Team name collision across sessions — file-based registry keyed by name, not session
Summary
When two Claude Code sessions on the same machine create teams with the same name, agents from one session join the other session's team. Messages, idle notifications, and shutdown approvals route to the wrong session. The originating session goes silent because its agents are reporting to a different lead.
Reproduction
- Open two Claude Code sessions under the same user (same
~/.claude/directory) - In session A, create a team:
TeamCreate("observability") - In session B, create a team with the same name:
TeamCreate("observability") - Session B spawns agents with
team_name: "observability" - Result: The agents join session A's team. All teammate messages (idle notifications, completion reports, shutdown approvals) route to session A. Session B receives nothing.
Root Cause
The team registry is file-based at ~/.claude/teams/{team-name}/config.json, keyed solely by team name. When session B creates a team named "observability", it either overwrites or joins the existing team file created by session A. The leadSessionId in the config determines where messages route, and it points to whichever session last wrote the file.
Observed Impact
- Agents spawned in one session reported their work to a completely unrelated session
- The originating session's lead went idle — from its perspective, all agents went silent
- Shutdown approvals for agents the receiving session never spawned landed in its conversation
- Had to manually edit the team config JSON to remove stale members before
TeamDeletewould succeed
Suggested Fix
Key teams by session ID (or session ID + team name) rather than team name alone. Two independent sessions should be able to create teams with the same name without collision. Cross-session team coordination, if desired, should be explicit and opt-in.
Environment
- Claude Code CLI
- Two sessions on the same Linux machine, same user, shared
~/.claude/directory - Both sessions used
TeamCreatewith name"observability"independently
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗