Dev.to AI 🤖 Ai 👁 0 📖 5 min read

Sonnet-Main, Opus-advisor, Haiku-subagents… Splits your Claude Code session across three models

Model configuration in Claude Code is usually one decision: which model runs the session. That is a single slider for three different jobs. There is the driver that reads your code and edits files, there is the second op

Sonnet-Main, Opus-advisor, Haiku-subagents… Splits your Claude Code session across three models

Model configuration in Claude Code is usually one decision: which model runs the session. That is a single slider for three different jobs. There is the driver that reads your code and edits files, there is the second opinion you want at the hard moments, and there is the fan-out work that never needed a frontier model.

// Detect dark theme var iframe = document.getElementById('tweet-2108687263043575923-298'); if (document.body.className.includes('dark-theme')) { iframe.src = "https://platform.twitter.com/embed/Tweet.html?id=2108687263043575923&theme=dark" }

What the setting writes

sonnet-opus-advisor-haiku-subagents is a settings component, so installing it is one command:

npx claude-code-templates@latest --setting model/sonnet-opus-advisor-haiku-subagents

It asks for a scope (User, Project or Local) and merges this into that settings file:

{
  "model": "sonnet",
  "advisorModel": "opus",
  "env": {
    "CLAUDE_CODE_SUBAGENT_MODEL": "haiku",
    "CLAUDE_CODE_SUBAGENT_MODEL_FORCE": "1"
  }
}

Three keys, three tiers:

  • model is the session driver. Sonnet.
  • advisorModel is the model Claude consults when it wants a second opinion. Opus.
  • The two env vars pin every subagent to Haiku.

All of them use family aliases instead of full model ids, so the setting follows whatever version Claude Code currently recommends for each family. Two things to know about that. On Bedrock, Vertex and Microsoft Foundry the aliases are pinned to older provider versions, so pin a full id like claude-sonnet-5 there instead. And if you already export ANTHROPIC_MODEL in your shell, it wins over the model key and the Sonnet line does nothing.

Opus goes in the advisor slot, not the main slot

advisorModel is a top-level settings key. The advisor is a server-side tool: it receives the conversation including tool calls and their results, and Claude decides on its own when to reach for it. In practice that is before committing to an approach, when the same error keeps coming back, and before it declares a task done. No setting forces a call, and none caps how many it makes.

The constraint that matters when you edit this: the advisor has to rank at or above the session’s main model. Sonnet driving with Opus on call satisfies that. Haiku can call an advisor but cannot be one.

You do not need the file to try it. /advisor opus sets the same key and saves it to your user settings, /advisor off turns it off, and --advisor sets it for a single session at launch. Using the advisor outside the interactive CLI, in -p, the Agent SDK, the desktop app or Remote Control, needs Claude Code v2.1.260 or later.

Three caveats the install does not mention. The feature is still labeled experimental. It runs on the Anthropic API only, so it is absent on Bedrock, Claude Platform on AWS, Google Cloud’s Agent Platform and Foundry, and behind a gateway it works only if the gateway forwards the request intact. And it is switched on by a feature flag fetched from Anthropic, which is why DISABLE_TELEMETRY or CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC quietly keeps it off. To turn it off on purpose, CLAUDE_CODE_DISABLE_ADVISOR_TOOL=1 is the direct switch.

The subagent tier, and the flag that makes it stick

CLAUDE_CODE_SUBAGENT_MODEL sets the default model for subagents, agent-team teammates and workflow agents. On its own it is only a default. Resolution runs per-invocation model first, then the model: line in the subagent's own frontmatter, then this variable, then the main conversation's model. So a subagent whose file says model: opus ignores it completely.

CLAUDE_CODE_SUBAGENT_MODEL_FORCE is the part that makes the tier real. Set to 1, Claude Code ignores the model field in subagent definitions and runs all of them on Haiku. It needs v2.1.257 or later.

// Detect dark theme var iframe = document.getElementById('tweet-2108698604193939736-339'); if (document.body.className.includes('dark-theme')) { iframe.src = "https://platform.twitter.com/embed/Tweet.html?id=2108698604193939736&theme=dark" }

Two things to keep in mind. The force flag is blunt: if one agent genuinely needs a bigger model, drop CLAUDE_CODE_SUBAGENT_MODEL_FORCE from the env block and keep CLAUDE_CODE_SUBAGENT_MODEL, which leaves frontmatter in charge for the agents that declare a model and Haiku for everyone else. And neither variable touches the built-in Explore and Plan subagents.

One detail about the env block itself: it is documented for any settings scope, but in a shared project file most of its values only apply once the folder is trusted. If the subagent tier looks like it is not taking effect in a repo you just cloned, check that first.

What to expect

// Detect dark theme var iframe = document.getElementById('tweet-2108718097469235386-78'); if (document.body.className.includes('dark-theme')) { iframe.src = "https://platform.twitter.com/embed/Tweet.html?id=2108718097469235386&theme=dark" }

The session shape changes more than the output does. Sonnet stays in control of the edits, Haiku absorbs the exploration passes, and Opus shows up only at the points where Sonnet would otherwise commit to something and find out later it was wrong.

A short checklist before you leave it on:

  1. Confirm the advisor is actually alive. If telemetry is disabled anywhere in your environment, it is not.
  2. Watch the first few sessions for subagents that got quietly downgraded. Anything that was doing real reasoning in a subagent will feel it.
  3. Keep subagents on exploration. If you were already using them to write code, Haiku is the wrong tier for that and the setting is not the problem.
  4. If you want the model decided per turn instead of pinned in a file, that is a different component, not a different value in this one.

Where the settings live

You can follow me on my social media:

📰 Read the original article on Dev.to AI

Originally published by Dev.to AI. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.