Command reference
Command reference
coordinate <verb> [args]
| Verb | What it does |
|---|---|
daemon |
Runs the claim loop on this machine. Only one daemon can run per database. A second start fails with daemon already running (pid N) on stderr and exit 1, unless the previous daemon's heartbeat row is stale (crashed without cleanup) |
daemon restart |
Starts a replacement daemon from the current binary, then stops the running one. See Upgrades and restarts |
service install [--force] |
Installs a user service that starts the daemon. See Run as a service |
service uninstall |
Stops and removes the installed service unit |
service status |
Reports installed, enabled and running state by asking the system manager (systemctl --user is-enabled/is-active, or launchctl print) |
doctor |
Prints a health report (version, DB, config, daemon liveness via the heartbeat row, queue stats); exits non-zero on failed checks |
enqueue [options] -- <command...> |
Adds a job and prints its id |
enqueue --acp <agent> --cwd <dir> --prompt <text> |
Adds an ACP agent-session job; the daemon spawns the agent and drives one turn |
status [id] |
Shows one job as pretty-printed JSON with the payload decoded. Without an id it still prints the historical tab-separated rows |
status --self |
Shows the job whose id is in COORDINATE_JOB_ID |
jobs [--status a,b] [--kind a,b] [--search TEXT] [--sort id|created|priority|status|runtime] [--asc|--desc] [--limit N] [--json] [--watch] |
Lists jobs as a human table by default. With --json it prints the canonical v1 machine records, one JSON object per line. Use this form in agents and scripts |
stats |
Prints the job count per state as JSON |
wait-on <id> <event> |
Parks a job until the event is released |
release <event> |
Queues every job parked on the event |
cancel <id> |
Cancels a job |
dead retry <id> / dead retry --all |
Puts one failed or dead job back in the queue. --all requeues every one of them, including cancelled jobs, so you have to ask for it |
cap show |
Prints the machine cap, repo cap, running-job count and machine name as JSON. The machine name is the one the daemon recorded in the queue DB on claim, so it is correct even when COORDINATE_MACHINE isn't set for this command, which is common over ssh |
cap set --machine-cap N --repo-cap N [--force] |
Writes the runtime cap into the queue DB; the daemon reads it each time it claims a job. See Caps. --force accepts a decrease below the current running count |
events [--follow] [--since ID] [--job ID] [--kind a,b] [--search TEXT] |
Prints the event log, or follows it. The filters are applied server-side |
logs <id> [--attempt N] [--json] [--follow] |
Prints the captured output of the job's attempts. Without --attempt it prints the newest attempt's stdout and stderr files with a header; --attempt N reads that attempt, --json emits one machine record per attempt (paths and byte counts, no output), --follow tails new output |
why <id> [--json] |
Explains the job's live state from the current rows: the state, the blockers (waiting event, saturated caps, spent budget), the next step and the log pointers. --json emits the machine record |
health [--json] |
Emits one fixed summary object: daemon liveness, caps, per-state job counts, oldest queued age and slot usage. --json is the machine form (one JSON object); without it the same data prints as short lines |
lease acquire <key> [--cost N] [--wait DUR] [--owner ID] |
Acquires units of a weighted semaphore key, or waits in a first-in, first-out queue when the key is full. Prints the grant as JSON on stdout. Exit 3 on wait timeout, 4 when cancelled or ungrantable. No daemon needed |
lease release <grant-id> |
Releases a grant early; the next waiter is considered immediately |
lease refresh <grant-id> |
Extends a grant's TTL. Holders must refresh it, or it expires after COORDINATE_LEASE_S seconds |
lease cancel <wait-id> |
Cancels a queued wait |
lease list / lease waits |
Prints live leases or queued waits as NDJSON |
run [--wait DUR] [--key KEY] [--cost N] [--fail-fast] [--label TEXT] -- <cmd...> |
Runs a command under a tool lease. It chooses the key from the same table as the daemon, waits when that key is full, refreshes the lease during the run and releases it at exit. Commands that don't match the table run without a lease |
forward --exec <command> [--once] [--since ID] [--kinds a,b] [--cursor FILE] |
Runs a command for each event |
tui |
Opens the interactive triage screen. It needs a terminal |
Help and discoverability
Every verb has its own help screen. coordinate --help lists the verbs, coordinate <verb> --help documents one verb, and coordinate help <verb> prints the same screen. A group verb (lease, agent, cap, dead, service) has one screen per sub-verb, so coordinate lease acquire --help documents the acquire call and coordinate lease --help lists the sub-verbs.
The screens are plain text with no escape sequences when the output is piped, so an agent can read them without a terminal. Each screen has the same sections: a one-line summary, USAGE, ARGUMENTS, OPTIONS, COMMANDS for a group verb, EXAMPLES where they help, and a LEARN MORE pointer to this page.
A verb that does not exist exits 1 and prints a did-you-mean block with the closest matches, so coordinate statu points at status and stats.
coordinate --help with no other argument exits 1 (the CLI is waiting for a verb), while coordinate <verb> --help exits 0. An unknown verb exits 1 and names the command.
Watching dispatched jobs
A job can keep running after the agent turn that enqueued it, so set up a way to hear when it finishes.
- On the same machine, use
forward --exec. Test the command once first, because a failed--execholds the cursor at that event. - On another machine, run a local watchdog that checks
statsorstatusover ssh. Event sinks can't send across environments.
The agent skill has the full pattern.
Upgrades and restarts
Install new versions with mise, brew or install.sh. coordinate doesn't download its own updates.
A daemon running a compiled binary watches that file. Once a changed file is stable across two checks, the daemon records an upgrade_detected event, starts its replacement and exits. Set COORDINATE_NO_AUTO_UPGRADE=1 to turn this off. coordinate daemon restart does the same handoff on demand. Both start the replacement before the old daemon exits.
Restart or upgrade when no jobs are running. Queued and parked jobs aren't affected, but a restart can interrupt running ones:
- The old daemon leaves its running jobs alive, but their leases stop being renewed. When a lease expires, the new daemon kills what's left of that attempt.
- The job then runs again if it has attempts left. Otherwise it becomes
dead, so a running job with--max-attempts 1can't recover by itself. A job past its deadline becomestimed_out. - Commands start again from the beginning. ACP jobs try to load their saved session, but may repeat a turn.
Run as a service
coordinate service install sets up a user service that runs coordinate daemon.
| System | Service | Loaded with |
|---|---|---|
| Linux | systemd user unit at ~/.config/systemd/user/coordinate.service |
systemctl --user enable --now |
| macOS | launchd plist at ~/Library/LaunchAgents/sh.coordinate.daemon.plist |
launchctl bootstrap gui/$UID |
On Windows, run coordinate daemon yourself or from a scheduled task.
The service file stores the binary's absolute path, COORDINATE_MACHINE, COORDINATE_CAP, PATH and, if set, COORDINATE_DB. Later changes to your shell's PATH don't affect it. Running the install again does nothing if the file is identical. If it differs, pass --force to overwrite it.
Job output capture
The daemon captures every cmd attempt's stdout and stderr into files under the coordinate state directory, next to the queue DB: logs/<job>-<attempt>.stdout.log and logs/<job>-<attempt>.stderr.log. The job_logs table links each job and attempt to those files. ACP jobs use stdout for the protocol, so only their stderr is captured.
coordinate logs 7 # the newest attempt's output
coordinate logs 7 --attempt 2 # a specific attempt
coordinate logs 7 --json | jq -c '[.attempt,.stdout_bytes,.stderr_bytes]'
coordinate why 7 # state, blockers, next step, log pointers
If the state directory isn't writable, the job still runs and its output goes to the daemon's own streams. Use rg to search these files. --search on jobs and events only searches metadata.
Machine output
coordinate jobs --json prints one v1 record per line, ready for jq or while read. The payload is an object, and timestamps are epoch seconds. For every field and filter, see Machine output schema. Without --json the same query renders as a human table (id, state, age, attempts, priority, waiting-on, truncated command). The table layout can change, so use --json in scripts.
coordinate jobs --json --status queued,running --sort priority --limit 20 | jq -c '[.id,.status,.payload.cmd]'
coordinate jobs --watch # repaint the human table every second; Ctrl-C exits
The triage screen
coordinate tui shows the same table and job details as coordinate jobs. Its actions use the same queue operations as the CLI and record the same events. It's keyboard only and fails with tui: stdout is not a terminal; use coordinate jobs (or jobs --json) instead when stdout isn't a terminal.
| Key | Action |
|---|---|
| arrows or Ctrl-N / Ctrl-P | Move the selection |
/ |
Filter jobs by metadata substring (the same search as jobs --search) |
s |
Cycle the sort (id, created, priority, status, runtime) |
f |
Cycle the state filter (all, queued, running, waiting, failed, dead, done, timed_out) |
| enter | Toggle the details pane: decoded metadata, the computed why, recent events and the end of the newest stdout |
r |
Refresh |
x |
Cancel the selected job, after a y/n confirmation |
R |
Retry (requeue) the selected failed or dead job, after a y/n confirmation |
e |
Prompt for an event name and release it (the same as coordinate release EVENT) |
q or Ctrl-C |
Quit |
The screen updates about once a second. For scripts, use jobs --json and events.
TUI hooks
Hooks let you run your own commands from the triage screen. Assign one to any unused key under [tui] in config.toml. Pressing that key runs the named command with the selected job's v1 JSON on stdin. Inside the command string, {id}, {cwd}, {repo} and {status} are substituted with the shell-quoted job fields.
[tui]
w = "codex open {id} --cwd {cwd}"
The hook can use the terminal and has 30 seconds to finish. The status line shows its exit code and the first 400 characters of stderr. Like forward --exec commands, hooks run in their own process.
Tool and resource leases
A lease limits how many heavy tools run at once. Set the unit limit for each key under [slots] in config.toml. For example, "tool:vitest:*" = 4 covers every project. Each grant uses --cost units. Jobs and interactive sessions share the same limits. The design notes explain how leases relate to --slot.
Costs and slot limits are positive multiples of 0.25 (0.5, 1.25, 2), enforced at parse time. Fractions are exact in binary floating point, so repeated grant and release cycles never drift the accounting; other values are rejected with the rule text rather than rounded.
coordinate lease acquire tool:vitest:myproject --cost 2 --wait 60s
lease acquire checks the database itself, so it works without a daemon. A running daemon also grants waiting leases in the background.
When a key is full, requests wait in order. The wait is saved in the database and ends when the lease is granted, --wait runs out, someone runs lease cancel or the owner exits.
By default, the owner is the process that called the CLI. Keep that shell or wrapper running while the tool runs, or pass --owner. When an owner exits, coordinate releases its leases and cancels its waits. A lease that isn't refreshed also expires.
enqueue options
| Option | Meaning |
|---|---|
--shell |
The command is one quoted string run through the shell |
--cwd <dir> |
Working directory for the job |
--repo <key> |
Group jobs that must not run together. Defaults to the working directory; an empty --repo "" skips the repo key |
--priority <n> |
Higher numbers run first. Default 0 |
--max-attempts <n> |
How many times a job may be started. Default 3 |
--max-runtime <duration> |
A deadline such as 90s, 15m or 2h |
--run-at <when> |
Earliest start: a delay such as 30s, 15m, 2h, or an absolute ISO timestamp such as 2026-11-23T18:00:00Z. The job stays queued until then |
--wait-on <event> |
Park the job immediately until release <event>. Finishing a job releases only its tool: slot waiters, so a --wait-on job needs an explicit release |
--lane NAME |
Claim a budget lane from [lanes] config. Defaults to the job kind when a lane of that name exists, so acp jobs take the acp lane without the flag |
--acp <agent> |
Enqueue an ACP job for this agent instead of a command (needs --cwd and --prompt) |
--prompt <text> |
Prompt text for --acp jobs |
--registry <file> |
ACP agent registry JSON, {"<name>": {"command": ..., "args": [...]}}. The default path, bench/agents.stub.json under the daemon's working directory, is not shipped, so pass this option |
Sessions, seats and drift
audit looks for running agent processes and shows whether each has a job or seat. It classifies the processes it recognizes by process group, parent processes and leases:
| Class | Meaning |
|---|---|
queued |
The process group belongs to a running queue job |
seated |
An ancestor holds a coordinate lease (the seat wrapper) |
parked |
The process group belongs to a parked job |
unseated-t3 |
A T3 session with no seat: an ancestor is a T3 runtime process and no lease covers it |
ad-hoc |
No job, no seat, no T3 parent |
coordinate audit # human table plus a summary line
coordinate audit --json # one record per row, then a summary object
coordinate audit --drift-only # only sessions without a job or seat
unseated-t3 and ad-hoc count as drift. The audit only reports them. It doesn't stop processes or change leases.
With [observability] mode = "full" in config.toml, the daemon runs the audit once per lease period and records a session_drift event when the results change. The default, queue-only, leaves the audit off. To use full mode for one daemon run, set COORDINATE_OBSERVABILITY=full.
A seat is a lease on the machine's capacity (machine:<name>), which it shares with queued jobs:
coordinate run --key machine:laptop --cost 1 --label "t3:<thread>" -- devin acp
A seat costs exactly 1: the seat is the unit of budget, so a machine cap of 50 means 50 concurrent sessions. The seat cost is hardcoded in the T3 provider wrapper; there is no override.
When the machine is full, a seat queues (the coordinate run default is an unbounded FIFO wait), so a new provider session delays until capacity frees instead of erroring. --fail-fast opts back into deny semantics: exit 4 with {"error":"seat_unavailable"}. The T3 provider wrapper, scripts/coordinate-seat, queues and never passes --fail-fast. If coordinate itself is unreachable, the wrapper runs the provider unseated and logs coordinate_unavailable to stderr rather than blocking session start. --label records what the seat is for. scripts/coordinate-seat-install sets up the wrapper and writes a marker file in the state directory.
Lanes
[lanes] in config.toml gives one class of work a subcap of the machine budget, so it cannot starve the others:
[lanes]
batch = 4
A job claims the lane named by its --lane value (or its kind, when a lane of that name exists, so acp jobs take the acp lane without any flag). A lane's limit is also the cost each of its claims spends on the machine key: with batch = 0.5, two batch jobs share one unit and still leave room for a seat. A spent lane blocks only its own class; other lanes and unlaned jobs keep claiming. Seats always spend 1.
Environment
| Variable | Default | Meaning |
|---|---|---|
COORDINATE_DB |
$XDG_STATE_HOME/coordinate/queue.db |
Database file |
COORDINATE_CAP |
3 (6 when COORDINATE_MACHINE is vps) |
Jobs running at once on this machine |
COORDINATE_REPO_CAP |
1 | Jobs running at once per repo key |
COORDINATE_MACHINE |
laptop |
Name of this machine |
COORDINATE_LEASE_S |
30 | Seconds before a silent job counts as dead |
COORDINATE_ACP_CMD |
(unset) | Replaces the command from the registry with this command line (split on spaces) for every --acp job. The registry file must still load and list the agent |
COORDINATE_OBSERVABILITY |
(unset) | Overrides [observability] mode in config.toml: queue-only or full |
ACP agent sessions
enqueue --acp stores the agent, working directory, prompt and registry in an acp job. The daemon finds the agent in the registry, starts it as a detached process and talks to it over stdin and stdout. It uses the Agent Client Protocol: JSON-RPC 2.0 as newline-delimited JSON.
- It sends
initialize. - It sends
session/newon the first attempt, orsession/loadon later ones. - It sends one
session/promptturn.
The daemon saves the sessionId in the job payload as soon as it has one. If the daemon stops during a turn, the next attempt loads that session.
The job becomes done when the turn ends with stopReason: end_turn, and failed otherwise. When time runs out, the daemon sends session/cancel before it kills the process.