← ClaudeAtlas

tmuxlisted

Remote control tmux sessions for interactive CLIs (python, gdb, etc.) by sending keystrokes and scraping pane output.
math2024444-spec/agent-commands · ★ 2 · AI & Automation · score 78
Install: claude install-skill math2024444-spec/agent-commands
# tmux Skill Use tmux as a programmable terminal multiplexer for interactive work. Works on Linux and macOS with stock tmux; avoid custom config by using a private socket. ## Quickstart (isolated socket) ```bash SOCKET_DIR=${TMPDIR:-/tmp}/claude-tmux-sockets # well-known dir for all agent sockets mkdir -p "$SOCKET_DIR" SOCKET="$SOCKET_DIR/claude.sock" # keep agent sessions separate from your personal tmux SESSION=claude-python # slug-like names; avoid spaces tmux -S "$SOCKET" new -d -s "$SESSION" -n shell tmux -S "$SOCKET" send-keys -t "$SESSION":0.0 -- 'python3 -q' Enter tmux -S "$SOCKET" capture-pane -p -J -t "$SESSION":0.0 -S -200 # watch output tmux -S "$SOCKET" kill-session -t "$SESSION" # clean up ``` After starting a session ALWAYS tell the user how to monitor the session by giving them a command to copy paste: ``` To monitor this session yourself: tmux -S "$SOCKET" attach -t claude-lldb Or to capture the output once: tmux -S "$SOCKET" capture-pane -p -J -t claude-lldb:0.0 -S -200 ``` This must ALWAYS be printed right after a session was started and once again at the end of the tool loop. But the earlier you send it, the happier the user will be. ## Socket convention - Agents MUST place tmux sockets under `CLAUDE_TMUX_SOCKET_DIR` (defaults to `${TMPDIR:-/tmp}/claude-tmux-sockets`) and use `tmux -S "$SOCKET"` so we can enumerate/clean them. Create the dir first: `mkdir -p "$CLAUDE_TMUX_SOCKET_DIR