[BUG] Agent Teams tmux split-pane: command sent via send-keys before shell is ready, teammates fail to start
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report
- [x] I am using the latest version of Claude Code
What's Wrong?
When Agent Teams spawns teammates in tmux split-pane mode, the startup command is sent via tmux send-keys before the shell in the new pane has finished initializing. The command text appears in the pane but is never executed. Each teammate pane shows an idle shell prompt instead of a running Claude instance.
The teammates do run in in-process mode (visible via shift+down cycling), but the tmux panes remain empty.
Root Cause Analysis
tmux split-windowcreates a new pane and starts the default shell (zsh)- Claude Code immediately sends the teammate startup command via
tmux send-keys - If zsh initialization takes longer than the delay between split-window and send-keys, the command arrives before the shell is ready to accept input
- The command is lost — it appears as text in the pane but is not executed
- When the shell prompt finally appears, the pane is empty
Evidence: Manually copy-pasting the exact same command into the pane after the prompt is displayed works perfectly. The command itself is valid.
Measured shell startup times:
- Default zsh with oh-my-zsh + plugins: ~2.4 seconds
- After optimizing zshrc to ~0.03 seconds: still fails (race condition)
This suggests the issue is not purely a slow-shell problem — send-keys may be dispatched with zero delay after split-window, which races even against fast shell initialization.
What Should Happen?
Claude Code should wait for the shell in the new tmux pane to be ready before sending the startup command. Possible approaches:
- Poll for shell readiness (e.g., send a marker command and wait for output)
- Use
tmux split-window -- <command>to run the command directly instead of split-window + send-keys - Add a configurable delay between pane creation and command dispatch
Steps to Reproduce
- Configure Agent Teams in
~/.claude/settings.json:
``json`
{ "env": { "CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS": "1" } }
~/.claude.json
And in :`
json``
{ "teammateMode": "tmux" }
- Start a tmux session:
tmux new-session -s test - Launch Claude:
claude --teammate-mode tmux - Ask Claude to create an agent team with 3 teammates
- Observe: tmux panes are created, command text is visible in each pane, but Claude processes do not start
- Verify:
tmux list-panes -a -F '#{pane_id} #{pane_current_command}'showszshfor all teammate panes - Verify: manually pasting the displayed command into a pane starts Claude successfully
Workaround
Capture the command from the pane and re-send it manually:
tmux send-keys -t <pane_id> '<command from pane>' Enter
Environment
- Claude Code: v2.1.86
- macOS: Darwin 25.4.0 (arm64)
- tmux: 3.5a
- Shell: zsh (oh-my-zsh)
- Terminal: Ghostty (irrelevant — tmux handles pane splitting)
Related Issues
- #23615 — send-keys corruption when multiple agents spawn simultaneously
- #35424 — teammateMode "tmux" config parsing issue
Is this a regression?
Unknown — first time using Agent Teams with tmux
Claude Code Version
2.1.86
This issue has 6 comments on GitHub. Read the full discussion on GitHub ↗