by yvgude
Control what your AI can see. LeanCTX (Lean Context) is the context intelligence layer for AI agents — one local Rust binary that decides what they read, remembers what they learn, guards what they touch, and proves what they save. 60–90% fewer tokens as the receipt. 76 MCP tools, 30+ agents, local-first.
# Add to your Claude Code skills
git clone https://github.com/yvgude/lean-ctxGuides for using ai agents skills like lean-ctx.
Last scanned: 5/2/2026
{
"issues": [],
"status": "PASSED",
"scannedAt": "2026-05-02T06:11:19.331Z",
"semgrepRan": false,
"npmAuditRan": true,
"pipAuditRan": true
}LeanCTX — Lean Context Engineering for AI agents
LeanCTX — short for Lean Context — is the context engineering layer for AI agents. It runs as a single local binary between your agents and everything they touch — your code, shell, data, and the model itself: it decides what they read, compresses what they send (an optional local proxy shrinks every request — system prompt, history and tool results — prompt-cache-safe), remembers what they learn, guards what they touch — and proves what they save with a signed, verifiable savings ledger. The result: 60–90% fewer tokens — and that's the receipt, not the product. Zero config required. Local-first.
| Problem | With LeanCTX |
|---|---|
| Repeated file reads: ~2000 tokens each | Cached re-reads: ~13 tokens |
Raw git status: ~800 tokens |
Compressed: ~120 tokens |
| Every turn re-sends the whole history | Proxy compresses each request, prompt-cache-safe |
| Context resets every chat | Session memory persists across chats |
| No visibility into context usage | Real-time dashboard + budget control |
Control what your AI can see. LeanCTX — short for Lean Context — is the context engineering layer for AI agents: one local Rust binary that decides what your agents read, compresses what they send to the model, remembers what they learn, guards what they touch — and proves what they save.
Token savings are the receipt. Intelligence is the product. Works with Cursor, Claude Code, Copilot, Windsurf, Codex, Gemini and 30+ other agents — no config needed.
lean-ctx setup command, no config changes neededLeanCTX treats context as a managed resource, not an afterthought. One binary covers the four dimensions that decide how well an AI agent actually performs:
Your AI agent reads files and runs commands. LeanCTX compresses both automatically.
full, map, signatures, diff, lines:N-M, density:X, …) — cached re-reads cost ~13 tokensdensity:0.4): SDE-style budget compression — keeps the highest-entropy lines until ~40% of the original tokens remain, deterministicsignatures carries line spans and points at lines:N-M for targeted expansion — outline first, bodies on demandNot every file needs the same depth. LeanCTX sends the signal, not the noise.
ModePredictor: learns the optimal read mode per file type from past sessionsIntentEngine: classifies query complexity so simple lookups stay cheapContext doesn't disappear between chats anymore.
Performance is accuracy, not just speed. You stay in control of the window.
ctx_proof, ctx_verify): 4-layer verification engine with CI drift gatesctx_url_read): pull a public web page, PDF, or YouTube transcript into context as compressed, citation-backed text — facts/quotes return claims with a confidence score + source URL, relevance-ranked research-compression distils to a token budget, SSRF-guarded (http/https only)ctx_refactor): language-server-powered rename, references, go-to-definition via rust-analyzer, typescript-language-server, pylsp, goplsctx_agent, ctx_handoff): agent handoff with context transfer bundles, diary system, synchronized shared statectx_expand search_all): FTS5-powered cross-archive search over all previously archived tool outputslean-ctx pack --pr builds a PR-ready context pack (changed files, related tests, impact, artifacts)lean-ctx pack create bundles Knowledge + Graph + Session into portable .ctxpkg files with SHA-256 integritylean-ctx gain --live for real-time savings, lean-ctx wrapped for weekly/monthly summaries (gain --svg/--share for a shareable card or self-hostable page), lean-ctx watch for TUI monitoringlean-ctx is an open-source ai agents skill for AI coding assistants such as Claude Code, Codex CLI, and ChatGPT, built by yvgude. Control what your AI can see. LeanCTX (Lean Context) is the context intelligence layer for AI agents — one local Rust binary that decides what they read, remembers what they learn, guards what they touch, and proves what they save. 60–90% fewer tokens as the receipt. 76 MCP tools, 30+ agents, local-first. It has 2,885 GitHub stars.
Yes. lean-ctx passed SkillsLLM's automated security scan — a dependency vulnerability audit plus prompt-injection heuristics — with no high-severity issues. You can read the full report in the Security Report section on this page.
Clone the repository with "git clone https://github.com/yvgude/lean-ctx" and add it to your Claude Code skills directory (see the Installation section above).
lean-ctx is primarily written in Rust. It is open-source under yvgude on GitHub, so you can review or fork the full source.
Yes. SkillsLLM lists many other AI Agents skills you can browse and compare side by side. Open the AI Agents category from the badge at the top of this page, or use the Related Skills and comparison links further down to weigh lean-ctx against similar tools.
No comments yet. Be the first to share your thoughts!