cmd/muster is a machine client for muster's JSON API, used by agents, scripts
and you. It builds as the muster binary.
The verb set is pinned in two places:
tests/verb-ledger.sh, run bymake verb-ledger, interrogates the built binary;cmd/muster/tree_test.gowalks the command tree.
| group | verbs |
|---|---|
| tasks | task ls, task get, task create, task comment, task status |
| an agent's own task | agent task get, agent task comment, agent task status |
| agents | agent ls, agent messages, agent resolve, agent rm (remove an agent; a host officer instance's left-over row needs no provisioner), agent create (creating an agent without the chief), chief ask, chief replace (replacing the chief) |
| browser flows | flow enqueue, flow ls, flow status, flow cancel |
| credentials | token ls, token revoke, whoami |
| session routing | route reply (a mirrored session's answer to a routed message) |
| plugins | plugins retry <message-id> (retry an unconfirmed message), plugins deliver-to <plugin-id> officer:<id> / --clear (bind a plugin to an officer) |
| pull requests | pr-session <owner>/<repo>#<n> (which of your sessions created a pull request: below) |
| setup | doctor (below) |
| scheduled host jobs | job list, job runs <name>, job run <name>, job forget <host> <name> (the jobs your machines declare, their runs, run one now, forget one of a machine that is gone: host-jobs.md) |
| the ask log | asks log, asks summary (what your agents asked you, how you answered, how long it took: below) |
| chief nudges | nudge next (a host's oldest chief-nudge notice as a tmux target: below) |
| several servers | tenant list, tenant current, tenant use, tenant add, tenant remove (below) |
Global flags: --api-url, --token, --env-file (default
~/.muster/muster.env), --tenant and --timeout.
The CLI looks for each setting in three places, from lowest to highest priority:
- the env file;
- the environment;
- flags.
| setting | variable | flag |
|---|---|---|
| API URL (no default; it must be an absolute http(s) URL) | MUSTER_API_URL |
--api-url |
| credential | MUSTER_TOKEN (older name: MUSTER_HOOK_TOKEN; MUSTER_TOKEN wins within one source) |
--token |
The usual credential is a personal API token (mst_…). Mint it in the
browser at /account/tokens; it acts as you (auth.md). Tokens cannot
be minted from the CLI. muster token ls and muster token revoke <id> manage
them, and muster whoami says who a credential acts as.
agent create is the one exception: it presents MUSTER_AGENT_CREATE_TOKEN, a
token of scope Start agents only (agent-create), and never sends
MUSTER_TOKEN. The server refuses every other token on POST /api/agents, a
full-access one included, so the ordinary credential cannot create agents.
Where it is read from:
- One tenant: from the env file, then the environment, like the token. An
exported
MUSTER_API_URLalone still pairs with the file's tokens here (the one-tenant path mixes sources field by field), so the file's agent-create token follows it, exactly as the file'sMUSTER_TOKENdoes. - More than one tenant: the pair rule below covers it too. It comes from
the selected tenant's file, or from the environment only beside an
environment
MUSTER_API_URL+MUSTER_TOKENpair. An exported one with neither makes it unusable for that tenant:agent createrefuses (exit 2, nothing sent) and says where to put it; every other verb runs as usual, since none of them sends it. - A flag pair (
--api-url+--token) cannot carry one: there is no flag for it, and an exported one beside a flag pair names no server's pair. On a host with more than one tenant,agent createwith a flag pair is therefore refused; use the tenant's file or an environment pair.
A tenant is a separate muster server, at its own URL, with its own credential. On this host each one is an env file:
⚠ Not on Windows. The Windows CLI refuses tenant files (it cannot open
them without following a symlink, nor check that only you can read them), so
muster tenant add there writes a file that every command selecting that tenant refuses. On
Windows use the default ~/.muster/muster.env, or --api-url and
MUSTER_API_URL / the token variables per call; WSL (Linux) has tenants.
~/.muster/muster.env # tenant "default": today's file, unchanged
~/.muster/tenants/work.env # tenant "work" (0600; the directory 0700)
~/.muster/current # one line naming the current tenant; absent = default
printf '%s\n' "$TOKEN" | muster tenant add work --api-url https://muster.example.com
muster tenant list # name, label, origin, current; never a token
muster tenant use work # writes ~/.muster/current
muster --tenant default task ls # one call on another tenant
muster tenant current # which tenant, and whether flag/env/file/default chose it
muster tenant use --clear # deletes ~/.muster/current
muster tenant remove work- Selection, highest first:
--tenant,MUSTER_TENANT,~/.muster/current,default.--env-filemeans "this file, not a tenant": it is refused next to--tenantand wins overMUSTER_TENANTandcurrent. tenant addreads the token from stdin, never argv (--tokenis refused there). It refuses the namedefault, a name that exists, and an origin another tenant already has. It checks the token withGET /api/whoamibefore it writes the file, and prints the origin and the principal.- A tenant file readable by group or others, or a symlink, is refused. An
optional
MUSTER_TENANT_LABEL=line in it sets the labeltenant listshows. tenant usere-targets every script on this host that runs the CLI without naming a tenant. Such a script should setMUSTER_TENANT.
The pair rule. A host with no tenant file (no entry at all under
~/.muster/tenants/), no current file, and nothing setting MUSTER_TENANT or
--tenant resolves exactly as before, field by field (configuration).
Everywhere else the selected file supplies the URL and the token as a pair.
A URL override (MUSTER_API_URL, --api-url) and a token override
(MUSTER_TOKEN, MUSTER_HOOK_TOKEN, --token) are accepted only together, and
only from one kind of source: --api-url with --token, or MUSTER_API_URL with
MUSTER_TOKEN/MUSTER_HOOK_TOKEN. One without the other, or a flag paired with
an exported variable, exits 2 and sends nothing. This is what stops one server's
token reaching another server. tenant use --clear alone does not lift it while
tenant files remain. doctor --deploy-env follows it too: a deploy file that
sets MUSTER_PUBLIC_URL without MUSTER_HOOK_TOKEN is refused rather than
paired with the selected tenant's token.
tenant add writes the file atomically (a temporary file, then a link that
never replaces an existing tenant), refuses a symlinked ~/.muster/tenants/,
tightens a group- or world-accessible one to 0700, and warns on stderr when the
origin is http:// (the token then travels in cleartext). A file under
~/.muster/tenants/ named with --env-file gets the same 0600 and
not-a-symlink checks as --tenant, and so does a symlink elsewhere that points
at one (it is refused as a symlinked tenant file).
Any entry under ~/.muster/tenants/ keeps the host off the zero-touch path,
including one that is not a tenant (a .add-* file left by an interrupted
tenant add, say). tenant list names such entries on stderr, and so does a
pair-rule refusal, so you can see why; remove what you do not need.
The design behind tenants is in docs/design/multi-tenant.md.
What is printed. stdout stays JSON. With more than one tenant, a tenant
chosen by ~/.muster/current is named on stderr (tenant: work (muster.example.com));
an explicit --tenant or MUSTER_TENANT is not echoed. With more than one
tenant, the version-skew note, the credential error and the route-absent error
name the tenant too, and the credential error names that tenant's file.
This repository is public, so the CLI can be fetched and pinned by revision. In
a downstream flake, add muster.url = "github:ZacxDev/muster" and use
muster.packages.${system}.muster-cli.
- The output is
muster-cli, and the binary ismuster. The output is not namedmuster, because that name belongs to the service. - The binary answers to whatever name you invoke it as. It uses
argv[0]for its help text, its error prefix and its version-skew note. So you can symlink it under another name, and nothing else changes.
nix run github:ZacxDev/muster#muster-cli -- task ls
go build -o muster ./cmd/muster # or plain GoChecks a muster installation end to end from the machine it runs on, and
prints how to fix each failure. INSTALL.md and install.sh end with it.
muster doctor --deploy-env <deploy-env-file> # on the machine running the server
muster doctor --api-url https://<your-muster-address> # on any other machineOn a machine other than the server, the doctor needs the server's address:
--api-url, or MUSTER_API_URL in the environment or in the env file. The API
URL has no default, so without one the doctor stops before checking anything.
INSTALL.md's "Check it" passes --api-url there.
The deploy file is the server's own .env when it sets the password and the hook
token; a Compose stack that generated them (no .env, quickstart-local.md)
prints them with docker compose exec muster /muster-server show-secret ui-password
(and hook-token), and INSTALL.md's "Check it" writes them into a private file for
--deploy-env.
| check | PASS means | read from |
|---|---|---|
server |
GET /health answers muster's document, over https |
the server |
manifest |
/manifest.webmanifest is a standalone manifest with icons |
the server |
hook-token |
the server enforces a hook token and accepts this one | GET /api/doctor |
mirror-hosts |
every host holding a live mirror token is connected | GET /api/doctor (the tunnel hub) |
this-host |
the server accepts THIS machine's mirror token and holds a connection from it | GET /mirror/host, with the token muster-mirror's settings file names |
mirror-service |
the muster-mirror user service is active here |
systemctl --user is-active (Linux), launchctl print (macOS) |
tmux |
tmux is installed here | tmux -V |
sign-in |
the operator password signs in, and the session opens the board | POST /login, then GET /tasks |
push |
the VAPID keys are set | GET /api/push/vapid-public-key (signed in), else GET /api/doctor |
dictation |
a bundled 1.7 s spoken sample comes back as text through POST /transcribe. Dictation off on the server is a SKIP: it is an optional feature. Misconfigured (MUSTER_STT_URL without MUSTER_STT_TOKEN) is a FAIL |
the server and its speech-to-text service |
features |
no feature the server reports is misconfigured (asked for, with a dependency missing); a feature that is merely off is not a failure. Every feature is listed below the checks, with its state and the line that turns it on | GET /api/doctor |
officers |
each officer declared for you (in MUSTER_OFFICERS or the database) can start an instance: a pod officer has the agent plane; a host officer's machine is connected, starts and closes agent windows, finds claude and is logged in to Claude Code, and has the officer's repository on -agent-spawn-repos (an officer with no repository needs none: it starts in a scratch directory). Each FAIL names the officer, what is in its way and the fix; no officer is a SKIP |
GET /api/doctor (the hub's view of each host's readiness) |
mcp-endpoint |
this machine's muster-mirror serves its local MCP endpoint (MUSTER_MIRROR_MCP_LISTEN in its settings) and has written its secret where muster-mirror keeps it (MUSTER_MIRROR_MCP_SECRET_FILE, else the user config directory: $XDG_CONFIG_HOME or ~/.config on Linux, ~/Library/Application Support on macOS). Unset is a SKIP: the agent ask tool is optional |
this machine's muster-mirror settings |
mcp-registration |
one of Claude Code's scopes for this directory registers that endpoint (any loopback spelling: localhost, 127.0.0.1, ::1; same port, path /mcp), so sessions here have muster's tools. A registration in only the local or project scope passes and says sessions elsewhere have none. A FAIL prints the exact claude mcp add-json command and the export MUSTER_MIRROR_MCP_SECRET=… line with the secret's path in it (where the secret is), after the install step when no claude is on PATH, in ~/.local/bin or in ~/.claude/local |
~/.claude.json (user scope, and projects[<this directory>]), ./.mcp.json |
ask-hook |
Claude Code runs muster-mirror ask before AskUserQuestion (ask cards; the hook's matcher is a regular expression, so AskUserQuestion|Bash counts). Absent is a SKIP with the hook to add |
~/.claude/settings.json |
- Feature off: a route whose feature is off on the server (session routing for
route reply, plugins forplugins retry, …) answers a typed 404, and the CLI printsfeature <id> is disabled on this server — enable with: …and exits 12. A plain 404 from a server that predates the route is still exit 7. - Exit status: 0 when no check FAILs, 1 when any does. A
SKIP(a check that cannot be made from this machine, or--skip) never fails the run. - Output: the report and the QR code go to stderr; stdout is one JSON
document,
{"url", "ok", "checks": [{"name", "status", "detail", "fix"}]}, as for every other verb, wherever the two streams go. To read only the report (a terminal, or an agent whose shell merges the streams), send stdout away:muster doctor >/dev/null. INSTALL.md's "Check it" does. - Credentials: the server-side checks need a token (the hook token, or a
personal token; a personal token sees only its owner's hosts); without one
they SKIP.
--deploy-envreads the compose.env: itsMUSTER_PUBLIC_URLandMUSTER_HOOK_TOKENbeat the env file and the environment (only--api-url/--tokenbeat them), and itsMUSTER_UI_PASSWORDis used for the sign-in, push and dictation checks. 🔴 The password is sent only to that file'sMUSTER_PUBLIC_URL; pointed at any other server, sign-in SKIPs. this-hostreads muster-mirror's settings file (--mirror-env, default~/.config/muster-mirror/env) for its token file and itsMUSTER_MIRROR_URL, and asks THAT server with the token. 🔴 The token is never sent anywhere else: when doctor is checking a different URL, this check SKIPs and names the mirror's server. A refused token is a FAIL; so is a connection under this host's name made with another token (two machines minted under one name). It SKIPs on a machine with no settings file. On a team host machine whose connection is held for a manager (mirroring.md), it FAILs with "held: … give this code to a team manager: XXXX-XXXX-XXXX": doctor reads the code muster-mirror left (MUSTER_MIRROR_ATTEMPT_CODE_FILEin the settings file, elsemuster-mirror/attempt-codein the user config directory) and sends it, with the token, to the same server only, which answers whether that code is held, is the live connection's, or neither. When machines are held for the team host and this machine's code is missing, unreadable or neither (held_unknown), it FAILs naming the code file ("this may be a held machine") rather than PASS "connected".- Flags:
--skip <check>[,<check>…],--mirror-env,--mirror-unit(defaultmuster-mirror.service),--mirror-label(defaultio.github.zacxdev.muster-mirror). - The QR code of the URL is drawn with
qrencodewhen it is installed; the URL is printed either way. GET /api/doctoris behind the armed hook token: a server with noMUSTER_HOOK_TOKENanswers 503 with"unarmed": true, which is what thehook-tokencheck reports.
A live chief nudge is a notice
on your Asks list: a pointer at a session that looks like it is waiting on you.
nudge next prints the oldest notice whose session is on one host, with its
tmux target, for a key binding to jump to:
muster nudge next --host laptop # the oldest notice that has a target, one JSON object
tmux switch-client -t "$(muster nudge next --host laptop | jq -r .target)"- Host:
--host, orMUSTER_MIRROR_HOSTwhen it is not given (the name the host's muster-mirror reports). Neither is a usage error (exit 2). - What a notice is:
key,host,target(<tmux session>:<window index>, resolved by the server when asked, so a renumbered window resolves to its new index;""when no mirrored window holds the session now),title,why,sinceandage_secs, andurlwhen the server knows its public URL. A notice with no target is skipped. - Exit status of
next: 0 with the notice on stdout; 11 with nothing on stdout when no notice with a target is waiting on that host; 1 when the queue could only be partly read and none was found (it does not claim none is waiting); and the usual codes otherwise (3 for a refused credential). - Credential: a personal token or a bar-summary token. It reads the attention summary, which is a user's own, so the shared hook token is refused (exit 3).
pr-session reads GET /api/pr-sessions:
the Claude Code sessions recorded as creating a pull request, newest first.
That is the sessions that created it (create rows, newest first_seen, not
limited to routing's 30-day window), which can differ from the session a review
is routed to (routing takes the newest last_seen inside that window and also
matches a pushed head branch). It takes <owner>/<repo>#<n> or the pull
request's GitHub URL:
muster pr-session acme/widget#12
muster pr-session https://github.com/acme/widget/pull/12
claude --resume "$(muster pr-session acme/widget#12 | jq -r '.sessions[0].claude_session')"- stdout is the server's answer with a
resumefield (claude --resume <id>) added to each row; stderr repeats each row as a line — session id, host (or that no window showed it),first_seen,kind— followed by itsclaude --resume <id>line. - Exit status: 0 with at least one row; 4 with nothing on stdout when no session of yours is recorded as creating it; 2 for an argument that is not a pull request (nothing is sent); 12 when the server does not have pull-request routing configured (the read is served only there); and the usual codes otherwise (3 for a refused credential, 6 for an unreachable server, 7 for a server older than the read — its answer to the GET is a 405, since it has only the hook's POST — and 9 for a server whose hook tier is not armed).
- Credential: the ordinary one — a personal token reads its owner's rows, the shared hook token the machine user's.
asks log reads GET /api/asks/log — your asks,
newest first — and asks summary reads GET /api/asks/summary: counts by
kind, outcome and who answered, the median and 90th percentile time to an
answer, and the questions asked at least twice with their most frequent
answer. Both take the same filters: --kind, --runtime, --outcome,
--answered-by, --host, --repo, --session, --since, --until
(--since 7d, --since 36h or an RFC 3339 time); asks log also takes
--limit and --before (the previous page's next), asks summary --top.
muster asks summary --since 30d
muster asks log --kind plain_text --answered-by owner --since 7d | jq -r '.asks[] | [.answer_secs, .question] | @tsv'- stdout is the server's JSON and nothing else (there is no
--jsonflag: there is no other stdout); stderr repeats it as lines a person reads — one block per ask (a row whose text expired says so), or the summary and one line per repeated question. - Exit status: 0; 12 when the ask log is off on the server (the message
names
MUSTER_ASK_LOG=1); 3 for the shared hook token or any other refused credential; 2 for a filter the server does not know (a 400 naming it); and the usual codes otherwise. - Credential: a personal token (
mst_…). The log is a person's own; the hook token acts as the machine user and is refused.
| binary | what it is |
|---|---|
muster-server |
The service. Subcommands: mirror token create <host>, mirror token create <host> --team <id> (a team host token, audited in the team's log; mirroring.md), mirror token ls, mirror token revoke <id>, vapid generate, invite --claim-admin, user disable <id>, user enable <id>, `app install |
muster-migrate |
Applies the schema to DATABASE_URL. The server also migrates itself at boot. --rls-off and --rls-on are the row-level-security rollback tools (schema.md). |
muster-mirror |
The host agent for mirrored sessions. |
ccd |
The supervisor inside the claude-code agent image (provisioner.md). |
The container image (Dockerfile) ships /muster-server, /muster-migrate and
/agent-cli/muster. The flake builds muster-cli, muster-migrate,
muster-mirror and a migrator image (migrate-image).