Agent team cleanup kills unrelated tmux panes
Resolved 💬 2 comments Opened Mar 2, 2026 by seun6 Closed Mar 2, 2026
Description
When Claude Code cleans up an Agent Team (multi-agent orchestration via TeamCreate/TeamDelete), it can accidentally kill unrelated user tmux panes.
Steps to Reproduce
- Have existing tmux panes open (regular terminal sessions)
- Create an Agent Team that spawns teammates in tmux panes
- When the team finishes, Claude attempts cleanup by listing all panes via
tmux list-panes -a - Claude kills all panes except the one running the main process (e.g.,
bun), including user's own terminal panes that are not team-related
Expected Behavior
Team cleanup should only kill panes that belong to the team. It should:
- Track which panes were created by the team (e.g., via team config or pane metadata)
- Only terminate team-owned panes during cleanup
- Never touch pre-existing user panes
Actual Behavior
Claude enumerates all tmux panes and kills any that don't appear to be "system" processes, destroying the user's unrelated terminal sessions.
Impact
- Destructive: User loses terminal sessions, running processes, and unsaved work in those panes
- Hard to reverse: Killed panes and their processes cannot be recovered
- Silent: No confirmation is asked before killing non-team panes
Suggested Fix
- Store team pane IDs in team config (
~/.claude/teams/{name}/config.json) at creation time - During cleanup, only kill panes listed in the team config
- Or use tmux pane environment variables / naming conventions to tag team-owned panes
Environment
- Claude Code (CLI)
- macOS (Darwin 25.3.0)
- tmux 3.x
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗