Built-in dynamic workflows (deep-research) have no model routing — all sub-agents inherit the main-loop model, burning Opus on grunt work

Open 💬 0 comments Opened Jun 15, 2026 by armatrix

Summary

Built-in dynamic workflows spawn their sub-agents with no model routing, so
every agent() call inherits the main-loop (session) model. When the session model
is Opus, a single fan-out workflow runs ~100 agents on Opus — including pure grunt
work (web search, page fetch, claim extraction, verification voting) that a cheaper
tier would handle at equal quality. This silently exhausts rate-limit / token budget.

I've hit this twice; the second time it drained an account's budget in one run.

Evidence

The built-in deep-research workflow template (compiled into claude.exe; the
persisted script is byte-identical across 3 independent sessions, md5
dde83c257b41fd7ccb4de359ca555913, 349 lines) contains zero model: overrides.

Its own agent-count formula:

agentCalls = 1 (scope) + 5 (search) + 15 (fetch) + 75 (verify: 25 claims × 3 votes) + 1 (synthesize) ≈ 97

All ~97 inherit the session model. ~90 of them (search + fetch + verify) are grunt /
mid-tier work that does not need the top model.

Root cause

  • agent() with no opts.model inherits the main-loop model (documented behavior).
  • The shipped workflow template never sets opts.model.
  • There is no framework-level default-model knob for workflows (only CLAUDE_CODE_WORKFLOWS=1).
  • The template is compiled into the binary, so users can't patch it (and it's

overwritten on every CLI update).

Impact

A fan-out workflow on an Opus session is the single fastest way to burn a 5h/7d
rate-limit window, with no warning and no per-role cost control. The default is the
most expensive possible configuration.

Proposed fixes (any one helps)

  1. Route the built-in templates by role. e.g. for deep-research:

search/fetch → haiku, verify → sonnet, scope → sonnet, synthesize → opus.
This is a one-line model: add per agent() call.

  1. Expose a workflow default-model / per-phase-model knob (setting or meta field)

so users can cap the tier without editing compiled templates.

  1. Warn on launch when a workflow will spawn N agents on the top tier with no

routing, with the estimated worst-case agent count.

Environment

  • claude-code (npm @anthropic-ai/claude-code), macOS arm64
  • Session model: Opus (1M context)

View original on GitHub ↗