[BUG] [AGENT_TEAMS] Teammate spawn amplification: 1 spawn intent produces N (2-8) independent teammates racing on the same task
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet (closest are #45958 about parallel dispatch stalls and #41607 about compaction subagent duplication; neither covers team-mode teammate duplication)
- [x] This is a single bug report
- [x] I am using the latest version of Claude Code (2.1.75)
What's Wrong?
Under CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1, spawning a teammate produces N independent teammate processes (typically 2–8) for what should be one logical spawn. All N share the same role/agentType and the same initial spawn prompt, start at the exact same millisecond timestamp, but get distinct agentIds and write to distinct subagents/agent-*.jsonl files. Their work diverges later because each one is a real independent process picking up tools, doing edits, posting status messages, and opening PRs.
Aggregate observation in one heavily-used session: 30 distinct Agent/team-spawn tool_use entries in the lead transcript → 107 subagent JSONL files on disk (~3.5× multiplier).
This is not the same as #45958 (parallel-dispatch notification queue stall) or #41607 (compaction subagent duplication). This is teammate-spawn amplification under EXPERIMENTAL_AGENT_TEAMS.
Concrete example from one session
Five activity-and-chip-fix teammates spawned at exactly the same instant from what appears to be a single spawn intent:
agent-aca4de6b71ed5f263.jsonl first_ts=2026-05-27T07:53:02.453Z promptId=d71bf94a-…
agent-a045f83f559d70068.jsonl first_ts=2026-05-27T07:53:02.453Z promptId=ef4a2f5c-…
agent-a3878333737c7d4d5.jsonl first_ts=2026-05-27T07:53:02.453Z promptId=ef4a2f5c-…
agent-adc1cdacf11bc8bcb.jsonl first_ts=2026-05-27T07:53:02.453Z promptId=fa283db3-…
agent-adc0efee0e1555a9c.jsonl first_ts=2026-05-27T07:53:02.453Z promptId=4acad4b3-…
All 5 have:
- Identical
agentType("activity-and-chip-fix") in their.meta.json - Identical initial user message ("You are
activity-and-chip-fixonpulse-fixes. Two fixes related to the Tier 0/1 visual primitives…") - Distinct
agentId(5 different) - Distinct
promptId(3 different — 2 of the 5 shareef4a2f5c-…) - First-millisecond-identical creation timestamp (
07:53:02.453Z) - Work that diverges after — each one ran Chrome browser_batch screenshots, made edits, eventually opened PRs
The lead lost track of which "real" agent to talk to. SendMessage routed to whatever the team registry resolved to. At least one duplicate PR (#587 on the target repo) was opened by a teammate the lead thought it had already heard from.
Why it's expensive
The 5 activity-and-chip-fix dupes each accumulated 36 base64 JPEG screenshots from mcp__Claude_in_Chrome__browser_batch while debugging the same staging URL — each transcript ballooned to 10–11 MB on disk and presumably similar in context tokens. Total wasted: ~55 MB of mostly-identical screenshot-heavy work on a problem one teammate could have solved.
Yesterday's same-session run with a single palette-designer showed the same pattern at smaller scale: 3 transcript files, all starting at the same millisecond 2026-05-26T10:04:20.781Z, near-identical tool counts (47/42/47 Bash, 13/13/13 Read, 9/9/9 Edit), one PR opened (#561).
Steps to Reproduce
- Set
CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1. - Have a lead session create a team and spawn one teammate with a substantive role prompt.
- Wait for the teammate to do real work (not just acknowledge dispatch).
- Inspect
~/.claude/projects/<project>/<session-id>/subagents/. - Count
*.meta.jsonfiles matching the spawned agentType vs. the number of times you asked the lead to spawn it. Expected 1:1, observed 2–8:1.
I have not isolated which spawn mechanism is at fault (the docs reference TeamCreate, SendMessage, and there appears to be a team-aware variant of Agent for spawning teammates). The amplification is visible regardless of which the lead picks.
Environment
| Field | Value |
|---|---|
| Claude Code version | 2.1.75 |
| Platform | macOS (Claude Code Desktop app) |
| Feature flag | CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1 |
| Model | default (no override) |
| Plan | Max |
| Session ID | 1360a259-fcbb-468e-8eaa-d24e83bd9fa7 (happy to share JSONL privately) |
What Should Happen?
| Observed | Expected |
|---|---|
| 1 spawn intent → N teammates (typically 2–8) | 1 spawn intent → 1 teammate |
| 5 teammates racing on the same task open duplicate PRs | One teammate per role/task, deterministic |
| ~3.5× transcript multiplier across the session | 1:1 |
Suspected causes (speculation)
- Spawn retry on perceived failure that doesn't deduplicate by
promptId/intent — but original "failed" spawn actually succeeded and is now racing the retry. - SendMessage / TeamCreate ordering where the spawn handler subscribes to a queue and multiple workers each pick up the same spawn request.
- Promise-amplification in the team registry where a single spawn
awaitresolves into N parallelPromise.allbranches.
Related issues
- #45958 (parallel
Agentdispatch stalls + silent subagent context reset) — different surface, samearea:agents - #41607 (duplicate compaction subagents) — closed; mechanism may be analogous
- #55297 (idle-team "non-interactive mode" reminder forcing premature shutdown) — same session also tripped this; compounds the cost because killed teams get respawned with the same amplification
Happy to share full session JSONL (12.6 MB lead + 107 subagent files totaling ~80 MB) privately if useful for triage. The amplification is reproducible across multiple spawns in this session, so the JSONL contains many independent data points.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗