LeanCTX for Claude Code

Claude Code is brilliant. Its token bill isn't.

LeanCTX cuts Claude Code token costs by 60–90% with MCP tools and shell hooks: compressed AST-aware reads, ~13-token cached re-reads, and 88–99% smaller command output. Sessions stay sharp longer because the window fills with signal instead of noise. Setup is one command: lean-ctx setup.

The problem

Where Claude Code spends your tokens.

Plan limits arrive mid-task

Long agentic sessions burn through usage limits because every file read and bash call lands raw in the window.

Compaction loses the plot

When the window fills, compaction summarizes away details you still need. Then the agent re-reads what it just forgot.

Bash output dominates the transcript

A single test run or install can cost more tokens than the code change itself.

Your stack. Your agent. Better context.

The integration

How LeanCTX plugs into Claude Code.

MCP server in claude config

lean-ctx setup registers the MCP server for Claude Code. You get ~13 lean-core tools by default (ctx_read, ctx_search, ctx_shell, …), with the full 81-tool catalog available on demand via ctx_call / ctx_expand.

CLAUDE.md guidance installed

Setup writes tool-preference rules so Claude Code reaches for compressed reads first. Automatically, in every session.

Session memory across restarts

Findings, decisions and progress persist in a local knowledge store and are restored into new sessions: less re-explaining, less re-reading.

Setup

One command. Auto-detected.

terminal
# install LeanCTX$ curl -fsSL https://leanctx.com/install.sh | sh
# auto-detect Claude Code and configure MCP + CLAUDE.md$ lean-ctx setup
# verify the wiring$ lean-ctx doctor
# see what a session saved$ lean-ctx gain

What changes

Three moments you'll notice.

The session that doesn't compact

Reads arrive 60–90% smaller, so the window fills 5–10× slower. Long tasks finish before compaction ever triggers.

The memory that survives

Tomorrow's session starts knowing what yesterday's learned, restored from the local knowledge store instead of re-read from disk.

The verifiable receipt

Every saving lands in an Ed25519-signed ledger. lean-ctx gain is a number you can audit.

Claude Code + LeanCTX, answered.

Using this at work?

Team gives your whole org one shared, audited context plane, and the ledger proves the savings to finance. Local use stays free forever, enforced by CI.

Support this project