cmux Cloud Machines
Everything cmux Cloud exposes from the CLI, for any coding agent (Claude Code, Codex, OpenCode, Pi, or another harness): the agent-only primitives (
,
,
,
,
,
,
,
) plus every verb the Cloud sidebar has. Host-side operations require the cmux app and a signed-in account (
,
); a guest-safe auth/CodeRouter subset is available inside a machine. Bring up WireGuard (
) before private VM attach, exec, desktop, or port operations; a published domain is reached through its HTTPS edge and does not require the viewer's tunnel.
is the overview and
prints a verb's own options, both offline;
references/commands.md is the complete reference and CI keeps it in lockstep with the CLI (
tests/test_cloud_vm_skill_coverage.py
). An agent with no skill loaded can bootstrap itself with
, which installs the app-bundled copy of this skill at
~/.config/cmux/skills/cmux-cloud.md
and prints a kickoff prompt.
The mission is delegation. A local agent (you, on the user's Mac) sends work to machines that outlive the laptop: every terminal and agent session lives in the machine's own cmux-tui daemon, so work keeps running with every pane closed and the lid shut, and any signed-in Mac reattaches later through the same addresses. Compose machine workspaces headlessly (as many as the task needs), watch them with
and
without opening anything, and surface panes or a
only when the user should look.
The shortest reliable loop is: authenticate → inspect limits and routing → run or stage work headlessly → observe with
/
→ open a pane or share a URL only when there is something useful to show. Ask for confirmation before creating, forking, resetting, or destroying a machine, because those operations consume plan capacity or delete data.
Treat the installed CLI as the contract. Read
and the
specific
before using a newly added flag, and check the
section of the reference only for planning. A tagged app, an older
machine image, and the app's bundled CLI can be on different rollout versions;
if help and this document disagree, follow help and report the discrepancy.
What a machine is
| Term | Meaning |
|---|
| Machine | A persistent cloud VM (); its generated name (for example ) is its id everywhere, while changes only a display label. New machines run terminals, agents, exec, and the desktop as (uid 1000, home , passwordless sudo). Older machines keep their root layout until recreated; resolve paths from the remote . A machine may sleep when idle and wakes on connect or exec. |
| Kind | Every new machine uses the devbox with TigerVNC on , openbox, the dock, and noVNC on 6901. , , and remain accepted for older scripts; they no longer select different new-machine kinds. Historical machines can still lack a screen. Shells receive the desktop environment, including , so , , and can drive the screen. |
| Contents | The Ubuntu 24.04 devbox supplies node, bun, uv, git, gh, ripgrep, fd, jq, tmux, xdotool, Chrome, and ; Claude Code, Codex, OpenCode, and Pi are installed on the session PATH. If a fresh machine is still bootstrapping, inspect . |
| Session | Every machine runs a cmux-tui remote daemon with workspaces () and terminals (). A terminal keeps running when the Mac disconnects or its pane closes. |
| Publication | cmux cloud domains publish
maps one VM port to one HTTPS hostname. allows the owner, allows current members of a selected team, and allows anyone with the URL. |
| Workspaces | One machine hosts many cmux-tui workspaces: the machine is the big box, workspaces are the desks in it. Make a workspace per task inside a machine (cmux vm workspace new <id> --name <task>
, the machine's ⌘N) — not a machine per task. The Cloud sidebar shows them grouped under the machine's Workspaces group. |
| Surface | A terminal, VNC screen, or browser — on This Mac or on a machine — with a stable id (). Panes project surfaces: reuses the pane already showing one or lands it at a pane edge; closing a pane never kills a machine's terminal. |
| Base | The one pinned persistent machine per user (; mints a new generation and keeps the old VM) — the user's ongoing work. |
| Pool | Machines the router provisioned for agent work (labeled in , membership persisted in ~/.cmuxterm/vm-run-pool.json
). / only draft these; any other machine needs . |
| Plan meter | prints the meter; the cap is whatever the backend sends ( → ; absent = uncapped, printed as ). The same object advertises ; plan tiers change, so read those fields instead of relying on remembered caps or sizes. Where the deployment gates provisioning to paid plans, , the first , , , , and the router's own provisioning answer with the pricing link on free or unknown plans; a free plan that can provision gets its advertised machine inside a 7-day access window (limits.freeAccessExpiresAt
— after it, access verbs need a paid plan while list/status/delete keep working). Never delete machines to make room without asking. |
| Checkpoint / fork | mints a restorable checkpoint, clones a machine for a parallel experiment, brings a snapshot back — where the provider supports it ( → ). |
Decide: cloud or local?
| Run in the cloud when… | Stay local when… |
|---|
| Builds/tests take minutes, need Linux, or would hog the user's Mac | The task is a quick edit or read |
| The task needs Linux isolation or a machine the user can watch through panes and port URLs | The user is editing the same files right now |
| You want isolation (a fork per experiment, a throwaway machine) | The repo has uncommitted local-only state you cannot sync |
| You want to fan out: several agents on several machines in parallel | |
| The user said "cloud", "machine", "VM", or shows a warm machine for this directory | |
Fast start — let the router pick
bash
cmux vm route # which machine this directory would get, and why (--json for scripts)
cmux vm run -- uname -a # routed, executed, exit code passed through
cmux vm run --sync -- bun test # push cwd to work/<dir> first, run there
cmux vm run --sync --pull work/app/dist -- bun run build
cmux vm agent --agent claude --sync -- "run the tests and fix failures" # a detached Claude Code session on the routed machine
cmux vm tree # the surface catalog: This Mac, then every machine → workspaces → ports → VNC displays → terminals
cmux vm open vivid-newt/main/term_2f9c # show the human one terminal (reuses its pane if open)
cmux surface open vivid-newt/terminal/term_2f9c --pane pane:2 --left # any surface, at a pane edge (same drop rules as the sidebar)
cmux cloud domains publish vivid-newt 3000 # public HTTPS hostname, personal access by default
cmux pane resize vivid-newt --disk 40G # grow persistent disk (4 GiB steps; never shrinks)
Repeat runs from the same directory hit the same machine (sticky binding, 14 days), so synced checkouts and dependencies stay warm.
forces a fresh pool machine;
pins one. For a machine the router creates,
accepts
,
,
,
,
,
, or raw MB; read
→
first because the server advertises the current plan's allowed choices and resolves unsupported requests to its default.
Picking a machine
- — the router's answer for this directory. If it says it would provision, that costs a machine slot: check first ( creates it now).
- Ongoing user work → Base (, or ).
- A new task on a machine you already use → a new workspace, not a new machine (
cmux vm workspace new <id> --name <task>
): one machine hosts many workspaces, and that is the intended unit of scale.
- Hard isolation (a different environment, a risky experiment) → of a warm machine, or
cmux vm new --detach --json
for a new devbox; add . Choose from → (named aliases: , , , , , ; raw MB also parses). Never pass unless you have a specific image id. Then , and before the first command.
- Persistent disk growth →
cmux pane resize <id> --disk <GiB>
after confirming the target and requested capacity. Values are 4–256 GiB in 4 GiB steps; the operation is grow-only, keeps the machine data and identity intact, and can take a provider minute. Run afterward to verify .
- Never draft the user's own machines without , and respect the plan meter.
Publish a VM port safely
Use the domains namespace when a user needs a stable HTTPS URL. It is separate from
: the latter is a private, tunnel-only preview, while a publication creates a public edge with an explicit viewer policy.
bash
# Generated cmux hostname; no customer DNS setup is needed.
cmux cloud domains publish <machine> <port> --json
# See the URL, policy, lifecycle state, and any verification instructions.
cmux cloud domains list
# Custom zone: print the complete DNS checklist, add the records, then retry.
cmux cloud domains verify example.com
cmux cloud domains publish <machine> <port> --domain app.example.com --access team --team <team-id>
cmux cloud domains zones
# Change or remove an existing publication (hostname or id is accepted).
cmux cloud domains access app.example.com public
cmux cloud domains rm app.example.com
The custom-domain flow is intentionally two-phase. The first
call creates a pending ownership challenge and prints labelled records: an ownership TXT record, apex and wildcard routing records, and
NS delegation. Add those records at the DNS provider, run
again, and wait for the certificate/routing state to become active. A verified zone can serve the apex or one-label children (
or
); deeper names need a covering zone. Generated cmux names are already reserved and certificate-covered, so they skip verification.
Choose the narrowest access mode:
(the default) for the owner,
with a required
for current members of that team, or
for anyone holding the URL.
changes the policy immediately; it does not create viewer grants. Treat a
URL as a credential and do not put it in logs or prompts. Use
when another tool will consume the result; it returns stable publication/domain objects rather than the human DNS table.
Running work
| Need | Verb |
|---|
| One non-interactive command, ~30 s | cmux vm exec <id> -- <cmd...>
( → {stdout, stderr, exit_code}
; wrap shell constructs in ) |
| A command with no machine id, minutes long, exit code through | cmux vm run [--sync] [--pull <path>] [--timeout <s>] -- <cmd...>
|
| A coding agent, detached, reattachable from anywhere | cmux vm agent --agent <claude|codex|opencode|pi> [--sync] [--no-open] -- "<prompt>"
(flag/subcommand-led args pass through) |
| An interactive program (REPL, TUI, long test run) driven headlessly | cmux surface new-terminal --machine <id> --no-open -- <cmd>
, then cmux vm terminal send <id> <term> 'input' --keys enter
→ cmux vm terminal wait <id> <term> --pattern 'pass|fail' --timeout 300
→ cmux vm terminal read <id> <term>
|
| Files in and out | cmux vm push <id> ./repo work/repo
/ cmux vm pull <id> work/repo/out.tgz
(SHA-256 verified, 256 MB cap, / skipped by default) |
| A machine that is asleep or still booting | |
Opening a machine (
,
,
, the sidebar) gives a
plain terminal on it — one terminal in the machine's cmux-tui session attached in a pane like an ssh session; it keeps running if the pane closes and shows up in
(reattach with the
cmux vm open <m>/<ws>/<term>
address the
line prints). Use
or
for the machine's individual surfaces. Long shell work under
must be backgrounded (see recipes) — never hold a long
open.
Watching and reporting back
bash
cmux vm tree <id> # live: terminals with title, cwd, agent state, (open: surface)
cmux vm terminal read <id> <term> # the screen of any machine terminal, without a pane
cmux vm open <id> # the machine's shell
cmux vm open <id>/<ws>/<term> # one terminal as a pane; reuses the pane already showing it
cmux vm workspace open <id> <ws> [--here|--tabs|--pane <p> --left] # a whole workspace: new local workspace, or into this one
cmux vm open <id>:desktop # the noVNC screen (new machines; historical shell-only machines have no screen)
cmux vm open <id>:port/3000 [--print] # URL for an HTTP port on the machine's private address (--print: URL only; needs `cmux vpn up`)
cmux vm workspace rename <id> <ws> <name> # rename it; `close` keeps its terminals (they detach into the pool), `rm` deletes it AND kills them
cmux vm tab rename <id> <tab> <name> # rename one exact tab placement; "" clears its custom label
cmux vm terminal rename <id> <term> <name> # rename every tab placement; "" clears every custom label
cmux surface ls --json # every surface (local + cloud) with ids, lifecycle, and which panes show it
cmux surface open <resource> [--new] [--pane <p> --left|--right|--up|--down|--tab] # one open path for all of them
cmux notify --title "Cloud build done" --body "…"
The user cannot see inside the machine: print URLs, pull artifacts, or open a pane when there is something to look at, and
for long work. Only share URLs minted by
; never guess raw provider URLs. A pane showing a machine surface is an ordinary local pane: move, split, reorder, or close it with the local topology verbs (
); the surface catalog follows the pane.
Workspaces and terminals on a machine
A pane showing a machine surface is an ordinary local pane: move, split, reorder, or close it with the local topology verbs (
) and the surface catalog follows the pane; closing a pane never kills the machine's terminal. A local workspace that
mirrors a machine workspace (opened with
, or bound with
) is that workspace seen from the Mac, so its structure is the machine's: a pane moved into it takes its tab there (a pool terminal gets one), a terminal pane closed in it closes that tab (the terminal detaches into the Terminals pool, still running), and a tab or workspace renamed there is renamed on the machine. Closing the local workspace itself (⌘⇧W) only ends the view: the machine workspace and its terminals stay exactly as they were. Panes in any other local workspace are viewers and never touch the machine's layout. Rearranging the machine's topology in full is what
is for.
cmux vm workspace new|open|rename|close|rm
and
cmux vm terminal close|send|read|wait
are the machine's cmux-tui session verbs; ids come from
.
is the sidebar's "Close Workspace…" (kills the workspace's terminals);
is CLI-only and keeps them running in the Terminals pool. Every sidebar action has a CLI verb over the same socket method —
references/sidebar-parity.md.
Credentials
Agents started with
authenticate inside the machine the way they would locally: their own login under the remote
(set up once with
; it persists with the machine), or the team's subrouter through
(uploads local credentials so no token is copied onto a machine). Do not put the user's tokens on a machine unless they ask.
Guest auth and CodeRouter
Start with
to identify the current machine and
to list the team's live machines. The guest reads those through its VM-bound
TLS edge without a Mac account token. Host lifecycle verbs still run on the Mac;
read the guest's
for the subset its image supports.
Inside a Cloud machine, the guest
adapter can report route health and run
an agent through the shared CodeRouter without exposing the Mac's Stack session:
bash
cmux auth status --json
cmux coderouter status --json
cmux coderouter usage
cmux coderouter models
cmux coderouter agent claude "summarize the current checkout"
cmux agent codex "run the tests"
These commands describe the machine's daemon, TLS edge, and VM-bound route.
Host account login and upstream credential management remain on the Mac; do not
copy those tokens into a VM.
still starts a detached terminal on the
selected machine, while the guest
form runs through CodeRouter.
Agent policy
- Prefer / / over naming machines. They only draft pool machines; is the deliberate way to use another.
- Reuse before create. , then an idle machine or Base. Creating machines needs a paid plan and counts against its cap.
- Stay headless while working (, , , ); open panes (, 's addresses) to show results, and only when the user should be looking.
- Checkpoint before risky operations (); fork instead of experimenting on a machine the user relies on.
- Only destroy what you created this session. and are permanent; keeps the old VM but the user must ask for it.
- Read plan limits and sizes from and , not from memory.
Common issues and fixes
| Symptom | Fix |
|---|
| hangs or times out | Exec is capped (~30 s). Background it: nohup … > /tmp/x.log 2>&1 &
, then poll — or use , , or a session terminal driven with `terminal send |
| / not found on a brand-new machine | Provisioning is still running: cmux vm exec <id> -- tail /tmp/cmux/provision.log
; the agents land in the session PATH (use a login shell). |
| First command after idle is slow | The machine was asleep: . |
| Attach/exec cannot reach any machine | The WireGuard tunnel is down: (state: ; needs brew install wireguard-tools
). Machines have no public ports. |
| times out while a link is connecting | Retry without or scope it to ; inspect /, then use or directly when you already know the target. |
| says it would provision | The pool is empty/busy. Check the plan meter; (or ) creates one. |
| Create fails with or an active-limit error | Provisioning needs a paid plan (), or the plan's machine cap is reached. Report it; let the user upgrade or choose a machine to remove. |
| says no such workspace | Names are the cmux-tui workspace names; copy the id from ( right after a link attach). |
| exits 1 | Timeout (default 30 s; raise ) — the error carries the screen tail; shows the whole screen. |
| Pushed a repo but is missing | skips , , , , by default; , or ship a (recipes). |
| Push/pull refuses a large payload | 256 MB cap. Clone/download inside the machine instead. |
| Command works in but not | Exec has no TTY/stdin; use non-interactive flags, or + `terminal send |
| / refused | Provider capability ( → ); providers without it hide the sidebar verbs too. |
| errors | The default provider attaches through the cmux-tui daemon and mints no SSH endpoint; use , , or . |
| still says pending | DNS is eventually consistent. Compare the printed record name/type/value exactly, wait for propagation, and rerun cmux cloud domains verify <domain>
; do not create a second zone for the same name. |
| A publication is not active | cmux cloud domains list --json
shows and ; custom domains must be verified and certificate-ready before routing activates. Generated domains do not need DNS proof. |
| A viewer is denied | Check the publication's : requires the owner, requires current membership in the selected team, and is the only unauthenticated mode. Change it deliberately with cmux cloud domains access
. |
Deep-dive references
| Reference | When to use |
|---|
| references/commands.md | Every verb, alias, flag, shape, exit code, socket method, and the sidebar action it mirrors — plus the "In flight" list of verbs that exist only in open PRs |
| references/sidebar-parity.md | Every Cloud-sidebar action and the CLI verb that does the same thing (1:1) |
| references/agent-workflows.md | Recipes: cloud dev box, routed agents, headless terminal loops, parallel forks, desktop/browser tasks, showing the human |
| ../cmux/SKILL.md | Windows/workspaces/panes when presenting machine panes |
| ../cmux-workspace/SKILL.md | Non-disruptive automation rules (focus, caller workspace) |
name: cmux-cloud-vm
description: "Route work to cmux Cloud machines (persistent cloud VMs) from the CLI — // pick a machine for you; / show the surface catalog (This Mac and every machine: terminals, VNC screens, browsers) and / put any of them in a pane; plus create, exec, push/pull, ports, checkpoints, forks. Use when an agent should run builds, tests, servers, desktop/browser tasks, or another agent on a cloud machine instead of the local Mac, or when the user says "cloud machine", "cloud VM", "run it in the cloud", or "cmux vm"."
cmux Cloud Machines
Everything the Cloud sidebar can do, from the CLI — plus agent-only primitives (
,
,
,
,
,
,
). Host-side operations require the cmux app and a signed-in account (
,
); the guest-safe subset documented below runs inside a VM without a Stack session. All of it is plain CLI, so it works for Claude Code, Codex, OpenCode, Pi, or any harness — and
bootstraps an agent that has no skill loaded: it installs the app-bundled cmux-cloud skill at
~/.config/cmux/skills/cmux-cloud.md
and prints a kickoff prompt pointing at it (
starts a local agent terminal with that prompt directly).
What a machine is
| Term | Meaning |
|---|
| Machine | A persistent cloud VM (). cmux-created machines have no provider idle timeout, so they stay available until the user pauses/stops or destroys them; an already-sleeping machine wakes on connect or exec. is a 16 GB persistent volume; the rest of the filesystem is disposable compute. |
| Contents | Ubuntu 24.04 (shared devbox image): node, bun, uv, git, gh, ripgrep, fd, jq, tmux, xdotool, Chrome, . Claude Code, Codex, OpenCode, and Pi are preinstalled. Desktop-kind machines (the default; makes a shell-only machine with no screen) boot a desktop: TigerVNC on with an openbox session, a dock (Chrome, Files, Ghostty) and noVNC on 6901 — the Desktop row in the sidebar / shows it. Shells on the machine get (and the accessibility bus) while the desktop is up, so , and act on that screen. |
| Session | Every machine runs the cmux-tui remote daemon: its own workspaces → terminals, visible in . A terminal you start there keeps running when the Mac disconnects. |
| Workspaces | One machine hosts many cmux-tui workspaces: the machine is the big box, workspaces are the desks in it. Make a workspace per task inside a machine (cmux vm workspace new <id> --name <task>
, the machine's ⌘N) — not a machine per task. The Cloud sidebar shows them grouped under the machine's Workspaces group. A workspace is a layout: its screen's splits, ratios and tabs. cmux vm layout export/apply
reads and writes that shape as JSON (the same document cmux new-workspace --layout
and use locally), and clicking the workspace row opens it on the Mac with the same geometry. |
| Surface | A terminal, VNC screen or browser — on This Mac or on a machine — with a stable id (). Panes project surfaces: reuses the pane already showing one, or lands it at a pane edge you choose; closing a pane never kills a machine's terminal. |
| Base | The one pinned persistent machine () — use it for the user's ongoing work. |
| Pool | Machines the router provisioned for agent work ( in ). / only draft these; hand-made machines need . |
| Plan meter | prints . Free plans get 1 machine and a 7-day cloud window; carries limits.freeAccessExpiresAt
. At the cap, creates fail with an upgrade action — never delete machines to make room without asking. |
| Checkpoint / fork | mints a restorable checkpoint; clones a machine for a parallel experiment. |
Decide: cloud or local?
| Run in the cloud when… | Stay local when… |
|---|
| Builds/tests take minutes, need Linux, or would hog the user's Mac | The task is a quick edit or read |
| The task needs a desktop, browser automation, or a screen the user can watch () | The user is editing the same files right now |
| You want isolation (fork per experiment, throwaway machine) | The repo has uncommitted local-only state you cannot sync |
| You want to fan out: several agents on several machines in parallel | |
| The user said "cloud", "machine", "VM", or the sticky machine for this directory already has a warm checkout () | |
Fast start — let the router pick
bash
cmux vm route # which machine would be used for this directory, and why
cmux vm run -- uname -a # routed, executed, exit code passed through
cmux vm run --sync -- bun test # push cwd to work/<dir> first, run there
cmux vm agent --agent claude --sync -- "run the tests and fix failures" # a detached Claude Code session on the routed machine
cmux vm tree # the surface catalog: This Mac, then every machine, workspace, terminal, desktop, port
cmux vm open vivid-newt/main/term_2f9c # show the human one terminal (reuses its pane if open)
cmux surface open vivid-newt/display/display:1 --pane pane:2 --left # any surface, at a pane edge (same drop rules as the sidebar)
cmux vm env set vivid-newt DATABASE_URL=postgres://… --from-file .env # project secrets, on the machine's persistent volume, in every shell/agent it starts
cmux vm layout apply vivid-newt dev-layout.json --name app --open # build the workspace shape (panes, ratios, tabs, commands) and show it
Repeat runs from the same directory hit the same machine (sticky binding), so synced checkouts and dependencies stay warm.
forces a fresh machine;
pins one.
Picking a machine
- — the router's answer for this directory; for scripts. If it says it would provision, that costs a machine slot: check first.
- Ongoing user work → Base (, or ).
- Isolation →
cmux vm new --detach --json
(desktop machine) or (shell-only); add / as needed. The CLI requests a machine kind; never pass unless you have a specific image id. Then .
- Never draft the user's own named machines without , and respect the plan meter.
Running work
Opening a machine (
,
,
, the sidebar) gives a
plain terminal on it — one terminal in the machine's cmux-tui session, attached in a pane like an ssh session; it keeps running if the pane closes and shows up in
(reattach with the
cmux vm open <m>/<ws>/<term>
address the
line prints).
is the only command that opens the full cmux-tui client.
bash
cmux vm run --sync --pull work/app/dist -- sh -c 'cd work/app && bun run build'
cmux vm agent --agent codex --machine <id> -- exec "summarize work/app" # args pass through when they start with a flag/subcommand
cmux vm agent --agent opencode --no-open --json -- "add a README" # headless; prints terminal + reattach address
cmux vm exec <id> -- <command...> # one command, non-interactive, ~30 s default cap
cmux vm push <id> ./repo work/repo && cmux vm pull <id> work/repo/out.tgz
cmux vm wait <id> --wake # block until ready and awake
cmux vm terminal send <id> <term> 'bun test' --keys enter # drive a machine terminal headlessly: type, then press keys (no pane, no focus)
cmux vm terminal wait <id> <term> --pattern 'pass|fail' --timeout 300 # block until the screen matches; exit 1 on timeout
cmux vm terminal read <id> <term> # the visible screen — what a person at that terminal sees
cmux vm terminal wait-exit <id> <term> --timeout 900 # block until the process exits (exit code passes through as exited/pending)
cmux vm terminal output <id> <term> # the full output so far (scrollback), with a resume cursor for the next read
cmux vm exec <id> --timeout 600 -- <command> # one command up to 15 minutes; default cap is 30 s
cmux vm pause <id> / cmux vm resume <id> # park a machine when the work is done (stops its compute); resume brings it back
cmux vm agent --agent claude --machine <id> --wait --output --timeout 1800 -- "…" # until-done: block, then print everything the agent wrote; exit code passes through
cmux vm dev <id> [<folder>] [--name <ws>] [--layout <file>] [--command "<cmd>"] [--port <n>] [--remote <path>] [--sync|--no-sync] [--no-open] [--dry-run] [--json] # route + optional sync + detected command + named workspace/layout
is the interactive counterpart of
: a REPL, a TUI, a long test run, or another agent's session on the machine can be driven and observed without attaching a pane or stealing focus. Start the program with
cmux surface new-terminal --machine <id> --no-open -- <cmd>
(its
id comes back on the OK line), then loop send → wait → read.
One-command dev setup
Use
when the input is a local project folder and the desired result is a running, inspectable dev layout:
bash
cmux vm dev <machine> [<folder>] [--name <workspace>] [--layout <file>] [--command "<cmd>"] [--port <n>] [--remote <path>] [--sync|--no-sync] [--no-open] [--dry-run] [--json]
It checks the machine, optionally pushes the folder (default remote
), detects a command and port, then creates or reuses the named workspace through
. The built-in layout is a dev terminal on the left and a focused shell on the right, with a browser tab when a port is known. Re-running with the same workspace name preserves a workspace that already has live terminals; it does not start a second dev server.
and
override detection,
replaces the built-in layout, and
performs no socket calls. Sync defaults on when a folder or recognizable project is supplied; use
for a machine-side checkout.
stages the workspace and prints the
command instead of opening a local pane.
includes
,
,
,
,
,
,
,
,
,
, terminal ids,
, and
.
The detector checks, in order,
,
,
,
,
,
,
,
, and
. For JavaScript projects it chooses bun, pnpm, yarn, or npm from the lockfile, prefers
then
, and infers a port from the script or framework defaults. When no project is recognized, it stages a shell-only workspace; pass
to run something anyway.
starts the agent as a
detached terminal in the machine's cmux-tui session: it survives closed panes and reconnects from any device (
cmux vm open <machine>/<ws>/<term>
). Long shell work should also be backgrounded (see recipes) — never hold a long
open.
Watching and reporting back
bash
cmux vm tree <id> # live: terminals with title, cwd, agent state, (open: surface)
cmux vm open <id> # the machine's shell (+ its screen on desktop machines)
cmux vm open <id>/<ws>/<term> # one terminal as a pane; reuses the pane already showing it
cmux vm workspace open <id> <ws> [--here|--tabs|--pane <p> --left] # a whole workspace: new local workspace, or into this one
cmux vm workspace rename <id> <ws> <name> # rename it; `close` keeps its terminals (they detach into the pool), `rm` deletes it AND kills them
cmux vm tab rename <id> <tab> <name> # rename one exact tab placement; "" clears its custom label
cmux vm terminal rename <id> <term> <name> # rename every tab placement; "" clears every custom label
cmux vm open <id>:desktop # the noVNC screen
cmux vm open <id>:port/3000 [--print] # private tokened URL for an HTTP port (--print: URL only)
cmux surface ls --json # every surface (local + cloud) with ids, lifecycle, and which panes show it
cmux surface open <resource> [--new] [--pane <p> --left|--right|--up|--down|--tab] # one open path for all of them
cmux surface new-terminal --machine <id> --cwd /root/work/app -- bun test # a terminal on the machine, opened as a pane
cmux notify --title "Cloud build done" --body "…" # inside a machine too: lands on the Mac pane showing this terminal
The user cannot see inside the machine: print URLs, pull artifacts, or open a pane when there is something to look at, and
for long work. Only share URLs minted by
— never guess raw provider URLs.
run inside a machine reaches the user's Mac as data: the machine's daemon records it and the Mac shows it on the pane displaying the terminal it ran in (or at workspace level wherever the machine is open; nowhere if nothing of the machine is on screen). Keep
/
short (128 B / 1 KiB caps, 5 per burst then 1 per second);
folds into the body; Mac selectors (
,
,
,
,
) and
are ignored there, and nothing can be typed back into the machine from the notification.
A pane showing a machine surface is an ordinary local pane: move, split, reorder, or close it with the local topology verbs (
) and the surface catalog follows the pane; closing a pane never kills the machine's terminal. Inside the machine, use
,
,
, and
cmux pane split|swap|resize
to arrange its own layout (
).
Layouts as data (the shape of a workspace)
When a person clicks a machine workspace they land in a layout: which panes exist, how they are split, the divider ratios, which tabs sit in each pane, and what runs where. Agents author and read that shape as JSON, never by dragging panes:
bash
cmux vm layout export <m> <ws> # {"name","cwd","layout": …} for that workspace (--raw: the daemon's exact LayoutDocument)
cmux vm layout apply <m> dev.json --name app # build a NEW workspace on the machine from the document (never touches a non-empty one)
cmux vm layout apply <m> - --workspace <ws> <<'JSON' # stdin; --workspace must already be empty; prefer --name or vm dev
{"direction":"horizontal","split":0.6,"children":[
{"pane":{"surfaces":[{"type":"terminal","name":"agent","cwd":"work/app","command":"claude"}]}},
{"direction":"vertical","children":[
{"pane":{"surfaces":[{"type":"terminal","name":"tests","cwd":"work/app","command":"bun test --watch"}]}},
{"pane":{"surfaces":[{"type":"browser","url":"http://localhost:3000"}]}}]}]}
JSON
cmux vm layout apply <m> --from-saved dev --open # a layout saved on the Mac (`cmux layout save dev`) applied in the cloud, then opened here
cmux layout get dev | cmux vm layout apply <m> - # the same, piped
The document is the one cmux already uses locally (
cmux new-workspace --layout
,
cmux layout save|get|open
,
workspaces):
{"pane":{"surfaces":[…]}}
leaves and
{"direction":"horizontal"|"vertical","split":0.1–0.9,"children":[a,b]}
splits;
= side by side (first child left),
= stacked (first child top),
= the first child's share. A surface is
{"type":"terminal"|"browser","name"?,"cwd"?,"command"?,"env"?,"url"?,"focus"?}
. In the cloud a terminal surface is a login shell in
(relative to the work user's home, or the document's
) with
in its process environment;
is typed into that shell and stays reviewable in the scrollback, so the pane survives the command.
surfaces are Mac-only and skipped.
(and the sidebar click) then materializes the same splits, ratios and tabs locally, so the layout an agent arranged in the cloud is the layout the person sees. Export first when you want to reproduce a human's arrangement on another machine or in a fork.
Project environment: env vars, files, repos
bash
cmux vm env set <m> DATABASE_URL=… API_KEY=… # stored 0600 at ~/.config/cmux/env in the work user's home on the machine's persistent volume
cmux vm env set <m> --from-file .env # dotenv rules: blank/# skipped, optional `export `, quotes stripped
cat .env | cmux vm env set <m> - # same, from stdin (nothing in argv or history)
cmux vm env ls <m> [--show] [--json] # names only unless --show
cmux vm env rm <m> API_KEY
cmux vm push <m> ./config work/app/config # files and folders (tarball, SHA-256 verified; .git/node_modules excluded by default)
cmux vm push --secret <m> ./id_ed25519 ~/.ssh/id_ed25519 # ONE secret file over the link into `cmux file receive` (0600, atomic); never through exec
cmux vm push <m> ./config work/app/config --watch # keep it in sync while you edit locally (Ctrl-C to stop)
git bundle create /tmp/repo.bundle --all && cmux vm push <m> /tmp/repo.bundle work/repo.bundle # a private repo with history, no credential on the machine
cmux vm exec <m> -- sh -c 'cd work && git clone repo.bundle app'
values are sourced by every login and interactive shell on the machine (
/
hook, installed once), so terminals from
,
,
, layout panes and
all see them, and so do agents the in-VM
starts.
How values travel, and the rules that keep them secret. sends values over the machine's cmux-tui link (end-to-end encrypted between the Mac and the daemon on the private WireGuard network; the control plane brokers the route but never reads it) into the machine's
, which turns terminal echo off before it reads. Nothing passes through
, a provider API, a command line, shell history, or a terminal's screen, and the daemon never journals terminal input. On the machine they are one root-only 0600 file. Your side of the bargain: prefer
or
(stdin) over
arguments so values stay out of
your shell history and
; keep values out of layout documents (names belong there, values in
);
prints names unless you pass
; and remember that forks, snapshots and templates copy the volume, file included (
before
). Do not put the user's own account tokens on a machine unless they ask; model credentials already reach agents through CodeRouter's edge and never sit in the guest.
The grammar (one spelling per concept)
| Where you are | What you address | Spelling |
|---|
| Mac | a machine | cmux vm <verb> <machine> …
— everything about machines lives here |
| Mac | this Mac's own session | the unprefixed local verbs (, , …) |
| inside a machine | this machine's session | the same unprefixed local verbs as on a Mac (, , , , ) |
| inside a machine | another machine | cmux vm <verb> <machine> …
— the same grammar as on the Mac |
| inside a machine | the owner's machines | (this one marked , with reachability) |
| inside a machine | myself | cmux self [peers|integrations|owner|machine] [--json]
(aliases: , ) |
| Mac | a machine's identity | cmux vm self <machine> [<path>] [--json]
— the same reflection payloads through your session |
Inside a machine: the same verbs, and other machines
Every machine has its own
(a shim over its cmux-tui daemon). An agent running
in the machine drives its own session with the Mac spellings — the target defaults to its own terminal (
):
bash
cmux self # who am I: name, id, status, team, owner, plan (reflection; no credential in the guest)
cmux self peers # the owner's other machines and their routes; `cmux self integrations` = what I can use, with help commands
cmux vm ls # every machine of the owner, this one marked *, with reachable/linked state
cmux tree --json # this machine's workspaces/terminals
cmux new-workspace --name tests # a workspace here
cmux terminal send <term> 'bun test' --keys enter ; cmux terminal wait <term> --pattern 'pass|fail' ; cmux terminal read <term>
cmux terminal wait-exit <term> --timeout 600 ; cmux terminal output <term> # block until the process exits, then read the full output (not just the screen)
cmux send-key --terminal <term> ctrl+c # keys into another terminal on this machine
cmux layout apply --name app app.json # the same layout verb, locally
cmux env ls # the same env file
cmux notify --title "done" --body "…" # lands on the Mac pane showing this terminal
cmux agent claude --timeout 600 "fix the tests" # runs in this terminal until it exits (it is the wait; exit code passes through; --timeout caps it)
To talk to
another machine (a second agent, a service box), a machine discovers its peers through reflection (
or
; the owner's private network is the trust boundary, so no Mac step is needed — older Mac-written route files still work). Inside
,
takes the peer as its first argument with the same grammar the Mac uses:
,
cmux vm exec <dst> -- <cmd>
,
cmux vm terminal send|read|wait|close <dst> <term> …
,
cmux vm terminal send <dst> <term> enter
,
cmux vm workspace new|rename|close|rm <dst> …
,
cmux vm agent <dst> --agent codex -- "review work/app"
(a durable terminal on the peer running the peer's own agent config),
cmux vm layout export|apply <dst> …
,
cmux vm env set|ls|rm <dst> …
,
cmux vm push <dst> <file> <remote-path>
(one file over the link, secret-safe),
cmux vm agent <dst> … --wait --output
(until the peer's agent exits). No control-plane credential lives in any VM; a machine reaches only machines of its own owner.
A pane showing a machine surface is an ordinary local pane: move, split, reorder, or close it with the local topology verbs (
) and the surface catalog follows the pane; closing a pane never kills the machine's terminal. A local workspace that
mirrors a machine workspace (opened with
, or bound with
) is that workspace seen from the Mac, so its structure is the machine's: a pane moved into it takes its tab there (a pool terminal gets one), a terminal pane closed in it closes that tab (the terminal detaches into the Terminals pool, still running), and a tab or workspace renamed there is renamed on the machine. Closing the local workspace itself (⌘⇧W) only ends the view: the machine workspace and its terminals stay exactly as they were. Panes in any other local workspace are viewers and never touch the machine's layout. Rearranging the machine's topology in full is what
is for.
CodeRouter and model credentials
CodeRouter routes
model credentials, not compute. An agent started with
inside a machine authenticates the same way it would locally (its own login, or CodeRouter's env/config in the machine's
); set that up once on the machine (
) and it persists on the volume. Do not put the user's tokens on a machine unless they ask.
The guest
adapter exposes the shared auth and CodeRouter commands:
bash
cmux auth status --json
cmux coderouter status --json
cmux coderouter usage
cmux coderouter models
cmux coderouter agent claude "summarize the current checkout"
cmux agent codex "run the tests"
reports daemon health, TLS reachability, and VM-bound route authentication
without printing credentials. Stack account login and upstream credential management remain
host-owned (
,
on the Mac); never copy those
tokens into a VM. A bare agent sentence uses the provider's one-shot form, while flags and
provider subcommands pass through unchanged.
Agent policy
- Prefer / / over naming machines. They only draft pool machines; is the deliberate way to use another.
- Reuse before create. , then an idle machine or Base. Free plans: one machine, 7 days.
- Stay headless while working (, , ); open panes (, 's addresses) to show results.
- Checkpoint before risky operations (), fork instead of experimenting on a machine the user relies on.
- Only destroy what you created this session. is permanent.
- Stage, then show. Prefer for a project, or
vm layout apply --name <workspace>
for a hand-authored layout; vm workspace new --no-open
intentionally preserves a starter-shell workspace and is not an empty layout target. Verify with /, then so the person lands in a finished layout, not a half-built one.
Common issues and fixes
| Symptom | Fix |
|---|
| hangs or times out | Exec is capped (~30 s default). Background it: nohup … > /tmp/x.log 2>&1 &
, then poll — or use / a terminal in the session for long work. |
| / not found on a brand-new machine | Provisioning is still running: cmux vm exec <id> -- tail /tmp/cmux/provision.log
; the agents land in (on PATH in login shells). |
| First command after idle is slow | The machine was asleep: . |
| says it would provision | The pool is empty/busy. Check the plan meter; (or ) creates one. |
| Create fails with an active-limit error | Plan cap (free: 1). Report it; let the user upgrade or choose a machine to remove. |
| says no such workspace | Names are the cmux-tui workspace names; copy the id from . |
vm layout apply --workspace
says the workspace is not empty | vm workspace new --no-open
preserves a starter shell; use vm layout apply --name <workspace>
or instead. |
| Pushed a repo but is missing | skips , , by default; or ship a bundle (recipes). |
| Push/pull refuses a large payload | 256 MB cap. Clone/download inside the machine instead. |
| Command works in but not | Exec has no TTY/stdin; use non-interactive flags or / for interactive programs. |
Deep-dive references
| Reference | When to Use |
|---|
| references/commands.md | Exhaustive command list with examples |
| references/sidebar-parity.md | Every Cloud-sidebar action and the CLI verb that does the same thing (1:1) |
| references/agent-workflows.md | Recipes: cloud dev box, routed agents, parallel forks, desktop/browser tasks, showing the human |
| ../cmux/SKILL.md | Windows/workspaces/panes when presenting machine panes |
| ../cmux-workspace/SKILL.md | Non-disruptive automation rules (focus, caller workspace) |