[BUG] Agent Teams under tmux loses teammate lifecycle state, causing orphaned/duplicate teammates and terminal control issues
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 using Agent Teams with tmux, Claude Code can lose the correct lifecycle/state of teammate agents.
This appears as one underlying issue with several related symptoms:
the MainAgent stops or thinks the team is done, but one or more teammates are still running
the system may lose track of already-started teammates and spawn another set
tmux interaction becomes unreliable when inspecting teammate panes:
keyboard input sometimes behaves abnormally
terminal control feels inconsistent
Ctrl+Z can unexpectedly suspend/kill a teammate process
extra duplicate teammates may remain idle, repeatedly reading Skills and waiting for input instead of doing useful work
A concrete example:
the prompt/custom setup asks Claude Code to start 3 teammates
Claude Code starts them
later, the MainAgent appears to not realize they already exist
it starts another 3
I end up with 6 teammate agents total, but only 3 are actually used while the other 3 stay idle
What Should Happen?
Claude Code should maintain an accurate, authoritative view of teammate lifecycle under tmux.
Expected behavior:
if the MainAgent stops or completes the team task, all teammates should be tracked and shut down cleanly
Claude Code should not spawn duplicate teammates when the requested teammates already exist
tmux panes should remain safe to inspect without corrupting terminal input/control
job-control keys such as Ctrl+Z should not leave teammate processes in a broken or inconsistent state
Error Messages/Logs
Steps to Reproduce
- Start Claude Code in Agent Teams mode using tmux teammate mode.
- Configure a fixed 4-agent team:
- 1 MainAgent / lead
- 3 Teammates with separate specialist responsibilities
- Run a complex, multi-stage research workflow in which the MainAgent coordinates the 3 teammates across multiple phases, intermediate outputs, validation/review steps, and final shutdown.
- Trigger the workflow through a scripted or looped
claude -pcommand, rather than only using a single interactive run.
- Repeat this workflow at scale. In my case, I ran it approximately 400 times.
- In roughly 30 runs, one or more failure modes appeared:
- the MainAgent stops or reports completion, but one or more teammates are still running
- Claude Code appears to lose track of already-started teammates and launches another set
- a workflow that should have 3 teammates ends up with 6 teammate processes total
- only 3 are actively used, while the extra 3 remain idle
- idle teammates remain attached, repeatedly reading Skills or waiting for input
- some teammates cannot be cleanly terminated
- entering tmux panes to inspect teammates can cause terminal input/control instability
Ctrl+Zmay unexpectedly suspend or kill a teammate process
- This issue is not fully deterministic, but it recurs under long-running, repeated, high-volume multi-agent orchestration often enough to be a real operational problem.
Claude Model
Sonnet (default)
Is this a regression?
No, this never worked
Last Working Version
_No response_
Claude Code Version
2.1.92
Platform
Anthropic API
Operating System
Ubuntu/Debian Linux
Terminal/Shell
VS Code integrated terminal
Additional Information
_No response_
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗