[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-74681":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":16,"subscribersCount":16,"size":16,"stars1d":17,"stars7d":18,"stars30d":19,"stars90d":16,"forks30d":16,"starsTrendScore":18,"compositeScore":20,"rankGlobal":10,"rankLanguage":10,"license":21,"archived":22,"fork":22,"defaultBranch":23,"hasWiki":24,"hasPages":22,"topics":25,"createdAt":10,"pushedAt":10,"updatedAt":41,"readmeContent":42,"aiSummary":43,"trendingCount":16,"starSnapshotCount":16,"syncStatus":44,"lastSyncTime":45,"discoverSource":46},74681,"lean-ctx","yvgude\u002Flean-ctx","yvgude","LeanCTX (Lean Context) — context intelligence for AI agents. One local binary that decides what your agents read, remembers what they learn, guards what they touch, and proves what they save. 60–90% fewer tokens as the receipt. 30+ tools, Rust, local-first.","https:\u002F\u002Fleanctx.com",null,"Rust",2595,266,19,4,0,101,303,482,29.28,"Apache License 2.0",false,"main",true,[26,27,28,29,30,31,32,33,34,35,36,37,38,39,40],"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","2026-06-12 02:03:26","\u003Cdiv align=\"center\">\n\n\u003Cpre>\n██╗     ███████╗ █████╗ ███╗   ██╗     ██████╗████████╗██╗  ██╗\n██║     ██╔════╝██╔══██╗████╗  ██║    ██╔════╝╚══██╔══╝╚██╗██╔╝\n██║     █████╗  ███████║██╔██╗ ██║    ██║        ██║    ╚███╔╝ \n██║     ██╔══╝  ██╔══██║██║╚██╗██║    ██║        ██║    ██╔██╗ \n███████╗███████╗██║  ██║██║ ╚████║    ╚██████╗   ██║   ██╔╝ ██╗\n╚══════╝╚══════╝╚═╝  ╚═╝╚═╝  ╚═══╝     ╚═════╝   ╚═╝   ╚═╝  ╚═╝\n\u003C\u002Fpre>\n\n**The Context Layer for AI Development**\n\nKnow what's in your context. Control what reaches the model.\nOne Rust binary. Zero cloud dependency.\n\n---\n\n\u003Ctable>\n\u003Ctr>\n\u003Ctd width=\"33%\" align=\"center\">\u003Cstrong>59 MCP tools\u003C\u002Fstrong>\u003Cbr\u002F>\u003Csub>10 read modes · graph · memory · multi-agent\u003C\u002Fsub>\u003C\u002Ftd>\n\u003Ctd width=\"33%\" align=\"center\">\u003Cstrong>95+ shell patterns\u003C\u002Fstrong>\u003Cbr\u002F>\u003Csub>56 modules · 270 passthrough rules\u003C\u002Fsub>\u003C\u002Ftd>\n\u003Ctd width=\"33%\" align=\"center\">\u003Cstrong>~13 tokens\u003C\u002Fstrong>\u003Cbr\u002F>\u003Csub>cached re-reads · tree-sitter AST · 21 langs\u003C\u002Fsub>\u003C\u002Ftd>\n\u003C\u002Ftr>\n\u003C\u002Ftable>\n\n---\n\n\u003Cp>\n  \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fyvgude\u002Flean-ctx\u002Factions\u002Fworkflows\u002Fci.yml\">\u003Cimg src=\"https:\u002F\u002Fgithub.com\u002Fyvgude\u002Flean-ctx\u002Factions\u002Fworkflows\u002Fci.yml\u002Fbadge.svg\" alt=\"CI\">\u003C\u002Fa>\n  \u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fyvgude\u002Flean-ctx\u002Factions\u002Fworkflows\u002Fsecurity-check.yml\">\u003Cimg src=\"https:\u002F\u002Fgithub.com\u002Fyvgude\u002Flean-ctx\u002Factions\u002Fworkflows\u002Fsecurity-check.yml\u002Fbadge.svg\" alt=\"Security\">\u003C\u002Fa>\n  \u003Ca href=\"https:\u002F\u002Fcrates.io\u002Fcrates\u002Flean-ctx\">\u003Cimg src=\"https:\u002F\u002Fimg.shields.io\u002Fcrates\u002Fv\u002Flean-ctx?color=%23e6522c\" alt=\"crates.io\">\u003C\u002Fa>\n  \u003Ca href=\"https:\u002F\u002Fcrates.io\u002Fcrates\u002Flean-ctx\">\u003Cimg src=\"https:\u002F\u002Fimg.shields.io\u002Fcrates\u002Fd\u002Flean-ctx?color=%23e6522c\" alt=\"Downloads\">\u003C\u002Fa>\n  \u003Ca href=\"https:\u002F\u002Fwww.npmjs.com\u002Fpackage\u002Flean-ctx-bin\">\u003Cimg src=\"https:\u002F\u002Fimg.shields.io\u002Fnpm\u002Fv\u002Flean-ctx-bin?label=npm&color=%23cb3837\" alt=\"npm\">\u003C\u002Fa>\n  \u003Ca href=\"https:\u002F\u002Faur.archlinux.org\u002Fpackages\u002Flean-ctx\">\u003Cimg src=\"https:\u002F\u002Fimg.shields.io\u002Faur\u002Fversion\u002Flean-ctx?color=%231793d1\" alt=\"AUR\">\u003C\u002Fa>\n  \u003Ca href=\"https:\u002F\u002Fpi.dev\u002Fpackages\u002Fpi-lean-ctx\">\u003Cimg src=\"https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FPi.dev-pi--lean--ctx-6366f1?logo=data:image\u002Fsvg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJ3aGl0ZSI+PHRleHQgeD0iNCIgeT0iMTgiIGZvbnQtc2l6ZT0iMTYiIGZvbnQtZmFtaWx5PSJzZXJpZiI+z4A8L3RleHQ+PC9zdmc+\" alt=\"Pi.dev\">\u003C\u002Fa>\n  \u003Ca href=\"LICENSE\">\u003Cimg src=\"https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FLicense-Apache%202.0-blue.svg\" alt=\"License\">\u003C\u002Fa>\n  \u003Ca href=\"https:\u002F\u002Fdiscord.gg\u002FpTHkG9Hew9\">\u003Cimg src=\"https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FDiscord-Join-5865F2?logo=discord&logoColor=white\" alt=\"Discord\">\u003C\u002Fa>\n  \u003Ca href=\"https:\u002F\u002Fx.com\u002Fleanctx\">\u003Cimg src=\"https:\u002F\u002Fimg.shields.io\u002Fbadge\u002F𝕏-Follow-000000?logo=x&logoColor=white\" alt=\"X\u002FTwitter\">\u003C\u002Fa>\n  \u003Cimg src=\"https:\u002F\u002Fimg.shields.io\u002Fbadge\u002FTelemetry-Opt--in%20Only-brightgreen?logo=shield&logoColor=white\" alt=\"Opt-in Telemetry\">\n\u003C\u002Fp>\n\n\u003Cp>\n  \u003Ca href=\"https:\u002F\u002Fleanctx.com\">Website\u003C\u002Fa>&nbsp;&nbsp;·&nbsp;&nbsp;\u003Ca href=\"https:\u002F\u002Fleanctx.com\u002Fdocs\u002Fgetting-started\">Docs\u003C\u002Fa>&nbsp;&nbsp;·&nbsp;&nbsp;\u003Ca href=\"#get-started-60-seconds\">Install\u003C\u002Fa>&nbsp;&nbsp;·&nbsp;&nbsp;\u003Ca href=\"#demo\">Demo\u003C\u002Fa>&nbsp;&nbsp;·&nbsp;&nbsp;\u003Ca href=\"#benchmarks\">Benchmarks\u003C\u002Fa>&nbsp;&nbsp;·&nbsp;&nbsp;\u003Ca href=\"cookbook\u002FREADME.md\">Cookbook\u003C\u002Fa>&nbsp;&nbsp;·&nbsp;&nbsp;\u003Ca href=\"SECURITY.md\">Security\u003C\u002Fa>&nbsp;&nbsp;·&nbsp;&nbsp;\u003Ca href=\"CHANGELOG.md\">Changelog\u003C\u002Fa>&nbsp;&nbsp;·&nbsp;&nbsp;\u003Ca href=\"https:\u002F\u002Fdiscord.gg\u002FpTHkG9Hew9\">Discord\u003C\u002Fa>\n\u003C\u002Fp>\n\n\u003C\u002Fdiv>\n\n---\n\n> **lean-ctx** is the Context Layer for AI coding. It compresses, tracks, and governs every token between your code and the AI — so you make better decisions, not just cheaper ones. Works with **Cursor, Claude Code, Copilot, Windsurf, Codex, Gemini** and 23+ other agents — no config needed.\n\n\u003Cp align=\"center\">\u003Cstrong>See it in action:\u003C\u002Fstrong>\u003C\u002Fp>\n\n\u003Ctable>\n  \u003Ctr>\n    \u003Ctd align=\"center\" width=\"33%\">\n      \u003Cimg src=\"assets\u002Fleanctx-demo.gif\" width=\"320\" alt=\"Map-mode file read + compressed git output demo\">\n      \u003Cbr\u002F>\n      \u003Cstrong>Read + Shell\u003C\u002Fstrong>\n      \u003Cbr\u002F>\n      Map-mode reads + compressed CLI output\n    \u003C\u002Ftd>\n    \u003Ctd align=\"center\" width=\"33%\">\n      \u003Cimg src=\"assets\u002Fleanctx-gain.gif\" width=\"320\" alt=\"lean-ctx gain live dashboard demo\">\n      \u003Cbr\u002F>\n      \u003Cstrong>Gain (live)\u003C\u002Fstrong>\n      \u003Cbr\u002F>\n      Tokens + USD savings in real time\n    \u003C\u002Ftd>\n    \u003Ctd align=\"center\" width=\"33%\">\n      \u003Cimg src=\"assets\u002Fleanctx-benchmark.gif\" width=\"320\" alt=\"lean-ctx benchmark report demo\">\n      \u003Cbr\u002F>\n      \u003Cstrong>Benchmark proof\u003C\u002Fstrong>\n      \u003Cbr\u002F>\n      Measure compression by language + mode\n    \u003C\u002Ftd>\n  \u003C\u002Ftr>\n\u003C\u002Ftable>\n\n\u003Cp align=\"center\">\u003Csub>All GIFs are generated from reproducible VHS tapes in \u003Ccode>demo\u002F\u003C\u002Fcode>.\u003C\u002Fsub>\u003C\u002Fp>\n\n## What it does\n\n**One binary replaces your entire context stack:**\n\n| Replaces | With lean-ctx | How |\n|----------|--------------|-----|\n| Output compression tools | 4 compression levels + 56 pattern modules | Shell hook + terse pipeline + 270 passthrough rules |\n| Context window managers | 10 read modes + auto-archive | Adaptive mode selection per file, Tree-sitter AST for 21 languages |\n| Session memory tools | CCP + temporal knowledge graph | Facts with validity, cross-session recovery, episodic + procedural memory |\n| Code graph tools | Property Graph + hybrid search | BM25 + embeddings + graph proximity |\n| Context observability tools | Context Manager (dashboard) | Real-time token tracking, file ledger, compression stats |\n| Governance \u002F quality tools | Profiles, roles, budgets, SLOs | Context proof, verification engine, quality gates |\n\n**Core capabilities:**\n\n- **File reads (MCP)**: cached + mode-aware reads (`full`, `map`, `signatures`, `diff`, …) with graph-aware related files hints\n- **Shell output (hook)**: compresses noisy CLI output via 56 pattern modules + 270 passthrough rules (git, npm, cargo, docker, kubectl, terraform, …)\n- **Context Manager** (beta): browser-based dashboard (`lean-ctx dashboard`) with real-time context window visualization — file ledger with token counts, compression ratios, system prompt cost breakdown, conversation history weight, context utilization gauge, and compression stats\n- **Graph-Powered Intelligence**: multi-edge Property Graph (imports, calls, exports, type_ref) with weighted impact analysis, hybrid search (BM25 + embeddings + graph proximity via RRF), and incremental git-diff updates\n- **Governance**: profiles, roles, budgets, and SLOs — define how much context each agent uses, what tools they can access, and when to throttle\n- **Context Proof & Verification** (`ctx_proof`, `ctx_verify`): cryptographic context proofs with 4-layer verification engine and quality gates (levels 0–4)\n- **LSP Refactoring** (`ctx_refactor`): language-server-powered rename, references, go-to-definition, and find-implementations via rust-analyzer, typescript-language-server, pylsp, gopls — with timeout-protected channel-based IO\n- **Knowledge System**: temporal knowledge graph with facts, validity windows, cross-session recovery, episodic memory (task-level summaries), and procedural memory (learned workflows)\n- **Multi-Agent** (`ctx_agent`, `ctx_handoff`): agent handoff with context transfer bundles, diary system (discovery\u002Fdecision\u002Fblocker\u002Fprogress\u002Finsight), and synchronized shared state\n- **Archive Full-Text Search** (`ctx_expand search_all`): FTS5-powered cross-archive search over all previously archived tool outputs\n- **PR Context Packs**: `lean-ctx pack --pr` builds a PR-ready context pack (changed files, related tests, impact, artifacts)\n- **Context Packages**: `lean-ctx pack create` bundles Knowledge + Graph + Session + Gotchas into portable `.lctxpkg` files — share context across projects\u002Fteams with SHA-256 integrity, auto-load on session start, and smart merge (dedup facts, overlay graph)\n- **Session memory (CCP)**: persist task\u002Ffacts\u002Fdecisions across chats with structured recovery queries surviving compaction\n- **Observability**: `lean-ctx gain --live` for real-time savings, `lean-ctx wrapped` for weekly\u002Fmonthly summaries, `lean-ctx watch` for TUI monitoring, heatmaps, and slow-log analysis\n- **HTTP mode**: `lean-ctx serve` for Streamable HTTP MCP + `\u002Fv1\u002Ftools\u002Fcall` (used by the Cookbook + SDK)\n\n## How it works (30 seconds)\n\n```\nAI tool  →  (MCP tools + shell commands)  →  lean-ctx  →  your repo + CLI\n```\n\n- **MCP server**: exposes `ctx_*` tools (read modes, caching, deltas, search, memory, multi-agent)\n- **Shell hook**: transparently compresses common commands so the LLM sees less noise\n- **Property Graph**: multi-edge code graph powers impact analysis, related file discovery, and search ranking\n- **CCP**: persists session state with structured recovery queries so long-running work doesn’t “cold start” every chat\n- **Context Manager**: browser dashboard for real-time visibility into what’s in your context window\n- **Governance**: profiles, budgets, SLOs, and verification proofs for enterprise-grade context control\n\n## Get started (60 seconds)\n\n```bash\n# 1) Install (pick one)\ncurl -fsSL https:\u002F\u002Fleanctx.com\u002Finstall.sh | sh      # universal (no Rust needed)\nbrew tap yvgude\u002Flean-ctx && brew install lean-ctx    # macOS \u002F Linux\nnpm install -g lean-ctx-bin                          # Node.js\ncargo install lean-ctx                               # Rust\npi install npm:pi-lean-ctx                           # Pi Coding Agent\n\n# 2) Setup (shell + auto-detected AI tools)\nlean-ctx setup\n\n# 3) Verify\nlean-ctx doctor\n\n# 4) See the payoff\nlean-ctx gain --live\nlean-ctx wrapped --week\n```\n\nAfter `setup`, restart your shell and your editor\u002FAI tool once so the MCP + hooks are active.\n\n\u003Cdetails>\n\u003Csummary>\u003Cstrong>Troubleshooting \u002F Safety\u003C\u002Fstrong>\u003C\u002Fsummary>\n\n- Disable immediately (current shell): `lean-ctx-off`\n- Run a single command uncompressed: `lean-ctx -c --raw \"git status\"`\n- Only activate in AI agent sessions: set `shell_activation = \"agents-only\"` in `~\u002F.config\u002Flean-ctx\u002Fconfig.toml`\n- Per-project config override: create `.lean-ctx.toml` in your project root (auto-merged with global config)\n- Docker projects sharing `\u002Fworkspace`: create `.lean-ctx-id` with a unique name to prevent context collisions\n- Update: `lean-ctx update`\n- Diagnose (shareable): `lean-ctx doctor --json`\n\n\u003C\u002Fdetails>\n\n## Supported IDEs & AI tools\n\nlean-ctx is a standard **MCP server**, so it works with any MCP-compatible client. Two integration modes are auto-selected per agent:\n\n| Mode | How it works | Best for |\n|---|---|---|\n| **Hybrid** | MCP for cached reads (~13 tokens) + shell hooks for command compression | Agents with shell access (Cursor, Claude Code, Codex, …) |\n| **MCP** | All 51 tools via MCP protocol, no shell hooks | Protocol-only agents (JetBrains, VS Code, Zed, …) |\n\n### Agent compatibility matrix\n\n| Agent | Hybrid | MCP | Setup |\n|---|:---:|:---:|---|\n| Cursor | ● | | `lean-ctx init --agent cursor` |\n| Claude Code | ● | | `lean-ctx init --agent claude` |\n| Codex CLI | ● | | `lean-ctx init --agent codex` |\n| Gemini CLI | ● | | `lean-ctx init --agent gemini` |\n| Windsurf | ● | | `lean-ctx init --agent windsurf` |\n| GitHub Copilot | ● | | `lean-ctx init --agent copilot` |\n| CRUSH | ● | | `lean-ctx init --agent crush` |\n| Hermes | ● | | `lean-ctx init --agent hermes` |\n| OpenCode | ● | | `lean-ctx init --agent opencode` |\n| Pi | ● | | `lean-ctx init --agent pi` |\n| Qoder | ● | | `lean-ctx init --agent qoder` |\n| Amp | ● | | `lean-ctx init --agent amp` |\n| Cline | ● | | `lean-ctx init --agent cline` |\n| Roo Code | ● | | `lean-ctx init --agent roo` |\n| Kiro | ● | | `lean-ctx init --agent kiro` |\n| Antigravity | ● | | `lean-ctx init --agent antigravity` |\n| Amazon Q | ● | | `lean-ctx init --agent amazonq` |\n| Qwen | ● | | `lean-ctx init --agent qwen` |\n| Trae | ● | | `lean-ctx init --agent trae` |\n| Verdent | ● | | `lean-ctx init --agent verdent` |\n| Aider | | ● | `lean-ctx init --agent aider` |\n| Continue | | ● | `lean-ctx init --agent continue` |\n| JetBrains IDEs | | ● | `lean-ctx init --agent jetbrains` |\n| QoderWork | | ● | `lean-ctx init --agent qoderwork` |\n| VS Code | | ● | `lean-ctx init --agent vscode` |\n| Zed | | ● | `lean-ctx init --agent zed` |\n| Neovim | | ● | `lean-ctx init --agent neovim` |\n| Emacs | | ● | `lean-ctx init --agent emacs` |\n| Sublime Text | | ● | `lean-ctx init --agent sublime` |\n\n> **Any MCP-compatible client** works out of the box — the table above shows agents with first-class auto-setup.\n\n### When to use (and when not to)\n\n**Great fit if you…**\n- use AI coding tools daily and your sessions are shell-heavy (git\u002Ftests\u002Fbuilds)\n- work in medium\u002Flarge repos (50+ files \u002F monorepos)\n- want a local-first layer with **no telemetry by default**\n\n**Skip it if you…**\n- mostly work in tiny repos and rarely call the shell from your AI tool\n- always need raw\u002Funfiltered logs (you can still use `--raw`, but ROI is lower)\n\n\u003Ca id=\"demo\">\u003C\u002Fa>\n\n## Demo\n\nTry these in any repo:\n\n```bash\nlean-ctx read rust\u002Fsrc\u002Fserver\u002Fmod.rs -m map\nlean-ctx -c \"git log -n 5 --oneline\"\nlean-ctx gain --live\nlean-ctx dashboard                              # Context Manager (browser)\nlean-ctx watch                                  # TUI monitor\nlean-ctx benchmark report .\n```\n\n- The repo ships the exact tapes used to render the GIFs in `demo\u002F`\n- Regenerate locally:\n\n```bash\nvhs demo\u002Fleanctx.tape\nvhs demo\u002Fgain.tape\nvhs demo\u002Fbenchmark.tape\n```\n\n\u003Ca id=\"benchmarks\">\u003C\u002Fa>\n\n## Benchmarks\n\n- **Latest snapshot**: [BENCHMARKS.md](BENCHMARKS.md)\n- **Reproduce**:\n\n```bash\nlean-ctx benchmark report .\n```\n\n## Docs\n\n- Getting started: https:\u002F\u002Fleanctx.com\u002Fdocs\u002Fgetting-started\n- Tools reference: https:\u002F\u002Fleanctx.com\u002Fdocs\u002Ftools\u002F\n- CLI reference: https:\u002F\u002Fleanctx.com\u002Fdocs\u002Fcli-reference\u002F\n- Comparison (vs RTK, Context+, MemGPT): https:\u002F\u002Fleanctx.com\u002Fcompare\u002F\n- FAQ: [discord-faq.md](discord-faq.md)\n- Feature catalog (SSOT snapshot): [LEANCTX_FEATURE_CATALOG.md](LEANCTX_FEATURE_CATALOG.md)\n- Architecture: [ARCHITECTURE.md](ARCHITECTURE.md)\n- Vision: [VISION.md](VISION.md)\n\n## Privacy & security\n\n- **No telemetry by default**\n- **Optional anonymous stats sharing** (opt-in during setup)\n- **Disableable update check** (config `update_check_disabled = true` or `LEAN_CTX_NO_UPDATE_CHECK=1`)\n- **40+ security hardening fixes** in v3.5.16 (path traversal, injection, CSPRNG, CSP, resource limits — [details](CHANGELOG.md))\n- Runs locally; your code never leaves your machine unless you explicitly enable cloud sync\n\nSee [SECURITY.md](SECURITY.md).\n\n## Uninstall\n\n```bash\nlean-ctx-off       # disable immediately (current shell session)\nlean-ctx uninstall # remove hooks + editor configs + data dir\n\n# Remove the binary (pick your install method)\nbrew uninstall lean-ctx\nnpm uninstall -g lean-ctx-bin\ncargo uninstall lean-ctx\npi uninstall npm:pi-lean-ctx                        # Pi Coding Agent\n```\n\n## Contributing\n\nStart with [CONTRIBUTING.md](CONTRIBUTING.md). Easy first PR: propose a new CLI compression pattern via the [issue template](.github\u002FISSUE_TEMPLATE\u002Fcompression_pattern.md).\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) and [NOTICE](NOTICE).","lean-ctx 是一个专为AI开发设计的上下文操作系统，旨在通过优化上下文管理减少Cursor、Claude Code、Copilot等工具中的token消耗，最高可达95%（缓存读取时甚至高达99%）。它采用单一Rust二进制文件构建，无需依赖云服务，提供包括49种工具、10种读取模式及90多种模式在内的强大功能组合。特别适合需要高效利用资源进行代码生成和模型训练的开发者使用，尤其是在成本控制严格的场景下。",2,"2026-06-11 03:50:23","high_star"]