Skip to content

Agent teams should spawn in new tmux window, not split current pane #23615

Description

@anupamchugh

Summary

Agent teams created via Task tool with team_name spawn new tmux panes by splitting the current window. This breaks the user's existing layout and causes command corruption when multiple agents start simultaneously.

The future of agentic coding is bottlenecked by a tmux split-pane race condition.

Reproduction

  1. Have a tmux session with an existing pane layout
  2. Spawn 4+ agent teammates via Task tool with team_name
  3. Observe: current window splits into 5+ panes
  4. Observe: some agents fail to start due to tmux send-keys corruption

What Happens

  • send-keys gets garbled: mmcd instead of cd, mentcd instead of cd
  • Agents that receive corrupted commands fail with zsh: command not found
  • User's existing tmux layout is destroyed
  • 2 out of 4 agents crashed before executing any work

Expected Behavior

Agent teams should spawn in a new tmux window (or configurable target), preserving the user's current pane layout:

# Current behavior
tmux split-window -h  # splits current pane, corrupts send-keys at scale

# Proposed behavior  
tmux new-window -n "agent-team-{team_name}"
tmux split-window -h  # split within the new window

Environment

  • macOS Darwin 25.1.0 (Apple Silicon)
  • Claude Code with CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1
  • tmux 3.x
  • 4 agents dispatched simultaneously

Workaround

Dispatch fewer agents (2 instead of 4), or handle crashed agents' tasks in the main session.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions