What I want
Native, first-class support for spawning swarm teammates as interactive tmux panes in the same window as the coordinator — the way Claude Code does it. Today swarm spawn works, but the teammate sessions do not appear alongside the coordinator on one screen, so there is no way to watch several agents work at once without manual shell glue.
Why this matters
The value of a swarm is observability while it runs. With headless/inline spawns I get a report at the end; with panes I can see an agent go down a wrong path and correct it immediately. Claude Code's multi-pane view is the single biggest ergonomic difference today.
Current state (v0.67.1) — this is mostly already built
Digging through the binary and testing on tmux 3.7b, almost all the machinery exists:
- The binary already says: "Without a hook, clients inside tmux automatically use a right-side pane."
[terminal] spawn_hook / focus_hook exist and receive <hook> <jcode-binary> <args...> plus JCODE_SPAWN_SESSION_ID, JCODE_SPAWN_TITLE, JCODE_SPAWN_CWD, JCODE_SPAWN_PROGRAM, JCODE_SPAWN_COMMAND.
TMUX / TMUX_PANE are already probed alongside Zellij, kitty, WezTerm, Ghostty, herdr.
- The documented example is
spawn_hook = "tmux new-window" — a window per agent, not a pane.
Two things block the out-of-the-box experience:
[agents] swarm_spawn_mode defaults to "inline" (there is even a one-time migration string swarm_spawn_mode default migration: visible -> inline). Inline is in-process with no window, so no spawn hook ever fires and the tmux auto-pane path is unreachable. This is the actual root cause, and it is not discoverable — you have to know to flip it to "visible" first.
- Naive
tmux split-window -h collapses geometry. Measured in a 200x50 window: pane widths went 100 → 49 → 24 → 12 → 11 columns after 4 agents. Usable tiling needs tmux select-layout tiled after each split.
Working config today (for anyone hitting this)
[agents]
swarm_spawn_mode = "visible"
[terminal]
spawn_hook = "~/bin/jcode-tmux-pane"
#!/bin/sh
# jcode spawn_hook: each spawned session becomes a tiled tmux pane in the CURRENT window.
set -eu
if [ -z "${TMUX:-}" ] && [ -z "${TMUX_PANE:-}" ]; then
exit 1 # not in tmux -> non-zero lets jcode fall back to its own terminal detection
fi
TARGET="${TMUX_PANE:-}"
CWD="${JCODE_SPAWN_CWD:-$PWD}"
if [ -n "$TARGET" ]; then
tmux split-window -h -t "$TARGET" -c "$CWD" "$@"
else
tmux split-window -h -c "$CWD" "$@"
fi
tmux select-layout tiled
[ -n "${JCODE_SPAWN_TITLE:-}" ] && tmux select-pane -T "$JCODE_SPAWN_TITLE" 2>/dev/null || true
exit 0
Verified: 3 simulated spawns produced 4 panes at ~100x24 with pane titles set from JCODE_SPAWN_TITLE; outside tmux the hook exits 1 and jcode correctly falls back to built-in terminal detection.
Proposed
swarm_spawn_mode = "tmux" (or make "visible" detect tmux natively) that does split + select-layout tiled + select-pane -T "$JCODE_SPAWN_TITLE" internally, with no user shell script.
[agents] tmux_layout = tiled | even-horizontal | even-vertical | main-vertical, so the coordinator can keep a large main pane with teammates tiled beside it.
- Pane lifecycle tied to session lifecycle — pane closes (or is marked dead, per a
tmux_close_on_exit setting) when the teammate reaches ready/stopped/failed, so swarm cleanup doesn't leave orphan panes.
- Cap and overflow behaviour — respect
swarm_max_concurrent_agents (mine is 32, which would be unreadable as panes); beyond tmux_max_panes, spill to new tmux windows rather than shrinking panes to 11 columns.
- Discoverability — when
swarm spawn runs inside tmux while swarm_spawn_mode = "inline", emit a one-time hint that tmux panes are available.
Difficulty
Items 1 and 2 look small: the terminal-detection, hook-invocation, and env-passing paths already exist, so this is mostly a built-in hook implementation plus a config enum. Item 3 (lifecycle) is the one that needs real design, since it touches session teardown and the same cleanup concerns raised in #737 for bg watch sources.
Environment
jcode v0.67.1 (88a19f3), macOS aarch64, tmux 3.7b.
What I want
Native, first-class support for spawning swarm teammates as interactive tmux panes in the same window as the coordinator — the way Claude Code does it. Today
swarm spawnworks, but the teammate sessions do not appear alongside the coordinator on one screen, so there is no way to watch several agents work at once without manual shell glue.Why this matters
The value of a swarm is observability while it runs. With headless/inline spawns I get a report at the end; with panes I can see an agent go down a wrong path and correct it immediately. Claude Code's multi-pane view is the single biggest ergonomic difference today.
Current state (v0.67.1) — this is mostly already built
Digging through the binary and testing on tmux 3.7b, almost all the machinery exists:
[terminal] spawn_hook/focus_hookexist and receive<hook> <jcode-binary> <args...>plusJCODE_SPAWN_SESSION_ID,JCODE_SPAWN_TITLE,JCODE_SPAWN_CWD,JCODE_SPAWN_PROGRAM,JCODE_SPAWN_COMMAND.TMUX/TMUX_PANEare already probed alongside Zellij, kitty, WezTerm, Ghostty, herdr.spawn_hook = "tmux new-window"— a window per agent, not a pane.Two things block the out-of-the-box experience:
[agents] swarm_spawn_modedefaults to"inline"(there is even a one-time migration stringswarm_spawn_mode default migration: visible -> inline). Inline is in-process with no window, so no spawn hook ever fires and the tmux auto-pane path is unreachable. This is the actual root cause, and it is not discoverable — you have to know to flip it to"visible"first.tmux split-window -hcollapses geometry. Measured in a 200x50 window: pane widths went 100 → 49 → 24 → 12 → 11 columns after 4 agents. Usable tiling needstmux select-layout tiledafter each split.Working config today (for anyone hitting this)
Verified: 3 simulated spawns produced 4 panes at ~100x24 with pane titles set from
JCODE_SPAWN_TITLE; outside tmux the hook exits 1 and jcode correctly falls back to built-in terminal detection.Proposed
swarm_spawn_mode = "tmux"(or make"visible"detect tmux natively) that does split +select-layout tiled+select-pane -T "$JCODE_SPAWN_TITLE"internally, with no user shell script.[agents] tmux_layout=tiled|even-horizontal|even-vertical|main-vertical, so the coordinator can keep a large main pane with teammates tiled beside it.tmux_close_on_exitsetting) when the teammate reachesready/stopped/failed, soswarm cleanupdoesn't leave orphan panes.swarm_max_concurrent_agents(mine is 32, which would be unreadable as panes); beyondtmux_max_panes, spill to new tmux windows rather than shrinking panes to 11 columns.swarm spawnruns inside tmux whileswarm_spawn_mode = "inline", emit a one-time hint that tmux panes are available.Difficulty
Items 1 and 2 look small: the terminal-detection, hook-invocation, and env-passing paths already exist, so this is mostly a built-in hook implementation plus a config enum. Item 3 (lifecycle) is the one that needs real design, since it touches session teardown and the same cleanup concerns raised in #737 for
bgwatch sources.Environment
jcode v0.67.1 (88a19f3), macOS aarch64, tmux 3.7b.