Agent skill
model-routing
Model selection strategy for subagents — haiku for exploration, sonnet for implementation, opus for architecture/security
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/other/other/model-routing
SKILL.md
Model Routing Strategy
Route subagents to the cheapest sufficient model. The model parameter on Task tool calls controls this.
When to Run
- Before dispatching Task subagents (which model to use?)
- When a subagent fails quality review (escalate to next tier?)
- When reviewing Ralph epic configuration
Routing Table
| Task Type | Model | Rationale |
|---|---|---|
| Exploration/search (Explore agents) | haiku | Fast, cheap, sufficient for find/read |
| Simple edits, single-file changes | haiku | Clear instructions, low complexity |
| Documentation writing | haiku | Structure is straightforward |
| Multi-file implementation | sonnet | Best balance for coding tasks |
| PR/code review | sonnet | Understands context, catches nuance |
| Test writing | sonnet | Needs pattern matching, not deep reasoning |
| Complex architecture, planning | opus | Deep reasoning required |
| Security analysis | opus | Can't afford to miss vulnerabilities |
| Debugging complex bugs | opus | Needs to hold entire system in mind |
| Ralph subagent tasks | sonnet | Default for autonomous execution, escalate on failure |
Fallback Escalation
When a subagent fails quality review, retry with the next tier:
- haiku fails → retry with sonnet
- sonnet fails → retry with opus
- opus fails → record failure (circuit breaker)
Do NOT escalate for:
- Syntax errors (fix in same tier)
- Missing imports (fix in same tier)
- Test-only failures with obvious fix (fix in same tier)
Only escalate when the failure indicates insufficient reasoning capability.
Examples
# Explore agent — use haiku
Task(subagent_type="Explore", model="haiku", ...)
# Implementation subagent — use sonnet
Task(subagent_type="general-purpose", model="sonnet", ...)
# Architecture/security review — use sonnet (or opus for security-critical)
Task(subagent_type="code-reviewer", model="sonnet", ...)
Cost Reference
| Model | Input/MTok | Output/MTok | Relative Cost |
|---|---|---|---|
| Haiku | $0.80 | $4.00 | 1x |
| Sonnet | $3.00 | $15.00 | ~4x |
| Opus | $15.00 | $75.00 | ~19x |
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?