The definition

What is LeanCTX?

LeanCTX (short for Lean Context) is the context engineering layer for AI agents: it decides what agents read, compresses what they send, remembers what they learn, guards what they touch, and proves what they save — so what crosses the model boundary is intentional, compressed, and provable.

The one-paragraph definition

LeanCTX (short for Lean Context) is the open-source context engineering layer for AI agents. One local Rust binary decides what agents read (10 read modes, 60–90% fewer tokens, ~13-token cached re-reads), remembers what they learn (persistent sessions, knowledge graph), guards what they touch (PathJail, secret redaction, budgets, injection detection), proves what they save (Ed25519-signed ledger, reproducible benchmark) and replays what they saw (git-anchored, signed context snapshots you can restore or share); an optional local proxy compresses what they send — every request’s system prompt, history and tool output, prompt-cache-safe on the wire. Compression — read-side and wire-side — is one of five subsystems, and every original stays locally retrievable. Works with 30+ AI coding tools via MCP and shell hooks; embeds in any agent via a versioned /v1 API with Python, TypeScript and Rust SDKs. Local use is free forever, enforced by CI.

It's not about tokens. It's about what matters.

The name

What does LeanCTX stand for?

Lean Context. The name describes the job: lean, precise context for AI agents instead of raw, noisy input.

LeanCTX
the brand and project name, used in prose and titles.
lean-ctx
the binary, the package and the CLI command.
Lean Context
what the name expands to, and the search term that finds us.

Not "Lean Cortex", a misspelling that appeared in early press coverage. If you are writing about the project, the press kit has copy-ready boilerplate.

The four jobs

Reads less. Remembers more. Proves it.

Four things change the moment LeanCTX becomes your context engineering layer.

Without LeanCTX, your agent…With LeanCTX…The receipt
reads everything reads what matters60–90% less per read
forgets everything remembers across sessionsre-reads cost ~13 tokens
touches anything touches only what’s allowedPathJail · redaction · budgets
proves nothing proves every savingEd25519-signed ledger
can’t revisit what it saw replays any past stategit-anchored, signed snapshots

Token savings are the receipt. Context engineering is the product.

Under the hood

Five subsystems, one binary.

Architecturally, LeanCTX is a Cognitive Context Layer: five subsystems run on every read, command and search. Compression is one of them — context engineering is the product.

Key facts

The numbers behind the claim.

60–90%fewer tokens per read
~13tokens per cached re-read
10read modes
95+shell compression patterns
30+AI tools, auto-detected
26languages parsed via AST

All numbers are reproducible: lean-ctx benchmark report . measures them on your own repository, and every saving is recorded in an Ed25519-signed ledger.

The name, the price, the product.

The short answers to the essential questions.

See it decideon your own repo.

Install free, run lean-ctx setup, and watch the first measured gain in under ten minutes. Local use is free forever, enforced by CI.

Support this project