Context Primitives
Five operations. One context boundary.
Each operation maps to a fundamental context decision your agent makes before inference.
Read
Load files with 10 compression modes. Cached across the entire session.
Search
Find symbols, patterns, or meaning across the project with compact results.
Shell
Run commands with 95+ output compression patterns built in.
Compress
Reduce any content while preserving the operational signal.
Measure
Record cost, quality, and the context path for every task execution.
Integration Depths
Start where you are. Go deeper when ready.
Zero-code
Add LeanCTX as a proxy or MCP server to any existing coding agent. No code changes required.
Wrap calls
Route tool reads and model calls through the context boundary. One line to wrap an existing agent.
Native SDK
Build context policy directly into your agent architecture. Full control over selection and receipts.
Real Code
Context control in six lines.
from leanctx import LeanCTX
ctx = LeanCTX(project=".")
agent = ctx.wrap(my_agent)
result = agent.run(task)
receipt = ctx.receipt()
# receipt.baseline_cost → $0.37
# receipt.treatment_cost → $0.058
# receipt.quality → PASS
# receipt.cost_delta → -84.3%Get Started
One command. Full context control.
# Install the SDK
pip install lean-ctx
# Or install the runtime directly
curl -fsSL https://leanctx.com/install | sh
# Run your first benchmark
lean-ctx evidence realworld \
--baseline "stock" \
--treatment "optimized"Proof Doctrine