mrkeyoor.com_
Tue 01 Sept 17:41 UTC
LLM Toolsevaluationupdated 25 Aug 2026

lean-ctx review

LeanCTX is a local Rust context layer for coding agents such as Claude Code, Codex, Cursor, and OpenCode. Its MCP tools, shell hooks, optional request proxy, repository graph, and session memory try to reduce repeated context while recording token cost and accepted outcomes.

+39stars / 7d
Verdict

Our LeanCTX source build succeeded in 402 seconds, but its 223-second test run exited 101 and current issues report broken safety and verbatim-read expectations. The product is ambitious and potentially useful for context-heavy Claude Code or Codex sessions, yet its proxy, shell, memory, graph, and 80-plus MCP surface is too broad to trust after a one-command wrap. Trial it on a disposable profile with destructive tools disabled; do not make it a team-wide default until plan-mode enforcement and raw-read behavior are fixed.

We ran it

Lab card: what happened when we ran lean-ctxScreenshot of lean-ctx (leanctx.com)
Install✓ · 59s492 packages
Build✓ · 537s
Tests✗ · 196sran, no count parsed
Repo3712 files~783,861 lines of source · 50.1 MB · 14 CI workflows · tests dir

Answers from our run

Does lean-ctx build from source?

Dependencies installed in 59 seconds (492 packages), and the build succeeded in 537 seconds. We cloned commit 8910171 into a clean Debian container with 3 CPUs and no project-specific setup.

Do lean-ctx's tests pass?

The test command failed in our container, and its output did not report a pass or fail count.

Who should not use lean-ctx?

Anyone relying on IDE plan mode as a security boundary: open issue 1500 says ctx_shell, ctx_execute, and ctx_patch remain callable in plan or readonly mode.

What are the alternatives to lean-ctx?

Repomix, Serena. Our LeanCTX source build succeeded in 402 seconds, but its 223-second test run exited 101 and current issues report broken safety and verbatim-read expectations.

Setup2/5Packaged setup is short, but Cargo installs and tests have failures
Docs3/5Extensive guides, weakened by undocumented behavior and count drift
Community4/5Recent release, daily pushes, and detailed current bug reports
Maturity2/5Wide feature set with open safety, packaging, and indexing defects

Who it’s for

Heavy Claude Code or Codex users working in repositories where repeated reads and noisy shell output consume context.
Developers willing to compare compressed output with raw source before trusting edits.
Teams that want local session memory, context budgets, and an inspectable savings ledger.
MCP users prepared to disable risky tools and tune indexing for their repository size.

Who it’s NOT for

Anyone relying on IDE plan mode as a security boundary: open issue 1500 says ctx_shell, ctx_execute, and ctx_patch remain callable in plan or readonly mode.
Users who require full or raw reads to be verbatim: issue 1543 reports an undocumented structural filter overriding both modes with no documented bypass.
Large-repository users unwilling to tune indexing: issue 1494 reports an indexer CPU spin on a roughly 7,000-file tree, with an undocumented no-index variable as the workaround.
Developers installing from crates.io right now: issue 1508 reports that v3.9.14 through v3.9.19 cannot install because published helper crates and packaged manifests are out of sync.
Small projects or sessions that rarely read files or run shell commands: the README itself says the return is lower there.

Setup reality

Our Rust install completed in 27 seconds with 492 packages. Building the project under ./rust/ succeeded in 402 seconds. Tests ran for 223 seconds and failed with exit 101; the supplied tail only says the library emitted 3 warnings and that the build failed, so it does not reveal the failing test or compiler error.

Packaged routes include a shell installer, Homebrew, npm, and Cargo, followed by lean-ctx wrap <agent>. Wrapping changes agent MCP registration, installs shell hooks, starts a daemon, and keeps local state. The request proxy is optional and needs provider routing that matches the chosen agent.

Use unwrap, raw-command bypasses, and agent-only shell activation during evaluation. Current issue reports make plan-mode enforcement, verbatim recovery, crate packaging, and large-tree indexing mandatory checks before team rollout.

LeanCTX sits between the agent and your repository

LeanCTX combines several context-management jobs in one Rust binary. Its MCP server supplies file reads, search, memory, graph queries, shell execution, handoffs, and recovery tools. Shell hooks compress familiar command output. An optional local proxy can rewrite full requests before they reach OpenAI, Anthropic, or Gemini, while a browser dashboard tracks context use and cost.

The project says eligible content can use 50 to 80 percent fewer tokens and that cached rereads can cost about 13 tokens. Those are LeanCTX's published figures, not results from our sandbox. Its design is more important than the headline percentage: compressed material moves to a content-addressed store, and the model receives handles that can retrieve original bytes through several paths.

That recovery contract is the feature to test first. Context reduction is useful only when an agent can reliably request the exact omitted code before editing or making a claim. LeanCTX offers ctx_expand, ctx_retrieve, reference URLs, and explicit read modes for that purpose. A current issue shows the contract is not dependable in every path.

Full and raw reads are not always verbatim

Issue 1543 reproduces an undocumented "triage level 2" filter in LeanCTX 3.9.19. Structured Markdown and HTML files were replaced with outline-like output even when the caller requested mode=full, mode=raw, zero aggressiveness, or a fresh read. The reporter found no documented switch that restored the original through ctx_read.

This defect cuts directly against edit safety. An agent may believe it has received full source when a structural filter has removed bodies, tables, or repeated selectors. It can retry several modes and still spend extra calls without recovering the content. Until the behavior is fixed, compare important reads with the editor's native file tool or shell and reserve LeanCTX compression for material where omission is acceptable.

The README itself shows documentation drift. One section labels the full list as 83 MCP tools, while later compatibility text and scenario copy refer to 79. Tool count is not a quality metric, but a changing surface needs generated reference material that agrees with the shipped binary.

What happened when we ran it

Our Rust sandbox installed 492 packages in 27 seconds. The project lives under ./rust/ inside a 48.9 MB checkout containing 3,589 files and roughly 755,534 lines of source. A full build succeeded in 402 seconds at commit 2a4a663.

Tests ran for 223 seconds and exited 101. The supplied log tail shows a long Rust linker invocation, says the lean-ctx library generated 3 warnings, and ends with warning: build failed, waiting for other jobs to finish. It does not include the original error or a test summary, so we cannot identify what failed or how many tests ran.

The repository has 14 CI workflow files and a tests directory, which is better evidence of intended coverage than a token-saving GIF. Our failed run still blocks a clean bill of health. Source adopters should capture the complete first error on their platform rather than guessing from the truncated tail.

Plan mode does not enforce read-only behavior

Issue 1500 says ctx_shell, ctx_execute, and ctx_patch remain available when an IDE is in plan or readonly mode. According to the report, MCP interaction metadata is not used to populate the server's existing access fields, so a denial guard never fires. The issue even demonstrates an arbitrary shell command arriving with plan metadata.

That means an interface label cannot be treated as a permission boundary. LeanCTX's shell tool is powerful enough to run development commands, and scripts can write outside a project when the process account allows it. Evaluate with operating-system isolation, a disposable repository, and an MCP allowlist that omits write or shell tools. Do not assume the agent client's mode protects the host.

The project provides useful escape controls: agent-only shell activation, a raw-command bypass, a current-shell off switch, doctor --json, and an unwrap command. Those make a trial reversible. They do not repair enforcement inside a running MCP session, so policy must live outside the tool until issue 1500 closes and is verified.

Packaging and indexing need their own trial

The README advertises shell, Homebrew, npm, and Cargo installation. Open issue 1508 reports that cargo install lean-ctx is broken for every version from 3.9.14 through current release 3.9.19. The report identifies stale published helper crates and capability manifests referenced outside the packaged crate. Prefer a prebuilt route only after verifying its provenance, or wait for a fresh-install CI fix.

Large trees have another reported failure. Issue 1494 describes a roughly 7,300-file, 211 MB repository where initial indexing completed file I/O and then spun CPU without returning. An undocumented LEAN_CTX_NO_INDEX=1 switch allowed calls to proceed but removed graph edges. Our checkout had 3,589 files, so our successful 402-second build does not test that runtime case.

LeanCTX is most interesting when a coding agent repeatedly burns context on the same large codebase. It is also least safe to adopt casually because it can read, compress, remember, proxy, and execute. Repomix is a smaller choice for preparing a static repository bundle; Serena is a narrower route to symbol-aware MCP navigation. LeanCTX deserves a controlled trial after its current safety and packaging bugs are fixed, with savings measured against your own accepted work rather than its headline percentage.

Alternatives

ProjectWhat it isPick it when
Repomix gh↗A focused tool that packs a repository into an AI-friendly file with filtering and token counts.pick this instead when you need a predictable code snapshot rather than a daemon, proxy, memory store, and 80-plus tools.
Serena gh↗An MCP coding toolkit that uses language intelligence for symbol-level navigation and edits.pick this instead when semantic code navigation matters more than request compression and savings accounting.

What people are saying

  1. [github-trending] yvgude/lean-ctx

Sources

  1. LeanCTX README
  2. LeanCTX repository
  3. LeanCTX v3.9.19 release
  4. Plan-mode shell bypass issue
  5. Full-read triage issue
  6. Cargo install packaging issue
  7. Large-tree indexer issue

More llm tools reviews

rig · open-knowledge · graphiti · cve-mcp-server · minimind · SillyTavern · the whole board →