[BUG] Agent Teams tmux split-pane: command sent via send-keys before shell is ready, teammates fail to start

Resolved 💬 6 comments Opened Mar 28, 2026 by ohikouta Closed May 14, 2026

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

  1. tmux split-window creates a new pane and starts the default shell (zsh)
  2. Claude Code immediately sends the teammate startup command via tmux send-keys
  3. 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
  4. The command is lost — it appears as text in the pane but is not executed
  5. 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

  1. Configure Agent Teams in ~/.claude/settings.json:

``json
{ "env": { "CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS": "1" } }
`
And in
~/.claude.json:
`json
{ "teammateMode": "tmux" }
``

  1. Start a tmux session: tmux new-session -s test
  2. Launch Claude: claude --teammate-mode tmux
  3. Ask Claude to create an agent team with 3 teammates
  4. Observe: tmux panes are created, command text is visible in each pane, but Claude processes do not start
  5. Verify: tmux list-panes -a -F '#{pane_id} #{pane_current_command}' shows zsh for all teammate panes
  6. 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

View original on GitHub ↗

This issue has 6 comments on GitHub. Read the full discussion on GitHub ↗