一键导入
tmux
Remote-control tmux sessions for interactive CLIs by sending keystrokes and scraping pane output.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Remote-control tmux sessions for interactive CLIs by sending keystrokes and scraping pane output.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Interact with GitHub repositories using the GitHub API
Create new skills for ChatDock
Summarize or extract text/transcripts from URLs, podcasts, and local files.
Get weather information and forecasts using wttr.in
| name | tmux |
| description | Remote-control tmux sessions for interactive CLIs by sending keystrokes and scraping pane output. |
| emoji | 🧵 |
| requires | {"bins":["tmux"]} |
| os | ["darwin","linux"] |
Use tmux only when you need an interactive TTY. Prefer the shell tool for non-interactive tasks.
SOCKET_DIR="${TMPDIR:-/tmp}/chatdock-tmux"
mkdir -p "$SOCKET_DIR"
SOCKET="$SOCKET_DIR/chatdock.sock"
SESSION=chatdock-main
# Create a new session
tmux -S "$SOCKET" new -d -s "$SESSION" -n shell
# Send commands
tmux -S "$SOCKET" send-keys -t "$SESSION":0.0 -- 'echo Hello World' Enter
# Capture output
tmux -S "$SOCKET" capture-pane -p -J -t "$SESSION":0.0 -S -200
After starting a session, always provide monitor commands to the user:
To monitor:
tmux -S "$SOCKET" attach -t "$SESSION"
tmux -S "$SOCKET" capture-pane -p -J -t "$SESSION":0.0 -S -200
$TMPDIR/chatdock-tmux/chatdock.sockTarget format: session:window.pane (defaults to :0.0)
# List all sessions
tmux -S "$SOCKET" list-sessions
# List all panes
tmux -S "$SOCKET" list-panes -a
# Literal text (preferred)
tmux -S "$SOCKET" send-keys -t target -l -- "$cmd"
# With Enter key
tmux -S "$SOCKET" send-keys -t target -- "ls -la" Enter
# Control keys
tmux -S "$SOCKET" send-keys -t target C-c # Ctrl+C
tmux -S "$SOCKET" send-keys -t target C-d # Ctrl+D
# Capture recent history (last 200 lines)
tmux -S "$SOCKET" capture-pane -p -J -t target -S -200
# Watch for a specific pattern (poll every 0.5s)
while ! tmux -S "$SOCKET" capture-pane -p -t target | grep -q "pattern"; do
sleep 0.5
done
echo "Pattern found!"
For Python REPLs, set PYTHON_BASIC_REPL=1 to avoid readline issues:
tmux -S "$SOCKET" send-keys -t "$SESSION":0.0 -- 'PYTHON_BASIC_REPL=1 python3 -q' Enter
SOCKET="${TMPDIR:-/tmp}/multi-agent.sock"
# Create multiple sessions
for i in 1 2 3; do
tmux -S "$SOCKET" new-session -d -s "task-$i"
done
# Launch tasks
tmux -S "$SOCKET" send-keys -t task-1 "cd /project1 && npm test" Enter
tmux -S "$SOCKET" send-keys -t task-2 "cd /project2 && npm test" Enter
tmux -S "$SOCKET" send-keys -t task-3 "cd /project3 && npm test" Enter
# Poll for completion
for sess in task-1 task-2 task-3; do
if tmux -S "$SOCKET" capture-pane -p -t "$sess" -S -3 | grep -q "\\$"; then
echo "$sess: DONE"
else
echo "$sess: Running..."
fi
done
# Kill a specific session
tmux -S "$SOCKET" kill-session -t "$SESSION"
# Kill all sessions on socket
tmux -S "$SOCKET" kill-server
# Remove socket file
rm -f "$SOCKET"
This skill requires macOS or Linux. On Windows, use WSL and install tmux inside WSL.