Quand l'utiliser : Your monthly AI coding bill is growing and you want to reduce it without changing your workflow.
Prérequis
- lean-ctx installed — brew install lean-ctx or curl -fsSL https://leanctx.com/install.sh | sh
Déroulement
-
One-command setup
Run: lean-ctx setup✓ Copié
→ Shell hooks installed, all detected editors configured automatically
-
Code normally for a day
Use your AI coding tool as usual — lean-ctx works transparently in the background.✓ Copié
→ No workflow change; compression happens silently
-
Check savings
Run: lean-ctx gain✓ Copié
→ Dashboard showing token savings per category (file reads, git, shell, etc.)
Résultat : Measurable token reduction (typically 60-90%) with zero workflow friction.
Pièges
- Compressed output confuses some edge-case prompts — Use
lean-ctx-off to temporarily disable, or use ctx_read with 'full' mode for specific files
Quand l'utiliser : Your AI assistant wastes tokens reading entire files when it only needs the structure or signature.
Déroulement
-
Use map mode for overview
lean-ctx read src/main.rs -m map✓ Copié
→ File structure at ~10% of full token cost
-
Use signatures mode for API
lean-ctx read src/lib.rs -m signatures✓ Copié
→ Just function/type signatures, no bodies
-
Use diff mode for changes
lean-ctx read src/main.rs -m diff✓ Copié
→ Only lines changed since last read — minimal tokens
Résultat : The AI gets exactly the context it needs at a fraction of the token cost.
Pièges
- Aggressive mode strips too much for complex refactoring — Use 'task' mode instead — it preserves context relevant to the current task
Quand l'utiliser : You're using Claude Code for architecture and Cursor for implementation, and they keep re-reading the same files.
Déroulement
-
Build context in agent A
In Claude Code: analyze the architecture of this project using ctx_overview.✓ Copié
→ Context built and cached by lean-ctx
-
Share to agent B
In Cursor: use ctx_share to pull the architecture context from the last session.✓ Copié
→ Cursor gets the architecture map without re-reading all files
-
Track costs across agents
lean-ctx gain --all-sessions✓ Copié
→ Combined savings across both agents
Résultat : Multiple agents share a cached context layer, avoiding redundant file reads.
Pièges
- Stale cache after file changes — lean-ctx tracks file modification times — cache invalidates automatically on change