Hybrid Context Optimizer β Shell Hook + MCP Server. Reduces LLM token consumption by 89-99%. Single Rust binary, zero dependencies.
RustOpen Source
The problem
What's broken without this
π€
Context window fills instantly
Large codebases and verbose CLI output consume your LLM context budget before you finish describing the problem.
πΈ
Token costs spiral out of control
Each file read, test output, and dependency tree dump multiplies your API bills and slows down iterative development.
π
Repetitive context re-submission
You manually trim, summarize, and re-paste the same project structure and logs across multiple LLM conversations.
The difference
Why it matters
β Without
Manual work
Slow iteration
Repeated mistakes
β With this
Runs as single Rust binary with zero external dependenciesβno Node, Python, or Docker overhead
Dual-mode operation: transparent shell hook for any CLI tool, plus 10 MCP tools for explicit editor integration
Achieves 89β99% token reduction on real workloads without requiring LLM-side prompting or model changes
Under the hood
How it works
π₯
Capture CLI output or file reads
Shell hook intercepts command output; MCP server handles explicit file/dependency requests from your editor.
βοΈ
Parse with tree-sitter AST
Extracts semantic structure from 14 languages, strips whitespace and comments, encodes via Token Dense Dialect (TDD) to compress syntax trees by 70β90%.
π€
Send compressed context to LLM
Editor receives dense, structured output that preserves code meaning in 1β11% of original tokens.
What it does
Core capabilities
β‘
Fast
Optimized for speed and efficiency.
π―
Reliable
Built to work consistently.
π
Integrates
Works with your existing tools.
I stopped manually copying file trees into Claude because lean-ctx compresses my entire project structure into a few hundred tokensβand my editor sees it automatically.
arc-web/diet-claude
Codebase
Built with care
π»
Rust
Built in Rust for type safety and reliability.
ποΈ
Architecture
MCP Server
π¦
Key deps
rmcp, tiktoken-rs, tokio
π
Open Source (MIT / PolyForm)
Fork it, extend it, ship it. It's yours.
Built by
Mike Ensor Arc Web
AI automation, marketing technology, building tools that work.
Mike builds open-source AI tools for agencies, marketers, and operators who are done waiting for software to catch up. All Arc Web projects are open source by default β fork them, extend them, ship them.