[BUG] Agent teams get stuck and output is not persisting! (tokens gone for nothing)
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
Bug in Claude Code native teams: when spawning team agents, members register with tmuxPaneId: "in-process" in ~/.claude/teams/*/config.json. If session ends before cleanup, members stay registered forever. Next session sees ghost agents → hooks fire "Task delegation failed" for dead processes.
Fix needed imo:
Bind members to session ID
Auto-prune stale members on team load
Add TTL or heartbeat so "in-process" doesn't persist indefinitely
What Should Happen?
agent teams output not getting stuck and deleting.. but persisting and automatically reporting to team lead once they've finished!
Error Messages/Logs
Steps to Reproduce
Start a Claude Code session
Use TeamCreate to create a team (e.g. fortress-delta-review)
Spawn 3+ agents via Task with team_name parameter — they register in ~/.claude/teams/{name}/config.json with tmuxPaneId: "in-process"
Let agents complete their work (or let the session end/crash before cleanup)
Start a new Claude Code session
Spawn any agent via Task tool — hooks see the stale members still registered in config.json and fire "Task delegation failed" errors for each ghost agent
Check ~/.claude/teams/{name}/config.json — dead members are still listed with tmuxPaneId: "in-process"
Expected: Stale members cleaned up on session end or pruned on next session start.
Actual: Ghost members persist forever, causing false "delegation failed" errors on every subsequent agent spawn.
Claude Model
Opus
Is this a regression?
No, this never worked
Last Working Version
_No response_
Claude Code Version
2.1.41 (Claude Code)
Platform
Anthropic API
Operating System
Windows
Terminal/Shell
VS Code integrated terminal
Additional Information
_No response_
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗