cmux-workspace
Skill35 starsChanged 5 months agoMITView on GitHub
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.
We split this skill into the rules it gives an agent
30 rules. 4 are common, 11 are distinctive, and 15 are very specific to this project.
4
Common
Most of the 3 edited versions we read keep these.
11
Distinctive
This author's own choices. Worth a look.
15
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 14
Do not assume the visually focused cmux workspace is the right target.
- Very specific: line 24
Use CMUX_WORKSPACE_ID as the default workspace anchor and CMUX_SURFACE_ID as the default caller terminal/surface anchor.
- Distinctive: line 30
Never call these without an explicit user ask:
- Very specific: line 46
Avoid create-then-move-then-focus chains.
- Distinctive: line 52
When opening auxiliary output for the current task (preview apps, TUIs, logs, one-off shells, browser checks), keep the workspace organized …
- Distinctive: line 64
If the caller workspace already has a non-caller helper pane, add a new surface to that pane instead of creating another pane:
- Distinctive: line 68
If there is no helper pane, create exactly one right-side pane:
- Distinctive: line 72
If there are multiple obvious stale helper panes from this same automation and the user asked to tidy or reuse, keep one right helper pane …
- Distinctive: line 77
After creating a helper terminal, verify that it is usable before claiming work is visible there:
- Distinctive: line 93
Use absolute durable paths or paths relative to the current repo checkout.
- Very specific: line 97
Prefer CMUX_WORKSPACE_ID and CMUX_SURFACE_ID.
- Very specific: line 98
If those are missing or rejected by cmux, inspect cmux identify --json and state that you are falling back to the current focused cmux …
- Very specific: line 100
If no helper pane exists, create one on the right with --focus false, then re-list panes to get the pane ref.
- Very specific: line 128
If cmux open fails because the caller env points at a stale workspace, retry once with the refs from cmux identify --json.
- Very specific: line 149
Use --id-format both when logs or handoffs need stable UUIDs plus human refs:
- Distinctive: line 157
Prefer explicit workspace flags even when env vars are set.
- Common: line 191
Do not send keystrokes, close surfaces, or change focus in other workspaces unless the user asked for that target.
- Very specific: line 217
Do not call focus-pane or focus-panel to recover from a failed move.
- Very specific: line 240
If reload output includes Dev web origin, start the matching dev server from the same worktree before handoff and prove it responds:
- Very specific: line 248
Run that server in the right-side helper terminal and verify the terminal exists with read-screen or top.
- Very specific: line 250
Never build or launch untagged cmux DEV.
- Distinctive: line 256
When a task touches shared iOS/runtime code, also run the iOS reload flow from the worktree:
- Distinctive: line 264
Use the socket path provided by cmux before falling back to defaults:
- Very specific: line 285
Use CMUX_WORKSPACE_ID, CMUX_SURFACE_ID, and CMUX_SOCKET_PATH before focused-window fallbacks.
- Very specific: line 286
Prefer explicit --workspace and --surface flags for mutating actions.
- Very specific: line 287
Never call focus-pane, focus-panel, select-workspace, or focus-changing tab-action verbs unless the user explicitly asked.
- Common: line 292
If a CLI command rejects a valid surface or pane ref, report it to the user.
- Common: line 293
Do not close, focus, move, or send input to another workspace unless the user names that target.
- Common: line 294
Use short refs for chat and command examples.
- Very specific: line 296
If a tagged reload prints Dev web origin, the handoff is incomplete until the same-worktree dev server is running and curl -fsS <Dev web …
“Common” is measured: kept by at least 6 in 10 of the 3 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 Workspace
Use this skill when a task should be scoped to the cmux workspace that invoked the agent. A workspace is the sidebar tab-like unit in cmux. It contains split panes, and each pane contains one or more surfaces. A surface is the terminal or browser session the user interacts with.
Default Rule
Scope actions to the current caller workspace unless the user explicitly asks for another workspace, another window, or global state.
Do not assume the visually focused cmux workspace is the right target. An agent can be running in one workspace while the user is looking at another. Prefer the caller environment first:
printf 'workspace=%s\nsurface=%s\nsocket=%s\n' \
"${CMUX_WORKSPACE_ID:-}" \
"${CMUX_SURFACE_ID:-}" \
"${CMUX_SOCKET_PATH:-}"
cmux identify --jsonUse CMUX_WORKSPACE_ID as the default workspace anchor and CMUX_SURFACE_ID as the default caller terminal/surface anchor. If those are missing, use cmux identify --json and be explicit that you are using the currently focused cmux context.
Non-Disruptive Automation
The user may be visually focused on a different workspace, window, or app while an agent works in the caller workspace. Treat layout and focus as separate concerns. Never call focus-changing verbs speculatively.
Never call these without an explicit user ask:
select-workspaceswitches the visible sidebar tab.focus-pane/focus-panelyanks pane or surface focus.tab-actionwith focus-changing actions.
These are user-affecting actions, like clicks. The rule applies even inside the caller's own workspace, since the user may be looking elsewhere.
Build layout additively, in one shot. Prefer commands that create a new pane already populated with the right surface:
# pane and content in one call, no follow-up needed
cmux new-pane --workspace "${CMUX_WORKSPACE_ID}" --type browser --direction right --url "http://127.0.0.1:8765"
cmux new-pane --workspace "${CMUX_WORKSPACE_ID}" --type terminal --direction downAvoid create-then-move-then-focus chains. If a layout command rejects a valid surface: or pane: ref, do not work around it by focusing. Report the bug to the user and stop.
Pass --focus false whenever the verb supports it. move-surface --focus false preserves the user's current attention. Other commands may grow the same flag over time (https://github.com/manaflow-ai/cmux/issues/1418, https://github.com/manaflow-ai/cmux/issues/2820).
Right-Side Helper Pane
When opening auxiliary output for the current task (preview apps, TUIs, logs, one-off shells, browser checks), keep the workspace organized by reusing a helper pane to the right of the caller terminal.
First inspect the caller context and panes:
cmux identify --json
cmux list-panes --workspace "${CMUX_WORKSPACE_ID:-}" --json
cmux list-pane-surfaces --workspace "${CMUX_WORKSPACE_ID:-}" --jsonUse this policy:
- If the caller workspace already has a non-caller helper pane, add a new surface to that pane instead of creating another pane:
cmux new-surface --workspace "${CMUX_WORKSPACE_ID:-}" --pane pane:<helper> --type terminal --focus false - If there is no helper pane, create exactly one right-side pane:
cmux new-pane --workspace "${CMUX_WORKSPACE_ID:-}" --type terminal --direction right --focus false - If there are multiple obvious stale helper panes from this same automation and the user asked to tidy or reuse, keep one right helper pane and clean up the duplicates. Do not close panes you cannot confidently identify as stale helper output.
- Send commands to the new or reused helper surface by explicit surface ref. Do not focus it unless the user asks.
This means repeated "open it" requests should normally create tabs inside the existing right helper pane, not more splits.
After creating a helper terminal, verify that it is usable before claiming work is visible there:
cmux surface-health --workspace "${CMUX_WORKSPACE_ID:-}"
cmux read-screen --workspace "${CMUX_WORKSPACE_ID:-}" --surface surface:<helper> --lines 20
cmux top --workspace "${CMUX_WORKSPACE_ID:-}" --processes --format tsvIf read-screen reports Terminal surface not found, or surface-health shows the helper terminal is not attached and top shows no process for it, treat that as a cmux CLI/runtime bug. Do not claim the command is running in the workspace. Clean up any empty helper surfaces you created, then report the bug or use an already-materialized cmux terminal surface. Do not use hidden tmux, nohup, or detached background fallbacks for visible dogfood handoff unless the user explicitly asks for that workaround.
Artifact Previews
When a task produces videos, images, checked frames, screenshots, PDFs, or other user-facing artifacts, open the final artifacts in cmux before handoff. Put them in the caller workspace's right-side helper pane as file preview tabs, and use --no-focus so the user's current terminal stays selected.
Final user-facing artifacts should persist under /cmux-assets/<branch>/.... If /cmux-assets cannot be created because the root volume is read-only, use cmux-assets/<branch>/... under the current repo checkout and state that fallback. Use /tmp only for scratch, then copy accepted artifacts into the durable tree before opening or reporting them.
Use absolute durable paths or paths relative to the current repo checkout. If the artifact lives in a worktree, copy it into the durable branch-scoped asset tree before final handoff; do not report paths that only work from inside the worktree.
Resolve the workspace and pane in this order:
- Prefer
CMUX_WORKSPACE_IDandCMUX_SURFACE_ID. - If those are missing or rejected by
cmux, inspectcmux identify --jsonand state that you are falling back to the current focused cmux context. - Reuse an existing non-caller helper pane when obvious.
- If no helper pane exists, create one on the right with
--focus false, then re-list panes to get the pane ref.
Template:
ARTIFACTS=(
"/cmux-assets/<branch>/demos/demo.mov"
"/cmux-assets/<branch>/demos/frame-tail.png"
)
WORKSPACE="${CMUX_WORKSPACE_ID:-}"
SURFACE="${CMUX_SURFACE_ID:-}"
cmux identify --json
cmux list-panes --workspace "$WORKSPACE" --json
cmux list-pane-surfaces --workspace "$WORKSPACE" --json
# Pick an existing non-caller helper pane from the pane list. If none exists:
cmux new-pane --workspace "$WORKSPACE" --type terminal --direction right --focus false
cmux list-panes --workspace "$WORKSPACE" --json
cmux open "${ARTIFACTS[@]}" \
--workspace "$WORKSPACE" \
--pane pane:<right-helper> \
--no-focus
cmux list-pane-surfaces --workspace "$WORKSPACE" --jsonIf cmux open fails because the caller env points at a stale workspace, retry once with the refs from cmux identify --json. Do not keep guessing across other workspaces. If opening still fails, report the failure and include the exact artifact paths.
Hierarchy
- Window: a macOS cmux window.
- Workspace: a sidebar entry. The UI may call it a tab, but CLI/socket APIs call it a workspace.
- Pane: a split region inside a workspace.
- Surface: a tab inside a pane. Surfaces can be terminals or browser panels.
- Panel: internal content type inside a surface. Prefer CLI surface commands instead of panel internals.
Inspect Current Context
cmux identify --json
cmux current-workspace --json
cmux list-workspaces --json
cmux list-panes --workspace "${CMUX_WORKSPACE_ID:-}" --json
cmux list-pane-surfaces --workspace "${CMUX_WORKSPACE_ID:-}" --json
cmux list-panels --workspace "${CMUX_WORKSPACE_ID:-}" --jsonUse --id-format both when logs or handoffs need stable UUIDs plus human refs:
cmux --json --id-format both identifyWorkspace-Scoped Actions
Prefer explicit workspace flags even when env vars are set. It makes automation auditable and avoids affecting a focused workspace in another window.
# create a new workspace when the user asks for a new task area
cmux new-workspace --name "debug auth" --cwd "$PWD"
# rename / close (only when explicitly requested)
cmux rename-workspace --workspace "${CMUX_WORKSPACE_ID:-}" -- "build fix"
cmux close-workspace --workspace workspace:4
cmux close-surface --workspace "${CMUX_WORKSPACE_ID:-}" --surface surface:3
# additive layout (safe, no focus side effects beyond the command's own defaults)
cmux new-pane --workspace "${CMUX_WORKSPACE_ID:-}" --type terminal --direction right
cmux new-surface --workspace "${CMUX_WORKSPACE_ID:-}" --type terminal
# focus-changing (USER-AFFECTING, only on explicit ask, see Non-Disruptive Automation above)
cmux select-workspace --workspace workspace:2
cmux focus-pane --workspace "${CMUX_WORKSPACE_ID:-}" --pane pane:2
cmux focus-panel --workspace "${CMUX_WORKSPACE_ID:-}" --panel surface:3Caller Terminal
The current terminal is the surface that invoked the agent. Treat it as the safest anchor for relative operations.
# send to the focused terminal in the caller workspace
cmux send "npm test\n"
# send to the exact caller surface
cmux send --surface "${CMUX_SURFACE_ID:-}" "git status\n"
cmux send-key --surface "${CMUX_SURFACE_ID:-}" enterDo not send keystrokes, close surfaces, or change focus in other workspaces unless the user asked for that target.
Moving Surfaces
Reorder a surface within its pane:
cmux move-surface --surface "${CMUX_SURFACE_ID}" --before surface:3
cmux move-surface --surface "${CMUX_SURFACE_ID}" --after surface:3
cmux move-surface --surface "${CMUX_SURFACE_ID}" --index 0Move a surface to another existing pane. Pass --focus false to keep the user's current attention put:
cmux move-surface --surface surface:240 --pane pane:172 --focus falseSplit a surface off into a new pane:
cmux drag-surface-to-split --surface surface:240 downKnown papercut: drag-surface-to-split currently routes through V1 and resolves the workspace via UI focus, so it can fail with ERROR: Surface not found when the caller's workspace is not the visually focused one. Tracked at https://github.com/manaflow-ai/cmux/issues/1901, related to https://github.com/manaflow-ai/cmux/issues/3189. Until that lands, prefer building the layout additively (see Non-Disruptive Automation above) over create-then-split.
Do not call focus-pane or focus-panel to recover from a failed move. Report the failure and stop.
Sidebar State
Status, progress, and logs should usually be attached to the current workspace so the sidebar reflects this task.
cmux set-status build "running" --workspace "${CMUX_WORKSPACE_ID:-}" --color "#ff9500"
cmux set-progress 0.4 --label "Building" --workspace "${CMUX_WORKSPACE_ID:-}"
cmux log --workspace "${CMUX_WORKSPACE_ID:-}" --level info -- "Started build"
cmux sidebar-state --workspace "${CMUX_WORKSPACE_ID:-}" --json
cmux clear-status build --workspace "${CMUX_WORKSPACE_ID:-}"
cmux clear-progress --workspace "${CMUX_WORKSPACE_ID:-}"Rebuild and Reload
For cmux app/runtime changes, use tagged reloads from the active worktree. A tagged reload creates an isolated app name, bundle ID, debug socket, and DerivedData path.
./scripts/reload.sh --tag <short-tag>If reload output includes Dev web origin, start the matching dev server from the same worktree before handoff and prove it responds:
cd web
CMUX_PORT=<printed-port> CMUX_PORT_RANGE=<range> CMUX_PORT_END=<end> bun dev
curl -fsS "http://127.0.0.1:<printed-port>"Run that server in the right-side helper terminal and verify the terminal exists with read-screen or top. If the helper terminal cannot be instantiated, report the cmux CLI/runtime bug instead of using a hidden background fallback.
Never build or launch untagged cmux DEV. If tests or tools need a socket, use the tag-specific socket:
CMUX_SOCKET_PATH=/tmp/cmux-debug-<short-tag>.sock cmux identify --jsonWhen a task touches shared iOS/runtime code, also run the iOS reload flow from the worktree:
ios/scripts/reload.sh --tag <ios-tag>Socket and Access
Use the socket path provided by cmux before falling back to defaults:
SOCK="${CMUX_SOCKET_PATH:-/tmp/cmux.sock}"Socket access can be off, restricted to cmux-spawned processes, or allow all local processes. If a command cannot connect, inspect capabilities before changing settings:
cmux capabilities --json
cmux pingReferences
- references/commands.md enumerates workspace, pane, surface, notification, and utility commands.
- ../cmux-browser/SKILL.md covers browser surfaces with the same current-workspace rule.
Rules
- Work in the current caller workspace by default.
- Use
CMUX_WORKSPACE_ID,CMUX_SURFACE_ID, andCMUX_SOCKET_PATHbefore focused-window fallbacks. - Prefer explicit
--workspaceand--surfaceflags for mutating actions. - Never call
focus-pane,focus-panel,select-workspace, or focus-changingtab-actionverbs unless the user explicitly asked. The user may be visually on a different workspace, window, or app. - Pass
--focus falseonmove-surfaceand any creation verb that supports it. - For auxiliary output, reuse the right-side helper pane; create one only if it does not exist.
- Persist final videos, images, checked frames, and other user-facing artifacts under
/cmux-assets/<branch>/...or the explicit fallbackcmux-assets/<branch>/..., then open them in the right-side helper pane withcmux open ... --no-focusbefore handoff. - Build layout additively with
new-pane --type ... --url ...rather than create-then-move-then-focus chains. - If a CLI command rejects a valid surface or pane ref, report it to the user. Do not work around by focusing.
- Do not close, focus, move, or send input to another workspace unless the user names that target.
- Use short refs for chat and command examples. Use UUIDs only for logs, persistence, or debugging.
- For app/runtime changes, always reload with
./scripts/reload.sh --tag <tag>from the worktree before dogfood handoff. - If a tagged reload prints
Dev web origin, the handoff is incomplete until the same-worktree dev server is running andcurl -fsS <Dev web origin>passes.
Other versions3 projects use a version of this.
Word for word · 0
None found.
Edited · 3
- manaflow-ai/cmux★ 29k41% same
- basicmachines-co/basic-memory★ 4.4k51% same
- rajinsyed/supermux★ 242% same
Wrote their own version · 0
None found.
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.
In this repository10 other files it gives its agents.
- skills/cmux-artifact/AGENTS.mdAGENTS.md
- skills/cmux-cli/AGENTS.mdAGENTS.md
- cmux-artifactSkill
- cmux-browserSkill
- cmux-cliSkill
- cmux-cloudSkill
- cmux-configSkill
- cmux-freestyleSkill
- cmux-refSkill
- cmux-sidebar-builderSkill
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.

