{"id":47676801,"url":"https://github.com/yvgude/lean-ctx","last_synced_at":"2026-04-25T13:13:57.522Z","repository":{"id":346423246,"uuid":"1189918673","full_name":"yvgude/lean-ctx","owner":"yvgude","description":"Reduce AI coding costs by 99% — MCP Server + Shell Hook for Cursor, Claude Code, Copilot, Windsurf, Gemini CLI \u0026 24 tools. Single Rust binary, zero telemetry.","archived":false,"fork":false,"pushed_at":"2026-04-21T14:13:16.000Z","size":426798,"stargazers_count":734,"open_issues_count":1,"forks_count":87,"subscribers_count":7,"default_branch":"main","last_synced_at":"2026-04-21T15:05:05.667Z","etag":null,"topics":["agentic-coding","ai","ai-coding","claude-code","context-engineering","copilot","cursor","developer-tools","gemini-cli","llm","mcp","mcp-server","reduce-token-costs","rust","token-optimization"],"latest_commit_sha":null,"homepage":"https://leanctx.com","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/yvgude.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-03-23T19:48:59.000Z","updated_at":"2026-04-21T14:44:28.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/yvgude/lean-ctx","commit_stats":null,"previous_names":["yvgude/lean-ctx"],"tags_count":145,"template":false,"template_full_name":null,"purl":"pkg:github/yvgude/lean-ctx","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yvgude%2Flean-ctx","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yvgude%2Flean-ctx/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yvgude%2Flean-ctx/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yvgude%2Flean-ctx/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yvgude","download_url":"https://codeload.github.com/yvgude/lean-ctx/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yvgude%2Flean-ctx/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32263048,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-25T09:15:33.318Z","status":"ssl_error","status_checked_at":"2026-04-25T09:15:31.997Z","response_time":59,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["agentic-coding","ai","ai-coding","claude-code","context-engineering","copilot","cursor","developer-tools","gemini-cli","llm","mcp","mcp-server","reduce-token-costs","rust","token-optimization"],"created_at":"2026-04-02T13:33:35.284Z","updated_at":"2026-04-25T13:13:57.515Z","avatar_url":"https://github.com/yvgude.png","language":"Rust","readme":"```\n  ██╗     ███████╗ █████╗ ███╗   ██╗     ██████╗████████╗██╗  ██╗\n  ██║     ██╔════╝██╔══██╗████╗  ██║    ██╔════╝╚══██╔══╝╚██╗██╔╝\n  ██║     █████╗  ███████║██╔██╗ ██║    ██║        ██║    ╚███╔╝ \n  ██║     ██╔══╝  ██╔══██║██║╚██╗██║    ██║        ██║    ██╔██╗ \n  ███████╗███████╗██║  ██║██║ ╚████║    ╚██████╗   ██║   ██╔╝ ██╗\n  ╚══════╝╚══════╝╚═╝  ╚═╝╚═╝  ╚═══╝     ╚═════╝   ╚═╝   ╚═╝  ╚═╝\n             Context Runtime for AI Agents\n```\n\n\u003ch3 align=\"center\"\u003eReduce Claude Code, Cursor \u0026 Copilot Token Costs by 99% — Open Source MCP Server\u003c/h3\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003cstrong\u003eShell Hook + Context Server · 42 tools · 10 read modes · 90+ patterns · Single Rust binary\u003c/strong\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://github.com/yvgude/lean-ctx/actions/workflows/ci.yml\"\u003e\u003cimg src=\"https://github.com/yvgude/lean-ctx/actions/workflows/ci.yml/badge.svg\" alt=\"CI\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://github.com/yvgude/lean-ctx/actions/workflows/security-check.yml\"\u003e\u003cimg src=\"https://github.com/yvgude/lean-ctx/actions/workflows/security-check.yml/badge.svg\" alt=\"Security\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://crates.io/crates/lean-ctx\"\u003e\u003cimg src=\"https://img.shields.io/crates/v/lean-ctx?color=%23e6522c\" alt=\"crates.io\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://crates.io/crates/lean-ctx\"\u003e\u003cimg src=\"https://img.shields.io/crates/d/lean-ctx?color=%23e6522c\" alt=\"Downloads\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://www.npmjs.com/package/lean-ctx-bin\"\u003e\u003cimg src=\"https://img.shields.io/npm/v/lean-ctx-bin?label=npm\u0026color=%23cb3837\" alt=\"npm\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://www.npmjs.com/package/pi-lean-ctx\"\u003e\u003cimg src=\"https://img.shields.io/npm/v/pi-lean-ctx?label=pi-lean-ctx\u0026color=%23cb3837\" alt=\"pi-lean-ctx\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://aur.archlinux.org/packages/lean-ctx\"\u003e\u003cimg src=\"https://img.shields.io/aur/version/lean-ctx?color=%231793d1\" alt=\"AUR\"\u003e\u003c/a\u003e\n  \u003ca href=\"LICENSE\"\u003e\u003cimg src=\"https://img.shields.io/badge/License-Apache%202.0-blue.svg\" alt=\"License\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://discord.gg/pTHkG9Hew9\"\u003e\u003cimg src=\"https://img.shields.io/badge/Discord-Join-5865F2?logo=discord\u0026logoColor=white\" alt=\"Discord\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://x.com/leanctx\"\u003e\u003cimg src=\"https://img.shields.io/badge/𝕏-Follow-000000?logo=x\u0026logoColor=white\" alt=\"X/Twitter\"\u003e\u003c/a\u003e\n  \u003cimg src=\"https://img.shields.io/badge/Telemetry-Zero-brightgreen?logo=shield\u0026logoColor=white\" alt=\"Zero Telemetry\"\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://leanctx.com\"\u003eWebsite\u003c/a\u003e ·\n  \u003ca href=\"#-get-started-60-seconds\"\u003eInstall\u003c/a\u003e ·\n  \u003ca href=\"#-how-lean-ctx-reduces-ai-token-costs\"\u003eHow It Works\u003c/a\u003e ·\n  \u003ca href=\"#-42-intelligent-tools\"\u003eTools\u003c/a\u003e ·\n  \u003ca href=\"#-shell-hook-patterns-90\"\u003ePatterns\u003c/a\u003e ·\n  \u003ca href=\"CHANGELOG.md\"\u003eChangelog\u003c/a\u003e ·\n  \u003ca href=\"https://discord.gg/pTHkG9Hew9\"\u003eDiscord\u003c/a\u003e\n\u003c/p\u003e\n\n---\n\n\u003cbr\u003e\n\n\u003e **lean-ctx** reduces LLM token consumption by **up to 99%** through three complementary strategies in a single binary — making AI coding faster, cheaper, and more effective.\n\n\u003cbr\u003e\n\n## ⚡ How lean-ctx Reduces AI Token Costs\n\n```\n  Without lean-ctx:                              With lean-ctx:\n\n  LLM ──\"read auth.ts\"──▶ Editor ──▶ File       LLM ──\"ctx_read auth.ts\"──▶ lean-ctx ──▶ File\n    ▲                                  │           ▲                           │            │\n    │      ~2,000 tokens (full file)   │           │   ~13 tokens (cached)     │ cache+hash │\n    └──────────────────────────────────┘           └────── (compressed) ───────┴────────────┘\n\n  LLM ──\"git status\"──▶  Shell  ──▶  git        LLM ──\"git status\"──▶  lean-ctx  ──▶  git\n    ▲                                 │            ▲                       │              │\n    │     ~800 tokens (raw output)    │            │   ~150 tokens         │ compress     │\n    └─────────────────────────────────┘            └────── (filtered) ─────┴──────────────┘\n```\n\n| Strategy | How | Impact |\n|:---|:---|:---|\n| **Shell Hook** | Transparently compresses CLI output (90+ patterns) before it reaches the LLM | **60-95%** savings |\n| **Context Server** | 46 MCP tools for cached reads, 10 read modes, deltas, dedup, memory, multi-agent sharing, adaptive compression | **74-99%** savings |\n| **AI Tool Hooks** | One-command integration via `lean-ctx init --agent \u003ctool\u003e` | Works everywhere |\n\n\u003cbr\u003e\n\n## 🎯 Token Savings — Real Numbers\n\n| Operation | Freq | Without | With lean-ctx | Saved |\n|:---|:---:|---:|---:|:---:|\n| File reads (cached) | 15× | 30,000 | 195 | **99%** |\n| File reads (map mode) | 10× | 20,000 | 2,000 | **90%** |\n| ls / find | 8× | 6,400 | 1,280 | **80%** |\n| git status/log/diff | 10× | 8,000 | 2,400 | **70%** |\n| grep / rg | 5× | 8,000 | 2,400 | **70%** |\n| cargo/npm build | 5× | 5,000 | 1,000 | **80%** |\n| Test runners | 4× | 10,000 | 1,000 | **90%** |\n| curl (JSON) | 3× | 1,500 | 165 | **89%** |\n| docker ps/build | 3× | 900 | 180 | **80%** |\n| **Session total** | | **~89,800** | **~10,620** | **88%** |\n\n\u003e Based on typical Cursor/Claude Code sessions with medium TypeScript/Rust projects. Cached re-reads cost ~13 tokens.\n\n\u003cbr\u003e\n\n### Why lean-ctx?\n\nAI coding tools like **Cursor**, **Claude Code**, **GitHub Copilot**, **Windsurf**, and **Gemini CLI** send massive amounts of context to LLMs with every request. Each file read, git command, or directory listing consumes tokens — and tokens cost money. lean-ctx sits transparently between your AI tool and the LLM, compressing everything before it reaches the model. No workflow changes needed. Install once, save on every API call.\n\n**Common questions lean-ctx solves:**\n- \"How do I reduce Claude Code token costs?\" → Shell hook + MCP server compress all context automatically\n- \"Why is Cursor using so many tokens?\" → Uncompressed file reads and CLI output waste 60-99% of tokens  \n- \"How to optimize MCP server performance?\" → lean-ctx IS an optimized MCP server with 42 intelligent tools\n- \"Best way to reduce AI coding API costs?\" → Context compression saves $30-100+/month for active developers\n\n\u003cbr\u003e\n\n## 🚀 Get Started (60 seconds)\n\n```bash\n# 1. Install (pick one)\ncurl -fsSL https://leanctx.com/install.sh | sh      # universal (sh or bash), no Rust needed\n# or: curl -fsSL https://leanctx.com/install.sh | bash\nbrew tap yvgude/lean-ctx \u0026\u0026 brew install lean-ctx    # macOS / Linux\nnpm install -g lean-ctx-bin                          # Node.js\ncargo install lean-ctx                               # Rust\n\n# 2. Setup (auto-configures shell + ALL detected editors)\nlean-ctx setup\n\n# 3. Verify\nlean-ctx doctor\n```\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cstrong\u003eTroubleshooting\u003c/strong\u003e\u003c/summary\u003e\n\n| Problem | Fix |\n|:---|:---|\n| Commands broken? | Run `lean-ctx-off` (fixes current session) |\n| Permanent fix? | Run `lean-ctx uninstall` (removes all hooks) |\n| Binary missing? | Aliases auto-fallback to original commands (safe) |\n| Piped output garbled? | Update + run `lean-ctx setup` (adds pipe guard to shell hooks) |\n| Manual fix? | Edit `~/.zshrc`, remove the `lean-ctx shell hook` block |\n| Preview changes? | `lean-ctx init --global --dry-run` |\n| Diagnose? | `lean-ctx doctor` |\n\nlean-ctx creates a backup of your shell config before modifying it (`~/.zshrc.lean-ctx.bak`).\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cstrong\u003eUpdating lean-ctx\u003c/strong\u003e\u003c/summary\u003e\n\n```bash\nlean-ctx update                # self-update (recommended — refreshes binary, hooks, and shell aliases)\nbrew upgrade lean-ctx          # Homebrew\nnpm update -g lean-ctx-bin     # npm\ncargo install lean-ctx         # Cargo (rebuild from source)\n```\n\nAfter updating, restart your shell (`source ~/.zshrc`) and IDE to activate the new version.\n\n\u003e **Note:** Since v2.21.8, `lean-ctx update` automatically refreshes shell aliases in `~/.zshrc` / `~/.bashrc` / `config.fish`. If you update via Homebrew/npm/Cargo, run `lean-ctx setup` once to ensure your shell hooks are current.\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cstrong\u003eSupported editors (auto-detected by \u003ccode\u003elean-ctx setup\u003c/code\u003e)\u003c/strong\u003e\u003c/summary\u003e\n\n| Editor | Method | Status |\n|:---|:---|:---:|\n| **Cursor** | MCP + hooks + rules | ✅ Auto |\n| **Claude Code** | MCP + PreToolUse hooks + rules | ✅ Auto |\n| **GitHub Copilot** | MCP | ✅ Auto |\n| **Windsurf** | MCP + rules | ✅ Auto |\n| **VS Code** | MCP + rules | ✅ Auto |\n| **Zed** | Context Server (settings.json) | ✅ Auto |\n| **Codex CLI** | config.toml + AGENTS.md | ✅ Auto |\n| **Gemini CLI** | MCP + hooks + rules | ✅ Auto |\n| **OpenCode** | MCP + rules | ✅ Auto |\n| **Pi** | pi-lean-ctx npm package | ✅ Auto |\n| **Qwen Code** | MCP + rules | ✅ Auto |\n| **Trae** | MCP + rules | ✅ Auto |\n| **Amazon Q Developer** | MCP + rules | ✅ Auto |\n| **JetBrains IDEs** | MCP + rules | ✅ Auto |\n| **Google Antigravity** | MCP + rules | ✅ Auto |\n| **Cline / Roo Code** | MCP + rules | ✅ Auto |\n| **Aider** | Shell hook + rules | ✅ Auto |\n| **Amp** | Shell hook + rules | ✅ Auto |\n| **AWS Kiro** | MCP + steering file | ✅ Auto |\n| **Continue** | MCP + rules | ✅ Auto |\n| **Crush** | MCP + rules | ✅ Auto |\n\n\u003c/details\u003e\n\n\u003cbr\u003e\n\n## 🧠 Three Intelligence Protocols\n\n\u003ctable\u003e\n\u003ctr\u003e\n\u003ctd width=\"33%\"\u003e\n\n### CEP\n**Cognitive Efficiency Protocol**\n\nAdaptive LLM communication with compliance scoring (0-100), task complexity classification, quality scoring, auto-validation pipeline.\n\n*Measurable efficiency gains*\n\n\u003c/td\u003e\n\u003ctd width=\"33%\"\u003e\n\n### CCP\n**Context Continuity Protocol**\n\nCross-session memory that persists tasks, findings, decisions across chats. LITM-aware positioning for optimal attention placement.\n\n*-99.2% cold-start tokens*\n\n\u003c/td\u003e\n\u003ctd width=\"33%\"\u003e\n\n### TDD\n**Token Dense Dialect**\n\nSymbol shorthand (`λ` `§` `∂` `τ` `ε`) and ROI-based identifier mapping for compact LLM communication.\n\n*8-25% extra savings*\n\n\u003c/td\u003e\n\u003c/tr\u003e\n\u003c/table\u003e\n\n\u003cbr\u003e\n\n## 🛠 42 Intelligent Tools\n\n### Core\n\n| Tool | Purpose | Savings |\n|:---|:---|:---:|\n| `ctx_read` | File reads — 8 modes + `lines:N-M`, caching, `fresh=true` | 74-99% |\n| `ctx_multi_read` | Multiple file reads in one round trip | 74-99% |\n| `ctx_tree` | Directory listings (ls, find, Glob) | 34-60% |\n| `ctx_shell` | Shell commands with 90+ compression patterns, cwd tracking | 60-90% |\n| `ctx_search` | Code search (Grep) | 50-80% |\n| `ctx_compress` | Context checkpoint for long conversations | 90-99% |\n\n### Intelligence\n\n| Tool | What it does |\n|:---|:---|\n| `ctx_smart_read` | Adaptive mode — auto-picks full/map/signatures/diff based on file type and cache |\n| `ctx_delta` | Incremental updates — only sends changed hunks via Myers diff |\n| `ctx_dedup` | Cross-file deduplication — finds shared imports and boilerplate |\n| `ctx_fill` | Priority-based context filling — maximizes info within a token budget |\n| `ctx_intent` | Semantic intent detection — classifies queries and auto-loads files |\n| `ctx_response` | Response compression — removes filler, applies TDD |\n| `ctx_context` | Multi-turn session overview — tracks what the LLM already knows |\n| `ctx_graph` | Project intelligence graph — dependency analysis + related file discovery |\n| `ctx_discover` | Shell history analysis — finds missed compression opportunities |\n| `ctx_edit` | Search-and-replace file editing — works without native Read/Edit tools |\n| `ctx_overview` | Task-relevant project map — use at session start |\n| `ctx_preload` | Proactive context loader — caches task-relevant files, returns compact summary |\n| `ctx_semantic_search` | BM25 code search by meaning — finds symbols and patterns across the project |\n| `ctx_impact` | Measures impact of code changes via dependency chain analysis |\n| `ctx_architecture` | Generates architectural overview from dependency graph and module structure |\n| `ctx_heatmap` | File access heatmap — tracks read counts, compression ratios, access patterns |\n\n### Memory \u0026 Multi-Agent\n\n| Tool | What it does |\n|:---|:---|\n| `ctx_session` | Cross-session memory — persist task, findings, decisions across chats |\n| `ctx_knowledge` | Persistent project knowledge — remember facts, recall by query/category |\n| `ctx_agent` | Multi-agent coordination — register, post/read scratchpad, handoff tasks, sync status |\n| `ctx_share` | Multi-agent context sharing — push/pull cached file contexts between agents |\n| `ctx_wrapped` | Shareable savings report — \"Spotify Wrapped\" for your tokens |\n| `ctx_task` | A2A task orchestration — create, assign, update, complete multi-agent tasks |\n| `ctx_cost` | Cost attribution per agent — record, summarize, track token usage |\n\n### Analysis\n\n| Tool | What it does |\n|:---|:---|\n| `ctx_benchmark` | Single-file or project-wide benchmark with preservation scores |\n| `ctx_metrics` | Session statistics with USD cost estimates |\n| `ctx_analyze` | Shannon entropy analysis + mode recommendation |\n| `ctx_cache` | Cache management: status, clear, invalidate |\n\n### Integrations\n\n| Package | What it provides |\n|:---|:---|\n| **VS Code Extension** (`packages/vscode-lean-ctx`) | Status bar token savings, one-click setup, MCP auto-config |\n| **Chrome Extension** (`packages/chrome-lean-ctx`) | Auto-compress pastes in ChatGPT, Claude, Gemini via native messaging |\n\n\u003cbr\u003e\n\n## 📖 ctx_read Modes\n\n| Mode | When to use | Token cost |\n|:---|:---|:---|\n| `full` | Files you will edit (cached re-reads ≈ 13 tokens) | 100% first, ~0% cached |\n| `map` | Understanding a file — deps + exports + API | ~5-15% |\n| `signatures` | API surface with more detail than map | ~10-20% |\n| `diff` | Re-reading files that changed | changed lines only |\n| `aggressive` | Large files with boilerplate | ~30-50% |\n| `entropy` | Repetitive patterns (Shannon + Jaccard filtering) | ~20-40% |\n| `task` | Task-relevant content via Information Bottleneck + KG filtering | ~15-35% |\n| `lines:N-M` | Specific ranges (e.g. `lines:10-50,80-90`) | proportional |\n\n\u003cbr\u003e\n\n## 🔌 Shell Hook Patterns (90+)\n\nPattern-based compression for **90+ commands** across **34 categories**:\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cstrong\u003eView all 34 categories\u003c/strong\u003e\u003c/summary\u003e\n\n| Category | Commands | Savings |\n|:---|:---|:---:|\n| **Git** (19) | status, log, diff, add, commit, push, pull, fetch, clone, branch, checkout, switch, merge, stash, tag, reset, remote, blame, cherry-pick | 70-95% |\n| **Docker** (10) | build, ps, images, logs, compose ps/up/down, exec, network, volume, inspect | 70-90% |\n| **npm/pnpm/yarn** (6) | install, test, run, list, outdated, audit | 70-90% |\n| **Cargo** (3) | build, test, clippy | 80% |\n| **GitHub CLI** (9) | pr list/view/create/merge, issue list/view/create, run list/view | 60-80% |\n| **Kubernetes** (8) | get pods/services/deployments, logs, describe, apply, delete, exec, top, rollout | 60-85% |\n| **Python** (7) | pip install/list/outdated/uninstall/check, ruff check/format | 60-80% |\n| **Ruby** (4) | rubocop, bundle install/update, rake test, rails test | 60-85% |\n| **Linters** (4) | eslint, biome, prettier, stylelint | 60-70% |\n| **Build Tools** (3) | tsc, next build, vite build | 60-80% |\n| **Test Runners** (8) | jest, vitest, pytest, go test, playwright, cypress, rspec, minitest | 90% |\n| **Terraform** | init, plan, apply, destroy, validate, fmt, state, import, workspace | 60-85% |\n| **Make** | make targets, parallel jobs, dry-run | 60-80% |\n| **Maven / Gradle** | compile, test, package, install, clean, dependency trees | 60-85% |\n| **.NET** | dotnet build, test, restore, run, publish, pack | 60-85% |\n| **Flutter / Dart** | flutter pub, analyze, test, build; dart pub, analyze, test | 60-85% |\n| **Poetry / uv** | install, sync, lock, run, add, remove; uv pip/sync/run | 60-85% |\n| **AWS** (7) | s3, ec2, lambda, cloudformation, ecs, logs, sts | 60-80% |\n| **Databases** (2) | psql, mysql/mariadb | 50-80% |\n| **Prisma** (6) | generate, migrate, db push/pull, format, validate | 70-85% |\n| **Helm** (5) | list, install, upgrade, status, template | 60-80% |\n| **Bun** (3) | test, install, build | 60-85% |\n| **Deno** (5) | test, lint, check, fmt, task | 60-85% |\n| **Swift** (3) | test, build, package resolve | 60-80% |\n| **Zig** (2) | test, build | 60-80% |\n| **CMake** (3) | configure, build, ctest | 60-80% |\n| **Ansible** (2) | playbook recap, task summary | 60-80% |\n| **Composer** (3) | install, update, outdated | 60-80% |\n| **Mix** (5) | test, deps, compile, format, credo/dialyzer | 60-80% |\n| **Bazel** (3) | test, build, query | 60-80% |\n| **systemd** (2) | systemctl, journalctl | 50-80% |\n| **Utils** (5) | curl, grep/rg, find, ls, wget | 50-89% |\n| **Data** (3) | env (filtered), JSON schema extraction, log dedup | 50-80% |\n\n\u003c/details\u003e\n\nAfter `lean-ctx init --global`, **23 commands** are transparently compressed via shell aliases:\n\n```\ngit · npm · pnpm · yarn · cargo · docker · docker-compose · kubectl · k\ngh · pip · pip3 · ruff · go · golangci-lint · eslint · prettier · tsc\nls · find · grep · curl · wget\n```\n\n\u003cbr\u003e\n\n## 👀 Examples\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cstrong\u003eDirectory listing\u003c/strong\u003e — 239 → 46 tokens (-81%)\u003c/summary\u003e\n\n```\n# ls -la src/                               # lean-ctx -c \"ls -la src/\"\ntotal 96                                     core/\ndrwxr-xr-x  4 user staff  128 ...           tools/\ndrwxr-xr-x  11 user staff 352 ...           cli.rs  9.0K\n-rw-r--r--  1 user staff  9182 ...           main.rs  4.0K\n-rw-r--r--  1 user staff  4096 ...           server.rs  11.9K\n...                                          shell.rs  5.2K\n                                             4 files, 2 dirs\n                                             [lean-ctx: 239→46 tok, -81%]\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cstrong\u003eFile reading (map mode)\u003c/strong\u003e — 2,078 → ~30 tokens (-99%)\u003c/summary\u003e\n\n```\n# Full read (284 lines, ~2078 tokens)       # lean-ctx read stats.rs -m map (~30 tokens)\nuse serde::{Deserialize, Serialize};         stats.rs [284L]\nuse std::collections::HashMap;                 deps: serde::\nuse std::path::PathBuf;                        exports: StatsStore, load, save, record, format_gain\n                                               API:\n#[derive(Serialize, Deserialize)]                cl ⊛ StatsStore\npub struct StatsStore {                          fn ⊛ load() → StatsStore\n    pub total_commands: u64,                     fn ⊛ save(store:\u0026StatsStore)\n    pub total_input_tokens: u64,                 fn ⊛ record(command:s, input_tokens:n, output_tokens:n)\n    ...                                          fn ⊛ format_gain() → String\n(284 more lines)                             [2078 tok saved (100%)]\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cstrong\u003ecurl (JSON)\u003c/strong\u003e — 127 → 14 tokens (-89%)\u003c/summary\u003e\n\n```\n# curl -s httpbin.org/json                   # lean-ctx -c \"curl -s httpbin.org/json\"\n{                                            JSON (428 bytes):\n  \"slideshow\": {                             {\n    \"author\": \"Yours Truly\",                   slideshow: {4K}\n    \"date\": \"date of publication\",           }\n    \"slides\": [                              [lean-ctx: 127→14 tok, -89%]\n      {\n        \"title\": \"Wake up to WonderWidgets!\",\n        ...\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cstrong\u003eVisual terminal dashboard\u003c/strong\u003e\u003c/summary\u003e\n\n```\n$ lean-ctx gain\n\n  ◆ lean-ctx  Token Savings Dashboard\n  ────────────────────────────────────────────────────────\n\n   1.7M          76.8%         520          $33.71\n   tokens saved   compression    commands       USD saved\n\n  Cost Breakdown  (@ $2.50/M input, $10/M output)\n  ────────────────────────────────────────────────────────\n  Without lean-ctx    $44.75  ($5.79 input + $38.96 output)\n  With lean-ctx       $11.04  ($1.76 input + $9.28 output)\n  Saved               $33.71  ($4.03 input + $29.68 output)\n\n  Top Commands\n  ────────────────────────────────────────────────────────\n  curl                48x  ████████████████████ 728.1K  97%\n  git commit          34x  ██████████▎          375.2K  50%\n  ctx_read           103x  █▌                    59.1K  38%\n    ... +33 more commands\n\n  lean-ctx v2.19.0  |  leanctx.com  |  lean-ctx dashboard\n```\n\n\u003c/details\u003e\n\n\u003cbr\u003e\n\n## 🔬 Scientific Compression Engine\n\nBuilt on information theory and attention modeling (v2.6):\n\n| Feature | What it does | Impact |\n|:---|:---|:---:|\n| **Adaptive Entropy** | Per-language BPE entropy + Jaccard thresholds with Kolmogorov adjustment | 10-25% |\n| **Attention Model** | Heuristic U-curve positional weighting + structural importance scoring | ↑ comprehension |\n| **TF-IDF Codebook** | Cross-file pattern dedup via cosine similarity | 5-15% |\n| **Feedback Loop** | Learns optimal thresholds per language/file type across sessions | auto-improving |\n| **Info Bottleneck** | Entropy + task-relevance filtering (Tishby et al., 2000) | 20-40% |\n| **ctx_overview** | Multi-resolution project map with graph-based relevance tiers | 90%+ |\n\n\u003cbr\u003e\n\n## 🌳 tree-sitter Signature Engine\n\nAST-based signature extraction for **18 languages**: TypeScript, JavaScript, Rust, Python, Go, Java, C, C++, Ruby, C#, Kotlin, Swift, PHP, Bash, Dart, Scala, Elixir, Zig.\n\n| Capability | Regex (old) | tree-sitter |\n|:---|:---:|:---:|\n| Multi-line signatures | ✗ | ✓ |\n| Arrow functions | ✗ | ✓ |\n| Nested classes/methods | Heuristic | AST scope |\n| Languages | 4 | **14** |\n\nBuild without tree-sitter for a smaller binary (~5.7 MB vs ~17 MB):\n\n```bash\ncargo install lean-ctx --no-default-features\n```\n\n\u003cbr\u003e\n\n## 📊 CLI Commands\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cstrong\u003eShell Hook\u003c/strong\u003e\u003c/summary\u003e\n\n```bash\nlean-ctx -c \"git status\"       # Execute + compress output\nlean-ctx exec \"cargo build\"    # Same as -c\nlean-ctx shell                 # Interactive REPL with compression\nlean-ctx bypass \"git diff\"     # Guaranteed zero compression\nlean-ctx safety-levels         # Show compression transparency table\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cstrong\u003eFile Operations\u003c/strong\u003e\u003c/summary\u003e\n\n```bash\nlean-ctx read file.rs                         # Full content (structured header)\nlean-ctx read file.rs -m map                  # Deps + API signatures (~10% tokens)\nlean-ctx read file.rs -m signatures           # Function/class signatures only\nlean-ctx read file.rs -m aggressive           # Syntax-stripped (~40% tokens)\nlean-ctx read file.rs -m entropy              # Shannon entropy filtered (~30%)\nlean-ctx read file.rs -m \"lines:10-50,80-90\"  # Specific line ranges\nlean-ctx diff file1.rs file2.rs               # Compressed file diff\nlean-ctx grep \"pattern\" src/                  # Grouped search results\nlean-ctx find \"*.rs\" src/                     # Compact find results\nlean-ctx ls src/                              # Token-optimized directory listing\nlean-ctx deps .                               # Project dependencies summary\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cstrong\u003eSetup \u0026 Analytics\u003c/strong\u003e\u003c/summary\u003e\n\n```bash\nlean-ctx setup                 # One-command setup: shell + editors + verify\nlean-ctx init --global         # Install shell aliases (file-based)\neval \"$(lean-ctx init zsh)\"   # Eval-based init (like starship/zoxide)\nlean-ctx init --agent claude   # Claude Code hook\nlean-ctx init --agent cursor   # Cursor hooks.json\nlean-ctx init --agent gemini   # Gemini CLI hook\nlean-ctx init --agent codex    # Codex AGENTS.md\nlean-ctx init --agent windsurf # .windsurfrules\nlean-ctx init --agent cline    # .clinerules\nlean-ctx init --agent kiro     # AWS Kiro (MCP + steering file)\nlean-ctx init --agent crush    # Crush by Charmbracelet\nlean-ctx init --agent pi       # Pi Coding Agent extension\nlean-ctx gain                  # Visual terminal dashboard\nlean-ctx gain --live           # Live auto-updating dashboard\nlean-ctx gain --graph          # ASCII chart (30 days)\nlean-ctx gain --daily          # Day-by-day breakdown\nlean-ctx gain --json           # Raw JSON export\nlean-ctx dashboard             # Web dashboard (localhost:3333)\nlean-ctx cheatsheet            # Quick reference\nlean-ctx discover              # Find uncompressed commands\nlean-ctx doctor                # Diagnostics\nlean-ctx update                # Self-update\nlean-ctx wrapped               # Shareable savings report\nlean-ctx benchmark run         # Real project benchmark\nlean-ctx benchmark report      # Markdown report\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cstrong\u003eDocker / CI (non-interactive bash)\u003c/strong\u003e\u003c/summary\u003e\n\nIn Docker/CI, AI agents often run commands via `bash -c` (non-interactive). Many distros skip `~/.bashrc` entirely in that mode, so the reliable hook point is `BASH_ENV`.\n\nRecommended Dockerfile order:\n\n```dockerfile\n# After installing lean-ctx\nRUN lean-ctx bootstrap\nENV BASH_ENV=\"/root/.lean-ctx/env.sh\"\n```\n\nIf you install Claude Code in the container, lean-ctx’s `env.sh` includes a **self-heal** block that re-injects the `lean-ctx` MCP server if Claude overwrote `~/.claude.json` on first start.\n\nTroubleshooting:\n\n- `lean-ctx doctor`\n- `lean-ctx doctor --fix`\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cstrong\u003eMulti-Agent Launcher\u003c/strong\u003e\u003c/summary\u003e\n\n```bash\nlctx                              # Auto-detect agent, current dir\nlctx --agent claude               # Launch Claude Code with lean-ctx\nlctx --agent cursor               # Configure Cursor\nlctx --agent gemini               # Launch Gemini CLI\nlctx /path/to/project \"prompt\"    # Project + prompt\nlctx --scan-only                  # Build project graph only\n```\n\n\u003c/details\u003e\n\n\u003cbr\u003e\n\n## ⚙️ Editor Configuration\n\n\u003e **`lean-ctx setup` handles this automatically.** Manual config below is only needed for edge cases.\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cstrong\u003eCursor\u003c/strong\u003e\u003c/summary\u003e\n\n`~/.cursor/mcp.json`:\n```json\n{\n  \"mcpServers\": {\n    \"lean-ctx\": { \"command\": \"lean-ctx\" }\n  }\n}\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cstrong\u003eGitHub Copilot\u003c/strong\u003e\u003c/summary\u003e\n\n`.github/copilot/mcp.json`:\n```json\n{\n  \"servers\": {\n    \"lean-ctx\": { \"command\": \"lean-ctx\" }\n  }\n}\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cstrong\u003eClaude Code\u003c/strong\u003e\u003c/summary\u003e\n\n```bash\nlean-ctx init --agent claude\n\n# If you need manual wiring:\nclaude mcp add-json --scope user lean-ctx \u003c\u003c'JSON'\n{\"command\":\"lean-ctx\"}\nJSON\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cstrong\u003eWindsurf\u003c/strong\u003e\u003c/summary\u003e\n\n`~/.codeium/windsurf/mcp_config.json`:\n```json\n{\n  \"mcpServers\": {\n    \"lean-ctx\": { \"command\": \"lean-ctx\" }\n  }\n}\n```\n\n\u003e If tools don't load, use the full path (e.g., `/Users/you/.cargo/bin/lean-ctx`). Windsurf spawns MCP servers with a minimal PATH.\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cstrong\u003eZed\u003c/strong\u003e\u003c/summary\u003e\n\n`~/.config/zed/settings.json`:\n```json\n{\n  \"context_servers\": {\n    \"lean-ctx\": {\n      \"source\": \"custom\",\n      \"command\": \"lean-ctx\",\n      \"args\": [],\n      \"env\": {}\n    }\n  }\n}\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cstrong\u003eOpenAI Codex\u003c/strong\u003e\u003c/summary\u003e\n\n`~/.codex/config.toml`:\n```toml\n[mcp_servers.lean-ctx]\ncommand = \"lean-ctx\"\nargs = []\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cstrong\u003eGemini CLI\u003c/strong\u003e\u003c/summary\u003e\n\n`~/.gemini/settings/mcp.json`:\n```json\n{\n  \"mcpServers\": {\n    \"lean-ctx\": { \"command\": \"lean-ctx\" }\n  }\n}\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cstrong\u003ePi Coding Agent\u003c/strong\u003e\u003c/summary\u003e\n\n```bash\nlean-ctx init --agent pi\n# Or: pi install npm:pi-lean-ctx\n```\n\nPi's `bash`, `read`, `grep`, `find`, and `ls` tools are automatically routed through lean-ctx. Supports 55+ file extensions with auto mode selection.\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cstrong\u003eOpenCode\u003c/strong\u003e\u003c/summary\u003e\n\n`~/.config/opencode/opencode.json`:\n```json\n{\n  \"$schema\": \"https://opencode.ai/config.json\",\n  \"mcp\": {\n    \"lean-ctx\": {\n      \"type\": \"local\",\n      \"command\": [\"lean-ctx\"],\n      \"enabled\": true\n    }\n  }\n}\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cstrong\u003eHermes Agent\u003c/strong\u003e\u003c/summary\u003e\n\n`~/.hermes/config.yaml`:\n```yaml\nmcp_servers:\n  lean-ctx:\n    command: \"lean-ctx\"\n    args: [\"mcp\"]\n```\n\n**Tool naming**: Hermes prefixes all MCP tools with `mcp_\u003cserver\u003e_`, so lean-ctx tools appear as `mcp_lean_ctx_ctx_read`, `mcp_lean_ctx_ctx_shell`, etc. This is standard Hermes behavior.\n\n**Reduce tool count** (recommended for smaller models):\n```yaml\nmcp_servers:\n  lean-ctx:\n    command: \"lean-ctx\"\n    args: [\"mcp\"]\n    tools:\n      include: [ctx_read, ctx_shell, ctx_search, ctx_tree, ctx_edit, ctx_session]\n```\n\n\u003c/details\u003e\n\n\u003cbr\u003e\n\n## 🎛 Tool Modes \u0026 Context Optimization\n\nlean-ctx exposes tools in three modes. Choose based on your model's context window:\n\n| Mode | Tools | Schema tokens | Best for | Env var |\n|:---|:---:|:---:|:---|:---|\n| **Granular** (default) | ~46 | ~15-20K | Cursor, Claude Code, Codex (large context) | _(default)_ |\n| **Lazy** | 9 + discover | ~3-4K | Hermes, Ollama, smaller models | `LEAN_CTX_LAZY_TOOLS=1` |\n| **Unified** | 5 | ~2K | Extreme optimization | `LEAN_CTX_UNIFIED=1` |\n\n**Lazy mode** exposes only core tools (`ctx_read`, `ctx_shell`, `ctx_search`, `ctx_tree`, `ctx_edit`, `ctx_session`, `ctx_knowledge`, `ctx_multi_read`) plus `ctx_discover_tools` for on-demand loading of additional tools.\n\n### Disabling specific tools\n\nVia config (`~/.lean-ctx/config.toml`):\n```toml\ndisabled_tools = [\"ctx_graph\", \"ctx_architecture\", \"ctx_heatmap\"]\n```\n\nVia environment variable:\n```bash\nexport LEAN_CTX_DISABLED_TOOLS=\"ctx_graph,ctx_architecture,ctx_heatmap\"\n```\n\n### Rules file placement\n\nBy default, `lean-ctx setup` and `lean-ctx init --agent` install agent rule files in **both** the home directory (global) and the current project (project-local). To avoid duplicates and save context tokens, configure the placement scope:\n\nVia config (`~/.lean-ctx/config.toml`):\n```toml\nrules_scope = \"global\"    # only home-dir rules (~/.claude/rules/, ~/.cursor/rules/, etc.)\n# rules_scope = \"project\" # only project-local rules (.claude/rules/, .cursor/rules/, etc.)\n# rules_scope = \"both\"    # default — install everywhere\n```\n\nVia environment variable:\n```bash\nexport LEAN_CTX_RULES_SCOPE=\"project\"\n```\n\nVia CLI:\n```bash\nlean-ctx config set rules_scope global\n```\n\nPer-project override via `.lean-ctx.toml` in the project root:\n```toml\nrules_scope = \"project\"\n```\n\n### Path access outside project root\n\nBy default, lean-ctx restricts file access to the project root for security. To allow access to additional directories:\n\n```bash\nexport LCTX_ALLOW_PATH=\"/home/user/.codex:/home/user/shared-data\"\n```\n\nWhen running inside Codex CLI (`CODEX_CLI_SESSION` set), `~/.codex` is automatically allowed. When running inside Claude Code, `~/.claude` is automatically allowed.\n\n\u003cbr\u003e\n\n## 🏆 lean-ctx vs Alternatives (Rust Token Killer, context-mode)\n\n| Feature | Rust Token Killer | lean-ctx |\n|:---|:---:|:---:|\n| Architecture | Shell hook only | **Shell hook + MCP server** |\n| Process model | Spawns per command | **Persistent server** (no EAGAIN) |\n| CLI patterns | ~50 | **90+** |\n| File reading | Signatures only | **8 modes** (full, map, signatures, diff, aggressive, entropy, task, lines) |\n| File caching | ✗ | ✓ (re-reads ≈ 13 tokens) |\n| Signature engine | Regex (4 langs) | **tree-sitter AST (18 langs)** |\n| Dependency maps | ✗ | ✓ |\n| Context checkpoints | ✗ | ✓ |\n| Token counting | Estimated | **tiktoken-exact** |\n| Entropy analysis | ✗ | ✓ |\n| Cost tracking | ✗ | ✓ (USD estimates) |\n| TDD mode | ✗ | ✓ (8-25% extra) |\n| Thinking reduction | ✗ | ✓ (CRP v2) |\n| Cross-session memory | ✗ | ✓ (CCP) |\n| LITM positioning | ✗ | ✓ |\n| Multi-agent sharing | ✗ | ✓ |\n| Project knowledge store | ✗ | ✓ |\n| Web dashboard | ✗ | ✓ |\n| Savings reports | ✗ | ✓ (`wrapped`) |\n| Raw mode / bypass | ✓ | ✓ (`raw=true`, `--raw`, `lean-ctx-raw`, `lean-ctx bypass`) |\n| User-defined filters | TOML rules | **TOML rules** (priority over builtins) |\n| Full output recovery | `tee` | ✓ (`tee_mode: always/failures/never`) |\n| Truncation warnings | ✗ | ✓ (transparent markers) |\n| ANSI auto-strip | ✗ | ✓ (pre-compression) |\n| Telemetry | **Default ON (PII)** | **Zero. None. Ever.** |\n| Editor support | 3 editors | **24 editors/tools** |\n\n\u003cbr\u003e\n\n## 🔐 Privacy \u0026 Security\n\nlean-ctx is **privacy-first by design**:\n\n- **Zero telemetry** — no data collection, no analytics, no phone-home, ever\n- **Zero network requests** — everything runs locally on your machine\n- **No PII exposure** — no hostnames, usernames, or project paths leave your system\n- **Fully auditable** — Apache 2.0 licensed, single Rust binary, no hidden dependencies\n\nSee [SECURITY.md](SECURITY.md).\n\n\u003e **Note on VirusTotal:** Rust binaries are frequently flagged by ML-based heuristic scanners. This is a [known issue](https://users.rust-lang.org/t/rust-programs-flagged-as-malware/49799). Build from source with `cargo install lean-ctx` to verify.\n\n\u003cbr\u003e\n\n## 🗑 Uninstall\n\n```bash\nlean-ctx init --global   # See what was added, then remove from shell profile\ncargo uninstall lean-ctx # Remove binary\nrm -rf ~/.lean-ctx       # Remove stats + config\n```\n\n\u003cbr\u003e\n\n## ❓ Frequently Asked Questions\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cstrong\u003eHow much money does lean-ctx save?\u003c/strong\u003e\u003c/summary\u003e\n\nBased on real usage data: active developers save **$30-100+ per month** on API costs. The exact amount depends on your AI tool, usage patterns, and pricing tier. lean-ctx shows your exact savings with `lean-ctx gain`.\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cstrong\u003eDoes lean-ctx work with Claude Code / Cursor / Copilot?\u003c/strong\u003e\u003c/summary\u003e\n\nYes — lean-ctx supports **24 AI coding tools** out of the box with 46 MCP tools. Run `lean-ctx setup` and it auto-detects and configures all installed editors. No manual configuration needed.\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cstrong\u003eDoes it slow down my AI tool?\u003c/strong\u003e\u003c/summary\u003e\n\nNo. lean-ctx adds \u003c1ms overhead per operation. The MCP server runs as a persistent process (no cold starts), and the shell hook uses compiled Rust patterns. Most users report their AI tools feel **faster** because less data means faster LLM responses.\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cstrong\u003eIs it safe? Does it send data anywhere?\u003c/strong\u003e\u003c/summary\u003e\n\nlean-ctx has **zero telemetry** — no data collection, no analytics, no network requests, ever. Everything runs 100% locally. The code is Apache 2.0 licensed and fully auditable. See [SECURITY.md](SECURITY.md).\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cstrong\u003eWhat's the difference between lean-ctx and Rust Token Killer (RTK)?\u003c/strong\u003e\u003c/summary\u003e\n\nlean-ctx is a hybrid architecture (shell hook + MCP server) while Rust Token Killer is shell-hook only. lean-ctx offers 42 tools vs RTK's basic compression, supports 24 editors vs 3, has tree-sitter AST parsing for 18 languages, cross-session memory, multi-agent coordination, and — critically — zero telemetry (RTK has default-on telemetry with PII).\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cstrong\u003eHow do I reduce my Claude Code / Cursor API bill?\u003c/strong\u003e\u003c/summary\u003e\n\n1. Install lean-ctx: `npm install -g lean-ctx-bin`\n2. Run `lean-ctx setup` (auto-configures everything)\n3. Use your AI tool normally — lean-ctx compresses context transparently\n4. Check savings: `lean-ctx gain`\n\nMost users see 70-90% reduction in token usage from day one.\n\n\u003c/details\u003e\n\n\u003cbr\u003e\n\n## 🤝 Contributing\n\nContributions welcome! Open an issue or PR on [GitHub](https://github.com/yvgude/lean-ctx).\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://discord.gg/pTHkG9Hew9\"\u003eDiscord\u003c/a\u003e ·\n  \u003ca href=\"https://x.com/leanctx\"\u003e𝕏 / Twitter\u003c/a\u003e ·\n  \u003ca href=\"https://buymeacoffee.com/yvgude\"\u003eBuy me a coffee ☕\u003c/a\u003e\n\u003c/p\u003e\n\n\u003cbr\u003e\n\n## 📄 License\n\nApache License 2.0 — see [LICENSE](LICENSE).\n\nPortions of this software were originally released under the MIT License. See [LICENSE-MIT](LICENSE-MIT) for the original text and [NOTICE](NOTICE) for attribution details.\n\n\u003cbr\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003csub\u003eBuilt with 🦀 Rust · Made in Switzerland 🇨🇭\u003c/sub\u003e\n\u003c/p\u003e\n","funding_links":["https://buymeacoffee.com/yvgude"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyvgude%2Flean-ctx","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyvgude%2Flean-ctx","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyvgude%2Flean-ctx/lists"}