Autonomous Claude Code agent for OCaml projects
README.md

agent #

Run Claude Code on an OCaml project until a command succeeds.

When you ask Claude Code to "fix the failing tests", it usually takes a few
rounds. Claude edits, you run dune test, and you paste the failures back.
agent does those rounds for you. You give it a prompt and a check command
such as dune test; it runs Claude Code, runs the check, and goes again until
the check exits 0 or an iteration limit is hit. The loop runs in a Docker
container with the OCaml toolchain installed, so the agent can use a shell
and edit files without touching the host. With --worktree its changes also
stay on a separate git worktree until you merge them.

The package includes a library, also called agent. Agent.Supervisor.run
is the loop, Agent.run is a single run, and Agent.Todo with
Agent.Todo_mirror track Claude's TODO list. Agent.Fleet decides how many
sessions work a repository's ready work, as many as its readings admit: the
ready work no session's packages hold, the host's memory and CPU, the repository's
landings, the pace of each account's usage windows and the backends' measured capability, never two
sessions on one package and no configured count. The tests the queue names
red reach the tracker by the queue's hook, the tracker package's tk hook,
which files them as issues; the fleet files none. Agent.Route says
which backend (a provider's model on one of its accounts: Claude Code,
Codex, or ocaml-llm's agent loop on Fireworks, Mistral or a local model)
may work an issue, by the issue's task and the backend's measured pass
rate. It decides only:
Agent.Fleet_reading decodes what its sources print, and the agent.eio
library's Fleet_eio performs, as agent fleet runs it.

Installation #

Install with opam:

$ opam install agent

If opam cannot find the package, it has probably not reached the public
opam-repository yet. Add the overlay repository and install from there:

$ opam repo add samoht https://tangled.org/gazagnaire.org/opam-overlay.git
$ opam update
$ opam install agent

Quick start #

$ # Initialize (creates Dockerfile and preset prompts)
$ agent init

$ # Authenticate with Claude (one-time setup)
$ agent login

$ # Run until tests pass
$ agent run --preset fix

$ # Run with worktree isolation (recommended)
$ agent run -w --preset fix

Usage #

Basic commands #

Without --until or --preset, agent run asks Claude once, on the host,
and gives it only the tools Read, Glob, Grep and TodoWrite. Claude can
then answer questions about the code, and it can only change files if you
pass --privileged. With --until or --preset, the command loops in Docker
and Claude also gets the shell and edit tools.

$ # Single run (no loop)
$ agent run "Add unit tests for the parser module"

$ # Loop until command succeeds
$ agent run --until "dune test" "Fix all test failures"

$ # Use a preset prompt
$ agent run --preset fix        # Run tests, fix failures
$ agent run --preset tidy       # Apply /ocaml-dev:tidy skill
$ agent run --preset security   # Apply /ocaml-security skill
$ agent run --preset lint       # Fix merlint warnings

Worktree isolation #

With --worktree (or -w) the loop runs in a new git worktree under
~/.cache/agent/worktrees/, and your own checkout is left alone until you
have reviewed the changes:

$ agent run -w --preset fix

agent merge on its own lists the worktrees. agent merge NAME commits
whatever is left in that worktree, merges it into the current repository and
removes the worktree. When the merge conflicts, it runs the agent in Docker
to resolve the conflicts, and if that fails it asks you to finish by hand.

$ # List available worktrees
$ agent merge

$ # Review changes
$ cd ~/.cache/agent/worktrees/myproject-1706985432 && git diff

$ # Merge into the main repository
$ agent merge myproject-1706985432

$ # Or discard without merging
$ agent merge --discard myproject-1706985432

Restricting the paths #

--path asks the agent to change only the given directories. The request is
just a line added to the prompt, so the agent is free to ignore it:

$ agent run --preset tidy --path lib/parser
$ agent run --preset security --path lib/crypto --path lib/auth

Prompt sources #

$ # Positional argument
$ agent run --until "dune test" "Fix the parser bug"

$ # From file
$ agent run --until "dune test" -p prompt.txt

$ # From stdin
$ echo "Fix the bug" | agent run --until "dune test" -p -

The fleet supervisor #

Who starts the lanes specifies how the fleet, the
tracker and the merge queue split the work, and what each keeps.
Reading delivery specifies the reading of what the
lanes become, from hand-out to land, by cause and by stage.

agent fleet run --config FILE feeds every repository the file names that
has a merge queue (mq) and a tk tracker. One run at a time does so on a
machine: a run holds the fleet's run lock, an exclusive flock on
STATE/run.lock the kernel lets go when the process ends, however it ends,
and a run that finds it held prints its holder, boots nothing and exits 0. A
dry run takes no lock. The lock's record names the run's process, its build
(the SHA-256 of its executable's bytes) and the launchd job it runs under,
the label launchd sets in XPC_SERVICE_NAME, or none. A run that holds it
removes the fleet's wake, STATE/wake, before it reads anything (below).
Every every
seconds, and at its wake (below), it reads each repository's queue, its status document (mq status --json) as the machine's one mq web keeps it on
~/.local/share/mq/web.sock (merge-queue's doc/web.md, "One reader for
the machine"), starting that server when none answers, so that no fleet
round or band refresh reads a queue of its own; a repository no
registration of this machine runs mq in has no reading. It also reads its
ready work, its claims and the work held for a prerequisite, each provider's allowance (its
tool's usage --json: claude-x, codex-x, fireworks, mistral), each
backend's eval trials, this host's memory pressure and its CPU by process
tree. Each reading runs
on its own and the round decides on those that have answered by the next
round, and it is not asked again while it runs. One lost, refused or not
answered by then, keeps its last answer for the round after, which decides
on it, and agent fleet status names the instant of that answer. One lost
two rounds running is not yet read, so it holds what depends on it (a slow
queue, its repository's starts) and nothing else. A tracker write (a release, a blocker row) runs on
its own too, so a tracker that takes minutes to write holds no round and
no lane's end. Each round, every repository starts a lane on each ready issue no
lane or claim takes, in the tracker's order (tk ready's: by priority,
then as each epic's order member ranks; the fleet ranks none of its own), in a session
of its own, its output in STATE/lanes/LANE.jsonl, while a host's memory and CPU and the
allowance admit it, until none starts one more. Each start goes to the
repository whose next ready issue ranks first by priority across them
all, and repositories whose next issues share a priority take turns, one
start each: lower-priority work, in any repository, takes only the room
that higher-priority work leaves, held by its repository's ceiling or
climb, its target's standing queue or by no backend admitting it. A host admits while the kernel does not
read its memory pressure critical and its available memory covers one lane more and
what its lanes will still grow into: pressure lags a burst, since a lane
grows into its memory over minutes as it builds. The kernel's warn is no
shortage: Activity Monitor's yellow says a Mac "might eventually need more
RAM", its red that it "needs more RAM"
(Apple),
so warn reads as normal does and the available memory judges it. A host's
available memory is its memory less what no allocation takes without
paging, which leaves its free, purgeable and file-cache pages, less the
part of its fixed cost no wired page holds. A worker's fixed cost is the
resident size of the local models it serves and the system's reserve
(merge-queue's workers page, "Local models"): a model server's weights
read as wired while its engine holds them and as file cache while it does
not, and on cambria they move between the two every few seconds, so the
memory less what is used alone would give a round the model's pages. A
worker with a fixed cost whose wired memory is unread has its available
memory unread. A lane's memory is the
sum of its processes' footprints, and its kind its issue's task and its
backend. A lane expects the mean of the peaks read of its kind's lanes
since the fleet booted, the last of each that ended and so far of each
live one, or its own peak when that is more, and will still grow by that
less what it holds now; a lane no reading holds yet, decided this round or
its hand-out still running, grows by all of it. A
kind stands on its own peaks once it holds two, and a lane more expects
the mean of every kind's the home host runs, as a lane started on a worker
does: a worker's lane is read at home by its delivery alone. The lanes' peaks are independent, so the host
also holds a margin of 1.645 times the square root of their summed
variances: their sum then fits with probability 0.95 under the normal
approximation, the 95th percentile of the sum rather than the sum of each
lane's. Until a lane's peak is read, a host takes one start a round.

A host admits a lane only while its CPU leaves room for the lane's share,
the queue's own work held first
(doc/dispatch.md).
Its CPU is read per process tree from the host's standing record, obs top --record's, and never from a load average: the collector's last
interval, live.json, and the minutes of record.json that end in the ten
minutes before it. Every tree that is no lane of the fleet's is held at the
mean of the CPU it took over those intervals: the queue's work (its checks
and vets, its pool's places, where an install builds, and its own mq
processes), then the other sessions and programs. One minute's peak of ten
so moves the hold by a tenth of its excess, and a tree busy over the ten
minutes is held at what it takes. A lane of the fleet is the tree of its
worktree and that of its agent's session. It holds the mean share of its
kind's lanes, read over the last interval each round since the fleet
booted, or the share it took when more. A host admits while its CPUs,
less all it holds, cover a lane more's mean share, and holds no margin for
the spread of the shares: CPU is compressible, so a peak past the CPUs
slows every process on the host in proportion and kills none, where a peak
past memory pages or kills
(doc/dispatch.md). With no reading, or one no later than the
reading before it, its collector stopped, a host admits nothing, a P0
neither. A worker host's CPU is read the same way from the queue's
reading of the worker, mq worker top WORKER --json, whose counters of
each tree's CPU grow from the tree's start, so a tree's share is the
difference of two readings and the first reading answers nothing: each
run's scope is a tree, a run in a sessions/ place a lane's session, any
other run (a check's, a vet's) the queue's work, and the rest other
programs. That reading names no lane of a session, so a session's share is
a sample of every kind's, and the lanes started there hold what their
kinds expect, or what the sessions took when more. Until a lane's share is
read, a host takes one start a round. A
worker host's lanes draw on the accounts the worker's model proxy sends
their calls to, the accounts of its backends: a subscription's through the
worker's relay, a per-usage key's through the proxy itself. So those
accounts' allowance admits a lane there as it does anywhere (below), and
no count of tokens the proxy keeps admits or refuses one.
A worker host's start, a P0's included, is bound by the worker's CPU and
memory, as the queue reads the worker, and by the accounts, not by the
worker's slots: a lane's session there holds no slot of the queue's
ledger, so a worker of 9 slots runs as many lanes as its CPU, its memory
and the accounts admit. A worker the queue names a stop of in
runs.workers of mq status --json (disk-low, a pause) admits no lane
of that repository.

A backend whose provider, or the model proxy in front of it, refuses every
call takes no new lane. An ocaml-llm lane that stops on such a failure (no
key or the key refused, refused or unreachable, a timeout, a server error)
exits 69, EX_UNAVAILABLE of sysexits(3), and its delivery passes the status
on, from a worker too. A lane that ends 75, EX_TEMPFAIL, which mq worker run exits with when the worker could not run the job (Claude Code not on its
PATH), and whose record holds no model call never reached its model, and
the next lane there would end the same. mq worker run exits 75 too when
its session drops mid-run; the calls the lane made until then are in its
record, each assistant message of a Claude Code session cut off before
its result, and such a lane says nothing of its backend. A backend whose newest lane to end
ended either way is out of every route, P0s included, and each round probes
it from the host its lanes run on: a one-token chat call to its model, at
its base_url, or for a claude-x provider the lanes' own claude -p
asked ok, on a worker as its job, on this host as claude-x run ACCOUNT
with no tool and no session kept, on the first of the backend's accounts
that neither a limit nor a failed login puts out. On a worker the probe is a job whose environment
holds probe-BACKEND as each provider's key, the word the worker's model
proxy counts its call against, as a lane's job holds its lane's: a job with
no key is refused by its tool before any call. A backend the configuration
no longer names is never probed: it has no route, and its outage stays in the
ledger only. The round decides without waiting for its probes,
and a passing probe routes the backend again from the next round. agent fleet status
names each such backend under unavailable, with the lane that ended so and
why its latest probe failed: the error a Claude Code probe's session ended
on, else the last line of the probe's standard error. A probe's mq worker run leaves the span tree of a slow run in probes/BACKEND.spans of the
fleet's state, as a queue's run leaves each command's beside its log, so
its standard error ends on the failure and not on the run's wall.
Each mq new of a start does the same under its lane's name: the
hand-out of the lane's worktree leaves the span tree of a slow call in
lanes/LANE.hand-out.spans of the fleet's state, and
lanes/LANE.hand-out.json names the call's process as soon as it runs
(its lane, issue and branch, the host, its pid, the number the kernel gave
it, the instant it was spawned), so a slow hand-out is sampled while it
runs and read once it ends. The later call that names the lane's process
the worktree's holder keeps lanes/LANE.holder.spans and
lanes/LANE.holder.json. A lane's next call of each kind replaces them.

A lane whose provider refused its account's login is that account's fault,
not its backend's. Claude Code ends such a session on an api_error result
whose assistant message's error is authentication_failed ("Failed to
authenticate: OAuth session expired and could not be refreshed"), and the
fleet ledgers the end with 77, EX_NOPERM. The account then takes no lane on
any route, P0s included, while the backend's other accounts take lanes;
each round probes the account, and it returns once a probe on it passes or a
later lane on it ends having called its model, never on a clock. agent fleet status names it under unavailable (claude ACCOUNT signed out: LANE ended on its failed login). On a worker, whose relay picks the
account, such an end puts the backend out as an outage does.

A lane that ends on its provider's limit carries the provider's own reading
of the account it drew on, newer than any allowance read. Claude Code
writes a rate_limit_event whose status is rejected into the lane's
stream-json record, naming the window it refused (seven_day,
five_hour) and the reset in resetsAt; its text says "You've hit your
weekly limit · resets 10pm (UTC)". The fleet reads the newest such event
through the JSON codec and ledgers the end with it ("limited": {"window": ..., "resets": ...}). Until the reset, the account takes no lane on any
route that draws on it, P0s included. On a host whose lanes are jobs of a
worker the worker's relay, not the start, picks the account a session draws
on, so the refusal names the account by its reset: of the backend's
accounts, the one whose window, as the allowance last read it, resets
nearest the stated reset, within the time left to it, and every account tied
with it, is out until then; the backend is out when no account's reading
names that period. A refusal that states no reset puts nothing out. The end is no failed life: it holds nothing and the lane is
resumed, under its name, on a route the limit leaves open. A round the limit
refuses names the account or the backend, the lane and the reset.

A provider can answer while the lanes on it still land nothing. A lane
that exits with a status from 1 to 127, 79 (an answer with no commit)
included, failed; a backend whose three newest lanes to end each failed
takes one lane at a time, P0s included, and while that lane runs the
round's other starts go to the next backend on the host's route. A branch
of one of its lanes that lands gives it its share again; a lane that exits
0 has only queued its land. In the hour to 16:23Z on 2026-12-02
deepseek-flash-farm started 83 lanes and landed 1, its answers with no
commit and an exit 0 that never landed each giving it its share again. A
lane that ends with no status (the fleet restarted), on a signal or at its
provider's limit says nothing of its backend, nor does an answer with no
commit whose last line declares what holds its issue: a row it waits on, a
split, an ask, a commit that holds its work, a branch or the home host. That
answer is the issue's: the release records it, so the issue runs where it
names or waits on the row it names before any lane starts on it again. On
2026-12-03 three parsimoni lanes on carmel answered {"home":ID}, an ask
and {"done":COMMIT}, and opus-carmel took one lane at a time in every
repository, with about 4,500 issues ready for carmel in blacksun. An answer
that names nothing still fails. The refusal reads glm takes one lane at a time: its last 3 lanes failed (fleet9, fleet7, fleet4) wherever
the fleet's status names what held a start.

A repository's landings bound its width: more lanes help only while the
queue lands more with them
(doc/dispatch.md).
Each round samples the repository's live lanes, and once an hour the
fleet adds the hour's lands and the mean width live over it to the run,
the hours since the width last moved. The lands are the queue's landings
into the entry branch since the probe before (mq events --json) that
the run's lanes made: a landing counts when its branch is a fleet lane's
and that lane started in the run, so a person's branch, a bump or a lane
an earlier width admitted moves no verdict, and the lane-hours of a lane
that started before the run are left out of its w. A lane lands minutes to an hour after it
starts, so an hour's lands are those of the lanes live across it, not of
the lanes live at its end, and a few lands an hour read nothing in one
hour that a run of them can. It compares the run, l lands in h hours
over w lane-hours, with the run before, l0 in h0 over w0. The
run's width rose and its lands an hour rose beyond their noise
(l * h0 - l0 * h > 2 * sqrt ((l + l0) * h * h0), two standard
deviations of the counts, as Fleet_climb derives): it grows, doubling
until its threshold, then a lane at a time. The lands per lane-hour fell
beyond their noise (l0 * w - l * w0 > 2 * sqrt ((l + l0) * w * w0)),
whatever the width did and whether or not a land waited in the queue: it
backs off to half the lanes live, stopping none, and to no fewer than the
lanes the run's lands an hour took at the run before's lane-hours per
land, and the back-off sets the threshold. The lane-hours leave out the
time, within the run's hours, of the lanes the machine ended, which say
nothing of lanes costing each other:
those that ended 69 (the provider or its proxy refused them), 75 (the
worker could not run them) or 79 (no work of their own), those their
provider's limit ended and those the fleet stopped. A back-off whose fall
such ends, read after it, explain sets no threshold: the one before it
holds again (doc/dispatch.md).
Neither, and the
run's lands are enough to judge a step, more than 16 and no fewer than the
run before's, over an hour whose starts the standing queue (below) did not
hold: it probes the step, due in the ledger. Neither, the width below
the threshold, and over an hour in which the standing queue refused no
start: it doubles, up to the threshold, and the run goes on, slow-start
in the ledger. Any other hour says
nothing of the width, lands equal at none or at one among them: the width
holds and the run goes on; a rise, a fall or a probe ends it. No lands
read, or no run before: it grows by one lane. An hour the host
slept, which the fleet reads as the time its awake clock (the one that
stops while the host sleeps) did not count, or over which the queue's
mq status --json named its disk-floor finding, is no sample: the queue
could not land over all of it, so the hour is in no run and the width
admitted holds. On 2026-11-25 the hour the laptop slept 47 minutes of read
3 lands against 1 and doubled the width to 96, and the next, at the disk
floor, doubled it to 192. Whatever the hour read, the width admitted is at
most one step past the mean width live over it, the lanes its lands paid
for: a width admitted past what its lanes used falls to that step at the
next probe, and an hour no lane was live in bounds nothing. An hour in
which, at any round, a bound other than the climb and the ready work
refused the repository's next start (a host's own bound, an account's
window, the repository's ceiling, mode or starts in flight, the brake) is
no sample either: that bound held the width, so the hour bounds nothing,
leaves the width admitted as it was, and is in no run.
A repository also starts a lane only while its target's standing queue
has room
(doc/dispatch.md):
the entries waiting in it, queued in the target's movement of mq status --json (those queued and those whose checks passed behind a car
still checked) less those its health names pin-disputed, which no
run moves and which agent fleet status names
in its health section, are within what the train lands over the time
a new start takes to reach the queue, or within the cars its train has
under check, checking (those replayed or checked). That room is the train's
rate with a land in hand, the target's queued_gap in the status's
pace (its count over its total), times the mean lead of the
repository's lives to the queue: from each life's start to the first
round whose reading of the queue lists its branch, recorded in the
ledger as a reached line, over the window the pace reads (its
since). The lanes on their way to the queue are the climb's to bound.
With no landing with a land in hand or no life that reached the queue
in the window, the cars under check alone are the room. The refusal
reads standing queue 21 over a room of 19.5 (30.1 lands an hour with one queued, 38m48s from a start to the queue) and no car under check.
With no reading of the queue's status the repository starts nothing,
and a P0 passes the climb but not this room, since its land waits in
the same queue. The standing
queue is the queue's own room, so an hour it refused a start is a sample:
the width it holds is the width the queue absorbs, which is what the
lands measure, and the hour bounds the width admitted to a step past the
lanes held. Over an hour it refused the start half of or more, no probe up
is due, so a width the queue's room holds grows only on a rise and cannot
drift up.
Each landing a repository's delivery reads of a lane's branch is recorded
once per life, credited to the newest life of that branch started before
it, as a landed line of the ledger and of the log with the life's lane,
issue, task, host and backend, its start and the land's instant:
landed fleet7 on proj-1 (mechanical) in REPO on farm with deepseek-flash-farm, started at T, landed at T. The queue's journal keeps
a window of its records, and the ledger keeps every land the fleet read,
so the lands of a host, a backend or a task over any span are a count of
those lines. The fleet's memory of a life's land goes with the life; the
ledger's line stays.
That is TCP's congestion control on a repository's landings, slow start
below the threshold, additive increase past it and multiplicative decrease
(RFC 5681, section 3.1), with a
window its lanes left unused brought down to what they used, as
RFC 7661, section 4.4.3, brings
down one at the end of a non-validated period. Slow start needs no rise
to grow because every consumer a lane loads reads its own room before the
start; the one cost no room reads is the lanes costing each other their
landings, so every fall in the lands per lane-hour sets the threshold, as
ssthresh "MUST be reduced in response to congestion", and it holds until
the next. The lands are the queue's, never the ends of
the fleet's lanes, and each probe is a line of the ledger with its
back-off, so a restart keeps the climb.

Of repositories whose next issues share a priority, one whose entry
branch has stood drained for the 95th percentile of the gaps between its
landings goes first, so it takes the hosts' room before the others. A host's or a repository's lanes, absent by default, is an
operator's ceiling on its lanes, capacity and never a mode; a host with
lanes 0 starts nothing, and a repository with lanes 0 starts nothing,
a P0 neither (below). A repository ceiling the configuration has held for a
round or more is named in the band (ceiling 1) and in agent fleet status, with when the configuration was written and the round that read
it. Pausing or stepping a repository is its queue's: under mq freeze the
fleet starts there only the issue the freeze's reason names by its id, and
under mq step on one lane at a time, a P0's included
(dispatch, "The mode is the queue's").
A start whose claim tk refuses (held by another, an epic), its exit 1,
spends none of the round: the round skips that issue and starts the next,
until one is claimed or none is left, and a later round reads the refused
issue afresh. A start that fails otherwise (its launch, its provider, its
worktree) starts nothing in its stead that round, and releases the claim
it took in the same step: its start failed: WHY. Each start is a line of
the ledger before its claim is asked, so a fleet killed between a start's
claim and its launch leaves the start there, and the next boot releases
that claim once it reads it: the fleet ended before its start did. Only
that start's issue is released, while its lane holds it and is not live;
no other holder's claim is touched.

Lanes share a package: the queue replays each land onto main and returns
the one that conflicts (entry-returned, its cause naming the paths). A
package takes no new lane only while the queue holds an entry of one of
its live lanes, or of the holder of a claim the fleet does not read dead,
returned on a conflict in it, which fleet status names. An issue naming
no package directory, or the package at the repository's root, is of the
root's group, ..

A repository whose queue's mq status --json names its disk-floor
finding, its pool's volume under mq.freeSpace, starts no lane, a P0
neither: the queue checks and lands nothing there, and each start's
worktree takes what its trim frees. On 2026-11-25 the volume fell from 67
to 33 GiB in eight minutes while the fleet started fifteen lanes onto it.
agent fleet status names the volume as the repository's bound.

A P0, an issue of priority 0, is the first start of each round whose
bounds admit a lane, and it meets every bound a start meets: its
repository's climb, lanes and window of starts in flight, its host's
lanes, memory and CPU, its backend's record and its account's pace.
Only the packages conflicts hold refuse it nothing. A priority orders the
work and adds no room: on 2026-12-02 the tracker ranked 222 issues at P0,
and a P0 that passed the climb, the memory and the pace started 83 lanes
in an hour on blacksun, whose climb admitted 1, and they landed 1; the
night before, 69 P0 lanes started on a host whose lanes is 8. A lane
counts on its host from the round that decides it, through its hand-out,
until it ends. Its repair and its resume read the same bounds. It runs on
the strongest backend of a host's route, the last (the route is cheapest
first), whose record and account admit it: one that clears the task on
any host before one that only declares it, so a P0 never waits for a
measurement; within each, on the first host whose bounds admit it. No
account's pace stops its lane once it runs. A P0 the round could not
start is counted under P0 waiting of agent fleet status, on a line with
those the same bounds refused that names the first of them and what
refused it: the machine's areas or priorities, its repository's climb,
lanes or starts in flight, its host's lanes, memory or CPU, its
backend's record, every account's pace, or a reading not in hand; each P0
lane's line is marked P0. A P0 that waits on an open issue, one it depends on
or one it tracks, is no ready work: tk ready holds it until that issue
closes, and the fleet reads it with tk list --blocked --status open and
the issues it waits on with tk show --json, whose prerequisites member
is the tracker's own reading. tk ready ranks the prerequisite at the
P0's priority, inherited from the rows that wait on it, and the fleet
starts it as a P0 on that rank.
P0 waiting names such a P0 with each open prerequisite and what holds it:
ready work no lane takes, the lane or claim that holds it, or a
prerequisite of its own.

Of its host's backends that clear the issue's task and have an account with
headroom, the lane runs on the
one with the fewest live lanes, the cheapest first on a tie: a burst of
lanes spreads over every backend that clears its task, and a provider's
outage or rate limit stalls only its share. Every provider the file
configures reads every repository it names: a provider that must not read
a tree is left out of the file that names the tree. An ocaml-llm lane is
passed --allow-private, without which its tool refuses a private tree. The task comes
from the tracker's row: triage:required is triage, topic:security
security, a bug or chore mechanical, anything else design. A row
labelled size:m, size:l or size:xl, two lands or more, is design
whatever its kind: mechanical work closes one stated rule at a named place,
and on 2026-12-01 a third of the 847 rows the fleet had sent to a backend
that is not judgement as mechanical carried one of those sizes. A repair
(below) is a task of its own, repair, but for a security fix. A backend
takes only the tasks its tasks names, every task when it names none, so
each model is kept to its own work (Codex's Luna on triage, Sol on
mechanical work, Astra on design and security). A judgement backend
(Claude Opus) clears each task it takes; any other clears a task only once
its trials (fireworks eval --trials FILE, or codex-x eval for a Codex
backend, each case tagged with its task) pass at the task's bar, and
never review. A security fix on a backend that is not
judgement commits without landing, and a review lane on a judgement
backend lands it. The fleet claims the issue for the lane and hands out its
worktree (mq new LANE/ISSUE TARGET --holder-pid PID --holder-id ID, the fleet's
own process holding it until the lane's is named). TARGET is the branch
the lane starts from and lands into: the value of the issue's label
branch:TARGET, else the repository's entry branch. An issue about the
queue's rules carries branch:mq/config, since mq.toml lives only on that
orphan branch and a checkout of the entry branch holds none. A branch:
value that git check-ref-format refuses, or that Git would read as an
option, and labels naming two branches fail the start. A store whose schema
enumerates its label families lists branch with values = ["*"]. The
issue's label host:NAME pins its lanes, fresh, resumed, repaired or
reviewing, a P0's included, to the configured host NAME, under that
host's bounds, and no other host takes it, while its wait there holds no
other issue, which any host with room takes: an issue whose work reads what
one machine alone holds (its queue's journal, its ledger, a checkout's
reflog) carries that machine's host, as in
tk edit ID --add-label host:NAME. A host: label that names no
configured host, or labels naming two hosts, hold the issue, named on the
fleet's status. A store whose schema enumerates its label families lists
host with values = ["*"]. An issue that names a package, by
name or by directory, of a dependency the lock at the head of the lane's
repository declares (.mqmodule), read with its packages when the fleet
boots, is handed out with that dependency
editable (--edit PATH), where the pool would link its read-only copy, so
a lane on a vendored package can change it. Its brief names each such
dependency, a worktree on a branch of its own, where the lane commits that
half. A start that fails before its lane
runs gives the branch that hand-out made back (mq drop LANE/ISSUE --discard, which keeps its tip), since mq new leaves the branch and its
worktree when the worktree's post-checkout hook fails; the lane is claude-x run ACCOUNT -- -p,
codex-x run ACCOUNT -- exec --model MODEL -c service_tier=TIER -c daybreak=false --cd WORKTREE, or fireworks run --dir WORKTREE with the gates allowed. A
lane on this host is confined by default: the lane's commands run under the
fleet's job, so macOS would ask the person in the fleet's name for every
location it guards with a privacy prompt, and no list of those locations is
complete. The home directory and /Volumes are denied, and only the lane's
worktree, each dependency it is handed editable with the repository that
tree is a worktree of, the configured repositories and their tracker stores, the fleet's
state volume, the opam root, dune's cache and data, the lane's temporary
directory (written) and its PATH's tools, Git's and dune's configuration
and the queue's and tracker's (read) are open again; a read the sandbox
denies never asks. A Claude lane gets them as --settings (its sandbox,
with no unsandboxed retry, and its file tools), a Codex lane as the
permission profile fleet-lane with no approval, and an ocaml-llm lane's
commands as a Seatbelt profile (--sandbox-profile).

A fleet lane resolves warrant's signing socket from WARRANT_SOCKET or
the current uid's default and denies that endpoint in each sandbox. It
refuses a lane profile if the socket lies inside one of its writable roots.
This denies the fleet lane's route to the shared agent; a process outside
the lane sandbox under the same uid and an mq check without confinement
remain separate custody boundaries. A lane can still choose another
reachable signing socket, so signer identity and check isolation remain
separate requirements.

An ocaml-llm lane's tool admits no tracker command and no path outside its
worktree but the dependencies the lock at the head of its repository
declares: each is read through its link and never written
(--read PATH=ROUTE), the link in the repository's checkout resolved at
the start to the dependency's own repository, and a write there is refused
with the route its brief also names, a worktree of that repository
(mq -C REPOSITORY new LANE/ISSUE) landing in that repository's queue, which
the lane names in a blocker line and does not commit. No lane's checkout
holds the tracker, so on any host its
brief carries the issue's text and that of each row the issue names by a
depends-on, tracks or discovered-from edge, the issue a blocker row holds
among them, and says tk reads nothing there; it only
commits, its tool is passed --commit so that what the model leaves
uncommitted at any stop is committed with its answer as the message, and
its process lands its branch once the
tool exits 0, as the lane's last land (mq land --no-wait), so the
queue's hook takes its issue on, vetting it on a worker when a host of the
configuration runs its lanes on one (--vet-on-worker); a branch with no
commit is not landed and the lane answered: the fleet resumes it no more, puts its answer on the issue and
records on it the blocker the answer's last line names, one JSON object:
{"depends_on":["ID"]} links the issue depends-on each row the
tracker does not show closed,
{"split":[{"title":"TITLE","body":"BODY"}]} files each child first in
it at its kind, priority and packages,
{"blocker":{"title":"TITLE","body":"BODY"}} files that row and
{"ask":{"title":"TITLE","body":"BODY"}} files it as an ask, a
decision labelled blocked-on:thomas, for a step that is the
maintainer's, each at the issue's priority and packages, discovered from
the issue and with the issue depending on it, {"done":"COMMIT"} closes the issue naming the
commit once git merge-base --is-ancestor reads it on the entry branch
or git cherry reads a patch-equivalent commit there; any other commit,
such as one only the lane's branch holds, files the answer as the row the
issue waits on, its title naming the commit and the entry branch. A
lane's checkout holds no ref of the entry branch, so its brief names the
branch's tip as the fleet read it at the start. And {"branch":{"issue":"ID","target":"BRANCH"}} labels the row ID
branch:BRANCH in place of any other branch: label it carries, so that
its next start runs mq new LANE/ID BRANCH, and closes the issue when
ID is another row, the tracker step that was the issue's work done; a
BRANCH that git check-ref-format refuses or that Git would read as an
option names nothing. {"home":"ID"} labels the row ID host:HOME,
HOME the configuration's home, in place of any other host: label,
so that its lanes run on the home host, which holds the queues and the
fleet's configuration a lane on a worker reads none of, and closes the
issue when ID is another row.
Anything else, an answer naming only closed rows, a commit the entry
branch lacks or a row the tracker does not show, files the lane's answer as
the row the issue depends on, an unblock row labelled unblock:ID; on an
issue that is itself an unblock row it files nothing and leaves the row the
issue unblocks to the lead, as for a lane that fails again.
An issue whose work requires tracker writes carries work:tracker. Like an
unblock row, it runs on the home host with a provider that can use the tracker.
A store that enumerates label values admits tracker in the work family.
The tracker holds the issue from its ready work until the rows it
depends on and its children close, and a P0 starts again past every
width once they have: every held issue depends on an open row, which the
tracker ranks at the issue's priority and the fleet works like any other.
A write the tracker refuses is logged and the claim released all the
same. A
backend's preamble, a file, comes before the brief of each lane it runs,
such as the working habits one model's trials pass more cases with; a
preamble the fleet cannot read fails the start before the claim. A
Codex lane runs on Codex's fast tier at full strength or for a P0 issue
and on its standard tier ("default") for every other, and with Daybreak
off, which no backend declares and the models lanes run refuse before
their first turn, whatever the account's config.toml sets. Each round of agent fleet run keeps the
fleet's status in status.json under its state directory, written whole
and renamed over the one before; a dry run keeps none. The keep reads the
farm, each queue's journal of the hour and each repository's branches, and
renders the document, off the loop that is told the lanes' ends and the
starts' answers, one keep at a time: the next round starts at its instant
whether the keep has ended or not, and a round whose keep is still running
keeps none of its own.
agent fleet status --config FILE prints the run that holds the run lock,
run process 1683, build SHA, job org.agent.fleet whatever the job's
label, or run none: no process holds the run lock, by a look that
blocks no run's take; then the brake, when one stands (below), then that
document with when it was kept. It reads nothing else: it boots no fleet,
runs no round, starts no lane and reads no queue, so any number of calls at
once cost a look at the lock and two file reads each. Before any run has
kept one it says so and exits 1. --json carries the run as run, its
process, build and job, or null. It prints
the lanes with their task, backend and account, the issues skipped in the
latest round that skipped any, the claims it released with why, every
reading a pick rests on, and, for each open host and each kind of ready work
(its task, and whether only a tracker's provider runs it), the backend it
would run on with what refused each cheaper one. A host routes every issue of
a kind alike, so one line stands for them all, with their number and the
first of them. So does a line of the P0s waiting, of the branches returned
and of the issues skipped: the status's lines are bounded by the lanes and
the configuration, never by the ready issues. agent fleet run --dry-run --once reads one round and prints
what it would do, each start's account with its soonest reset, its
strength, tier and model. Both print each host's and repository's width,
its live lanes, with what bounds it: memory pressure, the CPU, a ceiling, the ready
work, the landings, the standing queue, the accounts' windows or the
backends' capability.
agent fleet status prints each repository's climb under landings, such
as 4 lands an hour at 20 lanes, not up from 21 at 17: backs off to 10 lanes.

agent fleet status then prints the fleet's health, so that idle or
useless capacity is named by the tool rather than noticed by a person. A
worker of the queue's farm (mq worker top --json) is idle when its
reading is fresh, it has a model route (a local model whose engine
answered, or a backend of a host whose worker it is), its memory is not
short and no lane of the fleet runs on it; its line names the next step:
no host entry, its host's own bound (lanes 0 of the ceiling 0 on farm),
no backend of its host admitting a lane for any ready issue, with what
refused the first of them (a capability, an account's window, the pool of
a worker's accounts, a local model's slots), or the repositories'
bounds. A machine, a worker or the home host, delivers nothing when a
lane of it ended within the hour and none of its lanes' branches
(LANE/ISSUE) landed a commit in that hour by its queue's journal of
the hour (mq events --json --since 1h); its line lists each ending with its status and what
became of its branch: the queue's last word on it, the commits it holds
that its entry branch does not, or no commit. A branch queued now is
pending, not undelivered. A repository's lanes on a machine are named
when one of them lived over all of the hour and none queued or landed in
it, with the lanes started in the hour. On the home machine, whose
owners obs's record holds, each ending names below it the owner rows of
its lane (its worktree's and its agent session's, as the owners section
of agent fleet stats charges them), or no owner row, and a starved
repository's line names its lanes' rows and the machine's checks.

health
  carmel   idle: routes glm-farm glm-mech-farm, 261.3 GB free; host farm bound by lanes 0 of the ceiling 0 on farm
  cambria  idle: routes local:deepseek-v4-flash, 248.9 GB free; no fleet host starts lanes on it
  laptop   no commit landed in the last hour; 2 lanes ended:
    fleet1081/ISSUE  lost, the queue: interrupted: SIGTERM ended the land before it queued
      lane mono/fleet1081/ISSUE: 0.50 CPUs, 3.0 GB
      session claude 4100: 0.25 CPUs, 1.0 GB
    fleet1125/ISSUE  lost, 1 commit never landed
      no owner row
  carmel   /src/mono: no lane queued or landed in the last hour, 39 started in it

Its funnel section is the lanes' conversion over the hour, a row per
repository, machine, backend, account and task, each lane counted on its newest
start: started, the lanes started (a resume is no new lane); queued,
the lanes whose branch the queue ended a land of in the hour or holds
queued; landed, the lanes whose branch landed a commit in the hour;
commits, what those landings put on their targets; and USD, what the
lanes' ends in the hour cost by their ended lines' usage, each end on
the row of the start it ends, - when none was read or priced. A lane
started before the hour counts in queued and landed alone, so a row
can land more lanes than it started. A review lane's branch is the
writer's, so its row counts its start alone. A repository whose queue is
unread has no row, and its reading is named under health. mq stats --all gives the same hour by the queue: each target's work landings
apart from the bumps of its lock, and the work each machine landed.

funnel, lanes in the last hour
  repository        machine  backend  account          task        started  queued  landed  commits       USD
  /Volumes/mq/mono  laptop   kimi     accounts/samoht  mechanical        4       0       0        0         -
  /Volumes/mq/mono  laptop   opus     parsimoni.dev-2  design            3       2       2        5     18.40
  all                                                                    7       2       2        5     18.40

--since DURATION counts the funnel over another span (30m, 6h,
2d), each phrase above read over it in place of the hour, and adds
a line an hour of each sum divided by the span's hours, to a tenth,
and of the dollars to a cent: the reading the fleet's landings an hour
are held against. The health section keeps the hour.

funnel, lanes in the last 6h
  repository        machine  backend  account          task        started  queued  landed  commits       USD
  /Volumes/mq/mono  laptop   kimi     accounts/samoht  mechanical       17       0       0        0         -
  /Volumes/mq/mono  laptop   opus     parsimoni.dev-2  design           10       6       2        7     61.20
  all                                                                   27       6       2        7     61.20
  an hour                                                              4.5     1.0     0.3      1.2     10.20

Its spend section, over the same span, sums the funnel's rows by
backend, machine, repository and task, a table each: the lanes
started and landed, the lands, the issues those landings
carried, the millions of tokens read as input (uncached input and
cache writes), cached (cache reads) and output, and the USD; then
USD/land, Mtok/land (all tokens), USD/issue, USD/lane (per lane
started) and lanes/land (lanes started per landing), - where the
divisor is zero or the cost unknown. Its ranking names each backend
by landings per dollar, highest first, then a backend whose calls cost
nothing (free), then one with no cost read (no cost read), then
each that spent and landed nothing, the most spent first, with what it
spent: the backend that burns money without landing is the last line.

spend, lanes in the last 6h
  backend  started  landed  lands  issues  input  cached  output    USD  USD/land  Mtok/land  USD/issue  USD/lane  lanes/land
  glm           12       0      0       0   0.40   15.10    0.06   3.10         -          -          -      0.26           -
  opus          10       2      2       2   1.20   54.30    0.30  61.20     30.60      27.90      30.60      6.12         5.0
  ...
ranking, lands per USD
  opus  0.033 lands/USD: 2 lands for 61.20 USD
  glm   spent 3.10 USD over 12 lanes started and landed nothing

agent fleet stats --since DURATION prints the funnel, lives, lands,
stages, spend, train and owners sections alone, from the ledger, each
repository's queue and obs's record, without reading a round:
agent fleet stats --since 2d reads the last two days. With --json it
prints one JSON object of every section instead, each count named by its
column and each counted life, land, landing and owner by its name, for
an orchestrator to read (doc/delivery.md, "The command").

Its lives section counts each lane's lives over the span by the cause
of their end, a row per repository, machine, backend, account and task:
a resume starts another life of the same lane. Each cause is a record of
the ledger, never a status that stands for one: a stop the fleet recorded
before the end names it (stuck, from a signalled line, or braked,
spent, displaced, closed and asked, from a stopped line, whose
pool counts as spent), else the window the
provider refused the account's calls in (limited, the end's limited
member, read from the lane's rate_limit_event), else the end's status:
finished (0), answered (79), unavailable (69, or 75 with no model
call), signed-out (77) or failed (any other). A lost line is a lane whose process ended
and wrote no status; start-failed is a start that failed, and refused
a claim the tracker refused or a branch a start found with nothing left
to finish (nothing-left). live counts the lives running now. A
column shows only when some row counts it, and below the table each
limited life names its lane, account and window, and each life stopped
as stuck its quiet time against the bound it passed.

lives, in the last hour
  repository        machine  backend  account          task        live  finished  limited  stuck  lost  failed
  /Volumes/mq/mono  carmel   glm      accounts/samoht  mechanical     4         1        0      0     2       1
  /Volumes/mq/mono  laptop   opus     parsimoni.dev-2  design         2         3        1      1     0       0
  all                                                                 6         4        1      1     2       1
  limited fleet6798 on parsimoni.dev-2: seven_day until 2026-11-26T22:00:00-00:00
  stuck fleet6318: quiet 34 min of a 30 min bound

Its lands section counts each land of a lane's own branch over the
span by how it ended, on the row of the lane's newest start, as the
funnel counts its landings: a review lane's lands are the writer's. Each
end is the queue's record of it, read through mq's own codec, never its
words: vet refused is a refused outcome whose failed names the red
check of the target's vet, refused one that names none (a change in
the worktree, a merge among its commits), then landed, needs_work,
removed (by a bound, the target's state or another caller),
interrupted and unavailable; queued counts the lands queued now. A
--no-wait land's queued outcome is no end. A column shows only when
some row counts it, and below the table each check that refused or gave
back a land names its count by end.

lands, in the last hour
  repository        machine  backend  account          task        vet refused  landed  needs_work  queued
  /Volumes/mq/mono  carmel   glm      accounts/samoht  mechanical            2       1           1       1
  /Volumes/mq/mono  laptop   opus     parsimoni.dev-2  design                0       3           0       1
  all                                                                        2       4           1       2
  check lint-touched: 2 vet refused
  check test: 1 needs_work

Its stages section times each landing of a lane's own branch over the
span, from the round that decided its start to its target moved, and
gives each stage's count, median, 95th percentile and longest,
interpolated as mq stats reads its lead time. A landing's stages follow
one another, so they add up to its total: round, from the instant of
the round that decided the life's start to the instant its starting
names, when the shell began it; hand-out, from that instant to its
process spawned; work, from that spawn, or the branch's previous
queueing if later, to its vet's start; vet, the seconds of the checks its vet ran,
from its queued record; then the landed outcome's queue (queued and
waiting), replay, checks and move. A kept branch's next step, or a
land queued again after it was given back, works from its previous
queueing and has no round or hand-out, and its total runs from that
queueing. A life whose started names no spawn counts no round,
hand-out, work or total, and one whose starting names no instant counts
no round, hand-out or total.

stages, in the last hour
  stage     count    median       p95   longest
  round         3        5s       14s       15s
  hand-out      3       15s       15s       15s
  work          4  13min55s  28min26s  30min50s
  vet           5   2min30s   4min40s      5min
  queue         5      1min      1min      1min
  replay        5        5s       14s       15s
  checks        5      5min     14min     15min
  move          5        5s       14s       15s
  total         4  25min10s  46min34s  49min50s

Its train section is each target's train, a target of each
repository's queue: now, from the queue's status, its entries by state,
the size of each cut whose checks run and the replays in flight; over
the span, from the queue's journal, the cuts checked (each tree a check's
run passed or failed on, by the size its checking names) with their
median size, those red (a check whose last run failed), each bisection
that ended (bisected) with its red car, its suspects, its rounds and
its culprit, and the target's tip-red records.

train, cuts over the last hour
  /Volumes/mq/mono main
    now   3 checks running, 2 queued; cuts checking: 2 1; replays in flight: 0
    span  9 cuts checked, median size 2, 2 red; 1 bisection; tip reds 0
    bisected fleet6801/blacksun-x over 4 suspects in 2 rounds: culprit fleet6799/blacksun-y

Its owners section then gives the home machine's CPUs and memory by
owner class, over the span from obs's record (obs top --record) and now
from its live reading, each lane's row below lanes, the scheduling class
each ran at over the span (default, or the share of its CPU the kernel
ran below the default class and its nices), and the free space of the
queue's pool against its floor:

owners, in the last hour
  laptop
                                         CPUs        GB      now        GB  class
    lanes                                0.50       3.0     0.00       0.0  default
      fleet1 lane mono/fleet1/demo-a     0.50       3.0        -         -  default
    checks                               2.00       0.0     0.00       0.0  30% throttled, nice 5/10
    queue                                0.00       0.0     0.10       0.0
    ...
    disk                              412.0 GB free, floor 100.0 GB

The section it gains, a worker's owners, is specified in Reading
delivery
.

A lane is live while the fleet holds it started, or while a process on
this host names it in its environment as AGENT_LANE=LANE, which the
fleet sets on every lane it starts and a lane started by hand sets to be
seen. The ceilings count live lanes, each once; a claim takes its own
issue and is no lane. Whether a claim's holder has ended is the
tracker's verdict, the liveness that tk list --json gives each claimed
row: the fleet resumes a claim only when tk reads its holder dead (a
claim of an earlier boot of this machine, or one naming a process that no
longer runs) or the claim names the fleet's own process, never one tk
reads alive for another process, on another machine, of this boot or
unknown. Once a lane's process is spawned, the fleet claims each issue
the lane holds again with tk claim ID --as LANE --holder-pid PID --holder-id ID, the pid and the number the kernel gave that process, so
the tracker reads the lane ended exactly when that process ends. The lane's
process starts as agent fleet exec PROGRAM ARGV..., which sets
TK_HOLDER_PID and MQ_HOLDER_PID to its own pid and TK_HOLDER_ID and
MQ_HOLDER_ID to the number the kernel gave it, then becomes the lane's
process, agent fleet deliver, whose job keeps them: a claim or a worktree
hand-out the lane takes from its sandbox, which reads neither, names its
process too. When the lane's process ends, whatever its status, the fleet
hands its claims back before it records the end in its ledger: it claims
each issue tk reads the lane still holding again with tk claim ID --as LANE --holder-pid PID --holder-id ID, naming its own process, so tk
reads the claim alive while the fleet runs and its band counts no dead
claim for a lane that ended. The fleet reads a claim naming its own process
as a dead lane's, which it resumes or releases as below; once the fleet
ends, tk reads it ended too. A
session that runs lanes of its own names its process the same way, or tk
reads none of its claims dead before the machine boots again. The fleet
names the same process to the queue as the holder of the lane's worktree,
in place of its own, which the hand-out named,
with mq new BRANCH --holder-pid PID --holder-id ID on the branch the
worktree has out, so the queue reads the lane over once that process
ends. A claim the fleet reads dead, that
is no live lane, which left branches (LANE/...) and whose last life did
not end with status 0, is resumed first on its highest-priority claim
inside the machine's areas and at its priorities. A resume uses the same width, host and backend routing as
a fresh start, a P0 on the strongest backend. It runs under the holder's
name in its first branch's worktree, whether or not delivery has stopped.
Its brief names its claims, its branches and its report,
LANE.out in the reports directory (by default STATE/lanes), which
every lane writes as it stops. A lane's last land, mq land --no-wait,
completes its branch, so the queue's hook takes its issue off tk ready
(queued with no holder, then closed once the entry branch takes it).
Each step before it, the smallest change that stands alone (a failing
test and its fix are one step), lands the moment its test and lint are
green, with mq land --keep-branch --no-wait, which leaves the issue with
the lane, and the lane keeps working: small lands, landed often, are the
fastest. When a host of the configuration runs its lanes on
a merge-queue worker, every land of every lane, on this machine as on a
worker, carries --vet-on-worker, so the vet runs at the lane's committed
tip on a worker and not in a worktree of a machine whose CPUs its lanes
hold; with no such host, a land vets in the lane's worktree. A lane that
lands nothing takes its issue off tk ready, or the fleet starts another lane on it: its brief closes
an issue main already settles, naming the commit that does, links one
whose rest waits on another issue (tk link ID depends-on OTHER), and
releases with why one it cannot do. A start needs the provider's allowance
read, so a lane a network drop ended starts again once the network is
back. An ask for the maintainer (a blocked-on: label) is never a lane's
work.

A lane that fails at once on every start (an account it cannot use, a
brief it cannot read, a tool missing on its host) is not started again at
every round. When a lane's life ends with a status other than 0 and leaves
its branches as the failed life before it left them, each branch naming
the same commit, and no window of the account its last life drew on has
reached the reset read at its end, the fleet holds it: it resumes it no
more and records it as it records a lane that answered. Each claim of
the lane on an issue the fleet started it on gets a comment naming the
two ends, their statuses, the answer its log ends on (where a lane that
exits with a status other than 0 says why) and the last 20 lines of
LANE.out, a blocker
row carrying them that the issue depends on, unblock ID: lane LANE fails again on every start, then a release, held: ended STATUS at TIME, then STATUS at TIME, its branches unchanged, once. That blocker
row, like the one filed for an answer naming nothing or a commit the entry
branch lacks, is an unblock row: it carries the label unblock:ID. An
unblock row is filed one level deep at most, since one filed for an
unblock row takes its priority and fails the same way: on an issue that
carries an unblock: label, such a failure files no row. The fleet labels
the row it unblocks blocked-on:lead, comments the note on it as well, so
that row carries both lanes' failures, and closes the unblock row. No lane
starts on a blocked-on: row, and the lead's round reads them with
tk ready --label blocked-on:lead. A store whose schema enumerates its
label families lists unblock with values = ["*"] and lead among the
values of blocked-on. A claim of any other holder, or of an issue the fleet never started the lane on, is
left as it stands. A life the fleet stopped (the brake, a spent account
or pool, a displaced claim, a closed row, an operator's ask) or its
provider's limit ended ended for that reason, not its own, and holds
nothing: the lane is resumed as after any stop, unless it holds no claim
any more. No duration decides it: the issue waits on its blocker
row, which a lane of the fleet works and closes. The fleet reads a
lane's branches and the commit each names when the lane ends, and
records them in the ledger with the end, so a restarted fleet holds the
same lanes and releases them at its first round.

A dead lane the fleet started that a round does not resume has its claims
released in that round, each claim it reads dead, with tk release ID --holder LANE, so no row stays claimed by a lane that no longer runs and
that the fleet will not run again. The reason is recorded with the release
and printed by agent fleet status: ended with no branch to resume, its resume failed: WHY, or not resumed: and what refused it, such as farm closed (a host with a ceiling of 0), an account's spent window, a backend
that does not clear the task, the repository's ceiling or the machine's
areas. A lane whose resume waits on a reading not in hand keeps its claims
until the reading decides, and a claim of a holder the fleet did not start,
or one it does not read dead, is never released. The release moves no
branch: the dead lane's branch stays, and the next lane on the issue
finishes it. A branch that holds commits its target lacks stands for the
next mq new NAME, which switches a free worktree of the pool to it
(merge-queue's doc/branches.md, "After a land"). Each round's ready work
names, of each ready issue, the newest branch LANE/ID the queue keeps a
record of (refs/mq/meta/LANE/ID, which outlives the worktree's hand-out
record). Such an issue starts as a resume of that branch, before any fresh
start of its priority: the fleet claims it under LANE, mq new LANE/ID
takes back the branch's worktree on the base the queue records for it,
naming none, as a repair does, and the brief names the commits the branch
holds that its target lacks by patch id (git cherry -v TARGET LANE/ID, read once, for that start) and tells the lane to finish the
issue from them, landing each step the moment it is green. A branch whose
every commit its target holds by patch id is no resume: its start
ends before the claim, with nothing to release, and spends none of the
round, as a refused claim does. The round starts the next issue in its
stead, at the round's instant, the same issue among them as a fresh start
from its target, and the repository's window of starts in flight
stays as it was: the branch refused the start, not the store or the pool.
The ledger keeps the refusal, so no later round or run takes that branch
back while the repository's ready work names it. While LANE is live
the branch is that lane's to go on with, and no lane starts on the issue.
A branch the queue keeps no record of is no lane's, and the issue starts
fresh.

A land the queue returned (entry-returned in mq status --json: the
last land ended needs_work, was refused at its vet on a red check or was
removed from the queue, and the branch
still has something to land) is its lane's to fix forward; once that lane
has ended, the fleet repairs it. While the lane lives, a session's
included, it takes the issue its branch names: the queue's hook sets the
issue open for that lane to claim back, and no round starts another lane
on it meanwhile. Each round, of each returned branch
LANE/ID whose lane is not live and whose issue ID is ready work no
lane, claim or review takes, inside the machine's areas and
priorities, the newest starts a lane under LANE on the issue: the fleet
claims it, mq new LANE/ID takes back the branch's worktree on the base
the queue records for it, naming none (a resume and a review do the same,
so a branch stacked on an earlier lane's keeps that base), and the
brief names the queue's reason, the log the finding names (a vet
refusal's is its red check's, cause.log), and mq status LANE/ID --why.
They go in the tracker's order, each within the repository's
bounds and the hosts' as a fresh start of its issue, before any other
start. A branch whose repair failed to start is not
repaired again while the queue returns it, unless a lane on it starts, so
a failing start holds no width round after round. A fleet renewed onto
another build or configuration, which may have removed the cause, tries
it once more; a failure for the same reason as the one before it is
tried by no later run, and a resume that failed twice so is likewise
tried no more while its lane holds a claim. The lane's task is
repair, which no bar measures by default, so a judgement backend works
it, unless the configuration declares repair for a cheaper backend with
a bar its trials pass. A bump's red is the queue's own repairer's. A
returned branch whose issue is closed or claimed, or that names no issue,
is left for its issue: the queue's documents name no case where such an
entry is dropped with mq drop. agent fleet status counts, under returned, the entries with no
live lane, each with its repository, its end, the queue's reason and,
after repair failed:, why its last repair failed to start.

An issue a session works by hand needs only its claim: a claimed issue is
no ready work, and the fleet resumes a claim only when tk reads its
holder dead. To hold an issue nobody works, make it depend on the row it
waits on (tk link ID depends-on ROW): the tracker holds it until that
row closes.

A live lane can be stuck: its agent's run has ended, or waits on nothing
that will come, and its processes stay. Each round reads every live lane's
tree, the processes that name it and their descendants, and finds it
progressing when a process is new, a process other than the agent's own
spent CPU, a process reaped a command, a file the tree holds open or its
LANE.out was written, a process runs mq or tk (from any install of
them), the agent is owed its next event, or the repository's queue holds a
land of the lane (a branch LANE/... queued into the entry branch). The
agent is owed its next event while the newest event of its tool's record
leaves a model reply or a call in flight: for Claude Code any event of its
stream-json output but the result that ends its run, for Codex any
event of its exec --json output but the end of a turn or an error, and
for ocaml-llm a call of its call log, LANE.calls.jsonl, still pending or
finished on a tool call other than its answer. A lane waiting on its
provider, on a call, on its land or on a run on a worker is never stuck:
whether a reply can still come is the agent's client's to tell, as a live
child's is its tool's. An agent's own CPU tells nothing, since an idle
agent's timers spend some; a call it runs in its own process, such as
ocaml-llm's search over the whole tree, is told by its record. The bound is the 95th percentile of
the gaps between a lane's progressing readings, in whole minutes, once
three are measured. A lane quiet for the bound, and read quiet in two
rounds, is sent TERM, each process checked by its start, and at the next
round KILL to those of them still live. It keeps its claims and is
resumed from its LANE.out as a dead lane. A lane relaunched under its
name, none of the processes sent TERM left, is a new session: no KILL
reaches it, it is no longer stuck, and its quiet starts afresh, the old
session's silence no gap. Each signal is a ledger line, signalled with
the lane and the signal, and the fleet band
counts the lanes stopped as stuck that have not started again (stuck N).

The fleet's wake is the empty file STATE/wake, whose appearance starts
the next round (doc/dispatch.md, "A round is a run"). Each writer publishes
what the wake tells of first: a lane's process writes it once the lane's
status is written, and agent fleet stop, brake and unbrake once their
record stands. A run under way takes the wake as it appears, reads the
operator's records at once, and starts the next round once the open one has
decided, so a wake loses no reading. A
round leaves a task, agent fleet wake --at INSTANT, for the next instant
one of its rules names: an account window's reset, the reset a provider's
limit stated, a climb's next probe and the instant a live lane's quiet
reaches the stuck bound. Each instant has one task, under the lease
STATE/wakes/at.SECONDS, and a round leaves none while a task stands for an
instant no later. A round that memory refused a start leaves agent fleet wake --pressure, under STATE/wakes/pressure, which writes the wake at the
kernel's report that memory is short after which its level reads below
critical. The tasks run in sessions of their own and append to
STATE/wakes/tasks.log; one whose lease's file loses its name, as when the
state directory is removed, ends with no wake. agent fleet wake with no
option writes the wake at once.

$ agent fleet wake
woke: STATE/wake

An operator stops the fleet with agent fleet brake --reason TEXT and
lifts the stop with agent fleet unbrake. The brake is STATE/brake.json,
written whole and renamed over the one before, naming who applied it (--as,
USER by default), when and why; the fleet reads it at its wake, which the
command writes, and as every round begins, so it holds within seconds, the
round then open included, and across a restart and a renewal, and no job is unloaded. A braked
round starts no lane, resumes none, repairs and reviews nothing, and
releases no claim of a dead lane it would resume; it still reads, releases
the claims of lanes that ended with status 0 or on an operator's stop,
stops a stuck, spent or displaced lane, one whose row closed under it and
one an operator asked stopped, and drops the branch of a lane whose row
closed under it. A brake file that cannot be read holds as a brake,
as the queue's freeze does. Merge-queue's brake applies this brake from
its own build when no entry ends under the anchor either, with a reason
that names its reading, and files the ask that lifts it. With --stop the brake also stops each running
lane the fleet started, once, its process group sent TERM as a displaced
lane's is, a ledger line stopped whose why is braked with who and why,
so a fleet booted again stops no lane twice. A lane started by hand is not
the fleet's to stop. A stopped lane keeps its claims, its branches and its
LANE.out, and its end repeats no failed end, so the hold above never reads
the brake's stop as a lane that fails at once: the first round after agent fleet unbrake resumes it as any dead lane. --queue also freezes every
queue of the machine (mq freeze --all --reason TEXT); agent fleet unbrake lifts the fleet's brake alone and prints the mq unfreeze --all
that unfreezes the queues; it writes the fleet's wake, so the round it
starts reads no brake. agent fleet status prints the brake after the
run, --json carries it as brake, and the band starts with it
(below).

$ agent fleet brake --reason "load 500 on 18 cores" --stop --queue
braked by thomas at 2026-11-26T15:00:00-00:00: load 500 on 18 cores; stops its lanes; froze the queues
$ agent fleet unbrake
lifted: braked by thomas at 2026-11-26T15:00:00-00:00: load 500 on 18 cores; stops its lanes; froze the queues
the queues stay frozen; to unfreeze them: /bin/mq unfreeze --all

Each machine runs a fleet of its own and claims in its own copy of the
tracker, which meets the others' copies only at a sync, so two machines
apart could claim one issue. The areas a configuration names, each a
package's directory or a label, are those of the machine the fleet claims
on, and the fleet starts a lane only on an issue inside them: every package
it names is an area, or one of its labels is. Machines whose configurations
name disjoint packages never claim one issue, whatever packages it spans;
an issue that spans two machines' packages is neither's, and no two
machines name labels that one issue carries together. A configuration with
no areas takes every issue. A selector !PACKAGE excludes any issue
that names the package, even when a positive area matches. To take
every package except ocaml-merge-queue, set
"areas": [ "!ocaml-merge-queue" ]. An empty list takes no work.
When the ready work is all outside, the round says so. agent fleet status prints under areas each repository's ready issues and how many
each selector refuses, a selector that refuses none with 0, such as
/src/mono 7101 ready; !ocaml-merge-queue refuses 306. The configuration
travels in the tree, so a landed change to it moves the areas.

Inside its areas, a configuration may name the priorities its lanes
start on, each one of the tracker's, 0 to 4: a machine whose only backend
is a local model takes [ 2, 3 ], and starts no lane on the P1 ahead of
them, which no other machine's fleet takes either. A configuration with no
priorities takes every one, and the round says when the ready work
inside the areas is all at other priorities.

Run agent fleet check-areas FILE... on the configurations before
starting a second fleet. The command refuses shared areas after
accounting for exclusions. It also refuses two fleets that can both
take packages outside their named areas.

When two machines' copies of the tracker claimed one issue while apart, the
sync that merges them keeps the agreed copy's claim and records the other
on the row as displaced (the tracker's distributed model, section 2).
Each round reads the claims, and a lane the fleet runs whose issue the
tracker reads held by another holder, other than the lane a review lane
reviews, has lost its claim: the round stops it, its process group sent
TERM once, and names the issue and its holder on the stop, a ledger line
stopped whose why is displaced with the issue and the holder.
The stopped lane holds no claim of the issue, so no round resumes it there,
repairs its returned branch (its issue is claimed, so no ready work) or
starts a review of it, and its branch stays for the holder to read. The
issue takes no land from it but one it queued before the round read the
claim. A resumed lane that holds other claims is resumed on them as any
dead lane is.

A row can close under a lane that still runs on it, when another lane's
land took the work, and the lane goes on to a second fix of what the
entry branch holds. Each round reads the rows of its live lanes' issues
(tk show ID... --json), and a lane whose row reads closed or landed
has had its row closed under it: the round stops it, its process group
sent TERM once, a ledger line stopped whose why is closed with the
issue and the status. A row read queued stops nothing, since a lane's
own last land queues its row moments before the lane ends. Once the lane
has ended, the next round drops its branch and its worktree, mq drop LANE/ISSUE --discard, whose line names the commit that brings the
branch back.

An operator stops one lane with agent fleet stop LANE --reason TEXT.
The ask is STATE/asked/LANE.json, naming who asked (--as, USER by
default), when and why. The command writes the fleet's wake, at which the
fleet stops the lane, whatever its open round waits on, its process group
sent TERM once, a ledger line stopped whose why is asked with who
and why, and removes the ask; an ask that names no lane the fleet runs is
removed with a line that says so. Once the lane has ended, its claims are
released, stopped as asked by NAME: TEXT, so no round resumes it: its
issue is ready work again and its branch stays for the next lane to
finish.

$ agent fleet stop fleet4462 --reason "a second fix of what main holds"
fleet4462 asked stopped by thomas at 2026-11-25T15:10:00Z: a second fix of what main holds
{ "home": "laptop", "every": 300, "state": "/var/fleet",
  "areas": [ "ocaml-merge-queue", "topic:farm" ],
  "tools": { "mq": "/bin/mq", "tracker": "/bin/tk" },
  "providers": {
    "claude": { "agent": "claude-x", "tool": "/bin/claude-x" },
    "codex": { "agent": "codex-x", "tool": "/bin/codex-x" },
    "fireworks": { "agent": "llm", "tool": "/bin/fireworks" } },
  "backends": [
    { "name": "glm", "provider": "fireworks", "model": "glm-5p3", "accounts": [ "default" ],
      "preamble": "/var/fleet/prompts/glm.md" },
    { "name": "sol", "provider": "codex", "model": "gpt-6.1-sol", "accounts": [ "default" ],
      "tasks": [ "mechanical" ],
      "price": { "input": 1.25, "cached_input": 0.125, "output": 10 } },
    { "name": "opus", "provider": "claude", "model": "opus", "accounts": [ "a", "b" ],
      "judgement": true } ],
  "bars": { "mechanical": { "rate": 0.8, "trials": 5 } },
  "capability": { "glm": [ "/var/fleet/eval/glm.jsonl" ] },
  "hosts": [
    { "name": "laptop", "backends": [ "glm", "sol", "opus" ] },
    { "name": "farm", "lanes": 0, "backends": [ "opus" ], "worker": "farm" } ],
  "repositories": [
    { "path": "/src/mono", "entry": "main" } ] }

No account keeps a fixed share: each window is spent along its line,
from 0 at its start to 100 at its reset (Llm.Pace), so nothing of it is
left at the reset and none of it runs out before. The line at an instant
is 100 * elapsed / length, the window's length as its source states it
(minutes in usage --json). The fleet measures a lane's draw on each
window, in points per lane-hour, from readings an hour apart within one
period of the window, those its ledger replays included. A reset that
moved by less than the time left to it is the same period's: Claude
prints the weekly reset as 17:59:59 in one reading and 18:00:00 in the
next. A lane's life is the mean of the lives of the ended lanes of its
issue's task, the ledger's included, or of every task's while its own has none. A window with n lanes
drawing d points a lane-hour admits one more lane of life l while
used + n * d * l stands at or under its line: the margin the lane it
admits will draw. An account whose use passed a window's line by more
than one lane's draw (d * l of the lane it would stop), or that spent
it, stops its newest lane off a P0 that does not run on a worker host,
and the stop is a ledger line, stopped with the lane, the instant and
why: spent with the provider, the account, the window, its use and its
line. On 2026-12-02 the three Codex accounts stood at 0 to 3% of their
week, a Codex lane drew 2 to 8.4 points a lane-hour, and a projection of
every lane drawing until the reset admitted none of them before the
week's last 11 to 49 hours, while 4,505 design and 253 security issues
waited on Claude accounts at their limit; the line spends the same
allowance across the week. As the reset nears the line reaches 100, so
the allowance that resets soonest is still spent first: among the
accounts that admit a lane, the one with the most to spend per hour
before its resets goes first (Llm.Pace.target, the rule claude-x pick
and codex-x pick rank accounts by). While a second lane more would
still fit under the line, the lane runs at full strength: the fast tier,
the provider's strongest model for the task (the last of its backends on
the host's route that clears the issue's task) and, for Codex, high
reasoning effort. Before a lane's draw and life are measured, or a
window's length is known, an account takes one lane at a time and stops
a lane only once a window is spent. A window with no reset (a model's
free slots) bounds only while it has no headroom.

On a host whose lanes are jobs of a worker, the worker's relay picks the
account each session draws on, by the same pace, so a backend's accounts
there are one pool: what admits a lane is the pool's availability, the
lanes its accounts can still serve by their resets, summed. An account
whose windows each have a draw measured serves (100 - used) / (h * d)
lanes on each window, h the hours to its reset and d a lane's draw, and
the least of its windows; one with a window not yet measured serves one,
and a spent one none. An account the allowance does not read, or that a
limit puts out, serves none: no answer admits nothing. The pool admits one
more lane while the lanes drawing on its accounts, wherever they run, and
that lane are no more than its availability, at full strength while a
second one more would fit. The start names the account the pace ranks
first, the one the relay picks by the same rule, and its lane counts there
for the draws. A round the pool refuses names the backend, its lanes and
its availability. What stops a lane there is the pool too: while the lanes
drawing on its accounts are more than its availability, it stops the
newest of the backend's lanes on a worker host, off a P0, one at a time, a
stopped line whose why is pool with the provider, the backend, its
lanes and its availability. An account of the pool read alone stops none
of them: the pool admitted the lane by what all its accounts serve, and
the start named the account only for the draws.

A host with a worker runs its lanes as jobs of that merge-queue worker.
Its job holds the repository's commit alone, each dependency the pool's
read-only copy, so it takes no issue that edits a dependency, a P0
neither; a host that runs its lanes itself takes it.
A provider with agent: "llm" names the worker's model proxy as its
base_url, such as http://127.0.0.1:8443 on Darwin. A provider with
agent: "claude-x" runs the worker's own Claude Code, claude -p at the
host's pin, whose managed settings name the model proxy and confine its
commands; the worker's relay picks the account a session draws on, and the
backend's model is one the worker's declaration lists, such as
claude-opus-5-5. A codex-x provider is refused. The fleet reads
the worker's fresh memory pressure and its available memory before
admitting work (the kernel's critical level on Darwin, the watch's
slice-pressed or disk-low finding on Linux; the farm reading's
available bytes, Worker_farm.available), claims
the issue and creates its branch at home, at its target's tip with that
target as its upstream, and hands out no worktree. The job receives the issue text
and that of the rows it names,
works in its checkout and commits; its bearer word names the lane and has
no authority outside the proxy. The lane's process is agent fleet deliver, in a session of its own: it runs mq worker run --branch, which
returns those commits, then submits a successful result to the queue with
vetting on a worker when the lane may land, as the lane's last land, and
writes the lane's status to
STATE/lanes/LANE.status, then the fleet's wake. A failed worker or a refused land is a failed
lane; a result with no commit is an answer, and its branch is dropped. A
result with commits is handed a worktree before its land.

agent fleet run --worker-only WORKER restricts enabled hosts to jobs on
that worker. Repeat the option to allow several workers. A local launch,
missing launch declaration or another worker is refused before reading
commands or starting a lane. A replica's producer names its declared worker
with this option; inactive hosts with zero lane capacity start nothing.

agent fleet install --config FILE writes the launchd job and loads it,
unloading the one already loaded first, and prints the job's state as it
reads it back. A headless
role uses agent fleet install --user USER --config FILE, run as root:
the same job is a system LaunchDaemon, runs as USER, and starts at boot
without a GUI session. Its state directory belongs to USER.
Either job runs in launchd's interactive class (ProcessType
Interactive), the class merge-queue gives its own runs, and every
lane, build and queue command the fleet starts inherits it. A job that sets
no ProcessType runs as Standard, which launchd throttles: under a load
of 200 on 18 cores a command the fleet started took 10 to 20 times what
it took from a shell.
agent fleet install --user USER --config FILE --print prints its plist
without installing it. The configuration and executable must be readable
by USER, and its executable search path is the install command's PATH.
Before the first round that finds its configuration file changed, or the
path it was started from naming another file than at its start, as an
install that moves the link leaves it, agent fleet run executes the file
that path names now in its own place, with the same arguments, and prints
renew with why and build with that file. The pid stays, so launchd sees
no exit: a job kept alive that exits and is respawned every few minutes is
one launchd defers (launchd.plist(5), ThrottleInterval
and KeepAlive), and with it every round. It renews at once, whatever
lanes it runs: each runs on in its own session, a worker lane's land with
it, and the build booted next reads it back from the ledger and reaps it
once it ends. Only a build that cannot be executed ends it, with status 1
and why. Each start's ledger line, started or start-failed, names
the build the fleet ran under as build, the SHA-256 of the bytes of the
file it was started by, so each lane's end is a reading of that build.
The build it renews onto is on trial for the fleet's function, a start
that reaches the queue, and for the model relays', a lane's model calls,
read by merge-queue's brake from the ledger (merge-queue's install page,
"The brake"): two lanes started under it that end start_failed, lost
or with no branch and no answer, with none between them whose branch was
queued, or two whose backend was unavailable (69) with no model reply,
with none between them that had one, move the link back, and the fleet
renews onto the build the link names then, as after any move.
agent fleet lanes prints what the brake reads: each lane's end the
ledger holds, oldest first, one a line, as its position in the ledger,
the build its start names, the lane and how it ended (start-failed WHY,
lost, reached, or ended with branch, answer, unavailable or
status-N and then replied or silent); with no configuration it
prints nothing. The
brake never runs the fleet's build, so a build whose round cannot start
is judged as one whose lanes fail. A lane whose process group it finds gone ends with the status in
its LANE.status, and is lost when none was written.

A fleet that launchd runs as the GUI job compares, as it starts, the
plist its build renders with the job's file. When they differ, as after a
renewal onto a build that renders the job in another form, it runs
agent fleet install --config FILE in a session of its own and prints
reinstalled. That install unloads the job, the fleet with it, and loads
the new plist, and each lane runs on in its own session. An install that
fails is printed as reinstall with why, and the fleet runs on under the
job it has. A fleet started by hand, or with --dry-run, leaves the job
alone. A system role's job takes a new form only from
agent fleet install --user USER, run as root.

A lane's ended ledger line carries what its model calls used, one
entry per model, read from the lane's own record and never estimated:
the result events of a Claude Code lane's stream in LANE.jsonl, and
the assistant messages of a session after its last result, or of one
cut off before any, each message once and Claude Code's own <synthetic>
errors left out, the
turn.completed events of a Codex lane's, and an ocaml-llm lane's call
log, LANE.calls.jsonl. Each entry names the model and its tokens by the
OpenTelemetry GenAI conventions (gen_ai.request.model,
gen_ai.usage.input_tokens with the cached ones included,
gen_ai.usage.cache_read.input_tokens,
gen_ai.usage.cache_creation.input_tokens, gen_ai.usage.output_tokens,
gen_ai.usage.reasoning.output_tokens), and cost_usd: the cost the
source reports, as Claude Code prices its own calls, else the tokens at
the backend's price, the provider's published US dollars per million
uncached input, cached input and output tokens. Only what the run wrote to
its record counts, so a resumed lane's earlier runs are not counted twice.
An end with no readable record, a lane a restarted fleet finds gone or an
ocaml-llm lane on a worker whose call log stays there, has no usage.

The pure agent.job library exposes Agent_job, the shared job renderer,
registration commands and state reader, without the agent runtime.

The fleet band in Claude Code #

agent claude install installs the agent-fleet skills-directory plugin in
CLAUDE_CONFIG_DIR, or HOME/.claude. AGENT_FLEET_CONFIG, then
$XDG_CONFIG_HOME/agent/fleet.json (by default ~/.config/agent/fleet.json),
selects it. The account is recorded in the agent XDG state directory;
agent claude install --recorded updates each recorded real skills folder
once, leaving missing installations absent and refusing foreign folders or
links. A new Claude Code session loads the installed plugin.

The band reads agent fleet status --json, the status the fleet's last
run kept, and shows one line:

fleet   lanes 31 · claude 22 · codex 6 · local 0 | claude 36% · codex 97% · local up cambria deepseek-v4-flash

The total counts all providers; Claude, Codex and local counts follow.
Managed lanes and hand lanes with AGENT_LANE count once per lane name.
While lanes stopped as stuck have not started again, stuck N follows the
total (lanes 31 · stuck 2 · claude 22). While a brake stands, it follows
the label in red, with its age from a minute on (fleet braked by thomas 5m ago · lanes 0 · claude 0). While no process holds the run lock, no run follows in red (fleet no run · lanes 0 · claude 0).
Each provider's weekly figure is the mean percentage remaining over its
included, readable accounts with a weekly window; exhausted accounts
contribute zero. Green means on pace, yellow means an account stands past
its line or its line is unknown, and red means the provider's weekly allowance is exhausted. A read the service
refuses (an HTTP 429) keeps the account's last reading, and a figure resting
on a reading a minute or more old is followed by its age (36% 2h ago); ?
means no reading was ever made. Local names each farm host's local model,
from the host's reading that mq worker top --json shows: up with the
hosts and models whose engine answered the host's latest health request,
down with the silent ones (red only while a local lane runs), none
when no host serves a model, and ? when those readings are unread.
Accounts and reset times stay in
agent fleet status; --json includes them and the band's spans, while
--band prints just the line. The plugin passes the session's repository
as --root: outside a repository, or in one no registration of this
machine runs mq in, it shows no band, and --band prints nothing. The
plugin refreshes at most once every 30 seconds. An unread snapshot
displays the status command. From a minute after the status was kept, the
line ends with its age ( · kept 3m ago), and --json carries at, when
it was kept, and age, the seconds since.

Other commands #

$ agent init      # Create the Dockerfile, preset prompts and TODO.md
$ agent login     # Authenticate with Claude
$ agent merge     # List worktrees or merge one into main repo
$ agent shell     # Debug shell in the container
$ agent todo      # Show the TODO list in TODO.md
$ agent todo --check  # Exit 0 if every TODO is complete (for --until)

Configuration #

Presets #

A preset is a prompt that comes with a default --until command. The
prompts call Claude Code skills. A skill is a named folder of instructions
(a SKILL.md and optional extra files), and Claude loads it when a prompt
names it with a slash, as in /ocaml-testing.

The fix preset runs the tests and fixes the failures using the /ocaml
and /ocaml-testing skills. tidy cleans up the code with the
/ocaml-dev:tidy skill, and security hardens it with the /ocaml-security
and /fuzz skills. lint fixes merlint warnings with the /ocaml skill.

agent init writes each preset to ~/.config/agent/prompts/NAME.txt, and
you can change a preset by editing its file.

Preset Until Command
fix dune test
tidy dune build
security dune test
lint merlint . --error-on-warning

The lint preset's command is broken. merlint has no --error-on-warning
flag, so cmdliner rejects the command line with status 124 and the loop
never sees a success. Plain merlint . already exits non-zero on any
finding, and that is what the preset should run. Until it is fixed, pass
--until 'merlint .' along with --preset lint.

Docker container #

agent init writes the Dockerfile to ~/.local/share/agent/Dockerfile. The
image is called ocaml-agent. It starts from
ocaml/opam:ubuntu-24.04-ocaml-5.4 and adds these tools:

  • dune, merlin, ocaml-lsp-server, ocamlformat and utop;
  • Claude Code, on Node.js 20;
  • merlint and prune;
  • memtrace, alcotest and alcobar;
  • perf, valgrind, gdb, strace and ltrace.

Directories #

Path Purpose
~/.config/agent/ Claude credentials, preset prompts
~/.local/share/agent/ Dockerfile
~/.cache/agent/worktrees/ Git worktrees

Options reference #

agent run [OPTIONS] [PROMPT]

OPTIONS:
  --until COMMAND       Loop until COMMAND succeeds (exit 0)
  --preset NAME         Use preset (fix, tidy, security, lint)
  --path PATH           Focus on specific paths (repeatable)
  -w, --worktree        Run in isolated git worktree
  -p, --prompt FILE     Read prompt from file (use '-' for stdin)
  -C, --directory DIR   Working directory
  --privileged          Run without Docker sandbox
  --max-iterations N    Limit iterations (default: unlimited)
  --show-tools          Show tool usage during conversation
  -v, -vv, -vvv         Increase verbosity

Licence #

ISC