llm-context: rule-based context packing for agents

llm-context

A CLI and MCP server that use set rules to pack only the project files a task needs for the model

  • 307 ★ on the repository
  • Last commit
  • Apache-2.0
CLI

Extended access

Why this level

  • The tool reads project files and copies their content to the clipboard or to output for the model
  • The agent writes rules and runs lc commands itself, so files you did not mean to share can end up in a pack
All reasons and checks

cyberchitta/llm-context.py

Install

In your terminal, with SkillFoxx CLI

npx skillfoxx add cli/llm-context

Detects the agents on your machine, shows the access level and pins the version.

Other ways to install

Access and checks

How we review

Extended accessThe tool runs code or makes network calls and only reads external data.

  • The tool reads project files and copies their content to the clipboard or to output for the model
  • The agent writes rules and runs lc commands itself, so files you did not mean to share can end up in a pack

This is third-party code. Review the repository files before installing.

What it does

llm-context solves the problem of selecting files for a model. A rule describes the choice once: which files are needed in full, which are enough as outlines and signatures, what to exclude. The tool builds a ready pack from the rule and tracks changes. The `lc-init` command creates a .llm-context directory in the project and installs the lc-curate-context skill into .claude/skills. With it the agent works out which files a task needs, writes a rule, checks it and packs the result for itself, for a chat or for a sub-agent. The check runs through `lc-preview`. It shows file lists and pack size, and also finds definitions that the selected code uses but that are missing from the selection. A pack reaches a sub-agent through a shell pipe. For chats there are two paths: an MCP server through which the model pulls missing files itself, or copying the pack to the clipboard. Rules compose from parts, and each part has its own category prefix.

Who it is for. For developers working with large repositories in Claude Code or Claude Desktop who want to give the model an exact file set in place of the whole project.

Good fit when

  • The repository is large and for an auth task the agent needs only a module, its tests and neighboring definitions
  • You want to hand a sub-agent a file pack through a pipe so it does not hunt for files itself
  • You want to repeat the same selection for code review and for documentation updates through separate rules
  • A chat without file access should pull missing files and learn when they changed
  • You need a preview of pack size to stay under the token limit

Not a fit when

  • The project is small and fits in context whole: handing over the files directly is simpler
  • You need the whole repository packed into one file without rules: Repomix or Code2Prompt fit better
  • The agent cannot run shell commands and there is no MCP client
  • You need semantic file labelling with embeddings: the tool selects files by rules and path patterns

Example request

Build focused context for the auth refactor: write a rule, check it with lc-preview and pack the files.

Limitations

Python and the uv manager are required. For Claude Code the skill installs automatically; in other agents you will have to read its files by hand in the .claude/skills/lc-curate-context directory. The commands accept a rule name only with the `-r` flag. That flag also routes output to stdout, and without it `lc-context` copies the pack to the clipboard, so a pipe gets only log lines.

A pack is always partial: the file listing is filtered by your .gitignore files and by the rule itself, so some files may not be mentioned at all. The pack header reports how many files are full, outlined and excerpted, and that is where to check what the model received. After an upgrade, any lc command refreshes the skill, rules and templates in place.

How to disable. Delete the .llm-context and .claude/skills/lc-curate-context directories from the project and uninstall the tool with uv tool uninstall llm-context. Remove the llm-context entry from the MCP config.

FAQ

How do I install llm-context for Claude Code?

Run uv tool install "llm-context>=0.6.0", go to the project root and run lc-init. Claude Code loads the installed skill by itself.

How do I connect llm-context as an MCP server?

Add a server to the client config with the command uvx and the arguments --from llm-context lc-mcp. With it the model requests missing files itself and sees changed ones through lc_missing, lc_changed, lc_outlines and lc_preview.

What is a rule in llm-context?

A file with a YAML header and optional Markdown text. The header sets a description, a composition of other rules and file lists: full-files for whole files and excerpted-files for files reduced to signatures and definitions. A rule name starts with a category prefix: prm, flt, ins, sty or exc.

How is llm-context different from Repomix?

Repomix packs a repository into one file. llm-context selects files by rules for a task, shows missing definitions and can fetch files on the model's request.

How do I hand a pack to a sub-agent?

Through a pipe: `lc-context -r tmp-prm-auth -a | claude -p 'your task'`. The `-a` flag turns the fetch instructions into shell commands, so the sub-agent pulls whatever was left out of the pack itself.

Discussion

No questions or reviews yet.

CLI tools

An MCP server in one binary: AI reads and edits files across several projects and runs your commands

MCP serverBroad access341Repository stars

A CLI that generates and maintains AI context files, CLAUDE.md, Cursor rules, AGENTS.md and Copilot instructions, keeping them accurate as code changes

CLIExtended access1.3KRepository stars

A local MCP server that indexes your code so the agent pulls the functions it needs instead of rereading whole files

MCP serverExtended access440Repository stars
Editors’ pick

Packs a repository into one LLM-ready file with token counts, code compression and secret filtering, also runs as an MCP server

CLIExtended access29.1KRepository stars

mcpdoc

MCP LLMS-TXT Documentation Server

An MCP server from LangChain that serves docs from the llms.txt files you choose, with auditable tool calls

MCP serverExtended access1KRepository stars

Comparison with similar tools

Entries that share the main search query, and how they differ.

EntryOfficialAuthenticationRepository starsMain difference
llm-context: rule-based context packing for agents (this entry)no307
Repomixnonot required29,063packs the whole repository into one file with token counting
Code2Promptno7,743builds a codebase into a prompt from templates, without agent-written rules

README in short

The main documentation lives in the lc-curate-context skill itself, down to troubleshooting. The front page is an entry point and describes three ways to work: the agent on its own, a sub-agent through a pipe and a chat.

README badge

Report a problem

Foxx AIllm-context: rule-based context packing for agents
Foxx AI

I am Foxx AI and I have already vetted this tool. Ask about install, setup or anything else, and I will keep it simple.