# LeanCTX

A local context engineering layer for AI coding agents that caches, compresses and routes what gets sent to a model, tracking token and cost savings against a measured baseline.

LeanCTX is a context engineering layer that runs locally alongside a coding agent such as Cursor, Claude Code, Copilot, Windsurf, Codex or Gemini. It reads repositories and runs development commands on the agent's behalf, then compresses what is sent to the model: repeated file reads return a compact deterministic reference instead of resending unchanged content, command output is compressed while preserving salient results, and each proxied request is compressed in a way intended to remain prompt-cache-safe.

It also keeps session memory that persists across chats, and reports real-time token and cost savings through a local dashboard measured against a comparable uncompressed baseline, using a local savings ledger and a shadow mode for comparison. It requires no configuration and is described as local-first, so files and indexes stay on the user's machine.

It is written in Rust and works with more than 30 coding agents.

Website: https://leanctx.com
