Когда использовать: Your monthly AI coding bill is growing and you want to reduce it without changing your workflow.
Предварительные требования
- lean-ctx installed — brew install lean-ctx or curl -fsSL https://leanctx.com/install.sh | sh
Поток
-
One-command setup
Run: lean-ctx setup✓ Скопировано
→ 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.✓ Скопировано
→ No workflow change; compression happens silently
-
Check savings
Run: lean-ctx gain✓ Скопировано
→ Dashboard showing token savings per category (file reads, git, shell, etc.)
Итог: Measurable token reduction (typically 60-90%) with zero workflow friction.
Подводные камни
- Compressed output confuses some edge-case prompts — Use
lean-ctx-off to temporarily disable, or use ctx_read with 'full' mode for specific files
Когда использовать: Your AI assistant wastes tokens reading entire files when it only needs the structure or signature.
Поток
-
Use map mode for overview
lean-ctx read src/main.rs -m map✓ Скопировано
→ File structure at ~10% of full token cost
-
Use signatures mode for API
lean-ctx read src/lib.rs -m signatures✓ Скопировано
→ Just function/type signatures, no bodies
-
Use diff mode for changes
lean-ctx read src/main.rs -m diff✓ Скопировано
→ Only lines changed since last read — minimal tokens
Итог: The AI gets exactly the context it needs at a fraction of the token cost.
Подводные камни
- Aggressive mode strips too much for complex refactoring — Use 'task' mode instead — it preserves context relevant to the current task
Когда использовать: You're using Claude Code for architecture and Cursor for implementation, and they keep re-reading the same files.
Поток
-
Build context in agent A
In Claude Code: analyze the architecture of this project using ctx_overview.✓ Скопировано
→ 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.✓ Скопировано
→ Cursor gets the architecture map without re-reading all files
-
Track costs across agents
lean-ctx gain --all-sessions✓ Скопировано
→ Combined savings across both agents
Итог: Multiple agents share a cached context layer, avoiding redundant file reads.
Подводные камни
- Stale cache after file changes — lean-ctx tracks file modification times — cache invalidates automatically on change