@arbiterforge/ca-pi 0.18.3 → 0.19.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (74) hide show
  1. package/README.md +1 -1
  2. package/package.json +1 -1
  3. package/plugins/ca-pi/CHANGELOG.md +60 -0
  4. package/plugins/ca-pi/COMMANDS.md +2 -2
  5. package/plugins/ca-pi/SKILLS.md +5 -5
  6. package/plugins/ca-pi/SPRINT.md +43 -230
  7. package/plugins/ca-pi/agents/backend-author.md +5 -5
  8. package/plugins/ca-pi/agents/checkpoint-aggregator.md +7 -0
  9. package/plugins/ca-pi/agents/frontend-author.md +5 -5
  10. package/plugins/ca-pi/agents/infra-author.md +6 -7
  11. package/plugins/ca-pi/agents/scout.md +25 -24
  12. package/plugins/ca-pi/arbiter.md +6 -4
  13. package/plugins/ca-pi/generated/command-catalog.json +5 -5
  14. package/plugins/ca-pi/helpers/artifacts/ca-artifact-darwin-amd64 +0 -0
  15. package/plugins/ca-pi/helpers/artifacts/ca-artifact-darwin-arm64 +0 -0
  16. package/plugins/ca-pi/helpers/artifacts/ca-artifact-linux-amd64 +0 -0
  17. package/plugins/ca-pi/helpers/artifacts/ca-artifact-linux-arm64 +0 -0
  18. package/plugins/ca-pi/helpers/artifacts/ca-artifact-windows-amd64.exe +0 -0
  19. package/plugins/ca-pi/helpers/artifacts/ca-artifact-windows-arm64.exe +0 -0
  20. package/plugins/ca-pi/helpers/artifacts/release.json +37 -37
  21. package/plugins/ca-pi/hooks/_approvallib.py +41 -0
  22. package/plugins/ca-pi/hooks/_artifactlib.py +61 -115
  23. package/plugins/ca-pi/hooks/_artifactpromptlib.py +12 -12
  24. package/plugins/ca-pi/hooks/_bashguardlib.py +66 -4
  25. package/plugins/ca-pi/hooks/_contextselectlib.py +38 -35
  26. package/plugins/ca-pi/hooks/_contextwriterlib.py +114 -0
  27. package/plugins/ca-pi/hooks/_host.py +1 -1
  28. package/plugins/ca-pi/hooks/_prerequisitelib.py +35 -0
  29. package/plugins/ca-pi/hooks/_provenancelib.py +107 -1
  30. package/plugins/ca-pi/hooks/_readinjectlib.py +21 -7
  31. package/plugins/ca-pi/hooks/_reconciliationlib.py +170 -3
  32. package/plugins/ca-pi/hooks/_releaselib.py +6 -6
  33. package/plugins/ca-pi/hooks/_sprintapprovallib.py +52 -2
  34. package/plugins/ca-pi/hooks/artifact-reconcile.py +13 -4
  35. package/plugins/ca-pi/hooks/hostapi.py +1 -1
  36. package/plugins/ca-pi/hooks/init-codearbiter.py +34 -5
  37. package/plugins/ca-pi/includes/artifacts-attestation.md +434 -0
  38. package/plugins/ca-pi/includes/artifacts.md +133 -492
  39. package/plugins/ca-pi/includes/author-tdd-workflow.md +32 -21
  40. package/plugins/ca-pi/includes/fresh-verification.md +14 -12
  41. package/plugins/ca-pi/includes/harvest.md +3 -3
  42. package/plugins/ca-pi/includes/reference-map.md +1 -1
  43. package/plugins/ca-pi/includes/routing-table.md +3 -3
  44. package/plugins/ca-pi/includes/sprint-authority.md +6 -1
  45. package/plugins/ca-pi/includes/verification-boundary.md +11 -2
  46. package/plugins/ca-pi/package.json +1 -1
  47. package/plugins/ca-pi/routines/INDEX.md +8 -8
  48. package/plugins/ca-pi/routines/brainstorming/SKILL.md +65 -202
  49. package/plugins/ca-pi/routines/commit-gate/SKILL.md +60 -25
  50. package/plugins/ca-pi/routines/context-check/SKILL.md +89 -53
  51. package/plugins/ca-pi/routines/context-creation/SKILL.md +114 -220
  52. package/plugins/ca-pi/routines/decompose/SKILL.md +139 -167
  53. package/plugins/ca-pi/routines/executing-plans/SKILL.md +38 -136
  54. package/plugins/ca-pi/routines/finishing-a-development-branch/SKILL.md +45 -55
  55. package/plugins/ca-pi/routines/refactor/SKILL.md +27 -12
  56. package/plugins/ca-pi/routines/release/SKILL.md +1 -1
  57. package/plugins/ca-pi/routines/subagent-driven-development/SKILL.md +80 -230
  58. package/plugins/ca-pi/routines/tdd/SKILL.md +115 -228
  59. package/plugins/ca-pi/routines/writing-plans/SKILL.md +104 -174
  60. package/plugins/ca-pi/skills/ca-audit/SKILL.md +2 -2
  61. package/plugins/ca-pi/skills/ca-checkpoint/SKILL.md +1 -1
  62. package/plugins/ca-pi/skills/ca-commit/SKILL.md +60 -25
  63. package/plugins/ca-pi/skills/ca-context-check/SKILL.md +89 -53
  64. package/plugins/ca-pi/skills/ca-create-context/SKILL.md +114 -220
  65. package/plugins/ca-pi/skills/ca-decompose/SKILL.md +139 -167
  66. package/plugins/ca-pi/skills/ca-feature/SKILL.md +21 -38
  67. package/plugins/ca-pi/skills/ca-fix/SKILL.md +15 -9
  68. package/plugins/ca-pi/skills/ca-init/SKILL.md +18 -40
  69. package/plugins/ca-pi/skills/ca-pr/SKILL.md +45 -55
  70. package/plugins/ca-pi/skills/ca-refactor/SKILL.md +27 -12
  71. package/plugins/ca-pi/skills/ca-release/SKILL.md +1 -1
  72. package/plugins/ca-pi/skills/ca-review/SKILL.md +5 -8
  73. package/plugins/ca-pi/skills/ca-sprint/SKILL.md +11 -25
  74. package/plugins/ca-pi/skills/ca-status/SKILL.md +15 -6
@@ -1,239 +1,126 @@
1
1
  ---
2
2
  name: tdd
3
- description: The test-first gate. Routed to by /feature (after the spec is approved), /fix, and /refactor before any implementation code is written. Six gated phases — obligation scan, red, green, obligation verify, coverage, lint. No feature code exists before Phase 1 clears; nothing reaches commit-gate until all six are green.
3
+ description: Verify authorized feature, fix, and refactor work with scoped obligations, regression-first fixes, behavioral checks, characterization baselines, coverage, and lint.
4
4
  disable-model-invocation: true
5
5
  ---
6
6
 
7
7
  # tdd
8
8
 
9
- ## Authoritative format boundary
10
-
11
- For an HTML spec/plan pair, load `<plugin-root>/includes/artifacts.md` and use
12
- the installed structured-artifact engine for artifact I/O. Verify the plan's
13
- binding to the approved spec, use typed `index`, `outline`, and symbol-scoped `read`,
14
- and follow contextual pages for the selected task. The workflow must not parse rendered HTML
15
- for criteria, status, evidence, or authority. Missing or
16
- invalid HTML capability is a STOP, not a fallback to Markdown. Existing
17
- authoritative Markdown pairs continue through the legacy path. HTML `--farm`
18
- dispatch remains blocked.
19
-
20
-
21
- Test-first, or it does not ship. Routed to by `/feature` (after spec approval), `/fix`, and `/refactor`.
22
-
23
- For a feature author, including a confirmed small-lane feature, the owning
24
- coordinator selects task paths and obtains the current bounded map, provenance,
25
- scoped command records and collector observations, applicable constraint
26
- references, and host-effective instructions in native precedence order. Before
27
- the author mutates or executes a discovered command, compose the fresh child
28
- input with `_artifactpromptlib.compose_feature_actor_input` and send its
29
- returned `input` to that child. Bind the actual approved spec and plan IDs
30
- for full-lane work. For a confirmed small-lane feature, pass its mini-spec
31
- text as `confirmed_mini_spec` and leave both artifact IDs absent; do not invent
32
- a plan or bypass its existing gate. The packet
33
- is an orientation aid with `requires_actor_check`, not admission. Recheck
34
- worktree/source identity and resolve applicable critical constraints before a
35
- material action. Missing optional map detail permits bounded read-only source
36
- inspection, with full schema or document body read only when needed.
37
- Apply `_contextselectlib.prepare_actor_delivery` to that selected packet for
38
- the actual child, task, worktree and current source/host epochs. Send its
39
- `delivery_text` when requested and count the attempt before the material
40
- action; an unknown receipt or surviving session marker never proves delivery.
41
- Re-select on resume, compaction, scope or worktree change, and report a blocked
42
- delivery gap rather than assuming the child retained prior context.
43
-
44
- For a fix or targeted test-only change, use the caller that already owns the
45
- task. Before the author mutates or executes a discovered command, call
46
- `_contextselectlib.compose_fix_or_test_actor_input` with the current scoped
47
- sources, exact command cwd and collector evidence, then send its returned
48
- `input` to that actor. Use `route='fix'`, `caller='fix'`, and the confirmed
49
- bug-origin evidence and named regression for a fix. Use `route='test_change'`
50
- with the existing `fix`, `feature`, or `refactor` caller for a test-only change;
51
- do not create a feature spec pair merely to deliver context. The selected
52
- caller retains its own approval and TDD gates. Reuse an actual bug-origin RED
53
- when it already proves the named regression; for a targeted test change,
54
- validate the test against the real defect or an honest fault fixture. Never
55
- change production behavior merely to manufacture a failing test. If this
56
- conflicts with a required TDD gate, surface the conflict to that gate's owner;
57
- context delivery does not waive it. The packet remains reported evidence, not
58
- task admission.
9
+ Select the verification approach before changing code. Keep the intended behavior,
10
+ observed results, and pending checks explicit throughout implementation.
59
11
 
60
12
  ## Pre-flight
61
13
 
62
- Read these, or STOP and surface the gap — never guess a command or a threshold:
63
-
64
- - `<project-root>/.codearbiter/CONTEXT.md` — the `stage:` frontmatter (the maturity value) and project context.
65
- - `<project-root>/.codearbiter/tech-stack.md` — test, coverage, and lint invocations; file layout; mock patterns.
66
- - `<plugin-root>/includes/verification-boundary.md` — the required split between focused local proof and exhaustive exact-head hosted CI.
67
- - `<project-root>/.codearbiter/coding-standards.md` — style, structure, naming. Required for Phase 3.
68
- - For `/feature`, the authoritative approved spec. For HTML, read its typed
69
- criterion records through the installed engine and confirm the paired plan's
70
- exact binding; for legacy Markdown, read
71
- `<project-root>/.codearbiter/specs/<slug>.md`. It is the feature obligation
72
- source.
73
- - For `/fix`, the bug-origin evidence: observed and expected behavior, the
74
- current expectation and its citations, supported cause, and the regression
75
- oracle with its cited evidence. If a validated debug handoff supplies these,
76
- recheck its source binding and freshness in the actual worktree and the
77
- original caller authority through the fix owner. A packet or its intent field
78
- does not authorize repair. Do not create a feature artifact to enter TDD.
79
- - For `/refactor` backfill, the user-approved surface table and pre-existing
80
- parity evidence owned by `/refactor`. It does not require a feature spec.
81
- - `<project-root>/.codearbiter/security-controls.md` — only when the change touches a security boundary (auth, crypto, secrets, a trust boundary). Optional; absent on most changes.
82
- - `<project-root>/.codearbiter/code-map.md` — if present, a coarse concern→path→role map to orient before writing tests and code. Absent is fine — it is read-on-demand, populated by context-creation or commit-gate heal.
83
-
84
- ## Phase 1 — Obligation scan · gate: BLOCK
85
-
86
- An **obligation** is one verifiable claim about the change: (a) a unique ID, (b) a source citation,
87
- (c) a status. Status moves `OPEN → MAPPED → COVERED`; an obligation Phase 4 cannot tie to a passing
88
- test is `MISSING`. "We should test X" is not an obligation.
89
-
90
- Derive every obligation before any code is written, and record each as `ID · source · OPEN`:
91
-
92
- - **Spec (`/feature`)** — one obligation per acceptance criterion in the approved spec. For
93
- HTML, cite the exact artifact ID and criterion ID returned by the engine;
94
- caller-supplied labels cannot manufacture obligations or widen the approved
95
- criterion set.
96
- - **Bug-origin regression (`/fix`)** — one obligation for each scoped wrong
97
- behavior to repair. Cite the current expectation, observed defect and supported
98
- cause, regression oracle and evidence, and relevant source binding. A validated
99
- debug handoff supplies cited facts, not authority; derive these rows in the
100
- existing ledger. Do not invent a feature artifact such as a spec, plan, or
101
- mini-spec. The target regression must go red for the right reason before the
102
- minimum implementation. If the expectation is unresolved or the proposed
103
- behavior is new, stop and use the feature or decision owner.
104
- - **Refactor parity (`/refactor` backfill)** — cite the approved surface table
105
- and the uncovered symbol or seam with its pre-existing behavior and parity
106
- evidence. Do not turn a refactor into a feature or a bug fix.
107
- - **Contract** — API and input-validation invariants, error responses, boundary conditions.
108
- - **Security** — only when `security-controls.md` applies: the assertion that the security-relevant boundary holds.
109
-
110
- Gate: the obligation list is complete. For `/feature`, **auto-pass** when every obligation maps
111
- one-to-one onto the acceptance criteria of an already-approved spec (full-lane spec or small-lane
112
- mini-spec) — the user approved that list once; do not re-ask. **User review is required** only for
113
- obligations derived BEYOND that spec (Contract and Security rows): surface just those additions.
114
- For `/fix`, the scoped bug-origin regression follows the original caller's repair authority and
115
- current evidence; the absence of a feature spec is not a block or permission to expand scope.
116
- Review any proposed obligation beyond that supported correction under its actual owner. An ADR
117
- remains a user-attributed decision through `/adr`; neither a handoff nor this ledger creates one.
118
- For `/refactor`, retain its user-approved surface table and parity gates; backfill only the named
119
- uncovered behavior or seam. The TDD checklist does not amend that table.
120
- Under `/sprint`, spec-derived obligations auto-pass the same way and beyond-spec additions are
121
- SMARTS-decided and logged like any other auto-decision. A partial list never passes either way.
122
-
123
- ## Phase 2 — Red · gate: BLOCK
124
-
125
- Bind a failing test ID to each obligation and move that obligation `OPEN → MAPPED`.
126
- Run the test command from `tech-stack.md`. For `/fix`, first assess an existing failing
127
- test against target red: compare its assertion and regression oracle with the current
128
- target failure and evidence. Name the existing test ID in the obligation ledger and
129
- reuse that named existing target-red test when its oracle is adequate and it fails for
130
- the target reason. Do not duplicate a test solely because of its age or because it
131
- predates repair. Add tests only for uncovered obligations. Do not make a named target
132
- failure green before observing and recording its red result.
133
-
134
- - Every newly written test MUST fail, and fail **for the right reason** — the assertion, not an import error or a typo. A new test that passes with no implementation is wrong; fix it before continuing.
135
- - Record unrelated existing failures in the baseline and report them; an unrelated failure is not target red. An import or setup error is not target red. Preserve each failure's identity and output. A newly broken pre-existing test is a conflict — stop and surface it.
136
- - Required commit gates remain blocked while required checks fail. Do not skip tests, suppress failures, or waive gates to proceed.
137
-
138
- Observe the target regression red on the broken source before repair or implementation. If a material fixture or setup change occurs after that observation, the earlier red no longer qualifies: repeat target red on the broken implementation with the changed fixture or setup before the minimum repair. For an intermittent or timing defect, prefer a faithful deterministic seam. If only repeated trials can exercise the mechanism, predeclare a finite trial bound and failure oracle; record the stochastic sample limit. Do not claim deterministic proof from a passing sample or retry until green. A failing trial must match the target mechanism, not merely fail intermittently.
139
-
140
- Reject the standard traps: asserting on a mock instead of behavior; a test that can never fail; a
141
- snapshot so broad it asserts nothing; coupling to an implementation detail instead of observable
142
- behavior; asserting on the framework's behavior rather than your own.
143
-
144
- The reasons to skip red are known. Hearing one is the tell that this gate is about to be waived —
145
- never the license to waive it:
146
-
147
- | excuse | reality |
14
+ Use the selected specification or inline criteria for a feature, the observed defect
15
+ and expected behavior for a fix, and the agreed surface plus existing behavior for a
16
+ refactor. Read applicable project instructions and the test, coverage, and lint
17
+ commands in `<project-root>/.codearbiter/tech-stack.md`. Follow
18
+ `<plugin-root>/includes/verification-boundary.md` for local versus hosted checks.
19
+ Read security controls when the affected behavior crosses a security boundary.
20
+ Use `.codearbiter/code-map.md` on demand for source orientation when present.
21
+
22
+ For artifact I/O, load `<plugin-root>/includes/artifacts.md`. Use the selected
23
+ spec/plan identities and typed criterion records for HTML. Direct implementation
24
+ reads the same relevant inputs; it does not require a child or delivery receipt.
25
+
26
+ For actual delegation, send bounded context to the named actor. Feature actors use
27
+ `_artifactpromptlib.compose_feature_actor_input`; fix and test-only actors use
28
+ `_contextselectlib.compose_fix_or_test_actor_input`. Bind the actual task paths,
29
+ commands and cwd, applicable constraints, and effective instructions. A small-lane
30
+ feature supplies `confirmed_mini_spec` with absent spec/plan IDs. A fix supplies
31
+ `route='fix'`, `caller='fix'`, bug-origin evidence and the named regression. Test-only
32
+ work uses `route='test_change'` under its existing feature, fix, or refactor caller.
33
+ Use `required_refs` for particular task-critical inputs. Missing optional map or
34
+ provenance information permits focused source inspection.
35
+
36
+ `_contextselectlib.prepare_actor_delivery` can prepare the actor's bounded input.
37
+ Send the returned delivery text when requested and retain observed delivery facts.
38
+ An advisory delivery result needs no further retry. Re-select after a material
39
+ source, scope or worktree change. Resolve actual critical missing or conflicting
40
+ inputs before the affected action, and preserve host permissions.
41
+
42
+ ## Phase 1 — Obligations and verification approach
43
+
44
+ Record each required claim with an ID, its source, and its proving check. Include
45
+ applicable contract and security boundaries. Retain the existing feature criteria,
46
+ fix expectation, or refactor surface; ask only about a consequential missing choice.
47
+
48
+ | Work | Evidence required |
148
49
  |---|---|
149
- | "Too simple to fail first." | Simple changes have the cheapest red tests — and "too simple to test" and "too simple to break" have never been the same claim. |
150
- | "I'll write the test right after." | A test written after green has never been seen red: it is authored against the implementation it was meant to constrain, and its power to catch the bug is never demonstrated. |
151
- | "The test would just restate the implementation." | Then it is aimed at the wrong seam — assert the observable behavior, not the wiring. A change with no observable behavior to assert is a design finding, not an exemption. |
152
- | "The existing suite already covers this." | Then the failing test is impossible to write — try it. If it genuinely cannot go red, the obligation is already COVERED and Phase 4 records exactly that; if it goes red, the claim was wrong and you are holding the proof. |
153
-
154
- Gate: the runner confirms each newly written test red for the right reason, or an
155
- adequate named existing target-red test red for that reason, with every obligation
156
- `MAPPED` to a failing test. Record unrelated existing failures separately; they
157
- cannot count as target red or clear later required checks. No implementation code
158
- is written until this gate clears.
159
-
160
- ## Phase 3 — Green · gate: BLOCK
161
-
162
- Write the **minimum** implementation that satisfies the Phase 2 tests — no speculative logic, no
163
- gold-plating — to the conventions in `coding-standards.md`. Run the impact-bounded local tests from
164
- `verification-boundary.md`: the new regression plus affected pre-existing contracts. A broken
165
- pre-existing test is a regression: fix it. Exhaustive and cross-platform suites run on exact-head
166
- hosted CI before merge.
167
-
168
- Gate: rerun the same named target test for fresh green on the repaired source, then rerun fresh affected-contract tests on that source. Record these results with the applicable coverage, lint, and type-check results; an old-head green is not repair proof. The applicable local suite is green, reached by satisfying the Phase 2 tests — not by weakening them. A test's
169
- assertions MUST be unchanged between red and green; only fixtures and setup may move, and a material change to either requires renewed target red on the broken implementation before this green. A relaxed
170
- assertion is a gate violation.
171
-
172
- ## Phase 4 — Obligation verify · gate: BLOCK
173
-
174
- Walk the Phase 1 list item by item. Each `MAPPED` obligation moves to `COVERED` (a real passing test
175
- that exercises the claim) or `MISSING` (no test truly covers it). For security-relevant or
176
- contract-critical logic, dispatch the `coverage-auditor` agent
177
- (`<plugin-root>/agents/coverage-auditor.md`) to confirm the tests exercise the claim.
178
-
179
- A `MISSING` obligation returns the workflow to Phase 2 — author a correct failing test, then re-run
180
- Phase 3 — and loops until it is `COVERED`.
181
-
182
- **Stakes:** when you block on a `MISSING` obligation, state what the untested seam leaves exposed, not
183
- just that it is `MISSING` — one line naming the consequence: "this error path is untested; a 500 here
184
- would reach users silently." The block is the rule; the stakes are why it is worth the friction.
185
-
186
- Gate: every obligation `COVERED`, each backed by a passing test. Any `MISSING` blocks Phase 5.
187
-
188
- ## Phase 5 — Coverage · gate: BLOCK
189
-
190
- Coverage scales with the maturity value (`stage:` in `CONTEXT.md`) — a rigor knob, not a promotion
191
- gate. The threshold table is the shared `<plugin-root>/includes/maturity-coverage.md` (the
192
- single source of truth, also used by `refactor` Phase 2).
193
-
194
- Resolve the surface's **declared coverage profile** from `tech-stack.md` against
195
- `<plugin-root>/includes/maturity-coverage.md`, then run its coverage command.
196
- Every required metric must clear the maturity threshold. Apply the shared
197
- profile-selection, report-validity and critical-path evidence requirements;
198
- do not substitute metrics or treat an unmeasured metric as passed. Below the
199
- floor on any required metric → add meaningful tests until it is met.
200
-
201
- **Name the host you measured on**, and for a tree `tech-stack.md` marks as platform-forked, the
202
- figure is the UNION across its supported hosts — a single-host report scores the other platform's
203
- arm as permanently uncovered (issue #521, conditions in `<plugin-root>/includes/maturity-coverage.md`).
204
- Where only one host is available, say so and name what is missing rather than quoting it as the
205
- whole.
206
-
207
- Where the surface has no coverage tooling at all, take the no-tooling exemption in
208
- `<plugin-root>/includes/maturity-coverage.md` — which requires QUOTING the `tech-stack.md`
209
- Coverage section that omits a command for this surface — and pass the phase on the Phase 4
210
- obligation verify alone. Without that citation the phase STOPs: "I could not find the command" and
211
- "this surface has none" look identical from here and demand opposite responses. Do NOT invent a
212
- command, and do NOT silently skip the phase as though it had been run — a gate that cannot execute
213
- still reads as satisfied, which is worse than an absent one.
214
-
215
- **Stakes:** when coverage blocks below threshold, name the class of code left dark — the paths a later
216
- regression could rot unnoticed — not just "below threshold." The number is the rule; the untested paths
217
- are why it matters.
218
-
219
- Gate: threshold met on every required metric in the declared coverage profile
220
- for the current maturity value, with the shared critical-path evidence, or the no-tooling
221
- exemption taken WITH its citation and Phase 4 proof. A test added only to move the percentage fails this gate in
222
- spirit — it converts an honest red into a green that asserts nothing.
223
-
224
- ## Phase 6 — Lint · gate: BLOCK
225
-
226
- Run lint, and the type-check if the project is statically typed, from `tech-stack.md`. Resolve every
227
- error.
228
-
229
- Gate: clean lint and type-check, zero errors — this is what clears the path to `commit-gate`.
230
- "Mostly passes" is not passing.
231
-
232
- ## Hard rules
233
-
234
- - MUST NOT skip, suppress, or comment out a test to clear any gate.
235
- - MUST NOT mark an obligation `COVERED` without a passing test that exercises the claim.
236
- - MUST NOT lower a coverage threshold without a decision recorded in `CONTEXT.md`.
237
- - MUST NOT inline-suppress a lint rule without a written reason, and never to bypass a security-relevant rule.
238
- - MUST NOT guess the test, coverage, or lint command — read `tech-stack.md` or STOP.
239
- - MUST, at exit, run the follow-up harvest (`<plugin-root>/includes/harvest.md`) over any `[NEEDS-TRIAGE]` raised this run — batch-confirm promoting work to `open-tasks.md` and decisions to `open-questions.md` so nothing languishes; nothing auto-promotes interactively.
50
+ | Confirmed fix | Observe a named regression failing for the defect before repair, then passing after repair. Reuse an adequate current bug-origin RED. |
51
+ | Feature | Prefer test-first behavior checks. Existing implementation can be verified through current criterion-focused tests and meaningful negative controls where needed; report the observed sequence accurately. |
52
+ | Refactor or coverage backfill | Run characterization tests against existing behavior before restructuring. An initially passing test is a valid baseline. Preserve that baseline and its assertions through the refactor. |
53
+ | Documentation or non-executable change | Use the relevant reference, generation, schema, or rendering validation. Mark test and coverage phases inapplicable with the concrete reason. |
54
+
55
+ Each obligation moves `OPEN → MAPPED → COVERED`; a claim without adequate evidence
56
+ remains `MISSING`. Declare the approach and needed checks up front. Record only
57
+ observed results, including failures, skips, and unavailable checks.
58
+
59
+ ## Phase 2 — Establish the baseline
60
+
61
+ Run the selected checks and read their output. For a confirmed fix, verify that the
62
+ named regression fails for the target assertion, not an import, setup, or unrelated
63
+ error. Reuse a suitable existing test rather than duplicating it. Add tests for
64
+ uncovered behavior. Keep unrelated baseline failures separately identified.
65
+
66
+ For test-first feature work, observe the intended missing behavior before adding
67
+ it. For characterization, observe the existing behavior passing. A negative control
68
+ or isolated fault fixture can establish that a test detects a relevant deviation;
69
+ do not alter correct production behavior merely to obtain a failure.
70
+
71
+ For timing defects, prefer a deterministic seam. When repeated trials are necessary,
72
+ state a finite trial bound and failure oracle before running them. Report sample
73
+ limits; a passing sample is not deterministic proof.
74
+
75
+ Proceed when the selected baseline supports the intended change. A confirmed fix
76
+ requires its genuine target RED. Missing characterization coverage requires useful
77
+ baseline tests before restructuring. Never weaken assertions or suppress failures.
78
+
79
+ ## Phase 3 — Implement and check
80
+
81
+ Implement the scoped change using project conventions. Run the proving checks on
82
+ the resulting source, followed by affected pre-existing contracts. Repair regressions
83
+ and retain failed results until superseded by an actual rerun.
84
+
85
+ For a regression-first fix, run the same named test for fresh GREEN. Keep its
86
+ assertions unchanged between RED and GREEN. A material fixture or setup change
87
+ requires renewed target RED against the broken source before claiming that sequence.
88
+ For refactors, preserve the behavior and baseline test assertions.
89
+
90
+ ## Phase 4 — Verify obligations
91
+
92
+ Match each obligation to evidence that exercises its claim. Mark it `COVERED` only
93
+ when the applicable check passed. An unexplained failure or untested requirement
94
+ remains `MISSING`; repair the affected work and rerun its checks. Reuse current
95
+ results when the relevant source and inputs are unchanged.
96
+
97
+ Review the combined change at the scope its risks warrant. Use `coverage-auditor`
98
+ (`<plugin-root>/agents/coverage-auditor.md`) for an independently required review of security or contract-critical behavior.
99
+ State exactly what the evidence proves and what remains unknown.
100
+
101
+ ## Phase 5 — Coverage
102
+
103
+ Apply `<plugin-root>/includes/maturity-coverage.md` using the project's declared
104
+ coverage profile and maturity stage. Run the owning coverage command for the affected
105
+ surface; every required metric must meet its threshold and critical-path evidence
106
+ requirements. Keep production scope, exclusions, and metrics unchanged unless the
107
+ user has authorized a policy change.
108
+
109
+ Name the measurement host and retain the supported host union for platform-forked
110
+ trees. An unavailable host remains unmeasured. When the surface has no coverage
111
+ tooling, cite its `tech-stack.md` Coverage declaration and use the shared no-tooling
112
+ rule with the Phase 4 evidence. Never invent a command or treat unmeasured coverage
113
+ as passing.
114
+
115
+ ## Phase 6 — Lint and handoff
116
+
117
+ Run applicable lint and type checks from the project command guide. Resolve errors.
118
+ Return the scoped obligations, selected verification approach, actual command/cwd
119
+ and outcomes, and any pending checks to the caller. The commit owner evaluates this
120
+ evidence for the selected staged changes; it does not require a different historical
121
+ test sequence from the one appropriate to the work.
122
+
123
+ Preserve failures and actual user stops. Do not skip tests, lower coverage thresholds,
124
+ or suppress security checks to obtain a pass. Use `<plugin-root>/includes/harvest.md`
125
+ for genuine out-of-scope findings. Completion reports must distinguish implementation,
126
+ verification, review, and release.