[BUG] Executing `/clear` in Team Lead session kills all running teammates without graceful shutdown
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?
When a Team Lead (TL) executes /clear during an active team session, all spawned teammate tmux panes are destroyed and their processes terminated immediately — without invoking the graceful shutdown protocol (shutdown_request → shutdown_response).
After /clear:
| Item | Before /clear | After /clear |
|------|-----------------|----------------|
| tmux panes in TL window | 2 (TL + worker-1) | 1 (TL only) |
| worker-1 pane (%3) | Active | Destroyed (can't find pane) |
| worker-1 process | Running | Terminated |
| TL status bar | 1 teammate | Still shows 1 teammate (stale) |
| ~/.claude/teams/<team>/config.json | worker-1 listed, active | worker-1 still listed, isActive: false |
This causes:
- No graceful shutdown — teammate panes are destroyed without
shutdown_request/shutdown_responseprotocol - Inconsistent team state — config file retains the teammate entry, TL status bar still shows
1 teammate, but the actual process and pane are gone - Data loss risk — any in-progress work by the teammate is lost without warning
What Should Happen?
/clear should only reset the TL's conversation history. Running teammates should not be affected — their tmux panes, processes, and team membership should all remain intact, allowing them to continue working normally and accept new messages from the TL after the clear.
Error Messages/Logs
No explicit error messages. The teammate pane silently disappears. The only observable indicators:
- `tmux list-panes` shows the teammate pane is gone
- Team config file shows `isActive: false` for the terminated teammate
- TL status bar still displays stale `1 teammate` count
Steps to Reproduce
- Start Claude Code:
claude --dangerously-skip-permissions - Create a team with at least one teammate:
````
Create a team called 'clear-test' with one teammate named 'worker-1' (general-purpose type).
- Wait for the teammate to start and confirm it is active (status bar shows
1 teammate) - Verify the tmux layout has 2 panes (TL + worker-1)
- Execute
/clearin the TL's input - Observe: worker-1's tmux pane is destroyed, process terminated, but TL status bar still shows
1 teammate
Claude Model
None
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
2.1.63 (Claude Code)
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
iTerm2
Additional Information
- Claude Code version: 2.1.63
- OS: macOS (Darwin 24.6.0)
- Model: claude-opus-4-6
- Team feature flag:
CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1(set automatically when spawning teammates) - This behavior was not observed in earlier versions of Claude Code team functionality. The
/clearcommand previously only cleared the conversation history without affecting teammate processes.
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗