Skip to main content

LLM Context

License PyPI version Downloads

Context curation your coding agent does for itself. lc-init installs a skill that teaches the agent to work out which files a task actually needs, write that down as a composable rule, check the rule against the codebase, and pack the result — for its own context, for a chat you paste into, or for a sub-agent it dispatches.

Getting the right context into an LLM is friction-heavy: finding and copying files by hand wastes time, too much context hits token limits, too little misses what matters, and follow-up file requests mean more manual fetching. The usual answers are to send everything, or to have a person curate by hand. A rule describes the selection once, and it is a thing an agent can author, verify and reuse — the tooling handles packing, follow-up fetches, and change tracking.

Documentation lives in the skill

The full documentation is the lc-curate-context skill, installed into your project by lc-init. It is written to be read by an agent, and it is the only copy — this README is a landing page, not a manual.

File Contents
SKILL.md Writing a rule; the workflow; packing for a sub-agent
COMMANDS.md CLI and MCP reference, including output routing
SYNTAX.md Rule file schema and every field
PATTERNS.md Reusable rule shapes
EXAMPLES.md Worked examples
TROUBLESHOOTING.md Failure cases

Find them at .claude/skills/lc-curate-context/ after lc-init. In Claude Code the skill loads automatically; elsewhere, read the files directly.

Installation

uv tool install "llm-context>=0.6.0"
cd <project-root>
lc-init          # creates .llm-context/, installs the skill into .claude/skills/

Upgrading: uv tool upgrade llm-context, then any lc-* command refreshes the skill, rules and templates in place.

Three ways to use it

Your coding agent, curating for itself — this is the primary path. After lc-init the agent has the lc-curate-context skill, so "get me focused context for the auth refactor" becomes a rule it writes and verifies without you naming files.

lc-preview -r tmp-prm-auth    # what does this rule actually select?

lc-preview reports the exact file lists, the size, and — via the code graph — files defining symbols the selection uses but does not include. That last section is how the agent catches the module it forgot, before spending a turn on a wrong answer.

A sub-agent, via a pipe — a dispatcher writes the prompt, llm-context supplies the files.

lc-context -r tmp-prm-auth -a | claude -p 'Your task here'

-r routes output to stdout; without it lc-context copies to the clipboard, so a pipe or redirect gets nothing but log lines. These commands take no bare positional rule name — always -r. -a renders the pack's fetch instructions as shell commands the child runs itself, so from the repo root it can call lc-missing against the pack's timestamp for anything left out. See SKILL.md "Packing for a Sub-Agent".

A chat, via MCP or the clipboard — for models that aren't driving a terminal.

{
  "mcpServers": {
    "llm-context": {
      "command": "uvx",
      "args": ["--from", "llm-context", "lc-mcp"]
    }
  }
}

With MCP the model pulls files it wasn't given and notices ones that changed underneath it, through lc_missing, lc_changed, lc_outlines and lc_preview. Without it, lc-select then lc-context puts the pack on your clipboard to paste anywhere.

Rules in one minute

A rule is YAML frontmatter plus optional markdown:

---
description: "Debug API authentication"
compose:
  filters: [lc/flt-no-files]
  excerpters: [lc/exc-base]
also-include:
  full-files: ["/src/auth/**", "/tests/auth/**"]
---
Focus on the authentication system and its tests.

You rarely write one by hand — the skill does, and lc-preview is how it checks its work. Rules compose, and are named by category: prm- produces a context, flt- controls file inclusion, ins- supplies guidelines, sty- enforces coding standards, exc- configures excerpting. Files you expect to edit go in full-files; supporting code goes in excerpted-files, where it is reduced to signatures and definitions. See SYNTAX.md and PATTERNS.md.

What a generated context contains

Complete contents for full files, structural excerpts for the rest, a filtered file listing marking what is and isn't included, and a timestamp that lc-missing and lc-changed resolve against.

A pack is always partial — the listing is filtered by your .gitignore files and by the rule before anything is marked excluded, so files can exist that it never mentions. The header reports how many files are full, outlined and excerpted, so a consumer can check what it actually received rather than trusting the rule.

Learn More

License

Apache License, Version 2.0. See LICENSE for details.


Developed in collaboration with several Claude models and Groks, using LLM Context itself to share code during development. All code is heavily human-curated by @restlessronin.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

llm_context-0.7.0.tar.gz (60.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

llm_context-0.7.0-py3-none-any.whl (89.9 kB view details)

Uploaded Python 3

File details

Details for the file llm_context-0.7.0.tar.gz.

File metadata

  • Download URL: llm_context-0.7.0.tar.gz
  • Upload date:
  • Size: 60.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.29 {"installer":{"name":"uv","version":"0.11.29","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for llm_context-0.7.0.tar.gz
Algorithm Hash digest
SHA256 56f897a894fdd4626d1836c8d2e50d66e0ba613641c83428b2de5aa74dc6847f
MD5 2e4b0c8ffac1bda7412fb0815b388b34
BLAKE2b-256 689f493495aadaa5e887e671c8e1c009d8239d0f4c288ac91a059b5348909fca

See more details on using hashes here.

File details

Details for the file llm_context-0.7.0-py3-none-any.whl.

File metadata

  • Download URL: llm_context-0.7.0-py3-none-any.whl
  • Upload date:
  • Size: 89.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.29 {"installer":{"name":"uv","version":"0.11.29","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for llm_context-0.7.0-py3-none-any.whl
Algorithm Hash digest
SHA256 18a9d694df248dafbf568257938149346958040cf6ee4e290d7c29d111e94cbf
MD5 36e71b985591d2b3d2225cdbad045dee
BLAKE2b-256 de663817acb4423cf8f9b1d26de4b6cb96f70e40fc4bd939626a5818f3a435b1

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.7.0 This release

2 files

0.6.3

2 files

0.6.2

2 files

0.6.1

2 files

0.6.0

2 files

0.5.2

2 files

0.5.1

2 files

0.5.0

2 files

0.4.1

2 files

0.4.0

2 files

0.3.4

2 files

0.3.3

2 files

0.3.2

2 files

0.3.1

2 files

0.3.0

2 files

0.2.18

2 files

0.2.17

2 files

0.2.16

2 files

0.2.15

2 files

0.2.14

2 files

0.2.13

2 files

0.2.12

2 files

0.2.11

2 files

0.2.10

2 files

0.2.9

2 files

0.2.8

2 files

0.2.7

2 files

0.2.6

2 files

0.2.5

2 files

0.2.4

2 files

0.2.3

2 files

0.2.2

2 files

0.2.1

2 files

0.2.0

2 files

0.1.0

2 files

0.0.14

2 files

0.0.13

2 files

0.0.12

2 files

0.0.11

2 files

0.0.10

2 files

0.0.9

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page