| name | cli-cmux |
| description | Deep expertise in cmux — the terminal multiplexer with native browser views. Use when managing panes, reading terminal output, sending keystrokes, opening browser views, or manually testing web UIs and TUIs inside cmux. Triggers on: cmux, open a browser pane, split terminal, read screen, send keys, test this UI in cmux, preview in cmux. |
cmux — Terminal Multiplexer with Native Browser
cmux manages terminal panes and browser views through a Unix socket CLI.
You are already running inside cmux — your current pane has env vars
CMUX_WORKSPACE_ID and CMUX_SURFACE_ID set automatically.
Mental Model
window → workspace(s) → pane(s) → surface(s)
↑
terminal OR browser
- Window: OS window
- Workspace: A tab within a window (like tmux sessions)
- Pane: A visual split region
- Surface: The content inside a pane (terminal or browser); panes can have multiple surfaces as tabs
Addressing
cmux uses short refs by default: workspace:1, pane:2, surface:3.
Most commands auto-target the caller's workspace/surface via env vars.
cmux identify
cmux list-panes
cmux list-workspaces
Core Operations
Layout — Splits and Panes
cmux new-pane --direction right
cmux new-pane --direction down
cmux new-pane --type browser --direction right --url http://localhost:3000
cmux focus-pane --pane pane:3
cmux resize-pane --pane pane:2 -R --amount 20
cmux resize-pane --pane pane:2 -D --amount 10
Terminal I/O — Read and Send
cmux read-screen --surface surface:2
cmux read-screen --surface surface:2 --scrollback --lines 100
cmux send --surface surface:2 "npm run dev"
cmux send --surface surface:2 $'\n'
cmux send-key --surface surface:2 Enter
cmux send-key --surface surface:2 Up
cmux send-key --surface surface:2 Ctrl+C
Browser — Navigate and Interact
cmux browser --surface surface:3 navigate http://localhost:3000
cmux browser --surface surface:3 snapshot --interactive
cmux browser --surface surface:3 click "button.submit"
cmux browser --surface surface:3 fill "input[name=email]" "test@example.com"
cmux browser --surface surface:3 type "input[name=search]" "query"
cmux browser --surface surface:3 press Enter
cmux browser --surface surface:3 scroll --dy 500
cmux browser --surface surface:3 get url
cmux browser --surface surface:3 get title
cmux browser --surface surface:3 get text "h1"
cmux browser --surface surface:3 wait --selector ".loaded"
cmux browser --surface surface:3 wait --load-state complete
cmux browser --surface surface:3 wait --text "Dashboard"
Workflow: Testing a Web UI
The pattern: start the dev server in a terminal pane, open a browser pane
pointing at it, then interact via snapshot → act → re-snapshot.
cmux new-pane --direction down
cmux send --surface surface:2 "npm run dev"
cmux send-key --surface surface:2 Enter
cmux read-screen --surface surface:2
cmux new-pane --type browser --direction right --url http://localhost:3000
cmux browser --surface surface:3 snapshot --interactive
cmux browser --surface surface:3 click "nav a[href='/settings']"
cmux browser --surface surface:3 wait --load-state complete
cmux browser --surface surface:3 snapshot --interactive
cmux browser --surface surface:3 fill "input[name=username]" "testuser"
cmux browser --surface surface:3 fill "input[name=password]" "secret"
cmux browser --surface surface:3 click "button[type=submit]"
cmux browser --surface surface:3 wait --text "Welcome"
cmux browser --surface surface:3 snapshot --interactive
Snapshot Tips
--interactive returns only interactive elements — much smaller output
--compact reduces whitespace for smaller snapshots
--selector "main" scopes to a region of the page
--max-depth 5 limits DOM tree depth
- Always re-snapshot after navigation or DOM mutations
Workflow: Testing a TUI
The pattern: launch the TUI in a new pane, read-screen to observe, send/send-key to interact.
cmux new-pane --direction right
cmux send --surface surface:2 "my-cli-wizard"
cmux send-key --surface surface:2 Enter
cmux read-screen --surface surface:2
cmux send-key --surface surface:2 ArrowDown
cmux send-key --surface surface:2 ArrowDown
cmux send-key --surface surface:2 Enter
cmux read-screen --surface surface:2
cmux send --surface surface:2 "my-project-name"
cmux send-key --surface surface:2 Enter
cmux read-screen --surface surface:2
cmux send-key --surface surface:2 Ctrl+C
cmux read-screen --surface surface:2
cmux send-key --surface surface:2 Ctrl+C
TUI Tips
- Use
read-screen (not read-screen --scrollback) for current viewport
- Add
--lines 50 with --scrollback to limit output size
- Send
Ctrl+C to kill the TUI when done
- Read the screen after each interaction to confirm state changes
Context Management
cmux interactions are context-expensive. Minimize round-trips:
- Batch related commands — don't read-screen between every single keystroke
- Use
--interactive and --compact for browser snapshots
- Scope snapshots with
--selector when you only care about part of the page
- Delegate long test sessions to a Task subagent — the subagent runs the
full interaction loop and returns only findings
Sidebar Metadata
cmux provides sidebar status, progress, and logging for visibility:
cmux set-status "phase" "testing" --icon "🧪"
cmux set-progress 0.5 --label "Running tests..."
cmux log "Found 3 issues" --level warn
cmux clear-progress
Reference
For full command details, see: