A Claude Code setup for matching cheaper models to simpler tasks

The post describes a cost problem in Claude Code when subagents use the session’s default model for every task. It proposes using CLAUDE.md to route tasks to Haiku, Sonnet, or Opus based on task difficulty. The post includes a routing table and three behavior rules.

Key points

  • Claude Code subagents may inherit an expensive default model from the main session.
  • The post suggests using Haiku for simple tasks, Sonnet for medium tasks, and Opus for harder tasks.
  • CLAUDE.md is used to write the routing rules for model choice.
  • The goal is to reduce token and model costs without weakening tasks that need deeper reasoning.

Quick term guide

subagents
Smaller, specialized AI helpers that work under a main AI system to handle specific tasks.
subagent
A separate Claude instance that handles one specific task at the same time as other subagents, enabling parallel work.
CLAUDE.md
A project instruction file that tells Claude Code how to work with the codebase.
AI agents
AI agents are AI tools that can carry out steps toward a goal, not just answer once.
AI agent
An AI program that can inspect information and suggest what to do next.
reasoning
The ability of the AI to think through complex steps to find a solution.
workflow
A repeatable set of steps for getting a task done.
routing rules
Instructions that tell a server or computer which network path to send specific data through.
Read original