LeanCTX is a context management gateway designed to improve how AI agents and large language models access and process information. Written in Rust, it selects relevant information from source code, repositories, files, and command outputs before delivering it to AI tools. It uses structural analysis, compression, and context reuse to reduce unnecessary token consumption. Developers can configure file access permissions, content filters, and context budgets. The engine integrates with existing AI coding assistants through a command-line interface, MCP, hooks, and supported proxy configurations. It preserves local task records and findings to maintain continuity across sessions. Its reporting capabilities provide visibility into context usage, policy decisions, and estimated costs.
Features
- Task-specific context selection using structural analysis and intelligent information filtering
- Context compression and reuse for reducing unnecessary AI token consumption
- Configurable file access permissions, content filters, and context budgets
- Integration with AI coding assistants through MCP, CLI, and hooks
- Persistent local knowledge and task records for continuity across sessions
- Context usage reporting with source references and policy decision tracking