Dev & Engineering

LeanCTX Local Context Control

One local Rust binary that controls what your AI can see — compressing file reads and shell output and caching session context to cut token spend.

59/ 100
Recommended

Generally reliable with disclosed limitations; trial as directed and keep a rollback path.

See how it was scored ↓
Works as-is in
Codex · Claude Code
Stars
★ 3.9k
Last updated
11d ago
License
Apache-2.0
context-engineeringtoken-optimizationmcp-serverrust
+3file-readingshell-compressioncode-intelligence

What does this skill do, and when should you use it?

LeanCTX (lean-ctx) is a local context-intelligence layer for AI coding agents, running as a single Rust binary. It offers multiple file-read modes (full text down to signatures and entropy filtering), shell output compression, cached re-reads, and context recovery so agents read less and read smarter. This Skill document defines four tool-visibility profiles (Lean/minimal/standard/power), anchored file editing via ctx_read + ctx_patch, and architecture and verification tools invoked through ctx_call. The project is Apache-2.0 licensed, local-first, zero-config, and claims 60–90% token savings.

Replaces raw file reads with mode-based ctx_read (anchored, map, signatures, diff, lines:N-M, aggressive, entropy, task, auto), with re-reads served from a local cache (~13 tokens); wraps common commands (git, cargo, npm) with lean-ctx -c to compress their output; performs precise line-based editing via anchored views plus ctx_patch; exposes ctx_search, ctx_glob, ctx_tree, ctx_session, plus architecture tools (ctx_callgraph, ctx_impact, ctx_quality) and verification tools (ctx_verify, ctx_proof).

Good fit
  • Daily Cursor/Claude Code users repeatedly re-reading large files with high token bills, cutting read costs via cached re-reads and map/signatures modes
  • Teams in shell-heavy workflows (git, tests, builds) compressing command output with the shell hook so the model sees only signal
  • Engineers in large codebases (monorepos, 50+ files) using ctx_impact to gauge blast radius and ctx_callgraph to trace symbol calls
  • Users letting agents make precise code edits through anchored reads + ctx_patch instead of full-file rewrites
  • Context-budget-conscious users constraining which tools an agent can invoke via the four visibility profiles across the 76 MCP tools

How do you install this skill?

Before you start
Your agent needs
  • Shell / CLI
  • Network access
  • Local filesystem
  • MCP Server
Install first
  • lean-ctx binary (Rust, install script provided)

Install the binary: which lean-ctx || curl -fsSL https://raw.githubusercontent.com/yvgude/lean-ctx/main/skills/lean-ctx/scripts/install.sh | bash, then run lean-ctx setup. Also available via brew, npm (lean-ctx-bin), cargo, or Pi (see README). The Skill lives at rust/src/templates/SKILL.md in the repo; the README does not specify where to place this Skill file within Claude Code.

Generic route: install into Claude Code manually (macOS / Linux)
tmp="$(mktemp -d)"
git clone --depth 1 https://github.com/yvgude/lean-ctx.git "$tmp"
mkdir -p ~/.claude/skills
cp -R "$tmp/rust/src/templates" ~/.claude/skills/
rm -rf "$tmp"

Generated from the source repository and skill path; it copies only this skill's folder. If the author's install steps above differ, follow those first. To scope it to one project, replace ~/.claude/skills with that project's .claude/skills.

How do you use this skill?

After setup, follow the SKILL.md workflow: run lean-ctx -c "git status" instead of raw shell exec; read files you will edit with ctx_read(mode="anchored"), then edit with ctx_patch(path, op, line, hash, new_text) — never reproduce old text byte-for-byte, batch via ops:[…], create new files with op=create. A stale anchor returns CONFLICT with fresh anchors (retry once). Full docs: https://leanctx.com/docs.

What are this skill's strengths and limitations?

Pros
  • Local-first single Rust binary, no telemetry by default, code never leaves the machine unless cloud sync is explicitly enabled
  • Compression on both reads and shell output, ~13-token cached re-reads, with an auditable savings ledger and reproducible benchmarks
  • Four tool-visibility profiles (Lean to power) narrow the advertised tool surface per client, reducing context overhead
  • Works with 30+ agents including Cursor, Claude Code, Codex, Gemini CLI; one lean-ctx wrap command wires everything
Limitations
  • Payoff depends on three levers: window ownership, context lifetime, and provider pricing; small repos with little shell use land near break-even
  • The 60–90% savings and ~13-token re-read figures are the project's own benchmarks; validate on your repos with lean-ctx benchmark
  • Adds a layer of tool indirection: agents must learn ctx_* conventions and handle anchor CONFLICT retries
  • README inconsistently cites 76/79/80/81 MCP tools across sections; actual tool count depends on version

How does this skill compare with similar options?

Side by side with related skills; every score comes from the same FSRS standard.

Skill FS score Stars Last updated License
LeanCTX Local Context Control this page 59 · Recommended ★ 3.9k 11d ago Apache-2.0
LeanCTX — Local Context Intelligence Layer 61 · Recommended ★ 3.9k 11d ago Apache-2.0
Latent Briefing 55 · Use with care ★ 18k 14d ago MIT
Callimachus Recall 58 · Recommended ★ 43 3mo ago AGPL-3.0
Vexor Semantic Code Search 60 · Recommended ★ 244 23d ago MIT

The README positions LeanCTX on the same layer as standalone request-compression proxies such as Headroom — if its built-in proxy is enabled, you don't need Headroom on top; the official comparison page also lists RTK, Context+, and MemGPT.

How did FollowSkills review this skill?

FollowSkills review · FSRS-1.0
Recommended
59/ 100 5-point scale 3.0 / 5
1Utility13 / 20 · 3.3/5
2Reliability12 / 20 · 3.0/5
3Safety16 / 25 · 3.2/5

A context-compression tool; the install script is fetched and run via curl | bash from GitHub — a common but trust-the-maintainer install pattern; the tool wraps shell command execution.

4Evidence5 / 15 · 1.7/5
5Usability7 / 10 · 3.5/5
6Maintenance6 / 10 · 3.0/5
1 2 3 4 5 6

Open a dimension to read why it scored that way

Reviewed Jul 17, 2026 Review evidence[1]

Evidence confidence:Low — Mostly static review, author material or a limited demo; useful for discovery, not high-risk decisions.

This review was completed under FSRS 1.0. Dimension scores are not converted; it is queued for re-review under FSRS 2.0.

See the full review method →

FAQ

Does it cost money or require network access?
Local use is free with no telemetry by default; data only leaves the machine if you explicitly enable cloud sync or opt into anonymous stats. Installing requires network to download the binary.
Will it modify my system configuration?
lean-ctx wrap installs shell hooks, registers the MCP server, and starts a daemon; undo with lean-ctx unwrap, remove everything with lean-ctx uninstall, or disable for the current shell with lean-ctx-off.
How do agents invoke the tools?
lean-ctx is a standard MCP server exposing ctx_* tools; the default Lean profile advertises about 12 core tools, and more are reachable via ctx_call or ctx_load_tools, which reduces tool-schema token overhead.
Does compression lose information?
It is designed to be reversible (CCR): pruned content moves to a content-addressed store recoverable via ctx_expand, and JSON row-dedup is lossless. Lossy stages are CI-gated for accuracy.

More skills from this repository

All from yvgude/lean-ctx

Related skills