tmux Skill (Clawdbot) Use tmux only when you need an interactive TTY. Prefer bash background mode for long-running, non-interactive tasks. Quickstart (isolated socket, bash tool) After starting a session, always print monitor commands: Socket convention - Use (default ). - Default socket path: . Targeting panes and naming - Target format: (defaults to ). - Keep names short; avoid spaces. - Inspect: , . Finding sessions - List sessions on your socket: . - Scan all sockets: (uses ). Sending input safely - Prefer literal sends: . - Control keys: . Watching output - Capture recent history: . - Wa…

\\t' read -r name attached created; do\n attached_label=$([[ \"$attached\" == \"1\" ]] && echo \"attached\" || echo \"detached\")\n printf ' - %s (%s, started %s)\\n' \"$name\" \"$attached_label\" \"$created\"\n done\n}\n\nif [[ \"$scan_all\" == true ]]; then\n if [[ ! -d \"$socket_dir\" ]]; then\n echo \"Socket directory not found: $socket_dir\" >&2\n exit 1\n fi\n\n shopt -s nullglob\n sockets=(\"$socket_dir\"/*)\n shopt -u nullglob\n\n if [[ \"${#sockets[@]}\" -eq 0 ]]; then\n echo \"No sockets found under $socket_dir\" >&2\n exit 1\n fi\n\n exit_code=0\n for sock in \"${sockets[@]}\"; do\n if [[ ! -S \"$sock\" ]]; then\n continue\n fi\n list_sessions \"socket path '$sock'\" -S \"$sock\" || exit_code=$?\n done\n exit \"$exit_code\"\nfi\n\ntmux_cmd=(tmux)\nsocket_label=\"default socket\"\n\nif [[ -n \"$socket_name\" ]]; then\n tmux_cmd+=(-L \"$socket_name\")\n socket_label=\"socket name '$socket_name'\"\nelif [[ -n \"$socket_path\" ]]; then\n tmux_cmd+=(-S \"$socket_path\")\n socket_label=\"socket path '$socket_path'\"\nfi\n\nlist_sessions \"$socket_label\" \"${tmux_cmd[@]:1}\"\n","content_type":"application/x-sh; charset=utf-8","language":"bash","size":2945,"content_sha256":"a137d03b3b37332439a1592831d60479ff86315c7e6d6ed7da0fb799db0f13f7"},{"filename":"scripts/wait-for-text.sh","content":"#!/usr/bin/env bash\nset -euo pipefail\n\nusage() {\n cat \u003c\u003c'USAGE'\nUsage: wait-for-text.sh -t target -p pattern [options]\n\nPoll a tmux pane for text and exit when found.\n\nOptions:\n -t, --target tmux target (session:window.pane), required\n -p, --pattern regex pattern to look for, required\n -F, --fixed treat pattern as a fixed string (grep -F)\n -T, --timeout seconds to wait (integer, default: 15)\n -i, --interval poll interval in seconds (default: 0.5)\n -l, --lines number of history lines to inspect (integer, default: 1000)\n -h, --help show this help\nUSAGE\n}\n\ntarget=\"\"\npattern=\"\"\ngrep_flag=\"-E\"\ntimeout=15\ninterval=0.5\nlines=1000\n\nwhile [[ $# -gt 0 ]]; do\n case \"$1\" in\n -t|--target) target=\"${2-}\"; shift 2 ;;\n -p|--pattern) pattern=\"${2-}\"; shift 2 ;;\n -F|--fixed) grep_flag=\"-F\"; shift ;;\n -T|--timeout) timeout=\"${2-}\"; shift 2 ;;\n -i|--interval) interval=\"${2-}\"; shift 2 ;;\n -l|--lines) lines=\"${2-}\"; shift 2 ;;\n -h|--help) usage; exit 0 ;;\n *) echo \"Unknown option: $1\" >&2; usage; exit 1 ;;\n esac\ndone\n\nif [[ -z \"$target\" || -z \"$pattern\" ]]; then\n echo \"target and pattern are required\" >&2\n usage\n exit 1\nfi\n\nif ! [[ \"$timeout\" =~ ^[0-9]+$ ]]; then\n echo \"timeout must be an integer number of seconds\" >&2\n exit 1\nfi\n\nif ! [[ \"$lines\" =~ ^[0-9]+$ ]]; then\n echo \"lines must be an integer\" >&2\n exit 1\nfi\n\nif ! command -v tmux >/dev/null 2>&1; then\n echo \"tmux not found in PATH\" >&2\n exit 1\nfi\n\n# End time in epoch seconds (integer, good enough for polling)\nstart_epoch=$(date +%s)\ndeadline=$((start_epoch + timeout))\n\nwhile true; do\n # -J joins wrapped lines, -S uses negative index to read last N lines\n pane_text=\"$(tmux capture-pane -p -J -t \"$target\" -S \"-${lines}\" 2>/dev/null || true)\"\n\n if printf '%s\\n' \"$pane_text\" | grep $grep_flag -- \"$pattern\" >/dev/null 2>&1; then\n exit 0\n fi\n\n now=$(date +%s)\n if (( now >= deadline )); then\n echo \"Timed out after ${timeout}s waiting for pattern: $pattern\" >&2\n echo \"Last ${lines} lines from $target:\" >&2\n printf '%s\\n' \"$pane_text\" >&2\n exit 1\n fi\n\n sleep \"$interval\"\ndone\n","content_type":"application/x-sh; charset=utf-8","language":"bash","size":2139,"content_sha256":"96bc42702f7353c32233c223d61dd11f2f99033267aeefac838aea8983a67735"}],"content_json":{"type":"doc","content":[{"type":"heading","attrs":{"level":1},"content":[{"text":"tmux Skill (Clawdbot)","type":"text"}]},{"type":"paragraph","content":[{"text":"Use tmux only when you need an interactive TTY. Prefer bash background mode for long-running, non-interactive tasks.","type":"text"}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"Quickstart (isolated socket, bash tool)","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"bash"},"content":[{"text":"SOCKET_DIR=\"${CLAWDBOT_TMUX_SOCKET_DIR:-${TMPDIR:-/tmp}/clawdbot-tmux-sockets}\"\nmkdir -p \"$SOCKET_DIR\"\nSOCKET=\"$SOCKET_DIR/clawdbot.sock\"\nSESSION=clawdbot-python\n\ntmux -S \"$SOCKET\" new -d -s \"$SESSION\" -n shell\ntmux -S \"$SOCKET\" send-keys -t \"$SESSION\":0.0 -- 'PYTHON_BASIC_REPL=1 python3 -q' Enter\ntmux -S \"$SOCKET\" capture-pane -p -J -t \"$SESSION\":0.0 -S -200","type":"text"}]},{"type":"paragraph","content":[{"text":"After starting a session, always print monitor commands:","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":""},"content":[{"text":"To monitor:\n tmux -S \"$SOCKET\" attach -t \"$SESSION\"\n tmux -S \"$SOCKET\" capture-pane -p -J -t \"$SESSION\":0.0 -S -200","type":"text"}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"Socket convention","type":"text"}]},{"type":"bullet_list","content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Use ","type":"text"},{"text":"CLAWDBOT_TMUX_SOCKET_DIR","type":"text","marks":[{"type":"code_inline"}]},{"text":" (default ","type":"text"},{"text":"${TMPDIR:-/tmp}/clawdbot-tmux-sockets","type":"text","marks":[{"type":"code_inline"}]},{"text":").","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Default socket path: ","type":"text"},{"text":"\"$CLAWDBOT_TMUX_SOCKET_DIR/clawdbot.sock\"","type":"text","marks":[{"type":"code_inline"}]},{"text":".","type":"text"}]}]}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"Targeting panes and naming","type":"text"}]},{"type":"bullet_list","content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Target format: ","type":"text"},{"text":"session:window.pane","type":"text","marks":[{"type":"code_inline"}]},{"text":" (defaults to ","type":"text"},{"text":":0.0","type":"text","marks":[{"type":"code_inline"}]},{"text":").","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Keep names short; avoid spaces.","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Inspect: ","type":"text"},{"text":"tmux -S \"$SOCKET\" list-sessions","type":"text","marks":[{"type":"code_inline"}]},{"text":", ","type":"text"},{"text":"tmux -S \"$SOCKET\" list-panes -a","type":"text","marks":[{"type":"code_inline"}]},{"text":".","type":"text"}]}]}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"Finding sessions","type":"text"}]},{"type":"bullet_list","content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"List sessions on your socket: ","type":"text"},{"text":"{baseDir}/scripts/find-sessions.sh -S \"$SOCKET\"","type":"text","marks":[{"type":"code_inline"}]},{"text":".","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Scan all sockets: ","type":"text"},{"text":"{baseDir}/scripts/find-sessions.sh --all","type":"text","marks":[{"type":"code_inline"}]},{"text":" (uses ","type":"text"},{"text":"CLAWDBOT_TMUX_SOCKET_DIR","type":"text","marks":[{"type":"code_inline"}]},{"text":").","type":"text"}]}]}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"Sending input safely","type":"text"}]},{"type":"bullet_list","content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Prefer literal sends: ","type":"text"},{"text":"tmux -S \"$SOCKET\" send-keys -t target -l -- \"$cmd\"","type":"text","marks":[{"type":"code_inline"}]},{"text":".","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Control keys: ","type":"text"},{"text":"tmux -S \"$SOCKET\" send-keys -t target C-c","type":"text","marks":[{"type":"code_inline"}]},{"text":".","type":"text"}]}]}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"Watching output","type":"text"}]},{"type":"bullet_list","content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Capture recent history: ","type":"text"},{"text":"tmux -S \"$SOCKET\" capture-pane -p -J -t target -S -200","type":"text","marks":[{"type":"code_inline"}]},{"text":".","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Wait for prompts: ","type":"text"},{"text":"{baseDir}/scripts/wait-for-text.sh -t session:0.0 -p 'pattern'","type":"text","marks":[{"type":"code_inline"}]},{"text":".","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Attaching is OK; detach with ","type":"text"},{"text":"Ctrl+b d","type":"text","marks":[{"type":"code_inline"}]},{"text":".","type":"text"}]}]}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"Spawning processes","type":"text"}]},{"type":"bullet_list","content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"For python REPLs, set ","type":"text"},{"text":"PYTHON_BASIC_REPL=1","type":"text","marks":[{"type":"code_inline"}]},{"text":" (non-basic REPL breaks send-keys flows).","type":"text"}]}]}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"Windows / WSL","type":"text"}]},{"type":"bullet_list","content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"tmux is supported on macOS/Linux. On Windows, use WSL and install tmux inside WSL.","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"This skill is gated to ","type":"text"},{"text":"darwin","type":"text","marks":[{"type":"code_inline"}]},{"text":"/","type":"text"},{"text":"linux","type":"text","marks":[{"type":"code_inline"}]},{"text":" and requires ","type":"text"},{"text":"tmux","type":"text","marks":[{"type":"code_inline"}]},{"text":" on PATH.","type":"text"}]}]}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"Orchestrating Coding Agents (Codex, Claude Code)","type":"text"}]},{"type":"paragraph","content":[{"text":"tmux excels at running multiple coding agents in parallel:","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"bash"},"content":[{"text":"SOCKET=\"${TMPDIR:-/tmp}/codex-army.sock\"\n\n# Create multiple sessions\nfor i in 1 2 3 4 5; do\n tmux -S \"$SOCKET\" new-session -d -s \"agent-$i\"\ndone\n\n# Launch agents in different workdirs\ntmux -S \"$SOCKET\" send-keys -t agent-1 \"cd /tmp/project1 && codex --yolo 'Fix bug X'\" Enter\ntmux -S \"$SOCKET\" send-keys -t agent-2 \"cd /tmp/project2 && codex --yolo 'Fix bug Y'\" Enter\n\n# Poll for completion (check if prompt returned)\nfor sess in agent-1 agent-2; do\n if tmux -S \"$SOCKET\" capture-pane -p -t \"$sess\" -S -3 | grep -q \"❯\"; then\n echo \"$sess: DONE\"\n else\n echo \"$sess: Running...\"\n fi\ndone\n\n# Get full output from completed session\ntmux -S \"$SOCKET\" capture-pane -p -t agent-1 -S -500","type":"text"}]},{"type":"paragraph","content":[{"text":"Tips:","type":"text","marks":[{"type":"strong"}]}]},{"type":"bullet_list","content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Use separate git worktrees for parallel fixes (no branch conflicts)","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"pnpm install","type":"text","marks":[{"type":"code_inline"}]},{"text":" first before running codex in fresh clones","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Check for shell prompt (","type":"text"},{"text":"❯","type":"text","marks":[{"type":"code_inline"}]},{"text":" or ","type":"text"},{"text":"$","type":"text","marks":[{"type":"code_inline"}]},{"text":") to detect completion","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Codex needs ","type":"text"},{"text":"--yolo","type":"text","marks":[{"type":"code_inline"}]},{"text":" or ","type":"text"},{"text":"--full-auto","type":"text","marks":[{"type":"code_inline"}]},{"text":" for non-interactive fixes","type":"text"}]}]}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"Cleanup","type":"text"}]},{"type":"bullet_list","content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Kill a session: ","type":"text"},{"text":"tmux -S \"$SOCKET\" kill-session -t \"$SESSION\"","type":"text","marks":[{"type":"code_inline"}]},{"text":".","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Kill all sessions on a socket: ","type":"text"},{"text":"tmux -S \"$SOCKET\" list-sessions -F '#{session_name}' | xargs -r -n1 tmux -S \"$SOCKET\" kill-session -t","type":"text","marks":[{"type":"code_inline"}]},{"text":".","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"Remove everything on the private socket: ","type":"text"},{"text":"tmux -S \"$SOCKET\" kill-server","type":"text","marks":[{"type":"code_inline"}]},{"text":".","type":"text"}]}]}]},{"type":"heading","attrs":{"level":2},"content":[{"text":"Helper: wait-for-text.sh","type":"text"}]},{"type":"paragraph","content":[{"text":"{baseDir}/scripts/wait-for-text.sh","type":"text","marks":[{"type":"code_inline"}]},{"text":" polls a pane for a regex (or fixed string) with a timeout.","type":"text"}]},{"type":"code_block","attrs":{"wrap":false,"language":"bash"},"content":[{"text":"{baseDir}/scripts/wait-for-text.sh -t session:0.0 -p 'pattern' [-F] [-T 20] [-i 0.5] [-l 2000]","type":"text"}]},{"type":"bullet_list","content":[{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"-t","type":"text","marks":[{"type":"code_inline"}]},{"text":"/","type":"text"},{"text":"--target","type":"text","marks":[{"type":"code_inline"}]},{"text":" pane target (required)","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"-p","type":"text","marks":[{"type":"code_inline"}]},{"text":"/","type":"text"},{"text":"--pattern","type":"text","marks":[{"type":"code_inline"}]},{"text":" regex to match (required); add ","type":"text"},{"text":"-F","type":"text","marks":[{"type":"code_inline"}]},{"text":" for fixed string","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"-T","type":"text","marks":[{"type":"code_inline"}]},{"text":" timeout seconds (integer, default 15)","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"-i","type":"text","marks":[{"type":"code_inline"}]},{"text":" poll interval seconds (default 0.5)","type":"text"}]}]},{"type":"list_item","content":[{"type":"paragraph","content":[{"text":"-l","type":"text","marks":[{"type":"code_inline"}]},{"text":" history lines to search (integer, default 1000)","type":"text"}]}]}]},{"type":"hr","attrs":{"markup":"---"}}]},"metadata":{"date":"2026-06-05","name":"tmux","author":"@skillopedia","source":{"stars":2012,"repo_name":"openclaw-master-skills","origin_url":"https://github.com/leoyeai/openclaw-master-skills/blob/HEAD/skills/tmux/SKILL.md","repo_owner":"leoyeai","body_sha256":"9f1db252f27cc07b46c2a30607b8871205e7382472bb89b080bd6ffbb9a32681","cluster_key":"9f67d32e5a10f8d6a3433854fb933894d30bdca10e60f239a8f0c81b2560a5e8","clean_bundle":{"format":"clean-skill-bundle-v1","source":"leoyeai/openclaw-master-skills/skills/tmux/SKILL.md","attachments":[{"id":"4f425587-2068-5d63-89ca-9b78a5dfafa3","key":"uploads/10433ee7-ad12-4ae0-b34e-97553e46c6c8/4f425587-2068-5d63-89ca-9b78a5dfafa3/attachment.sh","path":"scripts/find-sessions.sh","size":2945,"sha256":"a137d03b3b37332439a1592831d60479ff86315c7e6d6ed7da0fb799db0f13f7","contentType":"application/x-sh; charset=utf-8"},{"id":"5d34af44-d29e-55bb-8cf9-65fcf000d284","key":"uploads/10433ee7-ad12-4ae0-b34e-97553e46c6c8/5d34af44-d29e-55bb-8cf9-65fcf000d284/attachment.sh","path":"scripts/wait-for-text.sh","size":2139,"sha256":"96bc42702f7353c32233c223d61dd11f2f99033267aeefac838aea8983a67735","contentType":"application/x-sh; charset=utf-8"}],"bundle_sha256":"089e3e8dac681fbe05fcbbf377c09cb3267536dce2146ae1fdececfcf9020e04","attachment_count":2,"text_attachments":2,"attachment_storage":"skillopedia-attachments-v1","binary_attachments":0,"excluded_attachments":[]},"cluster_size":2,"skill_md_path":"skills/tmux/SKILL.md","import_metadata":{"date":"2026-06-05","author":"@skillopedia","version":"v1","category":"browser-automation-scraping","category_label":"Browser"},"exact_dupes_collapsed_into_this":1},"version":"v1","category":"browser-automation-scraping","metadata":{"clawdbot":{"os":["darwin","linux"],"emoji":"🧵","requires":{"bins":["tmux"]}}},"import_tag":"clean-skills-v1","description":"Remote-control tmux sessions for interactive CLIs by sending keystrokes and scraping pane output."}},"renderedAt":1782982116196}

tmux Skill (Clawdbot) Use tmux only when you need an interactive TTY. Prefer bash background mode for long-running, non-interactive tasks. Quickstart (isolated socket, bash tool) After starting a session, always print monitor commands: Socket convention - Use (default ). - Default socket path: . Targeting panes and naming - Target format: (defaults to ). - Keep names short; avoid spaces. - Inspect: , . Finding sessions - List sessions on your socket: . - Scan all sockets: (uses ). Sending input safely - Prefer literal sends: . - Control keys: . Watching output - Capture recent history: . - Wa…