Tmux

From archibate/dotfiles-claude · View interactive version

Tmux is an AI agent skill from the GitHub repository archibate/dotfiles-claude. Spawn and interact with interactive CLIs (python, gdb, etc.) in tmux — send keystrokes, scrape pane output. This skill should be used when running any interactive CLI command, starting program requires interactive stdin / PTY / TUI render, or when the user says "split pane", "run in tmux", "start RE

How to use this skill

Skill file

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)

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, 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

Socket convention

Targeting panes and naming

Finding sessions

Sending input safely

Watching output

Spawning Processes

Some special rules for processes:

Synchronizing / waiting for prompts

```bash

scripts/wait-for-text.sh -t "$SESSION":0.0 -p '^>>>' -T 15 -l 4000

```

Interactive tool recipes

Cleanup

Helper: wait-for-text.sh

scripts/wait-for-text.sh polls a pane for a regex (or fixed string) with a timeout. Works on Linux/macOS with bash + tmux + grep.

scripts/wait-for-text.sh -t session:0.0 -p 'pattern' [-F] [-T 20] [-i 0.5] [-l 2000]
Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.