lean-context
Skill1 starsChanged 24 days agoMITView on GitHub
Keep coding-agent sessions cheap on large, multi-repo projects. Use when setting up or auditing a project for Claude Code (CLAUDE.md, project map, settings, tools), when sessions start with a large context, or before long multi-day tasks.
7 other projects use a version of this.
Adopted by
Most recently taken up by
- Wasif-ZA/metatroopertheir own version, first seen Nov 29, 2026
- OrionicsLtd/claude-skillstheir own version, first seen Nov 1, 2026
- EARTH157/claude-skillstheir own version, first seen Oct 25, 2026
- liujiarui0918/claude-code-codex-strongesttheir own version, first seen Oct 13, 2026
- wangxiaohuiboy/lean-agent-skillstheir own version, first seen Sep 10, 2026
- sayeediftekhar/lean-contexttheir own version, first seen Jul 28, 2026
Other versions7 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 7
- Kevinchamplin/claude-skills★ 3same name
- liujiarui0918/claude-code-codex-strongest★ 1same name
- OrionicsLtd/claude-skills★ 1same name
- Wasif-ZA/metatrooper★ 1same name
- EARTH157/claude-skills★ 0same name
- sayeediftekhar/lean-context★ 0same name
- wangxiaohuiboy/lean-agent-skills★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
The file
Show its rules and text
We split this skill into the rules it gives an agent
15 rules. 0 are common, 12 are distinctive, and 3 are very specific to this project.
0
Common
Most of the 7 edited versions we read keep these.
12
Distinctive
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 12
Create PROJECT_MAP.md at the project root (template in templates/).
- Distinctive: line 16
Put a short "how to read cheaply" block at the top (see the template) and a never-open list for bulky folders.
- Very specific: line 17
Keep it complete automatically: python scripts/mapcheck.py --install-hook warns on every commit when a file is missing from the map or a …
- Distinctive: line 19
When the agent adds, moves or removes a file, it fixes the map row in the same turn.
- Distinctive: line 28
Start every source file, config and script with a header comment saying what it is and when to use it.
- Distinctive: line 30
Prefer a code-graph or symbol-search tool for "where is this used" over opening files.
- Distinctive: line 31
Never list whole trees. Provide a tree command that skips bulk folders.
- Distinctive: line 34
Every tool and MCP server definition costs context in every session, used or not.
- Distinctive: line 46
Keep findings in a small knowledge base with a find step (even a TSV plus grep).
- Distinctive: line 51
No sub-agents or side sessions unless the user asks.
- Distinctive: line 56
Start a fresh session and note the context size before any prompt.
- Distinctive: line 58
Check CLAUDE.md size and contents.
- Very specific: line 59
Create or update PROJECT_MAP.md.
- Distinctive: line 60
Add header comments to the most-opened files.
- Distinctive: line 62
Start a fresh session again and compare the context size.
“Common” is measured: kept by at least 6 in 10 of the 7 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Lean context
Goal: the agent should start small, find any file in one or two steps, and never read or load what the task does not need. Every token the agent spends finding things is a token not spent on the work.
1. Index the library: one project map
Create PROJECT_MAP.md at the project root (template in templates/). One row per doc, config, source folder and
tool: the path in backticks, one line on what it is, and when to open it.
- Pointers only, never facts (values, states, rules). Facts live in the files the map points to, so the map cannot go stale against them.
- Put a short "how to read cheaply" block at the top (see the template) and a never-open list for bulky folders.
- Keep it complete automatically:
python scripts/mapcheck.py --install-hookwarns on every commit when a file is missing from the map or a row points to nothing. - When the agent adds, moves or removes a file, it fixes the map row in the same turn.
2. Keep the always-loaded context tiny
CLAUDE.md: rules only (safety, git, where things are). Aim for a few KB. Point to the map; do not copy it.STATUS.md(template): current state in at most 40 lines, rewritten at the end of each session, read at the start only when the task is not self-contained.- Decision log and change log are newest-first: read the top (about 60 lines) or grep. Never whole.
3. Find before you read
- Start every source file, config and script with a header comment saying what it is and when to use it. The agent reads the header, greps, then reads a line range.
- Prefer a code-graph or symbol-search tool for "where is this used" over opening files.
- Never list whole trees. Provide a tree command that skips bulk folders.
4. Tool diet
Every tool and MCP server definition costs context in every session, used or not.
- Deny tools the project never uses in
.claude/settings.local.json(example intemplates/). - Enable only the MCP servers this project needs; prefer per-project
.mcp.jsonover global ones. - Hard-deny reads of bulky generated folders (decompiler projects, caches, build output, backups).
- Desktop-app integrations add their own tools: for long technical work a terminal or editor session can start much smaller.
5. Expensive output goes to disk
Wrap heavy commands (decompilers, whole-tree linters, big logs, API dumps) with scripts/cached.py: the full output
is written once to .cache/cmd/, the agent sees the path and the first lines, then greps the file. Re-runs are free.
6. Never learn the same thing twice
Keep findings in a small knowledge base with a find step (even a TSV plus grep). Rule for the agent: look it up before researching, record what it learned in the same turn.
7. Session habits
- One task per session; clear between unrelated tasks; end each session by rewriting STATUS.md.
- No sub-agents or side sessions unless the user asks. When parallel work is worth it: one coordinator, at most two workers, each with a written brief naming the only files it may write. Cheaper models for mechanical work.
- Measure: note the context size at session start before and after each change, and keep what pays.
Audit checklist (run on an existing project)
- Start a fresh session and note the context size before any prompt.
- List loaded tools and MCP servers; deny what the project does not use.
- Check CLAUDE.md size and contents; move facts out, keep rules and pointers.
- Create or update PROJECT_MAP.md; run mapcheck until it is clean; install the hook.
- Add header comments to the most-opened files; add a never-open list.
- Wrap the heaviest commands with cached.py.
- Start a fresh session again and compare the context size.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

