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 |
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 |
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 |
6 |
Delegated implementation |
Coding agents implement the approved plan in units. Each brief has an ownership zone, a measurable DoD, bounds and a |
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 |
|
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-reviewon 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 |
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 |
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.mdnever declarespr-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 nocontinue-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 arun:step of the job calls. The manifests arepom.xml,build.gradle,package.jsonandpyproject.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.andangular.json. Untracked files count. Apr-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 isgit rev-parse HEAD^{tree}, orgit write-treefrom 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.
-
The run writes
<run>-split-plan.mdwith two to four groups. -
Each group has its scope in and out, its acceptance criteria, the shared contract fragment verbatim, its order, and its ledger.
-
The ledger maps every blocking ID of round 1 to the group that owns it, or to a Stage 5 question.
-
The approver approves the split at Stage 5.
-
The run continues with group 1. The file
<run>-sdd-g1.mdis 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 runsft-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 |
After checkpoint D |
On the path |
Stage 5 |
The question always carries one |
After the commit |
Four conditions must hold: the path is |
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_EVIDENCEre-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 ofprice-gate.pyreads these files.
After the verdicts of round 2 are in the ledger:
-
Every outstanding
NEEDS_HUMANgoes to the human, never to a lane. The ID also goes into the trailerOpen-Human: <IDs>. The answer becomes a dossier entry that the originating lens closes in the lane. -
Every open
blockingID and every outstandingNEEDS_EVIDENCEgoes to one fix lane. -
Open
noteIDs 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:
-
It completes Stage 8.
-
It writes
<run>-fix-dossier.md. -
It commits locally with the trailer
Open-Blocking: <IDs> · <dossier path>, andOpen-Human: <IDs>when it applies. It opens no pull request. -
It returns
FIX_LANE — <dossier path>, with theNEEDS_HUMANquestions when there are any.
The dossier has this content:
-
The header
Severity: MAJOR. The severity isCRITICALwhen 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: gatelines 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 cellF-<ID>that fails while the objection holds, and what the run tried.
The lane is always:
/ft-fix dossier <path>
-
ft-fixruns normally.bugfix-agentreproduces eachF-<ID>cell red and diagnoses from the dossier. No stage is skipped. -
A dossier entry tagged
NEEDS_HUMANstops the intake withNEEDS_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_FEATUREgoes to the human, never to a newft-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
blockingID was opened by ONE checkpoint F lens. That lens is not Security, and no ID was ever a Security ID. The round 2OBJECTIONSline of that lens lists each open blocking ID separately. A range such asR5-7reads as one ID and fails. -
No
NEEDS_EVIDENCEand noNEEDS_HUMANis outstanding. -
Every fix lies in test paths, and the batch is predicted at 30 changed lines or fewer. A test path has a
testortestsdirectory in it, atest_file name prefix, or a.spec.or.test.file name, and it is never undersrc/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-qarun with the profile accepted stays onFIX_LANE, unless the trivial fix applies.
The run does these steps:
-
It completes Stage 8 first, as the
FIX_LANEpath does. If the budget denies Stage 8, the brief’sRaise:line does not lift it, because that line is theTIER_RAISEtier line. Only the launcher lifts the budget, withRun-cost raise: <new total> · by <who>. The orchestrator stops and asks (NEEDS_USERwhen nested,AskUserQuestionin the main loop). -
After Stage 8 has returned it records
r2-tree: <sha>in the run journal, once, frompython3 ~/.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. -
It dispatches ONE fresh repair, described
<unit> repair delta-fix, to a direct leaf coding agent. AMode: slicechild is refused by the hook. The brief has oneSize:line (files <n> · lines ~<n>, n at most 30), oneDelta-fix: <IDs> · lens <lens name>line, and onewrites:line with test paths only. A second repair and aSendMessagecontinuation are not allowed. -
It runs
python3 ~/.claude/hooks/price-gate.py --delta-paths <worktree> <r2-tree>andunit-check.py. The<r2-tree>is the journaledr2-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 undersrc/main. A non-zero exit or more than 30 changed lines voids the delta, and the run takesFIX_LANE. -
It writes the round 3 pair of the run journal. It then dispatches ONE re-check by the originating lens on a
verifier, describedcpF r3 delta-fix <lens> re-check. The brief’sBase:equals the journaledr2-tree:. No other lens runs again. -
If the re-check is
SOUND, the IDs close and the run commits withoutOpen-Blocking:. Any other verdict takesFIX_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
blockingID 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
REFUTEDand 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_EVIDENCEand noNEEDS_HUMANis 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,.tsvor.csvfile. A misspelt word has ASCII letters, at most 2 changed, in a.md,.adocor.txtfile. -
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:
-
It completes Stage 8 first, as the
FIX_LANEpath does. It then recordstf-tree: <sha>in the run journal, frompython3 ~/.claude/hooks/price-gate.py --r2-tree <worktree>. -
It dispatches ONE leaf coding agent, described
<unit> repair trivial-fix. The orchestrator never edits, and aMode: slicechild is refused. The model is never abovesonnetwith effortmedium. The brief has aPick:line, aRaise:line, oneSize:line (files <n> · lines ~<n>, n at most 5), oneTrivial-fix: <IDs> · lens <lens name>line, and onewrites:line that names only the cited files. For each ID, the brief quotes thefile:line, the stale text and the correct text. Notes stay residual notes. A leaf that aTRIVIAL_DENYtext or the budget denies takesFIX_LANE, with no resend and no raise. An unpaid brief refusal that the hook says to send again (aPick:line, the profile step) is fixed and sent again once. -
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,.csvor.txtfile with no such check is not trivial. A.mdor.adocfile may journalcheck: none reads <path>. Exit 1 or 2, or a failed check, takesFIX_LANE. -
It writes the
tfpair of the run journal (<run>-cpF-tf-files.shaand its deleted-paths twin). It then dispatches ONE re-check by the originating lens on a read-onlyverifier, describedcpF r3 trivial-fix <lens> re-check. The brief hasBase: <tf-tree>, thetreeandhunk: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. -
If the re-check is
SOUND, the IDs close and the run commits withoutOpen-Blocking:. Any other verdict takesFIX_LANE. There is no second trivial fix and no delta fix after it. -
No
SendMessagefrom the run follows the leaf, to any recipient, while thetrivialentry 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
originof the repository is an entry of the allowlist ingit-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.mdnever 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-progressdrops 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 offtacs,oneiot_backendandft-bs-clientfail the attestation today.ft-acs-qaandft-acs-qa-consolebecome 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 |
|
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 |
|
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-agentfinds 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 |
|---|---|---|
|
A real defect that fits the bugfix scope. |
Yes |
|
Only part of the claim is real. The agent fixes the confirmed part. |
Yes |
|
Another caller compensates, or it is already fixed. |
No |
|
The behavior is intentional and correct. |
No |
|
Gate A did not pass by test, statistics or observation. The report lists what was tried and what is needed. |
No |
|
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 |
|
Parity mode. The local code is equivalent and better. |
No |
|
Parity mode. The behavior differs on purpose. It needs an entry in the documented-differences registry. |
Registry entry |
|
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.
The refactor pipeline
refactor-agent is its own orchestrator. It puts a safety net before the first edit.
-
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.
-
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.
-
Smell inventory. Each smell has
file:lineand a breached threshold fromrules/code-quality/design-principles.md. -
Classification.
PROCEED,PARTIAL,NOT_WORTH_IT,BEHAVIOR_CHANGE_REQUIRED,BLOCKED_NO_SAFETY_NETorBLOCKED. -
Small verified steps, then a consistency sweep over the same smell elsewhere.
-
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 |
|---|---|---|
|
The fix plan |
Correctness, Security, API-contract |
|
The diff |
Correctness (the executor), Security, API-contract |
|
The design brief |
Requirements-coverage, Security, API-contract |
|
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 |
|
The origin is |
|
The entry grade is |
The orchestrator states it. The router checks it against the journal. |
The checkpoint is |
The orchestrator states it. |
The observation of the change is not degraded |
|
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-adversarypass.
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 |
|---|---|---|
|
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. |
|
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. |
|
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. |
|
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) |
|---|---|
|
Correctness |
|
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 |
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 adequacylens 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 |
|---|---|
|
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. |
|
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. |
|
A sub-agent needs a file outside its declared |
|
A nested agent cannot ask the user. It returns the question to its parent, which relays it. |
|
|
|
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 |
|
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.mdsection 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-lenson 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.