Drive interactive CLIs inside tmux panes by sending keys, capturing pane output, and waiting for prompts. Use this for REPL/debug loops, not worker spawning.
Use tmux as a programmable terminal for interactive tools (python, lldb, gdb, psql, mysql, node, bash).
Use this skill when you need to:
send-keysDo NOT use this skill to spawn worktree-backed opencode workers.
Use Tworker and spawn-opencode-agent for that workflow.
lldb unless the user asks for another
debugger.PYTHON_BASIC_REPL=1.Use plain tmux ... commands when interacting with sessions created by
/.
wtspawn-opencode-agenttmux list-sessions
tmux list-panes -a -F '#{session_name}:#{window_name}.#{pane_index}'
Use a private socket only when isolation is needed.
CLAUDE_TMUX_SOCKET_DIR=${CLAUDE_TMUX_SOCKET_DIR:-${TMPDIR:-/tmp}/claude-tmux-sockets}
mkdir -p "$CLAUDE_TMUX_SOCKET_DIR"
SOCKET="$CLAUDE_TMUX_SOCKET_DIR/claude.sock"
tmux -S "$SOCKET" new -d -s claude-debug -n shell
tmux -S "$SOCKET" list-sessions
-l when possible.capture-pane -p -J to avoid wrapped-line artifacts.session:window.pane.Examples:
tmux send-keys -t my-session:opencode.0 -l -- 'PYTHON_BASIC_REPL=1 python3 -q'
tmux send-keys -t my-session:opencode.0 Enter
tmux capture-pane -p -J -t my-session:opencode.0 -S -200
tmux send-keys -t my-session:opencode.0 C-c
Use the helper script to poll until a prompt or completion line appears:
scripts/wait-for-text.sh -t my-session:opencode.0 -p '^>>>' -T 20 -l 4000
If using an isolated socket:
scripts/wait-for-text.sh -S "$SOCKET" -t claude-debug:shell.0 -p '\(lldb\)'
To monitor this session yourself:
tmux attach -t my-session
Or capture output once:
tmux capture-pane -p -J -t my-session:opencode.0 -S -200
For isolated sockets:
To monitor this session yourself:
tmux -S "$SOCKET" attach -t claude-debug
Or capture output once:
tmux -S "$SOCKET" capture-pane -p -J -t claude-debug:shell.0 -S -200
scripts/find-sessions.sh: list sessions on default socket, named socket,
socket path, or scan all sockets under CLAUDE_TMUX_SOCKET_DIR.scripts/wait-for-text.sh: poll pane output with timeout until a regex (or
fixed string) appears.tmux kill-session -t my-session
tmux kill-server
tmux -S "$SOCKET" kill-session -t claude-debug
tmux -S "$SOCKET" kill-server