Workflow tool: one invocation spawned 46 Opus subagents (~3M tokens) with no cost confirmation
Description
One Workflow tool invocation (run wf_abf6120f-5f6, a code-review orchestration) spawned 46 subagents consuming ~2,986,845 subagent tokens / 791 tool uses in ~18 minutes, for a task whose output was ultimately discarded.
All 46 subagents ran on Opus 4.8: subagents inherit the main-loop model by default, and the Workflow tool guidance instructs the model to omit per-agent overrides ("Default to omitting it"). Combined with ultracode mode ("token cost is not a constraint"), a single user prompt produced ~3M Opus tokens with:
- no cost warning,
- no projected-agent-count confirmation before launch,
- no automatic downgrade of sweep/verification subagents to cheaper models.
Expected behavior
A cost/scale confirmation before a 40+ agent fan-out, or cheaper default models (Haiku/Sonnet) for sweep and verification subagents, or at minimum a projected token estimate surfaced to the user before the run starts.
Environment
- Claude Code CLI on macOS (darwin 25.5.0)
- Session model: claude-opus-4-8 (all subagents inherited it)
- Effort set to ultracode via /effort
- Workflow run: 46 agents, 2,986,845 subagent tokens, 791 tool uses, 1,064,880 ms
Filed from the affected session on behalf of the account owner.
Showing cached comments. Read the full discussion on GitHub ↗
6 Comments
Related precedent: Anthropic reset 5-hour and weekly limits for Pro/Max users on May 15 and June 1, 2026 after acknowledging that "some Claude Code sessions spawn excessive parallel subagents, burning through usage faster than expected", attributed to Opus 4.8 request handling (https://pasqualepillitteri.it/en/news/3995/claude-code-resets-usage-limits-opus-4-8-not-dynamic-workflows). This report describes the same failure mode (46 parallel Opus 4.8 subagents, ~3M tokens) occurring on 2026-06-07, after the June 1 fix, via the Workflow feature's defaults - suggesting the intentional-orchestration path still lacks the safeguards the involuntary-spawning fix added.
Worth separating the two operator-side levers that actually control this today, since the report and the precedent above both point at Anthropic-side fixes — but the fan-out here is gated by two settings the user holds.
1.
ultracodeis the amplifier, not just the workflow. In ultracode mode the standing instruction is to author and run a workflow for every substantive task by default, and explicitly that token cost is not a constraint. That's the switch that turns one prompt into a 46-agent fan-out. The single most direct prevention is to not leave ultracode on for work where cost matters — use it deliberately for the few tasks that genuinely need that breadth, and drop back to a normal effort level otherwise. With ultracode off, the same code-review runs inline (or as a much smaller, opt-in fan-out) instead of auto-spawning sweeps.2. Subagents inherit the main-loop (session) model. All 46 ran on Opus 4.8 because the orchestrating session was on Opus 4.8 and the Workflow guidance is to omit per-agent model overrides by default. So the session model cascades to every agent. For sweep/verification-heavy orchestration, running the orchestrating session on Sonnet (
/model) cascades the cheaper model to the whole fan-out without touching the workflow at all — the agents that don't need Opus-level reasoning (grep sweeps, per-file verifiers) inherit Sonnet. If you author your own workflow scripts,agent(..., {model: 'sonnet'})pins individual stages; for a built-in workflow you can't edit, the session-model lever is the one that still works.So the combination that produced ~3M Opus tokens is ultracode (cost unconstrained + auto-fan-out) × Opus session model (cascaded to all agents). Flipping either one back contains it: ultracode off removes the auto-fan-out; Sonnet session model makes the fan-out cheap.
The remaining gap your report correctly identifies — no projected agent-count / token estimate surfaced before launch — is the real Anthropic-side ask, because neither lever above gives you a pre-flight "this will spawn ~46 agents, proceed?" prompt, which is exactly the confirmation a 40+ agent, cost-unconstrained fan-out should have. The involuntary-spawning fix (the May/June limit resets) didn't cover this intentional-orchestration path, as the comment above notes.
(For detection rather than prevention: the spend is invisible until it's done since it's one tool call running ~18 min. If you want a tripwire, a hook that watches subagent/Task spawns per turn and warns past a threshold is feasible — the free MIT cc-safe-setup has cost-runaway guards in that shape you can adapt — but the pre-conditions above are the higher-leverage fix.)
Additional details for triage:
skipWorkflowUsageWarningis not set in settings.json, yet no Workflow usage/cost warning was shown before the 46-agent run. The session does run withskipDangerousModePermissionPrompt/skipAutoPermissionPrompt; if the usage warning rides the permission-prompt path, those flags may suppress it - which would mean the cost warning is silently bypassed for any user with relaxed permission settings.skipWorkflowUsageWarning). That issue shows the warning exists; this one shows scale/cost still reaches ~3M Opus tokens without it firing, and that subagents inherit the most expensive model by default with no projected estimate.Found 2 possible duplicate issues:
This issue will be automatically closed as a duplicate in 3 days.
🤖 Generated with Claude Code
The two operator-side levers you've identified (ultracode mode + Opus session model cascading) are the right frame. Worth adding the observability gap that makes this worse: the fan-out cost is invisible until it's complete, because it's a single tool call that runs for 18 minutes. There's no mid-run signal that says "you've now spawned 20 agents, current projected spend is X."
That's actually the harder problem than the per-agent model defaults. A pre-flight "this will spawn ~N agents, estimated token range is X–Y, proceed?" prompt would close the main gap your report calls out. The involuntary-spawning fix (the May/June limit resets) covered unintentional fan-outs but left the intentional-orchestration path — where the user explicitly asked for a workflow but didn't know what scale that implied — without a cost-confirmation gate.
For anyone hitting this today: running the orchestrating session on Sonnet rather than Opus cascades the cheaper model to all subagents, which is the single highest-leverage lever if you can't avoid ultracode mode for a given task. Per-agent model overrides in custom workflow scripts work too, but you can't edit built-in workflows.
We're tracking this class of problem (cost-opaque fan-out, no mid-run abort surface) in the orchestration coordination layer we're building at claudeverse.ai — it's a common theme in the issues filed here in the last two weeks.
ngl that 46 subagents and ~3M tokens with no cost confirmation is rough, esp if u were not expecting ultracode to skip cost checks. fwiw i layered wozcode on top of claude code and it cut my token spend about 50% with better caching and dedupe, https://wozcode.com