LeanCTX is a local Rust program that controls the repository context an AI coding agent receives, including selecting, compressing, remembering, and tracking information. Developers use it alongside coding agents to reduce repeated context and manage what those agents read and execute, while the catalogue entries provide related rules, skills, and instructions.
Borrowing it
Nothing to install: this file belongs to yvgude/lean-ctx. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.
curl -O https://raw.githubusercontent.com/yvgude/lean-ctx/main/AGENTS.mdgit clone --depth 1 https://github.com/yvgude/lean-ctxWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/instructions/yvgude/lean-ctx/agents-md)<a href="https://agentmods.dev/instructions/yvgude/lean-ctx/agents-md"><img src="https://agentmods.dev/badge/instructions/yvgude/lean-ctx/agents-md/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/instructions/yvgude/lean-ctx/agents-md"><img src="https://agentmods.dev/badge/instructions/yvgude/lean-ctx/agents-md.svg" alt="Reviewed on agentmods" width="80" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.05516 | $0.05516 |
| Opus 5.5 | $0.02206 | $0.02206 |
| Sonnet 5.5 | $0.01103 | $0.01103 |
| Haiku 4.5 | $0.00552 | $0.00552 |
Grade A, and why
lean-ctx AGENTS.md scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 394 lines — stays where its author put it; the contents beside it link to each section on GitHub.
LeanCTX — Context Gateway for AI Systems
LeanCTX | OSS selects context, applies supported access and content controls, and records observable context operations; compression is one capability within that path.
Shared Context Gateway delivery skill
For LeanCTX implementation, integration, release, or repository migration,
load skills/leanctx-gateway-delivery/SKILL.md.
Codex and Claude discover the same canonical content through the
.agents/skills/leanctx-gateway-delivery and
.claude/skills/leanctx-gateway-delivery links.
Mandatory Routing Decision (Direct or Swarm)
For every substantive task in this repository, load and follow
docs/internal/skills/agent-orchestration.md before taking task actions. The
routing decision is mandatory; a swarm is not. The lead uses 0 to 15
workers (0 = direct execution) and picks the path with the shortest
accepted-result time that keeps the full quality bar — the routing gate in the
skill defines how. Fifteen agents is a hard concurrent maximum; every worker
gets a distinct role. Security, redaction, public contracts/schemas,
migrations, releases, and data-loss risk normally get an independent reviewer.
This rule is owned by the orchestration lead. Agents with a concrete delegated subtask are swarm workers: they coordinate through lean-ctx and complete their assigned role, but do not recursively launch another swarm unless the lead explicitly asks them to do so.
- Runtime: every Codex CLI agent MUST use
--model gpt-6-lunaand-c 'model_reasoning_effort="max"'. - LeanCTX coordination: every agent registers on the lean-ctx agent bus, checks directives, and uses lean-ctx context tools; the lead records the integrated decision and progress through lean-ctx.
- Topology: assign independent, non-duplicative roles. When a reviewer is used on a non-parallel change, it validates the implementer's result after it is ready — including whether each new test earns its place (see Test Policy).
- Safe ownership: only one agent may edit a given file or shared worktree at a time. Parallel agents investigate, test, or review in isolation unless explicit file ownership or separate worktrees are assigned.
- Completion: the lead integrates the findings, runs the relevant quality gates, and reports the agents' evidence. A task is not complete merely because an agent returned successfully.
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 2d ago Changed · +32 lines · +577 tokens per session dbd3682d90d0
- 4d ago Changed · +51 lines · +788 tokens per session bad557b1c0b3
- 5d ago Changed · +48 lines · +726 tokens per session 873fb5463d8a
- 6d ago Changed · -12 lines · -67 tokens per session 8a5f124f8f8f
- 7d ago Changed · +25 lines · +558 tokens per session 0d17eaa5b1e6
- 20d ago Changed · +9 lines · +119 tokens per session a16f72eb5e61
- 1mo ago Changed · +11 tokens per session 764d93d73e99
- 1mo ago Changed · +40 lines · +581 tokens per session 7a310224d507
- 2mo ago First seen · 201 lines · 2,223 tokens per session scan A 6e41fa034d2e
lean-ctx AGENTS.md is an instructions file published in the GitHub repository yvgude/lean-ctx (3,931 stars, last pushed yesterday), licensed Apache-2.0. It adds 5,516 tokens to every session, about $0.0221 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.
lean-ctx AGENTS.md compared with instructions from other repositories
| Mod | Type | Stars | Last push | Licence | Scan | Tokens | Works with |
|---|---|---|---|---|---|---|---|
| lean-ctx AGENTS.mdyvgude/lean-ctx | Instructions file | 3.9k | yesterday | Apache-2.0 | A | 5,516 | Codex, OpenCode |
| vscode buildNext.instructions.mdmicrosoft/vscode | Instructions file | 195k | today | MIT | A | 9,719 | GitHub Copilot |
| next.js AGENTS.mdvercel/next.js | Instructions file | 143k | today | MIT | A | 7,461 | Codex, OpenCode |
| vscode oss-third-party-notices.instructions.mdmicrosoft/vscode | Instructions file | 195k | today | MIT | A | 5,516 | GitHub Copilot |
| langchain AGENTS.mdlangchain-ai/langchain | Instructions file | 149k | today | MIT | A | 4,680 | Codex, OpenCode |
| vscode copilot-instructions.mdmicrosoft/vscode | Instructions file | 195k | today | MIT | A | 3,093 | GitHub Copilot |
| deepseek-harness AGENTS.mddeepseek-ai/deepseek-harness | Instructions file | 274k | 2d ago | MIT | A | 4,313 | Codex, OpenCode |