cost-tier-routing
Skill6 starsChanged 34 days agoMITView on GitHub
Use BEFORE doing direct file search, bulk reads, data import/export, or routine coding edits in the main conversation. Routes work to the cheapest model that can do it correctly — haiku for search/IO, sonnet for coding, opus for orchestration/architecture. Triggers when about to call Read on >2 files, Grep/Glob across the repo, batch CSV/JSON transforms, or any "where is X / list all Y / count Z" question. Also triggers when the orchestrator (you, on opus) is about to write straightforward code that a sonnet subagent could handle.
In this repository79 other files it gives its agents.
- adr-phase-coverageSkill
- aposd-red-flag-reviewSkill
- apple-on-device-aiSkill
- artifact-gatesSkill
- asc-app-create-uiSkill
- asc-build-lifecycleSkill
- asc-cli-usageSkill
- asc-crash-triageSkill
- asc-id-resolverSkill
- asc-localize-metadataSkill
- asc-metadata-syncSkill
- asc-notarizationSkill
- asc-ppp-pricingSkill
- asc-release-flowSkill
- asc-revenuecat-catalog-syncSkill
- asc-shots-pipelineSkill
- asc-signing-setupSkill
- asc-submission-healthSkill
- asc-subscription-localizationSkill
- asc-testflight-orchestrationSkill
- asc-wall-submitSkill
- asc-workflowSkill
- asc-xcode-buildSkill
- choose-boring-technologySkill
- ci-preflightSkill
- conways-lawSkill
- cost-routingSkill
- cunninghams-lawSkill
- ddd-strategic-auditSkill
- ddd-tactical-reviewSkill
- debug-test-captureSkill
- developing-ios-appsSkill
- doerrs-lawSkill
- fitts-lawSkill
- fix-regression-guardSkill
- galls-lawSkill
- goodharts-lawSkill
- greenspuns-tenth-ruleSkill
- gsd-core-hooksSkill
- hofstadters-lawSkill
- hyrums-lawSkill
- ios-accessibilitySkill
- ios-simulator-boot-healthSkill
- kerckhoffs-principleSkill
- kernighans-lawSkill
- knuths-optimization-principleSkill
- lady-lovelaces-objectionSkill
- leaky-abstractionsSkill
- linuss-lawSkill
- mobile-ios-designSkill
- money-boundary-judgmentSkill
- moores-lawSkill
- no-deferSkill
- norvigs-lawSkill
- parkinsons-lawSkill
- peter-principleSkill
- postels-lawSkill
- post-fix-traceSkill
- qa-test-architectSkill
- rubber-duckSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
7 rules. About 0 are common, 6 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈6
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 14
Before any of these actions in the main (opus) context, dispatch to a subagent instead:
- Distinctive: line 28
Keep on opus (the orchestrator):
- Distinctive: line 38
When you (opus) recognize a routable task:
- Distinctive: line 42
Read the report, don't redo the work: If the subagent missed something, dispatch again with a sharpened brief — don't bail out and do it …
- Very specific: line 43
Parallel where independent: If you need three unrelated searches, fire three haiku-scout calls in one message.
- Distinctive: line 50
When the user explicitly asked you to do it directly.
- Distinctive: line 67
Before every tool call in the main context, ask: *Could a cheaper model do this exact action with the same correctness?* If yes, dispatch.
≈ “Common” is an estimate: at least 1 in 5 of the 372,429 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
Cost-Tier Routing
Opus tokens cost ~5x sonnet and ~25x haiku. Doing Read and Grep on opus is lighting money on fire. This skill is the discipline for routing every action to the cheapest model that can do it correctly.
This skill requires three companion agents —
haiku-scout,haiku-importer, andsonnet-coder— installed in~/.claude/agents/. See this package'sREADME.mdfor the two-step install. The skill is inert without the agents because themodel:pin lives in the agent files, not here.
The rule
Before any of these actions in the main (opus) context, dispatch to a subagent instead:
| Action | Route to | Why |
Read more than 1–2 files in a row | haiku-scout | Bulk reads burn opus context |
Grep / Glob across the repo | haiku-scout | Mechanical lookup |
| "Where is X defined?" / "What references Y?" | haiku-scout | Pure search |
| Count LOC, list files, read a config | haiku-scout | Trivial IO |
| Convert/parse/split/merge data files | haiku-importer | Mechanical transform |
| Download + parse a fixture or seed file | haiku-importer | Mechanical IO |
| Write code at a known location with a known design | sonnet-coder | Implementation, not design |
| Refactor a function with clear constraints | sonnet-coder | Bounded edit |
| Run tests / typecheck after an edit | sonnet-coder (bundle with the edit) | Don't bounce back to opus mid-task |
Keep on opus (the orchestrator):
- Architectural decisions, tradeoff analysis
- Reading subagent reports and deciding the next step
- Synthesis across multiple subagent outputs
- User-facing explanations and recommendations
Tool split (CodeGraph first, Memtrace for heavy hits). Use CodeGraph (codegraph_explore / codegraph CLI) for symbol lookup, file reads, callers/callees, and ordinary blast radius. Reserve Memtrace (and cortex) for git history/evolution, recall_decision, cross-repo/API topology, risky blast radius (get_impact), PR review evidence, and dead code/complexity, because Memtrace costs quota. If ~/.claude/state/memtrace-quota.json says blocked with a future until, never call Memtrace; use CodeGraph until that time.
The dispatch pattern
When you (opus) recognize a routable task:
- Phrase the brief like a closed ticket, not an open question. Include: exact files/dirs, exact output format, exact verification command.
- Call
Agentwith the rightsubagent_type—haiku-scout,haiku-importer, orsonnet-coder. The model is pinned in the agent file; do not override unless you have a specific reason. - Read the report, don't redo the work. If the subagent missed something, dispatch again with a sharpened brief — don't bail out and do it yourself on opus.
- Parallel where independent. If you need three unrelated searches, fire three
haiku-scoutcalls in one message.
When to NOT route
- A single one-line
Readof a file you're about to edit yourself — just read it. - A trivial
Grep(one pattern, one directory) you're about to act on immediately — just grep. - Tasks already inside a subagent — subagents do their own work, they don't recursively dispatch the same tier.
- When the user explicitly asked you to do it directly.
The threshold is roughly: if the action will take >3 tool calls or >1000 tokens of file content, route it.
Red flags (you're about to waste money)
- "Let me read these 8 files to understand the structure" → STOP, dispatch
haiku-scoutwith a structural-survey brief. - "Let me grep for all usages, then read each one" → STOP, dispatch
haiku-scoutto return paths+excerpts in one shot. - "I'll just write this small fix" while sitting on opus → consider
sonnet-coderif it involves >1 file or any test run. - "Let me convert this CSV real quick" → STOP, dispatch
haiku-importer.
Escalation back to opus
Subagents are instructed to escalate when they hit reasoning work. When you get a report ending in ESCALATE: ..., that's the signal that the next step is genuinely yours. Don't push it back down — handle it on opus and re-dispatch a sharpened mechanical task if needed.
Self-check
Before every tool call in the main context, ask: Could a cheaper model do this exact action with the same correctness? If yes, dispatch. If no, proceed.
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.

