Skip to main content
The CLI is designed for automation and scripting (CI/CD pipelines, batch processing, programmatic control). For interactive terminal experiences, consider tools like Claude Code or similar TUIs.
Mux provides a CLI for running one-off agent tasks without the desktop app. Unlike the interactive desktop experience, mux run normally executes a single request to completion and exits. The --goal option is an explicit exception: it starts a CLI Goal Run that may perform automatic continuations until the goal is complete or a limit is reached.

GitHub Actions Guide

Learn how to use mux run in CI/CD pipelines

Installation

The CLI is available via npm and can be run directly with npx:
Using npx mux is especially convenient for CI/CD pipelines where you don’t want to manage a global installation.

mux run

Execute a one-off agent task:

Options

OptionShortDescriptionDefault
--dir <path>-dProject directoryCurrent directory
--model <model>-mModel to use (e.g., anthropic:claude-sonnet-4-5)Default model
--runtime <runtime>-rRuntime: local, worktree, ssh <host>, or docker <image>local
--mode <mode>Agent mode: plan or execexec
--thinking <level>-tThinking level: OFF, LOW, MED, HIGH, MAX, or 09 (model-relative, see Models)MED
--budget <usd>-bStop when session cost exceeds budget (USD)No limit
--goal <objective>Start a CLI Goal Run and continue until the persisted goal is complete or a limit stops itOff
--goal-budget <n>Goal budget ($5, 5.00, or 500c); separate from --budgetNo limit
--goal-turns <n>Maximum automatic goal continuation turnsNo limit
--experiment <id>-eEnable experiment (repeatable)None
--jsonOutput NDJSON for programmatic useOff
--quiet-qOnly output final resultOff

CLI Goal Runs

Use --goal when a task should keep going across automatic continuations until the agent marks the persisted goal complete:
A CLI Goal Run is intentionally not a strict alias for interactive /goal. It is ephemeral to the mux run process, does not apply interactive goal defaults, bypasses the interactive continuation cooldown, and exits successfully only when the persisted goal status is complete. If neither --goal-budget nor --goal-turns is provided, Mux warns that the goal is uncapped. --budget remains the hard session spending limit in USD. --goal-budget is goal accounting, accepts forms like $5, 5.00, and 500c, and may allow a final budget-limit wrap-up turn. If the session --budget is exceeded, the run stops immediately. Exit codes for CLI Goal Runs:
CodeMeaning
0Goal completed (unless the agent set a nonzero exit code)
1Operational, model, or tool error
2Session --budget exceeded
3Goal stopped incomplete, including goal budget/turn limits
130User interrupt

Runtimes

  • local (default): Runs directly in the specified directory. Best for one-off tasks.
  • worktree: Creates an isolated git worktree under ~/.mux/src. Useful for parallel work.
  • ssh <host>: Runs on a remote machine via SSH. Example: --runtime "ssh user@myserver.com"
  • docker <image>: Runs in a Docker container. Example: --runtime "docker node:20"

Output Modes

  • Default (TTY): Human-readable streaming with tool call formatting
  • --json: NDJSON streaming - each line is a JSON object with event data
  • --quiet: Suppresses streaming output, only shows final assistant response

Examples

mux workflow

Run a durable workflow JavaScript file from the command line without opening the desktop app. Workflows are addressed by explicit script_path values; there is no workflow discovery, list, or show command. Skill-packaged workflows use skill://<skill-name>/<file.js>, and local workflow files use an explicit workspace-contained .js path. mux wf is a shorthand alias for mux workflow.
mux workflow is experimental. Invoking the command implicitly enables the dynamic-workflows experiment for that invocation only. The initial CLI runner supports the local runtime only; worktree, SSH, Docker, and devcontainer workflow execution are blocked until their workflow isolation and cleanup semantics are implemented.
Use local workflow files for cheap CLI smoke tests. skill:// paths run the packaged workflow they reference, which may require AI credentials or model budget.

Workflow commands

CommandDescription
mux workflow run <script_path>Run an explicit workflow script in the foreground

Workflow options

OptionDescription
--dir <path> / -dProject directory. When omitted, Mux uses the Git root for the current cwd.
--runtime <runtime> / -rRuntime selection. Currently only local is supported for workflow runs.
--model <model> / -mModel used by workflow-owned child agents.
--thinking <level> / -tThinking level used by workflow-owned child agents.
--experiment <id> / -eEnable an additional experiment for workflow-owned child agents.
--jsonEmit the final workflow result as a JSON line on stdout.
--quiet / -qSuppress progress output and print only the final report.
--verbose / -vShow info-level logs while the workflow command runs.
--log-level <level>Set log verbosity to error, warn, info, or debug.

Workflow arguments

Workflows receive structured args. Positional prose is rejected; pass JSON, a JSON file/stdin payload, or explicit --arg key=value pairs instead. Only one argument mode can be used per run:
Input modeWorkflow args value
No args{}
--arg key=valueObject with lightly coerced scalar values
--args-json '{"base":"main"}'Exact JSON value
--args-file args.jsonExact JSON value read from a file
--args-stdinExact JSON value read from stdin
Workspace-file workflow scripts are executable only after the project is trusted. If an explicit local .js script path points into an untrusted project, mux workflow run fails before executing repo-controlled workflow code. Linked git worktrees inherit trust from the main repository path. Grant trust headlessly with mux trust.

mux trust

Trust gates all repo-controlled automation: project workflows, hooks, and .mux configuration. The desktop app records trust via Settings → Security; mux trust writes the same entry in ~/.mux/config.json headlessly — no desktop app or server required, registering the project if it was never added to mux. A running desktop instance picks the change up automatically.
Run from a linked git worktree (for example a mux workspace checkout), trust is recorded for the main repository path rather than the ephemeral worktree path. Review a repository before trusting it: trusted projects can execute repo-controlled code.

mux server

Start the HTTP/WebSocket server for remote access (for example, from a phone or another machine):
Options:
  • --host <host> - Host/interface to bind to (default: localhost)
  • --port <port> - Port to bind to (default: 3000)
  • --auth-token <token> - Bearer token for HTTP/WS auth
  • --no-auth - Disable authentication entirely
  • --print-auth-token - Always print the auth token on startup
  • --allow-http-origin - Accept HTTPS browser origins when a TLS-terminating proxy forwards X-Forwarded-Proto=http
  • --ssh-host <host> - SSH hostname/alias used for editor deep links in browser mode
  • --add-project <path> - Add and open project at the specified path
Use --allow-http-origin only when HTTPS is terminated by an upstream reverse proxy and mux receives rewritten X-Forwarded-Proto=http headers. This compatibility mode is disabled by default. For non-CLI server starts (for example desktop/browser mode), set MUX_SERVER_ALLOW_HTTP_ORIGIN=1 to opt in. Auth token precedence:
  1. --no-auth
  2. --auth-token
  3. MUX_SERVER_AUTH_TOKEN
  4. Auto-generated token
GitHub owner login for browser sessions is configured separately via MUX_SERVER_AUTH_GITHUB_OWNER or serverAuthGithubOwner in ~/.mux/config.json. See Server Access.

mux acp

Start the ACP (Agent-Client Protocol) stdio bridge used by editor integrations:
OptionDescription
--server-url <url>URL of a running mux server
--auth-token <token>Bearer token for authenticated server connections
--log-file <path>Write ACP logs to a file instead of stderr
For editor-specific setup (Zed, Neovim, JetBrains), see the ACP Editor Integrations guide.

mux desktop

Launch the desktop app. This is automatically invoked when running the packaged app or via electron .:
Note: Requires Electron. When running mux with no arguments under Electron, the desktop app launches automatically.

mux --version

Print the version and git commit:

Debug Environment Variables

These environment variables help diagnose issues with LLM requests and responses.
VariablePurpose
MUX_DEBUG_LLM_REQUESTSet to 1 to log the complete LLM request (system prompt, messages, tools, provider options) as formatted JSON to the debug logs. Useful for diagnosing prompt issues.
Example usage:
The output includes:
  • systemMessage: The full system prompt sent to the model
  • messages: All conversation messages in the request
  • tools: Tool definitions with descriptions and input schemas
  • providerOptions: Provider-specific options (thinking level, etc.)
  • mode, thinkingLevel, maxOutputTokens, toolPolicy