---
name: "routine-delivery-loop"
type: routine
license: CC BY-NC-SA 4.0
description: Driver routine for the full Claude Code delivery loop. Sequences exec → qa → route → merge for each eligible ticket in one session, with a 2-strike QA bounce cap and a run budget derived from the schedule interval so a run cannot outlive its own next firing. Each build (exec) and the QA leg run as isolated, disposable subagents so no build's context lands in the driver session and one run drains the whole queue rather than choking mid-queue; the exec subagent is a fresh context, never a fork. QA runs on the Opus tier, exec, route and merge on the session default. Loaded by the Cloud Routine config via a verbatim read. Replaces the three separate timer-polling routines (exec, qa, merge timers). Trigger it whenever asked to run the delivery loop or babysit the queue.
---

# routine-delivery-loop

The driver routine of the Claude Code delivery loop. Sequences the exec, qa, and merge skills in one session, draining the eligible ticket queue. Replaces three separate timer-polling routines and removes inter-leg latency at each handoff.

## Trigger

Timer-based Cloud Routine. This file is the canon; the Cloud Routine config is a thin loader carrying the canonical loader line in `core-operating-model` (*The loader line — one form*) and nothing else. Behaviour changes are made here, never in the routine config.

**An interactive build session with a green PR drives these legs itself — it does not wait for the schedule.** The timer is how the loop finds work nobody is sitting with; it is not a gate on the legs. A session that has just built a ticket and has a green PR runs the same sequence the driver runs, as subagents, on its own ticket: **QA** (`skill-review-pr`, Opus tier, worktree isolation), then **route per verdict**, then **`skill-merge-pr`**. Telling the Owner to wait for the next firing converts ten minutes into the gap to the next run — about nine hours on the 00:13 UTC cadence — for work already finished and already green. The fleet boundary is unchanged and so is the one that matters: **Forge still never merges its own PR** — the merge is Relay's leg, run as `skill-merge-pr`, and its CI-clean and conflict fail-safes apply exactly as they do under the timer. (Worked case: A1-499, 2026-09-23 — the session announced that Prism and Relay would run at the next firing; the Owner corrected it, noting other sessions had driven both legs themselves all day; once corrected the ticket went green-to-merged in about ten minutes — APP-1703.)

**Surface preflight — confirm this is a GitHub-capable surface before anything, and decline outright if it is not.** The core legs — exec, qa, merge — all need GitHub repo access (clone, build, PR, merge). GitHub-backed delivery is **Claude Code's** job; the Cowork surface carries no `mcp__github__*` tools and its egress proxy denies repo access, so the loop structurally cannot run there. Before the run-level lock and the eligibility scan, confirm two things: (1) the GitHub connector is present on this surface, and (2) it can actually reach an in-scope repo. **The authenticated read through the connector the legs actually use is the test**: `git ls-remote` against a known private in-scope repo, or `mcp__github__get_me` / `list_branches`, returns success rather than `could not read Username` / `Invalid username or token`. A successful `git push --dry-run origin HEAD:refs/heads/claude/<probe>` against a private in-scope repo is the strongest single signal, because it exercises the write scope the exec leg needs; where it is cheap, take it. If either check fails, **decline the run outright** with a clear operator signal naming which read failed and against which repo. **Do not inspect the value of** `GITHUB_TOKEN` **/** `GH_TOKEN` **at all, on either path.** The authenticated read is the whole test: a credential's value is never the evidence, so the literal placeholder `proxy-injected` is not a decline condition, not a corroborating diagnostic on the failure path, and not a tie-breaker. On the Claude Code cloud surface both variables **are** literally `proxy-injected` in a fully healthy session — the 2026-09-04 run read exactly that, then opened 12 PRs and squash-merged 11 across the estate — so the string discriminates nothing in either direction, and a conjunct that fires on every healthy run trains the next reader past the guard, which is precisely when the real wrong-surface case slips through (APP-805, APP-801). An unset variable is likewise not a decline condition on its own. A run reading the token shape literally declines itself on a session that can read, clone, push and drive the GitHub MCP — silently, self-justifyingly, every scheduled run until someone notices the queue has stopped for a reason that was never true. Do not probe with raw `curl` against `api.github.com` and do not treat an HTTP 403 as a decline signal: the egress proxy 403s direct API calls by policy on the same surface where the MCP tools work, so a curl-403 is a false negative (`convention-github` *Reading CI / PR state*). (Worked cases: the 2026-08-19 09:15Z run — `GITHUB_TOKEN` literally `proxy-injected` while `git ls-remote`, a `--depth 1` clone of private `claude-ops`, a push dry-run and `mcp__github__get_me` all succeeded, and the run proceeded on the reachability evidence by judgement — APP-1032; the same shape on 2026-08-23 — APP-1057.) A missing or unreachable GitHub connector is a *wrong-surface* / *unprovisioned-session* signal, not a repo-scope gap to work around: do **not** fall back to a Linear-only partial run, and do **not** reach for a Linear-side merge (`merge_diff`) as a substitute for the GitHub merge — a workaround that "works" makes a run that should never have started look partly successful and hides the real problem. The remedy is the operator's (schedule the loop on Claude Code only; ensure the session's GitHub connector is provisioned), named in the report. (Worked cases: a Cowork-scheduled copy that could not clone and reached for `merge_diff` — APP-805; a Claude Code session with no assoc-one GitHub auth that would have claimed-then-failed had the queue been free — APP-801.)

**Concurrency guardrail — with a staleness escape, scoped to the repo the active leg is touching.** Before running, check for any ticket currently In Progress with label `F0-RGE` — the active-exec-leg signal. If one exists, never run two legs concurrently in the same repo; but first distinguish a genuinely active run from a stalled handoff, so a single stuck leg cannot block every future run indefinitely:

- **Genuinely active** — In Progress under `F0-RGE`, having entered In Progress **recently** (within the staleness threshold, default ~3 hours), whether or not a PR exists yet. Another exec leg is mid-run: **skip the run entirely for that ticket's repo**, as before. The staleness threshold governs *both* conditions of this branch: recency is what makes a leg active, not the mere absence of a PR. A claim past the threshold with no PR is a crashed leg, not an active one, and belongs in the *ghost claim* branch below — never here.
- **Ghost claim (crashed before any output)** — In Progress under `F0-RGE` **past** the threshold, with **no** attached open PR, **no pushed `claude/<ticket-id>` branch on the remote** (`git ls-remote --exit-code origin claude/<ticket-id>`), and no agent comment since the claim. A branch with no PR is an interrupted leg, not a ghost: surface it in the end-of-run report with its age rather than resetting it (APP-1004). **The branch test is a proxy for "work may exist that a reset would strand", and two cases satisfy the proxy while carrying no such work — check both before surfacing.** First, **a branch at zero commits ahead of base carries nothing**: `git rev-list --count origin/main..origin/claude/<ticket-id>` returning `0`, with the branch tip equal to `origin/main`, is exactly the state `skill-build-ticket`'s mandated early push produces, and a marker branch must not read as an interrupted build. Second, **a driver holding direct evidence its own leg died** — a container-restart or task-stopped notification naming that task — is not inferring from staleness and is not held to a heuristic built for the inference case. Where either holds, reset as a ghost. The APP-1279 rule that a reset comment never asserts nothing is inheritable is satisfied by **showing** rather than asserting: record the commit count and the SHA equality in the comment alongside the three test results. Without these, the reset never fires and the surface never stops firing — the branch does not stop existing, so the ticket is re-surfaced by every future run and reset by none, and one batch sits In Progress permanently. The early push that created the marker is the driver's own rule (`skill-build-ticket` step 1), which makes this the cost of that rule rather than an argument against it. (Worked case: APP-1377 was claimed at 00:17:53Z on 2026-09-13, its exec leg destroyed by a container restart, and the session resumed at 13:12Z holding the harness notification naming that exact task. In Progress 12h 55m and no open PR both read true; `claude/app-1377` existed, at `20aaf52b…`, identical to `origin/main` with `rev-list --count` of 0. Reset to Todo with `F0-RGE` kept, assignee clear and the branch left in place, as a judgement the driver had to make live — APP-1416.) This is `skill-build-ticket`'s stale-claim-recovery case — a run that died before cutting a branch or opening a PR. **Do not skip:** defer to `skill-build-ticket`'s recovery (move the ticket back to **Todo**, keep `F0-RGE`, comment that a crashed run left no PR and the state was reset), so the leg unjams and the next eligibility scan re-evaluates the ticket on its merits. Skipping this branch is the failure this reconciliation fixes — the ghost is precisely the leg that got *nowhere*, yet the old wording ("carrying no attached open PR yet") routed it into *genuinely active* and blocked its whole repo indefinitely, the case where a crashed leg starves the most downstream work. Per this driver's own rule that it *calls existing skills rather than duplicating their logic*, defer to `skill-build-ticket` here rather than restating a thinner version of its ghost test. (Worked case: A1-323 sat In Progress under `F0-RGE` for ~14.7 hours with no branch and no PR, behind six eligible `meirionpritchard-com` tickets; a run reading only the driver's old wording skipped all six, while the run that reset it did so by reading `skill-build-ticket` and judging it the better rule — a call canon should not leave to per-run judgement on a guardrail — APP-808.)

  **Re-read immediately before the reset write, and write the comment to what was observed.** All three ghost tests are *post-push* signals, and a leg produces none of them until its first push — so the longest legs look most like a ghost for longest, and the reset lands hardest on the leg with the most work behind it. The freshness rule that makes a claim safe makes a reset safe for the same reason: take a second fresh `get_issue` immediately before the reset write, exactly as `skill-build-ticket` requires of a reset followed by a re-claim, and abandon the reset if anything has moved. Then name the three tests and what each returned, and **never assert that nothing is inheritable** — the recovering run cannot see a branch pushed seconds later, and a reset that strands real work while stating the opposite leaves nothing downstream to recompute it. (Worked case: APP-1243, a solo oversized publish of ~85 KB, was claimed at 02:04:49Z and reset as a ghost at 09:15:35Z. All three tests read true at the instant they were taken and the leg was live — 8h 29m into a build whose attachment fetch, baseline manifest, regeneration and two full agents-site builds all land before the first push. The recovery comment said "nothing is inheritable and no work is lost"; branch `claude/APP-1243` at `568c551` was digest-verified and had to be recorded on the ticket by hand afterwards so the next claimant did not rebuild it — APP-1278, APP-1279.)
- **Likely-stalled handoff** — In Progress under `F0-RGE` for longer than the threshold *and* already carrying an attached open PR. This is exec having opened the PR but never completed the handoff (never moved to In Review, so the label was never evicted to `PR-1SM` and the assignee was never cleared) — a crashed or interrupted leg, not an active one. **Auto-resume the handoff only when the stall is provably complete; otherwise surface it.** Check four conditions on the attached PR: (1) it is **non-draft**; (2) its **head is the ticket's head** — the PR points at this ticket's branch and its head SHA is current; (3) **every required check has concluded green**, read via `list_workflow_jobs` on the run id — never the cached `get_check_runs` / `get_workflow_job`, which serve a stale `in_progress` for 20+ minutes after a job has actually finished (`convention-github` *Reading CI / PR state*, APP-938); and (4) **every acceptance-criteria box is ticked**. If all four hold, the stall is provably complete and only the routing write is missing, so complete it unilaterally: **move to In Review, set label `PR-1SM` (evicts `F0-RGE`), clear the assignee** — exactly the handoff exec would have made. This mirrors the ghost-claim branch above, which already acts unilaterally on the *more* ambiguous no-PR state (APP-808), and `skill-merge-pr`'s split of a stall by whose remedy it is: a provably-complete handoff is the loop's own to finish, not the operator's. **If any of the four conditions fails**, do not auto-resume: surface it as a likely-stalled handoff for the operator — name the ticket, its open PR, which condition failed, and how long it has sat In Progress — and recommend either resuming the handoff by hand or clearing it back to Todo so the loop can proceed. A stall that is not provably complete is the operator's call; a provably-complete one is just an un-written handoff, and the loop writes it (APP-924).

**A live QA leg holds its repo too, and the marker is the signal.** The scan above keys on In Progress under `F0-RGE`, which is the exec-leg signal and only that; a QA leg is just as much a live leg and it reads a tree the whole time it runs. So before starting any leg, also treat a repo as held where its ticket carries a `[qa] REVIEWING HEAD: <sha7>` marker posted within the staleness threshold with no `[qa] HEAD: <sha7>` verdict at that head — a review is open against that commit and the tree is in use. Past the threshold, nothing changes: a marker with no verdict is already the no-parseable-verdict route, and the stranded-`PR-1SM` sweep applies as written. This is the cross-run half of the same-repo rule *2. QA leg* carries within a run — that rule reads the driver's own memory of an outstanding subagent, and a second driver has no such memory. The marker stays advisory towards the Owner: it gates no merge and creates no wait state for him; it holds only a sibling agent leg on the same repo. Publish batches make this structural rather than incidental — `skill-ops-sync` emits several sibling PUBLISH tickets per run, all targeting `claude-ops`, so sibling legs collide there by design rather than by chance. (Worked case: APP-1173, `assoc-one/claude-ops` PR #188, 2026-09-08 — a sibling exec leg working the next batch ticket switched the shared checkout from `claude/app-1173` at `1914c78` to `claude/app-1174` mid-review; every subsequent read returned `main`'s bytes while `git status` reported clean, and the run's site-render check was moments from building the base and reporting it as proving the branch. APP-1189.)

**The guardrail holds a sibling agent leg, and the Owner's own hand-started work is not one.** An active ticket whose assignee is the Owner and whose branch does not follow `skill-build-ticket`'s `claude/<ticket-id>` convention is the Owner building by hand, and the hold that is advisory towards him for a QA marker is advisory here too: a run he has asked for is not refused because he is working in the same repo. The discriminator costs the reads the guardrail already takes — the assignee and the branch name — and it is the same one the run-level lock below uses to tell an interactive session from a second firing. Three checks make proceeding safe and are taken before the exec leg, not after: the two tickets touch different files; the Owner's leg is already past exec with its PR open, so no second claim is being raced; and the merge leg stays serial and rebases on the Owner's head before merging. Where any of the three fails, say which and ask him rather than proceeding on judgement. The principle exists one branch over rather than here — the QA-marker paragraph above holds that the marker stays advisory towards the Owner and holds only a sibling agent leg on the same repo — so a literal read of the `F0-RGE` branches refuses the Owner on work he himself directed. (Worked case: on 2026-11-05 the Owner asked an interactive session to create `A1-901` and run the loop on it while `A1-900` sat In Progress under `F0-RGE` in `assoc-one/a1-advisory`, assigned to him on branch `aled/a1-900-…` with PR #55 six minutes old; the session proceeded on exactly these three checks and nothing collided, with no sentence in canon permitting it. The repo, the PR number and the branch name are that session's own report and are **unverified** here — no GitHub read is available from the refine surface. The branch-name discriminator this rule leans on **is** live canon: the run-level lock keys its third cause on a `claude/` branch not matching `skill-build-ticket`'s `claude/<ticket-id>` convention, and that paragraph was read against the live store this run. `APP-2906`.)

**The guardrail's scope is the active ticket's repo, not the whole run.** "Never run two legs concurrently in the same repo" means exactly that: the skip applies only to tickets targeting the same repo as the genuinely-active ticket. A session dispatched across several repos in one sitting (each with its own designated branch) holds back only the tickets on the affected repo and proceeds normally with eligible tickets on every other repo — one unrelated repo's in-flight ticket must never stall a multi-repo run in full, and conversely a legitimately active leg must never be raced by a second leg on that same repo. When in doubt which repo a candidate ticket targets, check its linked PR or attached branch name before deciding whether the guardrail applies to it. (Worked case: APP-480, 2026-07-09 — a 13-repo dispatch session held back only the ticket sharing a repo with the active leg and proceeded on the rest.)

In Progress is the active-run signal only while the run is genuinely active: a leg that opened its PR and then stalled past the threshold is auto-resumed when the stall is provably complete (non-draft PR at the ticket's head, required checks green via `list_workflow_jobs`, every AC ticked → In Review + `PR-1SM`, assignee cleared) and otherwise reported, not treated as live (APP-924). A leg that crashed *before* opening a PR is reset by `skill-build-ticket`'s stale-claim recovery, not treated as live either (APP-808). This is distinct from the duplicate-PR / race guards on *opening* a PR (APP-206/APP-208) — it concerns a run that already has its PR and never completed the handoff. (Captured 2026-07-04, delivery-loop run: A1-130 sat In Progress under `F0-RGE` for over 24 hours with an open PR and a stale assignee, skipping every run.)

**Run-level lock — one driver per queue, checked before anything else.** The concurrency guardrail above answers a different question from this one. It asks whether a *leg* is active on a given repo, and its remedy narrows the run. This asks whether another **driver** is live on the same queue at all, and its remedy is to decline the run. Two instances of this driver racing one queue is the case the per-repo guardrail structurally cannot cover: its read is instantaneous and taken at run start, so a ticket claimed after that read is invisible to it, and a cross-repo collision is not a repo conflict at all — the two runs are racing the queue, not the branch.

Before the out-of-band approval sweep, and across all delivery projects rather than one repo, look for evidence that another driver is mid-run:

- Any ticket that entered **In Progress** under `F0-RGE` within the staleness threshold that this run did not claim.
- Any ticket that moved into **In Review** under `PR-1SM`, or to **Done**, within the last ~15 minutes with a `claude/` PR this run did not open.

Either is evidence of a live driver. **Where evidence exists and this run has claimed nothing yet, decline to start.** Do not narrow to the unaffected repos and do not race: end immediately with a report naming the ticket, its timestamp, and the inference drawn. A declined run costs one scheduling interval; two drivers duplicating build work costs both runs' budgets and puts a claim write on a ticket another session is finishing.

Two things follow that are easy to get wrong:

- **The lock does not replace the per-claim precondition, and the precondition does not replace the lock.** This check is itself a snapshot and goes stale the moment it is taken, so the thing that makes any individual claim *safe* remains `skill-build-ticket` step 2's freshness precondition — re-fetch immediately before the claim and claim only a ticket still Todo and still carrying `F0-RGE`. The lock prevents duplicated work; the precondition prevents corruption. Run both.
- **A claim that comes back taken is the lock firing late — and so are two quieter tells.** A second driver is live *now* when: a claim write returns `skill-build-ticket`'s tells that it landed on someone else's work (an attached PR, or a missing `F0-RGE` label); a pre-write freshness check returns `no-op` because the ticket was **already routed elsewhere** seconds earlier (A1-354, 2026-08-18 — bounced Todo → Backlog by another exec run thirty seconds before this run's claim); or a merge-leg read finds the ticket or PR **moved under it** mid-read (APP-679, 2026-09-02 — merged and set Done by another session while this one was undrafting the same PR, exposed only by an atomic `patch` failure). All three are the same signal. The outcome is one rule, not a per-run judgement: repair any damage, **finish only the leg already in flight, then end the run**, and surface it in the end-of-run report. Note that an **event-woken session** (a `check_suite.completed` wake on a PR the loop itself opened) is a collision source the run-start tests cannot see and no schedule spacing can prevent, so the schedule check below is necessary but not sufficient — the per-leg freshness preconditions in `skill-build-ticket` and `skill-merge-pr` are what make each write safe (APP-717, APP-1028).

When the lock fires, name the cause in the report, and there are three — they take different remedies, and the ticket's own `stateHistory` separates them for the price of one read. **Two interleaved claim→handoff chains on different tickets** is a duplicated schedule entry: two instances of the same routine on the same schedule in the same window, an operator check in Claude Code Desktop → Schedule, not something the loop can fix. **One continuous claim→handoff chain still advancing** is a single coherent run that has outlasted the schedule interval, and the schedule is not the fault: the remedy is the run budget in *Behaviour* — a run that stops before its own next firing cannot become its own second driver — and, failing that, a longer interval or accepted periodic declines; no amount of looking at the schedule list will reveal it. **A ticket that reached In Review or Done with no `In Progress` transition at all, on a `claude/` branch not matching `skill-build-ticket`'s `claude/<ticket-id>` convention, is the third cause: a non-loop interactive session live on the same queue.** Neither of the two above fits it — there is nothing wrong with the schedule and no run has overrun — so reporting it as either sends the operator to a settings surface that is working correctly, the same misdirection this section already warns of for the overrun shape. The discriminator costs the same one read: `skill-build-ticket`'s claim step writes Todo → In Progress, so the **absence** of that transition says the loop's own claim path never ran, and a session-assigned branch name says which session did. Report it as a collision between a human-directed session and this schedule rather than as a scheduling problem, and **name the repo** the evidence points at. (Worked case: the 2026-09-21 12:19:48Z run declined on A1-454, set Done at 12:10:43Z — nine minutes before the run started — on a `claude/` branch this run did not open. Its `stateHistory` read Todo → In Review → Done with no In Progress at all, and its PR body flagged a "branch deviation" onto "this session's assigned branch per the harness's session branch assignment" — an interactive session, not a second firing of this routine. Three sibling tickets it unblocked were sitting in this run's own candidate list, created 11:28–12:02Z. The decline was correct and cost one scheduling interval exactly as designed; only the diagnostic had no slot for it. The PR number and branch name are as that run reported them and are **unverified from the drain surface**, which can read no repo — APP-1618.) Report the cause the history supports rather than the first one canon names — an operator sent to the schedule surface on an overrun finds exactly one entry and reasonably concludes the lock misfired. Where the cause is an overrun, carry the **observed age of the live run** in the report (its first In Progress timestamp against now), so repeated declines accumulate into a measurable interval problem rather than each reading as a one-off. Expect the overrun shape most often on the runs doing the most work: a QA bounce puts a second exec leg and a second QA leg inside one cycle (*Bounce cap*), so roughly doubles it. (Worked case, duplicate-schedule shape: 2026-07-29, two delivery-loop drivers draining one queue between ~09:15 and ~09:45. APP-715 was merged and set Done at 09:24:19, and the other run's 09:27 claim reverted it to In Progress; minutes later, in the opposite direction, a claim write reverted APP-705 from In Review + `PR-1SM` to In Progress with the assignee cleared. Both were caught from the write-back and repaired, but each run spent real build time on tickets the other was already finishing — APP-717.) (Worked case, overrun shape: the 2026-09-09 00:14 UTC run declined correctly with ten `F0-RGE` Todo candidates across five repos untouched. A1-387's `stateHistory` showed one unbroken chain — claimed 22:50:52, In Review 23:20:31, QA bounce 23:41:36, In Progress again 23:42:47, In Review + `PR-1SM` 23:59:26, written to again at 00:15:27 — a single ~85-minute cycle, one driver, one queue, no duplicate entry. APP-1204.)

## Behaviour

A run is a loop. Repeat the following cycle for one eligible ticket at a time, highest priority first, until no eligible ticket remains or the run nears its time budget. Always finish the in-flight ticket's full cycle before ending the run.

**Step 0 — declare the queue before draining it, then declare the stop when you take it.** This is a step in the sequence, not advice in the surrounding prose, because the prose has already failed to hold three times (see below). Two statements are mandatory:

- **Opening declaration, after the *full* eligibility scan and before the first exec leg:** state in the run's output *"N candidates, M eligible after dependency and scope checks, across R repos; continuing until the queue is empty or a named budget is exhausted."* Naming the figures **up front** is the point — the pull to stop arrives later, when the queue looks large and consequential, and a count already on the record is much harder to rationalise around than one recalled defensively after the fact.

  **Declare both figures, and declare them after phase 2.** The eligibility scan has two phases, and only the first is a single query: phase 1 is `list_issues(label: F0-RGE, state: Todo)`, which returns *candidates*; phase 2 is the per-candidate blocked-by, unmet-dependency and connector-scope check, which costs a `get_issue` plus `list_comments` per candidate (the N+1 read captured in APP-685). A declaration made between the two states a number that is not the eligible count. It overstates the queue, which inverts exactly what step 0 exists to do: it makes a legitimate `queue empty` exit look like an abandoned run, and would flatter a genuine soft-stop ("stopped with 4 of 5 remaining" when none were ever workable). Reporting both figures also surfaces a starved queue in the opening line rather than only in the end-of-run diagnostic. (Worked case: the 2026-08-03 run declared "5 eligible tickets across 3 repos" off phase 1; after phase 2 the true figure was 0, all five held by open blocked-by relations to human-lane items — APP-740.)

  **When the figure changes, restate it in the same form.** A post-merge re-scan (see *Post-merge re-scan*) can add eligible tickets mid-run. Say so in the fixed form *"re-scan after merge: M now M′"*. The run's commitment is always to the latest restated figure, and any early stop is measured against that, never against the opening number — a stated-number mechanism only works while the stated number is still true (APP-752).

- **Closing declaration, on any run that ends with eligible tickets remaining:** state which of the two real conditions fired, in these words and with the blank filled:
  - `queue empty`, or
  - `budget exhausted: <what ran out, with a number>` — elapsed wall-clock against the run's cap, a context or rate limit hit, a tool failing repeatedly.

  **A stop that cannot fill in that second blank with something concrete is not a genuine-budget stop — it is a defect in the run, not a judgement available to it.** "This felt like a lot", "these are materially bigger builds", "better done supervised", "stopping here on time budget" with nothing measured behind it: each is the same stop wearing different words, and each is out of bounds. If the blank cannot be filled, the correct action is to continue to the next eligible ticket.


- **Closing diff, on every run: the loop closes its own batch by diffing the list, never by comparing counts.** The two declarations above are counts, and two counts can agree while the sets differ — a run declaring 21 eligible and reporting 21 worked has proved nothing about *which* 21, and one dropped identifier is covered in the tally by a double-counted one. So the eligible list is an **explicit artefact of step 0, not a tally the driver carries in its narration**: phase 2 writes the eligible identifiers to a file in the session outputs folder, named under the partition-key rule (`convention-agent-runtime`, *A sub-agent's return is a verdict or a path*), and each dispatch appends the identifier it dispatched to that same record. Then, **before the end-of-run report, diff the two sets and name the difference** — every identifier in the step-0 list, as restated by any post-merge re-scan, that was never dispatched, and every dispatched identifier not in it. A non-empty diff is worked before the run ends, under the two stopping conditions exactly as written; where the budget will not hold it, it is named in the report identifier by identifier, so the next run inherits a list rather than a count. The diff is mechanical and that is the whole point: a driver's own narration is the one record in a run that nothing else ever checks, and it loses an item exactly where attention shifts — at a sub-batch boundary the driver invented for its own pacing, or across a context-compaction event. Sub-batching is not something this routine asks for, and a run that introduces it owns the bookkeeping it introduces with it. The worker-side half is `convention-agent-runtime`'s — a handback names the scope it was given, and a write that could already have been made is checked before it is made — and is not restated here. (Worked case: the 2026-10-22 12:13 UTC run, 21 eligible `F0-RGE` publish tickets in Apps/os.Claude. The driver worked APP-2547 to APP-2551, moved to a self-invented second sub-batch of APP-2600 to APP-2614, and dropped APP-2552 from its working set without dispatching it. No sweep, label check or external signal could have caught it: every one of them keys on a ticket's own state, and a ticket never dispatched looks exactly like one not yet reached. It surfaced only because the driver re-derived the original list against what it had actually dispatched, mid-run and well after the boundary; APP-2552 was then worked correctly and merged clean, so nothing was lost. The run also crossed a context-compaction boundary, which is the context-pressure family of APP-394 and APP-826 and is **not** this root — those are context exhaustion stopping a run outright, and APP-1582, now Done, is a hand-curated fire payload whose list never matched the live batch. This is a driver losing its own live working set across a boundary it introduced itself. The run, the 21-identifier list and the drop are the filing note's **report** and are **unverified** here, no session transcript being readable from the refine surface; the step-0 declarations above and the absence of any set-level diff anywhere in this file were read against the live store this run and are **observed**. APP-2631.)

**Two stopping conditions, and no others: an empty eligible queue, or a genuine time budget.** Nothing else ends a run. In particular, **the remaining eligible tickets spanning several repos, projects, or domains is not a reason to stop.** The loop exists to drain a mixed queue in one pass, and every ticket is independent by construction — its own branch off current `main`, its own PR — so "these are six substantial builds across six different repos, better done supervised" is not a judgement this run is asked to make. If the tickets are eligible and the budget holds, work them. The one case where a repo matters is already handled by the concurrency guardrail (a genuinely active leg on that *same* repo), and that guardrail **narrows** a run, never ends it. A run that soft-stops on diversity drains one ticket per invocation, which is precisely the n+1-runs problem this driver replaced the three timer routines to remove. (Stated as a negative example because it recurs: raised, acknowledged, and re-derived again on the 2026-07-14 run, which ended after one ticket and left six eligible tickets undrained with budget remaining — APP-527. And a third time on 2026-07-17: the run drained two rebase-bounced tickets correctly, then stopped with **eight eligible tickets across four repos**, telling the operator "stopping here on time budget" — and, asked what that meant, admitted no budget was tracked and the stop was the scale-and-diversity judgement this paragraph forbids. It self-diagnosed correctly, but only when pushed, and would have stayed stopped otherwise. That is why the check moved into step 0 above: a rule that has failed three times as prose is not landing as prose, and the remedy is to make the run *say the number* — first the queue it is committing to drain, then the budget it claims ran out. Both statements are cheap; neither can be satisfied by a feeling. APP-583.)

**The time budget is a number derived from the schedule interval, not a judgement made at the time.** A run still live when its own schedule fires again **is** the second driver the run-level lock exists to prevent, and it will be detected as one by its own successor. So the budget is derived rather than felt: read the interval from the run's own schedule, **stop claiming new tickets at two-thirds of it and hard-stop at three-quarters**, finishing only the in-flight ticket's cycle. **The interval is the gap from this firing to this schedule's *own next* firing — never an average, a nominal cadence, or the largest gap on the grid.** The delivery loop's cron is a list of slots, not a period (`13 09,12,00 * * *` today), so the three daily firings have three different budgets: the 00:13 run has 9h to its next firing (6h claim cap, 6h45m hard stop), the 09:13 run has **3h** (2h claim cap, 2h15m hard stop), and the 12:13 run has 12h (8h, 9h). A run that takes a single figure for "the interval" overruns the short slot by construction, every day, and its successor correctly declines — which reads as a queue-too-deep problem and is not one. Read `next_run_at` (or the next matching slot) from the schedule itself and subtract; where the schedule is genuinely not legible to the run, assume the **shortest gap on the grid** — today 3h, so **2h to the claim cap and 2h15m to the hard stop** — because a budget that is too small costs a run some queue and a budget that is too large costs the next run its whole leg.

**And the derivation needs a store that answers — `CronList` returns no jobs for a routine trigger, so the interval is read from the cloud trigger store or the assumed budget is declared.** The rule above derives the budget from the run's own schedule and tells the run to read `next_run_at` from it; it does not say which store holds that figure, and the nearest call to hand is the wrong one. A delivery-loop run reaching for its schedule via `CronList` gets an empty job list back: the enumeration covers local scheduled tasks and a routine trigger is not one of them, so the budget rule has no input at all and the derivation degrades in silence into exactly the unmeasured soft-stop the paragraphs above forbid. So **the interval is derived from the cloud trigger store** — `list_triggers` on the Claude_Code_Remote connector, which is the store `core-operating-model`'s three-way store split assigns a cloud scheduled job, read at the moment the figure is used rather than quoted from a note, a comment or an artefact, per that same section's rule. And **where neither store answers, the run states the budget it assumed and why, and never silently proceeds without one**: the shortest-gap fallback above is the assumption to take, it is named as an assumption in the opening declaration, and the closing declaration then has a number to measure the elapsed figure against. A run that proceeds budget-less has no stopping condition it can name, which is the whole defect the derivation rule exists to remove — an unreadable schedule is a reason to declare a fallback, never a reason to run without a cap. (Worked case, **observed** on the 2026-11-02 14:00 UTC delivery-loop run: the time-budget derivation called `CronList`, the call returned **no jobs**, and the interval the rule above requires was therefore never available. That the delivery loop is a routine trigger rather than a local scheduled task, and that `core-operating-model`'s three-way store split assigns a cloud scheduled job to `list_triggers` on the Claude_Code_Remote connector, were read against the live store this run and are **observed**; what the run then did with the empty return, beyond proceeding, is **reported**. `APP-2827`.)

Recorded as a fallback rather than as the rule: a cadence change must move the budget with it, and a *non-uniform* cadence moves it per firing. Fill the closing declaration's blank with the elapsed figure and the interval it was derived from: `budget exhausted: 2h 04m elapsed against a 2h claim cap (3h interval, 09:13→12:13)`. This is the one stop condition that needs no judgement call, which is the point — it removes the case where a run has genuinely run long and cannot name what ran out, without licensing the unmeasured soft-stop the paragraph above forbids. It costs a deep queue extra runs, and that is the trade it makes: a run that stops on a number leaves the remainder to the next firing, where a run that collides with itself loses a whole leg's work *and* the remainder anyway. (Worked case: the 2026-09-10 run opened 00:14 UTC on a ~9-hour cadence, merged five batches, claimed APP-1243 at 02:04:49Z, and was still live when the same schedule fired at 09:13 UTC; the successor reset APP-1243 at 09:15:35Z and the leg stood down at `skill-build-ticket` step 4 — 8h 29m of correct, complete, digest-verified work that never became a PR. The 14:16Z run declined at the lock on the identical shape with an observed age of 2h 40m and eleven sibling batches still in Todo, which is what a queue deep enough to keep producing overruns looks like — APP-1204, APP-1279, APP-1286.)

**Out-of-band approval sweep — run first, every run, before the eligibility scan.** Sweep In Review for tickets carrying `agent:R3-LAY` — the merge-approval signal `skill-merge-pr` treats as "approved". The loop's own clean-pass routing sets this label in-session and merges immediately, but Aled also approves tickets **out of band** between runs (setting `agent:R3-LAY` on an In Review ticket by hand, per convention-linear), and nothing else ships those: skill-triage and skill-coordinate never touch In Review to merge, so an out-of-band approval sits unmerged indefinitely (worked case: A1-146 approved 2026-07-06 20:00, still In Review after the 01:13 loop run — APP-454). So each run, before draining the Todo queue: list In Review tickets in delivery projects carrying `agent:R3-LAY`, and for each with an open PR, run the `skill-merge-pr` skill (it applies its own CI-clean / conflict fail-safe). This is the same merge leg, fired for approvals set outside the in-session flow. Then proceed to the eligibility scan. Merge stays in this loop rather than moving to the Linear-only Relay tasks (triage / coordinate) because merge needs GitHub repo access, which those do not carry.

**Corroborate a zero from this sweep before declaring it.** A zero here is indistinguishable from a healthy empty queue, and it is the one read in the loop where a false zero silently costs a merge — the ticket simply never re-enters the flow, which is the APP-454 failure the sweep exists to prevent, arriving through the sweep itself. So when the label-filtered query returns nothing, spend one more cheap read: list In Review tickets per delivery team **without** the label filter and check the label set in the returned rows. This is the silent-scope family `convention-linear` documents under *Reading Linear safely*, and it is a deliberate exception to *Zero is an answer* below — that rule governs the eligibility scan, where a zero is a success signal and re-querying costs read volume for nothing; here a single unfiltered list turns an unfalsifiable zero into a checked one. (Worked case: the 2026-08-10 run swept at 09:22, got zero, and declared "no out-of-band approvals"; the identical query in the same session at ~11:15 returned two — APP-747, In Review since 01:40 with an open PR, and A1-236. Neither was mergeable that day, so nothing was lost, which was luck rather than the guard working — APP-765.)

**QA the stranded `PR-1SM` ticket too — the same hole, one gate earlier.** The R3-LAY sweep exists because nothing else ships a manually-approved In Review ticket. The identical gap sits one gate before it and no rule covers it: a ticket in **In Review + `agent:PR-1SM`** with an open PR and **no `[qa] HEAD: <current-sha>` verdict** is waiting for a QA leg that will never come — `skill-triage` and `skill-coordinate` never run QA, and the eligibility scan reads only **Todo**, so the driver walks past it every run. This is the crash-safety claim failing for the one intermediate state it does not cover: *"a crash mid-cycle leaves a valid intermediate state; the next run resumes from Linear"* is true only for Todo, and In Review + `PR-1SM` is a valid intermediate state no run resumes. So run a **second pass, after the R3-LAY sweep and before the eligibility scan**: list In Review tickets in delivery projects carrying `agent:PR-1SM`, and for each with an open PR and no `[qa]` verdict at the **current head**, run the `skill-review-pr` leg, then route normally (a clean pass to `R3-LAY` → merge; a changes-needed verdict through the QA-bounce rules). The `[qa]` comment is what the sweep **branches on, not merely skips on** — the two stranded shapes are indistinguishable on the board (same state, same label, same empty assignee) and need opposite remedies: **no `[qa] HEAD: <current-sha>` verdict** → the QA leg never ran; run it (as above). **A verdict at the current head, clean** → QA ran and its route never completed; do not re-review — apply *Route per verdict* directly: unflagged → `R3-LAY` and the merge leg; flagged → clear the executor, set `operator-<venture>`, assignee clear, High; operator-verify-only → `human`, assign Aled, High. **A verdict at the current head, changes-needed** → the bounce-cap path, with the strike count read from the ticket's `[qa]` comments as *Bounce cap* specifies. So a legitimately mid-flight ticket is never double-QA'd (the matching verdict is the dedup key), and a reviewed-but-unrouted one is never walked past. This branch is a net beneath `skill-review-pr`'s own hand-off step failing to complete, not a replacement for it. (Worked case: A1-357 — Prism posted a clean verdict at 00:49 on 2026-08-17, the run ended before applying the route, and the ticket sat In Review + `PR-1SM` for ~8.7 hours satisfying the skip exactly, unstuck only by a run that looked by hand — APP-969.)

**Key this pass on the property, not the label.** The ticket this pass exists for is defined by what it is — **In Review, an open PR, and no `[qa] HEAD: <current-sha>` verdict** — and `agent:PR-1SM` is only the label it ought to carry. A hand-off that reached In Review without evicting `F0-RGE` leaves the same stranded ticket under a label nothing reads: the eligibility scan wants Todo, the R3-LAY sweep and this pass want their own labels, and the stalled-handoff test wants In Progress, so it falls through all four. So list In Review tickets per delivery team **without** the label filter (the read *Corroborate a zero* already spends) and take every row with an open PR — draft or ready, since exec hands off in draft and `skill-review-pr` undrafts on a clean pass — and no verdict at the current head, whichever fleet executor value it carries: `PR-1SM`, or an `F0-RGE` the hand-off never evicted. Branch and route exactly as above; the route's own `labels` write evicts the stale `F0-RGE`. The fleet boundary is unchanged: a ticket carrying `human`, an `operator-<venture>` label with no executor, or an assignee is not the loop's, and the guards below bind it as before. (Worked case: MBN-296, `mbn-theme` PR #13 — In Review + `F0-RGE` with CI green from 2026-09-18T09:14Z, blocking MBN-270, seen and passed by the 2026-09-20 run at both its start and its end; the 2026-09-21 run QA'd it in an isolated fresh clone despite the label, and it routed cleanly as operator-verify-only to `human`, Aled, Urgent — APP-1553; APP-1557 and APP-1527 are the earlier sightings.)

**Run both sweeps again immediately before the end-of-run report.** Both sweeps above fire once, at the top of the run, so an approval set by hand after that minute is not seen until the next scheduled run — the APP-454 failure shifted from *never checked* to *checked too rarely*, for everything approved after minute one. The window is not academic, and it is invisible from any other surface: the sweeps are repo-agnostic by design, so an approval can land on a repo the run is not otherwise touching, with no PR notification and no wake to surface it independently. So before writing the end-of-run report, re-run the out-of-band approval sweep and its stranded-`PR-1SM` twin, under the same corroborate-a-zero rule, and work whatever they return before the run ends; a merge made on that closing pass restates the run's figures exactly as *Post-merge re-scan* requires. Two `list_issues` calls close the window rather than shrinking it. (Worked case: the 2026-09-14 run's opening sweep correctly returned zero; an hour later, after its two `claude-ops` tickets, a re-scan found three `assoc-one/bot-trader` tickets approved mid-run — APP-933, a live trading-guardrail fix carrying two safety exposures, plus APP-918 and APP-926 — all QA-clean at their heads and merged cleanly once found, and found only because that run happened to re-scan out of courtesy — APP-1446.)

**Refine ruling recorded on this row (how/where, APP-1099):** a closing re-run, not an interval re-fire. An interval adds bookkeeping to every run to buy a shorter window on a session that is usually minutes long; the closing pass costs two reads once and closes the window outright.

**A swept ticket with no open PR is a finding, not a skip.** The "for each with an open PR" condition above filters the *QA leg*, not the sweep. An In Review + `agent:PR-1SM` ticket carrying **no** open PR is a PR-less deliverable that took the code lane's handoff by mistake, and skipping it is what makes the mis-route unrecoverable: the eligibility scan reads only Todo, `skill-triage` and `skill-coordinate` never touch In Review, and every other net in this loop keys on the same wrongly-set label. So re-read it as a PR-less deliverable and route it to **its own reviewer**, taken from the ticket's definition of done:

* **Where the DoD names a reviewing skill the connector fleet holds** — `skill-design-parity`, `skill-deck-parity` — dispatch that review via `skill-fleet-dispatch` / `skill-dispatch-run` carrying the named skill, and route on the returned verdict using the same grammar as a QA verdict. The dispatch path **is** the runner, not a new sweep: `skill-design-parity` is Prism's (APP-1043) and Prism holds no Linear-only runner, and `convention-linear` *Executor* is explicit that connector-surface work goes to the surface that can do it, reserving `human` for what genuinely needs Aled (APP-618).
* **Where no agent holds the review**, keep **In Review**, set label `human` (evicts `PR-1SM`), assign **Aled**, and post the hand-off naming the review needed together with **the estimate** (APP-1003).

This is the same blind spot as the R3-LAY and stranded-`PR-1SM` holes, one type-of-deliverable across: the loop looks for its own next-step label *and* its own next-step artefact, and a ticket that satisfies the label while failing the artefact test falls out of every sweep silently. (Cost of not having it: four consecutive runs at 0 eligible of 7 — 2026-09-03 16:09Z, 2026-09-06 00:14Z, 2026-09-06 09:14Z and 2026-09-07 12:28Z — with A1-388 stranded ~99h at In Review + `PR-1SM`, unassigned, holding all six `F0-RGE` leaves under epic A1-377 and starving the queue in every repo. APP-1108, APP-1129.)

Two guards bound it:

- **Staleness — reuse the ~15-minute concurrency boundary, do not invent a second.** A `PR-1SM` transition inside the run-level lock's ~15-minute window is evidence of another live driver mid-handoff (the concurrency guardrail above). Leave those to it and sweep only tickets that have sat past that boundary, so a ticket handed off seconds ago is never raced.
- **An assignee means surface, not sweep.** `PR-1SM` should carry no assignee; one that does may mean the Owner pulled the ticket deliberately, and *never changes state on a ticket the loop does not own* (APP-658) binds here — surface it in the end-of-run report (ticket, PR, how long it has sat) rather than running QA on it.

This closes the same blind spot as the R3-LAY sweep, from the other end. Both exist because the loop only ever looks for its own next-step label — which is also why the zero-eligible diagnostic, keyed on `F0-RGE`, cannot see a stranded `PR-1SM` ticket either. (Worked case: A1-263 and APP-776 both sat In Review + `PR-1SM` stranded since 2026-08-12; A1-263 was picked up only by analogy with the R3-LAY sweep, and QA then found a blocking defect — `mapProject` silently dropping `backdropColour`/`floatingAsset`, green in fixtures but broken in production — that would otherwise have sat unlooked-at; APP-776 was left untouched because the analogy is not canon and it carried an assignee — APP-853.)

**Eligibility scan — phase 1 of 2, never the whole scan** (same rules as exec): a ticket is eligible if it is a leaf ticket (never `type:epic`), has label `F0-RGE`, is in **Todo**, has no open blocked-by relation (blocker not Done or Canceled), carries no unmet dependency named in a PM comment, **and targets a repo this run's GitHub connector actually carries**. The label+state query answers only the first three conditions; the rest need the per-candidate reads of phase 2, and the scan is not complete — and nothing is declared — until phase 2 has run (see *Step 0*). **The relation half of phase 2 needs `get_issue(includeRelations: true)`.** The parameter defaults to `false`, and a plain `get_issue` returns a blocked ticket looking exactly like a free one, with no error to catch — so a phase-2 pass that reads only the body and `Notes` for a prose-stated dependency answers the harder half of the test while skipping the cheaper and far commoner one (`convention-linear`, *Reading Linear safely*: "Never infer 'not blocked' from a list row, or from a `get_issue` that did not pass `includeRelations: true`"). **And a blocker found on one candidate is not thereby established for its siblings:** where a candidate is held out, re-run the same relation read on each sibling rather than propagating the finding across a shared parent or a phase sequence — it is the cheapest read in the set, and a propagated inference writes Blocked on evidence it does not have. (Worked case: the 2026-10-01 09:15 UTC run passed A1-282, A1-283, A1-284 and A1-285 as eligible on a prose-only `Notes` check; A1-282's dispatched exec leg then found, via its own premise check, a formal `blockedBy` to A1-281 that the driver's `get_issue` had never requested — one exec leg and its build-agent cost spent on a blocker phase 2 was meant to catch for free — and the driver then marked the three siblings Blocked by inference without making that read on any of them — APP-1943.) Scan delivery projects only — never the Pipeline team. If the top candidate is ineligible, move to the next by priority. End the run cleanly if no eligible ticket exists — and on that empty-queue exit, emit the zero-eligible diagnostic (see *End-of-run report*).

**An assignee on a Todo candidate means surface, not claim — the same rule the `PR-1SM` sweep already carries, one gate earlier.** A ticket carrying `F0-RGE` in Todo should carry no assignee; one that does may mean the Owner pulled it deliberately, and *never changes state on a ticket the loop does not own* (APP-658) binds at the eligibility scan exactly as it binds at the sweep. Such a ticket is **not eligible**: surface it in the end-of-run report with its assignee and the reason it was held out, rather than claiming it into In Progress. The rule was written for the `PR-1SM` sweep and nothing applied it here, so an Owner-held ticket sits in the executor's queue looking claimable and is re-qualified from scratch every run. (Worked case: APP-60 and APP-61, both assigned to Aled and both waiting on credentials only he holds — a Linear API token, a Vercel KV provision — sat in the `F0-RGE` Todo queue across the 2026-09-10 and 2026-09-11 runs, each paying a full phase-2 read to learn what the assignee field says for free — APP-1318.)

**Connector-scope is an eligibility condition, checked before the claim — not discovered after it, and it is about every connector class the deliverable needs, not only GitHub's repo list.** This run's GitHub connector is scoped to a fixed repo list set per session, not per ticket — and the session's connector roster as a whole is likewise fixed per session. Two shapes therefore hold a ticket out, not one: a ticket whose target repo is outside the GitHub list, and a ticket whose deliverable needs a connector class the roster does not carry at all — most often one whose Definition of Done names no PR because its whole output is dashboard or platform state (a Vercel project, domain and build settings being the standing instance). Read the Definition of Done for the connector classes it implies before claiming; where one is absent from this session's roster, the ticket is not eligible on the same principle, and the capability-versus-lane rule it instances lives in `convention-agent-runtime` (*A ticket can need a capability combination no lane holds*) — do not restate it here. (Worked case: A1-574, a clean leaf on every ticket-level test, whose entire deliverable was Vercel dashboard and domain work on a session carrying no Vercel tool at all — held out and surfaced rather than claimed-then-Blocked, 2026-10-13. The run's connector roster is reported from its own filing and not re-read here; note that roster varies by surface, and the surface that drained this note does carry Vercel tools — APP-2305.) A ticket whose scope is a repo that list does not include — most often one standing up a brand-new repo — cannot be worked at all: there is nothing to sync against and no branch to cut. Such a ticket is **not eligible**, even when it is a leaf, `F0-RGE`, in Todo, and carries no open blocked-by relation. Before claiming the top candidate, confirm its target repo is in this session's connected scope; where it is not, skip it and surface it in the end-of-run report — the repo needs provisioning and the connector scope widening, which is a human step, not a loop step — rather than claiming it into In Progress and immediately Blocking. Claiming-then-Blocking burns a cycle and leaves a misleading In Progress trail. (Worked case: A1-242 scoped `assoc-one/operator-console`, a brand-new repo the session was never wired to reach — claimed, then Blocked with no code work possible, 2026-07-22 — APP-652.)

**And a third shape holds a ticket out one level earlier: the target repo does not exist yet.** The two shapes above both test a named repo or connector class against this session's roster. A ticket whose own first job is to *create* the repo its work then lands in fails neither test and passes both — the repo is not outside the list, it is outside everything, so a run reading only the roster finds nothing to decline on and re-derives the whole eligibility scan before arriving at the same hold-out. Read the Definition of Done for a repo that is brought into being by this ticket rather than named by it: an acceptance box reading "repo location confirmed with the Owner", a premise stating no target repo exists, or an objective to stand up a repo plus its hosting project. Where that is what the ticket asks for, it is held out as **awaiting an Owner decision on where the repo lives**, not as a connector-scope gap — the two have different remedies, and adding a repo to a roster cannot settle a location nobody has chosen. Hold it out, name it once in the run's report as that shape rather than restating the scan, and leave it in Todo: the run neither claims it nor moves it to Blocked, because nothing about it is a defect. (Worked cases, all **reported** from the filing legs and unverified here — no repo ref is readable from the authoring surface: APP-2248, whose objective is to create the `ds-quality` repo and its Vercel project, with APP-2249's app-shell build depending on that same uncreated repo; and APP-2598, whose own premise states no target repo exists and whose first acceptance box is the Owner's confirmation of where it goes. The shape was first met on A1-242 and has now recurred across three projects at once, which is what makes it a category rather than an instance — APP-2666.)

**A paused-type project status is an eligibility condition too, and it is the cheapest one in the set.** A project's own `status` field is a higher-order signal than any ticket-level one beneath it: a project on **Hold** (`statusType` `planned` — `convention-project-status`, *Hold is a real parked state*) is a decision already taken once, at the right altitude, and a ticket under it is **not eligible** however clean it reads on leaf, label, state, relation, PM-comment and connector-scope tests. **Read the project's status field directly; never propagate a hold label onto the tickets** (Owner decision on APP-1651, 2026-09-22). Every candidate already carries `projectId` and every project already carries `status`, so the field is the one always-current source of truth, where a label would need something to apply *and* remove it in sync with the status changing — the double-bookkeeping and drift shape this system's canon avoids elsewhere. The cost is bounded because the read is **per distinct project, not per candidate**: group the candidates by `projectId` exactly as they are already grouped by repo, and issue one `get_project` per distinct project, or one `list_projects` covering every distinct project ID in the candidate set. Hold it out, do not claim it, and report it under the collapsed project-level line (see *End-of-run report*) rather than as a per-ticket decision. **The assignee-held rule above was already an instance of this one and could not see it.** Its worked case — APP-60 and APP-61, held out by an assignee and re-qualified from scratch across the 2026-09-10 and 2026-09-11 runs — names two tickets whose real reason for not being live is that `app.Luna` is on **Hold** (confirmed live: status `Hold`, type `planned`); APP-63 under the same project was held out by a third accident, an open `blockedBy`, and the three ticket-level reads between them cost more than the one project read that explains all of them. Where a ticket-level signal and a project Hold both apply, the project Hold is the reason to report. (Worked case: the 2026-09-22 run surfaced APP-60, APP-61 and APP-63 in its end-of-run report as tickets "waiting on Owner-provisioned credentials (APP-1034)", framed as open decisions for Aled; the framing was not wrong on its own terms, it just missed the already-made, higher-altitude decision that made all three moot, and the Owner had to re-explain the same call — APP-1651.)

**Zero is an answer — trust it and end the run. Do not validate a correct empty result.** When the label+state queries return no In Progress and no Todo ticket, that is the eligibility scan working, and the run ends cleanly. A zero result feels like a failed query, and the pull is to go looking for the tickets that "must" be there — but the queries that follow are worse than the one that answered: a bare `list_issues(label: F0-RGE)` with no state filter returns the whole label's history and overflows the tool limit (the read-volume class in `convention-linear`), and `list_issue_statuses` per team, then a per-team re-query, all confirm what the first two calls already said correctly. **Nothing about a zero result is ambiguous** — the executor label is single-select and `Todo` is a real state name in every delivery team, both already canon here. An empty queue is the expected steady state of a loop that keeps up with its intake; it is a success signal, not a symptom. Report it and stop. (Worked case: the 2026-06-29 run got the right answer in two queries, then spent ~10 confirming it — including one payload that overflowed the context and needed Bash parsing to read. APP-378.)

For each eligible ticket, execute the following cycle in full before moving to the next:

**Spike-ticket variant — no PR, no QA/merge.** Some `F0-RGE` Todo tickets are **architecture spikes**, not builds: their acceptance criteria are "an ADR is attached, no PR with code" (the `skill-architecture-spike` shape), typically carrying a `spike` label or a spike-shaped title and AC. These are eligible by the letter of the scan but do not fit the exec → PR → QA → merge cycle, which assumes every `F0-RGE` Todo ticket produces a PR. When the top eligible ticket is a spike, run this variant instead of the standard cycle: claim it (In Progress, clear assignee), run the `skill-architecture-spike` skill (which attaches the ADR and never opens a code PR), then route it to **In Review**, set label `human`, assign **Aled**, and post a note that the ADR is ready for his read. **Skip the QA and merge legs** — there is no PR for them to act on. Then continue to the next eligible ticket. (Worked case: A1-87 carried `F0-RGE` + Todo with an "ADR attached, no PR" AC and had to be handled ad hoc — APP-450.)

**The entry test keys on the definition of done, not the title.** A `spike` label or a spike-shaped title is a hint, never the test; the test is whether the ticket's **definition of done names a PR**. Where the DoD names no PR, the deliverable is not code and the ticket takes this no-PR exit **at routing** rather than the `PR-1SM` handoff — a document, spec, ADR, deck or design-token set is finished by attaching the artefact and handing it to its reviewer, and nothing downstream of `PR-1SM` can read it. Applying the test at routing is what prevents the mis-route in the first place; the `PR-1SM` sweep's no-open-PR finding (see *QA the stranded* `PR-1SM` *ticket too*) is the net beneath it, not a substitute for it. (Worked case: A1-388 — titled `DESIGN:`, carrying no `spike` label, its deliverable the Linear document `a1-firmup.spec.operator-console-theme` and its DoD naming no PR — was routed to In Review + `PR-1SM`, unassigned; every recovery mechanism in the loop then keyed on the label the mis-route had already set wrongly, which is what makes the cost of a mis-route unbounded — APP-1129, APP-1108.)

### 1. Exec leg

Run the `skill-build-ticket` skill for this ticket in a **disposable fresh subagent**, not inline in the driver session. The build is the heaviest leg — files read, CI output, PR diffs — and running it inline accumulates every ticket's build context in the one driver session, so after a handful of tickets the window fills, the session ends, and the remaining eligible tickets are stranded in **Todo**. Isolating the build keeps that context out of the driver, which then holds only a one-line result per ticket and can walk the whole queue in one run. This is the same isolation the QA leg already has (APP-698), extended to the leg that actually generates the context (APP-826).

**Spawn a fresh subagent, never a `fork`.** Use the `Agent` tool to spawn a fresh, isolated context for the build. A `fork` inherits the driver's accumulated context — which is exactly what must be kept out of the build, and would defeat the isolation — so the exec subagent is always a fresh context, never a fork of the driver. The subagent is disposable: it does the one build and returns, and nothing of its context survives into the driver beyond the result line.

**The driver dispatches without touching the ticket's state first — the claim write belongs to the exec subagent.** The dispatch bullet below defers the claim's ordering and its freshness precondition to `skill-build-ticket` and does not restate them; this is the other limb of that deferral, which is that the driver does not *perform* the write either. A driver that moves the ticket to In Progress itself and then dispatches has taken the leg's own canonical write on its behalf, and it pre-empts the precondition that makes that write safe: `skill-build-ticket` step 2 re-fetches immediately before the claim and claims only a ticket still Todo and still carrying `agent:F0-RGE`, so the leg instead meets a ticket already In Progress with no PR and no comment of its own — which is exactly the reading the ghost-claim tests in *Trigger* exist to resolve for a *second* driver, not for one driver tripping its own precondition. The write is also the lock — `skill-build-ticket` step 2 states that the In Progress write *is* the lock, and `workflow-delivery-loop`'s *Lanes* states *"Status is the lock"* — so a pre-claim moves the lock before its holder exists, and the driver's share of a leg is the dispatch, never the lock. This is the state-write limb of the standing guardrail that **the driver calls existing skills; it does not duplicate their logic**: a pre-claim duplicates a skill's logic by performing it rather than by restating it, which is the same failure the guardrail names for a restated or narrowed rule. A driver that has already pre-claimed reverts the ticket to **Todo** and re-dispatches cleanly, rather than leaving the leg to reconcile a claim it did not write. (Worked case: the 2026-11-09 run, having merged one ticket, moved the next eligible ticket to In Progress itself and then dispatched its exec leg, catching and reverting the pre-claim before the subagent ran — **reported** by the filing note and recorded as unverified, no session transcript being readable from the refine surface. The absence is **observed**: this exec-leg section, the ghost-claim tests in *Trigger* and the guardrail on not duplicating a called skill's logic were each read against the live store this run, and none of them names the driver's own state write on a ticket it is about to hand to a leg. `APP-2966`.)

The prompt must:

- Instruct the subagent to load and follow `skill-build-ticket`'s SKILL.md verbatim against this ticket — full exec behaviour applies, in `skill-build-ticket`'s own order: step 1 governs the sequence of claim, sync and branch cut, along with the freshness precondition on the claim write, and this prompt does not restate it; read the ticket, acceptance criteria (Pattern A) and any PM comment; build, run CI (formatter → lint → format-check → type-check → build, as the repo requires) and open a PR only when CI is green; rebase onto the pull request's own base ref, re-run CI, force-push (the base ref is `skill-build-ticket` step 5's to resolve — *"onto the pull request's own base ref, never `main` by reflex"* — and this prompt neither restates nor narrows it: a dispatch brief that names `origin/main` here contradicts the very skill it dispatches, and on a repo that stages its work on a long-lived integration branch it rebases the work onto production before the PR is even opened. The staging-methodology repo and the document defining it are the filing note's own report and are **unverified** — no repo is readable from this surface, and the note gives that document two different paths in one body — so the rule rests instead on what is readable here: this bullet and `skill-build-ticket` step 5 contradicting each other on the same write. `APP-3003`.); move the ticket to In Review, set label `PR-1SM` (evicts `F0-RGE`), leave assignee clear; and on an unresolvable blocker, exec's own Blocked fail-safe — Blocked, priority Urgent, label `human`, assign Aled, comment the blocker. **The early push of the ticket branch to `origin` is `skill-build-ticket` step 1's rule, and this prompt neither restates nor re-orders it** — the driver depends on the pushed branch's effect, not on where it falls in the sequence. (Worked case: APP-1523, 2026-09-18 — the dispatch bullet here ordered step 1 as sync → cut → claim while `skill-build-ticket` step 1 states claim, then sync, then cut and marks that ordering load-bearing, so the leg held two conflicting authorities for the same step and had to reconcile them live with nothing to cite. It reconciled correctly — local `git` operations are not externally visible, only a push is, so "claim before any work" binds against the push — and left no unclaimed branch on `origin`, but the reasoning lived only in that run. The antecedent APP-1344 landed inside `skill-build-ticket` on 2026-09-14; this is its residue in the caller, a distinct root rather than a recurrence.) The ghost-claim test in *Trigger* reads "In Progress, no PR, no comment" as a dead leg; a leg that has been suspended mid-build by an infrastructure restart looks identical, and gets reset — and where the leg then resumes, its finished PR lands on a ticket another run has re-claimed. A pushed branch splits the two states: no branch is dead, branch-and-no-PR is interrupted and is surfaced rather than reset. (Worked case: APP-901, 2026-08-17 — the filing session was suspended 10:05–14:16 mid-leg, the 13:07 run reset the claim as a ghost, and the resumed session attached a finished PR to a re-claimed In Progress ticket, one scan from a fourth reset — APP-1004.) The early-push rule now lives in `skill-build-ticket` step 1, stated there in full and for exactly this reason — *"This is a rule of this skill, stated here because this is the artefact the executing leg reads"*, citing APP-1385 and APP-1378 — so the debt this paragraph recorded is discharged and the paragraph is retired. What the driver still owes is the *consequence* of the marker branch that rule creates, which is change 2 on this row.
- Pass only the ticket ID and its target repo — no build narrative from any prior ticket in this run.
- **An environment correction the run learns is filed against the artefact the leg reads, never carried in the next brief.** A leg that pays for a trap — a harness that reports to stderr, a build cache that serves stale bytes, a wait that measures no time — has produced a canon-shaped fact, and the brief is the one place it cannot survive: it is unversioned, unreviewed, seen once and discarded, and it drifts in the retyping. So the driver's response to a trap is a `FRICTION` note to the Pulse queue naming the artefact the correction belongs in (*Setup*, `skill-ops-retro` capture), not a "traps already paid for" section in the next leg's prompt. Corrections have three standing homes and no fourth: a **mechanism** fact about the sandbox or the GitHub surface belongs in `convention-github`; a **method** fact about measurement, controls or baselines belongs in `skill-review-pr` or `skill-build-ticket` step 4; a **repo-specific** limit belongs in that repo's `CLAUDE.md`, which `skill-build-ticket` step 3c already reads at claim time. The test of the transport is that a fresh driver on a fresh run needs to know none of it for its legs to avoid the trap. Until a correction lands in one of those homes it is not carried at all — a leg re-paying a trap once more is cheaper than a fleet trained to read briefs as canon. (Worked case: the 2026-09-08 run, 13 legs across three repos, discovered eight environment traps and the driver retyped all eight into every subsequent brief; by the last leg the "traps already paid for" section ran to eight items in the driver's own prose, the wording had drifted between briefs, and one brief told six legs to read a `CLAUDE.md` that does not exist in that repo — APP-1203 — with nothing to catch it against. APP-1205.)
- Require the final response to end with a fixed, parseable line the driver reads: `EXEC RESULT: <pr-opened | blocked | no-op>`, plus the PR reference where one was opened and a one-line reason.

The driver routes off the reported `EXEC RESULT` line — it does not re-derive the outcome from the repo. `pr-opened` proceeds to the QA leg on that PR.

**Before spawning QA on a `pr-opened` result, read the ticket once and check the boxes exec was able to close are ticked.** `skill-review-pr` makes a blank box a changes-needed verdict and forbids QA ticking on the builder's behalf; both are right, and together they mean a hand-off with blank boxes costs a full Opus review and a bounce-cap strike for a defect that has no code in it and that a ticks-only fix cannot re-trigger — the dedup key is the head SHA, and ticking boxes lands no commit. So the driver catches it for the price of one `get_issue`: walk `## Acceptance criteria` and `## Definition of done`, and where any box exec could have closed is blank, do not spawn QA — bounce straight to exec for the bookkeeping fix (Todo, `F0-RGE`, clear assignee, comment naming the blank boxes **and both surfaces that carry them** — the ticket description *and* the PR body's mirrored copy of the same two checklists). It is **two writes, not one**: the description is the write that closes a box and the PR body is a courtesy mirror that closes nothing (`skill-build-ticket` step 6, APP-1520), so a re-hand-off that ticks only the description leaves the two surfaces disagreeing on exactly the path that exists to fix box state, and the next QA leg pays for it by verifying and closing those boxes on its own read (APP-1760) and **do not count it against the bounce cap**, because the cap exists for code problems and a bookkeeping defect is caught by a read, not a review. The gate exempts the boxes exec structurally cannot close at hand-off — CI that concludes after the PR opens, and Prism's own verdict box — which `skill-review-pr` closes on its own verification and `skill-merge-pr` records on the verdict's evidence (APP-1025, APP-736); without that exemption every publish PR bounces forever. (Worked case: APP-933, 2026-08-17 — all ten boxes blank, Prism found every criterion met after a full review including deliberate breakage of each fix, and still had to return changes-needed; strike 1 of 2 spent on nothing — APP-1005.)

`blocked` means exec has already taken its own Blocked fail-safe on the ticket; the driver records it and continues to the next eligible ticket. `no-op` means exec made no change needing a downstream leg — a duplicate-PR Blocked it already handled, a claim its freshness precondition found no longer eligible, or a stale-claim it reset — and the driver likewise records and continues. If the final response carries **no** parseable `EXEC RESULT` line, do not guess a route — **but first distinguish a crashed subagent from one that paused deliberately and is resumable.** The harness's completion signal cannot tell the two apart, but the subagent's final text usually can: a leg that has opened its PR and left CI part-way (e.g. PR open, CI 10/12 green — APP-917) has *paused* on an unresolved external signal, not crashed, and resuming it in one message costs far less than a false Blocked + Urgent escalation landing sound work on the Owner's desk for nothing. So when the final text shows a resumable state — an open PR with in-flight-but-not-failed CI, or a coherent stopping point mid-build — resume the leg (re-dispatch it to finish and hand off) rather than Blocking it. Only where the text shows a genuine crash — no PR, no coherent stopping point, or an actual error — does the no-parseable-line route apply: treat the ticket like an unresolvable blocker: move it to **Blocked** at priority **Urgent**, **clear the executor** (no `agent`-group value), set the `operator-<venture>` label for the vertical that owns the project, clear the assignee, and comment the escalation category and what happened. `operator-<venture>` is its own label group and does not evict the executor, so clearing it is a separate write and not an optional one (APP-1117, Owner ruling 2026-09-04). A judgement item is the operator's first; it reaches Aled on age or at the mandate's edge (`convention-linear`, *Executor*). Surface it in the end-of-run report and continue — the same route the QA leg uses (APP-948, contributing cause APP-935).

**A long external wait is a known trigger for the harness's own idle enforcement, and a leg it terminates has not failed — but the leg it supersedes may still be running.** A subagent polling a real CI run to completion looks idle to the harness, which force-terminates it under its idle/handback rule; the handback that arrives then carries live, correct, resumable state — a pushed branch, an open PR, CI evidence already gathered — and reads exactly like the paused case above, so route it the same way: re-dispatch with a resume brief naming what was done and what is left, never Blocked and never Urgent. Expect this on any leg whose acceptance criteria need a real CI run rather than a YAML read, and budget for it: a terminated-and-resumed build costs the run extra spawns and resumption overhead, not a build. **And a terminated subagent's background work does not stop with it.** A `Monitor` the leg left polling CI survives the termination and wakes later, sending a second, unprompted handback *after* the driver has already dispatched the resume leg — at which point two live agents hold the same ticket and the same branch, which is the one-writer invariant this loop otherwise maintains by running builds serially. So **a handback from a subagent the driver has already superseded with a resume dispatch is informational only: never route off it, and never dispatch a second resume from it** — the resume dispatch is the moment the earlier leg stops being the driver's source of truth for that ticket — and the driver stops the superseded leg's lingering background work as soon as it notices, rather than letting both run. (Worked case: A1-577 / `assoc-one/meirionpritchard-com`, 2026-10-01 delivery-loop run — the exec leg was force-terminated mid-CI-wait twice, each time holding a pushed branch and an open draft PR; roughly 90 minutes of wall-clock and three spawns for what was two small workflow edits. On the first resumption the original leg's own Monitor woke and handed back after the resume leg was already live, leaving two agents on the same branch for a few minutes until the Monitor was stopped by hand — APP-1942, extending the paused-not-crashed case of APP-917.)

**The build runs on the session default tier; only its context is isolated.** Isolating the build is a context-hygiene change, not a tier change: exec stays on the session default, and route and merge stay inline on the session default too. Only the QA leg is pinned to Opus (see *2. QA leg*). As there, name a capability tier and never a versioned model id — a wrong literal fails schema validation and manufactures a false blocker on the first ticket of a run (APP-698).

**Serial per repo is unchanged — one build subagent at a time in this shape.** Isolating the build does not fan builds out. The driver still runs one build at a time, so it remains the effective single writer of claims and the one-PR-per-repo invariant is untouched; the per-claim freshness precondition inside exec still makes each claim safe. Parallel fan-out of build subagents across repos is a separate, dated follow-up (see *Deferred — parallel fan-out across repos*), not this change.

**And "build two variants for review" has a named shape on a one-branch-per-ticket repo — separate commits on the designated branch, or sibling branches cut off it, with the review surface naming which.** The rules above fix one build subagent per repo and one branch per ticket; neither says what a session does when the work it is handed is explicitly two alternatives for the Owner to choose between, and the repo's own `CLAUDE.md` says one branch per ticket. Left unnamed, the session invents a shape under time pressure — a second branch nothing tracks, two PRs against one ticket, or both variants collapsed into a single commit where the reviewer can see neither — and the review surface then carries no way to tell which diff is which, so the choice the variants existed to enable cannot be made. So the shape is named and it is one of exactly two: **variants are emitted as separate commits on the designated branch**, each commit message naming its variant, **or as sibling branches named off the designated branch**, whose naming is `convention-github`'s *Branch naming* to hold and not this file's to restate. Whichever is taken, **the review surface names which variant is which** — in the PR body, or in the ticket comment that asks for the choice — and **the session states which shape it took** in its handback, so the driver learns it from the return rather than by reading the repo. A variant pair is still one ticket: it is not a licence to open a second ticket's branches, and the one-PR-per-repo invariant above is unchanged by it. (Worked case: a session was handed one designated branch and a brief asking for two variants for review, against a repo whose `CLAUDE.md` states one branch per ticket, and had no canon shape to follow — **reported** by the filing note, no session transcript and no repo `CLAUDE.md` being readable from the refine surface. The absence is **observed**: this exec-leg section, the concurrency guardrail above and `convention-github`'s *Branch naming* section were each read against the live store this run, and none of them names a variant pair. `APP-2834`.)

### 2. QA leg

Run the `skill-review-pr` skill as an **isolated subagent on the Opus tier**, not inline in the driver session. QA is the review gate that decides what ships, so it warrants stronger reasoning than the exec/route/merge legs — and running it as a subagent keeps its judgement independent of the exec leg's own reasoning about the change it just made, matching skill-review-pr's own "isolated inputs only" contract. The exec, route and merge legs stay on the session default.

Spawn via the `Agent` tool, selecting the **Opus tier**. The tool's `model` parameter is a **capability enum** — `sonnet` / `opus` / `haiku` / `fable` — so the value to pass is `opus`. **Name the tier, never a versioned model identifier.** A full identifier such as `claude-opus-4-8` fails schema validation, and the failure does not degrade gracefully: per this driver's own rule below, a subagent failure with no parseable verdict routes the ticket to Blocked, Urgent, `human`, assigned Aled, so a wrong literal manufactures a false blocker on the first ticket of every run. It is also the second time a hardcoded model id in canon has drifted from what the tool accepts, which is why this is written as a tier and not as a literal — a tier survives the next model release, a version string does not (APP-698).

If the `Agent` tool exposes an **effort** control in this session, set it to its higher setting for this leg, on the same reasoning that selects the tier: the gate that decides what ships is where the reasoning is worth paying for. If it does not expose one, the tier selection alone is sufficient — do not invent a parameter, because an unrecognised key fails schema validation exactly as the wrong model literal does.

**Spawn the QA subagent with `isolation: "worktree"`.** The QA leg's negative control — revert to base, add a probe, re-run to prove red — is a write to whatever tree it runs in, and without isolation that tree is the driver's own checkout, the one the exec leg has just built in and may still be holding. Passing `isolation: "worktree"` on the `Agent` call gives QA its own git worktree, so the property "QA cannot mutate the checkout the driver holds" is structural rather than an accident of commit-and-push happening to precede the spawn — an ordering that a bounce being iterated, a fix staged while a verdict is outstanding, or the cross-repo interleaving this routine permits would silently lose. The cost is a worktree per QA leg plus an `npm install` inside it — a worktree does not share `node_modules`, and symlinking the driver's is rejected by Turbopack (`skill-review-pr` *Proving the baseline*), so QA installs fresh per `convention-github` *Fresh clones* — which is small beside a leg that already runs for ten minutes or more. `skill-review-pr` carries the matching instruction from its own side (run the control in an isolated tree, never the working checkout — APP-970); this is the driver's half. (Worked case: A1-347 / `meirionpritchard-com` PR #105, 2026-08-16 — QA reverted `globals.css` and both token files to base and added a probe spec inside `/home/user/meirionpritchard-com`, the driver's own clone; harmless only because the exec leg had already pushed `8219c1c` — APP-970.)

**Where the spawn cannot create a worktree, the fallback is a fresh clone — never the shared checkout.** In a multi-repo session the root is not itself a git repository, and `isolation: "worktree"` then fails at spawn with, verbatim: *Cannot create agent worktree: not in a git repository and no WorktreeCreate hooks are configured.* On that exact error, and only on that one, respawn the QA leg without the `isolation` key, and let the prompt carry the fact as a fact — worktree isolation unavailable, and the shared checkout path it must not touch — not as a restated rule: `skill-review-pr` already carries the recipe for a leg whose working directory is not the repo it must read (clone into its own per-ticket scratchpad directory, fetch the PR head, check out `--detach` at the head SHA, install fresh). The leg never downgrades to the shared checkout and "is careful" there instead; that is the APP-970 failure this spawn rule exists to prevent. The fallback holds the same property by the leg's discipline rather than by structure, so name it: the end-of-run report records `isolation: fresh clone (worktree unavailable)` against each leg that ran this way. `WorktreeCreate` / `WorktreeRemove` hooks in `settings.json`, as the error itself suggests, would restore the structural guarantee in such sessions; that is an optional Owner config lever, not a precondition of the run. (Worked case: on 2026-09-21 every QA spawn failed with this error in a session holding `mbn-theme` and `meirionpritchard-com` side by side, and both legs ran cleanly from fresh scratchpad clones; APP-1444 hit the same condition on 2026-09-14 and hand-built its trees in `/tmp` — APP-1561.)

**And a worktree created inside the repo is a scratch tree the stop hook will demand be committed — name the location, gitignore it, and tell the leg to refuse the demand.** The two rules above decide *whether* the QA leg gets its own tree and what to do when it cannot have one; neither says *where* the tree lands, and the default lands it inside the repo under review. A QA leg spawned with `isolation: "worktree"` puts its worktree under `.claude/worktrees` **inside the repo**, untracked and not gitignored, so the repo's stop hook reads a dirty tree and demands the scratch tree be committed before the leg may finish — and a leg that obeys commits a throwaway review checkout into the branch it was reviewing. So the spawn rule carries three obligations and all three are the driver's to state in the prompt. **Name the location** — `.claude/worktrees` inside the repo, so the leg is not surprised by where its own tree appeared. **Require it be gitignored**, or require the leg to write its worktree outside the repo entirely, which is the stronger fix and the one to take where the repo's `.gitignore` is not this run's to change. And **tell the leg to expect the stop hook's demand and refuse it**: a scratch tree is never committed, and a stop hook demanding it is a condition to report in the leg's handback, not an instruction to satisfy. The fallback above already records its isolation mode in the end-of-run report; the gitignore state is recorded the same way, so a run whose worktree sat untracked inside the repo is legible afterwards rather than only at the moment the hook fired. (Worked case: a QA leg spawned with `isolation: "worktree"` placed its worktree under `.claude/worktrees` inside the repo under review, untracked and absent from that repo's `.gitignore`, and the stop hook then demanded the scratch tree be committed before the leg could finish — **reported** by the filing note, no session transcript and no repo `.gitignore` being readable from the refine surface. The gap itself is **observed**: the worktree spawn rule and its fresh-clone fallback above were read against the live store this run and neither names a location or a gitignore obligation anywhere. `APP-2833`.)

**And a worktree the spawn creates successfully can still be a worktree of the wrong repository — `cd` into the target repo immediately before the spawn, and have the leg prove the remote before it trusts the tree.** The three rules above settle whether the QA leg gets its own tree, what to do when it cannot have one, and where the tree lands. None of them tests *which repository* the tree belongs to, and in a multi-repo session that is the property nothing checks: the spawn appears to resolve its worktree root from the **orchestrating session's** shell cwd rather than from the repo named in the leg's prompt, and the driver's cwd sits wherever its last `Bash` call left it. The failure is the quiet one of the pair. The APP-1561 shape errors out loudly and the fresh-clone fallback fires deliberately; this shape succeeds, and a leg that trusts the tree it was handed runs its negative control, its manifest build and its render check against an unrelated repository while returning a verdict on the PR it was asked about — a false clean or a false red with no signal anywhere. So the driver **`cd`s into the target repo's root in the call that immediately precedes the `Agent` spawn**, never relying on where the previous leg left it, and the prompt carries the target repo's `origin` as a fact the leg must confirm: **`git remote -v` in the handed tree before anything else, and on a mismatch the fresh scratchpad clone of the named repo** — the fallback the rule above already carries, reached by a different trigger. The check is recorded in the end-of-run report beside the isolation mode, so a run whose trees were right is as legible afterwards as one whose trees were not. Whether the root resolution is genuinely cwd-driven is an **unverified premise** named here and not asserted: the `Agent` tool is not on the refine surface's roster and no sandbox, worktree or repo is readable from it, so the mechanism is the filing run's hypothesis and only the symptom is counted. (Worked case: **reported** from the 2026-11-16 `routine-delivery-loop` run — six QA legs dispatched against `assoc-one/claude-ops` PRs for `APP-3127` through `APP-3132` each received a worktree under `/home/user/a1-advisory/.claude/worktrees/agent-<id>`, with `git remote -v` showing `assoc-one/a1-advisory` every time; all six detected the mismatch from a prompt that already instructed the check, fell back to a fresh clone, and the driver's own `git status` in `a1-advisory` then read the leftover worktree directory as untracked work and fired that session's stop hook, which is the condition the rule above already covers. The repos, worktrees and remotes are that run's **report** and are unverified here: `/home/user` does not exist on this surface and `gh api repos/<any>` answers 403 for every repository, a public control included. The gap is **observed**: `git remote -v` occurs 0 times in `skill-review-pr` and 0 times in this file, and its single appearance in the store — `skill-build-ticket` step 3c, where it confirms git-repo state against a false session banner — is a different check for a different purpose, all measured against the live store this run. `APP-3136`.)

The prompt must:

- Instruct the subagent to load and follow `skill-review-pr`'s SKILL.md verbatim against this ticket and its PR.
- Pass only the ticket ID and PR reference — no exec-leg narrative, reasoning, or context from this session.
- Require the subagent's final response to end with a fixed, parseable line the driver reads to execute **Route per verdict** below: `QA VERDICT: <skipped-dedup | clean | changes-needed | blocked-environment | operator-verify-only>`, plus a one-line reason.

Full qa behaviour applies inside the subagent — follow that skill for details. In summary, working from isolated inputs only (ticket, embedded criteria, diff):

- Check the dedup key (`[qa] HEAD: <sha7>`) — skip if a verdict for the current head commit already exists.
- Assess each acceptance criterion adversarially; cite what was run and observed.
- Post the verdict comment on both the Linear ticket and the GitHub PR, beginning with `[qa] HEAD: <sha7>`.

The driver routes off the subagent's reported `QA VERDICT` line — it does not re-derive the verdict from the PR itself. **The blocked-and-urgent route below is gated on one check first.** Where the driver's own QA leg returns in-run with no verdict and no handback, and the ticket or the pull request carries a `[qa] REVIEWING HEAD: <sha7>` marker at the **current** head with no superseding verdict at that head, the leg stopped mid-review rather than crashed — a resumable state, not a failure — so resume it once with an explicit finish-and-report instruction, and take the absent-line route only if that resume also returns nothing. The mechanism costs nothing new: the marker is `skill-review-pr`'s own (its step 5), and this driver already reads it as a live-leg signal in *Trigger* above, where a marker inside the staleness threshold with no verdict at that head marks the repo held. That cross-run rule is untouched — it is keyed on the staleness threshold and this gate is keyed on the current head and this run's own leg, so a stale marker from another run still routes as written. This is the **paused-versus-crashed** distinction the exec leg already carries in *Behaviour* below ("a subagent with no parseable result line resumes if the leg paused on a resumable state, and otherwise routes to Blocked + Urgent"), applied to the review leg, which had only the crash branch. The root cause of the silent return is **undiagnosed** — tool budget, an internal early stop, or a dropped final response are all consistent with what was seen — and the change is written to be correct either way: a resumable leg resumes, and anything genuinely dead fails the resume and takes the original route one message later. (Worked case: twice in one run on 2026-10-15, a QA leg posted its reviewing-head marker and returned with neither verdict nor handback; both resumed cleanly on a single finish-and-report message, where the route as written would have manufactured a Blocked + Urgent judgement item on live, reviewable work. The ticket identifiers and the two heads are the filing leg's report and are **unverified** here, no repo or GitHub access from the refine surface; the two canon claims this change leans on — the marker in `skill-review-pr` and this driver's own live-leg read of it — were both checked against the live store this run — APP-2363.) Otherwise: if the subagent's final response has no parseable `QA VERDICT` line (a subagent failure, not a QA outcome), do not guess a route: treat the ticket like an unresolvable blocker: move it to **Blocked** at priority **Urgent**, **clear the executor** (no `agent`-group value), set the `operator-<venture>` label for the vertical that owns the project, clear the assignee, and comment the escalation category and what happened. `operator-<venture>` does not evict the executor, so clearing it is a separate write (APP-1117). A judgement item is the operator's first; it reaches Aled on age or at the mandate's edge (`convention-linear`, *Executor*). Surface it in the end-of-run report and continue to the next eligible ticket.

**The QA leg returns asynchronously, and what the run may do while it is outstanding is bounded per repo.** The `Agent` tool returns control to the driver on completion rather than blocking, even when invoked with `run_in_background: false`. That is workable, but it sits against the *serial by design* guardrail, so the rule is stated rather than left to each run to re-derive:

- While a QA subagent is outstanding, the driver may begin the exec leg of the next eligible ticket **only if that ticket targets a different repo**. Never a second leg on the same repo as the outstanding QA — that is the collision the serial rule exists to prevent, and it is a repo hazard, not a run hazard.
- This permission is about a QA leg being outstanding and reaches nothing else. It does not license two **exec** legs at once: the one-build-at-a-time rule above is stricter than this interleaving rule and was written later to close exactly this gap, so two exec legs dispatched in one tool-call batch is the deviation even where both repos are independent and the per-repo test reads clear. A run holding this permission in working memory generalises from it to "parallelise execs across repos" unless the two are read together, which is why they are stated side by side here. (Worked case: the 2026-10-24 run dispatched three exec legs in one batch across three repos after a 5-eligible scan; no collision followed, because the repos were genuinely independent, so the deviation cost nothing measurable and was visible only in the run's own report — APP-2663, after APP-826 and APP-2126.)
- **The test is whether a leg is outstanding, not whether two dispatches shared a batch.** A dispatch separated from the previous one by a turn boundary and an intervening write — a merge confirmation, a routing comment, a post-merge re-scan — is the same deviation as a batched pair, because the rule bounds how many builds run at once and not how the calls were grouped. The batch wording above is the sentence the driver actually reads, so a run that has just posted a merge confirmation finds nothing in it against the next dispatch and the per-repo test reads clear on both repos. So the outstanding set is re-derived before every exec dispatch rather than recalled: any ticket this run moved to In Progress under `F0-RGE` whose `EXEC RESULT` has not yet come back is an outstanding leg, and one outstanding leg means the dispatch waits. (Worked case: on the 2026-11-05 ~10:13Z run the driver dispatched `APP-2869`'s exec leg in the same turn as `APP-2870`'s merge confirmation while `A1-889`'s leg, dispatched minutes earlier on another repo, was still running; both ran to completion and both PRs opened cleanly, so the deviation again cost nothing measurable and was visible only in the run's own report. Third occurrence of the class after `APP-2126` and `APP-2663`, both Done, and the first where the dispatches did not share a batch. `APP-2903`.)
- At most one ticket is in flight per repo, and its routing writes happen only when its own verdict returns. Never route, merge, or bounce a ticket whose verdict has not come back.
- A run never ends with an outstanding QA subagent. Collect and route every verdict before the end-of-run report; a verdict that never returns takes the absent-line failure route above.
- **A connector loss that outlasts one ticket's review splits the verdict from the routing — hold the merge, report the split, and never close the loop on a GitHub-only verdict.** The QA leg posts its verdict to both the GitHub PR and the Linear ticket, so a Linear connector loss part-way through a review can leave the PR carrying a complete verdict while the ticket carries nothing: the review is genuinely finished and the loop is genuinely not. Read that as a downstream signal that has half arrived, not as a verdict in hand. Nothing merges until the Linear write lands; the ticket keeps its current state and label; and the end-of-run report names the ticket, the head commit, the GitHub-side verdict and the write still outstanding. Where the connector does not return within the run, the ticket takes the absent-line failure route above rather than a route derived from the PR. The reason is attribution rather than caution: the board is what every other pass reads, and a merge justified by a verdict no reader of the board can see is indistinguishable from a merge justified by nothing. (Worked case: a delivery-loop run lost the Linear connector mid-run, outlasting one ticket's review — the GitHub-side verdict completed and posted while the Linear comment and the routing writes did not land until the connector returned — APP-1838.)

The bounce count is read from Linear rather than session state, so interleaved tickets still read the correct strike count (see *Bounce cap*). (Reasoning and first live evidence: APP-698 — four QA subagents across the 2026-07-27 session, all returning and routing correctly, with the run proceeding to a different repo while one was outstanding.)

### 3. Route per verdict

Read the verdict outcome and the ticket's human-gate flag (`Human gate: required — <reason>` in the ticket body; absent = none).

- **Unflagged + clean pass** → set label `R3-LAY` (evicts `PR-1SM`), keep In Review, leave assignee clear. This routing is the merge approval signal for unflagged work (see *merge leg*). Run the `skill-merge-pr` skill. Continue to the next eligible ticket.
- **Flagged + clean pass** → **clear the executor** (remove the `agent`-group value entirely — no `PR-1SM`, no `R3-LAY`, no replacement value), set the `operator-<venture>` label for the vertical that owns the project, clear the assignee, set priority **High**, keep In Review, and post the verdict with the flagged item leading, naming the escalation category and the question the operator is being asked to rule. Since the operator label-group split (confirmed live 2026-09-03) `operator-<venture>` sits *beside* the executor rather than replacing it, so a route that only adds the label leaves `agent:PR-1SM` in place and QA re-queues the ticket on the next sweep; clearing the executor is what takes it out of the fleet's queues. The operator rules the flag or hands it to Aled where it is genuinely his (a design judgement only he can make stays `human` + Aled). Stop on this ticket; continue to the next eligible ticket. (Owner ruling, Aled 2026-09-04: no `operator` value in the `agent` group — "evict" was the mechanism of the old single-select shape, not a requirement. APP-1117, APP-1103, APP-1035.)
- **Operator-verify-only clean pass** (QA clean except one AC that only Aled's own eyes or judgement can verify — no environment can automate it, e.g. "looks right in /studio") → keep **In Review**, set label `human` (evicts `PR-1SM`), assign Aled, set priority **High** (age to **Urgent** if it lingers), post the verdict noting the one AC awaiting his review — this is the one row that stays with the Owner, because by definition only his eyes can verify it. **Not Blocked** — nothing external blocks it, only his sign-off is outstanding (convention-linear *Issue states*; skill-review-pr; worked case A1-129, APP-441). Stop on this ticket; continue to the next eligible ticket. **And where the ticket carries an open, unmerged PR, the verdict names the exit as well as the ask** — because this route is the one place a hold has no way back into the loop. The out-of-band approval sweep keys on `agent:R3-LAY`, and this route deliberately sets `human` and never `R3-LAY`, so a confirmation written as a plain comment is prose and not a signal, and a ticket moved straight to **Done** on the strength of it leaves its fix unshipped behind a board that reads as finished — a worse state than one sitting visibly In Review, because nothing signals a problem. So the verdict comment says, in novice-grade terms per `convention-ticket`'s *Writing an instruction the operator has to action*: what to look at, and that **when he is satisfied he sets `agent:R3-LAY` on the ticket and leaves it In Review** — the next loop run's out-of-band sweep merges it and moves it on — **rather than moving it to Done himself while the PR is open**. That is the documented out-of-band approval used as designed, not a hold arming a merge: the hold has ended, so the routing invariant below is satisfied. Where the ticket's acceptance depends on the Owner exercising a UI rather than forming a judgement, the same comment carries the **numbered test script** he runs, for the same reason and under the same rule. (Worked case: MBN-296, `mbn-theme` PR #13 — routed correctly to operator-verify-only, confirmed by the Owner in a plain stand-up-ruling comment on 2026-09-21 and moved to Done, with PR #13 left open and CI still green for two further days until someone noticed by chance and asked for a hand merge. Second of the family on one ticket pair: its sibling MBN-282 bounced Done → In Review → Done three times before MBN-296 found the real defect — APP-1701. Premise unverified — confirm the PR number and repo against `assoc-one/mbn-theme` before building.)
- **Block (a genuine external blocker QA cannot resolve without separate work — a missing credential, an environment only CI or a device can provide, an unanswered dependency)** → move to Blocked and route by what is missing: a credential, a device, an account only Aled holds → `human`, assign Aled, @mention with what is needed; an unanswered dependency or a call on whether the blocker is real → **clear the executor** (no `agent`-group value), set `operator-<venture>`, clear the assignee, and @mention the operator with the escalation category and what is needed; Aled is the second hop on age (APP-1117). Reserve Blocked for a dependency that must clear before the ticket can progress; an AC that merely needs Aled's own review is the operator-verify-only route above, not this. Stop on this ticket; continue to the next eligible ticket.
- **Environment-limitation clean pass (QA sub-case (a) — unverifiable in the sandbox, but not a human gate)** → QA has found one AC it cannot verify in-sandbox that is *not* the operator's own judgement to make, and has parked the ticket at **Blocked + `agent:R3-LAY`** per `skill-review-pr`. Do **not** route this through the generic *Block* row above — `skill-review-pr` is explicit that this class is never handed to the operator as a "please run this" chore, and `skill-merge-pr`'s trigger (In Review + `agent:R3-LAY`) will never pick a Blocked ticket up, so followed literally the ticket sticks. **First ask `convention-linear`'s question, not the waiver's: would separate work make this box verifiable?** Where the unverifiable box is **CI itself**, or any other case where separate work would install the instrument, `convention-linear`'s *Issue states* instrument test governs and this row does not apply — the ticket goes to **Blocked carrying a blocked-by relation** to the ticket that installs the instrument, filed if it does not exist, with `human` and the assignee set per that rule. The bounded waiver applies **only** where an independent signal **genuinely executed in a trusted environment** already covers the surface. Where it does, apply `skill-merge-pr`'s **bounded-waiver test**: if an independent signal already covers the surface (green CI that genuinely ran, a passing visual diff, an identical code path already merged and serving), record the one-line waiver reason on the ticket, move it back to **In Review** (which is what makes `agent:R3-LAY` read as approved-ready-to-merge), and run the `skill-merge-pr` skill. If nothing independent covers the box, it is genuinely in doubt — leave it for the operator (**In Review**, set label `human`, assign Aled) rather than merging. Continue to the next eligible ticket. (Worked case: A1-250, `assoc-one/portal`, 2026-07-24 — QA parked it at Blocked + `agent:R3-LAY`; the identical mechanism in A1-249 was already merged and serving live, so the waiver applied and it merged — APP-665.) (Counter-case, and the reason the deferral is worded as a one-way street: the A1-250 waiver applied because an identical mechanism was *already merged and serving live* — an independent signal that genuinely ran. Where the unverifiable box is CI itself, no such signal exists by construction, because the signal is the instrument that is down. The two errors are not symmetric: parking a mergeable ticket in Blocked costs a re-route; waiving into a repo whose gate is entirely down, on a repo that publishes a public site, ships the failure. So the instrument case defers to `convention-linear` and never to the waiver — APP-1230.)
- **Changes needed** → check the bounce count before routing (see *Bounce cap* below).

**The invariant behind every row above: a route intended to hold work for the Owner or the operator sets `human` or `operator-<venture>`, never `R3-LAY`.** `agent:R3-LAY` on an In Review ticket is the merge-arming signal — `skill-merge-pr` and the out-of-band approval sweep both read it as "approved, ship it" — so a route that means "someone should look at this before anything else happens" must either set `human` or take the operator route — clear the executor and set `operator-<venture>` (APP-1035, APP-1117) — or it arms the autonomous merge it was trying to prevent. Clearing the executor is what disarms it: since the operator label-group split, an `operator-<venture>` label added beside a live `agent:R3-LAY` leaves the merge sweep armed on a ticket the route was holding. The rule is stated as "a hold sets a non-Relay value", not as "`R3-LAY` never appears on In Review": the *Environment-limitation clean pass* row deliberately moves a ticket back to In Review carrying `R3-LAY` to arm the bounded-waiver merge (APP-665), and that is a merge decision, not a hold. (Worked case: APP-806's fourth acceptance box — this invariant — was left unauthored when the note closed on an Owner ruling, and no pass picked it up for three weeks — APP-920.)

### merge leg

When the route is unflagged + clean, run the `skill-merge-pr` skill on the ticket's PR. The loop's clean-pass routing to `R3-LAY` is itself the approval signal — for unflagged, clean, unblocked work the merge proceeds without a separate `@relay` comment. Full merge behaviour applies. If merge hits a CI failure or conflict, it takes its own fail-safe (Blocked, Urgent, human, assigned Aled). Continue to the next eligible ticket regardless.

**A ticket spanning several PRs is legitimate, and the driver does not split it.** An estate-wide sweep — a `.gitignore` or lint-config rollout, a CI rollout, a dependency bump — is one ticket against N repos and N PRs by design, and the driver runs it as one cycle: one exec leg, one QA leg, one merge leg. The multi-PR rules live on the legs that need them — the `[qa] HEAD:` dedup key against a named primary PR whose verdict body enumerates every PR and head, the un-drafting, and the partial-merge route — and are carried by the `skill-merge-pr` and `skill-review-pr` rows rather than restated here, per this driver's own rule that it calls existing skills instead of duplicating their logic. (Worked case: APP-1111, 2026-09-04 — 14 repos, 12 PRs, 11 merged and one correctly held on a red check; every multi-PR question was re-derived live because no rule carried it — APP-1126.)

**Check the ticked boxes against the QA verdict before merging — a body can change after the verdict posts.** The clean-pass routing to `R3-LAY` is the approval signal, but the acceptance-criteria checklist in the ticket / PR body is mutable and the `[qa]` verdict is a point-in-time snapshot of the head it ran against. Before merging, reconcile the two: confirm the boxes the verdict relied on are still ticked and were not reverted since it posted, and that the body asserts no decision attribution that appeared *after* the verdict without a QA re-run. A body edited since the verdict — a reverted tick, or a decision that never happened — is **reconciled or treated as void** before merge, never merged on the stale verdict. The in-session run catches this only because the driver happens to hold the true history in-session; a scheduled run picking the ticket up cold reads the description as authoritative, so this is a design guard, not a luck-of-ordering one. Severity is asymmetric: a reverted tick is a false *negative* (the merge stalls, someone looks — recoverable), while a fabricated decision attribution is a false *positive* that manufactures Owner authority — weight the check toward the second (APP-948).

**CI status reads go stale — a status field is not proof a job is still running.** `skill-merge-pr`'s CI-wait re-queries the head commit's check state each iteration, and that read lags. `mcp__github__pull_request_read` with method `get_check_runs` has been measured reporting `queued` / `in_progress` for several minutes after the jobs concluded successfully, and `mcp__github__actions_list` with method `list_workflow_jobs` lags too, so cross-checking one status endpoint against the other is not enough. **Where a wait turns on whether checks have *concluded*, read the job logs** (`get_job_logs`): a concluded suite summary in the log is proof, while a status field saying `in_progress` is not proof of the opposite. The log read is also the right instrument for `skill-merge-pr`'s "checks genuinely ran, not a bare aggregate" guard, since it is the only read that can distinguish a real run from a suite that collected zero tests.

Two reasons this matters more than it looks. The first is budget: a routine whose only sanctioned early stop is a time budget must not spend that budget on its instrument, and each ticket burned extra polling cycles waiting for a conclusion that had already happened. The second is the same staleness in the other direction — a job that has already **failed** can still read `in_progress`, so a run treating "still running" as "not yet a problem" waits out a red check instead of acting on it.

This is **freshness**, and it is distinct from the **coverage** rule in `convention-github` *Reading CI / PR state in autonomous runs* — that check runs and commit statuses are two surfaces and neither read shows the other's objects. Both apply, and neither substitutes for the other: read both surfaces, and treat the status fields on either as lag-prone. (Worked case: 2026-08-10 delivery-loop run — `assoc-one/firmup` PR #29 read `in_progress` ~7 minutes after a real `completed_at` of 09:24:47, and `assoc-one/bot-trader` PR #13 likewise; on `assoc-one/firmup` PR #30 both `get_check_runs` and `list_workflow_jobs` read `in_progress` for a further ~6 minutes after a genuine 10:16:53 conclusion, and only `get_job_logs` told the truth, returning the completed suite summary — APP-765.)

### Post-merge re-scan

**Re-run the eligibility scan after each successful merge, and work what it adds.** The opening scan is a snapshot of a queue the run is about to change. A ticket that is a leaf, in Todo, carrying `F0-RGE`, whose only disqualifier was an open blocked-by relation, becomes eligible the moment its blocker merges — and without a re-scan it waits a full scheduling interval, so a three-deep chain built in one session takes three runs to clear. That is the same n+1-runs shape this driver replaced the three timer routines to remove; the fix landed for independent tickets and was never extended to dependent chains, which is exactly where the latency compounds (APP-752).

- After each successful merge — in the in-session cycle and in the out-of-band approval sweep alike — re-run the **full** scan, both phases. If it yields a ticket the opening scan did not, restate the figure in step 0's fixed form (*"re-scan after merge: M now M′"*) and continue working the queue.
- The re-scan **only adds**. It never re-admits a ticket already worked this run; a ticket sent back to Todo by the bounce cap re-enters through the bounce cap's own path, not through here.
- The re-scan changes the number, never the stop rules. The two stopping conditions are unchanged, and an early stop is measured against the latest restated figure.

**Where a merge clears the last blocker on a ticket still in Backlog, run `skill-coordinate` scoped to that ticket — do not promote it by hand.** Promotion crosses no agent boundary: this loop already composes Forge (exec), Prism (qa) and Relay (route, merge), and `skill-merge-pr` is Relay's, so a Relay-class promotion inside the run is the same agent doing work it already does here. The APP-540 guardrail below forbids *closing* an unowned ticket without evidence, which is a different action from promoting one — reversible, asserting nothing about completion. What the loop must not do is reimplement a thinner promotion: `skill-coordinate` also applies decisions from PM comments, encodes dependencies and surfaces structural proposals, and a promotion made purely on "blocker merged" could promote something coordinate would have held for another reason. So delegate the judgement to the skill that owns it, scoped to the affected ticket, and let anything it promotes to Todo reach the loop through the next re-scan.

If the loop's drain cadence and `task-coordinate`'s promotion cadence are mismatched, fixing the re-scan only moves the stall one layer up. That is a schedule question, owned by `skill-optimisation-review` Pass 3(b) (sequencing and loops) and resolved by an `OPS:` schedule ticket for the operator — not something this loop re-times for itself.

## Bounce cap

The cap is **two strikes**: one auto-bounce to exec, escalation to Aled on the second "changes needed" verdict for the same ticket.

**Before routing a "changes needed" verdict**, count prior QA bounce verdicts on the ticket:

1. Scan the ticket's Linear comment thread (`orderBy: createdAt`, sufficient limit — see convention-linear *Comment ordering gotcha*).
2. Count comments that begin with `[qa] HEAD:` and contain "changes needed" (case-insensitive) anywhere in their body. This is the number of prior bounces.

**Strike 1 (count = 0):** Auto-bounce to exec — move ticket to **Todo**, set label `F0-RGE` (evicts `PR-1SM`), clear assignee, add a brief Linear comment summarising the fix needed. Re-run the exec and QA legs for this ticket (re-enter from step 1 of this cycle).

**Derive the branch the bounce pushes to from the PR, never from a remembered name.** The PR number is the durable identifier; the branch name is not. When the bounce comment (or the exec leg it re-enters) names the branch to push additional commits to, take it from the PR object's **`head.ref`** read live, never from a generated name carried in memory or lifted from a sibling ticket. Under a re-land convention a ticket can have two plausible branches — a stale generated name (`claude/clever-goldberg-*`) from a superseded PR lineage and the live `-reland` branch — and pushing to the wrong one is silent: the branch exists, the checkout and push both succeed, and the open PR simply shows no new commits while the fix is built on a stale, commits-behind tree where the defect is often unreproducible. So the exec leg **confirms the target branch is the head of the PR being updated before pushing**, and **verifies the PR head SHA moved after pushing** — "updated in place" is an observation, not an assumption. A branch that is not the PR's head takes the Blocked path rather than a quiet no-op push. (Worked case: a QA bounce on A1-263 named `claude/clever-goldberg-mkxo37` — 8 commits behind and not PR #99's head `claude/a1-263-reland`; caught only by `skill-build-ticket`'s step-3a premise check, which found the schema fields the fix depended on absent on the named branch — APP-851. The single-designated-branch grant this stems from is APP-843's Owner decision.)

**Strike 2 (count ≥ 1):** Cap hit — **clear the executor** (the `agent`-group value is removed, not replaced: no `PR-1SM`, no substitute), set the `operator-<venture>` label, clear the assignee, keep In Review. Adding the label while leaving `agent:PR-1SM` in place re-queues the ticket for QA on the next sweep, which is the failure the label-group split introduced (APP-1117, Owner ruling 2026-09-04). Comment: "Second QA changes-needed — bounce cap reached. Routed to the operator: is a third attempt worth it, or does scope bend?" The operator rules; Aled is the second hop on age or at the mandate's edge (APP-1035). Stop on this ticket; continue to the next eligible ticket.

The count is derived from Linear, not session state — a crash or a loop spanning multiple runs reads the correct strike count from the comment thread, so no chain state is lost.

## End-of-run report

Close every run with a short note of what moved (tickets merged, bounced, blocked, flagged), **opening with the step-0 pair**: the candidate and eligible counts and repo spread declared at the start — together with any re-scan restatement — and, where the queue was not drained to empty, the stop condition in its required form (`queue empty` or `budget exhausted: <number>`). A report that ends early without that line is incomplete. On a run that **ends with no eligible ticket**, distinguish "no work queued" from "work waiting on a gate" with a **zero-eligible diagnostic**: list any `F0-RGE` tickets that exist but are in a non-Todo state (Refinement, Backlog, Blocked, In Review) with their state, **and any `F0-RGE` ticket that is in Todo but held out by an open blocked-by relation, naming the blocker** — the latter is invisible to a state-based list, and it is the shape a stalled chain takes (APP-752). So the operator can see at a glance whether the queue is genuinely empty or whether promotion / unblocking is what is missing. A fully empty `F0-RGE` set is reported as exactly that. **Where every held-out ticket in a project traces back to that project's own paused status, collapse them into one project-level line — never one decision per ticket.** This applies to both the zero-eligible diagnostic and any "surfaced for the Owner" reporting in an ordinary end-of-run report. The form is the project, its status, the count, and an explicit no-action-needed: "app.Luna is on **Hold** — 3 `F0-RGE` tickets held (APP-60, APP-61, APP-63), no action needed." That single line is the half of this rule that actually stops the re-surfacing, and it is not optional dressing on the eligibility check: a Hold-project ticket listed individually — even correctly, even as "held out" — still reads as N open items needing N judgements, and the Owner pays to re-explain the same already-made decision every run. **A project Hold outranks whatever ticket-level reason also applies.** Where a ticket is held out both by a Hold and by an assignee, an open `blockedBy`, or a dependency named in a PM comment, report the Hold and drop the ticket-level framing: the ticket-level reason is true, subordinate, and the thing that has been misleading the report. **No blocker-impact line is owed for a Hold**, because nothing is starved and there is no clearing action for the loop to name — resuming the project is an Owner move, made at the project level, not a blocker to clear. Where the Hold itself looks stale rather than deliberate, that is a hygiene item for `skill-plan`'s weekly cross-project pass (`convention-project-status`), surfaced as one line, and never a reason to widen the scan back out. (Worked case: the 2026-09-22 run listed APP-60, APP-61 and APP-63 as three separate tickets "waiting on Owner-provisioned credentials (APP-1034)", each framed as an open decision, when one line naming `app.Luna`'s Hold would have closed all three; the same three had already been re-qualified from scratch on 2026-09-10 and 2026-09-11 — APP-1651, APP-1318.) For each root blocker holding a Todo ticket out — whether by an open relation or by a dependency named only in Notes or a PM comment, which the relation query cannot see (A1-350: "pick up after A1-349 lands", plus two unset `NEXT_PUBLIC_SANITY_*` variables) — add a **blocker-impact line**: the blocker, its state, its age, the count and top priority of the `F0-RGE` Todo tickets it transitively holds, and the single clearing action where one is known. "A1-349 (In Review, Owner-assigned, 18d) is starving 1 Urgent build and the a1.assoc-one Foundation milestone — merge PR #6, then flip the Vercel Framework Preset" is the sentence that moves something; "0 eligible of 1" is not. This is the line APP-723 recommended and never landed, across eleven consecutive starved runs (APP-1033). This keeps a clean zero-eligible run informative rather than silent (captured 2026-06-28, delivery-loop run). A likely-stalled handoff detected by the concurrency guardrail (see *Trigger*) — auto-resumed if provably complete, otherwise surfaced — a run declined or ended by the run-level lock, an exec leg resumed rather than Blocked on a no-`EXEC RESULT` return, and any ticket held out of the scan because its target repo is not in this session's connector scope (see *Eligibility scan*), are surfaced here too, so a run skipped or narrowed is never silent.

**Where a blocker-impact line names a dependency that exists only in prose, name the relation that would make it cheap.** A dependency recorded in a PM comment, or in a *different* ticket's body, is refusable only by a read the scan does not make — so it costs a full phase-2 read every run and is re-derived from nothing each time. The remedy is not to cache the phase-2 outcome: a cached ineligibility outlives its cause, and a stale skip is worse than the read it saves. The remedy is to record the dependency where the scan already looks — state the missing `blockedBy` relation in the diagnostic, ticket by ticket, so one relation write turns the most expensive read in the queue into the cheapest one. The loop **proposes and never sets** it: a relation asserts a dependency on a ticket the loop does not own. (Worked case: thirteen `F0-RGE` Todo candidates across six projects qualified to zero on 2026-09-10, and the identical thirteen again on 2026-09-11. Six were refusable by the relation read already in phase 2. APP-63 was the expensive one — leaf, `F0-RGE`, Todo, no open relation, repo in scope, a PM comment saying it was clear — and refusable only from APP-1034's body, which names it as blocked; APP-60 and APP-61 carried their blockers in PM comments alone — APP-1318.)

## Guardrails

- Merges unflagged, clean, unblocked work autonomously: the merge leg runs `skill-merge-pr`, and the loop's clean-pass routing to `agent:R3-LAY` is the approval signal — no separate `@relay` comment is required (Option A, decision 2026-06-25). Main branch stays protected by the routing gate that precedes merge: only unflagged, clean, unblocked tickets are ever routed to `R3-LAY`, so only they are ever merged.
- **Ships out-of-band approvals too.** `agent:R3-LAY` on an In Review ticket is the approval signal whether the loop set it in-session or Aled set it by hand between runs. The out-of-band approval sweep at the top of each run (see *Behaviour*) is what closes the merge-coverage hole for the latter — otherwise a manually-approved ticket never re-enters the flow and sits unshipped (APP-454). The sweep merges only tickets already carrying `R3-LAY`, so it never approves anything itself, and it corroborates a zero result rather than declaring it unchecked (APP-765).
- **QAs out-of-band-stranded reviews too.** The mirror of the approval sweep, one gate earlier: an In Review ticket carrying `agent:PR-1SM` with an open PR and no current-head `[qa]` verdict is waiting for a QA leg nothing else runs, so a second opening pass runs `skill-review-pr` on it (past the ~15-minute concurrency boundary; a ticket carrying an assignee is surfaced, not swept). Same blind spot as the R3-LAY hole — the loop only looks for its own next-step label — and without it a run interrupted between its exec and QA legs strands its ticket permanently (APP-853). The pass keys on the property — In Review, an open PR, no current-head verdict — not on the label, so a ticket whose hand-off left `F0-RGE` in place is QA'd too (APP-1553).
- **Checks the ticked boxes against the QA verdict before merging.** The `[qa]` verdict is a snapshot of the head it ran against, and the body's AC checklist is mutable, so the merge leg reconciles the two before merging: a box reverted since the verdict, or a decision attribution added after it, is reconciled or treated as void rather than merged on the stale verdict. A reverted tick is a recoverable false negative; a fabricated decision attribution is a false positive that manufactures Owner authority, so the check weights toward the second (APP-948).
- **Distinguishes a crashed exec subagent from a paused, resumable one.** A no-`EXEC RESULT` return is not automatically a crash: an exec leg that opened its PR and left CI part-way (PR open, CI 10/12 green — APP-917) has paused on an external signal and is resumed in one message, not escalated. Only a genuine crash (no PR, no coherent stopping point, an actual error) takes the Blocked + Urgent route: executor cleared, `operator-<venture>` set, assignee cleared, escalation category commented (APP-948, contributing cause APP-935, APP-1117).
- **Never changes state on a ticket the loop does not own.** Every state write the loop makes — claim, handoff, route, merge, close — is only ever applied to a fleet-owned ticket the run is actively processing through the exec → qa → route → merge cycle. A ticket whose `agent`-group value is `human` (or any non-fleet owner) is outside the loop's lane entirely: the loop never moves it, and in particular never sweeps it to **Done** as a side effect of closing a sibling. A close names the ticket it is closing and the evidence for it (the merged PR, the QA verdict); it never carries a neighbouring ticket along, and it never marks Done a ticket whose acceptance criteria are unmet and whose named deliverable is absent. (Worked case: APP-540, a `human`-lane feasibility-gate ticket, was swept to Done one minute after the sibling APP-538 merged — none of its acceptance criteria met, no verdict anywhere — and sat wrongly Done for ~40 hours — APP-658.) The rule is about **closing without evidence**, not about touching: a post-merge promotion delegated to `skill-coordinate` is reversible and asserts nothing about completion, and is in scope (APP-752).
- **Never waives a box whose instrument is missing — that is `convention-linear`'s Blocked-with-a-relation case, not this row's.** The *Environment-limitation clean pass* route asks *"would separate work make this verifiable?"* before it asks anything about waivers: where the unverifiable box is CI itself, or any case an instrument would close, the ticket goes to Blocked carrying a blocked-by relation to the ticket that installs the instrument. The bounded waiver is reserved for a signal that genuinely executed in a trusted environment. A waiver routes around a missing instrument; it never replaces one (APP-1230, APP-555, APP-568).
- Aled is in the path for: flagged work, bounce-cap escalations, QA blocks, and merge failures. He is out of the path only for unflagged, clean, unblocked work — those are merged without him, by design.
- The concurrency guardrail skips only for a genuinely active leg, and only the tickets sharing that leg's repo — never the whole run, and never a stalled one: a leg past the staleness threshold with an open PR is auto-resumed when the stall is provably complete (non-draft PR at the ticket's head, required checks green via `list_workflow_jobs`, every AC ticked → In Review + `PR-1SM`, assignee cleared, per APP-924) and otherwise surfaced for the operator, never silently allowed to block every future run or every other repo in a multi-repo session. A leg past the threshold with **no** PR is a ghost claim, reset by `skill-build-ticket`'s recovery (back to Todo, keep `F0-RGE`) — never treated as active and never left to block its repo; recency, not the presence of a PR, is what marks a leg active (APP-808).
- **Declines the run when another driver is live on the same queue.** The run-level lock (see *Trigger*) is a separate check from the per-repo guardrail: it asks whether a second driver is draining this queue, and its remedy is to decline rather than narrow. It layers with `skill-build-ticket`'s per-claim freshness precondition — the lock prevents duplicated build work, the precondition prevents a claim landing on another session's ticket (APP-717).
- **The driver calls existing skills; it does not duplicate their logic — and the prompt it hands a subagent never restates, narrows, or contradicts a skill's rule.** Updates to exec, qa or merge skills are picked up automatically because the subagent loads the skill verbatim. A restatement in the driver prompt is worse than redundant: a rule summarised without its exception is inverted, and a subagent told to follow the prompt follows the inversion. A **narrowing** is the same failure with no visible seam — "post a verdict and nothing else" reads as scope rather than as a rule, and silently deletes the rest of the skill's step. A **contradiction** is the same failure once more, and the standing "canon wins over this brief" line is not the guard against it: a specific, emphatic instruction reliably outweighs a general disclaimer in practice, so the guard is the prompt carrying no rules at all. Four instances in this one file: the exec-leg prompt restated `skill-build-ticket`'s duplicate-PR guard without its supersede exception, so a bounced ticket whose PR sat on a retired session branch could neither be iterated nor superseded and starved for nine runs (APP-919, APP-920); the QA-leg summary said "do not convert draft PRs to ready" while `skill-review-pr` step 3 says convert on a clean pass, so four PRs in one run reached the merge gate as drafts with clean verdicts and the driver had to undraft them with no canon behind it (APP-1058, 2026-08-23); a QA brief saying the leg should "post a verdict and nothing else" suppressed that same `skill-review-pr` step 3 across five consecutive batches, and because the driver then described each draft to its merge leg as the designed hand-off, all five were counted escapes under `skill-merge-pr` step 3 that were never counted — the instruction defeated the control built to make exactly that class visible (APP-1126 (2), APP-1312); and an exec brief instructing the leg to open its PR ready for review, citing APP-1277 / APP-1285 as authority when both say the reverse, which cost the QA signal nothing only because the leg read canon, refused, and flagged the divergence in the PR body (APP-822, APP-1312, 2026-09-10). The prompt names the skill, the ticket and the parseable result line; the skill carries the rules, **and a correction the run learns is filed into a skill rather than carried in a prompt** (*1. Exec leg*, APP-1205). **The same holds for the ticket's own content, not only for a skill's rules.** A brief that re-describes what a ticket delivers — its artefact, its repo, its digest, its acceptance criteria — is a hand-typed copy of a source the leg is about to read for itself, and it drifts exactly as a restated rule does. So the prompt names the ticket **by identifier** and says nothing about its contents; where a brief genuinely must carry a field, it quotes the ticket's own title or digest table verbatim rather than paraphrasing it. A leg meeting a brief that disagrees with its ticket builds to the **ticket** (`skill-build-ticket` step 3, *the source outranks every restatement of it*) and records the discrepancy on the hand-off comment, never resolving it silently in either direction. (Worked case: the 2026-10-01 exec dispatch for APP-1909 described the ticket in prose as publishing `skill-operating-loop`, where its title, its digest table and its one attachment all name `convention-github` alone. The leg built `convention-github`, opened `claude-ops` PR #349 clean — digest-matched at every hop, manifest regenerated, render check passed — and flagged the mismatch on the hand-off comment. No harm landed, and nothing but the leg's own re-read stood between the brief and the wrong artefact. A `skill-operating-loop` publish ticket did exist in the same batch and was worked (APP-1952, PR #362), so this was a transcription slip across adjacent tickets in one sweep with no missing ticket behind it — APP-1944, the same hand-transcription family as APP-1159 and APP-1755.)
- **Serial per repo, one ticket in flight per repo.** One PR open at once per repo, one-agent-per-repo preserved. The QA subagent returns asynchronously, so a run may start the next ticket's exec leg on a *different* repo while a verdict is outstanding — never on the same repo, and never routing a ticket whose verdict has not returned (APP-698).
- **Isolates every build in a disposable fresh subagent — never a fork.** The exec leg spawns a fresh, isolated `Agent`-tool context that returns a one-line `EXEC RESULT`, so no build's file reads, CI output or diff accumulates in the driver session: the driver holds only one-liners and drains the whole queue in one run instead of choking mid-queue and stranding eligible tickets in Todo. A fork would inherit the driver's context and defeat the isolation. A subagent with no parseable result line resumes if the leg paused on a resumable state, and otherwise routes to Blocked + Urgent with the executor cleared, `operator-<venture>` set and the assignee cleared — the same as the QA no-verdict path (APP-1117). Isolation is context hygiene, not fan-out: builds stay serial per repo — and in this shape the driver runs **one build subagent at a time**, so it stays the single writer of claims; two exec legs dispatched in one tool-call batch, even on two different repos, is the deviation, not something the per-repo test clears (APP-826; APP-2126).
- **The QA leg names a capability tier, never a versioned model id.** `opus` is a value of the `Agent` tool's `model` enum; a full identifier fails schema validation, and a failed subagent with no parseable verdict manufactures a false Blocked + Urgent on the first ticket of a run. A tier survives a model release; a version string does not (APP-698).
- **The QA leg runs in its own isolated worktree.** The `Agent` spawn passes `isolation: "worktree"` so a negative control cannot mutate the checkout the driver holds — a structural guarantee, not one that depends on commit-and-push happening to precede the spawn. QA installs its own `node_modules` in that tree; it never symlinks the driver's (APP-970). Where the spawn fails with *not in a git repository and no WorktreeCreate hooks are configured*, the leg runs from a fresh scratchpad clone per `skill-review-pr` and the report says so — never from the shared checkout (APP-1561).
- **Ends on an empty queue or the time budget — never on repo, project, or domain diversity.** A mixed queue is the normal case, not a signal to pause for supervision. The concurrency guardrail narrows a run to exclude one repo; nothing narrows it to one ticket (APP-527).
- **Declares its queue at the start and names its stop at the end (step 0).** A run states the candidate count, the eligible count after the dependency and scope phase, and the repo spread before the first exec leg; restates the figure after any post-merge re-scan; and names `queue empty` or `budget exhausted: <number>` on any early stop. **An unfillable budget blank means continue, not stop** — the run has caught itself, which is the whole purpose of the declaration. Reported in the end-of-run report alongside what moved (APP-583, APP-740).
- **Canon edits originate canon-side, never repo-side.** This artefact is edited in Claude and published to `claude-ops`, which is a downstream mirror; repo commits stay limited to repo-native files (`build-manifest.ts`, the site, CI). A behaviour change authored directly in the repo does not reach the running loop at all — Cloud Routines load canon at run time — and it strands the two copies until someone merges them by hand. (Worked case: the isolated-Opus QA leg was authored as `claude-ops` PR #147, commit `0e57b8e`, 2026-07-20, and never published back; both sides then gained content the other lacked, so neither was a superset, and every parity run re-detected the divergence for three weeks until this merge — APP-643, Owner decision 2026-07-27.)
- Crash-safe: all state lives in Linear (status, labels, PR links, verdict comments). A crash mid-cycle leaves a valid intermediate state; the next run resumes from Linear.
- **Declines outright on a surface without a reachable GitHub connector — never a Linear-only partial run or a `merge_diff` workaround, and never on the shape of a token.** The exec/qa/merge legs need GitHub; the Cowork surface has none. The surface preflight (see *Trigger*) confirms the connector is present and can reach an in-scope repo by an authenticated read (a push dry-run where cheap) before the run-level lock and eligibility scan, and declines with an operator signal if not. The token's value is never read, on either path: `proxy-injected` is the cloud surface's request-time injection mechanism rather than a missing credential, so it is neither a veto nor a failure-path diagnostic — the authenticated read is the only test (APP-1032, APP-1057, APP-1127). A missing connector is a wrong-surface / unprovisioned-session signal to report, not a repo-scope gap to work around (APP-805, APP-801).
- Delivery projects only. Never touches the Pipeline team (Network / Roles / Advisory / Pitches).

## Deferred — parallel fan-out across repos

Isolating each build (see *1. Exec leg*) is the fix for context exhaustion, and it works whether or not builds run concurrently. Running several build subagents at once — one per distinct repo with eligible work, each in an isolated git worktree (`Agent` tool `isolation: 'worktree'`) — is a wall-clock speed bonus on top, and it is a **separate, dated follow-up tracked on APP-826 (due 2026-08-18), not authored here.** Its open points stay on that ticket, out of this canon until they are settled: the fan-out width cap against the parent's budget (width = distinct eligible repos, capped at N); how step 0's opening declaration and the concurrency guardrail restate for parallel legs (per-repo active-leg accounting across concurrent subagents); the single-writer-of-claims property once claims can be written in parallel; merge staying strictly serial within a repo lane while exec fans out across repos; the re-QA cost when a rebase moves the head sha and re-triggers the `[qa] HEAD:` dedup key; and worktree setup and crash-cleanup cost. The merge-queue shape for same-repo parallelism (parallel build, strictly serial merge with mandatory rebase-onto-`main` and CI re-run on the rebased head, gated per repo on CI strength) is a later option again, not part of that follow-up.

## Cutover note — operator action required

When this driver goes live, **retire the three standalone Cloud Routines** (exec timer, qa timer, merge timer) so there is one writer per repo. Running this driver alongside the standalone routines causes double-writes and competing state transitions. The retirement is a scheduling step Aled performs in the Claude Code Routines settings — it is not automated.

## QA subagent mechanism

The QA leg (see *2. QA leg*) spawns via the `Agent` tool rather than an inline `Skill` call. **This needs nothing enabling on the Cloud Routine's session — there is no allowed-tools configuration step.** Verified live on the 2026-07-27 run: four QA subagents were spawned across one session (APP-675, A1-251, APP-690, APP-691), all returned, all posted their verdict comments to both Linear and GitHub, and all ended with a parseable `QA VERDICT:` line the driver routed off.

The isolation earns its keep. On that run QA caught two things an exec-leg self-review would have waved through: that A1-251 was still sitting In Progress under `F0-RGE` because the handoff had been skipped, and that APP-675's PR body ticked a definition-of-done box the ticket had deliberately left unticked (APP-698).

## Setup

- Claude Code Desktop → Schedule → New remote task.
- Connectors: Linear + GitHub (same combined access as exec and qa: Contents read/write, Pull requests read/write).
- Routine prompt (the loader) — the canonical dual form (`core-operating-model`, *The loader line — one form*), pasted verbatim:

  Read the canon artefact `routine-delivery-loop` (the saved skill of that name; locally at `.claude/skills/routine-delivery-loop/SKILL.md`) and follow it verbatim.

  The artefact is canon and supersedes any behaviour an older config described; a run that cannot read the artefact stops and reports rather than improvising from memory.

  A Cloud Routine resolves the **path** half from its cloned `claude-ops` mirror and does not resolve a bare name; the name half is carried so the same config stays portable if this job ever moves surface (APP-1101, APP-830).
- Load MCP tool schemas via ToolSearch as needed for each leg (same schemas exec and qa load individually).
- **Claude Code ≥ 2.1.222.** The exec and QA legs both spawn as isolated `Agent`-tool subagents, and the disposable fresh-context subagent the exec leg depends on needs that floor. Below it, decline the run rather than fall back to an inline build that reintroduces the context-exhaustion the isolation removes.
- The exec leg spawns as a disposable fresh subagent on the session default tier; the QA leg spawns as a subagent on the Opus tier — both via the `Agent` tool. No per-tool allowlist or other configuration is required (see *QA subagent mechanism*).

On finish, run skill-ops-retro capture on this run's friction: **search the Pulse queue first and add the evidence to a same-root note if one exists, otherwise file a new FRICTION note** for the drain pass to assess, in capture step 3's literal shape — team Apps, project os.Claude, `FRICTION:` title, labels `task` + `work:configuration` + `PUL-5E`, Backlog, unassigned — filing the friction, never the run report.
