mandrel 1.94.0 → 2.0.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 (393) hide show
  1. package/.agents/README.md +59 -73
  2. package/.agents/agents/story-worker.md +12 -13
  3. package/.agents/docs/SDLC.md +489 -1285
  4. package/.agents/docs/agentrc-reference.json +177 -67
  5. package/.agents/docs/configuration.md +104 -138
  6. package/.agents/docs/execution-reference.md +17 -20
  7. package/.agents/docs/quality-gates.md +13 -19
  8. package/.agents/docs/workflows.md +3 -3
  9. package/.agents/instructions.md +70 -81
  10. package/.agents/rules/ci-remediation.md +8 -12
  11. package/.agents/rules/git-conventions-reference.md +6 -7
  12. package/.agents/rules/git-conventions.md +16 -22
  13. package/.agents/schemas/acceptance-eval-verdict.schema.json +1 -1
  14. package/.agents/schemas/agentrc.schema.json +54 -214
  15. package/.agents/schemas/lifecycle/ledger-record.schema.json +1 -1
  16. package/.agents/schemas/lifecycle/retro.end.schema.json +1 -1
  17. package/.agents/schemas/risk-verdict.schema.json +0 -13
  18. package/.agents/scripts/analyze-execution.js +1 -1
  19. package/.agents/scripts/audit-to-stories.js +7 -7
  20. package/.agents/scripts/boot-sweep.js +1 -1
  21. package/.agents/scripts/check-lifecycle-lint.js +6 -9
  22. package/.agents/scripts/check-prepush-recovery.js +1 -1
  23. package/.agents/scripts/cleanup-repo-test-temp.js +6 -1
  24. package/.agents/scripts/lib/Logger.js +6 -10
  25. package/.agents/scripts/lib/audit-suite/runner.js +2 -2
  26. package/.agents/scripts/lib/audit-suite/selector.js +5 -5
  27. package/.agents/scripts/lib/audit-to-stories/{seed-epic-from-findings.js → seed-from-findings.js} +9 -9
  28. package/.agents/scripts/lib/baselines/kernel.js +206 -18
  29. package/.agents/scripts/lib/baselines/kinds/maintainability.js +0 -4
  30. package/.agents/scripts/lib/baselines/reader.js +1 -6
  31. package/.agents/scripts/lib/bdd-runner-detect.js +5 -9
  32. package/.agents/scripts/lib/bootstrap/issue-forms-template.js +32 -33
  33. package/.agents/scripts/lib/checks/core-bare-clean.js +2 -2
  34. package/.agents/scripts/lib/checks/index.js +2 -1
  35. package/.agents/scripts/lib/checks/story-init-not-backgrounded.js +23 -21
  36. package/.agents/scripts/lib/cli/standard-args.js +13 -22
  37. package/.agents/scripts/lib/cli-args.js +16 -7
  38. package/.agents/scripts/lib/close-validation/gates.js +2 -2
  39. package/.agents/scripts/lib/config/ci.js +6 -31
  40. package/.agents/scripts/lib/config/delivery-routing.js +45 -29
  41. package/.agents/scripts/lib/config/explain.js +55 -36
  42. package/.agents/scripts/lib/config/limits.js +17 -58
  43. package/.agents/scripts/lib/config/paths.js +0 -2
  44. package/.agents/scripts/lib/config/quality.js +1 -1
  45. package/.agents/scripts/lib/config/runners.js +17 -50
  46. package/.agents/scripts/lib/config/temp-paths.js +19 -14
  47. package/.agents/scripts/lib/config/worktree-isolation.js +0 -5
  48. package/.agents/scripts/lib/config-resolver.js +2 -7
  49. package/.agents/scripts/lib/config-settings-schema-delivery.js +24 -148
  50. package/.agents/scripts/lib/config-settings-schema-quality.js +8 -14
  51. package/.agents/scripts/lib/config-settings-schema.js +52 -38
  52. package/.agents/scripts/lib/dependency-parser.js +3 -2
  53. package/.agents/scripts/lib/doc-tiers.js +2 -2
  54. package/.agents/scripts/lib/duplicate-search.js +211 -41
  55. package/.agents/scripts/lib/feedback-loop/retro-proposals-graduator.js +1 -1
  56. package/.agents/scripts/lib/findings/promote-finding.js +5 -5
  57. package/.agents/scripts/lib/framework-version.js +2 -3
  58. package/.agents/scripts/lib/git-branch-cleanup.js +1 -10
  59. package/.agents/scripts/lib/git-branch-lifecycle.js +17 -22
  60. package/.agents/scripts/lib/git-utils.js +32 -6
  61. package/.agents/scripts/lib/github/framework-repo.js +6 -0
  62. package/.agents/scripts/lib/label-constants.js +10 -23
  63. package/.agents/scripts/lib/label-taxonomy.js +9 -43
  64. package/.agents/scripts/lib/observability/active-story-env.js +1 -1
  65. package/.agents/scripts/lib/observability/hook-heartbeat.js +20 -52
  66. package/.agents/scripts/lib/observability/source-classifier.js +3 -3
  67. package/.agents/scripts/lib/onboard/init-tail.js +1 -3
  68. package/.agents/scripts/lib/orchestration/audit-lens-routing.js +128 -0
  69. package/.agents/scripts/lib/orchestration/bookkeeping-outbox.js +8 -5
  70. package/.agents/scripts/lib/orchestration/ceremony-routing.js +83 -20
  71. package/.agents/scripts/lib/orchestration/code-review.js +20 -268
  72. package/.agents/scripts/lib/orchestration/column-sync.js +1 -1
  73. package/.agents/scripts/lib/orchestration/consolidation-precondition.js +1 -1
  74. package/.agents/scripts/lib/orchestration/context-envelope.js +2 -5
  75. package/.agents/scripts/lib/orchestration/docs-digest.js +8 -8
  76. package/.agents/scripts/lib/orchestration/file-assumptions.js +7 -13
  77. package/.agents/scripts/lib/orchestration/git-cleanup/phases/cli.js +1 -1
  78. package/.agents/scripts/lib/orchestration/lifecycle/emit-loop-tick.js +8 -8
  79. package/.agents/scripts/lib/orchestration/lifecycle/emit-story-heartbeat.js +2 -2
  80. package/.agents/scripts/lib/orchestration/lifecycle/ledger-writer.js +6 -3
  81. package/.agents/scripts/lib/orchestration/lifecycle/listeners/README.md +17 -43
  82. package/.agents/scripts/lib/orchestration/lint-baseline-service.js +4 -4
  83. package/.agents/scripts/lib/orchestration/merge-block-class.js +1 -1
  84. package/.agents/scripts/lib/orchestration/phase-runner.js +3 -2
  85. package/.agents/scripts/lib/orchestration/plan-context.js +248 -266
  86. package/.agents/scripts/lib/orchestration/plan-critics-evaluate.js +1 -1
  87. package/.agents/scripts/lib/orchestration/plan-navigation.js +92 -0
  88. package/.agents/scripts/lib/orchestration/plan-persist/fan-out-gate.js +61 -0
  89. package/.agents/scripts/lib/orchestration/plan-persist/persist-helpers.js +97 -0
  90. package/.agents/scripts/lib/orchestration/plan-persist/run-plan-persist.js +223 -854
  91. package/.agents/scripts/lib/orchestration/plan-persist/story-ops.js +361 -0
  92. package/.agents/scripts/lib/orchestration/plan-persist/summary.js +35 -108
  93. package/.agents/scripts/lib/orchestration/plan-reachability.js +9 -14
  94. package/.agents/scripts/lib/orchestration/plan-runner/worktree-sweep.js +1 -1
  95. package/.agents/scripts/lib/orchestration/{epic-plan-spec/phases → planning}/authoring-context.js +13 -13
  96. package/.agents/scripts/lib/orchestration/planning/decomposer-context.js +27 -0
  97. package/.agents/scripts/lib/orchestration/{epic-plan-spec/phases → planning}/risk-verdict.js +3 -4
  98. package/.agents/scripts/lib/orchestration/post-merge/phases/branch-cleanup.js +2 -2
  99. package/.agents/scripts/lib/orchestration/post-merge/phases/dashboard-refresh.js +8 -20
  100. package/.agents/scripts/lib/orchestration/post-merge/phases/worktree-reap.js +3 -2
  101. package/.agents/scripts/lib/orchestration/pr-base-guard.js +18 -28
  102. package/.agents/scripts/lib/orchestration/preflight-cache.js +5 -5
  103. package/.agents/scripts/lib/orchestration/remote-verifier.js +1 -1
  104. package/.agents/scripts/lib/orchestration/resolve-plan-run.js +155 -0
  105. package/.agents/scripts/lib/orchestration/resolves-token.js +1 -1
  106. package/.agents/scripts/lib/orchestration/retro-perf-heuristics.js +8 -8
  107. package/.agents/scripts/lib/orchestration/retro-proposals.js +140 -79
  108. package/.agents/scripts/lib/orchestration/review-depth.js +26 -12
  109. package/.agents/scripts/lib/orchestration/review-providers/codex.js +2 -2
  110. package/.agents/scripts/lib/orchestration/review-providers/review-provider-factory.js +21 -56
  111. package/.agents/scripts/lib/orchestration/run-epilogue.js +426 -0
  112. package/.agents/scripts/lib/orchestration/single-story-close/phases/auto-merge.js +1 -1
  113. package/.agents/scripts/lib/orchestration/single-story-close/phases/code-review.js +95 -41
  114. package/.agents/scripts/lib/orchestration/single-story-close/phases/options.js +16 -13
  115. package/.agents/scripts/lib/orchestration/single-story-close/phases/review-block.js +40 -0
  116. package/.agents/scripts/lib/orchestration/single-story-close/runner.js +11 -3
  117. package/.agents/scripts/lib/orchestration/spec-freshness.js +14 -205
  118. package/.agents/scripts/lib/orchestration/spec-section-validator.js +4 -5
  119. package/.agents/scripts/lib/orchestration/spec-spill.js +60 -0
  120. package/.agents/scripts/lib/orchestration/split-policy-validator.js +188 -0
  121. package/.agents/scripts/lib/orchestration/story-close/emit-blocked.js +49 -0
  122. package/.agents/scripts/lib/orchestration/story-close/phases/code-review.js +15 -12
  123. package/.agents/scripts/lib/orchestration/story-follow-ups.js +237 -0
  124. package/.agents/scripts/lib/orchestration/story-init-remote.js +47 -0
  125. package/.agents/scripts/lib/orchestration/story-plan-state.js +48 -0
  126. package/.agents/scripts/lib/orchestration/{epic-runner → story-progress}/story-run-progress-writer.js +3 -3
  127. package/.agents/scripts/lib/orchestration/structured-comment-parser.js +1 -1
  128. package/.agents/scripts/lib/orchestration/task-body-validator.js +8 -18
  129. package/.agents/scripts/lib/orchestration/ticket-validator-conflicts.js +11 -61
  130. package/.agents/scripts/lib/orchestration/ticket-validator-sizing.js +189 -373
  131. package/.agents/scripts/lib/orchestration/ticket-validator.js +2 -7
  132. package/.agents/scripts/lib/orchestration/ticketing/bulk.js +0 -25
  133. package/.agents/scripts/lib/orchestration/ticketing/reads.js +29 -26
  134. package/.agents/scripts/lib/orchestration/ticketing/transition.js +5 -5
  135. package/.agents/scripts/lib/planning-corpus.js +16 -11
  136. package/.agents/scripts/lib/preflight-runner.js +2 -2
  137. package/.agents/scripts/lib/qa/coverage-verdict.js +5 -5
  138. package/.agents/scripts/lib/single-story/confirm-merge-follow-ups.js +36 -0
  139. package/.agents/scripts/lib/single-story-sweep/protection-ctx.js +1 -1
  140. package/.agents/scripts/lib/story-adjacency.js +11 -14
  141. package/.agents/scripts/lib/story-body/story-body.js +124 -70
  142. package/.agents/scripts/lib/story-plan.js +2 -4
  143. package/.agents/scripts/lib/templates/decomposer-prompts.js +46 -45
  144. package/.agents/scripts/lib/templates/spec-author-prompts.js +47 -45
  145. package/.agents/scripts/lib/{epic-body-sections.js → ticket-body-sections.js} +26 -26
  146. package/.agents/scripts/lib/validation-evidence.js +1 -1
  147. package/.agents/scripts/lib/wave-runner/ready-set.js +6 -6
  148. package/.agents/scripts/lib/workspace-provisioner.js +1 -1
  149. package/.agents/scripts/lib/worktree/lifecycle/reap.js +5 -7
  150. package/.agents/scripts/lint-issue-body.js +71 -40
  151. package/.agents/scripts/mandrel-update-preflight.js +1 -1
  152. package/.agents/scripts/notify.js +4 -3
  153. package/.agents/scripts/plan-context.js +64 -74
  154. package/.agents/scripts/plan-persist.js +121 -280
  155. package/.agents/scripts/plan-run-epilogue.js +97 -0
  156. package/.agents/scripts/providers/github/issues.js +17 -33
  157. package/.agents/scripts/providers/github/mappers.js +0 -12
  158. package/.agents/scripts/providers/github/tickets.js +2 -5
  159. package/.agents/scripts/resolve-plan-run.js +117 -0
  160. package/.agents/scripts/signals-view.js +24 -19
  161. package/.agents/scripts/single-story-close.js +11 -14
  162. package/.agents/scripts/single-story-confirm-merge.js +39 -23
  163. package/.agents/scripts/single-story-init.js +29 -20
  164. package/.agents/scripts/stories-wave-tick.js +6 -6
  165. package/.agents/scripts/story-plan.js +26 -47
  166. package/.agents/scripts/update-ticket-state.js +6 -15
  167. package/.agents/skills/core/analyze-execution/SKILL.md +21 -18
  168. package/.agents/skills/core/idea-refinement/SKILL.md +6 -6
  169. package/.agents/skills/core/scope-triage/SKILL.md +28 -172
  170. package/.agents/skills/skills.index.json +3 -43
  171. package/.agents/starter-agentrc.json +0 -5
  172. package/.agents/templates/agent-protocol.md +9 -10
  173. package/.agents/workflows/audit-architecture.md +3 -3
  174. package/.agents/workflows/audit-clean-code.md +3 -3
  175. package/.agents/workflows/audit-dependencies.md +3 -3
  176. package/.agents/workflows/audit-devops.md +3 -3
  177. package/.agents/workflows/audit-documentation.md +5 -5
  178. package/.agents/workflows/audit-lighthouse.md +3 -3
  179. package/.agents/workflows/audit-navigability.md +3 -2
  180. package/.agents/workflows/audit-performance.md +3 -3
  181. package/.agents/workflows/audit-privacy.md +3 -3
  182. package/.agents/workflows/audit-quality.md +3 -3
  183. package/.agents/workflows/audit-security.md +3 -3
  184. package/.agents/workflows/audit-seo.md +3 -3
  185. package/.agents/workflows/audit-sre.md +3 -3
  186. package/.agents/workflows/audit-to-stories.md +20 -20
  187. package/.agents/workflows/audit-ux-ui.md +3 -3
  188. package/.agents/workflows/deliver.md +122 -174
  189. package/.agents/workflows/git-cleanup.md +3 -4
  190. package/.agents/workflows/helpers/_merge-conflict-template.md +1 -1
  191. package/.agents/workflows/helpers/acceptance-self-eval.md +16 -29
  192. package/.agents/workflows/helpers/code-review.md +70 -193
  193. package/.agents/workflows/helpers/{single-story-deliver-reference.md → deliver-story-reference.md} +12 -14
  194. package/.agents/workflows/helpers/{single-story-deliver.md → deliver-story.md} +113 -139
  195. package/.agents/workflows/helpers/diagnose.md +10 -10
  196. package/.agents/workflows/helpers/parallel-tooling.md +1 -1
  197. package/.agents/workflows/helpers/signals.md +16 -16
  198. package/.agents/workflows/helpers/worktree-lifecycle.md +48 -64
  199. package/.agents/workflows/mandrel-update.md +2 -1
  200. package/.agents/workflows/plan.md +112 -145
  201. package/.agents/workflows/qa-assist.md +24 -30
  202. package/.agents/workflows/qa-explore.md +29 -38
  203. package/.agents/workflows/qa-run.md +2 -2
  204. package/README.md +9 -8
  205. package/docs/CHANGELOG.md +30 -0
  206. package/lib/migrations/index.js +6 -5
  207. package/package.json +2 -2
  208. package/.agents/agents/retro.md +0 -42
  209. package/.agents/personas/architect.md +0 -113
  210. package/.agents/personas/devops-engineer.md +0 -38
  211. package/.agents/personas/engineer.md +0 -33
  212. package/.agents/personas/project-manager.md +0 -114
  213. package/.agents/personas/qa-engineer.md +0 -95
  214. package/.agents/personas/security-engineer.md +0 -111
  215. package/.agents/personas/technical-writer.md +0 -101
  216. package/.agents/schemas/dispatch-manifest.json +0 -232
  217. package/.agents/schemas/epic-spec.schema.json +0 -153
  218. package/.agents/schemas/lifecycle/slice.end.schema.json +0 -21
  219. package/.agents/schemas/lifecycle/slice.heartbeat.schema.json +0 -20
  220. package/.agents/schemas/lifecycle/slice.start.schema.json +0 -17
  221. package/.agents/scripts/acceptance-spec-reconciler.js +0 -642
  222. package/.agents/scripts/bookkeeping-reconcile.js +0 -117
  223. package/.agents/scripts/dispatcher.js +0 -295
  224. package/.agents/scripts/epic-audit-prepare.js +0 -497
  225. package/.agents/scripts/epic-audit-recheck.js +0 -274
  226. package/.agents/scripts/epic-deliver-note-intervention.js +0 -192
  227. package/.agents/scripts/epic-deliver-preflight.js +0 -462
  228. package/.agents/scripts/epic-deliver-prepare.js +0 -852
  229. package/.agents/scripts/epic-execute-record-wave.js +0 -449
  230. package/.agents/scripts/epic-plan-clarity.js +0 -211
  231. package/.agents/scripts/epic-plan-healthcheck.js +0 -581
  232. package/.agents/scripts/epic-reconcile.js +0 -625
  233. package/.agents/scripts/lib/baseline-snapshot.js +0 -979
  234. package/.agents/scripts/lib/checks/epic-merge-lock-stale.js +0 -54
  235. package/.agents/scripts/lib/checks/stale-origin-epic.js +0 -49
  236. package/.agents/scripts/lib/config/lifecycle.js +0 -40
  237. package/.agents/scripts/lib/config/preflight.js +0 -58
  238. package/.agents/scripts/lib/config/retro.js +0 -77
  239. package/.agents/scripts/lib/epic-merge-lock.js +0 -322
  240. package/.agents/scripts/lib/epic-plan-clarity.js +0 -181
  241. package/.agents/scripts/lib/epic-plan-ideation.js +0 -261
  242. package/.agents/scripts/lib/orchestration/context-hydration-engine.js +0 -539
  243. package/.agents/scripts/lib/orchestration/deliver-route.js +0 -173
  244. package/.agents/scripts/lib/orchestration/dispatch-engine.js +0 -134
  245. package/.agents/scripts/lib/orchestration/dispatch-pipeline.js +0 -183
  246. package/.agents/scripts/lib/orchestration/epic-cleanup.js +0 -801
  247. package/.agents/scripts/lib/orchestration/epic-deliver-lease-guard.js +0 -310
  248. package/.agents/scripts/lib/orchestration/epic-plan-decompose/phases/context.js +0 -163
  249. package/.agents/scripts/lib/orchestration/epic-plan-decompose/phases/creation.js +0 -140
  250. package/.agents/scripts/lib/orchestration/epic-plan-decompose/phases/dag.js +0 -64
  251. package/.agents/scripts/lib/orchestration/epic-plan-decompose/phases/diagnostics.js +0 -72
  252. package/.agents/scripts/lib/orchestration/epic-plan-decompose/phases/persist-helpers.js +0 -156
  253. package/.agents/scripts/lib/orchestration/epic-plan-decompose/phases/persist.js +0 -345
  254. package/.agents/scripts/lib/orchestration/epic-plan-decompose/phases/planning-artifacts.js +0 -41
  255. package/.agents/scripts/lib/orchestration/epic-plan-decompose/phases/reconcile-spawn.js +0 -86
  256. package/.agents/scripts/lib/orchestration/epic-plan-lease-guard.js +0 -391
  257. package/.agents/scripts/lib/orchestration/epic-plan-spec/phases/drain.js +0 -94
  258. package/.agents/scripts/lib/orchestration/epic-plan-spec/phases/plan-epic.js +0 -236
  259. package/.agents/scripts/lib/orchestration/epic-plan-spec/phases/run-spec-phase.js +0 -307
  260. package/.agents/scripts/lib/orchestration/epic-plan-spec/phases/spec-freshness.js +0 -117
  261. package/.agents/scripts/lib/orchestration/epic-plan-state-store.js +0 -117
  262. package/.agents/scripts/lib/orchestration/epic-run-state-store.js +0 -621
  263. package/.agents/scripts/lib/orchestration/epic-runner/concurrency-gate.js +0 -186
  264. package/.agents/scripts/lib/orchestration/epic-runner/deliver-phases.js +0 -50
  265. package/.agents/scripts/lib/orchestration/epic-runner/phases/build-wave-dag.js +0 -129
  266. package/.agents/scripts/lib/orchestration/epic-runner/phases/snapshot.js +0 -103
  267. package/.agents/scripts/lib/orchestration/epic-runner/progress-reporter/composition.js +0 -267
  268. package/.agents/scripts/lib/orchestration/epic-runner/progress-reporter/signals.js +0 -210
  269. package/.agents/scripts/lib/orchestration/epic-runner/progress-reporter/transport.js +0 -238
  270. package/.agents/scripts/lib/orchestration/epic-runner/progress-signals/_bullet-format.js +0 -32
  271. package/.agents/scripts/lib/orchestration/epic-runner/progress-signals/component-drift.js +0 -203
  272. package/.agents/scripts/lib/orchestration/epic-runner/progress-signals/crap-drift.js +0 -227
  273. package/.agents/scripts/lib/orchestration/epic-runner/progress-signals/maintainability-drift.js +0 -117
  274. package/.agents/scripts/lib/orchestration/epic-runner/progress-signals/stalled-worktree.js +0 -37
  275. package/.agents/scripts/lib/orchestration/epic-runner/story-launcher.js +0 -127
  276. package/.agents/scripts/lib/orchestration/epic-runner/sub-agent-return.js +0 -276
  277. package/.agents/scripts/lib/orchestration/epic-runner/wave-scheduler.js +0 -66
  278. package/.agents/scripts/lib/orchestration/epic-spec-reconciler-apply.js +0 -789
  279. package/.agents/scripts/lib/orchestration/epic-spec-reconciler-diff.js +0 -676
  280. package/.agents/scripts/lib/orchestration/epic-spec-reconciler-discriminator.js +0 -389
  281. package/.agents/scripts/lib/orchestration/epic-spec-reconciler-format.js +0 -230
  282. package/.agents/scripts/lib/orchestration/epic-spec-reconciler-ops.js +0 -361
  283. package/.agents/scripts/lib/orchestration/finalize/open-or-locate-pr.js +0 -306
  284. package/.agents/scripts/lib/orchestration/finalize/post-handoff-comment.js +0 -489
  285. package/.agents/scripts/lib/orchestration/finalize/sanitize-skip-ci.js +0 -88
  286. package/.agents/scripts/lib/orchestration/lifecycle/emit-slice-lifecycle.js +0 -270
  287. package/.agents/scripts/lib/orchestration/lifecycle/emit-story-dispatch-end.js +0 -147
  288. package/.agents/scripts/lib/orchestration/lifecycle/listeners/acceptance-reconciler.js +0 -465
  289. package/.agents/scripts/lib/orchestration/lifecycle/listeners/automerge-armer.js +0 -501
  290. package/.agents/scripts/lib/orchestration/lifecycle/listeners/automerge-predicate.js +0 -984
  291. package/.agents/scripts/lib/orchestration/lifecycle/listeners/branch-cleaner.js +0 -264
  292. package/.agents/scripts/lib/orchestration/lifecycle/listeners/checkpoint-pointer-writer.js +0 -284
  293. package/.agents/scripts/lib/orchestration/lifecycle/listeners/cleaner.js +0 -355
  294. package/.agents/scripts/lib/orchestration/lifecycle/listeners/finalizer.js +0 -673
  295. package/.agents/scripts/lib/orchestration/lifecycle/listeners/index.js +0 -378
  296. package/.agents/scripts/lib/orchestration/lifecycle/listeners/intervention-recorder.js +0 -140
  297. package/.agents/scripts/lib/orchestration/lifecycle/listeners/label-transitioner.js +0 -144
  298. package/.agents/scripts/lib/orchestration/lifecycle/listeners/notify-dispatcher.js +0 -174
  299. package/.agents/scripts/lib/orchestration/manifest-builder.js +0 -222
  300. package/.agents/scripts/lib/orchestration/plan-persist/amend.js +0 -359
  301. package/.agents/scripts/lib/orchestration/plan-persist/delivery-mode.js +0 -127
  302. package/.agents/scripts/lib/orchestration/post-merge-pipeline.js +0 -205
  303. package/.agents/scripts/lib/orchestration/recurring-failure-detector.js +0 -152
  304. package/.agents/scripts/lib/orchestration/retro/phases/checks.js +0 -94
  305. package/.agents/scripts/lib/orchestration/retro/phases/compose-body.js +0 -571
  306. package/.agents/scripts/lib/orchestration/retro/phases/gather-signals.js +0 -450
  307. package/.agents/scripts/lib/orchestration/retro/phases/post-and-mirror.js +0 -191
  308. package/.agents/scripts/lib/orchestration/retro-heuristics.js +0 -57
  309. package/.agents/scripts/lib/orchestration/retro-runner.js +0 -197
  310. package/.agents/scripts/lib/orchestration/spec-renderer.js +0 -447
  311. package/.agents/scripts/lib/orchestration/story-close/auto-refresh-runner.js +0 -747
  312. package/.agents/scripts/lib/orchestration/story-close/baseline-attribution/phases/gate-failure.js +0 -211
  313. package/.agents/scripts/lib/orchestration/story-close/baseline-attribution/phases/pre-merge-attribution.js +0 -158
  314. package/.agents/scripts/lib/orchestration/story-close/baseline-attribution/phases/refresh-commit.js +0 -446
  315. package/.agents/scripts/lib/orchestration/story-close/baseline-attribution/phases/regression-projection.js +0 -297
  316. package/.agents/scripts/lib/orchestration/story-close/baseline-attribution/phases/scope-discovery.js +0 -48
  317. package/.agents/scripts/lib/orchestration/story-close/baseline-attribution-wiring.js +0 -67
  318. package/.agents/scripts/lib/orchestration/story-close/baseline-attribution.js +0 -161
  319. package/.agents/scripts/lib/orchestration/story-close/baseline-friction-body.js +0 -117
  320. package/.agents/scripts/lib/orchestration/story-close/cd-out-guard.js +0 -86
  321. package/.agents/scripts/lib/orchestration/story-close/cleanup-reconciler.js +0 -147
  322. package/.agents/scripts/lib/orchestration/story-close/close-inputs.js +0 -142
  323. package/.agents/scripts/lib/orchestration/story-close/comment-bodies.js +0 -62
  324. package/.agents/scripts/lib/orchestration/story-close/merge-runner.js +0 -658
  325. package/.agents/scripts/lib/orchestration/story-close/merge-subject.js +0 -198
  326. package/.agents/scripts/lib/orchestration/story-close/phases/branch-restore.js +0 -105
  327. package/.agents/scripts/lib/orchestration/story-close/phases/close.js +0 -222
  328. package/.agents/scripts/lib/orchestration/story-close/phases/gates.js +0 -292
  329. package/.agents/scripts/lib/orchestration/story-close/phases/locked-pipeline.js +0 -270
  330. package/.agents/scripts/lib/orchestration/story-close/phases/preflight.js +0 -110
  331. package/.agents/scripts/lib/orchestration/story-close/phases/refresh.js +0 -86
  332. package/.agents/scripts/lib/orchestration/story-close/phases/timeout-blocked-emitter.js +0 -112
  333. package/.agents/scripts/lib/orchestration/story-close/phases/timeout-blocked.js +0 -157
  334. package/.agents/scripts/lib/orchestration/story-close/post-merge-close.js +0 -421
  335. package/.agents/scripts/lib/orchestration/story-close/pre-merge-validation.js +0 -302
  336. package/.agents/scripts/lib/orchestration/story-close/shared-checkout-guard.js +0 -163
  337. package/.agents/scripts/lib/orchestration/story-close-recovery.js +0 -690
  338. package/.agents/scripts/lib/orchestration/wave-marker.js +0 -28
  339. package/.agents/scripts/lib/orchestration/wave-record-io.js +0 -218
  340. package/.agents/scripts/lib/orchestration/wave-record-notifications.js +0 -145
  341. package/.agents/scripts/lib/orchestration/wave-record-projection.js +0 -212
  342. package/.agents/scripts/lib/presentation/dispatch-manifest-render.js +0 -111
  343. package/.agents/scripts/lib/presentation/manifest-builder.js +0 -239
  344. package/.agents/scripts/lib/presentation/manifest-formatter.js +0 -242
  345. package/.agents/scripts/lib/presentation/manifest-helpers.js +0 -213
  346. package/.agents/scripts/lib/presentation/manifest-persistence.js +0 -261
  347. package/.agents/scripts/lib/presentation/manifest-procedures.js +0 -55
  348. package/.agents/scripts/lib/presentation/manifest-render-waves.js +0 -306
  349. package/.agents/scripts/lib/presentation/manifest-renderer.js +0 -188
  350. package/.agents/scripts/lib/presentation/manifest-story-views.js +0 -110
  351. package/.agents/scripts/lib/push-epic-retry.js +0 -209
  352. package/.agents/scripts/lib/spec/index.js +0 -36
  353. package/.agents/scripts/lib/spec/loader.js +0 -425
  354. package/.agents/scripts/lib/spec/state.js +0 -208
  355. package/.agents/scripts/lib/story-init/blocker-validator.js +0 -68
  356. package/.agents/scripts/lib/story-init/branch-initializer.js +0 -408
  357. package/.agents/scripts/lib/story-init/context-resolver.js +0 -92
  358. package/.agents/scripts/lib/story-init/donor-precheck.js +0 -207
  359. package/.agents/scripts/lib/story-init/state-transitioner.js +0 -80
  360. package/.agents/scripts/lib/story-init/task-graph-builder.js +0 -124
  361. package/.agents/scripts/lib/story-init/transition-summary.js +0 -34
  362. package/.agents/scripts/lib/test-reserved-epic-temp-ids.js +0 -35
  363. package/.agents/scripts/lib/wave-runner/tick.js +0 -754
  364. package/.agents/scripts/lib/wave-runner/wave-runner-error.js +0 -20
  365. package/.agents/scripts/lifecycle-emit-story-dispatch.js +0 -194
  366. package/.agents/scripts/lifecycle-emit.js +0 -510
  367. package/.agents/scripts/retro-run.js +0 -218
  368. package/.agents/scripts/slice-phase.js +0 -361
  369. package/.agents/scripts/standalone-feedback-rollup.js +0 -188
  370. package/.agents/scripts/story-close.js +0 -294
  371. package/.agents/scripts/story-init.js +0 -599
  372. package/.agents/scripts/story-phase.js +0 -369
  373. package/.agents/scripts/wave-tick.js +0 -464
  374. package/.agents/skills/core/epic-plan-consolidate/SKILL.md +0 -172
  375. package/.agents/skills/core/epic-plan-consolidate/examples.md +0 -51
  376. package/.agents/skills/core/epic-plan-decompose-author/SKILL.md +0 -441
  377. package/.agents/skills/core/epic-plan-decompose-author/examples.md +0 -47
  378. package/.agents/skills/core/epic-plan-premortem/SKILL.md +0 -146
  379. package/.agents/skills/core/epic-plan-premortem/examples.md +0 -53
  380. package/.agents/skills/core/epic-plan-spec-author/SKILL.md +0 -383
  381. package/.agents/skills/core/epic-plan-spec-author/examples.md +0 -91
  382. package/.agents/workflows/helpers/deliver-epic-reference.md +0 -547
  383. package/.agents/workflows/helpers/deliver-epic-single.md +0 -331
  384. package/.agents/workflows/helpers/deliver-epic.md +0 -998
  385. package/.agents/workflows/helpers/deliver-stories.md +0 -450
  386. package/.agents/workflows/helpers/epic-audit.md +0 -189
  387. package/.agents/workflows/helpers/epic-deliver-story.md +0 -436
  388. package/.agents/workflows/helpers/epic-testing.md +0 -125
  389. package/.agents/workflows/helpers/plan-epic-reference.md +0 -160
  390. package/.agents/workflows/helpers/plan-epic.md +0 -353
  391. package/.agents/workflows/helpers/plan-story.md +0 -251
  392. package/.agents/workflows/helpers/scope-triage-gate.md +0 -108
  393. /package/.agents/scripts/lib/orchestration/{epic-plan-spec/phases → planning}/spec-authoring-grounding.js +0 -0
@@ -1,53 +1,43 @@
1
1
  ---
2
2
  description:
3
- Execute a standalone Story (no parent Epic) end-to-end. Creates a branch
4
- from main, implements the changes in a worktree, runs gates, pushes, and
5
- opens a PR directly against main.
3
+ Execute one Story end-to-end. Creates story-<id> from main, implements in a
4
+ worktree (optional ## Slicing checkpoints), runs risk-routed ceremony, opens
5
+ a PR against main, and lands.
6
6
  ---
7
7
 
8
- # /single-story-deliver #[Story ID]
8
+ # /deliver-story #[Story ID]
9
9
 
10
- > **Runtime core.** This file is the always-ingested standalone-Story path:
11
- > step flow, commands, gate contracts, and the return contract. The lease /
12
- > sweep mechanics, the worktree-scope safety warning, the CI-recovery
13
- > procedures, and the Status-column reconciliation live in the sibling
14
- > [`single-story-deliver-reference.md`](single-story-deliver-reference.md);
15
- > each moved procedure keeps a one-line pointer at its trigger point below.
16
- > The reference is not projected to `.claude/commands/` — it is consulted on
17
- > demand.
10
+ > **Runtime core.** Always-ingested per-Story delivery path. Lease / sweep /
11
+ > CI-recovery detail lives in
12
+ > [`deliver-story-reference.md`](deliver-story-reference.md); consult on demand.
13
+ > Invoked by [`/deliver`](../deliver.md) for every Story (N=1 and N>1).
18
14
 
19
15
  ## Overview
20
16
 
21
- `/single-story-deliver` is the standalone counterpart to
22
- [`/deliver`](deliver-stories.md). Use it for a Story that is **not**
23
- attached to an Epic — refactors carved out of closed Epics, framework
24
- maintenance, or any work small enough that the Epic-Centric ceremony
25
- (sectioned Epic body + decomposition + dispatch manifest + cascade) would be
26
- overhead rather than help.
17
+ `/deliver-story` is the **one** delivery engine in v2. Every Story — trivial or
18
+ large uses the same machinery:
27
19
 
28
20
  ```text
29
- /single-story-deliver <storyId>
21
+ /deliver <storyId> (or /deliver --run <planRunId> → one Story at a time)
30
22
  → single-story-init.js (branch from main, worktree, agent::executing)
31
- → agent implements + commits (operator works in the worktree)
23
+ → agent implements + commits (optional ## Slicing intra-session checkpoints)
24
+ → risk-routed ceremony (acceptance critics · review · audit lenses)
32
25
  → single-story-close.js (gates, push, gh pr create → main, agent::closing)
33
- → CI watch + fix loop (until all required checks pass + PR is merged)
34
- → single-story-confirm-merge.js (PR merged → agent::done, issue closes)
26
+ → CI watch + fix loop (until required checks pass + PR merged)
27
+ → single-story-confirm-merge.js (PR merged → agent::done + follow-ups)
35
28
  ```
36
29
 
37
- **When to use `/single-story-deliver` vs. `/deliver`:**
30
+ | Trait | v2 `/deliver-story` |
31
+ | --- | --- |
32
+ | Ticket type | `type::story` only |
33
+ | Branch | `story-<id>` seeded from `project.baseBranch` (`main`) |
34
+ | Merge target | `main` via PR (squash + required checks) |
35
+ | Epic integration branch | **None** — no `epic/<id>`, no `--no-ff` wave merge |
36
+ | Spec / slices | Folded `## Spec` + optional `## Slicing` checkpoints in-session |
37
+ | Ceremony | Per-Story risk-routed via `ceremony-routing.js` |
38
38
 
39
- | Trait | `/single-story-deliver` | `/deliver` |
40
- | ----------------------------- | ---------------------------------------------------- | ------------------------------------------------------- |
41
- | Parent Epic | None (no `Epic: #N` in body) | Required (`Epic: #N` in body) |
42
- | Branch base | `project.baseBranch` (default `main`) | `epic/<epicId>` |
43
- | Merge target | `main` via PR | `epic/<epicId>` via `--no-ff` merge |
44
- | Epic-branch integration | No | Yes — merged into `epic/<epicId>` at close |
45
- | Dispatch manifest interaction | None | Read at init, regenerated at close |
46
- | Story scope | Inline `acceptance[]` / `verify[]` on the Story body | Inline `acceptance[]` / `verify[]` on the Story body |
47
-
48
- If the Story has an `Epic: #N` reference, use `/deliver`. If it
49
- doesn't, use this workflow (or `/deliver` for several standalone
50
- Stories at once).
39
+ If the Story still carries an `Epic: #N` reference, **stop** — that is a v1
40
+ Epic-attached ticket; re-plan as a v2 Story or finish it on a pre-v2 checkout.
51
41
 
52
42
  ## Prerequisites
53
43
 
@@ -70,11 +60,10 @@ node .agents/scripts/single-story-init.js --story <storyId>
70
60
  Flags: `--dry-run` (no git/ticket mutation), `--steal` (forcibly transfer a
71
61
  foreign Story lease to this operator — see the lease note below).
72
62
 
73
- > **Execution mode.** Like `story-init.js`, this command can take 3–6
74
- > minutes when the worktree's per-tree install runs. Invoke synchronously
75
- > with `Bash(timeout: 600000)`. Do **not** use `run_in_background` +
76
- > `Monitor` — a sub-agent that exits mid-install leaves the worktree
77
- > half-bootstrapped.
63
+ > **Execution mode.** `single-story-init.js` can take 3–6 minutes when the
64
+ > worktree's per-tree install runs. Invoke synchronously with
65
+ > `Bash(timeout: 600000)`. Do **not** use `run_in_background` + `Monitor` —
66
+ > a sub-agent that exits mid-install leaves the worktree half-bootstrapped.
78
67
 
79
68
  The script validates `type::story`, **acquires the Story lease**, fetches
80
69
  `origin`, seeds `story-<id>` from `baseBranch`, materializes a worktree
@@ -89,7 +78,7 @@ fetch and branch-seed.
89
78
  > heartbeat ledger to judge staleness) — coordinate or pass `--steal`. The
90
79
  > sweep is guarded (per-candidate protection + cross-session lock) and
91
80
  > never blocks init. See
92
- > [`single-story-deliver-reference.md` § Step 0 — Lease preflight and merged-sweep](single-story-deliver-reference.md#step-0--lease-preflight-and-merged-sweep)
81
+ > [`deliver-story-reference.md` § Step 0 — Lease preflight and merged-sweep](deliver-story-reference.md#step-0--lease-preflight-and-merged-sweep)
93
82
  > for the fail-closed outcomes, the `--steal` contract, and the sweep
94
83
  > hardening layers.
95
84
 
@@ -118,51 +107,40 @@ All subsequent commands run from this directory.
118
107
  > tools — you MUST prefix every such path with the absolute `workCwd` root or
119
108
  > risk silently editing the main checkout. Close's wrong-tree guard (Story
120
109
  > #3364) is a backstop, not a substitute. See
121
- > [`single-story-deliver-reference.md` § Worktree scope is not just the Bash cwd](single-story-deliver-reference.md#worktree-scope-is-not-just-the-bash-cwd).
110
+ > [`deliver-story-reference.md` § Worktree scope is not just the Bash cwd](deliver-story-reference.md#worktree-scope-is-not-just-the-bash-cwd).
122
111
 
123
112
  ---
124
113
 
125
114
  ## Step 1 — Implementation
126
115
 
127
- A standalone Story is **atomic** — no wave dispatch and no Epic-scoped
128
- cascade. Work happens in one or more commits on the `story-<id>`
129
- branch, against the inline `acceptance[]` / `verify[]` arrays on the
130
- Story body.
116
+ A Story is **atomic** — one `story-<id>` branch, one PR to `main`. Work
117
+ happens in one or more commits against the inline `acceptance[]` /
118
+ `verify[]` arrays (and the folded `## Spec` when present).
131
119
 
132
120
  Operator/agent responsibilities while in the worktree:
133
121
 
134
122
  1. Read the Story body. Treat its acceptance criteria as the contract.
135
123
 
136
- **Docs context — digest-first.** A standalone Story has no parent Epic,
137
- so there is usually no per-Epic docs digest to read. If the caller
138
- provides a `docsDigestPath` (the per-Epic docs digest at
139
- `temp/epic-<epicId>/docs-digest.md`), read that compact outline instead
140
- of re-reading the full `project.docsContextFiles` set, and pull
141
- individual docs files on demand (jump to the section at the line number
142
- the digest names). When no digest path is provided, read a full doc
143
- only when the Story's own context points you at one — do not ingest the
144
- whole docs set up front. See
145
- [`.agents/instructions.md` § 3](../../instructions.md).
146
-
147
- **Write-time audit checklists.** The write-time local-lens checklist
148
- threading (Story #4410) is wired on the Epic delivery path via
149
- `epic-deliver-prepare.js`, which threads a per-Story `checklistPath` into
150
- the maker prompt. When a standalone caller provides a `checklistPath`
151
- (the repo-relative path to this Story's footprint-matched **local**-lens
152
- authoring checklists, matched via `resolveLensTier(lens) === 'local'` +
153
- `matchesAnyFilePattern` against the Story's predicted footprint — never
154
- `selectAudits`, so no provider or git diff runs), read it before you
155
- write and self-check your change against each listed concern as you
156
- author it. When no `checklistPath` is provided, there is nothing extra to
157
- read — the lens-aware coverage still runs maker-blind at Story-scope
158
- review inside the close subprocess.
159
- 2. Implement the changes.
124
+ **Docs context — digest-first.** Read a full doc only when the Story's
125
+ own context points you at one do not ingest the whole
126
+ `project.docsContextFiles` set up front. If the caller provides a
127
+ `docsDigestPath`, prefer that compact outline and pull individual files
128
+ on demand. See [`.agents/instructions.md` § 3](../../instructions.md).
129
+
130
+ **Write-time audit checklists.** When the caller provides a
131
+ `checklistPath` (footprint-matched **local**-lens authoring checklists),
132
+ read it before you write and self-check as you author. When absent,
133
+ lens-aware coverage still runs maker-blind at Story-scope review inside
134
+ the close subprocess.
135
+ 2. Implement the changes. When the body has a `## Slicing` / Delivery
136
+ Slicing table, walk rows as **intra-session checkpoints** (commit +
137
+ flip each row when done) never as sibling tickets.
160
138
  3. Commit on the Story branch. Conventional-commit format is encouraged
161
139
  but not enforced — the PR title carries the canonical summary.
162
140
  4. Iterate (read tests, run targeted gates, edit, commit) until the
163
141
  acceptance criteria are met.
164
142
  5. Run the **bounded acceptance self-eval loop** (Step 1a below) before
165
- proceeding to close.
143
+ ceremony / close.
166
144
 
167
145
  Recommended quick gates while iterating (each is fast enough to run on
168
146
  save):
@@ -188,13 +166,13 @@ context critic, `verify[]`-as-evidence, the verdict schema, and the
188
166
  proceed / redraft / block decision) is the single-homed include
189
167
  [`acceptance-self-eval.md`](acceptance-self-eval.md) — read it and follow it.
190
168
 
191
- Standalone specifics for this path:
169
+ Story-path specifics:
192
170
 
193
171
  - **Critic evidence-share** (Story #4250). When the critic runs a `verify[]`
194
172
  command that is byte-identical to a close gate (`lint` / `typecheck`), it
195
- records the pass into the standalone evidence keyspace via `--standalone`
196
- (no parent Epic to key on) so Step 3's close short-circuits the gate at
197
- unchanged HEAD. Run it in the **Story worktree** (`workCwd` from Step 0):
173
+ records the pass into the Story evidence keyspace via `--standalone` so
174
+ Step 3's close short-circuits the gate at unchanged HEAD. Run it in the
175
+ **Story worktree** (`workCwd` from Step 0):
198
176
 
199
177
  ```bash
200
178
  node <main-repo>/.agents/scripts/evidence-gate.js \
@@ -202,14 +180,14 @@ Standalone specifics for this path:
202
180
  --worktree <workCwd> -- npm run lint
203
181
  ```
204
182
 
205
- - **Gate invocation** (omit `--epic` — there is no parent Epic):
183
+ - **Gate invocation** (omit `--epic`):
206
184
 
207
185
  ```bash
208
186
  node <main-repo>/.agents/scripts/acceptance-eval.js \
209
187
  --story <storyId> --verdict <verdict-path>
210
188
  ```
211
189
 
212
- - **On `decision: "proceed"`** → proceed to Step 3 (close).
190
+ - **On `decision: "proceed"`** → proceed to Step 2 (ceremony) then Step 3.
213
191
  - **On `decision: "block"`** → **do not proceed to close.** Post a `friction`
214
192
  comment naming the unmet criteria, then transition the Story to
215
193
  `agent::blocked`:
@@ -222,12 +200,23 @@ Standalone specifics for this path:
222
200
 
223
201
  ---
224
202
 
225
- ## Step 2 — Validate (deferred to close)
203
+ ## Step 2 — Ceremony (profile + risk)
204
+
205
+ Per-Story ceremony is selected by `delivery.routing.ceremonyProfile`
206
+ (`minimal` | `standard` | `strict`, default `standard`) and the Story's
207
+ own risk envelope (folded plan `planningRisk` / `risk-verdict` on the
208
+ Story or its plan-run context — never an Epic parent). Resolve
209
+ fresh-vs-inline acceptance critics per AC-cluster with
210
+ [`resolveCeremonyForRisk`](../../scripts/lib/orchestration/ceremony-routing.js)
211
+ (`minimal` → always inline; `strict` → always fresh; `standard` →
212
+ `high`/`medium`/`missing` → `fresh`, `low` → `inline` unless the
213
+ `freshCriticSampleRate` floor forces `fresh`). Review depth and audit lenses
214
+ follow the same envelope via `review-depth.js` /
215
+ `audit-lens-routing.js#resolveAuditLenses` inside close.
226
216
 
227
- `single-story-close.js` runs the canonical close-validation chain
228
- (typecheck, lint, test, format, maintainability, coverage, crap) before
229
- it pushes. Do **not** pre-run those gates here unless interactively
230
- iterating on a fix.
217
+ Hard gates (lint / test / format / coverage / CRAP / maintainability) always
218
+ run in Step 3 risk never disables them. Do **not** pre-run the full
219
+ close-validation chain here unless interactively iterating on a fix.
231
220
 
232
221
  ---
233
222
 
@@ -249,17 +238,11 @@ with a `Closes #<storyId>` footer, enables GitHub native auto-merge
249
238
  (NOT `agent::done` — the issue stays OPEN until Step 5 confirms the merge,
250
239
  Story #3385), reaps the worktree, and releases the Story lease.
251
240
 
252
- > **`delivery.ci.autoMerge` policy (shared with the Epic path).** The
253
- > standalone close honours the same config knob the Epic Phase 8.5 gate
254
- > reads. Under the default `"trust-ci"`, GitHub native auto-merge is armed
255
- > and the PR squash-merges once its **required** checks pass (GitHub's
256
- > `--auto` is the required-check gate — no client-side predicate is needed
257
- > here, unlike the Epic path, because a standalone Story runs no
258
- > audit/review/retro phase to gate on). Under `"strict"`, the close **does
259
- > not arm auto-merge** — the PR opens and waits for an **operator merge**,
260
- > exactly as `--no-auto-merge` does per-run. This lets a consumer who tightens
261
- > Epic merges with `"strict"` get the same operator-in-the-loop behaviour for
262
- > standalone Stories.
241
+ > **`delivery.ci.autoMerge` policy.** Under the default `"trust-ci"`, GitHub
242
+ > native auto-merge is armed and the PR squash-merges once its **required**
243
+ > checks pass. Under `"strict"`, the close **does not arm auto-merge** the
244
+ > PR opens and waits for an **operator merge**, exactly as `--no-auto-merge`
245
+ > does per-run.
263
246
 
264
247
  Flags:
265
248
 
@@ -270,46 +253,40 @@ Flags:
270
253
  - `--no-auto-merge` — disable auto-merge. Use when the PR materially changes
271
254
  behaviour and warrants a pre-merge eyeball; the operator then merges via
272
255
  the GitHub UI.
273
- - `--wait-merge` — **headless must-land** (Story #4428, Epic #4425). Pass
274
- this flag when driving `single-story-close.js` from an unattended /
275
- headless context (no operator available to run Step 5 by hand — a CI
276
- job, a scheduled `/loop`, or any wrapper that cannot rely on a human to
277
- invoke `single-story-confirm-merge.js` later). Instead of resting at
278
- `agent::closing` after arming, close polls the armed PR to merge
279
- confirmation on the `delivery.mergeWatch.*` cadence (reusing the same
280
- `confirmStoryMerged` flip logic Step 5 calls) and flips `agent::done`
281
- itself. If the arm fails, the PR closes without merging, or the poll
282
- budget is exhausted first, close classifies the block
256
+ - `--wait-merge` — **close-and-land** (Story #4428). Forces close to poll
257
+ the armed PR to merge confirmation on the `delivery.mergeWatch.*`
258
+ cadence (reusing the same `confirmStoryMerged` flip logic) and flip
259
+ `agent::done` itself. If the arm fails, the PR closes without merging,
260
+ or the poll budget is exhausted first, close classifies the block
283
261
  (`checks-pending-timeout` \| `branch-protection-human-required` \|
284
262
  `arm-failure` \| `api-race-other`), emits a `merge.unlanded` lifecycle
285
263
  event, posts a `friction` comment, transitions the Story to
286
264
  `agent::blocked`, and exits non-zero — never a silent `agent::closing`
287
- rest. **Attended runs must not pass this flag** the default (no flag)
288
- preserves the exit-at-`agent::closing` behaviour documented in Step 3
289
- and Step 5 below.
290
- - `--no-wait-merge` — explicit opt-out that always wins over `--wait-merge`
291
- (including for a caller that otherwise defaults to headless mode). Use
292
- when a headless wrapper still wants to manage merge confirmation itself
293
- (e.g. via its own `single-story-confirm-merge.js` invocation) rather than
294
- have close block the turn.
265
+ rest. When neither land flag is passed, close defaults from
266
+ `delivery.routing.closeAndLand` (**true**): attended and headless
267
+ delivers share the land-in-one-close happy path.
268
+ - `--no-wait-merge` — explicit opt-out that always wins. Use when the
269
+ operator wants the PR left at `agent::closing` for a human land (or a
270
+ wrapper that will invoke `single-story-confirm-merge.js` itself).
295
271
 
296
272
  > **Full close pipeline (base-sync outcomes, `agent::closing` rationale,
297
273
  > lease release).** For the numbered close pipeline, the base-sync outcome
298
274
  > table (no-op / conflict → `agent::blocked` / fetch-failed), and why the
299
275
  > issue stays OPEN at `agent::closing`, see
300
- > [`single-story-deliver-reference.md` § Step 3 — Close pipeline detail](single-story-deliver-reference.md#step-3--close-pipeline-detail).
276
+ > [`deliver-story-reference.md` § Step 3 — Close pipeline detail](deliver-story-reference.md#step-3--close-pipeline-detail).
301
277
 
302
278
  ---
303
279
 
304
280
  ## Step 4 — CI watch + fix loop (**required, not optional**)
305
281
 
306
- > **Headless (`--wait-merge`) runs skip Steps 4 and 5.** When Step 3 passed
307
- > `--wait-merge`, `single-story-close.js` already polled the PR to a
308
- > confirmed merge (flipping `agent::done` itself) or exited non-zero after
309
- > transitioning the Story to `agent::blocked` with a `merge.unlanded`
310
- > event there is no separate CI-watch turn or manual confirm step to run.
311
- > Proceed straight to Step 5.5. Attended runs (the default) still own
312
- > Steps 4 and 5 as documented below.
282
+ > **Close-and-land runs skip Steps 4 and 5.** When Step 3 lands through
283
+ > merge (`--wait-merge` or the `closeAndLand` default),
284
+ > `single-story-close.js` already polled the PR to a confirmed merge
285
+ > (flipping `agent::done` itself) or exited non-zero after transitioning
286
+ > the Story to `agent::blocked` with a `merge.unlanded` event there is
287
+ > no separate CI-watch turn or manual confirm step to run. Proceed
288
+ > straight to Step 5.5. Only `--no-wait-merge` runs still own Steps 4
289
+ > and 5 as documented below.
313
290
 
314
291
  The Story is **not done** when `single-story-close.js` returns. Auto-merge
315
292
  only fires when every required CI check turns green. Local close-validation
@@ -325,7 +302,7 @@ green-CI outcome, not just the push.
325
302
  > `agent::done` → post-merge steps → return the terminal JSON contract.
326
303
  > Ending the turn with prose and an unconfirmed merge is a contract
327
304
  > violation (the Story #1553 / PR #1554 failure mode). See
328
- > [`single-story-deliver-reference.md` § The auto-merge wait is an internally-blocking step](single-story-deliver-reference.md#the-auto-merge-wait-is-an-internally-blocking-step).
305
+ > [`deliver-story-reference.md` § The auto-merge wait is an internally-blocking step](deliver-story-reference.md#the-auto-merge-wait-is-an-internally-blocking-step).
329
306
 
330
307
  After `single-story-close.js` succeeds, enter the watch + fix loop. Drive
331
308
  `pr-watch-with-update.js` — the **single CI-watch mechanism** shared with
@@ -373,7 +350,7 @@ When the watch exits, branch on the exit code:
373
350
  > `reapOnSuccess`, pulling the failing job log, fixing coverage/CRAP
374
351
  > baselines without re-running close-validation, and the when-to-stop
375
352
  > Anti-Thrashing rules, see
376
- > [`single-story-deliver-reference.md` § Step 4 — CI watch + fix recovery](single-story-deliver-reference.md#step-4--ci-watch--fix-recovery).
353
+ > [`deliver-story-reference.md` § Step 4 — CI watch + fix recovery](deliver-story-reference.md#step-4--ci-watch--fix-recovery).
377
354
 
378
355
  ---
379
356
 
@@ -405,7 +382,7 @@ node .agents/scripts/single-story-confirm-merge.js --story <storyId> --cwd <main
405
382
  > live PR state and flips to `agent::done` only on a confirmed `MERGED` PR;
406
383
  > it is idempotent and safe to re-run while the PR is still open (returns
407
384
  > `pending`). See
408
- > [`single-story-deliver-reference.md` § Step 5 — Merge confirmation detail](single-story-deliver-reference.md#step-5--merge-confirmation-detail).
385
+ > [`deliver-story-reference.md` § Step 5 — Merge confirmation detail](deliver-story-reference.md#step-5--merge-confirmation-detail).
409
386
 
410
387
  ---
411
388
 
@@ -430,7 +407,7 @@ after the manual merge instead.
430
407
  > flags (`--poll-attempts`, `--poll-delay-ms`), the `attempts` / `drifted`
431
408
  > envelope semantics, and the canonical
432
409
  > `--reap-conflicting-workflows` operator fix, see
433
- > [`single-story-deliver-reference.md` § Step 5.5 — Re-assert Status column detail](single-story-deliver-reference.md#step-55--re-assert-status-column-detail).
410
+ > [`deliver-story-reference.md` § Step 5.5 — Re-assert Status column detail](deliver-story-reference.md#step-55--re-assert-status-column-detail).
434
411
 
435
412
  ---
436
413
 
@@ -461,16 +438,16 @@ run the cleanup after the manual merge lands.
461
438
  > **Why local `main` goes stale + per-flag behaviour.** For the stale-`main`
462
439
  > mechanism and the full `--fast-forward-main` / `--branches` / `--include`
463
440
  > flag semantics, see
464
- > [`single-story-deliver-reference.md` § Step 6 — Local branch cleanup detail](single-story-deliver-reference.md#step-6--local-branch-cleanup-detail).
441
+ > [`deliver-story-reference.md` § Step 6 — Local branch cleanup detail](deliver-story-reference.md#step-6--local-branch-cleanup-detail).
465
442
 
466
443
  ---
467
444
 
468
445
  ## Step 7 — Return contract (**required when dispatched as a sub-agent**) {#return-contract}
469
446
 
470
- When this workflow runs as a per-Story sub-agent (dispatched by `/deliver`
471
- via [`deliver-stories.md` § 2a/2c](deliver-stories.md)), the **only**
472
- acceptable way to end your turn is to **return a single terminal JSON status
473
- object** — never free-form prose:
447
+ When this workflow runs as a per-Story sub-agent (dispatched by
448
+ [`/deliver`](../deliver.md)), the **only** acceptable way to end your turn
449
+ is to **return a single terminal JSON status object** — never free-form
450
+ prose:
474
451
 
475
452
  ```json
476
453
  {
@@ -484,10 +461,8 @@ object** — never free-form prose:
484
461
  }
485
462
  ```
486
463
 
487
- This is the same envelope [`deliver-stories.md` § 2c](deliver-stories.md)
488
- mandates; this section is its single-homed restatement for the standalone
489
- worker so the contract is self-contained when this workflow is the entry
490
- point.
464
+ This section is the single-homed return contract for the Story worker so it
465
+ is self-contained when this workflow is the entry point.
491
466
 
492
467
  There is **no fourth "pending" status** — the CI/auto-merge wait is handled
493
468
  internally by blocking on `pr-watch-with-update.js` (Step 4) and confirming
@@ -499,7 +474,7 @@ failure (`status: "failed"`).
499
474
  > terminal-status contract (what each status requires), why a prose hand-off
500
475
  > with an unconfirmed merge is the very bug this workflow prevents, and the
501
476
  > report-state-not-process handoff discipline, see
502
- > [`single-story-deliver-reference.md` § Step 7 — Return-contract detail](single-story-deliver-reference.md#step-7--return-contract-detail).
477
+ > [`deliver-story-reference.md` § Step 7 — Return-contract detail](deliver-story-reference.md#step-7--return-contract-detail).
503
478
 
504
479
  ---
505
480
 
@@ -517,7 +492,7 @@ failure (`status: "failed"`).
517
492
  - The PR probe (`gh pr list --head <branch> --state open`) reuses an
518
493
  existing open PR rather than opening a duplicate.
519
494
 
520
- Re-running `/single-story-deliver` against an already-closed Story is
495
+ Re-running `/deliver-story` against an already-closed Story is
521
496
  safe.
522
497
 
523
498
  ---
@@ -539,7 +514,7 @@ safe.
539
514
  envelopes, the `story-run-progress` snapshot) rather than inventing a new
540
515
  contract. Do not narrate the steps you took, and do not prescribe how the
541
516
  next stage should do its work. Prose process commentary only bloats the
542
- hydrated prompt (`delivery.maxTokenBudget` elision).
517
+ hydrated prompt.
543
518
  - **Label transitions**: drive every `agent::*` state change through
544
519
  `node .agents/scripts/update-ticket-state.js --ticket <id> --state <state>`.
545
520
  This CLI is the authoritative mechanism — there is no separate
@@ -550,8 +525,7 @@ safe.
550
525
 
551
526
  ## See also
552
527
 
553
- - [`/deliver`](deliver-stories.md) — several standalone Stories at
554
- once (dependency-aware waves).
555
- - [`/deliver`](deliver-epic.md) — full Epic wave loop.
556
- - [`single-story-deliver-reference.md`](single-story-deliver-reference.md) —
528
+ - [`/deliver`](../deliver.md) — unified entry point (`<storyId...>` or
529
+ `--run <planRunId>`; sequences via `depends_on`).
530
+ - [`deliver-story-reference.md`](deliver-story-reference.md) —
557
531
  lease, sweep, CI-recovery, and Status-column reference detail.
@@ -9,7 +9,7 @@ description: >-
9
9
 
10
10
  > **Helper, not a slash command.** Files under `workflows/helpers/` are not
11
11
  > projected into the mandrel plugin command tree. The same `lib/checks/` registry runs
12
- > automatically as preflight inside `/deliver`, `/story-close`, and
12
+ > automatically as preflight inside `/deliver`, `single-story-close`, and
13
13
  > `npm test` — this viewer exists only for ad-hoc inspection. Invoke the
14
14
  > backing script directly: `node .agents/scripts/diagnose.js [args]`.
15
15
 
@@ -18,8 +18,8 @@ description: >-
18
18
  `diagnose.js` runs the checks registry assembled under
19
19
  `.agents/scripts/lib/checks/` in read-only mode and surfaces every
20
20
  finding declared on the requested scope. It is the operator-facing read
21
- of the same registry that preflight guards (`epic-deliver`,
22
- `story-close`), the retro hook, and `npm test` consult — but with
21
+ of the same registry that preflight guards (`/deliver`,
22
+ `single-story-close`), the retro hook, and `npm test` consult — but with
23
23
  `autoFix: false` always, no remote GitHub writes, and no commits.
24
24
 
25
25
  It is distinct from `diagnose-friction.js` (the per-Task signal capture
@@ -37,7 +37,7 @@ node .agents/scripts/diagnose.js [--scope <scope>] [--fail-on-blocker] [--json]
37
37
 
38
38
  | Flag | Default | Description |
39
39
  | -------------------- | ------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
40
- | `--scope <s>` | `diagnose` | Filter checks by declared scope. Use `all` to disable the filter and run every registered check. Other surface scopes (`epic-deliver`, `story-close`, `retro`) are accepted verbatim — checks whose `scope[]` includes the value will fire. |
40
+ | `--scope <s>` | `diagnose` | Filter checks by declared scope. Use `all` to disable the filter and run every registered check. Other surface scopes (`deliver`, `single-story-close`, `retro`) are accepted verbatim — checks whose `scope[]` includes the value will fire. |
41
41
  | `--fail-on-blocker` | off | Exit `2` when at least one finding has `severity === 'blocker'`. Without this flag the command always exits `0` even when blockers are present (it is by default an advisory read). |
42
42
  | `--json` | off | Emit a single line of JSON shaped as `{ scope, findings: [...] }` to stdout in place of the human table. Findings preserve the registry's `Finding` shape (id, severity, scope, summary, fixCommand, detail?, autoCorrectable). |
43
43
 
@@ -59,7 +59,7 @@ node .agents/scripts/diagnose.js
59
59
  node .agents/scripts/diagnose.js --scope all --json
60
60
 
61
61
  # Use inside a preflight script that should block on a blocker.
62
- node .agents/scripts/diagnose.js --scope story-close --fail-on-blocker
62
+ node .agents/scripts/diagnose.js --scope single-story-close --fail-on-blocker
63
63
  ```
64
64
 
65
65
  ## Output shape
@@ -80,12 +80,12 @@ Exactly one line. Schema:
80
80
  "scope": "diagnose",
81
81
  "findings": [
82
82
  {
83
- "id": "stale-origin-epic",
83
+ "id": "stale-origin-main",
84
84
  "severity": "blocker",
85
- "scope": "story-close",
86
- "summary": "Local epic/<id> is ahead of origin/epic/<id>",
87
- "detail": "Push the epic branch before re-running story-close.",
88
- "fixCommand": "git push origin epic/<id>",
85
+ "scope": "single-story-close",
86
+ "summary": "Local main is behind origin/main",
87
+ "detail": "Fast-forward main before re-running single-story-close.",
88
+ "fixCommand": "git fetch origin main; git merge --ff-only origin/main",
89
89
  "autoCorrectable": false
90
90
  }
91
91
  ]
@@ -42,7 +42,7 @@ the full duration and blocks every other parallel opportunity.
42
42
  fetches, anything you would have prefixed with `nohup` in a terminal.
43
43
  - **Anti-pattern:** synchronous `Bash` with a 600 000 ms timeout used as a
44
44
  blocker — that pattern is reserved for scripts whose exit is the
45
- signal-to-proceed (e.g., `story-init.js`'s per-tree install, which the
45
+ signal-to-proceed (e.g., `single-story-init.js`'s per-tree install, which the
46
46
  parent skill calls out explicitly).
47
47
  - **Don't poll with `sleep`:** `Monitor` returns on each stdout line. Loop
48
48
  on `until <condition>; do sleep 2; done` only when no event stream is
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  description: >-
3
3
  Helper doc for the signals-view.js debug viewer. Renders the signals
4
- span-tree for an Epic (and optionally a single Story) to the terminal.
4
+ span-tree for a run (and optionally a single Story) to the terminal.
5
5
  Read-only over `lib/signals/` — no remote writes, no state mutation, no
6
6
  auto-fixes. Dumb-terminal-safe (`console.log` only). Not a slash command —
7
7
  invoke the script directly when needed.
@@ -14,27 +14,27 @@ description: >-
14
14
  > (`lib/signals/`, writer, schema, detectors, NDJSON listeners) runs as
15
15
  > part of the normal `/deliver` machinery — this viewer is for
16
16
  > ad-hoc debugging when you need to inspect the span-tree directly.
17
- > Invoke the backing script: `node .agents/scripts/signals-view.js <epic-id> [--story <id>]`.
17
+ > Invoke the backing script: `node .agents/scripts/signals-view.js <run-id> [--story <id>]`.
18
18
 
19
19
  ## Overview
20
20
 
21
21
  `signals-view.js` is the operator-facing viewer for the consolidated
22
- signals stream. It reads `temp/epic-<eid>/stories/story-<sid>/signals.ndjson` via
22
+ signals stream. It reads `temp/run-<id>/stories/story-<sid>/signals.ndjson` via
23
23
  [`lib/signals/read`](../../scripts/lib/signals/read.js), builds an
24
24
  in-memory span-tree via
25
25
  [`lib/signals/buildSpanTree`](../../scripts/lib/signals/span-tree.js), and
26
- prints an Epic → Story → Task → events tree to stdout.
26
+ prints a run → Story → events tree to stdout.
27
27
 
28
- It is distinct from `diagnose-friction.js` (per-Task signal capture that
28
+ It is distinct from `diagnose-friction.js` (per-Story signal capture that
29
29
  wraps a shell command) and from `diagnose.js` (read of the checks
30
30
  registry). This viewer is purely a formatter over an iterator — no
31
31
  GitHub I/O, no commit creation, no label transitions.
32
32
 
33
33
  ```text
34
- node .agents/scripts/signals-view.js <epic-id> [--story <id>]
35
- → signals.read({ epic, story? })
34
+ node .agents/scripts/signals-view.js <run-id> [--story <id>]
35
+ → signals.read({ run, story? })
36
36
  → buildSpanTree(asyncIterator)
37
- → console.log lines (Epic → Story → Task → events)
37
+ → console.log lines (run → Story → events)
38
38
  → exit 0 (always; missing-file path prints a friendly message)
39
39
  ```
40
40
 
@@ -42,8 +42,8 @@ node .agents/scripts/signals-view.js <epic-id> [--story <id>]
42
42
 
43
43
  | Argument | Required | Description |
44
44
  | ---------------- | -------- | -------------------------------------------------------------------------------------------------------------------------------------- |
45
- | `<epic-id>` | yes | Positive integer Epic ID. The viewer resolves `temp/epic-<id>/` under the configured `project.paths.tempRoot`. |
46
- | `--story <id>` | no | Positive integer Story ID. When set, the printed tree is narrowed to a single Story subtree under the Epic. |
45
+ | `<run-id>` | yes | Positive integer run ID. The viewer resolves `temp/run-<id>/` under the configured `project.paths.tempRoot`. |
46
+ | `--story <id>` | no | Positive integer Story ID. When set, the printed tree is narrowed to a single Story subtree under the run. |
47
47
 
48
48
  ## Flags (test-only)
49
49
 
@@ -55,13 +55,13 @@ node .agents/scripts/signals-view.js <epic-id> [--story <id>]
55
55
 
56
56
  | Code | Meaning |
57
57
  | ---- | --------------------------------------------------------------------------------------------- |
58
- | `0` | Happy path **or** missing signals file. The missing-file path prints a friendly message ("No signals found for Epic #N"), never a stack trace. |
59
- | `1` | Bad arguments (non-integer `<epic-id>`, missing positional, malformed `--story`). |
58
+ | `0` | Happy path **or** missing signals file. The missing-file path prints a friendly message ("No signals found for run #N"), never a stack trace. |
59
+ | `1` | Bad arguments (non-integer `<run-id>`, missing positional, malformed `--story`). |
60
60
 
61
61
  ## Examples
62
62
 
63
63
  ```bash
64
- # Render every Story under Epic #1181.
64
+ # Render every Story under run #1181.
65
65
  node .agents/scripts/signals-view.js 1181
66
66
 
67
67
  # Narrow to a single Story subtree.
@@ -69,15 +69,15 @@ node .agents/scripts/signals-view.js 1181 --story 1438
69
69
 
70
70
  # No signals yet — friendly message, exit 0.
71
71
  node .agents/scripts/signals-view.js 9999
72
- # → No signals found for Epic #9999.
72
+ # → No signals found for run #9999.
73
73
  ```
74
74
 
75
75
  ## Phase steps
76
76
 
77
- 1. Parse `<epic-id>` and optional `--story <id>` from the slash-command
77
+ 1. Parse `<run-id>` and optional `--story <id>` from the CLI
78
78
  arguments. Reject non-integer or non-positive inputs with exit 1 and
79
79
  the canonical usage line.
80
- 2. Invoke `node .agents/scripts/signals-view.js <epic-id> [--story <id>]`
80
+ 2. Invoke `node .agents/scripts/signals-view.js <run-id> [--story <id>]`
81
81
  from the operator's working directory. The script resolves
82
82
  `tempRoot` from the project's `.agentrc.json` (or the framework
83
83
  default `'temp'`).