Stop Paying Opus Prices for grep: A Claude Code Task Routing Matrix
Short_Regular_7191 · reddit · 2026-07-25
The author shares a task routing strategy used in Claude Code, utilizing a ROUTING.md file to guide the LLM in automatically selecting the appropriate model tier based on task complexity (R1-R9).
Core Mechanism
- Task Classification: Divides dev tasks into 9 levels. R1 is a micro-fix handled by the current session; R2 is codebase recon delegated to a Haiku subagent; R8 covers high-risk ops like DB migrations, strictly requiring a top-tier model (e.g., Opus) and human confirmation.
- Escalation Red Lines: Forces a model tier upgrade after 2 failed attempts or scope surprises, preventing low-tier models from grinding and wasting tokens.
- Context Cost: Notes that if the current session has already loaded relevant context, delegating down to a cheaper model might actually increase costs due to the need to re-read files.
Auto-loaded via CLAUDE.md at session start, this setup turns the model into a dispatcher, effectively controlling API overhead while ensuring code safety.
More from coding & agent
- AWS on agent prompt caching: explicit + implicit patterns to slash token costs — AWS ML Blog · 2026-10-27
- He gave his AI agent a phone number and email — then hired it as social media manager — heyshrutimishra · 2026-10-27
- Firecrawl launches Alexandria company-data API and announces $75M Series B — devdigest · 2026-10-27
- Entire Builds a Git Forge Designed for Agent-Human Collaboration — lizziepika · 2026-10-27
- 'Let an agent run wild on vague goals and it makes your code worse 9 out of 10 times' — eptwts · 2026-10-27
- LangChain to demo the in-house design agent its team uses daily, this Wednesday — LangChain · 2026-10-27