Community程式設計與開發github.com

tmux

控制 tmux 會話/窗格以進行互動式 CLI:列出、捕獲輸出、發送按鍵、粘貼文字、監控提示。

tmux 是什麼?

這個技能讓 AI 代理(如 Claude Code)能夠直接控制現有的 tmux 會話和窗格,實現對持久化終端會話的互動式控制。與一次性命令或後臺任務不同,它專門設計用於管理和操作那些長時間運行、具有狀態且需要即時交互的 CLI 程序。技能支援列出 tmux 會話、窗格和窗口,捕獲螢幕輸出(包括完整的滾動緩衝區),以及精確發送文字按鍵和特殊按鍵。它還包含強大的提示檢測能力,可以監控命令輸出中的特定文字模式(如確認提示),並在理解上下文後自動響應。支援 `session:window.pane` 格式的目標定位,並提供 `scripts/wait-for-text.sh` 等輔助腳本,用於等待特定文字出現,確保命令完成的正確時序。這種技能在處理長時間運行的進程、需要保持狀態的交互式應用程式,或跨 SSH 連接保持的會話時尤其有用。

相容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/clawdbot/clawdbot/tree/main/skills/tmux

Installed? Explore more 程式設計與開發 skills: steipete/bluebubbles, steipete/eightctl, steipete/blucli · View all 6 →

在你喜歡的 AI 中提問

開啟一個已預先載入此 Agent Skill 的新對話。

說明文件

tmux 是做什麼的?

用於現有的互動式 tmux 會話。對於一次性命令,請使用普通的 Shell。對於新的非互動式後臺任務,請使用背景執行。

基本操作

tmux ls
tmux list-windows -t shared
tmux list-panes -t shared:0
tmux capture-pane -t shared:0.0 -p
tmux capture-pane -t shared:0.0 -p -S -

目標格式:session:window.pane,例如 shared:0.0。

發送輸入

發送純文字,然後按 Enter:

tmux send-keys -t shared:0.0 -l -- "請繼續"
tmux send-keys -t shared:0.0 Enter

特殊按鍵:

tmux send-keys -t shared:0.0 C-c
tmux send-keys -t shared:0.0 C-d
tmux send-keys -t shared:0.0 Escape

使用 -l -- 發送任意文字。將文字和 Enter 分開發送,以避免粘貼/換行問題。

會話管理

tmux new-session -d -s worker
tmux rename-session -t old new
tmux kill-session -t worker

提示檢查

tmux capture-pane -t worker-3 -p | tail -20
tmux capture-pane -t worker-3 -p | rg "proceed|permission|Yes|No|❯"

僅在理解提示內容時才批准/選擇:

tmux send-keys -t worker-3 -l -- "y"
tmux send-keys -t worker-3 Enter

輔助工具

  • scripts/find-sessions.sh:發現會話。
  • scripts/wait-for-text.sh:等待捕獲的窗格內容包含指定文字。

wait-for-text.sh 會搜索回顯輸入、滾動緩衝區以及進程輸出。對於命令完成,使用一個唯一標記,其完整文字在發送給 tmux 的命令中跨參數分割:

nonce="$(od -An -N8 -tx1 /dev/urandom | tr -d ' \n')"
marker="OPENCLAW_DONE_${nonce}"
tmux send-keys -t shared:0.0 -l -- "sleep 4; printf '%s%s\n' 'OPENCLAW_DONE_' '$nonce'"
tmux send-keys -t shared:0.0 Enter
scripts/wait-for-text.sh -t shared:0.0 -p "$marker" -F -T 30

回顯的命令永遠不會包含完整的標記,而 nonce 則防止舊的完成行被匹配。

備註

  • capture-pane -p 將輸出打印到 stdout 供腳本使用。
  • -S - 捕獲完整的滾動緩衝區。
  • tmux 會話在 SSH 斷開後仍然保持。

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

1password

Set up and use 1Password CLI for sign-in, desktop integration, and reading or injecting secrets.

acp-router

Route plain-language requests for Claude Code, Cursor, Copilot, OpenClaw ACP, OpenCode, Gemini CLI, Grok Build, Qwen, Kiro, Kimi, iFlow, Factory Droid, Kilocode, or explicit ACP harness work into either OpenClaw ACP runtime sessions or direct acpx-driven sessions ("telephone game" flow). For coding-agent thread requests, read this skill first, then use only `sessions_spawn` for thread creation. Codex chat binding defaults to the native Codex app-server plugin unless ACP is explicit or background spawn needs ACP.

add-model-provider

Add and live-prove a model provider with non-interactive config one-liners, without exposing credentials.

agent-transcript

Requested GitHub PR/issue agent transcripts: redact, trim, preview, and insert safely.

apple-notes

Create, view, edit, delete, search, move, or export Apple Notes via the memo CLI on macOS.

apple-reminders

List, add, edit, complete, or delete Apple Reminders and reminder lists via remindctl.

auto-qa

Run OpenClaw-wide autonomous QA and live/stress campaigns across independent subsystem lanes, with verified fixes and a resumable evidence report.

autoreview

Structured code review through the shared OpenClaw agent-skills installation.

bear-notes

Create, search, and manage Bear notes via grizzly CLI.

blacksmith-testbox

Run Blacksmith Testbox for CI-parity checks, secrets, hosted services, migrations, or builds local cannot reproduce.

block-kit

Use proactively for structured or interactive Slack replies, and when asked to author or validate native Slack Block Kit JSON.

blogwatcher

Monitor blogs and RSS/Atom feeds for updates using the blogwatcher CLI.

blucli

BluOS CLI (blu) for discovery, playback, grouping, and volume.

bluebubbles

Send and manage iMessages via BlueBubbles, including attachments, tapbacks, edits, replies, and groups.

browser-automation

Use when controlling web pages with the OpenClaw browser tool, especially multi-step flows, login checks, tab management, or recovery from stale refs/timeouts.

camsnap

Capture frames or clips from RTSP/ONVIF cameras and local webcams, including USB pan/tilt/zoom control.

canvas

Present HTML on connected OpenClaw node canvases, navigate/eval/snapshot, and debug canvas host URLs.

channel-message-flows

Use when running QA Lab channel message flow evidence.

clawdtributor

Clawtributor PRs here, last week or another window: discover conversation refs, recheck GitHub, rank by impact.

clawhub

Search ClawHub for plugins by default, or skills and agent Templates when requested; add Templates; install, verify, update, uninstall, publish, or sync skills.

相關技能