Skip to content

Teammate CLI health (FLT-508)

On 2026-11-21 three teammates had been dead for days and nothing said so:

Teammate What broke How long
Gronktayvius (Grok) A self-update installed a binary that segfaulted at launch. After a manual update, headless grok -p hung past 600 s starting ~20 MCP servers on a PC with 1–2 GB free. ~5 days
Jenny (agy) Windows Terminal's Intelligent Terminal plugin added a PreToolUse hook that printed {decision:ask} (invalid JSON; even valid, "ask" blocks headless). Separately, raft serve-raft crashed at boot (SocketException 10049) and took admit quorum with it. hours
Clahadore (headless claude) The login reached its time limit (loggedIn:false), killing the Fable seat and the Claude probe. ~3 days

Each dead teammate costs about a fifth of fleet capacity. This page covers what now catches each failure class.

Run it

C:\Users\fives\source\repos\usage-governor\publish\UsageGovernor.exe teammate-health --grok-prompt

One line per check, OK or FAIL, exit 0 only when all pass. --grok-prompt adds a real headless grok answer (a few tokens, booked to the grok ledger as teammate-health) timed against a 60 s budget. Without it nothing spends quota. watch-usage runs the same cheap checks every hour and logs failures; the Claude login alert also appears on every prompt as a CLAUDE-AUTH: line.

Raft admit authority: late Tailscale

serve-raft binds this node's Tailscale IP. It now waits for that IP to exist (2 s backoff doubling to 30 s, up to 30 min) and retries a start that fails with WSAEADDRNOTAVAIL. Other errors still fail fast. Each wait is logged to serve-raft-crash.log as bind-wait. If the address never appears it exits 75.

The scheduled task is the second line. ops/Set-RaftAuthorityTaskPolicy.ps1 sets RestartCount 999 / 1 min, MultipleInstances=IgnoreNew, and adds a 5-minute repetition trigger as a watchdog, because restart-on-failure alone did not bring greatroom back. -Check reports without changing anything. Applying needs an elevated shell, since the task is S4U with RunLevel Highest.

Grok: minimal headless home and update canary

grok 1.0.92 has no per-run MCP switch for its own config. The GROK_CONFIG overlay is allowlisted and does not reach [mcp_servers]. Verified: the overlay left all four servers enabled. GROK_HOME does relocate the whole home, so headless runs (council-seat's Gronktayvius, grok-exec, teammate-health) use %LOCALAPPDATA%\usage-governor\grok-headless-home\<hash of the real home>:

  • config.toml has no MCP servers, plugins or permissions. The user's config also carries MCP bearer tokens that a review seat has no business holding.
  • GROK_AUTH_PATH points at the real ~/.grok/auth.json. Nothing is copied.
  • AGENTS.md / GROK.md are synced from ~/.grok, so the seat still knows who it is.
  • sessions is a junction to ~/.grok/sessions, so the governor's grok meter still sees every headless run.
  • The Claude/Cursor import switches are off, and GROK_DISABLE_AUTOUPDATER=1 prevents a self-update mid-gate.

The home is only ever written when it carries usage-governor's ownership marker or is new and empty, so a root that is an alias of the real home, or someone else's directory, is refused. The sessions link's target is verified. If the home cannot be built (for example, no grok login), the seat or grok-exec FAILS with the reason; it never falls back to the user home whose MCP servers caused the hang. Interactive grok is untouched. The 10 servers hand-disabled in ~/.grok/config.toml on 2026-11-21 can be re-enabled for interactive use (original list: J:\reference-archive\grok-mcp-before.txt).

The update canary fingerprints grok.exe (size and mtime). After any change it runs grok --version. On failure it checks that grok.exe.old runs, then:

  1. moves the bad binary to grok.exe.broken-<utc>;
  2. copies .old back;
  3. re-verifies the restored binary.

When the binary is unchanged the check costs two stat calls. It runs before every grok-exec and hourly in watch-usage.

agy: PreToolUse hook preflight

agy-wrap.ps1 runs UsageGovernor.exe hook-preflight-agy before admission. The preflight:

  1. finds every PreToolUse hook in ~/.gemini/config/plugins/*/hooks.json and ~/.gemini/settings.json;
  2. flags a hard-coded "ask" decision;
  3. runs each hook once through cmd /s /c (hidden, with a sample event on stdin), so quote-stripping reproduces exactly as it did on 2026-11-21;
  4. fails on invalid JSON, an ask decision, a non-zero exit or a timeout.

A pass is cached for 24 hours against the exact bytes inspected, so hooks run again daily or after any change. The 'ask' text check is only a hint attached to a runtime failure; it never fails a healthy hook on its own. A checker crash is exit 4, and agy-wrap refuses admission on 3 or 4. On failure, agy-wrap stops before anything is admitted, and the message names the file and the fix. An older governor without the verb only produces a warning.

Claude: login expiry, and the unattended path

claude auth status --json reports loginExpiresAt. The governor reads it hourly. From 7 days out, every prompt carries CLAUDE-AUTH: headless claude login expires …. Once the login has expired, or loggedIn is false, the line says so outright.

auth status is free, but it never exercises the token. On streaming on 2026-11-21 it reported loggedIn: true (expiring 2026-12-20) while the Fable seat failed with "OAuth session expired and could not be refreshed". On the same box, the PATH claude.cmd shim was blocked by Device Guard. So every 6 hours, and every pass while one is failing, the governor also makes one real call: claude -p "Reply with exactly CLAUDE_OK…" --model haiku --max-turns 1, through the launcher PATH resolves. If it fails, the level is call-failed and the prompt line names the launcher and its error. Only a later live call that answers clears it; a free status read never does. Run it on demand with teammate-health --claude-prompt.

Unattended path (Andrew only: never create credentials from an agent):

  1. In an interactive shell, run claude setup-token. It opens a browser login and prints a long-lived OAuth token for the subscription.
  2. Store it like other fleet secrets and expose it to the unattended jobs, not to every shell: set CLAUDE_CODE_OAUTH_TOKEN in the environment of the scheduled tasks or the wrappers that start headless claude (Fable seat, probes).
  3. Verify with claude auth status. A token login typically reports no loginExpiresAt, and the check treats that as OK.

council-seat strips CLAUDE_CODE_OAUTH_TOKEN from review-seat children by design (FLT-389), so the Fable seat keeps using the stored subscription login unless that policy changes. Until then, the 7-day alert is what keeps the Fable seat alive: re-login when it fires.

Orphan MCP reaper

The reclaimer already stopped clientless MCP helpers whose image name contains mcp. It now also covers MCP servers hosted by a runtime (node, python, uv, uvx, npx, bun, deno, cmd). A runtime qualifies only when its command line, read with NtQueryInformationProcess, names an MCP server. A runtime whose command line does not mention MCP is never a candidate, however dead its parent: mission control's http-server and Ollama's cmd wrapper both look like that. It also has to have been SEEN under a live client before (recorded by pid and creation time in reclaim-mcp-owned.json), so an MCP server started detached on purpose is never reaped. All the existing proofs still apply:

  • no live client in the ancestry;
  • the direct parent is gone;
  • the same pid and start time on a second look;
  • 10 minutes clientless.

reclaim-plan is always a dry run. Real stops happen only from watch-usage at Low or Critical resources, and reclaim-disabled turns them off.

Measured on greatroom 2026-11-21: of the ~190 node/python/uv/cmd processes, all but 8 traced to a live client (22 claude.exe sessions). The 8 with dead parents were daemons, not MCP. So the 4.7 GB was live sessions' own MCP servers, not orphans; a per-session MCP budget is the lever for that, tracked separately.