claude-code icon indicating copy to clipboard operation
claude-code copied to clipboard

Let a subagent choose its own advisor model (per-agent advisorModel, or one rung above the caller)

Open ucsandman opened this issue 3 months ago • 2 comments

Problem

advisorModel is one global setting. Every subagent inherits it, and the only guard is "the advisor must be at least as capable as the base model", which skips the advisor when it is weaker but happily runs it as a peer.

In practice that means:

  • With advisorModel: opus, an Opus subagent gets an Opus advisor. A peer shares the worker's blind spots; the second opinion is mostly a second sample.
  • With advisorModel: fable, a Sonnet subagent gets a Fable advisor, and the advisor reads the full transcript, so a cheap worker asking a routine question spends top-tier tokens where Opus would have done the job.

There is no setting that gives both Sonnet -> Opus and Opus -> Fable in the same session.

Verified on 2.1.259: advisorModel is read once from settings, subagents receive the parent's value (getAdvisorSetting), the agent-definition frontmatter has no advisor key, and the advisor call is server-side, so a PreToolUse hook cannot see or rewrite it.

Request

Either of these would solve it; the first is simpler and fully explicit.

  1. Per-agent frontmatter key. Let .claude/agents/*.md declare advisorModel:, overriding the session setting for that agent only. Example:

    ---
    name: opus-owner
    model: opus
    advisorModel: fable
    ---
    
  2. A relative value. Accept advisorModel: "escalate" (or similar) meaning "the next model up from the caller's own model, capped at the top". Sonnet -> Opus, Opus -> Fable, Fable -> Fable. This needs no per-agent configuration and matches how the capability check already ranks models.

Why it matters

Teams that route work by model tier (Haiku lookups, Sonnet implementation, Opus ownership, Fable for architecture and security calls) want the advisor to follow the same ladder. Today the choice is between a peer advisor for the strongest workers or an over-provisioned one for the cheapest, session-wide.

Workaround in use

A user-defined advisor subagent plus a PreToolUse hook that injects the escalated model through updatedInput. It works for the harness advisor but cannot touch the native one, so Opus workers are steered away from the native advisor by prompt text only.

ucsandman avatar Sep 03 '26 06:09 ucsandman

+1. I want one advisor rung up from whatever model is running:

  • haiku → sonnet
  • sonnet → opus
  • opus → fable

This should apply to spawned subagents (resolved by the subagent's own model, not inherited from the parent) and to the main session when I switch with /model X.

A per-model key would cover both cases:

"modelSettings": {
  "claude-haiku-5-5":  { "advisorModel": "sonnet" },
  "claude-sonnet-5-5": { "advisorModel": "opus" },
  "claude-opus-5-5":   { "advisorModel": "fable" }
}

modelSettings already holds per-model effortLevel, maxEffortLevel and autoCompactWindow, so this fits there. A frontmatter advisorModel: could then override it for a single agent.

Checked on 2.1.296: still one global advisorModel, and subagents inherit the parent's value. The only workaround is a separate --settings file per model, which breaks on a mid-session /model switch.

antonio-1119 avatar Oct 12 '26 09:10 antonio-1119

Confirming on 2.1.302, with two probes (agent frontmatter advisorModel and a session whose advisor differs from the agent's model): a subagent always takes the session's advisor, and no agent key selects one.

  • Probe 1: session advisor Opus, agent frontmatter advisorModel: fable -> the agent's advisor was Opus.
  • Probe 2: session advisor Fable, agent key opus -> the agent's advisor was Fable.

Why it matters: under a Sonnet main session (advisor Opus), every agent, including Opus reviewers and verifiers, is advised by Opus; under an Opus main (advisor Fable), every Sonnet builder or searcher it launches is advised by Fable and draws on the Fable share of the weekly limit. We budget the advisor by role (a Sonnet agent with the Opus advisor, an Opus agent with Fable), and nothing in settings lets us.

Ask, in addition to the per-model modelSettings idea above: an advisor/advisorModel field in agent frontmatter, and the same parameter on the Agent tool, so a Sonnet agent can run with the Opus advisor and an Opus agent with Fable inside a session whose own advisor differs. We will drop our workaround (agents take the session's advisor) once it ships.


Co-Authored-By: Claude Sonnet 5.5 [email protected] 🤖 Generated with Claude Code

luigi-lauro avatar Oct 18 '26 07:10 luigi-lauro