Quartermaster: autonomy dials, worker roles, and speed

Two months ago I wrote about Quartermaster, around v0.5.1. It took the scheduling and watching off me.

Then I became the bottleneck. Workers kept stopping to ask me the same safe questions: merge this approved PR, move to step two now that step one checked out, run a preview that only adds things. Mostly I said yes.

A few other things showed up once I ran it all day. Not every job wants a branch and a PR. One provider runs out of quota when ten workers run at once. And the CLI was slow because it spawned bd, herdr and gh on every tick.

v0.8.0 is out now, 129 commits later.

Teaching agents when not to ask

My first pass was a single label, autonomous. That didn't last. Pushing to a branch isn't the same as merging to main, deploying to dev, changing prod, or deleting a database.

So I replaced it with a 0-9 dial. Every bead gets a level (default 4, capped at 7) and every step gets an impact class by where its effect lands:

  • 0 to 2: read-only, the worktree, the worker's own branch and PR.
  • 3 to 4: local bead state, merging its own reviewed green PR, spending up to $500.
  • 5 to 7: dev targets, other non-prod, additive prod changes that pass a plan check.
  • 8 to 9: deletes or stateful replaces in prod, unreviewed merges, secrets, anything irreversible or unknown.

If a step's class is at or below the bead's level, the worker goes ahead and leaves an AUTO: note. Anything above it stops at needs_me.

Levels 8 and 9 only exist as time-boxed leases (like --for 4h), and the ticker puts them back when time's up. Only a local worker on a level-9 lease starts with bypass flags like --dangerously-skip-permissions. Rolling hourly budgets cap how many steps and applies a bead can run without me, and three failed checks in a row trip a circuit breaker that drops the bead back to level 2. quartermaster autonomy off drops everything to 2 at once.

Answering from a phone

When a worker does need me, free-form notes were slow to read and answer. Now it writes a structured question with numbered options, a recommendation and a class. Everything between my machines already runs over Tailscale, so I can answer in the coordinator, in the board's decision queue (1 through 9), or right from my phone.

With [tap] enabled, the ticker serves signed one-use links and a small mobile inbox at /inbox, bound only to my Tailscale address and checked against tailscale whois. Following a link shows the live command or question and asks for a button press; a chat preview can't approve anything on GET.

Enforcing merges and applies

While workers hold their own credentials, a dial is only advice. To enforce it on merges and applies, I put a local executor daemon behind PATH shims for gh, pulumi and tofu.

  • Merges. gh pr merge queries GitHub itself for an independent current-head approval, green checks and zero open threads (including outdated ones). It refuses --admin, and refuses --auto on branches that don't require review.
  • Applies. pulumi up and tofu apply check out the worktree's committed HEAD into a clean directory, run the preview through quartermaster gate plan (blocking any delete, replace or count mismatch), and apply only that saved plan.

Anything above the bead's level, or any flag the shim doesn't recognize, stops with a SHA-256 digest until I approve it via quartermaster plan resume or /inbox.

Checking work without a PR

A PR gets CI and review. A post-merge rollout or an investigation doesn't, so the worker that did the work was also the one saying it was done.

Now the coordinator adds two to four checkable criteria under ## Acceptance, and workers close through quartermaster close. For rolling-out and no-PR beads, close runs a fresh read-only agent against live evidence. It never sees the worker's own notes or close reason. Default strict mode stays local; an opt-in live read-only mode adds allowlisted read-only CLIs, GET and HEAD checks and read-only MCP tools while blocking writes and credentials. Two fails in a row stop the loop and hand both sides to me.

Beyond one shape of worker

In v0.5.1, every worker got a branch, a worktree and a PR brief. That wastes worktrees and sends the wrong instructions when the job isn't writing code.

Now workers have roles: implementer, reviewer, investigator, rollout and autoresearch, plus custom roles in config with their own agent, model, thinking level and tool restrictions. Non-coding roles skip git and worktrees completely and run in a private empty directory.

  • Pre-PR review. Label a bead review:required, and each clean commit starts a worktree-free reviewer on that exact SHA (or a security reviewer when a diff touches auth, IAM, workflows or migrations). Concrete blockers route straight back to the implementer. Rounds cap at two before it asks me, and a pass cleans up the reviewer.
  • Planning councils. On a tricky change, quartermaster council fans out two or more read-only planners in parallel with no cross-talk. The ticker shuffles their plans and strips their names into Plan A and Plan B, then a blind chair fact-checks the claims against the live repo and writes one plan.
  • Fresh shifts. resume continues an old transcript; after a couple of review rounds, that transcript is mostly noise. quartermaster shift starts a fresh session in the same worktree without touching git, carrying over a short handoff summary.
  • Resource locks. Labeling independent beads lock:<name> serializes work that shares a staging cluster or benchmark box. Any in_progress holder blocks manual dispatch and holds back automatic dispatches until it finishes.
  • Chained rollouts and watches. Passing --rollout-target dev at dispatch attaches a dependent rollout sibling bead that auto-dispatches once the PR merges and closes (when its target class passes the dial). And quartermaster watch attaches read-only external checks (a GitHub release, a PR, a workflow run or an HTTP endpoint) that wake the worker once the condition lands.

More agents, pi, and autoresearch

Quartermaster now runs five CLIs: claude, codex, pi, Muse Code and Antigravity (agy).

Most of the new agent work went into pi, because it takes extensions and writes every session to an append-only JSONL file. Local pi workers take follow-up prompts over a control socket instead of terminal paste, so messages queue cleanly behind a running turn. Its virtual models (quartermaster/worker-auto and coordinator-auto) fail over across an ordered provider chain when one drops below 20% headroom or hits rate limits, and move back once quota recovers.

There's also an opt-in headless pi-rpc backend with no terminal pane (you read the conversation right inside the board) and an opt-in headless inbox runner that handles routine events like merges and failing checks while the interactive coordinator is idle or closed.

Autoresearch

I wrote earlier about using pi-autoresearch (davebcn87/pi-autoresearch) to grind down a slow benchmark. Running that loop unattended has obvious failure modes: the agent edits the benchmark to game the score, runs past a budget, or commits scratch files into a PR.

role:autoresearch pins the extension, enforces an iteration cap, a spend limit and a lock:bench-cpu mutex, and hashes the harness scripts and any frozen files into a manifest outside the repo. The pi extension blocks edits to them, re-checks every hash before each experiment, skips bd prime compaction bloat, holds off automatic reviews while running, and blocks pushing or opening a PR until .auto/ and autoresearch.* files are gone.

For v0.8.0, I pointed it at Quartermaster's own Go and Node test suite. It cut go test -count=1 ./... from 83.4s to 8.9s (TestPiCoordinatorPolicy from 42.6s to 1.4s), with zero production files changed and statement coverage unchanged at 76.4%.

Usable by anyone, and fast

In the first post I wrote that Quartermaster was built for how I work, and that the ideas would travel better than the code. v0.7.0 fixed most of that. It adds native macOS and Linux helpers, drops hardcoded initials and branch prefixes, makes Linear opt-in (tracker = "none"), and makes GitHub optional (forge = "none" or "auto") so GitLab, Bitbucket or local repos work without gh. quartermaster configure detects your setup and writes a five-line config, and the README is down to two pages with the rest in docs/.

v0.8.0 fixed the speed. Quartermaster started as shell glue around bd, herdr, gh and tailscale, so every context call and ticker pass spawned dozens of processes. I replaced those read paths without adding a single Go dependency (go.mod still has three):

  • bd stays the only writer. In embedded Dolt mode, reads come from a local cache keyed by .beads/last-touched and the Dolt manifest. In Dolt server mode (which I run locally now), Quartermaster queries read-only MySQL directly in pure Go, with zero bd spawns. Local Herdr and Tailscale calls talk straight to their Unix sockets.
  • Read-only GitHub polling moved off gh onto a direct HTTP/2 GraphQL and REST client with ETag 304 caching, batched PR queries and exponential backoff on failed runs.
  • Cold context dropped from three bd reads to one, autonomy.json loads once per pass instead of once per bead, and unchanged 15-second ticks write zero bytes to state.json instead of rewriting 1.1 MB.
WhatBeforeAfter
quartermaster context --compact (cold, Dolt server)2.2s57ms
quartermaster context --compact (warm, embedded)5.7s60ms
GitHub poll (16 repos, 43 open PRs)>60s4.1-4.6s
Board rebuild (463 beads)7.13ms1.14ms
Unchanged 15s tick (state.json write)1.1 MB0 B
Full test suite (go test -count=1 ./...)83.4s8.9s

The context output matches byte-for-byte, and the 16-repo GitHub pass uses about 12 GraphQL points.

Quartermaster is on GitHub at travisjeffery/herdr-quartermaster. Four commands get it running on macOS or Linux:

herdr plugin install travisjeffery/herdr-quartermaster --ref v0.8.0
cd /path/to/your/repo && bd init && bd config set status.custom needs_me
quartermaster configure
quartermaster coordinator

The quickstart covers minimal and non-GitHub setups.