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
@@ -21,7 +21,8 @@
21
21
  *
22
22
  * Behaviour:
23
23
  * - Loads the configured review adapter via the factory; defaults to
24
- * `native` when `delivery.codeReview.provider` is unset.
24
+ * a single `native` chain entry when `delivery.codeReview.providers`
25
+ * is unset or empty.
25
26
  * - Always posts the unified `verification-results` structured comment on
26
27
  * the Epic issue (the adapter never posts; the orchestrator owns
27
28
  * persistence). Story #4411 (Epic #4405) unified the former
@@ -36,11 +37,8 @@
36
37
  */
37
38
 
38
39
  import { hasSurvivingCritical } from '../audit-suite/findings.js';
39
- import { resolveLensTier } from '../audit-suite/selector.js';
40
40
  import { resolveConfig } from '../config-resolver.js';
41
- import { selectAuditStrategy } from '../dynamic-workflow/capability.js';
42
41
  import { gitSpawn } from '../git-utils.js';
43
- import { read as readPlanState } from './epic-plan-state-store.js';
44
42
  import { resolveDepth } from './review-depth.js';
45
43
  import {
46
44
  countBySeverity,
@@ -93,248 +91,6 @@ function countChangedFiles({ baseRef, headRef, gitSpawnFn = gitSpawn }) {
93
91
  }
94
92
  }
95
93
 
96
- /**
97
- * Resolve the `planning.taskSizing` operator override the same way the ticket
98
- * validator does, so an operator who retunes sizing retunes the depth
99
- * thresholds with it. Reads `config.planning.taskSizing` first, then the
100
- * legacy `config.agentSettings.planning.taskSizing` nest; absent → `undefined`
101
- * so {@link resolveDepth} falls back to `DEFAULT_TASK_SIZING`.
102
- *
103
- * @param {object|null|undefined} config
104
- * @returns {object|undefined}
105
- */
106
- function resolveTaskSizing(config) {
107
- return (
108
- config?.planning?.taskSizing ??
109
- config?.agentSettings?.planning?.taskSizing ??
110
- undefined
111
- );
112
- }
113
-
114
- /**
115
- * Producer-side resolver (Story #3937, extended by Story #3938): read an
116
- * Epic's judged `planningRisk` envelope off its `epic-plan-state` checkpoint
117
- * and resolve the review depth via the shared {@link resolveDepth} resolver.
118
- * This is the live epic-scope counterpart to `resolveRiskRoutedLenses` in
119
- * `epic-audit-prepare.js` — it reuses the same best-effort `readPlanState`
120
- * pattern so the producer never aborts the review on a risk-read failure.
121
- *
122
- * Best-effort and total: a missing/unparseable checkpoint, an absent
123
- * `planningRisk` field, a read failure, or a malformed `overallLevel` all
124
- * degrade to `standard` (never throws). So an Epic that skipped `/plan`
125
- * (no checkpoint) still gets a passing `standard` review with no new failure
126
- * mode. The producer resolves depth from the judged risk alone (the diff is
127
- * not yet enumerated at this point); the full risk + diff-width combination is
128
- * applied in `runCodeReview`, which knows the changed-file count. A high-risk
129
- * Epic resolves to `deep` here; a low-risk one to `light` (the diff width can
130
- * only escalate, never downgrade, that producer-side resolution).
131
- *
132
- * @param {{
133
- * epicId: number,
134
- * provider: object,
135
- * readPlanState?: typeof readPlanState,
136
- * }} params
137
- * @returns {Promise<ReviewDepth>}
138
- */
139
- export async function resolveReviewDepthForEpic({
140
- epicId,
141
- provider,
142
- readPlanState: readPlanStateFn = readPlanState,
143
- }) {
144
- let state = null;
145
- try {
146
- state = await readPlanStateFn({ provider, epicId });
147
- } catch {
148
- // A read failure (provider error, malformed comment) must not abort the
149
- // review. Degrade to the neutral `standard` depth.
150
- return 'standard';
151
- }
152
- return resolveDepth({ overallLevel: state?.planningRisk?.overallLevel });
153
- }
154
-
155
- /**
156
- * The axes whose presence (at `high` risk) routes a specific post-delivery
157
- * audit lens. Mirrors the audit-workflow names under
158
- * `.agents/workflows/audit-*.md`. Story #3939 broadened the routing so every
159
- * high-risk REQUIRED axis maps to a lens rather than leaving three of them
160
- * (`data-migration`, `destructive-mutation`, `billing`) routing nothing:
161
- *
162
- * - `security` → `audit-security` (auth/secret boundary)
163
- * - `public-api` → `audit-architecture` (the canonical
164
- * architectural axis; a breaking public surface)
165
- * - `data-migration` → `audit-quality` (migration correctness +
166
- * regression coverage)
167
- * - `destructive-mutation` → `audit-security` (irreversible mutation is
168
- * an auth/abuse boundary; co-routes with
169
- * `security`, de-duplicated)
170
- * - `billing` → `audit-privacy` (money + the PII/consent
171
- * surface that travels with it)
172
- * - `critical-workflow` → `audit-quality` (the load-bearing path
173
- * warrants the deepest coverage pass)
174
- *
175
- * The `visible-behavior` axis intentionally routes NO lens: it forces the
176
- * acceptance-spec disposition at plan time and no audit lens maps cleanly to
177
- * it. Any other axis (or a low/medium-risk axis) contributes no lens.
178
- *
179
- * Every key here MUST be a value in the `axis` enum of
180
- * `.agents/schemas/risk-verdict.schema.json` — the verdict-derived envelope
181
- * can only ever carry schema-valid axes, so a key absent from that enum is
182
- * unreachable dead routing (Story #3889 removed the unreachable
183
- * `architecture` key; the architectural axis is `public-api`).
184
- */
185
- const AXIS_TO_LENS = Object.freeze({
186
- security: 'audit-security',
187
- 'public-api': 'audit-architecture',
188
- 'data-migration': 'audit-quality',
189
- 'destructive-mutation': 'audit-security',
190
- billing: 'audit-privacy',
191
- 'critical-workflow': 'audit-quality',
192
- });
193
-
194
- /**
195
- * Stable output order for routed lenses so the lens list is deterministic
196
- * regardless of axis ordering in the verdict. Every lens any axis can route
197
- * appears here exactly once; `resolveAuditLenses` filters this canonical
198
- * order down to the matched set (Story #3939).
199
- */
200
- const LENS_ORDER = Object.freeze([
201
- 'audit-security',
202
- 'audit-architecture',
203
- 'audit-quality',
204
- 'audit-privacy',
205
- ]);
206
-
207
- /**
208
- * Resolve the set of post-delivery audit lenses a judged risk envelope routes.
209
- *
210
- * High-risk axes map to their audit lens via {@link AXIS_TO_LENS}; only axes
211
- * judged `high` contribute (a `low`/`medium` axis carries no lens). The result
212
- * is de-duplicated and stably ordered by {@link LENS_ORDER} so an envelope
213
- * listing the `public-api` axis more than once routes `['audit-architecture']`
214
- * once, not twice — and two distinct axes routing the same lens (e.g.
215
- * `security` + `destructive-mutation` both → `audit-security`) collapse to a
216
- * single entry. A low-risk envelope — or any envelope with no high-risk routed
217
- * axis — resolves to an empty array (no lens beyond the existing baseline
218
- * gates).
219
- *
220
- * Pure function — no I/O, no side effects.
221
- *
222
- * @param {{ axes?: Array<{ axis?: string, level?: string }> }} [envelope]
223
- * @returns {string[]} Ordered, de-duplicated audit-lens identifiers.
224
- */
225
- export function resolveAuditLenses(envelope = {}) {
226
- const axes = Array.isArray(envelope?.axes) ? envelope.axes : [];
227
- const matched = new Set();
228
- for (const entry of axes) {
229
- if (!entry || entry.level !== 'high') continue;
230
- const lens = AXIS_TO_LENS[entry.axis];
231
- if (lens) matched.add(lens);
232
- }
233
- return LENS_ORDER.filter((lens) => matched.has(lens));
234
- }
235
-
236
- /**
237
- * Compose the Epic-close (gate3) lens roster from the change-set selection
238
- * plus every risk-routed lens.
239
- *
240
- * STOPGAP (post-#4405 review finding): Story #4412 excluded every
241
- * `local`-tier change-set lens here on the premise that the Story-scope
242
- * local-lens pass (Story #4409) verifies those concerns shift-left. That
243
- * premise does not hold yet — `runLocalLensReview`
244
- * (story-close/phases/code-review.js) materializes lens bodies with no
245
- * `artifactPrefix` (so no content persists) and no consumer acts on its
246
- * result, which left change-set lenses (security, privacy, performance,
247
- * quality, …) executed by NO reviewer at ANY tier. Local-tier lenses are
248
- * therefore KEPT at Epic close until the story-scope pass has a real
249
- * consumer; re-enable the exclusion then (tracked as a follow-up issue).
250
- * The write-time maker checklists (#4410) are advisory self-checks, not
251
- * verification. The `resolveLensTierFn` seam is retained so the
252
- * re-exclusion is a one-line revert.
253
- *
254
- * The two inputs mirror the `epic-audit-prepare.js` envelope:
255
- * - `changeSetAudits` — the raw change-set gate3 selection, kept in full
256
- * (see the stopgap note above).
257
- * - `riskRoutedAudits` — the verdict-routed high-risk lenses plus the
258
- * route-glob navigability lens. Kept in **full**, regardless of tier: a
259
- * high-risk axis (or a route-adding change set) that demands a local-tier
260
- * lens still runs it at Epic close, because that demand is the whole point
261
- * of risk routing.
262
- *
263
- * De-duplicated and order-preserving (kept change-set lenses first, then the
264
- * risk-routed extras). Pure over the injected `resolveLensTierFn` seam; the
265
- * default resolver reads `audit-rules.json` from disk.
266
- *
267
- * @param {{
268
- * changeSetAudits?: string[],
269
- * riskRoutedAudits?: string[],
270
- * resolveLensTierFn?: typeof resolveLensTier,
271
- * }} [params]
272
- * @returns {string[]} The Epic-close roster (all change-set tiers +
273
- * risk-routed; local-tier exclusion suspended per the stopgap above).
274
- */
275
- export function selectEpicCloseLenses({
276
- changeSetAudits = [],
277
- riskRoutedAudits = [],
278
- resolveLensTierFn = resolveLensTier,
279
- } = {}) {
280
- const kept = [];
281
- const seen = new Set();
282
- const add = (lens) => {
283
- if (typeof lens !== 'string' || lens.length === 0 || seen.has(lens)) return;
284
- seen.add(lens);
285
- kept.push(lens);
286
- };
287
- for (const lens of Array.isArray(changeSetAudits) ? changeSetAudits : []) {
288
- if (typeof lens !== 'string' || lens.length === 0) continue;
289
- // Stopgap: keep local-tier lenses (see docstring). The tier seam is
290
- // deliberately untouched so restoring `=== 'local' → continue` is a
291
- // one-line revert once the story-scope tier has a real consumer.
292
- void resolveLensTierFn;
293
- add(lens);
294
- }
295
- for (const lens of Array.isArray(riskRoutedAudits) ? riskRoutedAudits : []) {
296
- add(lens);
297
- }
298
- return kept;
299
- }
300
-
301
- /**
302
- * Build the post-delivery audit-lens execution plan for a judged risk
303
- * envelope. Each routed lens (see {@link resolveAuditLenses}) is paired with a
304
- * strategy decision from the **existing** `selectAuditStrategy` engine — no new
305
- * audit machinery is introduced. A low-risk envelope resolves to an empty
306
- * `lenses` array and runs no audit beyond the baseline gates (Story #3876).
307
- *
308
- * Pure with respect to the injected `selectAuditStrategyFn` (default is the
309
- * shared dynamic-workflow engine, which is itself pure over its snapshot).
310
- *
311
- * @param {{ axes?: Array<{ axis?: string, level?: string }> }} [envelope]
312
- * @param {{
313
- * snapshot?: object,
314
- * forceStrategy?: ('orchestrated'|'sequential'|null),
315
- * selectAuditStrategyFn?: typeof selectAuditStrategy,
316
- * }} [opts]
317
- * @returns {{ lenses: string[], plan: Array<{ lens: string, strategy: string, reason: string, forced: boolean }> }}
318
- */
319
- export function planAuditLenses(envelope = {}, opts = {}) {
320
- const {
321
- snapshot = {},
322
- forceStrategy = null,
323
- selectAuditStrategyFn = selectAuditStrategy,
324
- } = opts;
325
- const lenses = resolveAuditLenses(envelope);
326
- const plan = lenses.map((lens) => {
327
- const decision = selectAuditStrategyFn({ snapshot, forceStrategy });
328
- return {
329
- lens,
330
- strategy: decision.strategy,
331
- reason: decision.reason,
332
- forced: decision.forced,
333
- };
334
- });
335
- return { lenses, plan };
336
- }
337
-
338
94
  /**
339
95
  * Build the `code-review.end` payload from the normalized result envelope.
340
96
  * The runner result may carry a `report` field (full markdown body) which
@@ -376,9 +132,7 @@ function buildCodeReviewEndPayload({ epicId, result, durationMs }) {
376
132
  * `baseRef`.
377
133
  */
378
134
  function resolveConfigBase(config) {
379
- return (
380
- config?.project?.baseBranch ?? config?.agentSettings?.baseBranch ?? 'main'
381
- );
135
+ return config?.project?.baseBranch ?? 'main';
382
136
  }
383
137
 
384
138
  /** Positive-integer override, else the supplied default. */
@@ -535,25 +289,22 @@ function resolveScopeEnvelope(opts, config) {
535
289
  */
536
290
  /**
537
291
  * Resolve the human-facing provider name from the resolved code-review
538
- * config. Chain configs render as `chain[a,b,...]`; a single-provider
539
- * config renders its `provider` string; everything else falls back to
540
- * `'native'`. Story #4075 extracted from `runCodeReview`.
292
+ * config. Multi-entry chains render as `chain[a,b,...]`; a single-entry
293
+ * chain (including the unset/empty default) renders that entry's name;
294
+ * everything else falls back to `'native'`.
541
295
  */
542
296
  function resolveProviderName(codeReviewConfig) {
543
- const isChainConfig =
544
- codeReviewConfig &&
545
- Array.isArray(codeReviewConfig.providers) &&
546
- codeReviewConfig.providers.length > 0;
547
- if (isChainConfig) {
548
- return `chain[${codeReviewConfig.providers
549
- .map((p) => p?.name ?? '?')
550
- .join(',')}]`;
297
+ const providers =
298
+ codeReviewConfig && Array.isArray(codeReviewConfig.providers)
299
+ ? codeReviewConfig.providers
300
+ : [];
301
+ if (providers.length === 1) {
302
+ return providers[0]?.name ?? 'native';
551
303
  }
552
- return (
553
- (codeReviewConfig && typeof codeReviewConfig.provider === 'string'
554
- ? codeReviewConfig.provider
555
- : null) ?? 'native'
556
- );
304
+ if (providers.length > 1) {
305
+ return `chain[${providers.map((p) => p?.name ?? '?').join(',')}]`;
306
+ }
307
+ return 'native';
557
308
  }
558
309
 
559
310
  /**
@@ -564,15 +315,17 @@ function resolveProviderName(codeReviewConfig) {
564
315
  * envelope or the posted comment. Absent risk envelope + unknown width →
565
316
  * `standard`. Story #4075 — extracted from `runCodeReview`.
566
317
  */
567
- function buildReviewInput({ opts, config, scope, ticketId, baseRef, headRef }) {
318
+ function buildReviewInput({ opts, scope, ticketId, baseRef, headRef }) {
568
319
  const changedFileCount =
569
320
  typeof opts.changedFileCount === 'number'
570
321
  ? opts.changedFileCount
571
322
  : countChangedFiles({ baseRef, headRef, gitSpawnFn: opts.gitSpawnFn });
323
+ // v2 Stage 2: review depth uses DEFAULT_DIFF_WIDTH (mechanical file count
324
+ // of the diff under review). It is deliberately decoupled from the
325
+ // planning model-capacity advisory (`DEFAULT_MODEL_CAPACITY`).
572
326
  const depth = resolveDepth({
573
327
  overallLevel: opts.planningRisk?.overallLevel,
574
328
  changedFileCount,
575
- sizing: resolveTaskSizing(config),
576
329
  });
577
330
  return {
578
331
  scope,
@@ -670,7 +423,6 @@ async function executeReviewPipeline({ opts, config, envelope }) {
670
423
 
671
424
  const reviewInput = buildReviewInput({
672
425
  opts,
673
- config,
674
426
  scope,
675
427
  ticketId,
676
428
  baseRef,
@@ -28,7 +28,7 @@
28
28
  * Located at `lib/orchestration/column-sync.js` (Story #2548) so the
29
29
  * canonical state mutator `transitionTicketState`
30
30
  * (`lib/orchestration/ticketing/state.js`) can invoke it without an
31
- * upward dependency into `epic-runner/`. Prior to #2548 this module
31
+ * upward dependency into the deleted `epic-runner/` tree. Prior to #2548 this module
32
32
  * lived under `epic-runner/` and was only wired against the Epic
33
33
  * ticket — Stories and Tasks never updated their Projects v2 Status
34
34
  * column on label flips.
@@ -30,7 +30,7 @@
30
30
  * Epic body off disk / the GitHub API.
31
31
  */
32
32
 
33
- import { DELIVERY_SLICING_RE as DELIVERY_SLICING_HEADING_RE } from '../epic-body-sections.js';
33
+ import { DELIVERY_SLICING_RE as DELIVERY_SLICING_HEADING_RE } from '../ticket-body-sections.js';
34
34
 
35
35
  /** A row is a markdown table line: starts with `|` once trimmed. */
36
36
  const TABLE_ROW_RE = /^\|/;
@@ -8,7 +8,7 @@
8
8
  * @module lib/orchestration/context-envelope
9
9
  */
10
10
 
11
- /** @typedef {'protocolPolicy' | 'persona' | 'skillCapsules' | 'hierarchy' | 'acceptanceCriteria' | 'verificationCommands' | 'taskInstructions'} SectionName */
11
+ /** @typedef {'protocolPolicy' | 'skillCapsules' | 'hierarchy' | 'acceptanceCriteria' | 'verificationCommands' | 'taskInstructions'} SectionName */
12
12
 
13
13
  /**
14
14
  * @typedef {object} SectionSource
@@ -37,7 +37,7 @@
37
37
  /**
38
38
  * @typedef {object} ContextEnvelope
39
39
  * @property {'1'} schemaVersion
40
- * @property {{ id: number, title: string, persona?: string, skills?: string[], protocolVersion?: string }} task
40
+ * @property {{ id: number, title: string, skills?: string[], protocolVersion?: string }} task
41
41
  * @property {Section[]} sections
42
42
  * @property {TicketSnapshot[]} provenance
43
43
  * @property {{ maxTokens: number, used: number, elided: string[] }} budget
@@ -51,7 +51,6 @@ export const PROMPT_SECTION_SEPARATOR =
51
51
  /** Rendering order for {@link envelopeToPrompt} (not elision priority). */
52
52
  export const SECTION_RENDER_ORDER = Object.freeze([
53
53
  'protocolPolicy',
54
- 'persona',
55
54
  'skillCapsules',
56
55
  'hierarchy',
57
56
  'acceptanceCriteria',
@@ -65,7 +64,6 @@ export const DEFAULT_SECTION_PRIORITIES = Object.freeze({
65
64
  hierarchy: 20,
66
65
  acceptanceCriteria: 30,
67
66
  verificationCommands: 40,
68
- persona: 50,
69
67
  protocolPolicy: 80,
70
68
  taskInstructions: 100,
71
69
  });
@@ -76,7 +74,6 @@ export const DEFAULT_ELIDE_POLICIES = Object.freeze({
76
74
  hierarchy: 'summarize',
77
75
  acceptanceCriteria: 'summarize',
78
76
  verificationCommands: 'drop',
79
- persona: 'summarize',
80
77
  protocolPolicy: 'drop',
81
78
  taskInstructions: 'drop',
82
79
  });
@@ -1,5 +1,5 @@
1
1
  /**
2
- * docs-digest.js — per-Epic docs digest builder (Story #4338).
2
+ * docs-digest.js — per-run docs digest builder (Story #4338).
3
3
  *
4
4
  * `/deliver` story sub-agents previously re-read every file in
5
5
  * `project.docsContextFiles` on every Story, re-paying the full docs payload
@@ -16,8 +16,8 @@
16
16
  * Story #4433 extends this module with {@link ensureDocsDigest}, a shared
17
17
  * generate-and-write export so the planner-context surface
18
18
  * (`plan-context.js` / `authoring-context.js`) can produce a session docs
19
- * digest without duplicating the mkdir+writeFile plumbing
20
- * `epic-deliver-prepare.js` already owns for the delivery-children digest.
19
+ * digest without duplicating the mkdir+writeFile plumbing shared by
20
+ * `plan-context.js` / `authoring-context.js` and the `/deliver` workflow.
21
21
  */
22
22
 
23
23
  import fs from 'node:fs';
@@ -110,7 +110,7 @@ function renderDocSection(doc) {
110
110
  }
111
111
 
112
112
  /**
113
- * Build the per-Epic docs digest markdown from the configured docs context
113
+ * Build the per-run docs digest markdown from the configured docs context
114
114
  * files. Missing files are skipped silently (the read seam returns only the
115
115
  * files it could stat + read). Returns `null` when there is nothing to digest
116
116
  * — i.e. `docsContextFiles` is empty/unset — so callers surface a null
@@ -130,7 +130,7 @@ export async function buildDocsDigest({ docsContextFiles, docsRoot } = {}) {
130
130
  const header = [
131
131
  '# Docs digest',
132
132
  '',
133
- 'Per-Epic outline of the project docs context set. Each entry lists the',
133
+ 'Per-run outline of the project docs context set. Each entry lists the',
134
134
  'file path, byte size, and its heading outline (with line numbers) plus',
135
135
  'the first paragraph under each `##` section. Read the full file on demand',
136
136
  'when a section looks relevant — do **not** ingest the whole set per Story.',
@@ -144,10 +144,10 @@ export async function buildDocsDigest({ docsContextFiles, docsRoot } = {}) {
144
144
  /**
145
145
  * Build the docs digest and write it to `outputPath`, returning `null` (no
146
146
  * write) when there is nothing to digest. This is the single shared
147
- * generate-and-persist export both digest producers call: the per-Epic
148
- * delivery-children digest (`epic-deliver-prepare.js`) and the planner-
147
+ * generate-and-persist export both digest producers call: the per-run
148
+ * `/deliver` docs digest (`helpers/deliver-story.md`) and the planner-
149
149
  * context digest (`plan-context.js` → `authoring-context.js`, Story
150
- * #4433). Callers own path construction (temp-root layout, epic id, etc.)
150
+ * #4433). Callers own path construction (temp-root layout, run id, etc.)
151
151
  * so both surfaces can keep — or deliberately share — their own convention;
152
152
  * this function only owns "build digest, ensure parent dir, write file".
153
153
  *
@@ -45,11 +45,10 @@
45
45
  * the shared-editor conflict gate's domain — that finding's rendering is
46
46
  * cross-referenced (see `renderMismatch`), not duplicated here.
47
47
  *
48
- * Legacy compatibility: stories whose `body.changes` items are still bare
49
- * strings carry no assumption and are skipped silently here. The
50
- * deprecation signal is emitted *once* per validator invocation through
51
- * `collectDeprecationWarnings`, so consumers running an older planner
52
- * see a clear migration nudge without a hard failure mid-flight.
48
+ * String bullets: stories whose `body.changes` items are still bare
49
+ * strings are hard errors they are pushed to `errors[]` by the
50
+ * validator's body-shape gate before this module runs. There is no
51
+ * silent skip or deprecation nudge.
53
52
  */
54
53
 
55
54
  import { gitSpawn } from '../git-utils.js';
@@ -319,21 +318,16 @@ export function validateStoryFileAssumptions(opts) {
319
318
  const entries = collectStoryAssumptionEntries(story);
320
319
 
321
320
  if (entries.length === 0) {
322
- // Legacy path: this Story carries no object-form entries. Emit a
323
- // single deprecation warning so the operator sees the migration
324
- // nudge once per Story rather than per-bullet.
325
321
  if (hasLegacyChangeBullets(story)) {
326
- warnings.push(
327
- `"${slug}" → body.changes uses legacy string bullets without { path, assumption }. Migrate to object form so Phase 8 can verify file-state assumptions. See Story #2636.`,
322
+ errors.push(
323
+ `"${slug}" → body.changes uses legacy string bullets without { path, assumption }. Migrate every bullet to object form so Phase 8 can verify file-state assumptions. See Story #2636.`,
328
324
  );
329
325
  }
330
326
  continue;
331
327
  }
332
328
 
333
- // Partial-migration warning: some entries are object-form, some are
334
- // still strings. Surface once so the operator notices the gap.
335
329
  if (hasLegacyChangeBullets(story)) {
336
- warnings.push(
330
+ errors.push(
337
331
  `"${slug}" → body.changes mixes object-form entries with legacy string bullets. Migrate every bullet for full freshness coverage.`,
338
332
  );
339
333
  }
@@ -26,7 +26,7 @@ function resolveBaseBranch(cwd, override) {
26
26
  if (override) return override;
27
27
  try {
28
28
  const cfg = resolveConfig({ cwd });
29
- return cfg?.project?.baseBranch || cfg?.agentSettings?.baseBranch || 'main';
29
+ return cfg?.project?.baseBranch || 'main';
30
30
  } catch {
31
31
  return 'main';
32
32
  }
@@ -40,7 +40,7 @@
40
40
  * `ledgerPath` (the host-loop case — the loop owns where its ledger
41
41
  * lives) OR an `epicId`, in which case the canonical
42
42
  * `epicLedgerPath(epicId)` is used so an Epic-scoped loop's ticks land
43
- * in the same `temp/epic-<id>/lifecycle.ndjson` the rest of the run
43
+ * in the same `temp/run-<id>/lifecycle.ndjson` the rest of the run
44
44
  * reads. Exactly one of the two MUST be supplied.
45
45
  */
46
46
 
@@ -65,8 +65,8 @@ const SCHEMA_DIR = path.resolve(
65
65
  const VALID_STATUSES = new Set(['running', 'done', 'blocked']);
66
66
 
67
67
  /**
68
- * Parse `temp/epic-<id>/lifecycle.ndjson` (or any
69
- * `<dir>/epic-<id>/lifecycle.ndjson`) back into `{ tempRoot, epicId }`
68
+ * Parse `temp/run-<id>/lifecycle.ndjson` (or any
69
+ * `<dir>/run-<id>/lifecycle.ndjson`) back into `{ tempRoot, epicId }`
70
70
  * so a LedgerWriter — which is constructed from `{ epicId, tempRoot }`
71
71
  * rather than a raw path — can be bound to the supplied ledger path.
72
72
  *
@@ -79,13 +79,13 @@ const VALID_STATUSES = new Set(['running', 'done', 'blocked']);
79
79
  * @returns {{ tempRoot: string, epicId: number }}
80
80
  */
81
81
  function decomposeLedgerPath(ledgerPath) {
82
- const epicDir = path.dirname(ledgerPath);
83
- const tempRoot = path.dirname(epicDir);
84
- const epicDirName = path.basename(epicDir);
85
- const m = /^epic-(\d+)$/.exec(epicDirName);
82
+ const runDir = path.dirname(ledgerPath);
83
+ const tempRoot = path.dirname(runDir);
84
+ const runDirName = path.basename(runDir);
85
+ const m = /^run-(\d+)$/.exec(runDirName);
86
86
  if (!m) {
87
87
  throw new Error(
88
- `emitLoopTick: ledgerPath does not match <tempRoot>/epic-<id>/lifecycle.ndjson layout (got ${ledgerPath})`,
88
+ `emitLoopTick: ledgerPath does not match <tempRoot>/run-<id>/lifecycle.ndjson layout (got ${ledgerPath})`,
89
89
  );
90
90
  }
91
91
  const epicId = Number.parseInt(m[1], 10);
@@ -2,8 +2,8 @@
2
2
  * emit-story-heartbeat.js — Story #3057.
3
3
  *
4
4
  * Programmatic helper that appends a single `story.heartbeat` NDJSON
5
- * record to `temp/epic-<id>/lifecycle.ndjson` during a Story's
6
- * implementation loop. Story-implementation phases can run for many
5
+ * record to the Story lifecycle ledger (`temp/.../lifecycle.ndjson` via
6
+ * `lib/config/temp-paths.js`) during a Story's implementation loop. Story-implementation phases can run for many
7
7
  * minutes between dispatch and merge; `story.heartbeat` is the
8
8
  * inspectable in-progress signal the host-loop reconciler reads to
9
9
  * confirm forward progress.
@@ -25,6 +25,7 @@
25
25
 
26
26
  import { appendFileSync, mkdirSync } from 'node:fs';
27
27
  import path from 'node:path';
28
+ import { runTempDir } from '../../config/temp-paths.js';
28
29
 
29
30
  /**
30
31
  * Static deny-list pulled from the Tech Spec § Security & Privacy. Keys
@@ -85,7 +86,7 @@ export class LedgerWriter {
85
86
  * @param {object} opts
86
87
  * @param {number} opts.epicId
87
88
  * @param {string} opts.tempRoot - absolute or repo-relative path; the
88
- * writer resolves `temp/epic-<id>/lifecycle.ndjson` underneath.
89
+ * writer resolves `temp/run-<id>/lifecycle.ndjson` underneath.
89
90
  * @param {() => number} [opts.now] - injectable clock for tests.
90
91
  */
91
92
  constructor(opts) {
@@ -101,7 +102,9 @@ export class LedgerWriter {
101
102
  }
102
103
  this._epicId = opts.epicId;
103
104
  this._tempRoot = opts.tempRoot;
104
- this._epicDir = path.join(this._tempRoot, `epic-${this._epicId}`);
105
+ this._epicDir = runTempDir(this._epicId, {
106
+ project: { paths: { tempRoot: this._tempRoot } },
107
+ });
105
108
  this._ledgerPath = path.join(this._epicDir, 'lifecycle.ndjson');
106
109
  this._now = typeof opts.now === 'function' ? opts.now : Date.now;
107
110
  }
@@ -127,7 +130,7 @@ export class LedgerWriter {
127
130
  * The naive optimization (cache "ensured" after the first call) is
128
131
  * unsound when a listener moves the ledger directory mid-handler —
129
132
  * which is exactly what the Cleaner does on Wave 8 (Story #2259):
130
- * it renames `temp/epic-<id>/` under `archive/` between the listener
133
+ * it renames `temp/run-<id>/` under `archive/` between the listener
131
134
  * body and the bus's `onCompleted` hook fire-time, and the next
132
135
  * append (the `completed` record for the outer event) would land
133
136
  * in a vanished directory. `mkdirSync({recursive: true})` is