Skip to content

ops

Tools for the sessions that run the system above the coordinators: the operator, which watches health, cost and stuck sessions, and later the optimizer. The concept, the owner's decisions on it and what the hand-run coordinator watch learned are in the operator and watch guide (milestone Operator and optimizer).

The plugin holds four commands and two skills, watch and operator, the operator's desk that keeps the Session Board and the Question Boards fresh for every repository. ops-status is one read-only picture of the whole machine and of the repositories its coordinators work on, with a janitor section that lists what can be cleaned up; it uses no model and changes nothing except its own history file. ops-patrol runs it every 15 minutes from a systemd user timer, compares the picture with the previous run and pushes six alarms to the owner's phone through ntfy, with a heartbeat that the Raspberry Pi watches; the three watch conditions of ops-status (a coordinator's context size, idle with work, a missing wake trigger) join them only when the owner turns their push on, and an idle or full coordinator gets a short Sonnet judge in its own sandbox when the owner turns their judge on. ops-quota records the plan quota that Claude Code hands to the status line, and the turns that ended on a rate limit, into the log the other two read. ops-blocked tells the operator desk when a coordinator of a single milestone is completely blocked and may be archived after its hand-off. The Ops Board comes later and reads what they print.

Commands on the PATH

ops-status

ops-status                 # the snapshot as JSON
ops-status --text          # a page of at most 25 lines
ops-status --base-dir DIR  # the coordinators' worktree directory, if not the configured one
ops-status --no-history    # do not append to the history file
ops-status --no-janitor    # leave the janitor section out (advice for a person, not for the patrol)
ops-status --sessions      # ask every sandbox for its sessions, also while the snapshots are fresh

Every external command gets 5 seconds. A source that fails, times out or needs rights the user does not have does not fail the run: its section becomes {"unavailable": "<reason>"} and sources names it. The exit code is 0 whenever the arguments are valid, also on a machine where no coordinator has ever run (an empty coordinator list).

The sandboxes are asked for their sessions (one sbx exec each) only when a coordinator's snapshot is stale, which is all the patrol needs. A sandboxed coordinator with a fresh snapshot then shows session_live false and no session_name; --sessions asks them anyway, for the watch round, which messages a coordinator by its name.

It never runs coordinator status, which registers the calling session as coordinator; it reads the snapshot files that command writes. It never uses sudo.

No secret, token, report note or transcript content reaches the output: session names, ids, states, times and counts only.

ops-patrol

ops-patrol                 # one run: snapshot, compare, send what changed, heartbeat
ops-patrol --dry-run       # evaluate and list what would be sent; sends nothing, writes no state
ops-patrol --json          # the run as JSON instead of one line
ops-patrol --snapshot FILE # read a snapshot file instead of running ops-status (fixtures, replays)
ops-patrol --state FILE    # the state file, default ~/.local/state/ops/patrol.json
ops-patrol --env-file FILE # the token file, default ~/.config/claude-dev-doctor/claude-remote.env
ops-patrol --now TIME      # the current time, ISO 8601 (tests and replays)
ops-patrol --install       # write the systemd user units and enable the timer (no root)
ops-patrol --unit-dir DIR  # where --install writes, default ~/.config/systemd/user

Every run takes an ops-status --no-janitor snapshot (5 minutes at most; the history line is appended as usual, so the patrol is what gives the history its 15-minute baseline), works out which alarms are open, and sends a push only when one starts or clears. No model is called.

The six alarms (the owner's choice on the concept page, q10; sbx since #589, signin since #836):

Key Open when Start Clear
ci:<repo> ci.repos[].red and the failing run's created_at is more than 1 hour ago CI red on main for 1 h 30 min: owner/app, check failing since 08:30 CI on main green again: owner/app
unit:<unit> a claude-remote* unit is in units.down (claude-sandbox@* is not an alarm) Unit down: claude-remote@app.service (failed) Unit up again: …
coordinator:<repo> the coordinator's snapshot is stale (older than 30 minutes, or without a time) and its session does not run (session_live is not true; with session_unknown, only once the snapshot is older than 90 minutes) Coordinator stale: owner/tool, snapshot 1 h old Coordinator back: owner/tool
quota quota.five_hour or quota.seven_day used_percentage at 95 or more (level 95) or at 98 or more (level 98), the fuller window deciding; a change of level is a new start (quota levels) 7-day quota at 96% (95% or more, resets 2026-11-16T00:00:00Z): coordinators finish running work until it is merged or blocked and start no new work; 5-hour quota at 99% (98% or more, resets …): every session persists its work (commit, push, record state) and waits for the reset quota back below 95% in both windows: the quota rule is lifted
sbx:signed-out sbx.signed_in is false: sbx ls failed with not signed in (a revoked Docker sign-in) sbx not signed in on <host>: run sbx login as claude sbx no longer reports a lost sign-in on <host> (signed in again, or sandboxd stopped)
signin:<sandbox> signin.sandboxes[].state is expiring (the sandbox's Anthropic sign-in ends within 3 days, level expiring) or gone (past its end, an emptied or missing credentials file, or api.anthropic.com refusing it, level gone); a change of level is a new start, a sandbox that could not be probed (unknown) is undecided Anthropic sign-in of sandbox claude ends soon: the sign-in ends 2026-12-13 10:19 UTC. Renew it: sbx exec -it claude claude, then /login as the bot account Anthropic sign-in of sandbox claude is fine again

Quota levels

The owner's rule of 2026-11-13 (#774, it replaced the 80% / 90% levels of #504): at 95% of either plan window, the 5-hour ("daily") or the 7-day ("weekly"), the coordinators finish the work that is running, until it is merged or blocked, and start no new work; at 98% every session persists its work (commit, push, record state) and waits for the reset. The quota alarm is one alarm with a level, so it stays one of the six: 96% opens level 95, 99% moves it to level 98 (a new start), 96% again back to level 95 (a new start), and below 95% in both windows clears it. Each start and the clear is sent once; a level is not sent again until the figure has left it. The start line names the fuller window, its figure and its resets_at. Nothing stops a session: it is told, not interrupted.

Sender. The patrol sends both messages: the push to the owner as for every alarm, and the line to the sessions through a file. The patrol has no model and no way to message a session, so after every run that could read the quota it writes ~/.local/state/ops/quota-notice.json (the level, the line, an id that changes with the level, and the coordinator sessions of its snapshot), and the plugin's hook hooks/quota-notice.sh on UserPromptSubmit and PostToolUse adds the line to a session's context, once per crossing:

Level Who is told Line
95 the coordinator sessions (coordinators.repos[].session_id of the snapshot) ops-patrol: 7-day quota at 96% (95% or more, resets …): coordinators finish running work until it is merged or blocked and start no new work
98 every session ops-patrol: 5-hour quota at 99% (98% or more, resets …): every session persists its work (commit, push, record state) and waits for the reset
clear, or a lower level every session that was told an earlier level ops-patrol: quota back below 95% in both windows: the quota rule is lifted

A session hears the line with its next prompt or tool call; one that sits idle hears it when it works again. What each session was told is a small file per session in ~/.local/state/ops/quota-notice-seen/, written for every session the hook checks (so the hook stays in bash until the notice changes) and removed by the patrol after 8 days, except a record of the active notice (a crossing can last longer). Without a quota log the level is unknown: the notice stays as it is. A run with --state (a scratch run) writes its notice next to that state file, so live sessions are not told; --dry-run writes none. Sessions inside a Docker Sandbox do not share the host's state directory and are not told by the hook; the ops:watch round tells the sandboxed coordinators (the watch skill (plugins/ops/skills/watch/SKILL.md)).

sbx's sign-in (#589). Every snapshot reads it with one sbx ls --json while sandboxd.service is active: the sbx section is {"daemon": true, "signed_in": true}, or signed_in: false with reason: "sbx not signed in", or null with the reason when sbx failed otherwise (unknown: neither opened nor cleared). Without sandboxd (daemon: false) no sandbox runs and nothing needs the sign-in: no alarm. Signed out, no sandbox can be asked, so a stale coordinator's session_unknown is sbx not signed in and its alarm stays undecided however old the snapshot: sbx:signed-out is the alarm that speaks, not Coordinator stale. The way back is in linux-host.md.

A stale snapshot alone is no alarm (#556). A coordinator that has ended its check-in and waits for the owner writes no snapshot, so its snapshot ages while its session runs; the patrol stays quiet as long as session_live is true, and ops-status --text shows it as STALE (session alive). A coordinator in a Docker Sandbox runs in the VM, where the host's claude agents does not see it: for a stale snapshot the host does not list, ops-status asks sbx exec <name> claude agents --json --all in each running sandbox, and only then; the sandboxes are those of the snapshot's one sbx ls --json, which runs only while sandboxd.service is active (sbx starts a daemon when none runs). A coordinator whose session ended, or whose sandbox is stopped, alarms on the first run after its snapshot turned 30 minutes old, within 45 minutes. A running sandbox that does not answer (sbx ls or its sbx exec fails or takes longer than 20 seconds) may hold the session: session_live is null, session_unknown says which sandbox, and the alarm is undecided — neither opened nor cleared — until the snapshot is 90 minutes old; after that it opens with the reason. When the host's claude agents itself fails, a stale snapshot alarms as before. A session that runs but hangs is not told apart from one that waits: no model is called to ask it.

The "red for an hour" clock starts at the failing run, not when the patrol first saw it: a red main at 10:00 gives one push shortly after 11:00 ("CI red on main for 1 h"), and the first run after it turns green one push "green again". A new failure after that starts a new hour. A new failing run on a repository that is already red keeps its alarm open: red for less than an hour is undecided (unknown: ci:<repo> in the summary), it neither opens nor clears.

One notification per transition. The state file holds one record per open alarm with the time its start went out. The next runs are silent while it stays open; after 6 hours without a change it is reminded once (Still open after 6 h: …), and again every 6 hours. A clear is sent once and the record removed. A notification that could not be delivered (ntfy unreachable, a refused token, no values configured) leaves the record as it was, so the next successful run sends it. A source that ops-status could not read ({"unavailable": …}, one repository whose gh run list failed, or one systemctl scope in unavailable_scopes) neither opens nor clears its alarms: they stay as they were until the source is back. After a reboot the first run compares with the stored state, not with nothing, so there is no burst of notifications. A start has ntfy priority high (4), a clear and a reminder the default (3).

Heartbeat. After every run the patrol calls the Uptime Kuma push URL (…/api/push/<token>?status=up&msg=<n alarms open>&ping=). When the patrol stops, the host is down or the network is gone, the push monitor on the Pi reports "heartbeat missing" after 30 minutes, through the same ntfy topic. A run whose snapshot failed (ops-status exited non-zero, timed out after 5 minutes or printed no JSON) sends status=down with the reason as msg, so a broken ops-status shows up on the Pi as well; its alarms are neither cleared nor re-sent until a snapshot is back. A run without a heartbeat URL says no heartbeat URL.

Kill switch. While the file ~/.config/ops/off exists ($XDG_CONFIG_HOME honoured) the patrol sends nothing, takes no snapshot and leaves the state as it is; the run prints off and exits 0. The heartbeat stops too, so the Pi reports the patrol missing after 30 minutes: that is the intended answer to "is it off?". Pause the push monitor on the Pi for a planned silence.

Exit code. 0 when the run completed and everything it owed was delivered; 1 when the snapshot failed, a notification could not be sent or the heartbeat was refused, so systemctl --user status ops-patrol.service shows the last failure. The one-line summary names the counts: ops-patrol: 4 alarms open, 4 opened, 4 sent, heartbeat ok. --json prints the open and unknown keys, the notifications, what was sent or failed and the heartbeat result.

State. ~/.local/state/ops/patrol.json ($XDG_STATE_HOME honoured), written atomically. An unreadable file is replaced and the run says state file unreadable, starting over.

Secrets. Four values, read from the environment first and from the host's token file ~/.config/claude-dev-doctor/claude-remote.env otherwise (surrounding whitespace and one pair of quotes are trimmed; no value ever reaches the output, a command line or the process list):

Key Value
OPS_NTFY_URL the topic URL, http://<pi>:8090/operator-alarms
OPS_NTFY_TOKEN a write-only ntfy access token for that topic
OPS_HEARTBEAT_URL the Uptime Kuma push URL up to and excluding the ?: http://<pi>:3001/api/push/<token>, used as it is; a ?status=… query pasted with it is dropped
OPS_HEARTBEAT_TOKEN the push monitor's token; only appended when the URL ends at /api/push, without a token

Both URLs must be http or https with a host; any other scheme (file://, ftp://) is refused before a request is made and counts as a failed send. A redirect is not followed: it counts as a failed send too.

They arrive on the host with the Bitwarden sync (vault.sh sync, project dev, #414), or by hand with bash scripts/linux/set-token.sh OPS_NTFY_TOKEN and the other three keys: hidden input, never a command-line argument.

Timer. ops-patrol --install writes ~/.config/systemd/user/ops-patrol.service and ops-patrol.timer (OnCalendar=*:0/15, Persistent=true; the service runs this plugin's bin/ops-patrol with the token file as EnvironmentFile, so gh has its token too), runs systemctl --user daemon-reload and enable --now ops-patrol.timer, and needs no root. From a Claude Code session, which has no XDG_RUNTIME_DIR, it reaches the user manager at /run/user/<uid> as vault.sh timer does. Two things to know:

  • The user manager runs without a login only while the user lingers. When --install cannot reach it, the units are still written and the owner's one command is printed: sudo loginctl enable-linger claude, then the two systemctl --user commands.
  • The unit names the plugin's path. Run from the marketplace checkout the host keeps current (git pull on main), the path stays; run from an installed copy, it changes with each ops version, so run --install again after an update (the install is idempotent).

Check it: systemctl --user list-timers ops-patrol.timer shows the next run, journalctl --user -u ops-patrol.service -n 5 the last summary lines.

The Pi side, as the hub session set it up on the Raspberry Pi 5 (Debian 13, Docker): ntfy and Uptime Kuma as one Docker Compose project, reachable from the host over Tailscale and the LAN only (no Caddy route and no tunnel: the owner's choice; a route behind the Pi's Caddy proxy would only be needed for a phone outside Tailscale). Step by step, on the Pi:

  1. Containers. A docker-compose.yml with two services, restart: unless-stopped, named volumes: binwiederhier/ntfy:v2.33.1 (serve, port 8090:80, volume on /var/cache/ntfy and /etc/ntfy) and louislam/uptime-kuma:2.5.7 (port 3001:3001, volume on /app/data). docker compose up -d.
  2. ntfy, closed by default. In /etc/ntfy/server.yml: base-url: http://<pi>:8090, auth-file: /var/cache/ntfy/user.db, auth-default-access: deny-all. Then one user per writer and reader, and a token for each machine, inside the container: ntfy user add <host>, ntfy access <host> operator-alarms write-only, ntfy token add <host> (the host's OPS_NTFY_TOKEN); ntfy user add kuma, ntfy access kuma operator-alarms write-only, ntfy token add kuma (for Uptime Kuma); ntfy user add owner, ntfy access owner operator-alarms read-only (the phone). Check: an anonymous curl -d test http://<pi>:8090/operator-alarms answers 403.
  3. Uptime Kuma. Open http://<pi>:3001, create the admin account. Settings → Notifications → Setup Notification, type ntfy: server URL http://<pi>:8090, topic operator-alarms, authentication Access Token with the kuma token, priority default; "Default enabled" on.
  4. The heartbeat monitor. Add New Monitor, type Push, name <host> patrol heartbeat, heartbeat interval 1800 seconds, retries 0. Kuma shows the push URL http://<pi>:3001/api/push/<token>?status=up&msg=OK&ping=: the part before the ? is the host's OPS_HEARTBEAT_URL, the token OPS_HEARTBEAT_TOKEN. Enable the ntfy notification on it.
  5. The host monitor. Add New Monitor, type Ping, hostname the host's Tailscale name, interval 60 seconds, the same notification. (Ports 80 and 9090 on the host are closed, so a ping and not an HTTP check; the heartbeat covers the patrol itself.)
  6. The phone. Install the ntfy app, add the server http://<pi>:8090 (reachable through Tailscale on the phone) with the owner user, subscribe to operator-alarms.
  7. The host. Put the four values into the Bitwarden project dev or the token file (above), run ops-patrol --install, then force one alarm from a fixture to see the whole path:
ops-patrol --snapshot plugins/ops/scripts/fixtures/patrol-alarms.json --state /tmp/<dir>/patrol.json
ops-patrol --snapshot plugins/ops/scripts/fixtures/patrol-alarms.json --state /tmp/<dir>/patrol.json   # silent
ops-patrol --snapshot plugins/ops/scripts/fixtures/patrol-quiet.json --state /tmp/<dir>/patrol.json    # "green again"

The first run sends the fixture's four starts once (and a heartbeat), the second run sends only the heartbeat, the third the four clears. The scratch state file keeps the live state clean.

The watch conditions as alarms. The three watch conditions of ops-status push only when alarms.<name>.push is true in ~/.config/ops/config.json; by default they show on the page and the patrol stays silent (the owner wants one status page and at most three owner-facing items a day, q03 and q04). With push on, the start, clear, 6-hour reminder, kill switch and unknown-source rules above apply to them as well:

Key Open when Start Clear
context:<session> watch.context.items[] Coordinator context warning: cloud/app at 412k tokens (limit 400k), 64.20 USD Coordinator context back below 400k: cloud/app
idle:<repo> watch.idle.items[] Coordinator idle with work for 30 min: owner/app, 1 free, queue #256 Coordinator no longer idle with work: owner/app
trigger:<session> watch.trigger.items[] Cloud coordinator without a wake trigger: cloud/app Wake trigger back: cloud/app

A context alarm that moves from warning to urgent, or back, sends one new start with the new level. Turning push off drops that kind's open alarms without a clear. A condition that is unavailable (the session cache older than 30 minutes, a stale coordinator snapshot) neither opens nor clears; for a stale coordinator the coordinator:<repo> alarm is the one that speaks.

Not in scope here: more alarm types (the owner's choice on the concept page), alarms by e-mail. The one action beyond notifying is the judge.

The judge

The owner's decisions on #531 (#644): when idle or context opens for a coordinator and alarms.<name>.judge is true, the patrol starts a short headless judge session inside that coordinator's sandbox, from the host:

sbx exec -w <folder> <sandbox> claude -p "<the condition>…" --model sonnet --max-turns 25 \
  --max-budget-usd 1.50 --output-format json --allowedTools "…" --name "ops-judge idle:owner/app"

The judge runs one round of the watch skill for that one coordinator: it reads ops-status, decides whether and how to nudge, sends at most one watch: line with SendMessage and ends with JUDGE: nudged|held|none — <reason>. The patrol calls no model itself (#372); it starts the judge after the heartbeat and the saved state and waits for it, at most 7 minutes.

Rule
Cooldown once when the condition opens, then at most every 2 hours while it stays open; a condition that closes forgets its record, so reopening judges again. A condition of an unknown source keeps its record.
No run while sbx is not signed in (#589: the sbx:signed-out alarm says why), or while the coordinator's sandbox or folder is not known (a coordinator on the host): a skip, logged once per reason, and due again next run
Bounds Sonnet, 25 turns, 1.50 USD, 7 minutes per judge, at most 4 per run, all at once (the rest stay due for the next run); a failed launch counts as a run, so the cooldown bounds it too, and a judge that ends on a limit still logs its cost and turns
Kill switch ~/.config/ops/off stops the patrol and with it every judge
Sandboxes with a judge (or the context push) on, the patrol runs ops-status --sessions: an sbx exec per sandbox gives each coordinator its sandbox, its folder (session_cwd) and its context

Log. One JSON line per judge run, and per change of skip reason, in ~/.local/state/ops/judge.log next to the state file: at, key, sandbox, folder, outcome (nudged, held, none, failed, skipped), reason (the judge's one line, at most 200 characters), cost_usd, turns. Never the judge's answer or a transcript. The judge's own round also appends its line to watch.log inside the sandbox. --dry-run lists would judge <key> without starting one; the summary line counts them (judge 1 nudged). Turn it on:

{"alarms": {"idle": {"judge": true}, "context": {"judge": true}}}

Check it on the host: tail ~/.local/state/ops/judge.log, and journalctl --user -u ops-patrol.service -n 5 for the summary line.

ops-quota

ops-quota statusline               # the status line: log the numbers, print "5h 41%  7d 60%"
ops-quota statusline COMMAND [ARG …]  # the same, then run COMMAND on the same stdin and pass its
                                   # output and exit code through unchanged
ops-quota hook                     # the StopFailure hook: log one rate-limit event
ops-quota notice                   # the quota notice hook: hand the patrol's quota line to this session once
ops-quota --log FILE …             # another log file (tests)

On the Max plan the real limit is the 5-hour and the 7-day usage window, shared by every session on the account, and Anthropic offers no usage API for it. Claude Code hands the numbers to the status line command with every update (rate_limits.five_hour and seven_day, each used_percentage and resets_at), and ends a turn that hit the limit with the StopFailure hook. ops-quota sits at both ends and appends what it sees to one log:

~/.local/state/ops/quota.jsonl   ($XDG_STATE_HOME honoured; at 5 MB it moves to quota.jsonl.1)

A numbers line is {"at", "session", "rate_limits": {"five_hour": {"used_percentage", "resets_at"}, "seven_day": {…}}, "cost_usd"}, an event line {"at", "session", "event", "resets_at"}; times are ISO 8601 UTC (the status line's epoch seconds are converted). Nothing else of the status line or the hook input is written: no prompt text, no tool output, no error message, no path. ops-status shows the newest numbers and the events of the last 24 hours in its quota section, and ops-patrol raises the quota alarm from them.

Sandboxes (#774). The sessions in a Docker Sandbox log into the VM's own ~/.local/state/ops/quota.jsonl, which the host does not share. Every snapshot therefore reads the last 200 lines of that log from each running sandbox (one sbx exec each, in parallel; a sandbox that cannot be asked adds nothing) and takes the record with the newest at of all the logs: the numbers are per account, so one fresh reader anywhere is enough. Set the status line below in each sandbox's ~/.claude/settings.json too (a host step for the owner, see the issue's host-step page); until a session there runs it, the sandbox adds nothing.

The status line. It is a user setting a plugin cannot ship. Point it at the launcher in ~/.claude/settings.json; on a host that loads the marketplace from a checkout:

"statusLine": {
  "type": "command",
  "command": "<checkout>/plugins/ops/bin/ops-quota statusline"
}

To keep an existing status line, give its command and arguments after statusline: the wrapped command is found on the PATH (on Windows a bare bash is Git Bash, not the WSL launcher in System32), gets the same JSON on stdin, and its output and exit code are passed through unchanged. With the workflow plugin's badge, for example:

"command": "<checkout>/plugins/ops/bin/ops-quota statusline <checkout>/plugins/workflow/bin/coordinator statusline"

A machine that installed the plugin from GitHub runs the newest cached copy instead:

"command": "bash -c 'd=$(ls -d ~/.claude/plugins/cache/<owner>/ops/*/ 2>/dev/null | sort -V | tail -1); [ -n \"$d\" ] || exit 0; exec \"${d}bin/ops-quota\" statusline'"

The status line stays fast: no network, one read of the log's tail and at most one append, and at most one line per session per minute (Claude Code runs the command after every update, debounced at 300 ms). A status line JSON without rate_limits (an API key, or before the first response of the session) writes nothing and prints nothing. Whatever goes wrong with the log is one line on stderr and never the status line's problem: the summary or the wrapped command still runs.

The hook. hooks.json runs ops-quota hook on StopFailure with the matcher rate_limit|billing_error, so every session with the plugin installed records its hits; nothing to configure. The hook input carries no reset time, so the event takes the resets_at of the fuller window from the last logged numbers, when there are any and that time is still ahead. Its output is ignored by Claude Code, and it never blocks.

Two sessions reporting 41% and 43% within a minute give two lines; ops-status shows the newer, 43%, with its reset time. Not in scope here: OpenTelemetry, ccusage, GitHub billing, and alarms on the numbers (ops-patrol).

ops-blocked

ops-blocked round [--base-dir DIR]     # judge every coordinator snapshot, record the round
ops-blocked record REPO asked          # the desk sent the hand-off question
ops-blocked record REPO need-input     # the desk reported that the session needs input
ops-blocked record REPO archived       # the desk archived the session
ops-blocked record REPO denied [--session ID]  # the archive was refused: prints the owner's command

The owner's rule (#475): a coordinator that runs for a single milestone and is completely blocked writes down what it holds only in memory and is then archived. ops-blocked decides; the operator desk sends the question and archives the session.

Who. The rule reads the focus of each coordinator's status snapshot (coordinator focus --milestone M --umbrella N of workflow:coordinator). It applies only to a focus of exactly one milestone and no extra issue numbers (several_milestones otherwise); a coordinator without a focus is repository_wide. Neither is ever asked or archived, and nothing is read for them.

Completely blocked, read from the status file and GitHub (gh with the host's login, reads only):

  • the snapshot's live_workers is 0 (the coordinator's own count, not claude agents, which sees one machine; a stale snapshot still counts, since a coordinator parked for the owner stops writing it);
  • every open issue of the milestone but the umbrella issue is held: needs:human, agent:parked, agent:hold, the other host's needs:windows (on Linux) or needs:linux (on Windows), an open blocked-by relationship, or an open pull request that waits for the owner;
  • every open pull request that closes one of those issues waits only for the owner: no draft, no conflict, at least one check and every check passed, and needs:owner-merge, needs:owner-approval or that issue's own needs:human (a pull request closing several issues is judged per issue).

A milestone that is not open, one with 100 or more open issues, 100 or more open milestones without it, 200 or more open pull requests, or a failed read is unknown: the count of blocked rounds stays as it was. So is a hand-off read that finds 100 or more comments since the question and no hand-off among them: it is never counted as unanswered.

The rounds. Each round is one round of the desk, and the state file ~/.local/state/ops/blocked.json ($XDG_STATE_HOME honoured) counts the blocked rounds in a row per repository; a round that is not blocked, a new coordinator session or a new focus starts the count again. A snapshot that cannot be read keeps what was recorded for its repository. The action of each entry:

Rounds Action
the first blocked round none
the second, with an umbrella issue ask, with message: the question for a hand-off comment on the umbrella issue whose first line is ## Coordinator hand-off; repeated each round until record asked
the second, without an umbrella report once: "umbrella unknown"; never asked or archived
after record asked, the hand-off comment is there, written by the owner or a collaborator (author_association OWNER, MEMBER or COLLABORATOR; on a public repository anyone else can comment too) archive, with ack, the comment's link; repeated until record archived or denied
two rounds after record asked, no hand-off report once: "hand-off unanswered"; not archived unless the hand-off still comes
after archived or denied none, verdict done, and nothing is read for that session again

The acknowledgement is the comment itself: one created on the umbrella issue since the round that asked, starting with the marker. denied prints owner_step (the session's link when --session is given) and owner_command, the jq line that adds mcp__claude-code-remote__archive_session to permissions.allow in ~/.claude/settings.json.

The snapshot

base_dir is the coordinators' worktree directory: --base-dir, else base_dir in ~/.config/workflow-coordinator/config.json ($XDG_CONFIG_HOME and WORKFLOW_COORDINATOR_CONFIG are honoured, as coordinator config does).

Field Meaning Source
version snapshot format, 1 —
generated_at when the snapshot was taken, local time the clock
host short machine name, lower case the host name
os linux, windows, darwin Python's platform.system()
coordinators.repos[] one entry per coordinator snapshot <base_dir>/.coordinator/*.status.json
….repo the repository it coordinates the snapshot's repo
….session_id, ….session_name, ….session_live, ….session_sandbox, ….session_unknown the coordinator session, its name, whether its process runs (null when a sandbox that may hold it did not answer), the Docker Sandbox it runs in (null on the host), and, only then, which sandbox did not answer the snapshot's coordinator.session_id, matched in claude agents --json --all; for a stale snapshot the host does not list, also in sbx exec <name> claude agents --json --all of every running sandbox
….written_at, ….age_minutes, ….stale when the snapshot was written; stale when older than 30 minutes or without a time the snapshot's written_at
….live_workers, ….max_workers running workers and the ceiling the snapshot
….tasks, ….findings, ….questions, ….leftovers tracked tasks, open findings over all tasks, open owner questions, leftovers the snapshot's tasks[].findings, questions, leftovers
….file, ….error instead of the above, for a snapshot that cannot be read the file
maintenance.runs per maintenance task: at and result of its last run (no notes) <base_dir>/.coordinator/maintenance.json
maintenance.problems the tasks whose last result is problem or failed same
sessions.live sessions with a running process claude agents --json --all
sessions.interactive of those, the interactive ones same
sessions.background_states background sessions counted by state, finished ones included same
sessions.waiting[] live sessions whose state or status is blocked or waiting: name, id (8 characters), kind, state, waiting_for, waiting_minutes (null when the data has no time) same
units.units[] unit, scope (system, user), active, sub, since, restarts systemctl [--user] show for the loaded units matching claude-remote* and claude-sandbox@*
units.down units that are not active same
units.unavailable_scopes a scope that could not be read, with the reason (the user bus is often missing in a service) same
machine.cpus, machine.load CPUs; load average over 1, 5 and 15 minutes os.cpu_count(), /proc/loadavg
machine.mem_total_gb, machine.mem_available_gb memory /proc/meminfo
machine.uptime_hours uptime /proc/uptime
machine.disks[] path, free_gb, used_percent for / and the home directory, once per file system shutil.disk_usage
machine.reboot_required, machine.reboot_packages a pending reboot and the packages asking for it /var/run/reboot-required, /var/run/reboot-required.pkgs
updates.count upgradable packages apt list --upgradable
ci.repos[] per repository a coordinator works on: repo, red (the latest run of a workflow failed), and workflows[] with the latest run of each workflow on main (name, status, conclusion, created_at, url); a repository that cannot be read has unavailable gh run list -R <repo> --branch main; gh auth status only when every repository failed
quota.five_hour, quota.seven_day the newest used_percentage and resets_at of the plan quota ~/.local/state/ops/quota.jsonl, written by ops-quota
quota.at, quota.limit_events_24h when those numbers were logged; rate-limit events in the last 24 hours same
sbx sbx's Docker sign-in (#589): daemon (sandboxd.service active), signed_in (true, false, or null when not known), reason when sbx did not list, host one sbx ls --json, only while sandboxd.service is active
signin.sandboxes[] each running sandbox's Anthropic sign-in (#836): name, state (ok; expiring within 3 days of its end; gone past it, with an emptied or missing credentials file, or refused; unknown when the sandbox gave no answer or api.anthropic.com none at all), ends_at (the refresh token's end, a time, never the token), detail, step (the owner's step while expiring or gone: /login, or recreating the sandbox when a variable or helper outranks the sign-in) one sbx exec per running sandbox with the probe of sandboxes.sh status: the token reaches curl through a config on stdin, only a code, a word and a time come back
….free_slots the coordinator's free worker slots the snapshot's slots.free
boards.owner who syncs the two boards: coordinator or operator (#374) boards_owner in the coordinator config
boards.session the Session Board's age_minutes and stale (older than 30 minutes or never synced); note instead when no session_board is set the mtime of <base_dir>/.coordinator/sessions.cache.json
boards.questions[] per repository with a saved Question Board snapshot: repo, age_minutes, stale (older than 60 minutes), rows; empty without a question_board generatedAt of <base_dir>/.coordinator/<owner>-<repo>.questions.json
boards.stale the stale boards by name; the text page prints one Boards STALE: line while it is not empty the above
watch the three watch conditions: settings, session_cache (status, written_at, age_minutes, reason), context, idle, trigger <base_dir>/.coordinator/sessions.cache.json, <slug>.desk-cache.json, the history file, ~/.config/ops/config.json
sources.<section> status (ok, unavailable), seconds, and the reason when unavailable the run itself
janitor.sessions[] sessions to clean up: id, name, state, reason, command (and pid for an idle one); see The janitor section claude agents --json --all, gh api repos/<repo>/issues/<n>
janitor.sessions_unavailable why the sessions could not be listed (the daemon is down); the other categories are still listed same
janitor.folders[] folders under base_dir to clean up: path, kind, repo, reason, queue (the entry of #350's janitor, or null) the worktree folder, git worktree list, git rev-list --count, leftovers() of coordinator.py
janitor.folders_unavailable why folders could not be checked (the workflow plugin is not installed) —
janitor.memory available_gb, floor_gb, below_floor, idle_sessions, idle_sessions_gb, bg_spare, bg_spare_gb /proc/meminfo, /proc/<pid>/status and cmdline, min_free_mem_gb of the coordinator config (unset: 25% of MemTotal, at most 4, as the coordinator)
janitor.lines[] one line per finding with the owner's command the above

ci is {"unavailable": "gh not authenticated"} when gh is not logged in; the rest is filled. On Windows the Linux-only sections (machine, units, updates) are unavailable. With --no-janitor the janitor section and its sources entry are left out altogether; the page and the history line have no janitor line then. The user scope of units is read with the XDG_RUNTIME_DIR a login would set (/run/user/<uid>) when the process has none, so it works from the Claude Code service too while the user lingers.

Watch conditions

Three ways a coordinator goes wrong without anyone noticing (#429), in the watch section and as one Watch line of the text page:

Condition On when Items Source
context a coordinator session's context reaches warning_tokens (level warning) or urgent_tokens (urgent) session_id, name, repo, level, used_tokens, cost_usd; sandbox for one read in its sandbox the session cache; the transcript of a sandboxed coordinator
idle a coordinator with live_workers 0, slots.free above 0 and a non-empty eligible queue, on consecutive runs for minutes, while its snapshot is fresh repo, free_slots, issues, since, minutes; now lists the repositories idle with work in this run <slug>.status.json, queue.items of <slug>.desk-cache.json, the history file
trigger a cloud coordinator session, neither completed nor archived, without a pending trigger session_id, name, repo the session cache

Each condition has status (ok, unavailable with a reason), its items, and unavailable: the sessions or repositories it could not judge, with the reason. A condition that is unavailable is off. trigger without any session cache is dropped (the owner's decision on #531): no cloud coordinator is known to run, so there is nothing to miss a trigger.

  • The session cache. Context size and triggers are known only to Claude Code session tools, which a timer without a model cannot call. The workflow:board-sync (plugins/workflow/skills/board-sync/SKILL.md) round writes them for the coordinator sessions to <base_dir>/.coordinator/sessions.cache.json (version, written_at, sessions[] with id, title, repo, cloud, state, used_tokens, cost_usd, pending_triggers; no other text). A cache older than 30 minutes or unreadable makes context and trigger unavailable; a missing one drops trigger.
  • A coordinator in a sandbox (#644): with --sessions (the patrol passes it while a judge or the context push is on) ops-status reads the context of every live coordinator from its transcript: the newest main-thread usage line under ~/.claude/projects/, input plus cache tokens, through one sbx exec for a coordinator in a sandbox and directly for one that runs on the same machine (the host, or the judge's own sandbox). Only that line leaves the VM, and of it only the counts reach the snapshot. context is ok from that alone when there is no session cache (context.session_cache then gives the reason); a stale or unreadable cache keeps it unavailable, since it may hold cloud coordinators.
  • The host coordinator runs under a local session id the session list does not show: without --sessions its context size has no source and is listed under context.unavailable. It is never a trigger candidate: its wake-up is coordinator watch, which the coordinator:<repo> alarm covers.
  • Idle for 30 minutes. Each history line records the repositories idle with work in that run (idle_with_work); the condition is on once the unbroken run of such lines, this run included, spans minutes. A line without the repository, or a gap between two lines longer than minutes or 30 minutes, whichever is more, starts it over. A stale coordinator snapshot makes the repository unavailable; so does a missing desk cache, a desk queue whose last refresh failed (queue.error) or a snapshot without slots.free. Queue items marked blocked do not count. A run that could not judge it (the coordinators source failed) writes idle_with_work: null, which neither ends nor extends a run; context and trigger still come from the session cache then.

Settings in ~/.config/ops/config.json ($XDG_CONFIG_HOME honoured), under alarms; a missing file or key is the default, a wrong value is the default with a line in watch.notes:

{"alarms": {
  "context": {"warning_tokens": 400000, "urgent_tokens": 600000, "push": false, "judge": false},
  "idle": {"minutes": 30, "push": false, "judge": false},
  "trigger": {"push": false}
}}

The context defaults sit above the 300k auto-compact window the sandboxes and the home unit set (#787, docs/setup/linux-host.md): a coordinator past 400k has not compacted where it should, so its window is not in effect or its compaction failed. A cloud coordinator has no such window and compacts near 967k: its warning at 400k is the cue to offer /compact, since it re-reads that much on every call.

push makes ops-patrol send the condition as an alarm, judge start a judge in the coordinator's sandbox; the two are independent.

The janitor section

Lists, once per run, what nobody cleans up, and the command that would do it. It runs none of them: no claude stop, no claude rm, no rm, no git or gh write. The owner pastes the commands, or queues folders to the janitor of #350 once it is installed. Each finding is one line of janitor.lines and one entry of janitor.sessions or janitor.folders.

Sessions.

  • Finished: an entry with no process in state blocked, done, failed or stopped whose issue or pull request is closed or merged → claude rm <id> (claude stop does not take a session that has exited). The number comes from the name: <user>:<host>/<repo>#<n>, cloud/<repo>#<n>, <repo>-issue-<n> or <repo>-pr-<n>; the repository from the name, else from the folder <repo>-<n>-<slug> it ran in, else the only repository with a snapshot.
  • Idle: an entry with a process whose status is not busy that started more than 24 hours ago (startedAt; the listing has no last-activity time) → claude stop <id>, or for an interactive session "end it in its terminal".
  • Live orphans that leftovers() finds (a cleaned-up task's session, a worker whose folder is gone), with its claude stop <id>.
  • Never listed: a coordinator (a name <user>:<host>/<repo> without #<n>, or the coordinator.session_id of a snapshot), a session with an open pull request (its number, or a head branch …/<n>-…), and as finished a session with a running process.

Worktrees and folders under base_dir (dot folders and each repository's main checkout aside), for every repository with a snapshot in <base_dir>/.coordinator/:

  • what leftovers() of the workflow plugin's coordinator.py reports (unregistered folders of <repo>-<n>-<slug>, idle worktrees), in its words;
  • a folder no repository registers: not a git folder, git of <repo> no longer knows it, or unknown repository when its .git points into a repository without a snapshot;
  • a registered worktree with no open pull request that is more than 100 commits behind origin/<default> (behind …, issue open or behind …, no open pull request), or whose issue is closed and that has no commit beyond origin/<default>.

A folder is listed once: when leftovers() already reports it, the janitor adds how far behind it is or that its issue is closed to the same line. The command is the queue entry of #350 (remove_folder <repository key> <leaf name>), never a path; a folder of no known repository says look at it. coordinator.py is found beside this plugin in a marketplace checkout, else through ~/.claude/plugins/installed_plugins.json; without it the folders are folders_unavailable.

Memory. MemAvailable against min_free_mem_gb of the coordinator config (default 4), the number of idle sessions (a process, not busy) and of bg-spare processes, and the resident memory each group holds with its child processes. Below the floor it is a finding.

GitHub is read with one gh api repos/<repo>/issues/<n> per distinct number (it answers for pull requests too) and one list of open pull requests per repository, cached for the run; no loop over all issues.

History

Each ops-status run appends one compact JSON line to ~/.local/state/ops/history.jsonl ($XDG_STATE_HOME honoured), so later stages have baseline numbers: the time, coordinator count and the stale ones, live workers, findings, questions, live and waiting sessions, units down, red repositories, load, free memory, the smallest free disk, a pending reboot, upgradable packages, the quota percentages, the unavailable sources and the repositories idle with work (idle_with_work, which the idle watch condition counts its minutes from). At 5 MB the file moves to history.jsonl.1 (one generation is kept).

Hooks

Event Script Does
SessionStart hooks/restore-exec-bit.sh makes the launchers in bin/ executable again (a Desktop copy loses the bit)
SessionStart hooks/bin-on-path.sh puts bin/ on the Bash PATH where Claude Code does not (Windows)
StopFailure (rate_limit\|billing_error) bin/ops-quota hook appends one event to the quota log when a turn ends on a rate limit (ops-quota)
UserPromptSubmit, PostToolUse hooks/quota-notice.sh → bin/ops-quota notice hands the patrol's quota notice to the session once per crossing (quota levels); Python starts only when the notice changed since the session was last checked, otherwise it stays in bash

The watch skill

ops:watch (plugins/ops/skills/watch/SKILL.md) runs one watch round over the coordinators from any session that has SendMessage, host or sandbox: it reads ops-status --sessions, judges each coordinator (gone, blind, context, idle, fine), sends at most one watch: line to a coordinator that is idle with eligible work or near its context limit, and reports in one paragraph. It never merges, claims or restarts; restarts belong to the sandbox watch timers. Each round appends one line per coordinator to ~/.local/state/ops/watch.log, which the next round reads so that a nudge is not repeated within 2 hours. It replaces the Coordinator Watch runbook of the cloud watcher; the judge session that ops-patrol starts (#644) loads it as its instructions. Its evals are in evals/watch-*.

The operator skill

ops:operator (plugins/ops/skills/operator/SKILL.md) is the operator's desk in the home session on the host (#374): it syncs the Session Board, refreshes the Question Board of every repository ops-status lists, reads the decision pages back in a Sonnet subagent and sends the repository's coordinator one operator: line per page with answers to apply. With ops-blocked it asks a completely blocked single-milestone coordinator for its hand-off and archives the session afterwards (#475). It never applies an answer, starts, claims or merges. start arms its 10-minute tick with CronCreate; each round appends to ~/.local/state/ops/operator.log, which the next round reads so that the same submission is told once. While the owner sets boards_owner=operator in the coordinator config (on the host and in each sandbox), the coordinators skip their own board sync and Question Board refresh (workflow:coordinator, setup step 6). When the desk stops, ops-status shows the boards stale. Its evals are in evals/operator-*.

Installation

/plugin install ops@<owner>

Then /reload-plugins, or start the session again. Python 3.8 or later, standard library only.

Development

python3 -m unittest discover -s plugins/ops/scripts -p 'test_*.py'
bash plugins/ops/tests/restore-exec-bit-test.sh
bash plugins/ops/tests/bin-on-path-test.sh
bash plugins/ops/tests/ops-status-test.sh
bash plugins/ops/tests/ops-patrol-test.sh
bash plugins/ops/tests/ops-quota-test.sh
bash plugins/ops/tests/ops-blocked-test.sh

The unit tests read the fixtures in scripts/fixtures/: coordinator snapshots, claude agents --json output, gh run list output, systemctl output, a quota log, a status line JSON and a StopFailure input. The janitor tests build a worktree folder and a /proc snapshot in a temporary directory and answer git and gh with a recording stub that fails on any write. The patrol tests replay two ops-status snapshots, patrol-alarms.json (the four alarms besides sbx) and patrol-quiet.json, through the rules, the transitions and main with a recording HTTP stub; nothing is sent. patrol-watch.json has the three watch conditions on with push set, and .coordinator/sessions.cache.json is the session cache board-sync writes (its shape is checked against session_board.py from both sides). The watch tests build the coordinator folder, the desk caches and the history in a temporary directory. The ops-blocked tests build a coordinator snapshot the same way and answer the GitHub reads with a recording stub; ops-blocked-test.sh puts a fake gh on the PATH.

Limits

  • waiting_minutes is filled only when claude agents --json gives a time for the wait; today it reports the state, not since when.
  • The user-scope units are read only where the user bus is reachable (XDG_RUNTIME_DIR set).
  • One generation of history is kept on rotation.