Community编程与开发github.com

tmux

控制 tmux 会话/窗格以处理交互式 CLI:列出、捕获输出、发送按键、粘贴文本、监控提示。

tmux 是什么?

这是一个用于控制现有交互式 tmux 会话的 AI 助手技能。它允许助手列出会话、窗口和窗格,捕获输出内容,向特定窗格发送文本或特殊键,以及检查提示信息。该技能适用于需要与持久化终端会话交互的场景,例如监控长时间运行的任务或处理需要确认的交互式命令。通过编写脚本辅助工具(如 `scripts/wait-for-text.sh`)可以等待特定文本出现,从而实现自动化操作。该技能主要面向终端环境,支持 tmux 会话,并且会话在 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 -- "Please continue"
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, 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 when explicitly requested; install, verify, update, uninstall, publish, or sync skills.

相关技能