import type { Metadata } from "next"; import { CodeBlock } from "../../components/code-block"; import { Callout } from "../../components/callout"; export const metadata: Metadata = { title: "API Reference", description: "cmux CLI and Unix socket API reference. Workspace management, split panes, input control, notifications, sidebar metadata (status, progress, logs), environment variables, and detection methods.", }; function Cmd({ name, desc, cli, socket, }: { name: string; desc: string; cli: string; socket: string; }) { return (
{desc}
cmux provides both a CLI tool and a Unix socket for programmatic control. Every command is available through both interfaces.
| Build | Path |
|---|---|
| Release |
/tmp/cmux.sock
|
| Debug |
/tmp/cmux-debug.sock
|
| Tagged debug build |
/tmp/cmux-debug-<tag>.sock
|
Override with the CMUX_SOCKET_PATH environment variable.
Send one newline-terminated JSON request per call:
method and{" "}
params. Legacy v1 JSON payloads such as{" "}
{`{"command":"..."}`} are not supported.
| Mode | Description | How to enable |
|---|---|---|
| Off | Socket disabled | Settings UI or CMUX_SOCKET_MODE=off |
| cmux processes only | Only processes spawned inside cmux terminals can connect. | Default mode in Settings UI |
| allowAll | Allow any local process to connect (no ancestry check). |
Environment override only: CMUX_SOCKET_MODE=allowAll
|
| Flag | Description |
|---|---|
--socket PATH
|
Custom socket path |
--json
|
Output in JSON format |
--window ID
|
Target a specific window |
--workspace ID
|
Target a specific workspace |
--surface ID
|
Target a specific surface |
--id-format refs|uuids|both
|
Control identifier format in JSON output |
Set status pills, progress bars, and log entries in the sidebar for any workspace. Useful for build scripts, CI integrations, and AI coding agents that want to surface state at a glance.
| Variable | Description |
|---|---|
CMUX_SOCKET_PATH
|
Override the socket path used by CLI and integrations |
CMUX_SOCKET_ENABLE
|
Force-enable/disable socket (1/0,{" "}
true/false, on/
off)
|
CMUX_SOCKET_MODE
|
Override access mode (cmuxOnly,{" "}
allowAll, off). Also accepts{" "}
cmux-only/cmux_only and{" "}
allow-all/allow_all
|
CMUX_WORKSPACE_ID
|
Auto-set: current workspace ID |
CMUX_SURFACE_ID
|
Auto-set: current surface ID |
TERM_PROGRAM
|
Set to ghostty
|
TERM
|
Set to xterm-ghostty
|
CMUX_SOCKET_MODE values full and{" "}
notifications are still accepted for compatibility.