This is an early release preview. You may encounter bugs.
LeanCTX logo
Unclaimed

Tool coding memory

LeanCTX

lean-ctx sits between coding agents and your codebase, compressing file reads and shell output before they hit the model

A 84/100 GitHub score ? This grade is derived from GitHub signals, not user votes. Open for the full breakdown.
Discussion

01 / Summary

About LeanCTX.

LeanCTX is a context gateway that sits between AI coding agents and the files, repositories, and tool output they read. It selects task-relevant context, applies configured access and content controls before delivery, and records the context operations it can observe. The application, agent loop, and model stay under the user's control.

The open-source LeanCTX Engine is a local Rust binary that works on two planes. On the read path, an MCP server exposes ctx_* tools (read modes, caching, deltas, search, memory, multi-agent handoff) and a shell hook compresses common command output before the model sees it. On the wire path, an opt-in local request proxy reduces eligible prompt, history, and tool-result content on its way to the model provider while respecting provider prompt-cache boundaries. A separate LeanCTX SDK embeds Engine capabilities in an application.

Agents with shell access (Cursor, Claude Code, Codex CLI, Gemini CLI, Hermes, OpenCode, Pi, Cline, Roo Code, Kiro, and others) use a hybrid mode that combines MCP reads with shell hooks. Protocol-only clients (JetBrains IDEs, VS Code, Zed, Aider, Continue, Neovim) use the MCP tool set alone.

Savings figures are framed as measurements of a declared workload. Shadow Mode simulates what the same work would have cost without LeanCTX from uncompressed token counts, and reports cost per accepted outcome (CPAO) as the main metric. A powered with/without quality study has not been run, and earlier per-mode compression figures were withdrawn.

  • Read modes: 16 modes for file reads, including full, map, signatures, diff, line ranges, and a target-density mode that keeps the highest-entropy lines
  • Shell compression: 85+ patterns compress output from git, npm, cargo, docker, kubectl, terraform, and other commands
  • AST awareness: Tree-sitter parsing for 27 languages, so compact views follow code structure rather than plain text
  • Source recovery: compact views keep source references that expand back to full content on demand
  • Session memory: persists tasks, facts, and decisions across chats, exportable as a portable package
  • Code graph: a multi-edge property graph of imports, calls, exports, and type references drives impact analysis and search ranking
  • Hybrid search: combines BM25, embeddings, and graph proximity
  • Access controls: path permissions, content filters such as field masking, and per-agent context budgets
  • Context Proof: an exportable audit trail of policy decisions, source references, and usage evidence
  • Context Manager: a browser dashboard with live token tracking and compression statistics
  • Web research: pulls web pages, PDFs, and YouTube transcripts into context as compressed, cited text
  • Signed addons: experimental packages carrying a sandboxed WASM module or an external MCP server declaration, verified locally before install

02 / Discussion CREDIBILITY-GATED

Discussion

Reading is open to everyone. Posting and voting need a verified identity or a GitHub grade of B or higher.

  • No discussions yet.

04 / Build

Build with LeanCTX.

Browse the catalog for frameworks, tools, and harnesses, each scored on real GitHub credibility.

Get LeanCTX →

Browse the catalog