Repo map
About 2k tokens at session start: every file and its top-level symbols as name:line.
Exploring −50% turns; symbol lookups −47% to −60% cost.
A plugin for Claude Code and Cursor
Your coding agent wastes turns: wandering your repo, editing one file per call, pasting whole test logs. Every turn costs you time and budget. lean cuts them.
Run both inside Claude Code, then restart it.
/plugin marketplace add jkcailteux/lean-plugin
/plugin install lean@lean-marketplace
fetch(). One block is one turn.Against vanilla Claude Code on Claude Opus 5.5: 8 tasks, two runs. Yours will vary; /lean:stats estimates it.
Biggest wins where Claude would otherwise explore or edit file by file.
Mean of 2 to 8 runs per task. Single tasks swing by chance, so read the pattern. On a one-shot grep lean costs about a cent more.
One Node file, no dependencies. Hooks run once per session, never per tool call.
About 2k tokens at session start: every file and its top-level symbols as name:line.
Exploring −50% turns; symbol lookups −47% to −60% cost.
Many edits across many files in one call, no prior read.
Edits −80% turns, −50% wall time, no failed calls.
Several files in one read. Test runs that return only the failures.
Removing them cost +10% and 4× the exploring turns.
Back in a big session after the cache expired? lean says so once and suggests /compact.
Simulated: −36% to −42% when you compact on the warning.
/lean:stats shows what your sessions cost, which tools fill your context, and what lean saved.
> /lean:stats Last 24h · 1 session(s) in this project Spent ≈ $18 at API list prices over 161 turns median turn 5s What lean saved (estimates) lean:BatchEdit 10 round trips $1.10 46s lean:RunCompact 708 tokens $0.01
Every turn re-reads the whole conversation, so long sessions are where the money goes.
autoCompactWindow: 200000.simulated spend over 8,158 real turns with the guard plus autoCompactWindow: 200000. Compact sooner.
Two commands, one restart.
/plugin marketplace add jkcailteux/lean-plugin
/plugin install lean@lean-marketplace
~/.claude/settings.json{ "autoCompactWindow": 200000 }Copy the plugin into Cursor's local plugins folder. No restart.
git clone https://github.com/jkcailteux/lean-plugin
rsync -a --exclude test lean-plugin/plugins/lean/ ~/.cursor/plugins/local/lean/
Turn on Include Third-Party Plugins, Skills, and Other Configs. The repo map needs it.
In Cursor, ask the agent what lean saved. Skipped round trips are a share of the model calls in Cursor's transcripts; the time saved is an estimate, since Cursor stores only each prompt's time, to the minute. In Claude Code, /lean:stats shows both: what lean saved there and in Cursor for the same project. The context guard is Claude Code only, and the Cursor port isn't benchmarked yet.
Use it, fork it, ship it.
No network code.
No background process.