The Cognitive Context Layer for Agentic Systems.
LeanCTX helps AI agents perceive, compress, remember, and route context. Less noise, better signal. One binary, zero config, open source.
curl -fsSL https://leanctx.com/install.sh | sh You can't optimize what you can't see.
Every file read, every shell command, every search result — your AI sends it all to the model without filtering. You have no visibility into what's eating your context window. The result? Wasted tokens, lost focus, and decisions based on noise.
"Compression saves tokens. But knowing what's in your context — that's what changes the output."
Understand, compress, remember, verify, connect.
LeanCTX sits between your AI and your codebase. First it shows you what's in your context — then it optimizes the full lifecycle from file read to model delivery.
Understand
See every file, token count, rule cost, and conversation weight in real-time. Know exactly what's eating your context window before making decisions.
Compress
10 read modes with Tree-sitter AST parsing for 21 languages. Strips noise, keeps structure. Cached re-reads cost ~13 tokens — 60-99% fewer tokens per read.
Remember
Cross-session memory, knowledge graphs, and context checkpoints. Your AI remembers decisions, discoveries, and file relationships across sessions.
Verify
Profiles, roles, and budgets. Control what each agent sees, how much it spends, and when to throttle. Full audit trail.
Connect
Drop a TOML file, connect any API. GitHub, Jira, databases, or your own services — lean-ctx pulls live context from any data source into your AI's working memory.
What it looks like in your terminal.
lean-ctx works silently behind the scenes. When your AI reads a file, the context layer transparently compresses, routes, and optimizes the output. Here's a real ctx_read call and the metrics dashboard.
Works with every major AI coding tool.
Cursor, Claude Code, GitHub Copilot, Windsurf, Pi, Neovim, Sublime Text, Emacs, Codex — lean-ctx integrates with all of them. Zero vendor lock-in, zero configuration per tool. Install once, benefit everywhere.
Frequently Asked Questions
What is LeanCTX?
LeanCTX is the Context Layer for AI development. It sits between your AI coding tool and your codebase, compressing file reads by up to 99%, persisting memory across sessions, and verifying all outputs before delivery. It works with 29+ AI tools including Cursor, Claude Code, and GitHub Copilot.
How much does LeanCTX save in token costs?
Active developers save $30-100+ per month on AI API costs. File reads are compressed by 60-99%, shell output by 60-90%, and cached re-reads cost only 13 tokens. Use lean-ctx gain to measure your personal savings.
Does LeanCTX work with Cursor / Claude Code / Copilot?
Yes. LeanCTX supports 29+ AI coding tools out of the box. Run lean-ctx setup and it auto-detects and configures all installed editors. It supports two integration modes: Hybrid (MCP + shell hooks) and Full MCP.
Is LeanCTX free and open source?
Yes. LeanCTX is fully open source under MIT + Apache-2.0 dual license. Zero telemetry, everything runs locally. The single Rust binary is available via npm, cargo, or direct download.
What is the Context Layer?
The Context Layer is lean-ctx's architecture for managing the full AI context lifecycle. It sits between your code and the AI: deciding what to read, how to compress it, what to remember, and how to verify results. Learn more on the Architecture page.
Stop guessing. Start seeing what's in your context.
One Rust binary. No cloud. No account. MIT + Apache-2.0 licensed. Install in 60 seconds — see what's in your context, then optimize it.