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.01037 |
| Opus 5.5 | $0.00022 | $0.00415 |
| Sonnet 5.5 | $0.00011 | $0.00207 |
| Haiku 4.5 | $0.00006 | $0.00104 |
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 12d 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 — 82 lines — stays where its author put it; the contents beside it link to each section on GitHub.
LeanCTX — Context Gateway for AI Systems
Control what your AI can see. LeanCTX Engine provides local context selection, supported access and content controls, and evidence of observed context operations for existing agents: Select → Control → Prove. 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 ctx_patch, or the host's native edit tool |
| 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" |
Do not read or search through ctx_shell (cat, sed -n, grep, rg):
that bypasses the read cache and symbol index. Use ctx_read / ctx_search.
What ships with it
12 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.5 KB
- claude_mod/cockpit.d.ts 3.3 KB runs code
- claude_mod/cockpit.tsx 62 KB
- claude_mod/hooks.json 35 B
- claude_mod/plugin.json 2.9 KB
- claude_mod/register.ts 36 KB runs code
- claude_mod/render.tsx 11 KB
- CLAUDE.md 2.1 KB
- PI_AGENTS_REPLACE.md 1.2 KB
- PI_AGENTS.md 1.8 KB
- skill_install.sh 2.4 KB runs code
- windsurfrules.txt 1.1 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.
- 12d ago Changed · +6 lines 4bc69f7578cf
- 13d ago Changed · +4 lines · +13 tokens per session de55dac0a4cc
- 1mo 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,879 stars, last pushed yesterday), licensed Apache-2.0. It adds 55 tokens to every session and 1,037 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.
Other skills, from other repositories
data-sync
Sync and archive data from messaging platforms (WhatsApp, Discord, Slack, Twitter/X, Google) into Moltis memory as daily digest summaries. Orchestrates crawl tools and writes structured markdown to the memory system.
karpathy-llm-wiki
Use when building or maintaining a personal LLM-powered knowledge base. Triggers: ingesting sources into a wiki, querying wiki knowledge, linting wiki quality, 'add to wiki', 'what do I know about', or any mention of 'LLM wiki' or 'Karpathy wiki'.
ax-rust-agent-context
Use when writing Rust code with axllm for deciding between context maps, trajectory context policy, offline optimization (ACE/GEPA), and memory recall for long-context agents.
memory-systems
Guides implementation of agent memory systems, compares production frameworks (Mem0, Zep/Graphiti, Letta, LangMem, Cognee), and designs persistence architectures for cross-session knowledge retention. Use when the user asks to "implement agent memory", "persist state across sessions", "build knowledge graph for…
experience-record
Record lessons learned and implementation experiences for future reuse. Use when a task reveals a durable pattern, important decision, or debugging lesson worth preserving.
ax-rust-agent-memory-skills
Use when writing Rust code with axllm for agent memory, recall callbacks, dynamic skill discovery, loaded-skill state, and used-skill tracking.