lean-agents
Skill1 starsChanged 32 days agoMITView on GitHub
Make subagents load only the context they need and run on the cheapest model that fits, with a routing table for the main session.
In this repository25 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- auditSkill
- autonomySkill
- batch-wakeupsSkill
- code-mapSkill
- codex-dispatchSkill
- cycleSkill
- flowSkill
- frictionSkill
- guardrailsSkill
- modelsSkill
- planningSkill
- reviewSkill
- rosterSkill
- scanSkill
- scheduleSkill
- slim-instructionsSkill
- speedSkill
- startSkill
- test-loopSkill
- tools-before-tokensSkill
- trim-contextSkill
- undoSkill
- whats-newSkill
The file
We split this skill into the rules it gives an agent
4 rules. About 0 are common, 1 is distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
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 11
Not in Claude Code?: Read docs/hosts.md in the plugin root first.
- Very specific: line 23
Look at my custom agents (<Claude config dir>/agents/*.md and .claude/agents/*.md) and how the main session uses them (the usage audit in …
- Distinctive: line 33
Use "retry once with more effort before moving to a bigger model" as the escalation rule.
- Very specific: line 38
If both exist, propose .claude/agent-context/common.md (the few project rules every agent needs) plus one short role file per agent type …
≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Lean subagents and model routing
Plugin root: ${CLAUDE_PLUGIN_ROOT}. If that is still a ${...} placeholder, use the folder that contains skills/ (this file is skills/<name>/SKILL.md), and substitute that path, in quotes, wherever this skill uses CLAUDE_PLUGIN_ROOT.
Not in Claude Code? Read docs/hosts.md in the plugin root first. Skip steps that only work in Claude Code, and follow its propose-only rule before changing any host configuration.
Each subagent loads only the context its job needs and runs on the cheapest model that does that job well. The main session routes work to it on purpose, not by habit.
Changes: edits agent definitions, settings and hooks, after you approve. Back up <Claude config dir>/agents/ and <Claude config dir>/settings.json first.
Autonomy: follow ${CLAUDE_PLUGIN_ROOT}/docs/autonomy.md. The mode comes from the skill argument (propose, safe, auto or yolo), else docs/kaizen/config.json, else agent-kaizen.json in your Claude config dir ($CLAUDE_CONFIG_DIR or ~/.claude), else propose. In safe and auto, read every "wait for my OK" below as: apply it yourself if the mode allows (backup, verify, roll back on failure, ledger row), otherwise list it as a proposal. Hard stops always ask. At most maxChangesPerRun changes (default 3). End with a summary of what was applied, skipped and rolled back.
In this skill, <Claude config dir> means $CLAUDE_CONFIG_DIR or ~/.claude, and <Codex home> means $CODEX_HOME or ~/.codex.
Task
Look at my custom agents (<Claude config dir>/agents/.md and .claude/agents/.md) and how the main
session uses them (the usage audit in docs/kaizen/ shows spawn counts and cost per type).
For each agent report: model, effort, tools allowlist (or none), what instructions it loads, and median cost per spawn. Then propose:
- Model tiers by job:
- cheapest model: reading code, running commands, judging one specific claim;
- mid tier: routine coding, tests, routine plans and reviews;
- top tier: hard debugging, architecture trade-offs, escalations. Use "retry once with more effort before moving to a bigger model" as the escalation rule.
- A tools allowlist for every agent: read-only agents get no Edit or Write.
- Smaller context. Check the current Claude Code documentation for: (a) an agent frontmatter option that stops a subagent loading CLAUDE.md; (b) a SubagentStart hook that can add context to a subagent. If both exist, propose .claude/agent-context/common.md (the few project rules every agent needs) plus one short role file per agent type (coding, planning, review, research), injected by a hook script keyed on the agent type. Note that built-in general-purpose agents still load everything, so the main session should prefer the custom ones.
- A routing table for the main CLAUDE.md: task shape → agent → model → effort. Keep it to about 20 rows.
Back up the files you will touch to a dated folder first. Show every change as a diff and wait for my OK. Add a ledger row per change.
Bundled resources
Templates: ${CLAUDE_PLUGIN_ROOT}/templates/agents/*.md (frontmatter with omitClaudeMd: true, tools allowlists), ${CLAUDE_PLUGIN_ROOT}/templates/agent-context/ (common.md, role files, roles.conf) and the hook ${CLAUDE_PLUGIN_ROOT}/hooks/subagent-context.sh.
Done when
cheaper spawns and fewer escalations to the top model. The audit shows the effect per agent type.
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.

