Quality Pipelines Reference

This page holds the facts of the three quality pipelines (feature, bug, refactor). Read it to look one fact up. The story of a run, and the choice of the command, are on Quality Pipelines.

Terms on this page

The Glossary defines orchestrator, sub-agent, brief, main loop, approver, design brief, grade, lens, checkpoint, executor, agent-run, DoD, ownership zone, run journal, worktree, flywheel, baseline gate and the stop signals. This page also uses two terms:

  • Verifier: the read-only review agent. One verifier invocation uses one lens.

  • Vault note: a note in the Knowledge Vault.

On this page: Feature · Gate tiers · Design split · Fix lane · Bugfix · Refactor · Lenses and verdicts · Test adversary · Escalations · Invariant. The entry points and the bug severities are on Quality Pipelines, Choosing the entry point.

The feature pipeline

ft-developer grades the task first. The grade decides the depth, never the approval gate. The feature stages are numbered 0 to 9. The bugfix stages have their own numbers (see The bugfix pipeline), so this page writes "feature Stage 5" and "bugfix Stage 5" where the two could be confused.

Grades and budgets

Grade Condition Run-cost budget

simple-addition

One stack. No new module, table, wire contract, protocol or security surface. About 50 lines in about 3 files. No migration, except one that changes one column’s type or nullability or adds one nullable column with no contract field, backfill or hot-table key.

6 agent-runs

TDD-led

Bug-shaped work, a single business rule, or a protocol message with a known spec. The failing test is the spec.

12 agent-runs

architecture-led

Everything else: a new module or endpoint, and any change to a contract, data model, protocol or security surface.

30 agent-runs

An agent-run is one dispatch of any sub-agent. When the budget runs out, the run escalates. It never lowers quality.

The ten stages

Stage Name What happens

0

Preflight

The orchestrator detects the repository and verifies the capabilities. It is the only place that installs anything, with consent per item. Sub-agents trust the resulting capabilities map.

1

Triage

The orchestrator grades the task and declares the run-cost budget. It also states whether the task is user-visible, by outcome and not by file type. It records a ## Human SDD — path block that says whether a human SDD is written. See The human SDD.

2

Elicitation

The orchestrator harvests facts first, then asks every blocking unknown. It records a safe default as an assumption. Design never starts with an open blocking question.

3

Design brief

Architecture-led work writes a design brief with at least two approaches, machine-checkable data, contract and protocol fragments, a test plan and a doc plan. The other grades write a 3–5 line mini-plan.

4

Checkpoint D

Architecture-led only. The verifier lenses attack the design brief. The hard cap is round 3. If every lens refutes round 1, the run makes a design split. See The lens roster. When the path is write, ft-sdd writes the human SDD after checkpoint D closes.

5

APPROVAL GATE

Always, every grade. The approver approves the verified design brief, or confirms the mini-plan. When the human SDD is checked, the same answer approves it too. An unchecked human SDD is never presented for approval. No production code is delegated before an explicit approval. A nested ft-developer never approves for the approver. It returns NEEDS_USER.

6

Delegated implementation

Coding agents implement the approved plan in units. Each brief has an ownership zone, a measurable DoD, bounds and a Size: line. A unit is about 400 lines or 10 files at most.

7

Baseline gate and checkpoint F

The test command runs once before any edit. The pass criterion is no new failure against that baseline. Then the simplicity pass, the test adversary and the diff lenses run. Checkpoint F ends after round 2. See Gate tiers and Fix lane.

8

Docs

ft-doc-writer-agent writes documentation when the repository has an Antora portal. Otherwise the stage is recorded as NO-OP or MANUAL. After the commit, one ft-sdd repair brief updates the human SDD against the committed code when the conditions in The human SDD hold.

9

Report

The report lists files, tests, verification rounds, run-cost, bounds, scope, convergence and refactor proposals. It also writes a decision note to the vault and appends to the flywheel when a checkpoint caught something.

Grade changes, plan invalidation and commits

  • The grade can fall once, on evidence. After the first SOUND checkpoint D, the grade can drop one step when every predicate holds. The downgrade never changes the verification of the code. Feature Stage 7 reads the grade at entry, so a run that entered as architecture-led keeps checkpoint F and the test adversary.

  • The window closes at feature Stage 6. After the first coding dispatch, no downgrade is available.

  • A coding agent can return PLAN_INVALIDATED. The approved design is contradicted by the repository, or a simple-addition run busts its budget. The orchestrator re-enters feature Stage 3 with the evidence. A material change re-runs the affected feature Stage 4 lenses and the feature Stage 5 gate.

  • TDD-led and simple-addition runs take the lightweight path. They skip the parallel verifier checkpoints and run /code-review on the diff. They still run the approval gate, the baseline gate and the test adversary.

  • The orchestrator commits after a green feature Stage 7. It never pushes and never opens a pull request.

Gate tiers

The feature pipeline runs the tests in three tiers, Stages 6 to 9. The rule applies to ft-developer only. The bugfix pipeline keeps its own Gate B. The canon is rules/agents/verification-routing.md section 8.

Tier What runs When Who runs it

U (unit)

The tests of the unit brief and the guard tests that grep finds for the touched packages, on the cheapest engine.

After the last edit of the unit. Split group instances run tier U only.

The coding leaf.

G (group)

The detected test command, scoped to the touched build units and their dependents (Maven -pl <touched> -amd; npm and Python: the test directories of the touched packages). The second engine runs only when the diff is engine-specific or touches authn, authz or secret handling.

Once on the frozen diff. Again on the final tree only when the checkpoint F fix batch edited production code, scoped to the units that it touched.

The orchestrator, on the pool.

P (pull request)

The full clean verify: every engine and every suite.

Once for each pull request tip.

PR CI when it is trusted. Otherwise the orchestrator, once, on the pool.

A repository with no build units has no scoped tier G. If PR CI owns tier P, tier G is the tier U set of every unit plus the guard tests. Otherwise tier G is the full detected command and it also settles tier P.

The trust rule

PR CI earns tier P credit only by a declaration in the committed profile, read at the merge-base of HEAD with the PR target branch, the default branch of the repository on origin, and not at the base commit (the tip of the branch can hold earlier agent commits that nobody reviewed):

pr-ci: <workflow> · <job> · covers full | <suite list>
  • The file .claude/bugfix-profile.local.md never declares pr-ci:.

  • The declaration is the attestation of the repository owner. The job runs on every pull request into the base branch, with no path filter, no if: and no continue-on-error, on every engine, as a required check. Nobody checks this except at the review of the declaration (residual R8).

  • The orchestrator decides the credit before the baseline run, at that merge-base, and cites the workflow and job step as file:line.

  • The credit is refused for the run when the diff against that merge-base touches .github/*, the profile, a build manifest, a file of the test selection or a repo script that a run: step of the job calls. The manifests are pom.xml, build.gradle, package.json and pyproject.toml. The test selection files are .mvn/maven.config, mvnw, settings.gradle*, gradle.properties, pytest.ini, setup.cfg, tox.ini, conftest.py, jest.config., karma.conf. and angular.json. Untracked files count. A pr-ci: line or a workflow change in the own commits of the branch is therefore refused. The credit is also refused when the declared workflow uses a remote ref that is not pinned to a SHA.

  • covers <suite list> credits those suites only. The tier P run of the pool covers the other suites.

  • A repository with no declaration runs tier P once on the pool, and PR CI runs its own suites again.

With credit, Stage 9 reports Tier P: owed to PR CI <workflow file:line, job step file:line>.

Baseline and reuse

  • The baseline run starts before any edit, in the background on the pool. With credit, it covers the planned unit scope of the design brief. At the freeze, only the units outside that scope run, as a delta. Without credit, it runs the full command from the start.

  • A CI or nightly run on the same base tree replaces the baseline run when Stage 9 cites its run id.

  • The pass criterion is unchanged: no new failures. The flaky rule is unchanged.

  • The orchestrator journals each result as proven: gate <U|G|P> · <command> · <decisive line> · tree <hash>. The hash is git rev-parse HEAD^{tree}, or git write-tree from a temporary index.

  • The orchestrator never runs a suite again on a tree where it ran green. One run settles every tier that its scope covers.

  • The orchestrator cannot stop PR CI. Tier P that is owed to CI is simply not run on the pool.

  • The red-green run of the checkpoint F executor is outside this rule.

  • The second engine runs at tier G for an engine-specific diff. Otherwise it runs at tier P.

Stage 9 reports four lines: Tier U: <n> units green, Tier G: <command> · <decisive line> · tree <hash>, Tier P: <owed to PR CI …​ | <command> · <decisive line>> and Baseline: <scope> · <outcome>.

Checkpoint D: round cap and design split

Checkpoint D ends at round 3. price-gate.py denies a checkpoint D review for round 4 or later (FT_DESIGN_CAP, default 3).

If every lens refutes round 1, the run makes a design split instead of a round 2. The split applies when no lens returns SOUND and every NEEDS_EVIDENCE re-run is settled. It does not apply when every blocking ID is text-only. The text-only rule wins there.

  1. The run writes <run>-split-plan.md with two to four groups.

  2. Each group has its scope in and out, its acceptance criteria, the shared contract fragment verbatim, its order, and its ledger.

  3. The ledger maps every blocking ID of round 1 to the group that owns it, or to a Stage 5 question.

  4. The approver approves the split at Stage 5.

  5. The run continues with group 1. The file <run>-sdd-g1.md is a new artifact. Its checkpoint D starts at round 1 (cpD g1 r1) with the full core and the routed lenses. Its briefs carry the group ledger.

One split is allowed for each run. The cap of 3 rounds holds for each artifact.

Stage 9 names every remaining group with its command. Each remaining group is a follow-up run:

/ft-dev group <plan> <group>

The follow-up run is its own lineage root with its own budget (see Dispatch Economy Reference, Lineage bounds). The split-seed intake works as follows:

  • The run is graded architecture-led.

  • The run seeds its design brief from the group section of the plan.

  • The run carries the group ledger into every checkpoint D brief.

  • Each ledger ID is closed or carried like any open objection.

  • The path block reads human SDD: none — design split. A split group never runs ft-sdd.

The human SDD

A run has two documents. The design brief is internal: it says how the code is built, and the verifier lenses attack it. The human SDD says what changes. ft-sdd writes it with Audience: overview, and the approver approves it. QA reads it and writes test cases from it. The run has one approval act: the approver’s single answer. When the approver says "SDD", the approver means the human SDD. The rules are in rules/agents/human-sdd.md, sections 1 to 5.

Moment What happens

Stage 1

The orchestrator writes a ## Human SDD — path block. The path is write when the task is architecture-led and a release tag is reachable from the starting branch. Otherwise the path is none — lighter grade or none — no release baseline. A design split writes none — design split.

After checkpoint D

On the path write, the top-level ft-developer sends one ft-sdd brief with Mode: write and State: design. A slice child, a split group and a merge instance never run ft-sdd. A revision of the design brief after the write sends one re-run on the same artifact.

Stage 5

The question always carries one Human SDD: line. The record is checked or unchecked: <field name>. When it is checked, the question shows the link, the status in plain words and the yes/no question lines. The answers come from the approver afterwards, and one answer approves both documents. When it is unchecked, the human SDD is not presented for approval.

After the commit

Four conditions must hold: the path is write, the run never split, the commit is sound, and the approval reader yields <url> · doc.md <40-hex>. That reader result means a checked human SDD that the approver’s answer approved. Then one ft-sdd brief with Mode: repair and State: delivered rewrites the artifact against the committed code. If the approver answered "proceed on the internal design brief" on an unchecked document, no repair runs, and Stage 9 reads unchecked at approval.

An unchecked record names the first failing field. The approver then decides to proceed on the internal design brief, with the human SDD reported as unapproved, or to stop. Stopping writes no code and returns STOPPED — human SDD unchecked: <field name>.

The delivered document can differ from the text that the approver approved. The Stage 9 report says so, and the run never re-labels the document as approved. An owner answer never changes the document in this run, whatever the question. An answer that changes a design statement revises the design brief and re-runs the human SDD update before approval. The Stage 9 slot answers <n> not in the document counts every answer. An answer reaches the document only through a later repair by the launcher.

If an update does not publish, the earlier version stays at the URL. A person reads the update was not published; the earlier version at <url> is stale in the design phase. After the commit, the Stage 9 line reads earlier version at <url> stale. An update that publishes a Draft is not stale: the URL shows that Draft, and the human SDD reads as unchecked.

Checkpoint D hygiene

  • A reversed decision invalidates its test cells. The author rewrites every cell and every prose line that still encodes the old decision in the same pass.

  • A fix that cannot be observed is not a fix. A guard, a filter or a branch needs evidence that production reaches the guarded path.

Checkpoint F: round cap and fix lane

Checkpoint F ends at round 2. price-gate.py denies a verifier* or ft-architecture-audit dispatch for checkpoint F round 3 or later (FT_REVIEW_CAP, default 2). The test adversary and every other caller pass. Two re-checks are the exceptions: the trivial re-check (see Trivial fix) and the delta re-check (see Delta fix).

  • Round 1 is the whole set of the route, including the full core.

  • Round 2 is the re-check of the one fix batch.

  • A NEEDS_EVIDENCE re-run keeps the number of its round (cpF r2 NE <lens>).

  • The orchestrator saves each lens report verbatim as <run>-cpF-r<n>-<lens slug>.md. The slug is lowercase, with non-alphanumeric characters replaced by -. The delta check of price-gate.py reads these files.

After the verdicts of round 2 are in the ledger:

  • Every outstanding NEEDS_HUMAN goes to the human, never to a lane. The ID also goes into the trailer Open-Human: <IDs>. The answer becomes a dossier entry that the originating lens closes in the lane.

  • Every open blocking ID and every outstanding NEEDS_EVIDENCE goes to one fix lane.

  • Open note IDs are residual notes in the report.

If the conditions of Trivial fix hold, the trivial fix replaces the steps below. If not, and the conditions of Delta fix hold, the delta fix replaces them. If neither holds, the run does four things:

  1. It completes Stage 8.

  2. It writes <run>-fix-dossier.md.

  3. It commits locally with the trailer Open-Blocking: <IDs> · <dossier path>, and Open-Human: <IDs> when it applies. It opens no pull request.

  4. It returns FIX_LANE — <dossier path>, with the NEEDS_HUMAN questions when there are any.

The dossier has this content:

  • The header Severity: MAJOR. The severity is CRITICAL when an open ID is a Security blocking objection.

  • The lane budget Budget <16 + k + 4>, a pre-authorized raise. Here k is the number of originating-lens re-checks, and 4 is one repair round.

  • The proven: gate lines of the run, with their tree hashes, so that Gate B can reuse them.

  • For each ID: the originating lens, file:line, the OBJECTIONS and WHY lines quoted verbatim from the saved report, the cell F-<ID> that fails while the objection holds, and what the run tried.

The lane is always:

/ft-fix dossier <path>
  • ft-fix runs normally. bugfix-agent reproduces each F-<ID> cell red and diagnoses from the dossier. No stage is skipped.

  • A dossier entry tagged NEEDS_HUMAN stops the intake with NEEDS_USER.

  • Checkpoint 2 runs its own roster plus one re-check for each dossier ID. The originating lens of the ID runs that re-check, so the lens that opened the ID closes it. The pinned rosters do not change.

  • A lane that returns SCOPE_IS_FEATURE goes to the human, never to a new ft-developer.

  • The cap never drops a core lens. Round 1 runs the full core.

Checkpoint F: delta fix

The delta fix is one bounded repair and one re-check. It is the first exception to FIX_LANE after round 2. The run considers it after the trivial fix. It applies once for each lineage root.

It applies only when all of these hold:

  • Every open blocking ID was opened by ONE checkpoint F lens. That lens is not Security, and no ID was ever a Security ID. The round 2 OBJECTIONS line of that lens lists each open blocking ID separately. A range such as R5-7 reads as one ID and fails.

  • No NEEDS_EVIDENCE and no NEEDS_HUMAN is outstanding.

  • Every fix lies in test paths, and the batch is predicted at 30 changed lines or fewer. A test path has a test or tests directory in it, a test_ file name prefix, or a .spec. or .test. file name, and it is never under src/main.

  • Every ID still open under addressed: in the round 2 report of that lens, notes included, is listed in the brief’s fix IDs. If one is missing, the hook denies the delta fix.

  • No port-lane profile is in force and no trivial fix has run on this journal. While the profile is in force, the delta fix is excluded. A port-lane case such as an ft-acs-qa run with the profile accepted stays on FIX_LANE, unless the trivial fix applies.

The run does these steps:

  1. It completes Stage 8 first, as the FIX_LANE path does. If the budget denies Stage 8, the brief’s Raise: line does not lift it, because that line is the TIER_RAISE tier line. Only the launcher lifts the budget, with Run-cost raise: <new total> · by <who>. The orchestrator stops and asks (NEEDS_USER when nested, AskUserQuestion in the main loop).

  2. After Stage 8 has returned it records r2-tree: <sha> in the run journal, once, from python3 ~/.claude/hooks/price-gate.py --r2-tree <worktree>: the tree of the delivered work. The re-check compares that tree with the round 2 pair, so a tree that moved is refuted.

  3. It dispatches ONE fresh repair, described <unit> repair delta-fix, to a direct leaf coding agent. A Mode: slice child is refused by the hook. The brief has one Size: line (files <n> · lines ~<n>, n at most 30), one Delta-fix: <IDs> · lens <lens name> line, and one writes: line with test paths only. A second repair and a SendMessage continuation are not allowed.

  4. It runs python3 ~/.claude/hooks/price-gate.py --delta-paths <worktree> <r2-tree> and unit-check.py. The <r2-tree> is the journaled r2-tree: line, and the check compares the tree of the worktree against that tree. The command exits 0 only when at least one path changed and all changed paths are test paths. A dirty submodule or an untracked nested repo fails it. Ignored files count only under src/main. A non-zero exit or more than 30 changed lines voids the delta, and the run takes FIX_LANE.

  5. It writes the round 3 pair of the run journal. It then dispatches ONE re-check by the originating lens on a verifier, described cpF r3 delta-fix <lens> re-check. The brief’s Base: equals the journaled r2-tree:. No other lens runs again.

  6. If the re-check is SOUND, the IDs close and the run commits without Open-Blocking:. Any other verdict takes FIX_LANE. There is no second delta fix and no round 4.

price-gate.py adds 2 agent-runs to the budget when it grants the delta fix. It reads the saved lens reports for the check. If any check fails or errors, it denies the delta fix, and the run takes FIX_LANE. A false round label buys at most 2 runs and one more independent look. The +2 is root-wide and the lock-out is kept for each journal, so a sibling’s dispatch can take the spare slot before the re-check. That is bounded to one run.

Checkpoint F: trivial fix

The trivial fix is the second exception to FIX_LANE. It is one mechanical repair of a citation or a misspelt word, and one re-check. The run considers it first, before the delta fix. It applies once for each journal.

It applies only when all of these hold:

  • Every open blocking ID was opened by ONE checkpoint F lens. That lens is not Security, no ID was ever a Security ID, and no ID is an adversary finding.

  • The governing report of that lens is REFUTED and lists each ID separately. That report is -cpF-r2-<lens slug>. Under an accepted port-lane profile, it is the post-fix report <run>-cpF-r1-postfix-<lens slug>.md.

  • Every other lens has a governing report that is SOUND. Under the profile, these are the post-fix reports, and the pre-fix round 1 reports are superseded. No Security report names an ID.

  • No NEEDS_EVIDENCE and no NEEDS_HUMAN is outstanding.

  • For each ID, the report gives the file:line, the stale text and the correct text.

  • Each fix is one of two kinds. A citation correction changes only the line-number tail of a token that reads as a citation before and after: <name>:<n>, :<n>, a range :<n>-<n>, or #L<n>. It lies in a .md, .adoc, .txt, .tsv or .csv file. A misspelt word has ASCII letters, at most 2 changed, in a .md, .adoc or .txt file.

  • The fix is never in src/main, never in a build or dependency file, never in a value that a test or the product reads as data (a key, an id, an expected value, a flag), and never in a code file, comments included.

  • The batch is at most 5 changed lines and 16 changed characters.

  • No delta fix and no trivial fix has run on this journal.

  • The budget has one agent-run left for the leaf. The re-check is never denied by the budget.

The run does these steps:

  1. It completes Stage 8 first, as the FIX_LANE path does. It then records tf-tree: <sha> in the run journal, from python3 ~/.claude/hooks/price-gate.py --r2-tree <worktree>.

  2. It dispatches ONE leaf coding agent, described <unit> repair trivial-fix. The orchestrator never edits, and a Mode: slice child is refused. The model is never above sonnet with effort medium. The brief has a Pick: line, a Raise: line, one Size: line (files <n> · lines ~<n>, n at most 5), one Trivial-fix: <IDs> · lens <lens name> line, and one writes: line that names only the cited files. For each ID, the brief quotes the file:line, the stale text and the correct text. Notes stay residual notes. A leaf that a TRIVIAL_DENY text or the budget denies takes FIX_LANE, with no resend and no raise. An unpaid brief refusal that the hook says to send again (a Pick: line, the profile step) is fixed and sent again once.

  3. It runs python3 ~/.claude/hooks/price-gate.py --trivial-check <worktree> <tf-tree>. The command exits 0 only when the edit is mechanically trivial. Then it runs the narrowest check that reads a touched file, ONCE. The check passes when it is green. It also passes when it is a recorded base red whose failure and problem counts have not grown, and no problem line names a touched path. A .tsv, .csv or .txt file with no such check is not trivial. A .md or .adoc file may journal check: none reads <path>. Exit 1 or 2, or a failed check, takes FIX_LANE.

  4. It writes the tf pair of the run journal (<run>-cpF-tf-files.sha and its deleted-paths twin). It then dispatches ONE re-check by the originating lens on a read-only verifier, described cpF r3 trivial-fix <lens> re-check. The brief has Base: <tf-tree>, the tree and hunk: lines of the CLI, the check and its decisive line, and one closure line for each ID. The orchestrator saves the report verbatim as <run>-cpF-tf-<lens slug>.md.

  5. If the re-check is SOUND, the IDs close and the run commits without Open-Blocking:. Any other verdict takes FIX_LANE. There is no second trivial fix and no delta fix after it.

  6. No SendMessage from the run follows the leaf, to any recipient, while the trivial entry of the journal is kept.

Besides the conditions of the delta re-check in tiering.md section 2 that still apply, the re-check lens is REFUTED when its own run of --trivial-check <worktree> <Base:> does not exit 0, or when --r2-tree <worktree> differs from the printed tree. It is also REFUTED when a path is outside the writes: set, when a fixed text is read as data, or when a corrected word is not exactly the correct text of the finding.

price-gate.py enforces the lens, report and lock-out conditions, the budget condition, the shape and the ceiling of the leaf, and the lock-out. The lock-out covers SendMessage too, and an unreadable state allows. It keeps the state trivial in lineage.json. The --trivial-check command and the re-check own the content. A residual remains: "not read as data" and "the correct word" rest on the re-check lens.

Release rings (preview)

The schema is in verification-routing.md section 9. Only the preview ring is active. Claude Code only: Codex installs no ring hook, so no ring runs there.

When the ring is active. All of these conditions must hold. Otherwise the Stage 9 line is Rings: none declared. A ring is never inferred.

  • The origin of the repository is an entry of the allowlist in git-safety-check.sh.

  • The committed profile at the merge base declares preview: workflow <path> · image <registry>/<repo>.

  • The tree at the merge base holds <path>.

  • The file .local.md never declares a ring.

The hook rules are in Preview push of the git safety hook.

Who pushes. Only ft-ops pushes. ft-developer never pushes, except for the one bootstrap probe that you approve at Stage 5.

Names. The slug is the name of the run journal. A split group is <name>-<group>. The ref is refs/heads/preview/<slug>. The only tag form is preview-<slug>.

When a preview is pushed.

  • A preview is pushed after the tier U of a unit is green, unless the snapshot tree equals the last tree sent.

  • A run pushes at most 5 previews. The final snapshot is always pushed before Stage 9. The cap drops intermediate snapshots only.

  • One push runs at a time. The newest snapshot is pushed at once, and cancel-in-progress drops the superseded build.

  • A transient base-tip failure retries once at the next snapshot.

What the preview contains. The preview is the base tip plus the run versions of the delivered files. It is not the exact tested tree. A base edit to a delivered file inside the window is absent from the preview. The journal and the hand-back declare this difference: the preview: journal line and the Rings: line both carry tree: <base tip sha> + delivered files.

Where the ring ends. The ring ends at <image>@<digest> in the registry. No demo deploy runs. The build logs preview-digest: <image>:preview-<slug>@sha256:<hex>. Each push builds from a workflow on the preview/** branches. The ft-acs-qa-console workflow preview.yml pushes to hub.friendly-tech.com/qa/ft-acs-qa-console and runs no tests. The oneiot_backend workflow build-preview.yml pushes to the production Harbor project ftacs/ftacs.

The preview: journal line of each push is preview: <n> · <sha> · after <unit> · tree: <base tip sha> + delivered files · <image>:preview-<slug>@<digest> · <minutes push to digest>. The Stage 9 line is Rings: preview <n> sent · tree: <base tip sha> + delivered files · <m> failed: <why> · held: <step> · last <image>@<digest> · <minutes>. The final push is not awaited, so the line reads final <sha> pushed · digest pending: <run URL>. A pre-check refusal at the held step gives Rings: held: <step>. A refusal at the form, slug, target, config or base-tip step gives Rings: failed: <step>.

Not adopted. The keys beta-flag:, rc-suites: and preview-units: have no effect, and bugfix pipeline previews do not exist. The key pr-ci: is the other active key. See Gate tiers, trust rule.

Cleanup. Refs, tags and untagged manifests accumulate. Stage 9 names them on the recovery: line. The coordinator deletes them. The owner collects registry garbage.

Residuals of the tiers and lanes

  • R1: A branch that is never opened as a pull request never gets its full run. Stage 9 says so on its own line.

  • R3: A diff that edits the CI or the profile pays tier P on the pool and again in PR CI. This exception is declared.

  • R7: A repository with no pr-ci: declaration pays tier P twice. The pull request jobs of ftacs, oneiot_backend and ft-bs-client fail the attestation today. ft-acs-qa and ft-acs-qa-console become eligible when they declare.

  • R8: The attestation in pr-ci: is the word of the repository owner. Only the review of the declaration checks it.

The bugfix pipeline

ft-fix is a thin orchestrator over bugfix-agent. The agent owns the fix methodology. The verifier agent owns the review methodology. The skill adds a capability preflight and independent, fresh-context review at two checkpoints.

The bugfix stages include 3.5 and 4.5, which the feature pipeline does not have. Bugfix Stage 5 is the report.

The bugfix stages

Stage Name What happens

0

Preflight

The orchestrator verifies the capability manifest and creates the run journal.

1

Analysis

bugfix-agent runs Phases 0–3 and writes no code. It returns the root cause with file:line, the severity, the classification, the fix plan, the siblings and a lens ledger.

2

Checkpoint 1

The verifier lenses attack the fix plan. The mandatory core always runs.

3

Implementation

Gate A runs first: the repro test fails before the first production edit. Then the TDD fix, the siblings sweep, the permanent guard and Gate B.

3.5

Test adversary

ft-test-adversary attacks the delivered tests. The loop converges before checkpoint 2.

4

Checkpoint 2

The verifier lenses attack the diff. The Correctness lens is the executor and re-runs the tests in a worktree.

4.5

Docs

Only when the fix changes documented or observable behavior.

5

Report

The report adds the verification rounds, the run-cost, the bounds, the scope and the routing lines.

Reproduce first, then root cause

  • Gate A. No production code before a failing repro test. The escape hatch for a non-deterministic bug is a statistical repro or instrumented observation. In performance mode a before-measurement replaces the test.

  • No fix without a root cause. Phases 1 and 2 complete before any fix code. Phase 2 is a self-verification of N cycles on fresh evidence. It stops at 2 cycles without progress or at 5 cycles.

  • Gate B. The full test command runs once before the patch. The pass criterion is no new failure against that baseline. The regression test and the guard each need a proven red and green.

  • The siblings sweep. bugfix-agent finds the bug-class pattern across the source tree. It confirms every hit. Each confirmed sibling ships with its own test, proven red before the fix. It excludes provably safe hits and lists them.

  • The permanent guard. A test invariant, a boundary validation or a structural barrier closes the bug class. A guard never shown failing is not a guard.

Outcome classes

Class Meaning Code change

CONFIRMED

A real defect that fits the bugfix scope.

Yes

PARTIALLY_CONFIRMED

Only part of the claim is real. The agent fixes the confirmed part.

Yes

FALSE_POSITIVE

Another caller compensates, or it is already fixed.

No

WONT_FIX

The behavior is intentional and correct.

No

CANNOT_REPRODUCE

Gate A did not pass by test, statistics or observation. The report lists what was tried and what is needed.

No

EXTERNAL_GAP

The root cause is in an external library or service. The agent adds a minimal safe workaround or a missing-data marker. It writes the correct fix as logic for the owner.

Workaround only

LOCAL_BETTER

Parity mode. The local code is equivalent and better.

No

INTENTIONAL_DIVERGENCE

Parity mode. The behavior differs on purpose. It needs an entry in the documented-differences registry.

Registry entry

SCOPE_IS_FEATURE

The root cause is real, but the fix is feature-sized. See Escalations.

No, handed off

A ticket that ends without a fix gets a ready-to-paste comment in the report. BLOCKED is a further state for a permission problem or a dead end that needs a human.

Run-cost budgets

ft-fix declares 8 agent-runs for MINOR, 20 for MAJOR and 34 for CRITICAL. A standalone bugfix-agent declares 4, 10 and 16. The orchestrator budget overrides the standalone one.

The refactor pipeline

refactor-agent is its own orchestrator. It puts a safety net before the first edit.

  1. Safety net. The agent checks that the tests pin the observable behavior. It writes characterization tests for the gaps. They must be green on the unchanged code.

  2. Perturbation proof. The agent makes a throwaway behavior change and shows that a net test goes red. A net that cannot fail on a behavior change is not a safety net. A scoped mutation run is the stronger form.

  3. Smell inventory. Each smell has file:line and a breached threshold from rules/code-quality/design-principles.md.

  4. Classification. PROCEED, PARTIAL, NOT_WORTH_IT, BEHAVIOR_CHANGE_REQUIRED, BLOCKED_NO_SAFETY_NET or BLOCKED.

  5. Small verified steps, then a consistency sweep over the same smell elsewhere.

  6. Verification gate. The baseline is preserved, the net is green, the public contracts are unchanged, and coverage and performance hold.

If behavior cannot be pinned by any test or observation, the agent does not refactor blind. It reports BLOCKED_NO_SAFETY_NET. A needed behavior change is a handoff, not part of the refactor.

The lens roster

The verifier agent attacks one lens per invocation. Its mission is to refute the artifact. An artifact that survives a genuine attempt gets SOUND. The roster and triggers are in rules/agents/verification-routing.md. The deterministic preflight diff-router.py plan --checkpoint <name> selects the lens set, and every brief cites its Route: route:<hash>. The script is ~/.claude/hooks/diff-router.py, and its source is in deploy/templates/hooks/.

The mandatory core

The core is dispatched on the first pass over an artifact. No grade, severity, ledger or flag removes it.

Checkpoint Artifact Mandatory core

ft-fix checkpoint 1

The fix plan

Correctness, Security, API-contract

ft-fix checkpoint 2

The diff

Correctness (the executor), Security, API-contract

ft-developer checkpoint D

The design brief

Requirements-coverage, Security, API-contract

ft-developer checkpoint F

The diff

Correctness, Security, API-contract, and the executor lens Test-plan adequacy

Two lenses join the core by outcome. Visual/UX joins whenever the outcome is user-visible. The executor lens is core at every diff checkpoint, because nothing else re-runs the tests.

The port-lane profile

The port-lane profile is the one named, scoped exception to the mandatory core. The owner accepted this lighter review for ft-acs-qa port lanes only. It is not a general relaxation. The owner measured 12 port lanes in 24 hours. Only Correctness and the first adversary pass ever changed a test.

The profile applies only when every condition in this table holds.

Condition Who observes it

The launcher line Profile: port-lane is recorded on the lineage root

price-gate.py

The origin is ft-acs-qa on github.com, and the branch starts with port/

diff-router.py, from git

The entry grade is simple-addition, with no later grade increase, and the lane is not user-visible

The orchestrator states it. The router checks it against the journal.

The checkpoint is ft-developer checkpoint F, round 1

The orchestrator states it.

The observation of the change is not degraded

diff-router.py

If any condition fails, the router refuses the profile with exit code 4 and routes the checkpoint as before.

With the profile, checkpoint F spawns these reviews in one message:

  • Correctness.

  • Security, only when the diff adds a secret read, or when a security-class rule fires.

  • The first ft-test-adversary pass.

API-contract, Test-plan adequacy, every routed lens and Visual/UX are not spawned.

After the review, the lane runs one fix batch. Each fix has a red-first proof. Then diff-router.py plan --post-fix names the first-pass lenses for what the batch added: a new secret-read or security-class line, a removed security-class line, a round-1 security citation that the batch removed, a new, renamed or deleted file, or an edit of a security-path file. There is no round 2. The run-cost budget is 12 agent-runs instead of 6.

The owner accepted two residuals:

  • Lines that the fix batch changes inside an already-reviewed file, without a new citation, get no independent re-read. The red-first proof and the gate are the only guard.

  • The Security trigger does not cover the egress of a secret that the lane already reads.

The profile cannot enforce two things. It cannot compel an orchestrator that skips the router. It cannot detect an --emit file that someone edited and hashed again. A host without price-gate.py never accepts the profile, so it runs the full core. See Agent Harness Reference, The port-lane profile.

Routed lenses

A routed lens is dispatched when its trigger fires, when earlier evidence is unresolved, or when no earlier verdict exists on this artifact. On the first pass over a new artifact the last condition fires for every routed lens. The core is a floor, not the plan.

Lens Fires when the artifact

Performance

Adds or moves a query, a remote or database call inside a loop, a cache, a serialization surface, a render path, an index or a batch size. Also on the performance route.

Regression/caller-impact

Changes a signature, a return or exception contract, a shared constant or a config default. Also when it touches a symbol with more than one caller or edits an existing test.

Clarity/readability

Adds a file or an abstraction, or changes more than about 150 lines or 5 files.

Reference-parity

Parity mode only, and the change touches a ported surface.

Architecture/FT-standard conformance

Adds or moves a module, package, layer boundary or DI wiring, or adds a new production file on a stack with an FT standard.

Requirements-coverage (checkpoint F)

The diff is not a subset of the design brief surface, or an acceptance criterion changed since checkpoint D.

Test-plan adequacy (checkpoint D)

The plan declares a new test level or class, or an EXEMPT lens rests on a test existing.

Mechanical lenses run on Sonnet: API-contract, Architecture, Clarity, Reference-parity and Test-plan adequacy. Judgment lenses run on Opus: Correctness, Security, Regression, Performance, Requirements-coverage and Visual/UX. The tier changes the price of a dispatch. It never changes the roster.

Verdicts

Verdict Meaning What the orchestrator does

SOUND

The lens tried to refute the artifact and failed. It cites the evidence that resisted.

The lens is not re-run unless the fix touches its area.

REFUTED

A concrete flaw, with what the artifact missed. The lens lists every objection in one pass.

It waits for the whole round. Then it makes ONE fix over every open ID, and re-runs only the lenses the no-repeat rule names.

NEEDS_EVIDENCE

An artifact is missing: a journal excerpt, a repro command, a baseline output.

It supplies the artifact and re-runs that lens once. This does not count as a round.

NEEDS_HUMAN

A question only a human can answer: intent, a business decision, runtime data.

At checkpoint D it folds the question into the approval gate. Elsewhere it escalates to the approver.

Every objection has an ID in a ledger and a tag, blocking or note. A note never refutes. A reworded objection is not progress.

Rounds and repetition

  • Round caps. Stop and escalate after 2 consecutive rounds without progress, or at 5 rounds per checkpoint loop. A round makes progress only when new evidence or a design change closes an objection. The feature pipeline has two stricter caps: checkpoint D ends at round 3, and checkpoint F ends at round 2. One trivial fix (see Trivial fix) or one delta fix (see Delta fix) can follow round 2. The bugfix checkpoints and the adversary loop keep 5 rounds.

  • The no-repeat rule. A lens re-runs only when it has an open objection, when the fix edited a file in its area, or when its missing artifact now exists. A material revision re-runs every non-EXEMPT lens.

  • Sequencing. No diff lens starts before the diff is frozen. Parallelism is inside a round, and sequencing is between rounds. The adversary loop and the lens batch never run at the same time on the same slice.

  • Evidence packs. The orchestrator assembles ONE pack per checkpoint. A re-run brief carries only the delta.

  • Routing is reported. The report names every lens that did not run, with the predicate that did not fire and the evidence it rests on. A lens routed away without a citable verdict counts as open.

The executor and worktrees

Exactly one lens re-runs the tests. It works in a dedicated git worktree (isolation: worktree) and performs the red-green check: revert the fix, see the test fail, restore the fix, see it pass. This lens is the executor, and it differs by pipeline. The Visual/UX lens is the only other lens that executes. It drives the running app in a browser, needs no worktree and runs no tests. All other lenses are read-only.

Pipeline Executor (re-runs the tests)

ft-fix checkpoint 2

Correctness

ft-developer checkpoint F

Test-plan adequacy

On Codex a spawned role runs with its parent’s sandbox. The installed readonly-role-guard hook, once you trust it, denies a read-only role apply_patch, shell-routed apply_patch, spawning or messaging other agents, and every mcp__ tool outside the role’s tools: list. The role [features] table removes the tools of apps, plugins, memories and permission requests, with no trust needed. The shell of the verifier writes nothing by instruction only, as Bash does on Claude Code. A shell write inside a writable root of the parent (the workspace, /tmp, $TMPDIR, writable_roots) is not stopped. The OS sandbox of the parent stops a write elsewhere only on read-only or workspace-write. It does not stop a write under danger-full-access, after an approved require_escalated, or for a command that matches an exec-policy allow rule in any loaded config folder. The Linux sandbox was not read. The full table is in Codex.

On Codex the verifier can be the executor only in a worktree that the parent creates inside its own writable roots. The child cannot write the top-level .git or the gitdir of the worktree, so it cannot run git worktree add. It reverts the fix with git apply -R or a file copy, and never with git checkout, git stash or git add. Where a runtime gives no worktree or test run, the orchestrator pays the red-green itself, and the report declares the degradation.

The test adversary

ft-test-adversary is shared by both pipelines. ft-developer runs it before checkpoint F. ft-fix runs it as Stage 3.5. A standalone bugfix-agent runs it at Gate B. The author reports green, and the adversary tries to prove the tests are insufficient. It is read-only and executes nothing.

Check What it attacks

1 Honest RED

Every new test must fail without the fix. The adversary audits the proof. It names a test that is vacuous by construction, and it asks for the missing red evidence.

2 Negative and observability

Tests that assert only a terminal state. It requires an assertion on the real side effect, or on an operation that must NOT happen.

3 Regression guard

A refresh or idempotent path without a test that repeats the operation.

4 Seam composition

Two sides of a boundary tested alone and never composed.

5 Challenged assumption

The assumption the fix encodes. A test must fail if the assumption is wrong.

6 Emulator leniency

An assertion that passes only because the emulator is softer than real hardware.

7 Skip gate

Tests that did not run, such as Tests run: 0 under the default build-skip-tests profile.

The output is a ranked list of missing or weak tests, each as a precise brief for the fix author. A suite that is adequate gets a clean verdict.

  • It runs nothing. What it cannot settle statically becomes a named probe for the executor lens.

  • Loop cap. Stop after 2 consecutive rounds without a new accepted finding, or at 5 rounds. The first pass is mandatory. On exhaustion the report names each attack still standing.

  • Difference from the verifier. The Test-plan adequacy lens only maps each plan item to a test and checks diff coverage. It does not run the seven attacks. A plan item with no test is REFUTED. A shallow test is an adversary finding.

Escalations

Signal What happens

SCOPE_IS_FEATURE

The root cause is real, but the fix needs a new module or table, a contract or protocol change, a cross-cutting redesign or a new security surface. The bugfix pipeline stops. bugfix-agent hands a diagnosis dossier to ft-developer: the repro test, the root cause with file:line, the evidence digest, the affected surface and the assumptions. ft-developer grades it architecture-led, seeds design brief section 0 from the dossier and uses the repro test as the RED test. It does not re-diagnose.

PLAN_INVALIDATED

The approved plan or the confirmed root cause is contradicted by the repository. The pipeline returns to the design or to checkpoint 1 with the evidence.

SCOPE_BREACH

A sub-agent needs a file outside its declared writes: set. It stops and reports the file and the reason. The orchestrator re-scopes.

NEEDS_USER and BLOCKED

A nested agent cannot ask the user. It returns the question to its parent, which relays it.

CLIMB: opus

ft-fix-host runs on Sonnet when its brief says TIER_AB: sonnet. If a ruling is beyond it, it ends with CLIMB: opus — <the ruling> and the journal path. The caller relaunches it with Climb: opus.

FIX_LANE

A feature run ends checkpoint F at round 2 with open blocking objections, and neither a trivial fix nor a delta fix repairs them. It returns FIX_LANE — <dossier path>. See Fix lane.

CONTEXT_RESET

A long orchestrator sheds its context at a sanctioned boundary and a fresh instance resumes from the journal. See Agent Harness and Dispatch Economy.

Every stop writes a ## HANDOFF block to the run journal: the state, what is proven, what is open, a resume: command and a recovery: list.

The invariant

Economy may never remove the last independent reviewer.
  • The mandatory core of verification-routing.md section 1 is emitted unconditionally, except under the port-lane profile (see The port-lane profile). The profile keeps Correctness, and it never removes the last independent reviewer.

  • --drop-lens on a core lens exits with code 2.

  • No route rule may deny the dispatch of a core lens.

  • A trivial bug narrows checkpoint 1 to the three core lenses. A bug is trivial when it has one file, one caller, severity MINOR, risk LOW, a fix of 20 lines or fewer, and no parity, security, API-contract or data-loss dimension. It never narrows it to zero.

  • The reviewer never wrote the artifact. A self-check, such as the Phase 2 lens ledger of bugfix-agent, can shrink the routed set. It never replaces the core.

  • If the verifier is unavailable, the orchestrator runs the lenses itself and the report says "self-check only — no independent review".

To edit the verifier or the test adversary, see Contributing.