feat(dashboard): spawn claude in new tmux window when $TMUX is set #48
Reference in New Issue
Block a user
Delete Branch "tmux-spawn-window"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Option 3 from
docs/research/claude-code-pane-in-dashboard.md, opt-in by environment. When the dashboard runs inside tmux (\$TMUXis set), both the new-agent (n) attach AND the re-attach (Enter) paths spawn claude withtmux new-window -n <slug> docker exec -it … claude …instead of taking over the terminal viacurses.endwin. The dashboard keeps rendering in its current tmux pane; the operator switches to the new window via tmux's normal nav (defaultC-b n).Outside tmux, the existing handoff path is unchanged — the dispatch is a single
_in_tmux()check per attach.Mechanics
DockerBottle.claude_docker_argvextracted fromexec_claude, so bothsubprocess.runANDtmux new-windowcan build on the same docker-exec argv (preserving--append-system-prompt-file)._attach_via_tmuxin dashboard.py wraps the docker argv withtmux new-window -n <slug> …and returns immediately. Status line:[slug] opened in new tmux window._build_tmux_attach_argvsplit out as a pure helper so the wrapping shape is unit-tested without shelling out.Status
_build_tmux_attach_argv)\$TMUXis unsetOption 3 from `docs/research/claude-code-pane-in-dashboard.md`, opt-in by environment. When the dashboard runs inside tmux (\$TMUX is set), both the new-agent (`n`) attach AND the re-attach (Enter) paths spawn claude with `tmux new-window -n <slug> docker exec -it … claude …` instead of taking over the terminal via `curses.endwin`. The dashboard keeps rendering in its current tmux pane; the operator switches to the new window via tmux's normal nav. Outside tmux the existing handoff path is unchanged — the dispatch is a single `_in_tmux()` check per attach. Mechanics: - `DockerBottle.claude_docker_argv` extracted from `exec_claude`, so both subprocess.run AND `tmux new-window` can build on the same docker-exec argv (preserving `--append-system-prompt-file`). - `_attach_via_tmux` in dashboard.py wraps the docker argv with `tmux new-window -n <slug> …` and returns immediately. Status line: `[slug] opened in new tmux window`. - `_build_tmux_attach_argv` split out as a pure helper so the wrapping shape is unit-tested without shelling out. 467 unit tests pass (2 new for `_build_tmux_attach_argv`).didericis referenced this pull request2026-05-26 14:14:19 -04:00
Pull request closed