cmux-cli
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chinesecmux CLI
cmux CLI
Use this skill when a task is best handled through the command line, or when the user asks how to use, inspect, script, or document the cmux CLI. Prefer the live CLI help for exact syntax, then apply the safety rules here.
cmux当某项任务最适合通过命令行处理,或者用户询问如何使用、检查、编写脚本或记录cmux CLI时,使用此技能。优先使用实时CLI帮助获取准确语法,然后应用此处的安全规则。
cmuxPrerequisites
前提条件
Use the binary on for normal user workflows:
cmuxPATHbash
cmux --help
cmux version
cmux pingWhen dogfooding a tagged Debug build from a cmux source checkout, use the tag-bound helper instead of :
/tmp/cmux-clibash
CMUX_TAG=<tag> scripts/cmux-debug-cli.sh --help
CMUX_TAG=<tag> scripts/cmux-debug-cli.sh identify --jsonscripts/cmux-debug-cli.sh/tmp/cmux-debug-<tag>.sock在常规用户工作流中,使用中的二进制文件:
PATHcmuxbash
cmux --help
cmux version
cmux ping当从cmux源码检出中试用带标签的Debug构建版本时,请使用绑定标签的辅助脚本,而非:
/tmp/cmux-clibash
CMUX_TAG=<tag> scripts/cmux-debug-cli.sh --help
CMUX_TAG=<tag> scripts/cmux-debug-cli.sh identify --jsonscripts/cmux-debug-cli.sh/tmp/cmux-debug-<tag>.sockDiscovery
命令发现
Always discover current syntax from the CLI before giving exact command help:
bash
cmux --help
cmux help
cmux <command> --help
cmux docs settings
cmux docs shortcuts
cmux docs api
cmux docs browser
cmux docs agents
cmux docs dockSome subcommands print the top-level help instead of detailed subcommand help. If that happens, search the source locally:
bash
rg -n "Usage: cmux <command>|case \"<command>\"|run.*<Command>" CLIDo not fetch source files with . Read the local checkout or active worktree.
gh api在提供准确命令帮助前,务必从CLI中发现当前语法:
bash
cmux --help
cmux help
cmux <command> --help
cmux docs settings
cmux docs shortcuts
cmux docs api
cmux docs browser
cmux docs agents
cmux docs dock部分子命令会打印顶层帮助而非详细的子命令帮助。如果出现这种情况,在本地源码中搜索:
bash
rg -n "Usage: cmux <command>|case \"<command>\"|run.*<Command>" CLI不要使用获取源文件。读取本地检出的代码或活动工作树。
gh apiMental Model
心智模型
cmux exposes app state over a Unix socket.
- Window: top-level macOS cmux window.
- Workspace: sidebar tab-like container inside a window.
- Pane: split region inside a workspace.
- Surface: tab inside a pane. A surface can host a terminal, browser, markdown viewer, diff viewer, or other panel.
- Panel: lower-level content implementation. Prefer surface commands unless a command explicitly requires .
--panel
Handle inputs usually accept UUIDs, refs such as , , , , or numeric indexes. Output defaults to refs:
window:1workspace:2pane:3surface:4bash
cmux --id-format refs identify
cmux --id-format both list-pane-surfaces --workspace workspace:1
cmux --json --id-format both tree --allcmux通过Unix socket暴露应用状态。
- Window:macOS cmux的顶层窗口。
- Workspace:窗口内类似侧边栏标签的容器。
- Pane:工作区内的拆分区域。
- Surface:窗格内的标签页。一个Surface可以承载终端、浏览器、markdown查看器、差异查看器或其他面板。
- Panel:底层内容实现。除非命令明确要求,否则优先使用surface命令。
--panel
输入通常接受UUID、引用(如、、、)或数字索引。输出默认使用引用:
window:1workspace:2pane:3surface:4bash
cmux --id-format refs identify
cmux --id-format both list-pane-surfaces --workspace workspace:1
cmux --json --id-format both tree --allSocket Targeting
Socket 目标定位
Prefer the caller environment when running inside cmux:
bash
printf 'workspace=%s\nsurface=%s\nsocket=%s\n' \
"${CMUX_WORKSPACE_ID:-}" \
"${CMUX_SURFACE_ID:-}" \
"${CMUX_SOCKET_PATH:-}"
cmux identify --jsonUse explicit socket targeting for tagged or non-default apps:
bash
cmux --socket /tmp/cmux-debug-<tag>.sock identify --json
CMUX_SOCKET_PATH=/tmp/cmux-debug-<tag>.sock cmux pingSocket auth resolves in this order: , then , then the password saved in Settings. Do not ask the user for a password until or the command error shows auth is actually required.
--passwordCMUX_SOCKET_PASSWORDcmux capabilities --json在cmux内部运行时,优先调用者环境:
bash
printf 'workspace=%s\nsurface=%s\nsocket=%s\n' \
"${CMUX_WORKSPACE_ID:-}" \
"${CMUX_SURFACE_ID:-}" \
"${CMUX_SOCKET_PATH:-}"
cmux identify --json对带标签或非默认应用使用显式socket定位:
bash
cmux --socket /tmp/cmux-debug-<tag>.sock identify --json
CMUX_SOCKET_PATH=/tmp/cmux-debug-<tag>.sock cmux pingSocket认证的优先级为:,然后是,最后是设置中保存的密码。除非或命令错误显示确实需要认证,否则不要向用户索要密码。
--passwordCMUX_SOCKET_PASSWORDcmux capabilities --jsonGlobal Options
全局选项
Common global options:
bash
cmux --json <command>
cmux --id-format refs <command>
cmux --id-format uuids <command>
cmux --id-format both <command>
cmux --socket <path> <command>
cmux --password <password> <command>Use for automation and scripts. Use plain output when writing quick human-facing status.
--json常见全局选项:
bash
cmux --json <command>
cmux --id-format refs <command>
cmux --id-format uuids <command>
cmux --id-format both <command>
cmux --socket <path> <command>
cmux --password <password> <command>自动化和脚本使用。编写面向人类的快速状态时使用纯文本输出。
--jsonSafe First Commands
安全初始命令
Start every automation session by inspecting context and capabilities:
bash
cmux ping
cmux capabilities --json
cmux identify --json
cmux list-windows --json
cmux list-workspaces --json
cmux tree --all --jsonInside cmux, scope mutating commands to the caller workspace and surface by default:
bash
cmux list-panes --workspace "${CMUX_WORKSPACE_ID:-}" --json
cmux list-pane-surfaces --workspace "${CMUX_WORKSPACE_ID:-}" --json
cmux read-screen --workspace "${CMUX_WORKSPACE_ID:-}" --surface "${CMUX_SURFACE_ID:-}" --lines 80每个自动化会话都应从检查上下文和功能开始:
bash
cmux ping
cmux capabilities --json
cmux identify --json
cmux list-windows --json
cmux list-workspaces --json
cmux tree --all --json在cmux内部,默认将修改命令限定在调用者的工作区和界面:
bash
cmux list-panes --workspace "${CMUX_WORKSPACE_ID:-}" --json
cmux list-pane-surfaces --workspace "${CMUX_WORKSPACE_ID:-}" --json
cmux read-screen --workspace "${CMUX_WORKSPACE_ID:-}" --surface "${CMUX_SURFACE_ID:-}" --lines 80Common Workflows
常见工作流
Use references/commands.md for a broader command catalog. High-frequency patterns:
bash
undefined使用references/commands.md获取更全面的命令目录。高频模式:
bash
undefinedOpen without stealing focus when supported.
支持时,打开但不获取焦点。
cmux open . --focus false
cmux open https://example.com --workspace "${CMUX_WORKSPACE_ID:-}" --focus false
cmux open . --focus false
cmux open https://example.com --workspace "${CMUX_WORKSPACE_ID:-}" --focus false
Create helper output in the caller workspace.
在调用者工作区创建辅助输出。
cmux new-pane --workspace "${CMUX_WORKSPACE_ID:-}" --type terminal --direction right --focus false
cmux new-surface --workspace "${CMUX_WORKSPACE_ID:-}" --pane pane:2 --type terminal --focus false
cmux new-pane --workspace "${CMUX_WORKSPACE_ID:-}" --type terminal --direction right --focus false
cmux new-surface --workspace "${CMUX_WORKSPACE_ID:-}" --pane pane:2 --type terminal --focus false
Read and write the caller terminal.
读取和写入调用者终端。
cmux read-screen --surface "${CMUX_SURFACE_ID:-}" --scrollback --lines 200
cmux send --surface "${CMUX_SURFACE_ID:-}" "echo ok\n"
cmux send-key --surface "${CMUX_SURFACE_ID:-}" enter
cmux read-screen --surface "${CMUX_SURFACE_ID:-}" --scrollback --lines 200
cmux send --surface "${CMUX_SURFACE_ID:-}" "echo ok\n"
cmux send-key --surface "${CMUX_SURFACE_ID:-}" enter
Browser surface automation.
浏览器界面自动化。
cmux browser open https://example.com --focus false
cmux browser snapshot --surface surface:5 --compact
cmux browser click "button[type=submit]" --snapshot-after
cmux browser open https://example.com --focus false
cmux browser snapshot --surface surface:5 --compact
cmux browser click "button[type=submit]" --snapshot-after
Settings and docs.
设置和文档。
cmux docs settings
cmux settings path
cmux config validate
cmux reload-config
cmux docs settings
cmux settings path
cmux config validate
cmux reload-config
Sidebar status for task progress.
侧边栏任务进度状态。
cmux set-status build running --workspace "${CMUX_WORKSPACE_ID:-}" --color "#ff9500"
cmux set-progress 0.4 --label "Building" --workspace "${CMUX_WORKSPACE_ID:-}"
cmux clear-status build --workspace "${CMUX_WORKSPACE_ID:-}"
cmux clear-progress --workspace "${CMUX_WORKSPACE_ID:-}"
undefinedcmux set-status build running --workspace "${CMUX_WORKSPACE_ID:-}" --color "#ff9500"
cmux set-progress 0.4 --label "Building" --workspace "${CMUX_WORKSPACE_ID:-}"
cmux clear-status build --workspace "${CMUX_WORKSPACE_ID:-}"
cmux clear-progress --workspace "${CMUX_WORKSPACE_ID:-}"
undefinedCommand Families
命令族
The CLI includes these broad families:
- App/docs/settings: ,
welcome,docs,settings,config,shortcuts,reload-config.themes - Openers and viewers: ,
open,markdown, browser commands.diff - Context and topology: ,
identify,list-windows,list-workspaces, workspace/window/pane/surface lifecycle commands.tree - Terminal IO: ,
read-screen,send,send-key,capture-pane,pipe-pane,clear-history.respawn-pane - Browser automation: ,
browser open,goto,snapshot,click,fill,screenshot,get,find, cookies, storage.tab - Notifications and sidebar state: , notification list/read/clear commands,
notify,right-sidebar,set-status,set-progress.log - Agent workflows: ,
hooks,feed,claude-teams,codex-teams,omo,omx.omc - Auth and cloud: ,
auth,login,logoutorvm.cloud - Advanced socket/debug: ,
capabilities,events,rpc,surface-health,debug-terminals.trigger-flash - tmux compatibility: ,
capture-pane,resize-pane,wait-for,swap-pane,break-pane,join-pane, buffers, hooks, messages.find-window
CLI包含以下广泛的命令族:
- 应用/文档/设置:、
welcome、docs、settings、config、shortcuts、reload-config。themes - 打开器和查看器:、
open、markdown、浏览器命令。diff - 上下文和拓扑:、
identify、list-windows、list-workspaces、工作区/窗口/窗格/界面生命周期命令。tree - 终端IO:、
read-screen、send、send-key、capture-pane、pipe-pane、clear-history。respawn-pane - 浏览器自动化:、
browser open、goto、snapshot、click、fill、screenshot、get、find、cookies、storage。tab - 通知和侧边栏状态:、通知列表/读取/清除命令、
notify、right-sidebar、set-status、set-progress。log - Agent工作流:、
hooks、feed、claude-teams、codex-teams、omo、omx。omc - 认证和云:、
auth、login、logout或vm。cloud - 高级socket/调试:、
capabilities、events、rpc、surface-health、debug-terminals。trigger-flash - tmux兼容性:、
capture-pane、resize-pane、wait-for、swap-pane、break-pane、join-pane、buffers、hooks、messages。find-window
Non-Disruptive Automation
无干扰自动化
The user may be looking at a different workspace, window, or app. Treat focus changes like UI clicks.
Do not call these unless the user explicitly asks:
focus-windowfocus-panefocus-panelselect-workspace- actions that focus or select
tab-action right-sidebar focus
Prefer additive, scoped commands:
bash
cmux new-pane --workspace "${CMUX_WORKSPACE_ID:-}" --type terminal --direction right --focus false
cmux new-surface --workspace "${CMUX_WORKSPACE_ID:-}" --pane pane:2 --type terminal --focus false
cmux send --workspace "${CMUX_WORKSPACE_ID:-}" --surface surface:7 "npm test\n"When creating helper output for a task, reuse one right-side helper pane in the caller workspace. Use and first, then create a new pane only when no suitable helper pane exists.
list-paneslist-pane-surfaces用户可能正在查看不同的工作区、窗口或应用。将焦点更改视为UI点击操作。
除非用户明确要求,否则不要调用以下命令:
focus-windowfocus-panefocus-panelselect-workspace- 会获取焦点或进行选择的操作
tab-action right-sidebar focus
优先使用附加的、限定范围的命令:
bash
cmux new-pane --workspace "${CMUX_WORKSPACE_ID:-}" --type terminal --direction right --focus false
cmux new-surface --workspace "${CMUX_WORKSPACE_ID:-}" --pane pane:2 --type terminal --focus false
cmux send --workspace "${CMUX_WORKSPACE_ID:-}" --surface surface:7 "npm test\n"为任务创建辅助输出时,在调用者工作区重用一个右侧辅助窗格。先使用和,仅当没有合适的辅助窗格时才创建新窗格。
list-paneslist-pane-surfacesSettings Boundary
设置边界
cmux-owned settings live in . Ghostty terminal behavior lives in . Prefer Ghostty config for terminal behavior Ghostty already supports, such as font, cursor style, scrollback, theme, background opacity, and blur.
~/.config/cmux/cmux.json~/.config/ghostty/configBefore editing , run:
cmux.jsonbash
cmux docs settings
cmux settings pathBack up the existing file to a timestamped copy before editing, then run:
.bakbash
cmux reload-configcmux自有设置存储在中。Ghostty终端行为设置存储在中。对于Ghostty已支持的终端行为(如字体、光标样式、回滚、主题、背景透明度和模糊),优先使用Ghostty配置。
~/.config/cmux/cmux.json~/.config/ghostty/config编辑前,运行:
cmux.jsonbash
cmux docs settings
cmux settings path编辑前将现有文件备份到带时间戳的副本,然后运行:
.bakbash
cmux reload-configDebug and Tagged Builds
调试和带标签构建
For cmux app/runtime development, build a tagged app before using CLI commands against it:
bash
./scripts/reload.sh --tag <tag>
CMUX_TAG=<tag> scripts/cmux-debug-cli.sh identify --json
CMUX_TAG=<tag> scripts/cmux-debug-cli.sh list-workspaces --jsonDo not use bare without a tagged . Do not use for tagged dogfood because it points at the most recently reloaded build and can target the wrong socket.
xcodebuild-derivedDataPath/tmp/cmux-cliUseful debug files:
bash
cat /tmp/cmux-last-cli-path
cat /tmp/cmux-last-debug-log-path
tail -f "$(cat /tmp/cmux-last-debug-log-path 2>/dev/null || echo /tmp/cmux-debug.log)"对于cmux应用/运行时开发,在使用CLI命令之前先构建带标签的应用:
bash
./scripts/reload.sh --tag <tag>
CMUX_TAG=<tag> scripts/cmux-debug-cli.sh identify --json
CMUX_TAG=<tag> scripts/cmux-debug-cli.sh list-workspaces --json不要使用不带标签的裸。不要将用于带标签的试用版本,因为它指向最近重新加载的构建,可能会定位到错误的socket。
-derivedDataPathxcodebuild/tmp/cmux-cli有用的调试文件:
bash
cat /tmp/cmux-last-cli-path
cat /tmp/cmux-last-debug-log-path
tail -f "$(cat /tmp/cmux-last-debug-log-path 2>/dev/null || echo /tmp/cmux-debug.log)"Rules
规则
- Run or
cmux --helpbefore giving exact syntax.cmux <command> --help - Use for scripts and agent automation.
--json - Scope mutating commands with ,
--workspace,--surface, and--panewhere available.--window - Prefer ,
CMUX_WORKSPACE_ID, andCMUX_SURFACE_IDover focused-window fallbacks.CMUX_SOCKET_PATH - Pass or
--focus falsewhenever the command supports it unless the user asked to focus something.--no-focus - Never change settings without first running or
cmux docs settings; back upcmux settings pathbefore editing.cmux.json - Prefer Ghostty config for terminal behavior Ghostty already supports.
- For tagged Debug builds, use .
CMUX_TAG=<tag> scripts/cmux-debug-cli.sh ... - Do not run commands against the default socket when the task is about a tagged app.
- Do not ask the user to paste commands into cmux when the CLI can perform the setup directly.
- 在提供准确语法前,运行或
cmux --help。cmux <command> --help - 脚本和Agent自动化使用。
--json - 尽可能使用、
--workspace、--surface和--pane限定修改命令的范围。--window - 优先使用、
CMUX_WORKSPACE_ID和CMUX_SURFACE_ID,而非聚焦窗口的回退选项。CMUX_SOCKET_PATH - 只要命令支持,就传递或
--focus false,除非用户要求获取焦点。--no-focus - 在运行或
cmux docs settings前,不要更改设置;编辑前备份cmux settings path。cmux.json - 对于Ghostty已支持的终端行为,优先使用Ghostty配置。
- 对于带标签的Debug构建,使用。
CMUX_TAG=<tag> scripts/cmux-debug-cli.sh ... - 当任务涉及带标签的应用时,不要针对默认socket运行命令。
- 当CLI可以直接执行设置时,不要要求用户将命令粘贴到cmux中。
Related Skills
相关技能
- covers core topology and routing.
skills/cmux/SKILL.md - the skill covers current-workspace targeting and helper panes.
cmux-workspace - the skill covers browser surface automation.
cmux-browser - the skill covers safe settings edits.
cmux-settings - the skill covers markdown viewer panels.
cmux-markdown
- 涵盖核心拓扑和路由。
skills/cmux/SKILL.md - 技能涵盖当前工作区定位和辅助窗格。
cmux-workspace - 技能涵盖浏览器界面自动化。
cmux-browser - 技能涵盖安全的设置编辑。
cmux-settings - 技能涵盖markdown查看器面板。
cmux-markdown