cmux
Skill11 starsChanged 4 months agoMITView on GitHub
MUST be read ANY time you interact with cmux in ANY way — listing/inspecting/creating/closing cmux workspaces, panes, or surfaces; reading or capturing pane/screen output; sending input or keys to a pane/surface; delegating to, polling, or checking on other agents running in cmux panes/surfaces; building or rearranging terminal layout; cmux browser automation; sending notifications/flashes/status/progress to the sidebar; editing cmux settings; or integrating an agent with cmux hooks. If your command starts with `cmux ` or touches a cmux workspace/pane/surface/agent, read this FIRST. Triggers on "cmux", "in this workspace", "this pane", "the other agent", "delegate to", "check on the agent", "send to the pane". macOS only (14.0+).
- Installs packages
We split this skill into the rules it gives an agent
10 rules. 0 are common, 4 are distinctive, and 6 are very specific to this project.
0
Common
Most of the 25 edited versions we read keep these.
4
Distinctive
This author's own choices. Worth a look.
6
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 56
After every agent check, send the user a one-line status update: what the agent is doing and whether it is on track.
- Very specific: line 123
Default behavior of markdown open is to create a new pane every time, even with --direction right.
- Very specific: line 157
cmux list-surfacesdoes not exist: Use cmux list-pane-surfaces [--pane ...]. - Very specific: line 172
Before editing cmux.json, copy it to a timestamped .bak next to it so the user can revert.
- Very specific: line 202
Anchor to
CMUX_WORKSPACE_ID: Never assume the visually focused workspace is the target. - Distinctive: line 206
Never send input to surfaces you don't own: Only target surfaces in the caller's workspace unless the user explicitly asks for …
- Very specific: line 207
Check surface health before routing input: when UI state may be stale: cmux surface-health.
- Distinctive: line 212
macOS only: No Linux/Windows port.
- Distinctive: line 213
WKWebView ≠ CDP: Don't expect Playwright-equivalent network mocking or viewport emulation.
- Very specific: line 216
Legacy v1 socket payloads (
{"command":...}) rejected: Use v2 JSON-RPC only.
“Common” is measured: kept by at least 6 in 10 of the 25 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
cmux Control
cmux 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 (/tmp/cmux.sock) for full topology and browser control.
Core Concepts
- Window — top-level macOS cmux window
- Workspace — sidebar tab within a window (one git branch / project context)
- Pane — split region inside a workspace
- Surface — tab inside a pane (terminal or browser)
Handles default to short refs (workspace:2, pane:1, surface:7); UUIDs accepted as input. Add --id-format uuids|both for UUID output.
Ref syntax — get this right or fail silently
- Always use PREFIXED refs (
pane:38,surface:46). A bare number is treated as an INDEX, not an ID —--surface 46means "the surface at index 46" (usually nonexistent → silent failure), NOTsurface:46. read-screenandcapture-panehave NO--paneflag — they target--workspaceor--surfaceonly. Passing--paneerrors, and a bare/missing 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 withcmux list-pane-surfaces --pane pane:N, thencmux read-screen --surface surface:N.- Never append
2>/dev/nullto cmux commands. Errors go to stderr with exit code 1; suppressing them blinds you to your own ref/flag mistakes (the #1 cause of "(no output)").
Detect cmux in a Shell
[ -S "${CMUX_SOCKET_PATH:-/tmp/cmux.sock}" ] || exit 0 # bail if not in cmux
[ -n "${CMUX_WORKSPACE_ID:-}" ] && echo "inside cmux surface"Injected 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.
Fast Start — Topology
cmux identify --json # who am I (window/workspace/pane/surface)
cmux tree # full hierarchy
cmux list-workspaces --json
cmux list-panes --workspace "$CMUX_WORKSPACE_ID"
cmux list-surfaces --workspace "$CMUX_WORKSPACE_ID"
cmux new-workspace --name "feature-x" --cwd /path/to/repo
cmux new-pane --workspace "$CMUX_WORKSPACE_ID" --type terminal --direction right --focus false
cmux new-pane --workspace "$CMUX_WORKSPACE_ID" --type browser --direction right --url http://localhost:3000
cmux move-surface --surface surface:7 --pane pane:2 --focus false
cmux split-off --surface surface:7 right
cmux reorder-surface --surface surface:7 --before surface:3
cmux close-surface --surface surface:7Polling Pi Agents in Panes — Keep Sleeps Short
When 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/refactor) — most of the time sleep 2–sleep 5 is more than enough.
After 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.
Claude Code cmux note: after Claude finishes, it may prefill a predicted next user message; that draft is Claude, not the user speaking.
Send Input
Command names: there is NO send-surface / send-key-surface. Target a specific surface with the --surface flag on send / send-key (same commands as the focused terminal). send-panel / send-key-panel exist ONLY for panels (--panel), not surfaces.
cmux send "echo hi\n" # focused terminal
cmux send-key "ctrl+c" # enter|tab|esc|backspace|arrows|ctrl+x|shift+tab
cmux send --surface surface:7 "npm run build" # specific surface (NOT send-surface)
cmux send-key --surface surface:7 enter # specific surface (NOT send-key-surface)Notifications & Sidebar Metadata
cmux notify --title "Done" --body "tests passed"
cmux set-status build "compiling" --icon hammer --color "#ff9500"
cmux set-progress 0.5 --label "Building..."
cmux log --level success "All 42 tests passed" # info|progress|success|warning|error
cmux trigger-flash --workspace "$CMUX_WORKSPACE_ID" # blue-ring attention cue
cmux sidebar-state --json # dump all sidebar metadataBrowser Automation (WKWebView)
Workflow: open → wait → snapshot → act → re-snapshot.
S=$(cmux --json browser open https://example.com | jq -r .result.surface_ref)
cmux browser "$S" wait --load-state complete --timeout-ms 15000
cmux browser "$S" snapshot --interactive # returns elements as e1, e2, ...
cmux browser "$S" fill e1 "<email-address>"
cmux browser "$S" click e2 --snapshot-after
# Navigation / inspection
cmux browser "$S" goto URL | back | forward | reload
cmux browser "$S" get url | get title | get text body | get value "#email" | get count ".row"
cmux browser "$S" eval 'return document.title'
# Waits
cmux browser "$S" wait --selector "#ready" --timeout-ms 10000
cmux browser "$S" wait --url-contains "/dashboard" --timeout-ms 10000
# Session
cmux browser "$S" cookies get | cookies set --name foo --value bar
cmux browser "$S" state save /tmp/auth.json | state load /tmp/auth.json
# Diagnostics
cmux browser "$S" console list | errors list | screenshotNot supported by WKWebView (return not_supported): viewport emulation, geolocation/offline emulation, trace recording, network route interception, raw input injection.
Markdown Viewer
cmux markdown open plan.md --direction right # live-watching renderer
cmux open file.pdf # auto-routes to right viewercmux markdown open flags: --workspace, --surface, --window, --direction <right|down|left|up>, --focus <true|false>. There is NO --pane flag — passing it errors. To target a pane, pass --surface <existing-md-surface-in-that-pane>.
Reuse the existing right markdown pane (don't spawn strays)
Default 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:
# 1. Find the right pane and its surfaces (anchor to THIS workspace)
cmux list-panes --workspace "$CMUX_WORKSPACE_ID"
cmux list-pane-surfaces --pane pane:10 # the right/helper pane
# 2. Open targeting an existing markdown surface IN that pane (reuses pane, adds tab)
cmux markdown open /abs/path/file.md --surface surface:12 --focus false
# 3. If it STILL spawned a new pane (it can), move the new surface in + verify
cmux move-surface --surface surface:NEW --pane pane:10 --focus false
cmux list-panes --workspace "$CMUX_WORKSPACE_ID" # confirm stray pane is goneSwapping the file in the single right pane (close-FIRST, then open)
To 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.
# 1. close the previous right markdown surface (right side goes empty)
cmux list-panes --workspace "$CMUX_WORKSPACE_ID"
cmux close-surface --surface surface:PREV
# 2. THEN open the new file fresh
cmux markdown open /abs/path/new.md --direction right --focus falseORDER 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.
Hard-won lessons (avoid the trial-and-error)
- Surface refs are global, not per-workspace. A ref like
surface:126from an earliermarkdown openmay live in a different window/workspace. Always re-list (list-panes/list-pane-surfaces) before reusing a ref — never assume a ref from a previous turn is still in the right pane. move-surface-ing a markdown viewer often leaves it BLANK. The moved surface keepstype=markdownandsurface-healthlooks fine, but renders nothing. Fix:close-surfaceit andcmux markdown open <path>fresh, then move the fresh surface if needed. Don't waste time onrefresh-surfaces— it usually won't fix a moved-then-blank viewer.- You cannot screenshot or
read-screena markdown surface (Surface is not a terminal/ 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. cmux list-surfacesdoes not exist. Usecmux list-pane-surfaces [--pane ...].
Settings & Config
cmux docs settings # prints paths, schema URL, reload cmd — read BEFORE editing
cmux settings path # path to cmux.json
cmux settings cmux-json # open in editor
cmux reload-config # hot-reload cmux.json + ~/.config/ghostty/config (Cmd+Shift+,)Locations:
- cmux settings:
~/.config/cmux/cmux.json(canonical). Project-local override:.cmux/cmux.jsonor./cmux.json. - Terminal rendering (font, cursor, theme, scrollback, opacity, blur):
~/.config/ghostty/config— NOT cmux.json.
Before editing cmux.json, copy it to a timestamped .bak next to it so the user can revert. Schema: https://raw.githubusercontent.com/manaflow-ai/cmux/main/web/data/cmux.schema.json.
Agent Hooks & Install
brew tap manaflow-ai/cmux && brew install --cask cmux
sudo ln -sf /Applications/cmux.app/Contents/Resources/bin/cmux /usr/local/bin/cmux
cmux hooks setup # all detected agents
cmux hooks setup codex|grok|antigravity|opencode # specific agent
npx skills add manaflow-ai/cmux -g -y # install cmux skills for agentsNative session-resume supported for: Claude Code, Codex, Grok, OpenCode, Pi, Amp, Cursor CLI, Gemini, Antigravity, Rovo Dev, Hermes, Copilot, CodeBuddy, Factory, Qoder.
Socket API (advanced)
/tmp/cmux.sock — Unix socket, JSON-RPC v2. Use for tight loops where subprocess spawn cost matters; otherwise prefer the CLI.
echo '{"id":"1","method":"workspace.list","params":{}}' | nc -U /tmp/cmux.sockMethod prefixes: system.*, window.*, workspace.*, pane.*, surface.*, notification.*, browser.*. Full list and Python client example in references/socket-api.md.
Access 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.
Critical Rules — Non-Disruptive Automation
These rules come from the cmux-workspace skill and prevent agents from yanking the user's focus:
- Anchor to
CMUX_WORKSPACE_ID. Never assume the visually focused workspace is the target. - Never call focus-changing verbs speculatively.
select-workspace,focus-pane,focus-panel,focus-surfaceonly on explicit user request. Pass--focus falsewhenever available. - Build layout additively in one call.
cmux new-pane --type … --focus falsebeats create-then-move-then-focus chains. - Right-side helper pane pattern. Reuse an existing non-caller helper pane if present; otherwise create exactly one right-side pane.
- 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.
- Check surface health before routing input when UI state may be stale:
cmux surface-health.
Common Pitfalls
- Pi/Pi-like socket connection failures from external processes → default
cmuxOnlymode; either run inside a cmux terminal or change socket mode. - macOS only. No Linux/Windows port.
- WKWebView ≠ CDP. Don't expect Playwright-equivalent network mocking or viewport emulation.
- Resume strips sensitive env vars. Re-inject tokens at resume time if the agent needs them.
- Skills snapshot at app start. Edits to skill files require a restart of the consuming agent.
- Legacy v1 socket payloads (
{"command":...}) rejected. Use v2 JSON-RPC only. - Don't
cat ~/.cmuxterm/*-hook-sessions.jsonexpecting secrets — they're scrubbed. Look there for session/surface mappings only.
Reference: Full CLI Help
For any command, cmux <cmd> --help is authoritative. Use cmux capabilities --json to enumerate available socket methods in the current build.
Keyboard Shortcuts (most-used)
Workspaces: ⌘N new, ⌘1–8 jump, ⌃⌘[ / ⌃⌘] prev/next, ⌘⇧W close, ⌘B sidebar. Surfaces: ⌘T new, ⌘⇧[ / ⌘⇧] prev/next, ⌘W close, ⌃1–8 jump. Splits: ⌘D right, ⌘⇧D down, ⌥⌘D browser right, ⌥⌘←→↑↓ focus directional, ⌘⇧↵ zoom. Browser: ⌘⇧L open, ⌘L address bar, ⌘[/⌘] back/forward, ⌥⌘I devtools. App: ⌘, settings, ⌘⇧, reload-config, ⌘⇧P palette, ⌘⇧O restore session, ⌃⌥⌘. system-wide show/hide.
Other versions27 projects use a version of this.
Word for word · 0
None found.
Edited · 3
- davidondrej/skills★ 4.2k12% same
- matyasstoch/david-skills★ 5998% same
- matyasstoch/cmux-skill★ 1098% same
Wrote their own version · 24
- manaflow-ai/cmux★ 29ksame name
- basicmachines-co/basic-memory★ 4.4ksame name
- manaflow-ai/manaflow★ 1.1ksame name
- glebis/claude-skills★ 404same name
- will-ness-ai/skills★ 170same name
- nikships/skills-registry★ 25same name
- bks-lab/open-bridge★ 13same name
- ph3on1x/claude-cmux-skill★ 9same name
- boundsj/agent-skills★ 2same name
- jonmumm/skills★ 2same name
14 more not listed
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
Used alongsideProjects with it also use cmux-browser, cmux-markdown and 2 more.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
manaflow-aiSkillcmux-browser
Automate the browser inside cmux. Use for cmux browser, browser surface, webview, current workspace browser, snapshot refs, DOM actions, waits, screenshots, cookies, storage, tabs, downloads, console, errors, and browser session state.
Also in 4 projects that use this
basicmachines-coSkillcmux-markdown
Open markdown files in a formatted viewer panel with live reload. Use when you need to display plans, documentation, or notes alongside the terminal with rich rendering (headings, code blocks, tables, lists).
Also in 3 projects that use this
basicmachines-coSkillcmux-settings
View and edit cmux settings in ~/.config/cmux/cmux.json. Use when the user wants to change cmux preferences (appearance, sidebar, notifications, automation, browser, shortcuts), set a value by JSON path, validate the file, open it in an editor, or look up which keys cmux recognizes. Triggers on '/cmux-settings', 'change cmux setting', 'set <something> in cmux', 'cmux config', 'cmux.json', or 'rebind a cmux shortcut'.
Also in 3 projects that use this
manaflow-aiSkillcmux-workspace
Work inside the current cmux workspace and terminal. Use for cmux workspace, current workspace, caller surface, panes, surfaces, tagged reloads, socket targeting, and non-interfering cmux automation.
Also in 3 projects that use this
In this repository26 other files it gives its agents.
- agent-self-schedulingSkill
- codex-subagentSkill
- fable-safe-promptSkill
- goal-loopSkill
- handoffSkill
- markdown-renderingSkill
- run-deep-sweSkill
- anti-sleepSkill
- pi-custom-modelSkill
- setup-helpSkill
- browser-harnessSkill
- deepapiSkill
- deep-researchSkill
- pi-web-searchSkill
- research-promptSkill
- youtube-transcriptSkill
- distribute-skill-to-all-agentsSkill
- effective-agent-skillsSkill
- folder-specific-claude-and-agents-mdSkill
- push-skill-to-githubSkill
- brain-to-docsSkill
- grill-meSkill
- interview-style-doc-buildingSkill
- read-all-adrsSkill
- shortSkill
- teachSkill
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

