AI Agents & Skills

Model routing for subagents: let Haiku do the chores, Opus the hard parts

TL;DR

A subagent is a Markdown file in .claude/agents/ with a model frontmatter field (sonnet, opus, haiku, inherit or a full ID). Send reading/searching to a small model, keep the big one for design and review. Set a default with CLAUDE_CODE_SUBAGENT_MODEL.

A cheap code-scouting subagent

---
name: code-scout
description: Find files, read logs, list call sites of a function. Use when surveying the codebase.
tools: Read, Glob, Grep
model: haiku
---
Read only, never edit. Return file + relevant lines, max 20 items.

Model resolution order

  1. The model Claude passes when invoking the subagent (if any).
  2. The model frontmatter field (inherit = main session's model).
  3. The CLAUDE_CODE_SUBAGENT_MODEL environment variable.
  4. The main session's model.

Suggested roles

RoleModelWhy
Scouting code, reading logs, summarizinghaikuLots of reading, little reasoning
Writing tests, small refactorssonnetBalanced speed/quality
Architecture, security reviewopus / inheritNeeds deep reasoning