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.
Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx skills add yvgude/lean-ctx --skill templatesgit 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/skills/yvgude/lean-ctx/templates)<a href="https://agentmods.dev/skills/yvgude/lean-ctx/templates"><img src="https://agentmods.dev/badge/skills/yvgude/lean-ctx/templates/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/skills/yvgude/lean-ctx/templates"><img src="https://agentmods.dev/badge/skills/yvgude/lean-ctx/templates.svg" alt="Reviewed on agentmods" width="80" height="20"></a>- NVIDIA SkillSpector warn
SkillSpector: 2 findings, up to high
These are SkillSpector’s own severities. On a checked sample its high-severity flags on skills were ~96% false positives — a documented command, a public API, a “never do X” rule — so we show them as a caution to read, not a verdict. Why →
- high Tool Misuse · line 11 Tool calls are chained to bypass individual safety checks or escalate capabilities beyond what any single tool call would allow.Fix: Limit tool chaining depth and validate the output of each tool before passing it to the next. Require explicit user approval for multi-step chains.
- low Supply Chain · line 11 Remote code is downloaded and executed. This bypasses code review and could introduce malicious code.Fix: Avoid downloading and executing remote scripts. Use trusted packages from PyPI/npm. If remote fetch is required, verify checksums and use HTTPS.
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.00055 | $0.01076 |
| Opus 5.5 | $0.00022 | $0.00430 |
| Sonnet 5.5 | $0.00011 | $0.00215 |
| Haiku 4.5 | $0.00006 | $0.00108 |
Grade C, and why
lean-ctx scanned grade C with 2 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 7d 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.
Downloads and executes remote codehighSupply chain
curl | sh runs whatever the server returns today, which is not necessarily what it returned when this was reviewed.
which lean-ctx || curl -fsSL https://raw.githubusercontent.com/yvgude/lean-ctx/main/skills/lean-ctx/scripts/install.sh | bash Makes network callslowCapability
Not a fault in itself. Listed so you know the mod talks to something, and to what.
which lean-ctx || curl -fsSL https://raw.githubusercontent.com/yvgude/lean-ctx/main/skills/lean-ctx/scripts/install.sh | bash How it starts
The opening of the file, as written. The whole thing — 84 lines — stays where its author put it; the contents beside it link to each section on GitHub.
LeanCTX — Context Gateway for AI agents
Less context. More intelligence. LeanCTX provides local context selection, supported access and content controls, and evidence of observed context operations for existing agents: Select → Control → Learn → Prove. Learn means local task and knowledge continuity, not model training. Recovery depends on source or archive availability and access permissions. LeanCTX | SDK is the separate integration surface for applications.
lean-ctx shapes context before it reaches you: cached reads, compressed shell output, focused search, recovery to exact source. Two rules beat every detail:
- Fewer round trips beat smaller outputs. One call that answers the question is cheaper than three small ones. Never add a call just to save a few hundred tokens.
- Never wait by polling. Do not loop
sleep+ status checks (see below).
Intent → tool
| You want to… | Call |
|---|---|
| Understand how something works (unknown location) | ctx_compose(task) — ranked files + source in one call; use it FIRST instead of search→read→read |
| Find the exact definition of a symbol | ctx_search(action="symbol", name=…) |
| Find code by meaning | ctx_search(action="semantic", query=…) |
| Find a text/regex pattern | ctx_search(pattern=…, path=…) |
| Who calls X / what calls X makes | `ctx_callgraph(action="callers" |
| Read a file you will edit | ctx_read(path, mode="anchored") → edit with the host's native edit tool, or ctx_call(name="ctx_patch", arguments={…}) |
| Read a file only for context | `ctx_read(path, mode="signatures" |
| Re-check a file after editing | ctx_read(path, mode="diff") |
| Run a command (build, test, git, …) | ctx_shell(command) — output is compressed |
| List files / directory shape | ctx_glob(pattern) / ctx_tree(path, depth) |
| Remember across sessions | `ctx_session(action="finding" |
What ships with it
15 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.
- CLAUDE_GLOBAL.md 1.6 KB
- claude_mod_jobs/hooks.json 35 B
- claude_mod_jobs/plugin.json 1020 B
- claude_mod_jobs/register.ts 23 KB runs code
- claude_mod/cockpit.d.ts 3.3 KB runs code
- claude_mod/cockpit.tsx 64 KB
- claude_mod/hooks.json 35 B
- claude_mod/plugin.json 2.3 KB
- claude_mod/register.ts 21 KB runs code
- claude_mod/render.tsx 14 KB
- CLAUDE.md 2.2 KB
- PI_AGENTS_REPLACE.md 1.2 KB
- PI_AGENTS.md 2.1 KB
- skill_install.sh 4.1 KB runs code
- windsurfrules.txt 1.3 KB
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.
- 7d ago Changed 56d520ed54b4
- 26d ago Changed 238de3cbf947
- 1mo ago Changed · +1 lines d8387e920c3a
- 1mo ago Changed · +1 lines e0e832439ea0
- 1mo ago Changed · +6 lines 4bc69f7578cf
- 1mo ago Changed · +4 lines · +13 tokens per session de55dac0a4cc
- 3mo ago First seen · 72 lines · 42 tokens per session scan C 31febfba9276
lean-ctx is a skill published in the GitHub repository yvgude/lean-ctx (3,967 stars, last pushed 3d ago), licensed Apache-2.0. It adds 55 tokens to every session and 1,076 once invoked, about $0.0002 per session on Opus 5.5. A static security scan graded it C with 2 findings (downloads and executes remote code, makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.
lean-ctx compared with skills from other repositories
| Mod | Type | Stars | Last push | Licence | Scan | Tokens | Works with |
|---|---|---|---|---|---|---|---|
| lean-ctxyvgude/lean-ctx | Skill | 4.0k | 3d ago | Apache-2.0 | C | 55 | Claude Code, Codex |
| knowledge-basePinvou/pinvou-agent | Skill | 3.0k | today | MIT | A | 0 | Claude Code, Codex |
| notesPinvou/pinvou-agent | Skill | 3.0k | today | MIT | A | 0 | Claude Code, Codex |
| data-syncmoltis-org/moltis | Skill | 3.0k | 1mo ago | MIT | A | 46 | Claude Code, Codex |
| semantic-contracts-installerLLM-Coding/Semantic-Anchors | Skill | 549 | today | Apache-2.0 | A | 132 | Claude Code, Codex |
| karpathy-llm-wikiAstro-Han/karpathy-llm-wiki | Skill | 2.8k | 4mo ago | MIT | A | 67 | Claude Code, Codex |
| post-cortex-memoryjulymetodiev/post-cortex | Skill | 23 | yesterday | MIT | A | 194 | Claude Code |