Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

tmux-pilot

БесплатноБез исполняемых скриптовНе проверен

Drive tmux from an AI agent — sessions, windows, panes, send commands, capture output, poll agents, browser-like workflow. Cross-platform (Linux/macOS/WSL)…

mswellот mswell★ 74 звезды на GitHub

Об этом скилле

tmux-pilot — Agent-Driven tmux Control

tmux-pilot gives AI agents full control over tmux topology: sessions, windows, panes, input routing, and output capture. It's the cross-platform equivalent of cmux for macOS.

Core Concepts

  • Session — top-level tmux container (like a project workspace)
  • Window — a tab within a session (like a workspace tab)
  • Pane — a split region within a window (where commands run)
  • Target — tmux addressing: session:window.pane (e.g., main:0.1)

Detect tmux in a Shell

[ -n "$TMUX" ] || exit 0                    # bail if not inside tmux
ORIGIN_PANE=${TMUX_PANE:?}                   # pane running this agent, e.g. %5
CURRENT_SESSION=$(tmux display-message -p -t "$ORIGIN_PANE" '#S')
CURRENT_WINDOW=$(tmux display-message -p -t "$ORIGIN_PANE" '#I')
CURRENT_PANE=$(tmux display-message -p -t "$ORIGIN_PANE" '#P')
echo "Inside tmux: ${CURRENT_SESSION}:${CURRENT_WINDOW}.${CURRENT_PANE}"

Key env vars: $TMUX (socket path), $TMUX_PANE (pane ID like %5). Always derive CURRENT_SESSION and CURRENT_WINDOW from $TMUX_PANE, not from the user's active client, so panes are created in the same window as the running agent instance.

Fast Start — Topology

# Inspect
tmux list-sessions                           # all sessions
tmux list-windows -t "$SESSION"              # windows in a session
tmux list-panes -t "$SESSION:$WINDOW"        # panes in a window
tmux display-message -p '#S:#I.#P'           # current target

# Create
tmux new-session -d -s work -c /path/to/repo           # detached session
tmux new-window -t work -n build -c /path/to/repo      # new window/tab (only when explicitly requested)
tmux split-window -h -t work:0 -c /path/to/repo        # horizontal split (right) in explicit window
tmux split-window -v -t work:0 -c /path/to/repo        # vertical split (below) in explicit window

# Layout
tmux select-layout -t work:0 even-horizontal   # even-horizontal|even-vertical|main-horizontal|main-vertical|tiled
tmux resize-pane -t work:0.1 -R 20             # resize right 20 cells
tmux resize-pane -t work:0.1 -D 10             # resize down 10 cells

# Navigate (use sparingly — prefer --focus false pattern via -d flag)
tmux select-pane -t work:0.1
tmux select-window -t work:1

Send Input to Panes

# Send a command (literal text + Enter)
tmux send-keys -t work:0.1 "npm run build" Enter

# Send special keys
tmux send-keys -t work:0.1 C-c              # Ctrl+C (cancel)
tmux send-keys -t work:0.1 C-l              # Ctrl+L (clear)
tmux send-keys -t work:0.1 Escape           # Escape key
tmux send-keys -t work:0.1 Up Enter         # arrow up + enter (re-run last)

# Send without pressing Enter (staging input)
tmux send-keys -t work:0.1 "partial command"

Capture Output (Read Pane Content)

This is the key differentiator — reading what's on screen or in scrollback.

# Capture visible content of a pane
tmux capture-pane -t work:0.1 -p

# Capture with scrollback (last 100 lines)
tmux capture-pane -t work:0.1 -p -S -100

# Capture entire scrollback history
tmux capture-pane -t work:0.1 -p -S -

# Save capture to file
tmux capture-pane -t work:0.1 -p -S -100 > /tmp/pane-output.txt

# Wait then capture (poll pattern)
sleep 3 && tmux capture-pane -t work:0.1 -p | tail -20

Polling Pattern — Launch & Monitor

When launching a process in another pane and waiting for results:

# 1. Send command
tmux send-keys -t work:0.1 "npm test" Enter

# 2. Poll with short intervals (2-5s for fast commands)
sleep 3
OUTPUT=$(tmux capture-pane -t work:0.1 -p -S -50)

# 3. Check for completion signals
echo "$OUTPUT" | grep -qE "(PASS|FAIL|Error|✓|✗|done)" && echo "Complete"

Keep sleep intervals short (2–5s) for typical commands. Use longer (10–15s) only for builds, installs, or known-slow operations.

Launch Pi Agent in a Pane

# Create a pane for a sub-agent in the same window as this Pi instance.
# Never use a bare split-window or new-window for sub-agents.
[ -n "$TMUX" ] || exit 1
ORIGIN_PANE=${TMUX_PANE:?}
CURRENT_SESSION=$(tmux display-message -p -t "$ORIGIN_PANE" '#S')
CURRENT_WINDOW=$(tmux display-message -p -t "$ORIGIN_PANE" '#I')
NEW_PANE=$(tmux split-window -h -t "$CURRENT_SESSION:$CURRENT_WINDOW" -d -P -F '#P')  # -d = don't focus
TARGET="$CURRENT_SESSION:$CURRENT_WINDOW.$NEW_PANE"

# Launch pi with a task
tmux send-keys -t "$TARGET" "pi --print 'Run the tests and fix failures'" Enter

# Poll for completion
for i in $(seq 1 30); do
  sleep 5
  OUTPUT=$(tmux capture-pane -t "$TARGET" -p -S -30)
  if echo "$OUTPUT" | grep -qE '(❯|→|\$)\s*$'; then
    echo "Agent finished"
    break
  fi
done

Multi-Pane Workspace Setup

# Create a dev workspace with editor + server + tests
tmux new-session -d -s dev -c ~/Projects/myapp
tmux rename-window -t dev:0 "code"

# Split into 3 panes: main | top-right / bottom-right
tmux split-window -h -t dev:0 -d -l 40%
tmux split-window -v -t dev:
Полный SKILL.md на GitHub

Установить tmux-pilot в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

FAQ

Что делает скилл tmux-pilot?

Drive tmux from an AI agent — sessions, windows, panes, send commands, capture output, poll agents, browser-like workflow. Cross-platform (Linux/macOS/WSL). Use when the user wants to control terminal layout, launch parallel agents, run commands in background panes, orchestrate multi-pane workflows, or mentions tmux automation.

Как установить скилл tmux-pilot?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл tmux-pilot запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить tmux-pilot с