[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7EG1D6YTRWBCPP6TV2MBZGC":3,"skill-same:01M7EG1D6YTRWBCPP6TV2MBZGC":60},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":38,"commitSha":39,"skillDirectory":40,"forksCount":41,"repositoryHtmlUrl":42,"repositoryHomepageUrl":6,"ownerHtmlUrl":43,"ownerBlogUrl":6,"ownerDescription":44,"updatedAt":45,"install":46,"resources":59},"01M7EG1D6YTRWBCPP6TV2MBZGC","cmux",null,"Control cmux workspaces, panes, surfaces, and agent sessions safely from macOS terminal workflows.","lza6\u002FArmor-piercing-system-prompts","lza6","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F128880206?v=4","01M7EB3K7WPX5T28EJ2NVHE6EG","Chinese-tingfeng","01M7EB3K97E1KQ16QWKJMFNGX8",11,"MIT","https:\u002F\u002Fgithub.com\u002Flza6\u002FArmor-piercing-system-prompts\u002Fblob\u002Fmain\u002F04-安全渗透\u002Fcmux\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: cmux\ndescription: \"Control cmux workspaces, panes, surfaces, and agent sessions safely from macOS terminal workflows.\"\ncategory: development\nrisk: critical\nsource: community\nsource_repo: davidondrej\u002Fskills\nsource_type: community\ndate_added: \"2026-07-07\"\nauthor: davidondrej\ntags: [cmux, terminal, agents, macos]\ntools: [claude, codex]\nlicense: \"MIT\"\nlicense_source: \"https:\u002F\u002Fgithub.com\u002Fdavidondrej\u002Fskills\u002Fblob\u002Fmain\u002FLICENSE\"\n---\n\n# cmux Control\n\n## When to Use\n\n- Use when you need to inspect, create, close, or rearrange cmux panes, surfaces, or workspaces.\n- Use when you need to send input to or monitor agents running inside cmux.\n\ncmux is a native macOS terminal app for running multiple AI coding agents in parallel. It exposes a CLI (`cmux`) and a Unix-socket JSON-RPC API (`\u002Ftmp\u002Fcmux.sock`) for full topology and browser control.\n\n## Core Concepts\n\n- **Window** — top-level macOS cmux window\n- **Workspace** — sidebar tab within a window (one git branch \u002F project context)\n- **Pane** — split region inside a workspace\n- **Surface** — tab inside a pane (terminal or browser)\n\nHandles default to short refs (`workspace:2`, `pane:1`, `surface:7`); UUIDs accepted as input. Add `--id-format uuids|both` for UUID output.\n\n### Ref syntax — get this right or fail silently\n\n- **Always use PREFIXED refs** (`pane:38`, `surface:46`). A **bare number is treated as an INDEX, not an ID** — `--surface 46` means \"the surface at index 46\" (usually nonexistent → silent failure), NOT `surface:46`.\n- **`read-screen` and `capture-pane` have NO `--pane` flag** — they target `--workspace` or `--surface` only. Passing `--pane` errors, and a bare\u002Fmissing target falls back to your OWN surface (you'll read your own footer and draw wrong conclusions). To read a pane: resolve it to a surface FIRST with `cmux list-pane-surfaces --pane pane:N`, then `cmux read-screen --surface surface:N`.\n- **Never append `2>\u002Fdev\u002Fnull` to cmux commands.** Errors go to stderr with exit code 1; suppressing them blinds you to your own ref\u002Fflag mistakes (the #1 cause of \"(no output)\").\n\n## Detect cmux in a Shell\n\n```bash\n[ -S \"${CMUX_SOCKET_PATH:-\u002Ftmp\u002Fcmux.sock}\" ] || exit 0   # bail if not in cmux\n[ -n \"${CMUX_WORKSPACE_ID:-}\" ] && echo \"inside cmux surface\"\n```\n\nInjected env vars in every cmux-spawned terminal: `CMUX_WORKSPACE_ID`, `CMUX_SURFACE_ID`, `CMUX_SOCKET_PATH`, `CMUX_PORT`. **Always anchor automation to `CMUX_WORKSPACE_ID`** — the visually focused workspace may not be the agent's caller workspace.\n\n## Fast Start — Topology\n\n```bash\ncmux identify --json                              # who am I (window\u002Fworkspace\u002Fpane\u002Fsurface)\ncmux tree                                         # full hierarchy\ncmux list-workspaces --json\ncmux list-panes --workspace \"$CMUX_WORKSPACE_ID\"\ncmux list-surfaces --workspace \"$CMUX_WORKSPACE_ID\"\n\ncmux new-workspace --name \"feature-x\" --cwd \u002Fpath\u002Fto\u002Frepo\ncmux new-pane --workspace \"$CMUX_WORKSPACE_ID\" --type terminal --direction right --focus false\ncmux new-pane --workspace \"$CMUX_WORKSPACE_ID\" --type browser  --direction right --url http:\u002F\u002Flocalhost:3000\ncmux move-surface --surface surface:7 --pane pane:2 --focus false\ncmux split-off --surface surface:7 right\ncmux reorder-surface --surface surface:7 --before surface:3\ncmux close-surface --surface surface:7\n```\n\n## Polling Pi Agents in Panes — Keep Sleeps Short\n\nWhen launching a Pi Agent inside a cmux pane and polling for output, use **short `sleep` intervals (2–5s)**. Pi is fast and minimal, and the user runs it on Opus 4.8 Fast via OpenRouter, which streams tokens extremely quickly. Do NOT use `sleep 15` unless genuinely needed (a big build\u002Frefactor) — most of the time `sleep 2`–`sleep 5` is more than enough.\n\nAfter every agent check, send the user a one-line status update: what the agent is doing and whether it is on track. Keep it extremely concise.\n\nClaude Code cmux note: after Claude finishes, it may prefill a predicted next user message; that draft is Claude, not the user speaking.\n\n## Send Input\n\n**Command names:** there is NO `send-surface` \u002F `send-key-surface`. Target a specific surface with the `--surface` flag on `send` \u002F `send-key` (same commands as the focused terminal). `send-panel` \u002F `send-key-panel` exist ONLY for panels (`--panel`), not surfaces.\n\n```bash\ncmux send \"echo hi\\n\"                                       # focused terminal\ncmux send-key \"ctrl+c\"                                       # enter|tab|esc|backspace|arrows|ctrl+x|shift+tab\ncmux send --surface surface:7 \"npm run build\"               # specific surface (NOT send-surface)\ncmux send-key --surface surface:7 enter                     # specific surface (NOT send-key-surface)\n```\n\n## Notifications & Sidebar Metadata\n\n```bash\ncmux notify --title \"Done\" --body \"tests passed\"\ncmux set-status build \"compiling\" --icon hammer --color \"#ff9500\"\ncmux set-progress 0.5 --label \"Building...\"\ncmux log --level success \"All 42 tests passed\"               # info|progress|success|warning|error\ncmux trigger-flash --workspace \"$CMUX_WORKSPACE_ID\"          # blue-ring attention cue\ncmux sidebar-state --json                                    # dump all sidebar metadata\n```\n\n## Browser Automation (WKWebView)\n\nWorkflow: open → wait → snapshot → act → re-snapshot.\n\n```bash\nS=$(cmux --json browser open https:\u002F\u002Fexample.com | jq -r .result.surface_ref)\ncmux browser \"$S\" wait --load-state complete --timeout-ms 15000\ncmux browser \"$S\" snapshot --interactive                     # returns elements as e1, e2, ...\ncmux browser \"$S\" fill e1 \"\u003Cemail-address>\"\ncmux browser \"$S\" click e2 --snapshot-after\n\n# Navigation \u002F inspection\ncmux browser \"$S\" goto URL | back | forward | reload\ncmux browser \"$S\" get url | get title | get text body | get value \"#email\" | get count \".row\"\ncmux browser \"$S\" eval 'return document.title'\n\n# Waits\ncmux browser \"$S\" wait --selector \"#ready\" --timeout-ms 10000\ncmux browser \"$S\" wait --url-contains \"\u002Fdashboard\" --timeout-ms 10000\n\n# Session\ncmux browser \"$S\" cookies get | cookies set --name foo --value bar\ncmux browser \"$S\" state save \u002Ftmp\u002Fauth.json | state load \u002Ftmp\u002Fauth.json\n\n# Diagnostics\ncmux browser \"$S\" console list | errors list | screenshot\n```\n\n**Not supported by WKWebView** (return `not_supported`): viewport emulation, geolocation\u002Foffline emulation, trace recording, network route interception, raw input injection.\n\n## Markdown Viewer\n\n```bash\ncmux markdown open plan.md --direction right                 # live-watching renderer\ncmux open file.pdf                                           # auto-routes to right viewer\n```\n\n`cmux markdown open` flags: `--workspace`, `--surface`, `--window`, `--direction \u003Cright|down|left|up>`, `--focus \u003Ctrue|false>`. There is **NO `--pane` flag** — passing it errors. To target a pane, pass `--surface \u003Cexisting-md-surface-in-that-pane>`.\n\n### Reuse the existing right markdown pane (don't spawn strays)\n\nDefault behavior of `markdown open` is to **create a new pane** every time, even with `--direction right`. To keep all docs as tabs in ONE right pane, follow this exactly:\n\n```bash\n# 1. Find the right pane and its surfaces (anchor to THIS workspace)\ncmux list-panes --workspace \"$CMUX_WORKSPACE_ID\"\ncmux list-pane-surfaces --pane pane:10        # the right\u002Fhelper pane\n\n# 2. Open targeting an existing markdown surface IN that pane (reuses pane, adds tab)\ncmux markdown open \u002Fabs\u002Fpath\u002Ffile.md --surface surface:12 --focus false\n\n# 3. If it STILL spawned a new pane (it can), move the new surface in + verify\ncmux move-surface --surface surface:NEW --pane pane:10 --focus false\ncmux list-panes --workspace \"$CMUX_WORKSPACE_ID\"   # confirm stray pane is gone\n```\n\n### Swapping the file in the single right pane (close-FIRST, then open)\n\nTo replace the doc shown in your one right markdown pane, the ONLY reliable order is **close the previous surface FIRST, then `markdown open` the new file fresh** — never move an existing viewer, never open-then-close.\n\n```bash\n# 1. close the previous right markdown surface (right side goes empty)\ncmux list-panes --workspace \"$CMUX_WORKSPACE_ID\"\ncmux close-surface --surface surface:PREV\n# 2. THEN open the new file fresh\ncmux markdown open \u002Fabs\u002Fpath\u002Fnew.md --direction right --focus false\n```\n\nORDER MATTERS: close-previous BEFORE open-new. Opening first then closing the old one, or `move-surface`-ing an existing viewer, leaves the right pane BLANK.\n\n### Hard-won lessons (avoid the trial-and-error)\n\n- **Surface refs are global, not per-workspace.** A ref like `surface:126` from an earlier `markdown open` may live in a different window\u002Fworkspace. Always re-list (`list-panes` \u002F `list-pane-surfaces`) before reusing a ref — never assume a ref from a previous turn is still in the right pane.\n- **`move-surface`-ing a markdown viewer often leaves it BLANK.** The moved surface keeps `type=markdown` and `surface-health` looks fine, but renders nothing. Fix: `close-surface` it and `cmux markdown open \u003Cpath>` fresh, then move the *fresh* surface if needed. Don't waste time on `refresh-surfaces` — it usually won't fix a moved-then-blank viewer.\n- **You cannot screenshot or `read-screen` a markdown surface** (`Surface is not a terminal` \u002F browser screenshot is WKWebView-only). To verify a markdown viewer rendered, ask the user or open the file in a browser surface instead. Don't burn turns trying to capture it.\n- **`cmux list-surfaces` does not exist.** Use `cmux list-pane-surfaces [--pane ...]`.\n\n## Settings & Config\n\n```bash\ncmux docs settings        # prints paths, schema URL, reload cmd — read BEFORE editing\ncmux settings path        # path to cmux.json\ncmux settings cmux-json   # open in editor\ncmux reload-config        # hot-reload cmux.json + ~\u002F.config\u002Fghostty\u002Fconfig (Cmd+Shift+,)\n```\n\nLocations:\n- cmux settings: `~\u002F.config\u002Fcmux\u002Fcmux.json` (canonical). Project-local override: `.cmux\u002Fcmux.json` or `.\u002Fcmux.json`.\n- Terminal rendering (font, cursor, theme, scrollback, opacity, blur): `~\u002F.config\u002Fghostty\u002Fconfig` — NOT cmux.json.\n\nBefore editing `cmux.json`, copy it to a timestamped `.bak` next to it so the user can revert. Schema: `https:\u002F\u002Fraw.githubusercontent.com\u002Fmanaflow-ai\u002Fcmux\u002Fmain\u002Fweb\u002Fdata\u002Fcmux.schema.json`.\n\n## Agent Hooks & Install\n\n```bash\nbrew tap manaflow-ai\u002Fcmux && brew install --cask cmux\nsudo ln -sf \u002FApplications\u002Fcmux.app\u002FContents\u002FResources\u002Fbin\u002Fcmux \u002Fusr\u002Flocal\u002Fbin\u002Fcmux\ncmux hooks setup                                             # all detected agents\ncmux hooks setup codex|grok|antigravity|opencode             # specific agent\nnpx skills add manaflow-ai\u002Fcmux -g -y                        # install cmux skills for agents\n```\n\nNative session-resume supported for: Claude Code, Codex, Grok, OpenCode, Pi, Amp, Cursor CLI, Gemini, Antigravity, Rovo Dev, Hermes, Copilot, CodeBuddy, Factory, Qoder.\n\n## Socket API (advanced)\n\n`\u002Ftmp\u002Fcmux.sock` — Unix socket, JSON-RPC v2. Use for tight loops where subprocess spawn cost matters; otherwise prefer the CLI.\n\n```bash\necho '{\"id\":\"1\",\"method\":\"workspace.list\",\"params\":{}}' | nc -U \u002Ftmp\u002Fcmux.sock\n```\n\nMethod prefixes: `system.*`, `window.*`, `workspace.*`, `pane.*`, `surface.*`, `notification.*`, `browser.*`. Full list and Python client example in `references\u002Fsocket-api.md`.\n\nAccess modes: `cmuxOnly` (default — only cmux-spawned processes), `automation` (any local process), `password`, `allowAll` (unsafe). If you hit `Failed to connect to socket`, you're likely an external process under `cmuxOnly` — switch mode in Settings > Automation or run from inside a cmux terminal.\n\n## Critical Rules — Non-Disruptive Automation\n\nThese rules come from the `cmux-workspace` skill and prevent agents from yanking the user's focus:\n\n1. **Anchor to `CMUX_WORKSPACE_ID`.** Never assume the visually focused workspace is the target.\n2. **Never call focus-changing verbs speculatively.** `select-workspace`, `focus-pane`, `focus-panel`, `focus-surface` only on explicit user request. Pass `--focus false` whenever available.\n3. **Build layout additively in one call.** `cmux new-pane --type … --focus false` beats create-then-move-then-focus chains.\n4. **Right-side helper pane pattern.** Reuse an existing non-caller helper pane if present; otherwise create exactly one right-side pane.\n5. **Never send input to surfaces you don't own.** Only target surfaces in the caller's workspace unless the user explicitly asks for cross-workspace routing.\n6. **Check surface health before routing input** when UI state may be stale: `cmux surface-health`.\n\n## Common Pitfalls\n\n- **Pi\u002FPi-like socket connection failures from external processes** → default `cmuxOnly` mode; either run inside a cmux terminal or change socket mode.\n- **macOS only.** No Linux\u002FWindows port.\n- **WKWebView ≠ CDP.** Don't expect Playwright-equivalent network mocking or viewport emulation.\n- **Resume strips sensitive env vars.** Re-inject tokens at resume time if the agent needs them.\n- **Skills snapshot at app start.** Edits to skill files require a restart of the consuming agent.\n- **Legacy v1 socket payloads (`{\"command\":...}`) rejected.** Use v2 JSON-RPC only.\n- **Don't `cat ~\u002F.cmuxterm\u002F*-hook-sessions.json`** expecting secrets — they're scrubbed. Look there for session\u002Fsurface mappings only.\n\n## Reference: Full CLI Help\n\nFor any command, `cmux \u003Ccmd> --help` is authoritative. Use `cmux capabilities --json` to enumerate available socket methods in the current build.\n\n## Keyboard Shortcuts (most-used)\n\nWorkspaces: ⌘N new, ⌘1–8 jump, ⌃⌘[ \u002F ⌃⌘] prev\u002Fnext, ⌘⇧W close, ⌘B sidebar.\nSurfaces: ⌘T new, ⌘⇧[ \u002F ⌘⇧] prev\u002Fnext, ⌘W close, ⌃1–8 jump.\nSplits: ⌘D right, ⌘⇧D down, ⌥⌘D browser right, ⌥⌘←→↑↓ focus directional, ⌘⇧↵ zoom.\nBrowser: ⌘⇧L open, ⌘L address bar, ⌘[\u002F⌘] back\u002Fforward, ⌥⌘I devtools.\nApp: ⌘, settings, ⌘⇧, reload-config, ⌘⇧P palette, ⌘⇧O restore session, ⌃⌥⌘. system-wide show\u002Fhide.\n\n## Limitations\n\n- Adapted from `davidondrej\u002Fskills`; verify local paths, tools, credentials, and agent features before acting.\n- For commands, remote access, scheduling, browser automation, or file-changing workflows, get explicit user approval and confirm the target environment first.\n","# cmux Control\n\n## When to Use\n\n- Use when you need to inspect, create, close, or rearrange cmux panes, surfaces, or workspaces.\n- Use when you need to send input to or monitor agents running inside cmux.\n\ncmux is a native macOS terminal app for running multiple AI coding agents in parallel. It exposes a CLI (`cmux`) and a Unix-socket JSON-RPC API (`\u002Ftmp\u002Fcmux.sock`) for full topology and browser control.\n\n## Core Concepts\n\n- **Window** — top-level macOS cmux window\n- **Workspace** — sidebar tab within a window (one git branch \u002F project context)\n- **Pane** — split region inside a workspace\n- **Surface** — tab inside a pane (terminal or browser)\n\nHandles default to short refs (`workspace:2`, `pane:1`, `surface:7`); UUIDs accepted as input. Add `--id-format uuids|both` for UUID output.\n\n### Ref syntax — get this right or fail silently\n\n- **Always use PREFIXED refs** (`pane:38`, `surface:46`). A **bare number is treated as an INDEX, not an ID** — `--surface 46` means \"the surface at index 46\" (usually nonexistent → silent failure), NOT `surface:46`.\n- **`read-screen` and `capture-pane` have NO `--pane` flag** — they target `--workspace` or `--surface` only. Passing `--pane` errors, and a bare\u002Fmissing target falls back to your OWN surface (you'll read your own footer and draw wrong conclusions). To read a pane: resolve it to a surface FIRST with `cmux list-pane-surfaces --pane pane:N`, then `cmux read-screen --surface surface:N`.\n- **Never append `2>\u002Fdev\u002Fnull` to cmux commands.** Errors go to stderr with exit code 1; suppressing them blinds you to your own ref\u002Fflag mistakes (the #1 cause of \"(no output)\").\n\n## Detect cmux in a Shell\n\n```bash\n[ -S \"${CMUX_SOCKET_PATH:-\u002Ftmp\u002Fcmux.sock}\" ] || exit 0   # bail if not in cmux\n[ -n \"${CMUX_WORKSPACE_ID:-}\" ] && echo \"inside cmux surface\"\n```\n\nInjected env vars in every cmux-spawned terminal: `CMUX_WORKSPACE_ID`, `CMUX_SURFACE_ID`, `CMUX_SOCKET_PATH`, `CMUX_PORT`. **Always anchor automation to `CMUX_WORKSPACE_ID`** — the visually focused workspace may not be the agent's caller workspace.\n\n## Fast Start — Topology\n\n```bash\ncmux identify --json                              # who am I (window\u002Fworkspace\u002Fpane\u002Fsurface)\ncmux tree                                         # full hierarchy\ncmux list-workspaces --json\ncmux list-panes --workspace \"$CMUX_WORKSPACE_ID\"\ncmux list-surfaces --workspace \"$CMUX_WORKSPACE_ID\"\n\ncmux new-workspace --name \"feature-x\" --cwd \u002Fpath\u002Fto\u002Frepo\ncmux new-pane --workspace \"$CMUX_WORKSPACE_ID\" --type terminal --direction right --focus false\ncmux new-pane --workspace \"$CMUX_WORKSPACE_ID\" --type browser  --direction right --url http:\u002F\u002Flocalhost:3000\ncmux move-surface --surface surface:7 --pane pane:2 --focus false\ncmux split-off --surface surface:7 right\ncmux reorder-surface --surface surface:7 --before surface:3\ncmux close-surface --surface surface:7\n```\n\n## Polling Pi Agents in Panes — Keep Sleeps Short\n\nWhen launching a Pi Agent inside a cmux pane and polling for output, use **short `sleep` intervals (2–5s)**. Pi is fast and minimal, and the user runs it on Opus 4.8 Fast via OpenRouter, which streams tokens extremely quickly. Do NOT use `sleep 15` unless genuinely needed (a big build\u002Frefactor) — most of the time `sleep 2`–`sleep 5` is more than enough.\n\nAfter every agent check, send the user a one-line status update: what the agent is doing and whether it is on track. Keep it extremely concise.\n\nClaude Code cmux note: after Claude finishes, it may prefill a predicted next user message; that draft is Claude, not the user speaking.\n\n## Send Input\n\n**Command names:** there is NO `send-surface` \u002F `send-key-surface`. Target a specific surface with the `--surface` flag on `send` \u002F `send-key` (same commands as the focused terminal). `send-panel` \u002F `send-key-panel` exist ONLY for panels (`--panel`), not surfaces.\n\n```bash\ncmux send \"echo hi\\n\"                                       # focused terminal\ncmux send-key \"ctrl+c\"                                       # enter|tab|esc|backspace|arrows|ctrl+x|shift+tab\ncmux send --surface surface:7 \"npm run build\"               # specific surface (NOT send-surface)\ncmux send-key --surface surface:7 enter                     # specific surface (NOT send-key-surface)\n```\n\n## Notifications & Sidebar Metadata\n\n```bash\ncmux notify --title \"Done\" --body \"tests passed\"\ncmux set-status build \"compiling\" --icon hammer --color \"#ff9500\"\ncmux set-progress 0.5 --label \"Building...\"\ncmux log --level success \"All 42 tests passed\"               # info|progress|success|warning|error\ncmux trigger-flash --workspace \"$CMUX_WORKSPACE_ID\"          # blue-ring attention cue\ncmux sidebar-state --json                                    # dump all sidebar metadata\n```\n\n## Browser Automation (WKWebView)\n\nWorkflow: open → wait → snapshot → act → re-snapshot.\n\n```bash\nS=$(cmux --json browser open https:\u002F\u002Fexample.com | jq -r .result.surface_ref)\ncmux browser \"$S\" wait --load-state complete --timeout-ms 15000\ncmux browser \"$S\" snapshot --interactive                     # returns elements as e1, e2, ...\ncmux browser \"$S\" fill e1 \"\u003Cemail-address>\"\ncmux browser \"$S\" click e2 --snapshot-after\n\n# Navigation \u002F inspection\ncmux browser \"$S\" goto URL | back | forward | reload\ncmux browser \"$S\" get url | get title | get text body | get value \"#email\" | get count \".row\"\ncmux browser \"$S\" eval 'return document.title'\n\n# Waits\ncmux browser \"$S\" wait --selector \"#ready\" --timeout-ms 10000\ncmux browser \"$S\" wait --url-contains \"\u002Fdashboard\" --timeout-ms 10000\n\n# Session\ncmux browser \"$S\" cookies get | cookies set --name foo --value bar\ncmux browser \"$S\" state save \u002Ftmp\u002Fauth.json | state load \u002Ftmp\u002Fauth.json\n\n# Diagnostics\ncmux browser \"$S\" console list | errors list | screenshot\n```\n\n**Not supported by WKWebView** (return `not_supported`): viewport emulation, geolocation\u002Foffline emulation, trace recording, network route interception, raw input injection.\n\n## Markdown Viewer\n\n```bash\ncmux markdown open plan.md --direction right                 # live-watching renderer\ncmux open file.pdf                                           # auto-routes to right viewer\n```\n\n`cmux markdown open` flags: `--workspace`, `--surface`, `--window`, `--direction \u003Cright|down|left|up>`, `--focus \u003Ctrue|false>`. There is **NO `--pane` flag** — passing it errors. To target a pane, pass `--surface \u003Cexisting-md-surface-in-that-pane>`.\n\n### Reuse the existing right markdown pane (don't spawn strays)\n\nDefault behavior of `markdown open` is to **create a new pane** every time, even with `--direction right`. To keep all docs as tabs in ONE right pane, follow this exactly:\n\n```bash\n# 1. Find the right pane and its surfaces (anchor to THIS workspace)\ncmux list-panes --workspace \"$CMUX_WORKSPACE_ID\"\ncmux list-pane-surfaces --pane pane:10        # the right\u002Fhelper pane\n\n# 2. Open targeting an existing markdown surface IN that pane (reuses pane, adds tab)\ncmux markdown open \u002Fabs\u002Fpath\u002Ffile.md --surface surface:12 --focus false\n\n# 3. If it STILL spawned a new pane (it can), move the new surface in + verify\ncmux move-surface --surface surface:NEW --pane pane:10 --focus false\ncmux list-panes --workspace \"$CMUX_WORKSPACE_ID\"   # confirm stray pane is gone\n```\n\n### Swapping the file in the single right pane (close-FIRST, then open)\n\nTo replace the doc shown in your one right markdown pane, the ONLY reliable order is **close the previous surface FIRST, then `markdown open` the new file fresh** — never move an existing viewer, never open-then-close.\n\n```bash\n# 1. close the previous right markdown surface (right side goes empty)\ncmux list-panes --workspace \"$CMUX_WORKSPACE_ID\"\ncmux close-surface --surface surface:PREV\n# 2. THEN open the new file fresh\ncmux markdown open \u002Fabs\u002Fpath\u002Fnew.md --direction right --focus false\n```\n\nORDER MATTERS: close-previous BEFORE open-new. Opening first then closing the old one, or `move-surface`-ing an existing viewer, leaves the right pane BLANK.\n\n### Hard-won lessons (avoid the trial-and-error)\n\n- **Surface refs are global, not per-workspace.** A ref like `surface:126` from an earlier `markdown open` may live in a different window\u002Fworkspace. Always re-list (`list-panes` \u002F `list-pane-surfaces`) before reusing a ref — never assume a ref from a previous turn is still in the right pane.\n- **`move-surface`-ing a markdown viewer often leaves it BLANK.** The moved surface keeps `type=markdown` and `surface-health` looks fine, but renders nothing. Fix: `close-surface` it and `cmux markdown open \u003Cpath>` fresh, then move the *fresh* surface if needed. Don't waste time on `refresh-surfaces` — it usually won't fix a moved-then-blank viewer.\n- **You cannot screenshot or `read-screen` a markdown surface** (`Surface is not a terminal` \u002F browser screenshot is WKWebView-only). To verify a markdown viewer rendered, ask the user or open the file in a browser surface instead. Don't burn turns trying to capture it.\n- **`cmux list-surfaces` does not exist.** Use `cmux list-pane-surfaces [--pane ...]`.\n\n## Settings & Config\n\n```bash\ncmux docs settings        # prints paths, schema URL, reload cmd — read BEFORE editing\ncmux settings path        # path to cmux.json\ncmux settings cmux-json   # open in editor\ncmux reload-config        # hot-reload cmux.json + ~\u002F.config\u002Fghostty\u002Fconfig (Cmd+Shift+,)\n```\n\nLocations:\n- cmux settings: `~\u002F.config\u002Fcmux\u002Fcmux.json` (canonical). Project-local override: `.cmux\u002Fcmux.json` or `.\u002Fcmux.json`.\n- Terminal rendering (font, cursor, theme, scrollback, opacity, blur): `~\u002F.config\u002Fghostty\u002Fconfig` — NOT cmux.json.\n\nBefore editing `cmux.json`, copy it to a timestamped `.bak` next to it so the user can revert. Schema: `https:\u002F\u002Fraw.githubusercontent.com\u002Fmanaflow-ai\u002Fcmux\u002Fmain\u002Fweb\u002Fdata\u002Fcmux.schema.json`.\n\n## Agent Hooks & Install\n\n```bash\nbrew tap manaflow-ai\u002Fcmux && brew install --cask cmux\nsudo ln -sf \u002FApplications\u002Fcmux.app\u002FContents\u002FResources\u002Fbin\u002Fcmux \u002Fusr\u002Flocal\u002Fbin\u002Fcmux\ncmux hooks setup                                             # all detected agents\ncmux hooks setup codex|grok|antigravity|opencode             # specific agent\nnpx skills add manaflow-ai\u002Fcmux -g -y                        # install cmux skills for agents\n```\n\nNative session-resume supported for: Claude Code, Codex, Grok, OpenCode, Pi, Amp, Cursor CLI, Gemini, Antigravity, Rovo Dev, Hermes, Copilot, CodeBuddy, Factory, Qoder.\n\n## Socket API (advanced)\n\n`\u002Ftmp\u002Fcmux.sock` — Unix socket, JSON-RPC v2. Use for tight loops where subprocess spawn cost matters; otherwise prefer the CLI.\n\n```bash\necho '{\"id\":\"1\",\"method\":\"workspace.list\",\"params\":{}}' | nc -U \u002Ftmp\u002Fcmux.sock\n```\n\nMethod prefixes: `system.*`, `window.*`, `workspace.*`, `pane.*`, `surface.*`, `notification.*`, `browser.*`. Full list and Python client example in `references\u002Fsocket-api.md`.\n\nAccess modes: `cmuxOnly` (default — only cmux-spawned processes), `automation` (any local process), `password`, `allowAll` (unsafe). If you hit `Failed to connect to socket`, you're likely an external process under `cmuxOnly` — switch mode in Settings > Automation or run from inside a cmux terminal.\n\n## Critical Rules — Non-Disruptive Automation\n\nThese rules come from the `cmux-workspace` skill and prevent agents from yanking the user's focus:\n\n1. **Anchor to `CMUX_WORKSPACE_ID`.** Never assume the visually focused workspace is the target.\n2. **Never call focus-changing verbs speculatively.** `select-workspace`, `focus-pane`, `focus-panel`, `focus-surface` only on explicit user request. Pass `--focus false` whenever available.\n3. **Build layout additively in one call.** `cmux new-pane --type … --focus false` beats create-then-move-then-focus chains.\n4. **Right-side helper pane pattern.** Reuse an existing non-caller helper pane if present; otherwise create exactly one right-side pane.\n5. **Never send input to surfaces you don't own.** Only target surfaces in the caller's workspace unless the user explicitly asks for cross-workspace routing.\n6. **Check surface health before routing input** when UI state may be stale: `cmux surface-health`.\n\n## Common Pitfalls\n\n- **Pi\u002FPi-like socket connection failures from external processes** → default `cmuxOnly` mode; either run inside a cmux terminal or change socket mode.\n- **macOS only.** No Linux\u002FWindows port.\n- **WKWebView ≠ CDP.** Don't expect Playwright-equivalent network mocking or viewport emulation.\n- **Resume strips sensitive env vars.** Re-inject tokens at resume time if the agent needs them.\n- **Skills snapshot at app start.** Edits to skill files require a restart of the consuming agent.\n- **Legacy v1 socket payloads (`{\"command\":...}`) rejected.** Use v2 JSON-RPC only.\n- **Don't `cat ~\u002F.cmuxterm\u002F*-hook-sessions.json`** expecting secrets — they're scrubbed. Look there for session\u002Fsurface mappings only.\n\n## Reference: Full CLI Help\n\nFor any command, `cmux \u003Ccmd> --help` is authoritative. Use `cmux capabilities --json` to enumerate available socket methods in the current build.\n\n## Keyboard Shortcuts (most-used)\n\nWorkspaces: ⌘N new, ⌘1–8 jump, ⌃⌘[ \u002F ⌃⌘] prev\u002Fnext, ⌘⇧W close, ⌘B sidebar.\nSurfaces: ⌘T new, ⌘⇧[ \u002F ⌘⇧] prev\u002Fnext, ⌘W close, ⌃1–8 jump.\nSplits: ⌘D right, ⌘⇧D down, ⌥⌘D browser right, ⌥⌘←→↑↓ focus directional, ⌘⇧↵ zoom.\nBrowser: ⌘⇧L open, ⌘L address bar, ⌘[\u002F⌘] back\u002Fforward, ⌥⌘I devtools.\nApp: ⌘, settings, ⌘⇧, reload-config, ⌘⇧P palette, ⌘⇧O restore session, ⌃⌥⌘. system-wide show\u002Fhide.\n\n## Limitations\n\n- Adapted from `davidondrej\u002Fskills`; verify local paths, tools, credentials, and agent features before acting.\n- For commands, remote access, scheduling, browser automation, or file-changing workflows, get explicit user approval and confirm the target environment first.\n",{"name":5,"risk":24,"tags":25,"tools":29,"author":32,"source":33,"license":15,"category":34,"date_added":35,"description":7,"source_repo":36,"source_type":33,"license_source":37},"critical",[5,26,27,28],"terminal","agents","macos",[30,31],"claude","codex","davidondrej","community","development","2026-07-07","davidondrej\u002Fskills","https:\u002F\u002Fgithub.com\u002Fdavidondrej\u002Fskills\u002Fblob\u002Fmain\u002FLICENSE","main","d69096e239f2a89aabc2cd078c47664a9d3b1e11","04-安全渗透\u002Fcmux",3,"https:\u002F\u002Fgithub.com\u002Flza6\u002FArmor-piercing-system-prompts","https:\u002F\u002Fgithub.com\u002Flza6","个人vx：Tf00798\r\n个人✈：@TFGY999","2026-10-08 14:29:22",{"source":8,"skillName":5,"commands":47,"prompt":57,"zipAvailable":58},[48,51,54],{"tool":49,"command":50},"npx","npx skills add lza6\u002FArmor-piercing-system-prompts --skill cmux",{"tool":52,"command":53},"bunx","bunx skills add lza6\u002FArmor-piercing-system-prompts --skill cmux",{"tool":55,"command":56},"pnpm","pnpm dlx skills add lza6\u002FArmor-piercing-system-prompts --skill cmux","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Flza6\u002FArmor-piercing-system-prompts\u002Fblob\u002Fmain\u002F04-安全渗透\u002Fcmux\u002FSKILL.md",true,[],[61,69,74,81,88,95],{"skillNo":62,"name":63,"nameZh":6,"description":64,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":65,"categories":66,"keywords":67,"publishedAt":68},"01M7FFG485KY83TD6HSC4YPCMC","obsidian-clipper-template-creator","Guide for creating templates for the Obsidian Web Clipper. Use when you want to create a new clipping template, understand available variables, or format clipped content.","https:\u002F\u002Fgithub.com\u002Flza6\u002FArmor-piercing-system-prompts\u002Fblob\u002Fmain\u002F07-后端与架构\u002Fobsidian-clipper-template-creator\u002FSKILL.md",[],[],"2026-11-16 10:05:34",{"skillNo":70,"name":63,"nameZh":6,"description":64,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":71,"categories":72,"keywords":73,"publishedAt":68},"01M7FFG0T6AZ0STEJPSB3CX84K","https:\u002F\u002Fgithub.com\u002Flza6\u002FArmor-piercing-system-prompts\u002Fblob\u002Fmain\u002F07-后端与架构\u002Fobsidian-clipper-template-creator-antigravity-awesome-skills-main\u002FSKILL.md",[],[],{"skillNo":75,"name":76,"nameZh":6,"description":77,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":78,"categories":79,"keywords":80,"publishedAt":68},"01M7FFFY0QEM14SKWPDYGMXM2P","python-api","Programmatic Object-Detection-Metrics API guidance for BoundingBox, BoundingBoxes, Evaluator, enums, coordinate conversion, AP\u002FmAP semantics, and source-style import diagnostics.","https:\u002F\u002Fgithub.com\u002Flza6\u002FArmor-piercing-system-prompts\u002Fblob\u002Fmain\u002F07-后端与架构\u002Fobject-detection-metrics\u002Fsub-skills\u002Fpython-api\u002FSKILL.md",[],[],{"skillNo":82,"name":83,"nameZh":6,"description":84,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":85,"categories":86,"keywords":87,"publishedAt":68},"01M7FFFVZQZ2GJ0C0TGP7JHD20","file-evaluation","Folder-based PASCAL VOC AP\u002FmAP evaluation from ground-truth and detection text files.","https:\u002F\u002Fgithub.com\u002Flza6\u002FArmor-piercing-system-prompts\u002Fblob\u002Fmain\u002F07-后端与架构\u002Fobject-detection-metrics\u002Fsub-skills\u002Ffile-evaluation\u002FSKILL.md",[],[],{"skillNo":89,"name":90,"nameZh":6,"description":91,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":92,"categories":93,"keywords":94,"publishedAt":68},"01M7FFFSFNYSE77SJ6PE1CK2DA","object-detection-metrics","Guides legacy Object-Detection-Metrics PASCAL VOC AP\u002FmAP evaluation from detection text folders and direct Python API classes.","https:\u002F\u002Fgithub.com\u002Flza6\u002FArmor-piercing-system-prompts\u002Fblob\u002Fmain\u002F07-后端与架构\u002Fobject-detection-metrics\u002FSKILL.md",[],[],{"skillNo":96,"name":97,"nameZh":6,"description":98,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":99,"categories":100,"keywords":101,"publishedAt":68},"01M7FFFP0GCK1RVXBCPQ8APBMT","nx-workspace-patterns","Configure and optimize Nx monorepo workspaces. Use when setting up Nx, configuring project boundaries, optimizing build caching, or implementing affected commands.","https:\u002F\u002Fgithub.com\u002Flza6\u002FArmor-piercing-system-prompts\u002Fblob\u002Fmain\u002F07-后端与架构\u002Fnx-workspace-patterns\u002FSKILL.md",[],[]]