by yvgude
The Context OS for AI Development. Reduce token waste in Cursor, Claude Code, Copilot, Windsurf, Codex, Gemini & more by 60–95% (up to 99% on cached reads) Shell Hook + MCP Server · 49 tools · 10 read modes · 90+ patterns · Single Rust binary
# Add to your Claude Code skills
git clone https://github.com/yvgude/lean-ctxLast scanned: 5/2/2026
{
"issues": [],
"status": "PASSED",
"scannedAt": "2026-05-02T06:11:19.331Z",
"semgrepRan": false,
"npmAuditRan": true,
"pipAuditRan": true
} ██╗ ███████╗ █████╗ ███╗ ██╗ ██████╗████████╗██╗ ██╗
██║ ██╔════╝██╔══██╗████╗ ██║ ██╔════╝╚══██╔══╝╚██╗██╔╝
██║ █████╗ ███████║██╔██╗ ██║ ██║ ██║ ╚███╔╝
██║ ██╔══╝ ██╔══██║██║╚██╗██║ ██║ ██║ ██╔██╗
███████╗███████╗██║ ██║██║ ╚████║ ╚██████╗ ██║ ██╔╝ ██╗
╚══════╝╚══════╝╚═╝ ╚═╝╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═╝
Context Runtime for AI Agents
lean-ctx is a local-first context runtime that compresses file reads + shell output before they reach the LLM. Cached re-reads drop to ~13 tokens.
full, map, signatures, diff, …) with graph-aware related files hintslean-ctx pack --pr builds a PR-ready context pack (changed files, related tests, impact, artifacts)lean-ctx pack create bundles Knowledge + Graph + Session + Gotchas into portable .lctxpkg files — share context across projects/teams with SHA-256 integrity, auto-load on session start, and smart merge (dedup facts, overlay graph)No comments yet. Be the first to share your thoughts!
lean-ctx serve for Streamable HTTP MCP + /v1/tools/call (used by the Cookbook + SDK)AI tool → (MCP tools + shell commands) → lean-ctx → your repo + CLI
ctx_* tools (read modes, caching, deltas, search, memory, multi-agent)# 1) Install (pick one)
curl -fsSL https://leanctx.com/install.sh | sh # universal (no Rust needed)
brew tap yvgude/lean-ctx && brew install lean-ctx # macOS / Linux
npm install -g lean-ctx-bin # Node.js
cargo install lean-ctx # Rust
pi install npm:pi-lean-ctx # Pi Coding Agent
# 2) Setup (shell + auto-detected AI tools)
lean-ctx setup
# 3) Verify
lean-ctx doctor
# 4) See the payoff
lean-ctx gain --live
lean-ctx wrapped --week
After setup, restart your shell and your editor/AI tool once so the MCP + hooks are active.
lean-ctx-offlean-ctx -c --raw "git status"lean-ctx updatelean-ctx doctor --jsonlean-ctx is a standard MCP server, so it works with any MCP-compatible client. Three integration modes are auto-selected per agent:
| Mode | How it works | Best for |
|---|---|---|
| CLI-Redirect | Agent calls lean-ctx directly via shell — zero MCP schema overhead | Agents with shell access |
| Hybrid | MCP for cached reads (13 tokens), CLI for shell + search | Mixed environments |
| Full MCP | All 57 tools via MCP protocol | Protocol-only agents |
| Agent | CLI | Hybrid | MCP | Setup |
|---|:---:|:---:|:---:|---|
| Cursor | ● | | | lean-ctx init --agent cursor |
| Codex CLI | ● | | | lean-ctx init --agent codex |
| Gemini CLI | ● | | | lean-ctx init --agent gemini |
| Claude Code | | ● | | lean-ctx init --agent claude |
| CRUSH | | ● | | lean-ctx init --agent crush |
| Hermes | | ● | | lean-ctx init --agent hermes |
| OpenCode | | ● | | lean-ctx init --agent opencode |
| Pi | | ● | | lean-ctx init --agent pi |
| Qoder | | ● | | lean-ctx init --agent qoder |
| Windsurf | | ● | | lean-ctx init --agent windsurf |
| GitHub Copilot | | ● | | lean-ctx init --agent copilot |
| Amp | | ● | | lean-ctx init --agent amp |
| Cline | | ● | | lean-ctx init --agent cline |
| Roo Code | | ● | | lean-ctx init --agent roo |
| Kiro | | ● | | lean-ctx init --agent kiro |
| Antigravity | | ● | | lean-ctx init --agent antigravity |
| Amazon Q | | ● | | lean-ctx init --agent amazonq |
| Qwen | | ● | | lean-ctx init --agent qwen |
| Trae | | ● | | lean-ctx init --agent trae |
| Verdent | | ● | | lean-ctx init --agent verdent |
| JetBrains IDEs | | | ● | lean-ctx init --agent jetbrains |
| QoderWork | | | ● | lean-ctx init --agent qoderwork |
| VS Code | | | ● | lean-ctx init --agent vscode |
| Zed | | | ● | lean-ctx init --agent zed |
| Neovim | | | ● | lean-ctx init --agent neovim |
| Emacs | | | ● | lean-ctx init --agent emacs |
| Sublime Text | | | ● | lean-ctx init --agent sublime |
Any MCP-compatible client works out of the box — the table above shows agents with first-class auto-setup.
Great fit if you…
Skip it if you…
--raw, but ROI is lower)Try these in any repo:
lean-ctx read rust/src/server/mod.rs -m map
lean-ctx -c "git log -n 5 --oneline"
lean-ctx gain --live
lean-ctx benchmark report .
demo/vhs demo/leanctx.tape
vhs demo/gain.tape
vhs demo/benchmark.tape
lean-ctx benchmark report .