Agent skill

cmux Agent Surface Control

by disler in disler/learning-cmux-with-agents

Drives the cmux terminal multiplexer from natural language to open, inspect, prompt, read and close windows, workspaces, panes, surfaces and agent sessions.

MITAuto-check: notesProductivity & Automation

Install cmux Agent Surface Control

skills CLI
$ npx skills add disler/learning-cmux-with-agents --skill cmux -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install disler/learning-cmux-with-agents cmux --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/disler/learning-cmux-with-agents.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.claude/skills/cmux .claude/skills/cmux && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
cmux
GitHub stars
115
Token cost
~2.6k tokens
SKILL.md length
1,329 words
Files
1
Skills in repo
5
Repo updated
First seen
Licence
MIT

At a glance

Drives the cmux terminal multiplexer from natural language to open, inspect, prompt, read and close windows, workspaces, panes, surfaces and agent sessions.

  • Works in 9 steps: help before every unfamiliar verb.… → Look before you leap. Inspect with tree… → Refs are positional and renumber.… → …
  • Opening a new cmux workspace with several panes, each running an agent
  • SKILL.md covers Purpose, Instructions, Workflows and Report Format
  • Calls codex, jq and claude; needs OPENROUTER_API_KEY and ANTHROPIC_API_KEY

What it does

The skill treats cmux as a CLI and socket that controls terminal surfaces and the agents running in them. The agent always starts with cmux --help, drills into subcommands and trusts the help output over memory, never guessing flags. It learns the nesting of window, workspace, pane and surface, and checks the current state with cmux tree --all or the workspace and pane listing commands before acting. Orchestration prompts are meant to be prefixed with /cmux.

Creating a workspace uses --json to capture both the workspace and initial surface refs, which are then reused rather than guessed. An --env-file option, defaulting to the repo's .env, loads environment variables into every surface so agents such as claude, pi, codex or gemini start already authenticated, and a compact JSON layout can boot a multi-pane team in one call. The agent must not overwrite a working login, and must never read key values by cat, echo or screen reads unless an agent actually fails to authenticate.

When your agent uses it

  • Opening a new cmux workspace with several panes, each running an agent
  • Reading the output of a surface or sending a prompt to an agent in another pane
  • Tearing down a fleet of agent sessions when work is finished
  • Inspecting the current window, workspace and pane tree

Example prompts

  • “/cmux open a workspace with three panes, each running an agent, and load my .env into all of them.”
  • “/cmux show me the tree of windows, workspaces and panes right now.”
  • “/cmux send the failing test output to the agent in the second pane and read back its reply.”
  • “/cmux close every workspace I created in this session.”

Requirements

  • The cmux CLI and a running cmux app
  • An .env file holding agent credentials, if agents need them

Workflow steps

9 steps, taken from the first numbered list in SKILL.md.

  1. help before every unfamiliar verb. Confirm the subcommand and flags exist.
  2. Look before you leap. Inspect with tree / list / read-screen before sending or closing anything.
  3. Refs are positional and renumber. surface:N / workspace:N shift as things open and close. Re-read the tree right before you act; for…
  4. Type then submit. A prompt isn't sent until you send-key enter. Give agents a beat before you read-screen their reply.
  5. Read back to verify. After sending a command, read-screen to confirm it actually ran and got the result you expected — don't assume.
  6. Close scoped, never broad. Close only surfaces you just created or explicitly identified. Never loop a close over the whole tree — you'll…
  7. One window per team. Keep a unit of work to a single window so it stays monitorable and tearable as a unit.
  8. Never print secrets. If a surface has credentials/keys loaded, read results back without echoing the secret values.
  9. Prefer push over poll. Use cmux events --category notification (see Wait for agents via notification events above) to know the instant an…

What it can do on your machine

Read from SKILL.md and the folder at commit 6eaacab. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • codex
    • jq
    • claude

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names these keys or tokens, usually read from environment variables:

    • OPENROUTER_API_KEY
    • ANTHROPIC_API_KEY

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

cmux Agent Surface Control loads about 2.6k tokens when it runs. Until then it costs about 70 tokens; SKILL.md has 1,329 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~70
When it runs · the whole SKILL.md, loaded when a task matches
~2.6k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check: notes

The automated check noted patterns worth knowing about, such as sudo or a known installer.

  • NoteMentions a .env fileSKILL.md:52
    ate --name <name> --cwd <dir> --env-file .env --json
  • NoteMentions a .env fileSKILL.md:59
    - **Default `--env-file` to `.env`** (the repo's `.env`) unless told otherwise:
  • NoteMentions a .env fileSKILL.md:60
    `--env-file .env`. That is the canonical source for `OPENROUTER_API_KEY`,
  • NoteMentions a .env fileSKILL.md:68
    default, just point `--env-file` at `.env` and proceed; do not `cat .env`,

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from disler/learning-cmux-with-agents at commit 6eaacab, republished under its MIT licence (© disler). 1,329 words, ~2,641 tokens.

Download SKILL.mdSave it as .claude/skills/cmux/SKILL.md (or your agent's skills folder).
name
cmux
description
Drive cmux — the terminal multiplexer / agent-surface control CLI — from natural language. Use this whenever a prompt asks you to open, inspect, prompt, read, or tear down cmux windows, workspaces, panes, surfaces, or agent sessions. Prefix orchestration prompts with /cmux.
argument-hint
what to do in cmux

cmux

Purpose

You are driving cmux, a CLI + socket for controlling terminal surfaces (and the agents running inside them). Every window, workspace, pane, and surface is a real, addressable object you can spawn, prompt, read, and close from the command line.

Instructions

Discover commands first (--help)

Before doing anything, run:

bash
cmux --help

Then drill into any subcommand you intend to use:

bash
cmux <command> --help     # e.g. cmux workspace --help, cmux send --help

cmux evolves; trust --help over memory. Never guess flags — confirm them.

Understand the hierarchy

Everything nests in one tree. Learn the boxes and the verbs fall out:

  • Window → a top-level OS window.
  • Workspace → a sidebar entry ("tab") inside a window.
  • Pane → a split region within a workspace.
  • Surface → a tab within a pane (a terminal or a browser).

Use cmux tree --all (or cmux workspace list / cmux list-pane-surfaces) to see the current state before you act.

Create a workspace and inject credentials (--env-file)

Create a workspace and capture BOTH refs in one call. --json returns the workspace_ref and the initial surface_ref — grab and thread them; never guess positional refs.

bash
cmux workspace create --name <name> --cwd <dir> --env-file .env --json
  • cmux workspace create supports --env-file, which loads that file's environment variables into every surface in the workspace — so an agent launched in a pane (claude, pi, codex, gemini) comes up already authenticated, no manual export needed.
  • Default --env-file to .env (the repo's .env) unless told otherwise: --env-file .env. That is the canonical source for OPENROUTER_API_KEY, ANTHROPIC_API_KEY, etc.
  • Pair it with --layout <compact-json> to boot a whole multi-pane team declaratively in one call (each pane's command auto-launches its agent).
  • Don't inject over a working login. If an agent is already authenticated (e.g. Claude Code), don't push a placeholder key over it via --env-file; scope credential injection to the agents that actually need it.
  • Assume the keys are already set up — and never read their values. By default, just point --env-file at .env and proceed; do not cat .env, echo $OPENROUTER_API_KEY, or read-screen a surface to capture a key. Only if an agent actually fails to authenticate should you validate, and do it safely: cmux workspace env --workspace <ref> --mask shows that a var is present without revealing it, and [ -n "$VAR" ] confirms it is non-empty. Report the masked/presence result, never the secret itself.
The control loop

You operate surfaces the way a person would, but over the CLI:

  • cmux send --surface <ref> "<text>" — type text into a surface.
  • cmux send-key --surface <ref> enter — submit it (press a key). send types; send-key submits — they are separate steps.
  • cmux read-screen --surface <ref> — read what's on screen (add --scrollback for history). This is your eyes.
  • cmux close-surface --surface <ref> — end a surface cleanly.
Wait for agents via notification events (don't busy-poll)

Instead of looping on read-screen, subscribe to cmux's push channel and block until an agent finishes its turn. This is verified working for pi, codex, and Claude Code.

cmux events is the wait channel — not cmux wait-for. cmux wait-for <name> is an unrelated named-token rendezvous (a manual semaphore you signal yourself); it does not know when an agent finishes. The agent-completion signal is the notification event category.

Prerequisite — install the notification hooks once:

bash
cmux hooks setup            # wires pi, codex, opencode, gemini, … to emit on turn-stop
# or per agent:  cmux hooks pi install   /   cmux hooks codex install

Claude Code emits notifications out of the box when launched inside cmux (no cmux hooks entry needed). Without hooks, an agent stays silent and you're back to polling — so install them before relying on the wait.

What an agent emits when its turn ends — one event per completed turn:

json
{ "name": "notification.requested", "category": "notification",
  "workspace_id": "120FC732-…", "surface_id": null, "seq": 1512, … }

Match on workspace_id — for hook-emitted notifications surface_id is usually null, but workspace_id is always set. The title/body are redacted in the event (you get the signal, not the text), so once it fires, read-screen that workspace's surface for the actual reply. Filter to --name notification.requested; a sibling notification.clear_requested fires when a surface gains focus and is just noise.

Block until a specific agent finishes (capture its workspace_id first via cmux list-workspaces --json --id-format both):

bash
WS=<agent-workspace-uuid>
# Start the listener to a file BEFORE sending the prompt, then poll the file.
cmux events --name notification.requested --no-heartbeat --no-ack > /tmp/cmux.ev &
EV=$!
cmux send --surface <ref> "<task>"; cmux send-key --surface <ref> enter
# wait (bounded) for this workspace's turn-done event
until grep -q "\"workspace_id\":\"$WS\"" /tmp/cmux.ev; do sleep 1; done
kill $EV
cmux read-screen --surface <ref> --scrollback --lines 40   # now read the reply

Pitfall: a cmux events | jq … & pipeline in a one-liner can stall on stdout buffering — stream to a file and poll the file (above), or pass jq --unbuffered. For a durable cursor across reconnects use cmux events --cursor-file <path> --reconnect.

Launching the pi agent

pi is an interactive TUI agent — launch it as pi --model … "<task>".

  • Launch it inside a pane (via cmux send + send-key enter), not from your own non-interactive/batch shell.
Launching Codex — run it in yolo / auto mode

When launching Codex in a pane, start it unattended so it doesn't stall on approval prompts (it's running inside cmux, driven by an orchestrator). Pass the flag at launch — do not edit Codex's global config:

  • Yolo (full, no sandbox): codex --dangerously-bypass-approvals-and-sandbox "<task>" — skips every approval prompt and the sandbox. Use only because the run is orchestrated/observed.
  • Auto (sandboxed): codex --full-auto "<task>" — automatic execution inside a workspace-write sandbox; safer when full access isn't needed.

Default to yolo for hands-off fleet runs; reach for --full-auto when you want a sandbox. These are per-launch flags, so they never change the user's global Codex setup.

Always launch Codex with the gpt-5.5 model unless a prompt specifies otherwise — pass -m gpt-5.5 at launch, e.g. codex -m gpt-5.5 --dangerously-bypass-approvals-and-sandbox "<task>". If a prompt names a different Codex model/effort, use that instead; gpt-5.5 is just the default.

Show full SKILL.md (479 more words)Show less
Launching Claude Code — use cc bypass mode

Plain claude launches in ask-for-permission mode: it will decline to run Bash/edits and instead print instructions, then end its turn. For a hands-off fleet agent, launch it the same way you yolo Codex — bypass permissions at launch:

  • cc bypass: claude --dangerously-skip-permissions "<task>" — Claude's equivalent of Codex yolo. The composer then shows ⏵⏵ bypass permissions on and it executes shell/edits without prompting. (--dangerously-skip-permissions is a per-launch flag; it doesn't change global Claude settings.)

Caveat verified in testing: a notification still fires on turn-completion even when Claude refused to do the work — so if you only watch events, you can mistake a "declined, nothing happened" turn for success. Always read-screen (or check the artifacts) after the event, don't trust the event alone. Claude Code emits cmux notifications out of the box (no cmux hooks entry needed); see Wait for agents via notification events above.

Best practices
  1. --help before every unfamiliar verb. Confirm the subcommand and flags exist.
  2. Look before you leap. Inspect with tree / list / read-screen before sending or closing anything.
  3. Refs are positional and renumber. surface:N / workspace:N shift as things open and close. Re-read the tree right before you act; for anything long-lived, anchor to a stable window UUID, not a positional ref.
  4. Type then submit. A prompt isn't sent until you send-key enter. Give agents a beat before you read-screen their reply.
  5. Read back to verify. After sending a command, read-screen to confirm it actually ran and got the result you expected — don't assume.
  6. Close scoped, never broad. Close only surfaces you just created or explicitly identified. Never loop a close over the whole tree — you'll kill things you didn't mean to. close/close-window may no-op while a live agent occupies a pane; use close-surface per pane.
  7. One window per team. Keep a unit of work to a single window so it stays monitorable and tearable as a unit.
  8. Never print secrets. If a surface has credentials/keys loaded, read results back without echoing the secret values.
  9. Prefer push over poll. Use cmux events --category notification (see Wait for agents via notification events above) to know the instant an agent finishes instead of polling read-screen in a tight loop. Install hooks first (cmux hooks setup); match events on workspace_id. cmux wait-for is a manual named-token semaphore, not an agent-finished signal.

Workflows

Drive a surface end-to-end

The default loop for any single-surface task: discover, inspect, act, verify, report.

  1. cmux --help (and per-subcommand --help) to confirm the verbs.
  2. Inspect current state (tree --all / workspace list).
  3. Take the action (create / send + send-key / read).
  4. Read back to verify the result.
  5. Report concisely what happened, citing the surfaces/refs involved.

Report Format

Report concisely in plain English: what you did, the surfaces/refs involved, and what read-screen confirmed. Cite refs (e.g. workspace:2 / surface:3) and never echo secret values.

© disler, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in .claude/skills/cmux of disler/learning-cmux-with-agents.

Open the folder on GitHubat commit 6eaacab

Compare with similar skills

cmux Agent Surface Control next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

cmux Agent Surface Control compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
cmux Agent Surface Control this skilldisler/learning-cmux-with-agents115—~2.6kAutomated safety check: NotesMIT
Fastgpt Workflow GeneratorYYH211/Claude-meta-skill282—~5.5kAutomated safety check: PassMIT
Lindy Core Workflow Bjeremylongshore/tons-of-skills-marketplace2.8k—~1.6kAutomated safety check: PassMIT
Agency Orchestrator Workflow RunnerjnMetaCode/superpowers-zh8.3k1 repos~885Automated safety check: PassMIT
Flow Nexus Swarmruvnet/agentic-flow8164 repos~4.2kAutomated safety check: PassNone
Orchestration Graph RunnerYeachan-Heo/oh-my-claudecode40k—~1.3kAutomated safety check: PassMIT

Similar skills

  • Fastgpt Workflow Generator

    YYH211/Claude-meta-skill

    Generates production-ready FastGPT workflow JSON from natural language requirements.

    282 GitHub stars~5.5k tokensUpdated 4 mo ago
    Productivity & AutomationAuto-check passed
  • Lindy Core Workflow B

    jeremylongshore/tons-of-skills-marketplace

    Configure Lindy triggers, scheduling, multi-agent delegation, and automation.

    2.8k GitHub stars~1.6k tokensUpdated today
    Productivity & AutomationAuto-check passed
  • Agency Orchestrator Workflow Runner

    jnMetaCode/superpowers-zh

    Runs agency-orchestrator YAML workflows inside the current agent session, with the session's own model playing each role in turn and no API key needed.

    8.3k GitHub starsUsed in 1 repo~885 tokens
    Agent WorkflowsAuto-check passed
  • Flow Nexus Swarm

    ruvnet/agentic-flow

    Cloud-based AI swarm deployment and event-driven workflow automation with Flow Nexus platform

    816 GitHub starsUsed in 4 repos~4.2k tokens
    Backend & APIsAuto-check passed
  • Orchestration Graph Runner

    Yeachan-Heo/oh-my-claudecode

    Runs deterministic DAG pipelines from a JSON descriptor with journal-based crash recovery, so an interrupted run resumes without repeating finished nodes.

    40k GitHub stars~1.3k tokensUpdated yesterday
    Agent WorkflowsAuto-check passed
  • Runs one operation across many files with parallel worker agents: finds files by glob pattern, splits them into chunks, launches workers and summarizes the results.

    28k GitHub stars~2.3k tokensUpdated today
    DevelopmentAuto-check passed

More from disler/learning-cmux-with-agents

  • cmux Browser Automation

    disler/learning-cmux-with-agents

    Drives browser surfaces inside cmux from the command line: open sites, snapshot elements, act on refs, wait for state changes and extract data.

    115 GitHub stars~1.3k tokensUpdated 3 mo ago
    Auto-check passed
  • cmux Customization

    disler/learning-cmux-with-agents

    Customizes cmux for a user by editing cmux.json actions, workspace layouts, dock controls, tab bar buttons, settings and Ghostty terminal preferences.

    115 GitHub stars~2.4k tokensUpdated 3 mo ago
    Auto-check passed
  • cmux Contributor Dev Workflow

    disler/learning-cmux-with-agents

    Contributor rules for the cmux repo: tagged Debug builds through reload.sh, first-time setup, Xcode project normalization and per-tag sidebar extension points.

    115 GitHub stars~1.5k tokensUpdated 3 mo ago
    Auto-check passed
  • cmux Testing Rules

    disler/learning-cmux-with-agents

    Testing rules for the cmux Swift codebase: Swift Testing as the default framework, a two-commit regression policy, and tests that check runtime behavior, not source text.

    115 GitHub stars~1.2k tokensUpdated 3 mo ago
    Auto-check passed

Questions about cmux Agent Surface Control

What does cmux Agent Surface Control do?

Drives the cmux terminal multiplexer from natural language to open, inspect, prompt, read and close windows, workspaces, panes, surfaces and agent sessions. The skill treats cmux as a CLI and socket that controls terminal surfaces and the agents running in them. The agent always starts with cmux --help, drills into subcommands and trusts the help output over memory, never guessing flags.

When should I use cmux Agent Surface Control?

cmux Agent Surface Control fits situations like: opening a new cmux workspace with several panes, each running an agent; reading the output of a surface or sending a prompt to an agent in another pane; tearing down a fleet of agent sessions when work is finished; inspecting the current window, workspace and pane tree.

How do I install cmux Agent Surface Control in Claude Code?

Run `npx skills add disler/learning-cmux-with-agents --skill cmux -a claude-code`. Or copy the skill folder (.claude/skills/cmux in disler/learning-cmux-with-agents) into .claude/skills/cmux in your project. Claude Code loads it when a task matches its description.

How do I install cmux Agent Surface Control in Codex?

Run `npx skills add disler/learning-cmux-with-agents --skill cmux -a codex`. Or copy the skill folder (.claude/skills/cmux in disler/learning-cmux-with-agents) into .agents/skills/cmux in your project. Codex loads it when a task matches its description.

Can I use cmux Agent Surface Control in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add disler/learning-cmux-with-agents --skill cmux -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/cmux, .gemini/skills/cmux, .github/skills/cmux and .opencode/skills/cmux in your project.

What does cmux Agent Surface Control need to run?

Going by SKILL.md and its folder, cmux Agent Surface Control needs the command-line tools its instructions call (codex, jq and claude) and credentials named OPENROUTER_API_KEY and ANTHROPIC_API_KEY. Our summary lists: The cmux CLI and a running cmux app; An .env file holding agent credentials, if agents need them.

Does cmux Agent Surface Control access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is cmux Agent Surface Control safe to install?

Our automated static check of SKILL.md found notes only (mentions a .env file), nothing it rates as a warning. It is not a guarantee. Review the folder before installing.

What licence does cmux Agent Surface Control use?

cmux Agent Surface Control is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does cmux Agent Surface Control use?

About 2.6k tokens (SKILL.md is roughly 11k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to cmux Agent Surface Control?

Skills that share tags, products or a category with cmux Agent Surface Control: Fastgpt Workflow Generator (YYH211/Claude-meta-skill, 282 stars), Lindy Core Workflow B (jeremylongshore/tons-of-skills-marketplace, 2.8k stars), Agency Orchestrator Workflow Runner (jnMetaCode/superpowers-zh, 8.3k stars) and Flow Nexus Swarm (ruvnet/agentic-flow, 816 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains cmux Agent Surface Control?

disler (a GitHub user) maintains it in disler/learning-cmux-with-agents, which has 115 GitHub stars. The repository holds 5 skills in this directory. The repository was last updated on June 29, 2026.

Source: disler/learning-cmux-with-agents on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.