--- name: model-router description: Use when any user request arrives before responding. Classify task complexity and select the right Claude model and effort level before doing anything else. --- # Model Router ## Overview Before responding to any request, rate it on two scales: **model** (Haiku / Sonnet / Opus) and **effort** (Low / Medium / High). Then behave accordingly — shallower for simple tasks, deeper for complex ones, and route subagents to cheaper models for grunt work. ## Classification Table | What the request looks like | Model | Effort | |-----------------------------|-------|--------| | Single question, factual lookup, find a file, fix a typo, rename something | **Haiku** | **Low** | | Add/change a feature, explain a system, fix a moderate bug, write tests, refactor 1–3 files | **Sonnet** | **Medium** | | Design new architecture, debug across many files, build something from scratch, many unknowns, high stakes | **Opus** | **High** | ### Quick signals — Haiku / Low - "What does X mean?" / "Where is Y?" - One-line fix, rename, or typo - Explain a single concept - Run a quick command and report back ### Quick signals — Sonnet / Medium - Change or add a feature to existing code - Explain how a whole system works - Standard debugging with a clear reproduction - Refactoring or writing tests for existing code ### Quick signals — Opus / High - Architecture or system design from scratch - Complex bug with unclear root cause spanning many files - Full feature implementation with many moving parts - Tasks with high uncertainty or high risk of getting it wrong - Long multi-step plans or orchestrating many subagents ## Required Steps — Do These Every Time 1. **Announce the rating** at the very top of your first response: ``` > Model: Sonnet · Effort: Medium ``` 2. **Behave at the rated effort level:** - **Low** — Answer directly. One pass. No extra exploration. Skip verification unless obvious. - **Medium** — Verify assumptions before acting. Moderate depth. Check your work once at the end. - **High** — Full exploration first. Consider edge cases. Try multiple approaches. Thorough verification. Spawn subagents for parallel work. 3. **Assign subagent models to match the subtask, not the overall task:** - File reads, quick searches, simple lookups → `model: "haiku"` - Code analysis, moderate edits, explanations → `model: "sonnet"` - Complex reasoning, architecture decisions → no override (inherits current model) ## Escalation If you discover mid-task the work is harder than rated, re-announce before continuing: ``` > Escalating to: Opus · High — found cross-system dependency not visible upfront ``` ## Model Mismatch Warning If the task clearly needs Opus but the conversation is running on a lighter model, say so once at the top: ``` > ⚠️ This task is Opus-level. You may get better results restarting in Opus mode. ``` Then do your best with what's available. ## Common Mistakes | Mistake | Fix | |---------|-----| | Rating everything Opus/High | Most requests are Sonnet/Medium. Reserve Opus for genuine complexity. | | Rating everything Haiku/Low to save tokens | Haiku should not handle multi-file tasks or judgment calls. | | Spawning Opus subagents for file searches | Always use `model: "haiku"` for mechanical reads and lookups. | | Forgetting to announce the rating | Always show the `> Model: X · Effort: Y` line first. | | Not escalating when complexity grows | Re-announce when you discover the task is bigger than it looked. |