← Reddit

Be careful running Claude Code subagents

Reddit · swong8 · August 1, 2026
A repository analysis task consumed 2.76 million tokens after Claude Opus 5 unexpectedly spawned six subagents that independently created three additional subagents, each running expensive reasoning operations without proper constraints. The excessive token consumption resulted from safeguards being removed during model optimization and compounded by technical issues including unreceived agent reports, blocked file operations, and agents continuing to run after abandonment. Users should limit subagents to three maximum, prevent subagents from spawning their own agents, and avoid running agents in the background.

Detailed Analysis

A Reddit post detailing a costly failure mode in Claude Code's subagent orchestration system has surfaced, describing how a routine repository-analysis workflow spiraled into a 2.76 million token burn that exhausted an entire five-hour usage window. The user, who had previously run the same `/analyze-repo` and `/diagram-repo` prompts without issue across Opus 4.6 through 4.8, encountered the problem specifically after upgrading to Opus 5. According to the poster, Anthropic had publicly acknowledged pruning the system prompt as model capabilities increased—a change that appears to have stripped out safeguards that previously kept subagent spawning in check. The result: six heavyweight subagents were launched to analyze a 597,000-line Go repository, and those subagents silently spawned three additional subagents of their own, all inheriting "High" reasoning effort and producing expensive chain-of-thought tokens across roughly 70 turns each.

The technical breakdown described is notable for how many distinct failure points compounded simultaneously. Subagent research reports never made it back to the orchestrating model, returning placeholder text like "Done." or "Standing by." instead of actual findings. File-write permissions were inconsistently enforced, blocking the parent agents from writing to a directory while their nested children could write to the same location, triggering repeated retries that each re-billed a full agent transcript. Compounding the technical defects, the user never invoked a stop command when the failing agents were abandoned, allowing them to continue running for roughly 40 more minutes, and deliverables were published prematurely while six agents were still active—leading to five separate correction rounds when their late-arriving reports contradicted already-published content. By the poster's own estimate, roughly a third to half of the token spend produced no usable output.

This matters because it exposes a tension inherent in giving increasingly capable models more autonomy over orchestration decisions. As reasoning models like Opus 5 are trusted to manage multi-agent workflows with less explicit scaffolding, the assumption is that the model's improved judgment can substitute for hardcoded guardrails. This incident suggests that assumption can fail in expensive and hard-to-detect ways—particularly around resource-bounding behaviors like subagent count limits and reasoning-effort inheritance, which are not the kind of judgment calls a model necessarily makes conservatively by default, especially when it has no direct visibility into cumulative token cost or wall-clock time until after the fact.

The episode also reflects a broader pattern across the agentic AI ecosystem: as tools shift from single-turn completions to recursive, self-directed multi-agent systems, the cost and failure surface area grows non-linearly. Subagents spawning subagents is structurally similar to runaway recursion in traditional software, but with the added risk that each "call" can cost real money and consume finite rate-limited quota rather than just CPU cycles. The practical mitigations the user landed on—explicitly capping subagent counts, prohibiting nested spawning, and avoiding background execution—are essentially manual guardrails filling a gap left by the removed system-prompt safeguards. This suggests that as foundation model providers streamline system prompts in pursuit of more "native" agentic capability, there's a real risk of quietly removing protective defaults that users had come to depend on, pushing the burden of cost-control and recursion-limiting back onto end users through prompt engineering rather than platform-level enforcement. For an ecosystem racing to make agents more autonomous, this incident is a concrete reminder that autonomy without hard resource ceilings can translate directly into runaway billing events.

Read original article →