mandrel 2.110.0 → 2.112.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 (190) hide show
  1. package/.agents/agents/acceptance-critic.md +14 -0
  2. package/.agents/agents/auditor.md +14 -0
  3. package/.agents/agents/plan-critic.md +5 -0
  4. package/.agents/agents/story-worker.md +4 -1
  5. package/.agents/audit-checklists/state-machines.md +21 -0
  6. package/.agents/docs/agentrc-reference.json +23 -10
  7. package/.agents/docs/configuration.md +362 -15
  8. package/.agents/docs/execution-reference.md +11 -0
  9. package/.agents/docs/workflows.md +2 -1
  10. package/.agents/rules/ci-remediation.md +28 -4
  11. package/.agents/rules/git-conventions-reference.md +7 -0
  12. package/.agents/schemas/agentrc.schema.json +179 -13
  13. package/.agents/schemas/audit-rules.json +28 -0
  14. package/.agents/schemas/baselines/baseline-envelope.schema.json +16 -4
  15. package/.agents/schemas/baselines/bundle-size.schema.json +1 -0
  16. package/.agents/schemas/baselines/coverage.schema.json +1 -0
  17. package/.agents/schemas/baselines/crap.schema.json +37 -10
  18. package/.agents/schemas/baselines/duplication.schema.json +1 -0
  19. package/.agents/schemas/baselines/maintainability.schema.json +1 -0
  20. package/.agents/schemas/baselines/mutation.schema.json +1 -0
  21. package/.agents/schemas/crap-report.schema.json +6 -5
  22. package/.agents/schemas/story-deliver-terminal.schema.json +49 -3
  23. package/.agents/schemas/story-progress.schema.json +1 -1
  24. package/.agents/schemas/validation-evidence.schema.json +2 -2
  25. package/.agents/scripts/boot-sweep.js +41 -3
  26. package/.agents/scripts/coverage-capture.js +39 -3
  27. package/.agents/scripts/coverage-ratchet.js +106 -0
  28. package/.agents/scripts/evidence-gate.js +84 -21
  29. package/.agents/scripts/file-ci-gap.js +220 -10
  30. package/.agents/scripts/lib/audit-baselines/read.js +8 -1
  31. package/.agents/scripts/lib/audit-baselines/trend.js +2 -1
  32. package/.agents/scripts/lib/audit-to-stories/audit-lenses.js +1 -0
  33. package/.agents/scripts/lib/baseline-loader.js +4 -2
  34. package/.agents/scripts/lib/baselines/codec.js +57 -0
  35. package/.agents/scripts/lib/baselines/crap-preview-incremental.js +8 -3
  36. package/.agents/scripts/lib/baselines/crap-preview-scan.js +10 -16
  37. package/.agents/scripts/lib/baselines/crap-updater-cli.js +4 -13
  38. package/.agents/scripts/lib/baselines/kernel.js +19 -1
  39. package/.agents/scripts/lib/baselines/kinds/_crap-codec.js +171 -0
  40. package/.agents/scripts/lib/baselines/kinds/_crap-read.js +56 -16
  41. package/.agents/scripts/lib/baselines/kinds/_shared-metric.js +0 -59
  42. package/.agents/scripts/lib/baselines/kinds/crap.js +283 -319
  43. package/.agents/scripts/lib/baselines/preview-gates.js +29 -10
  44. package/.agents/scripts/lib/baselines/reader.js +36 -9
  45. package/.agents/scripts/lib/baselines/refresh-service.js +79 -18
  46. package/.agents/scripts/lib/baselines/seat-missing.js +173 -7
  47. package/.agents/scripts/lib/baselines/writer.js +36 -21
  48. package/.agents/scripts/lib/changed-files.js +70 -6
  49. package/.agents/scripts/lib/child-exec.js +10 -0
  50. package/.agents/scripts/lib/claude/agents-projection.js +5 -5
  51. package/.agents/scripts/lib/close-lock-events.js +8 -3
  52. package/.agents/scripts/lib/close-validation/ci-deferral.js +40 -0
  53. package/.agents/scripts/lib/close-validation/gates.js +156 -32
  54. package/.agents/scripts/lib/close-validation/process.js +16 -7
  55. package/.agents/scripts/lib/close-validation/projections/crap.js +43 -10
  56. package/.agents/scripts/lib/close-validation/runner.js +160 -41
  57. package/.agents/scripts/lib/close-validation/skip-branch-test.js +144 -0
  58. package/.agents/scripts/lib/close-validation/test-delta.js +33 -8
  59. package/.agents/scripts/lib/codex/agents-projection.js +6 -0
  60. package/.agents/scripts/lib/config/agentrc-overlay.js +9 -5
  61. package/.agents/scripts/lib/config/explain.js +5 -2
  62. package/.agents/scripts/lib/config/gates/coverage.schema.js +53 -0
  63. package/.agents/scripts/lib/config/gates/crap-incremental-coverage.schema.js +1 -1
  64. package/.agents/scripts/lib/config/git-roots.js +38 -4
  65. package/.agents/scripts/lib/config/handoff.js +24 -0
  66. package/.agents/scripts/lib/config/quality.js +28 -12
  67. package/.agents/scripts/lib/config/worktree-isolation.js +2 -5
  68. package/.agents/scripts/lib/config-resolver.js +22 -2
  69. package/.agents/scripts/lib/config-settings-schema-delivery.js +87 -4
  70. package/.agents/scripts/lib/config-settings-schema-quality.js +36 -1
  71. package/.agents/scripts/lib/config-settings-schema.js +1 -1
  72. package/.agents/scripts/lib/coverage-capture-affected.js +1 -0
  73. package/.agents/scripts/lib/coverage-capture-delta.js +164 -32
  74. package/.agents/scripts/lib/coverage-capture-own-fix.js +232 -0
  75. package/.agents/scripts/lib/coverage-capture-usage.js +2 -2
  76. package/.agents/scripts/lib/coverage-capture.js +31 -0
  77. package/.agents/scripts/lib/coverage-deferral.js +96 -0
  78. package/.agents/scripts/lib/coverage-ratchet.js +187 -0
  79. package/.agents/scripts/lib/crap-baseline-join.js +5 -5
  80. package/.agents/scripts/lib/crap-engine.js +3 -3
  81. package/.agents/scripts/lib/crap-method-identity.js +104 -48
  82. package/.agents/scripts/lib/escomplex-anchor.js +135 -0
  83. package/.agents/scripts/lib/escomplex-kernel.js +30 -1
  84. package/.agents/scripts/lib/failure-rows.js +121 -0
  85. package/.agents/scripts/lib/full-suite-lock.js +44 -4
  86. package/.agents/scripts/lib/full-suite-queue.js +89 -13
  87. package/.agents/scripts/lib/generated/agentrc-validator.js +8 -2
  88. package/.agents/scripts/lib/gh-env.js +3 -6
  89. package/.agents/scripts/lib/gh-pr-rest.js +1 -0
  90. package/.agents/scripts/lib/git/base-sync-probe.js +182 -0
  91. package/.agents/scripts/lib/git-branch-lifecycle.js +9 -0
  92. package/.agents/scripts/lib/observability/close-telemetry.js +37 -2
  93. package/.agents/scripts/lib/observability/handoff-telemetry.js +170 -0
  94. package/.agents/scripts/lib/observability/review-dispositions.js +23 -6
  95. package/.agents/scripts/lib/observability/runtime-friction.js +17 -4
  96. package/.agents/scripts/lib/observability/source-classifier.js +3 -0
  97. package/.agents/scripts/lib/observability/story-outcome.js +393 -0
  98. package/.agents/scripts/lib/orchestration/check-baselines/phases/compare.js +2 -1
  99. package/.agents/scripts/lib/orchestration/check-baselines/phases/evaluate.js +19 -1
  100. package/.agents/scripts/lib/orchestration/check-baselines/phases/fail-detail.js +84 -0
  101. package/.agents/scripts/lib/orchestration/check-baselines/phases/pipeline.js +14 -5
  102. package/.agents/scripts/lib/orchestration/check-baselines/phases/refresh-ack.js +3 -2
  103. package/.agents/scripts/lib/orchestration/check-baselines/phases/report.js +26 -6
  104. package/.agents/scripts/lib/orchestration/ci-rerun-guard.js +124 -23
  105. package/.agents/scripts/lib/orchestration/code-review.js +223 -19
  106. package/.agents/scripts/lib/orchestration/handoff-gates.js +217 -44
  107. package/.agents/scripts/lib/orchestration/handoff-rescore.js +169 -0
  108. package/.agents/scripts/lib/orchestration/handoff-suite-of-record.js +45 -0
  109. package/.agents/scripts/lib/orchestration/plan-persist/run-plan-persist.js +5 -1
  110. package/.agents/scripts/lib/orchestration/plan-persist/source-rewrite.js +76 -4
  111. package/.agents/scripts/lib/orchestration/plan-persist/story-ops.js +2 -2
  112. package/.agents/scripts/lib/orchestration/preflight-lanes.js +208 -0
  113. package/.agents/scripts/lib/orchestration/review-base-ref.js +40 -17
  114. package/.agents/scripts/lib/orchestration/review-deposit.js +38 -12
  115. package/.agents/scripts/lib/orchestration/review-depth.js +21 -0
  116. package/.agents/scripts/lib/orchestration/review-history.js +124 -20
  117. package/.agents/scripts/lib/orchestration/review-providers/claude-verdict.js +23 -8
  118. package/.agents/scripts/lib/orchestration/review-providers/code-review.js +82 -39
  119. package/.agents/scripts/lib/orchestration/review-providers/critical-verifier.js +64 -11
  120. package/.agents/scripts/lib/orchestration/review-providers/degraded-gates.js +98 -3
  121. package/.agents/scripts/lib/orchestration/review-providers/finding-identity.js +6 -2
  122. package/.agents/scripts/lib/orchestration/review-providers/findings-renderer.js +55 -8
  123. package/.agents/scripts/lib/orchestration/review-providers/review-guidance.js +1 -0
  124. package/.agents/scripts/lib/orchestration/review-providers/review-provider-factory.js +42 -15
  125. package/.agents/scripts/lib/orchestration/review-providers/types.js +6 -0
  126. package/.agents/scripts/lib/orchestration/single-story-close/failed-terminal.js +10 -1
  127. package/.agents/scripts/lib/orchestration/single-story-close/gate-log.js +10 -0
  128. package/.agents/scripts/lib/orchestration/single-story-close/phases/base-sync.js +7 -4
  129. package/.agents/scripts/lib/orchestration/single-story-close/phases/close-validation.js +17 -2
  130. package/.agents/scripts/lib/orchestration/single-story-close/phases/code-review.js +59 -2
  131. package/.agents/scripts/lib/orchestration/single-story-close/phases/confirm-merge.js +13 -1
  132. package/.agents/scripts/lib/orchestration/single-story-close/phases/finish.js +15 -4
  133. package/.agents/scripts/lib/orchestration/single-story-close/phases/land-review-record.js +213 -0
  134. package/.agents/scripts/lib/orchestration/single-story-close/phases/normalize-pr-title.js +17 -2
  135. package/.agents/scripts/lib/orchestration/single-story-close/phases/open-pr.js +42 -20
  136. package/.agents/scripts/lib/orchestration/single-story-close/phases/post-land.js +51 -26
  137. package/.agents/scripts/lib/orchestration/single-story-close/phases/pre-push.js +3 -1
  138. package/.agents/scripts/lib/orchestration/single-story-close/phases/pull-request.js +51 -15
  139. package/.agents/scripts/lib/orchestration/single-story-close/phases/push.js +59 -11
  140. package/.agents/scripts/lib/orchestration/single-story-close/phases/reconcile-done.js +1 -0
  141. package/.agents/scripts/lib/orchestration/single-story-close/phases/review-block.js +31 -13
  142. package/.agents/scripts/lib/orchestration/single-story-close/phases/review-halt.js +29 -6
  143. package/.agents/scripts/lib/orchestration/single-story-close/phases/review-outcome.js +10 -12
  144. package/.agents/scripts/lib/orchestration/single-story-close/phases/review-override.js +19 -4
  145. package/.agents/scripts/lib/orchestration/single-story-close/result.js +43 -13
  146. package/.agents/scripts/lib/orchestration/single-story-close/review-overlap.js +73 -39
  147. package/.agents/scripts/lib/orchestration/single-story-close/runner.js +11 -2
  148. package/.agents/scripts/lib/orchestration/story-close/baseline-upward-writeback.js +3 -2
  149. package/.agents/scripts/lib/orchestration/story-close/duplication-close-rescore.js +20 -8
  150. package/.agents/scripts/lib/orchestration/story-deliver-terminal.js +7 -0
  151. package/.agents/scripts/lib/orchestration/story-handoff.js +789 -196
  152. package/.agents/scripts/lib/orchestration/ticketing/reads.js +2 -0
  153. package/.agents/scripts/lib/pr-body-lines.js +32 -0
  154. package/.agents/scripts/lib/single-story/ci-ratchet-gate.js +140 -0
  155. package/.agents/scripts/lib/single-story/confirm-and-land.js +17 -7
  156. package/.agents/scripts/lib/single-story/confirm-merge.js +12 -3
  157. package/.agents/scripts/lib/single-story-sweep/report-stalled-executing.js +202 -0
  158. package/.agents/scripts/lib/standalone-ratchets.js +37 -0
  159. package/.agents/scripts/lib/suite-admission.js +20 -8
  160. package/.agents/scripts/lib/suite-sizing.js +146 -0
  161. package/.agents/scripts/lib/workspace-provisioner.js +2 -2
  162. package/.agents/scripts/merge-baseline.js +14 -3
  163. package/.agents/scripts/providers/github/comments.js +19 -3
  164. package/.agents/scripts/providers/github.js +1 -0
  165. package/.agents/scripts/review-dispositions-report.js +1 -1
  166. package/.agents/scripts/role-scope-guard.js +267 -0
  167. package/.agents/scripts/single-story-close.js +4 -4
  168. package/.agents/scripts/single-story-confirm-merge.js +31 -5
  169. package/.agents/scripts/single-story-init.js +24 -4
  170. package/.agents/scripts/story-handoff.js +3 -3
  171. package/.agents/scripts/story-outcomes-report.js +231 -0
  172. package/.agents/scripts/story-review-compute.js +9 -5
  173. package/.agents/scripts/update-coverage-baseline.js +12 -2
  174. package/.agents/scripts/update-crap-baseline.js +9 -1
  175. package/.agents/workflows/audit-state-machines.md +213 -0
  176. package/.agents/workflows/helpers/code-review.md +63 -9
  177. package/.agents/workflows/helpers/deliver-digest.md +53 -54
  178. package/.agents/workflows/helpers/deliver-reference.md +236 -63
  179. package/.agents/workflows/helpers/deliver-story-reference.md +19 -8
  180. package/.agents/workflows/helpers/deliver-story.md +7 -2
  181. package/.agents/workflows/helpers/parallel-tooling.md +29 -0
  182. package/.agents/workflows/helpers/plan-reference.md +10 -2
  183. package/docs/CHANGELOG.md +56 -0
  184. package/lib/cli/doctor-checks/coverage-ratchet.js +54 -0
  185. package/lib/cli/doctor-checks/effective-agentrc.js +23 -0
  186. package/lib/cli/doctor-checks/llm-review.js +2 -11
  187. package/lib/cli/doctor-checks/sync-parity.js +5 -1
  188. package/lib/cli/doctor-checks/test-credit-path.js +7 -2
  189. package/lib/cli/registry.js +5 -0
  190. package/package.json +1 -1
@@ -83,6 +83,10 @@ How each tier changes the review protocol:
83
83
  to check every caller in that block against the new signature or shape —
84
84
  the one bug class a diff alone cannot show.
85
85
 
86
+ The `code-review` provider also maps depth to `claude --effort`: `low` at
87
+ `light` and `standard`, `high` at `deep`. `delivery.codeReview.effortByDepth`
88
+ overrides that per depth (`low`/`medium`/`high`/`xhigh`/`max`).
89
+
86
90
  The LLM-backed review providers (code-review, codex, security-review,
87
91
  ultrareview) render the resolved `depth` into the prompt/instructions they emit so the underlying
88
92
  model actually changes thoroughness. The native provider deliberately ignores
@@ -122,6 +126,30 @@ collapsed under **Previously raised**. A repeat still halts unless an operator
122
126
  overrode that CRITICAL with `--override-review-block` earlier, in which case
123
127
  it is downgraded to a suggestion.
124
128
 
129
+ ### Earlier CRITICALs stay blocking
130
+
131
+ A CRITICAL that survived grounding and verification stays open across later
132
+ runs. Each run settles every open one: raised again at an overlapping
133
+ location and still critical, it halts as a repeat; raised there but refuted
134
+ or ungrounded by this run, it is resolved. Otherwise (absent, or raised below
135
+ critical) the critical-verifier re-checks the stored finding at the current
136
+ head: one call each at any depth, at most 10 per run, 3 in flight. Only a
137
+ `refuted` verdict resolves it; confirmed, uncertain, an unproven
138
+ confirmation, an error, a missing CLI or the cap carries it into the run's
139
+ findings as a blocking CRITICAL (errors and the cap also record a
140
+ `critical-verification` degraded gate). A later delta touching its location
141
+ never clears it: only a verifier refutation at the current head or an
142
+ operator override does, and `--override-review-block` covers a carried
143
+ CRITICAL like any other. A resolved one is labelled `fixed` when its instance
144
+ files changed since the head that raised it, else `refuted` (reporting only).
145
+ The history keeps each CRITICAL's title, body (4,000 characters), location
146
+ and claim for the re-check, plus each run's outcomes; an older history reads
147
+ as before. When the history holds any earlier surviving CRITICAL, the comment
148
+ renders an **Earlier CRITICALs** section (id, title, last location, raising
149
+ head, status `still open` / `fixed` / `refuted` / `overridden`), on a
150
+ zero-finding run too; a carried finding renders only there, and the
151
+ unqualified no-findings claim is suppressed while one is still open.
152
+
125
153
  ### Review dispositions
126
154
 
127
155
  When a Story lands, the post-land tail (before the temp purge reaps the
@@ -130,9 +158,11 @@ local, never-committed `<tempRoot>/review-dispositions.ndjson` (rotated at
130
158
  1 MB, one `.1` generation kept). Precedence, with the last run as the final
131
159
  review: `overridden` (an operator overrode it; the record carries the
132
160
  redacted reason, clipped to 500 characters), `downgraded-ungrounded` and
133
- `refuted-by-verifier` (flagged in the final run), `open-at-merge` (in the
134
- final run otherwise), `fixed-on-branch` (raised earlier, absent from the
135
- final run). A record holds ids, provider, severity, class and run count only,
161
+ `refuted-by-verifier` (flagged in the final run), then an earlier
162
+ CRITICAL's last re-check resolution (`fixed` → `fixed-on-branch`, `refuted` →
163
+ `refuted-by-verifier`), `open-at-merge` (in the final run otherwise,
164
+ including a carried CRITICAL), `fixed-on-branch` (raised earlier, absent from
165
+ the final run). A record holds ids, provider, severity, class and run count only,
136
166
  never a title, body, path or excerpt; a Story already recorded appends
137
167
  nothing. Summarize with
138
168
  `node .agents/scripts/review-dispositions-report.js [--since <YYYY-MM-DD>] [--json]`:
@@ -168,12 +198,36 @@ The pipeline will:
168
198
  close-validation gate, so the review does not re-run it).
169
199
  - Post a structured summary report to the `[TICKET_ID]` issue.
170
200
 
171
- **What the review did not check is posted, not silent.** A diff longer than
172
- 200,000 characters is truncated for the model bug review, and a `<callers>`
173
- block can hit a cap; each records a degradation (the unreviewed character and
174
- file counts, or the dropped symbols) beside the parsed findings. Those land
175
- in the **Degraded gates** section of the posted `verification-results`
176
- comment — that section is where every unreviewed slice appears.
201
+ **What the review did not check is posted, not silent.** Every degradation
202
+ lands in the **Degraded gates** section of the posted `verification-results`
203
+ comment with one of three kinds:
204
+
205
+ - `verdict-missing` — no verdict at all: the diff could not be read, the
206
+ `claude` CLI is not logged in or out of quota, the reviewer failed or its
207
+ output did not parse, every chunk failed, an optional chain entry such as
208
+ `llm-review` was skipped on a host without its CLI, or the base ref is
209
+ unresolvable. Close reports `gates.codeReview: "unreviewed"`.
210
+ - `coverage-partial` — part of the diff went unreviewed: one chunk failed
211
+ beside chunks that returned a verdict, files fell past the chunk bound, or a
212
+ chunk was truncated at the 200,000-character budget. Close reports
213
+ `"partial"`.
214
+ - `context-reduced` — reviewed with less context: a capped `<callers>`
215
+ block or truncated guidance. Close reports `"degraded"`.
216
+
217
+ Before recording a no-verdict, the `code-review` provider re-invokes the
218
+ reviewer **once** when the failure is transient-shaped (a non-zero exit that
219
+ is not a usage limit, an `is_error` result, a non-success subtype,
220
+ unparseable output). It never retries a failed auth preflight, a usage limit
221
+ or a timeout.
222
+
223
+ `delivery.codeReview.onNoVerdict` decides what a gap does. `report` (the
224
+ default) never halts. `block` halts handoff and close on any
225
+ `verdict-missing` or `coverage-partial` record with `haltCause:
226
+ "no-verdict"`: the blocker names the cause, its fix and the
227
+ `story-review-compute.js --story <id>` re-run command, handoff settles
228
+ `blocked` (no code change resolves it) and close refuses to arm auto-merge
229
+ unless re-run with `--override-review-block "<reason>"`. `context-reduced`
230
+ never halts.
177
231
 
178
232
  ### Story scope runs no lens pass
179
233
 
@@ -8,11 +8,10 @@ description: >-
8
8
  # Deliver digest (read once per session)
9
9
 
10
10
  > **Bundle, not a procedure.** [`deliver-story.md`](deliver-story.md) is still
11
- > the steps; this file is the material they reference, bundled so one read
12
- > covers the happy path. Situational material (lease preflight, recovery
13
- > routers, merge-wait budgets, CI remediation) stays on demand in
11
+ > the steps; this file bundles the material they reference. Situational
12
+ > material stays on demand in
14
13
  > [`deliver-story-reference.md`](deliver-story-reference.md) and
15
- > [`deliver-reference.md`](deliver-reference.md); read those only when routed.
14
+ > [`deliver-reference.md`](deliver-reference.md), read only when routed.
16
15
 
17
16
  ## 1. Dispatch — where the engine runs
18
17
 
@@ -21,12 +20,12 @@ rule produces it:
21
20
 
22
21
  1. **Run topology.** A one-Story run is `inline` (the router's own session)
23
22
  whatever its shape — isolation only matters against a *concurrent*
24
- sibling, and a one-Story run has none.
25
- 2. **Every other run is `subagent`**, however trivial each Story's shape.
23
+ sibling.
24
+ 2. **Every other run is `subagent`**, whatever each Story's shape.
26
25
 
27
26
  `inline` drops only the `story-worker` boot — not the verdict owner, which
28
27
  the profile alone names (§ 3). **`subagent` and `inline` run the same engine**: same gates,
29
- same PR to `main`, same terminal envelope.
28
+ same PR to `main`, same envelope.
30
29
 
31
30
  ## 2. Engine invariants
32
31
 
@@ -44,43 +43,41 @@ the only sanctioned landing.
44
43
 
45
44
  ## 3. Change set — computed once, handed to everyone
46
45
 
47
- One enumeration per Story: a critic that re-runs its own `git diff` can
48
- score a different set than the one that routed it. **One script** derives
49
- the change set, the level and the ceremony (close and critic hand-offs call
50
- it; the worker gets it from § 4's `--init`):
46
+ One enumeration per Story: a critic re-running `git diff` can score
47
+ another set. **One script** derives the change set, the level and the
48
+ ceremony (close and critic hand-offs call it; the worker gets it from § 4's
49
+ `--init`):
51
50
 
52
51
  ```bash
53
52
  node <main-repo>/.agents/scripts/ceremony-derive.js --story <storyId> --cwd <workCwd>
54
53
  ```
55
54
 
56
- It prints one JSON object: `files` — the one change set the verdict owner is
57
- handed (`null` when the diff could not be enumerated) — plus `level` and
55
+ It prints one object: `files` — the one change set handed to the verdict
56
+ owner (`null` when the diff is unenumerable) — plus `level` and
58
57
  `classes` from `review-depth.js`, and `mode`, `reason` and `verdictOwner`
59
- from `ceremony-routing.js`. Level rules: a sensitive path registered in
60
- `audit-rules.json` → `high`, none → `low`, an unenumerable diff → `null`.
61
- The level drives **review depth** only (close reads the same level): a
58
+ from `ceremony-routing.js`. Level: a sensitive
59
+ `audit-rules.json` path → `high`, else `low`; unenumerable → `null`.
60
+ The level drives **review depth** only (close reads it too): a
62
61
  sensitive footprint buys a **deep review**, not a fresh acceptance critic.
63
62
 
64
63
  > **The ceremony rule, stated once.** The **profile alone** names the verdict
65
64
  > owner: `minimal` / `standard` → `inline`, `strict` → `fresh`. Nothing else
66
65
  > moves it — not the change level, not sensitivity, **not the dispatch
67
- > mode**: an `inline` Story under `strict` still spawns the fresh critic. The
68
- > only inline authoring under `strict` is the harness fallback in
69
- > [`acceptance-self-eval.md`](acceptance-self-eval.md), noted in any friction
70
- > comment.
66
+ > mode**: an `inline` Story under `strict` still spawns the fresh critic,
67
+ > bar the harness fallback in [`acceptance-self-eval.md`](acceptance-self-eval.md).
71
68
 
72
69
  ## 4. Acceptance self-eval (Step 1a, required)
73
70
 
74
71
  **One verdict owner per Story** — named by `verdictOwner`: the inline
75
72
  self-eval under `minimal` / `standard` (the default), a fresh maker-blind
76
- critic under `strict`. Never both, and never a warm-up pass. Start from the
73
+ critic under `strict`. Never both. Start from the
77
74
  skeleton — it derives § 3's `files` and `verdictOwner` with the same function:
78
75
 
79
76
  `node <main-repo>/.agents/scripts/acceptance-eval.js --story <storyId> --init
80
77
  --cwd <workCwd>`
81
78
 
82
- It writes one empty record per `acceptance[]` item (plus the next round and
83
- HEAD) under `temp/scratch/story-<id>/`. The owner fills **every** record,
79
+ It writes one empty record per `acceptance[]` item and prints its
80
+ path. The owner fills **every** record,
84
81
  scored against that change set with `verify[]` output as evidence, and scores
85
82
  it in **one** gate call. Bounded by `delivery.acceptanceEval.maxRounds`
86
83
  (default 2; `0` scores once with no redraft).
@@ -90,8 +87,7 @@ it in **one** gate call. Bounded by `delivery.acceptanceEval.maxRounds`
90
87
 
91
88
  The gate reads the Story's `acceptance[]` count itself and rejects, **before**
92
89
  scoring and consuming no round, a verdict whose `criteria[]` length differs
93
- or with an unfilled record (naming its indices). A second gate call in the
94
- same round wastes it and races the Story ledger.
90
+ or with an unfilled record (naming its indices).
95
91
 
96
92
  `proceed` → § 5. `redraft` → one more round inside the cap. `block` → **do
97
93
  not close**: post a `friction` comment and flip `agent::blocked`.
@@ -99,44 +95,47 @@ Per-round mechanics: [`acceptance-self-eval.md`](acceptance-self-eval.md).
99
95
 
100
96
  ## 5. The one credited run — `story-handoff.js`
101
97
 
102
- After the self-eval loop's last fix commit the worker runs **one** command,
103
- which runs this section in order and prints one envelope:
98
+ After the self-eval's last fix commit the worker runs **one** command:
104
99
 
105
100
  `node <main-repo>/.agents/scripts/story-handoff.js --story <storyId> --cwd <workCwd>`
106
101
 
107
102
  `ready` (exit 0) → hand off. `fix-required` (exit 2) → a finding, a red or
108
- deferred suite, a base-merge conflict (files named), a non-fast-forward push
109
- or a CRITICAL: fix, commit, re-run; labels untouched. `blocked` (exit 1) →
110
- only a remote-refused push, an unreachable remote, an unconfirmed base branch
111
- or an unregistered merge driver: it flips `agent::blocked` and posts
112
- `friction`. A re-run skips every step still valid for HEAD. It never runs
113
- close, opens a PR or writes another label. Outruns the sync Bash ceiling → run
114
- it in the **background**.
115
-
116
- 1. **Base merge.** It will merge `origin/<baseBranch>` into the Story branch
117
- **first**, ahead of every check: close's base-sync then no-ops.
118
- 2. **Preflight — blocking.** `lint`/`format` (close's credit),
103
+ deferred suite, a base-merge conflict, a non-fast-forward push,
104
+ a `commit_refs_rules` push stepping missed or a CRITICAL: fix, commit,
105
+ re-run; labels untouched. `blocked` (exit 1) → only a remote-refused push,
106
+ an unreachable remote, an unconfirmed base branch, an unregistered merge
107
+ driver or `host-resources` (exit 77): it flips `agent::blocked` and posts
108
+ `friction`. A re-run skips every step still valid for HEAD. Past the sync ceiling → **background**, explicit timeout: parallel-tooling Rule 2.
109
+
110
+ 1. **Base merge:** merge `origin/<baseBranch>` into the Story branch
111
+ **first**, ahead of every check: close's base-sync then no-ops. Then close's **duplication re-score**, committed
112
+ **untagged** before any credit.
113
+ 2. **Preflight — blocking.** `typecheck`/`lint`/`format` (close's credit),
119
114
  `quality-preview.js --changed-since origin/<baseBranch>`, then each
120
- baselined ratchet — [`deliver-reference.md`](deliver-reference.md) § Preflight.
115
+ baselined ratchet; one `fix-required` lists every finding. Serial unless
116
+ a per-host `.agentrc.local.json` sets `delivery.execution.preflightConcurrency`
117
+ above 1 (default 1): close's independent gates then run in admitted
118
+ lanes beside the base lane — [`deliver-reference.md`](deliver-reference.md) § Preflight.
121
119
  3. **One depositor**, by the one predicate close registers `coverage-capture`
122
120
  on — coverage or CRAP gate on **and** a `captureScript`:
123
121
  - **Capture-active** →
124
122
  `node <main-repo>/.agents/scripts/coverage-capture.js --cwd <workCwd>`,
125
- behind the host full-suite lock. Signal: `Wrote content-digest capture
123
+ behind the full-suite lock. Signal: `Wrote content-digest capture
126
124
  stamp`. No second `npm test`.
127
125
  - **Otherwise** → `node <main-repo>/.agents/scripts/evidence-gate.js
128
- --standalone --scope-id <storyId> --gate test --worktree <workCwd> -- npm test`.
129
- Signal: `✓ test passed` — the `test` evidence close reads.
130
- 4. **Seat.** CRAP or MI gate on → `--seat-missing` for each (signal
131
- `seated: N`), committed as `chore(baselines): baseline-refresh: …`; then
132
- post-capture checks: close's `quality-preview-crap` and `check-baselines`.
126
+ --standalone --scope-id <storyId> --gate test --worktree <workCwd> -- npm test`;
127
+ a predicted capture skip runs `testChanged --changed-since` the
128
+ merge-base, else says why. Signal: `✓ test passed`.
129
+ 4. **Seat.** `--seat-missing` (`seated: N`): MI before step 2, CRAP and
130
+ capture-path coverage here, committed `chore(baselines): baseline-refresh:
131
+ …`; then post-capture checks: close's `quality-preview-crap` and `check-baselines`,
132
+ then `delivery.handoff.postSeatChecks`. Children get `MANDREL_HANDOFF_STEP`.
133
133
  5. **Push** `story-<id>`; the remote ref must equal HEAD.
134
- 6. **Held review** beside step 3, which a CRITICAL aborts —
135
- [`deliver-reference.md`](deliver-reference.md) § Held review.
134
+ 6. **Held review** from step 1, beside 2: a CRITICAL skips or aborts 3,
135
+ one envelope with any finding — [`deliver-reference.md`](deliver-reference.md) § Held review.
136
136
 
137
137
  A later commit voids any credit; a baseline-JSON seat keeps the stamp. It
138
- reads the **output**, not the exit code: a run that prints no signal
139
- deposits nothing. Seat order, runner shapes, redraft rounds:
138
+ reads the **output**, not the exit code: no signal deposits nothing. Seat order, runner shapes:
140
139
  [`deliver-reference.md`](deliver-reference.md) § Credited run.
141
140
 
142
141
  `verify[]` is scoped entries **plus** this one run: an entry that is a
@@ -148,7 +147,7 @@ respawned.
148
147
  `single-story-close.js` emits exactly one envelope on stdout between
149
148
  `--- STORY DELIVER TERMINAL ---` markers, schema-validated against
150
149
  [`story-deliver-terminal.schema.json`](../../schemas/story-deliver-terminal.schema.json)
151
- — the SSOT. Relay it verbatim; never hand-compose one or substitute prose.
150
+ — the SSOT. Relay it verbatim; never hand-compose one.
152
151
 
153
152
  | `status` | Exit | Meaning | You do |
154
153
  | --- | --- | --- | --- |
@@ -161,12 +160,12 @@ Required fields: `kind` (`story-deliver-terminal`), `storyId`, `status`,
161
160
  `phase` (the schema's enum names where it stopped), `elapsedSeconds`,
162
161
  `nextCommand`. `gates`
163
162
  reports every gate as `passed` / `failed` / `skipped` — a skipped gate is
164
- reported, never omitted, so a missing gate is never read as a passing one.
163
+ never omitted, so a missing gate never reads as passing.
165
164
 
166
165
  ## 7. When to leave this file
167
166
 
168
- Unclear state / a re-run refusal → `deliver-recover.js --story <id>`
169
- (read-only). Lease, sweep, worktree scope; sequencing, epilogue, checklist
170
- threading → [`deliver-story-reference.md`](deliver-story-reference.md) and
167
+ Unclear state / a re-run refusal → `deliver-recover.js --story <id>`; boot
168
+ auto-lists stalled `agent::executing` Stories with it (read-only, advisory).
169
+ Lease, sweep, worktree scope; sequencing, epilogue, checklist threading → [`deliver-story-reference.md`](deliver-story-reference.md) and
171
170
  [`deliver-reference.md`](deliver-reference.md). CI red after the PR opens →
172
171
  [`rules/ci-remediation.md`](../../rules/ci-remediation.md).