mandrel 2.0.0 → 2.2.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 (323) hide show
  1. package/.agents/README.md +59 -28
  2. package/.agents/agents/acceptance-critic.md +20 -9
  3. package/.agents/agents/story-worker.md +45 -48
  4. package/.agents/audit-checklists/performance.md +1 -1
  5. package/.agents/docs/SDLC.md +60 -46
  6. package/.agents/docs/agentrc-reference.json +8 -13
  7. package/.agents/docs/configuration.md +33 -57
  8. package/.agents/docs/execution-reference.md +39 -10
  9. package/.agents/docs/quality-gates.md +17 -19
  10. package/.agents/docs/workflows.md +6 -6
  11. package/.agents/instructions.md +64 -79
  12. package/.agents/rules/ci-remediation.md +3 -3
  13. package/.agents/rules/gherkin-standards.md +10 -0
  14. package/.agents/rules/git-conventions-reference.md +42 -51
  15. package/.agents/schemas/acceptance-eval-verdict.schema.json +2 -2
  16. package/.agents/schemas/agentrc.schema.json +35 -46
  17. package/.agents/schemas/audit-rules.json +59 -1
  18. package/.agents/schemas/audit-rules.schema.json +33 -1
  19. package/.agents/schemas/lifecycle/README.md +1 -2
  20. package/.agents/schemas/lifecycle/ledger-record.schema.json +1 -1
  21. package/.agents/schemas/lifecycle/merge.flip-failed.schema.json +33 -0
  22. package/.agents/schemas/lifecycle/merge.unlanded.schema.json +1 -0
  23. package/.agents/schemas/lifecycle/story.merged.schema.json +1 -1
  24. package/.agents/schemas/signal-event.schema.json +3 -3
  25. package/.agents/schemas/story-deliver-terminal.schema.json +152 -0
  26. package/.agents/schemas/validation-evidence.schema.json +1 -1
  27. package/.agents/scripts/acceptance-eval.js +24 -68
  28. package/.agents/scripts/agents-bootstrap-github.js +1 -1
  29. package/.agents/scripts/bootstrap.js +3 -3
  30. package/.agents/scripts/check-dead-exports.js +43 -104
  31. package/.agents/scripts/check-doc-links.js +2 -2
  32. package/.agents/scripts/check-lifecycle-lint.js +1 -1
  33. package/.agents/scripts/check-workflow-cli-lint.js +91 -0
  34. package/.agents/scripts/deliver-recover.js +122 -0
  35. package/.agents/scripts/drain-pending-cleanup.js +1 -1
  36. package/.agents/scripts/evidence-gate.js +20 -50
  37. package/.agents/scripts/generate-skills-index.js +17 -1
  38. package/.agents/scripts/generate-workflows-doc.js +4 -4
  39. package/.agents/scripts/lib/ITicketingProvider.js +1 -19
  40. package/.agents/scripts/lib/audit-suite/selector.js +323 -23
  41. package/.agents/scripts/lib/baselines/kinds/maintainability.js +0 -11
  42. package/.agents/scripts/lib/bootstrap/ci-workflow-template.js +28 -33
  43. package/.agents/scripts/lib/bootstrap/manifest.js +8 -11
  44. package/.agents/scripts/lib/bootstrap/project-bootstrap.js +30 -53
  45. package/.agents/scripts/lib/bootstrap/quality-bootstrap.js +0 -2
  46. package/.agents/scripts/lib/checks/core-bare-clean.js +4 -1
  47. package/.agents/scripts/lib/checks/index.js +1 -1
  48. package/.agents/scripts/lib/checks/loop-health.js +12 -11
  49. package/.agents/scripts/lib/checks/state.js +17 -248
  50. package/.agents/scripts/lib/checks/story-init-not-backgrounded.js +3 -3
  51. package/.agents/scripts/lib/checks/subagent-agent-tool-required.js +3 -4
  52. package/.agents/scripts/lib/checks/worktree-bootstrap-env.js +2 -2
  53. package/.agents/scripts/lib/checks/worktree-residue-biome.js +3 -3
  54. package/.agents/scripts/lib/cli-args.js +23 -2
  55. package/.agents/scripts/lib/close-validation/gates.js +13 -13
  56. package/.agents/scripts/lib/close-validation/projections/inputs.js +7 -7
  57. package/.agents/scripts/lib/close-validation/projections/maintainability.js +12 -12
  58. package/.agents/scripts/lib/close-validation/runner.js +13 -21
  59. package/.agents/scripts/lib/close-validation/telemetry.js +17 -8
  60. package/.agents/scripts/lib/config/acceptance-eval.js +2 -2
  61. package/.agents/scripts/lib/config/delivery-routing.js +7 -6
  62. package/.agents/scripts/lib/config/explain.js +10 -16
  63. package/.agents/scripts/lib/config/github.js +7 -5
  64. package/.agents/scripts/lib/config/limits.js +15 -25
  65. package/.agents/scripts/lib/config/quality.js +11 -14
  66. package/.agents/scripts/lib/config/runners.js +8 -21
  67. package/.agents/scripts/lib/config/temp-paths.js +18 -56
  68. package/.agents/scripts/lib/config-settings-schema-delivery.js +34 -16
  69. package/.agents/scripts/lib/config-settings-schema-quality.js +9 -2
  70. package/.agents/scripts/lib/config-settings-schema.js +48 -22
  71. package/.agents/scripts/lib/dead-exports-knip.js +105 -0
  72. package/.agents/scripts/lib/dead-exports-mode.js +51 -0
  73. package/.agents/scripts/lib/duplicate-search.js +38 -7
  74. package/.agents/scripts/lib/findings/promote-finding.js +23 -14
  75. package/.agents/scripts/lib/format-generated-json.js +97 -0
  76. package/.agents/scripts/lib/framework-version.js +19 -189
  77. package/.agents/scripts/lib/gh-exec.js +8 -0
  78. package/.agents/scripts/lib/git-branch-lifecycle.js +0 -158
  79. package/.agents/scripts/lib/git-utils.js +0 -14
  80. package/.agents/scripts/lib/json-utils.js +1 -2
  81. package/.agents/scripts/lib/label-constants.js +0 -15
  82. package/.agents/scripts/lib/label-taxonomy.js +1 -12
  83. package/.agents/scripts/lib/observability/active-story-env.js +42 -163
  84. package/.agents/scripts/lib/observability/runtime-friction.js +243 -0
  85. package/.agents/scripts/lib/observability/signal-validator.js +4 -4
  86. package/.agents/scripts/lib/observability/signals-writer.js +6 -82
  87. package/.agents/scripts/lib/observability/source-classifier.js +2 -2
  88. package/.agents/scripts/lib/observability/tool-trace-hook.js +2 -12
  89. package/.agents/scripts/lib/orchestration/acceptance-clusters.js +1 -1
  90. package/.agents/scripts/lib/orchestration/acceptance-eval-decision.js +2 -2
  91. package/.agents/scripts/lib/orchestration/ceremony-routing.js +43 -45
  92. package/.agents/scripts/lib/orchestration/change-set.js +103 -0
  93. package/.agents/scripts/lib/orchestration/code-review.js +70 -191
  94. package/.agents/scripts/lib/orchestration/consolidation-precondition.js +3 -3
  95. package/.agents/scripts/lib/orchestration/deliver-recover.js +328 -0
  96. package/.agents/scripts/lib/orchestration/detectors-phase.js +12 -6
  97. package/.agents/scripts/lib/orchestration/git-cleanup/phases/fast-forward.js +34 -0
  98. package/.agents/scripts/lib/orchestration/lease-guard-shared.js +3 -2
  99. package/.agents/scripts/lib/orchestration/lifecycle/emit-ledger-event.js +142 -0
  100. package/.agents/scripts/lib/orchestration/lifecycle/emit-loop-tick.js +9 -11
  101. package/.agents/scripts/lib/orchestration/lifecycle/emit-merge-flip-failed.js +86 -0
  102. package/.agents/scripts/lib/orchestration/lifecycle/emit-merge-unlanded.js +37 -103
  103. package/.agents/scripts/lib/orchestration/lifecycle/listeners/README.md +7 -3
  104. package/.agents/scripts/lib/orchestration/lifecycle/listeners/watcher.js +50 -85
  105. package/.agents/scripts/lib/orchestration/lifecycle/trace-logger.js +3 -14
  106. package/.agents/scripts/lib/orchestration/merge-block-class.js +76 -20
  107. package/.agents/scripts/lib/orchestration/merge-poll.js +104 -0
  108. package/.agents/scripts/lib/orchestration/plan-context.js +116 -33
  109. package/.agents/scripts/lib/orchestration/plan-critic-conditions.js +26 -36
  110. package/.agents/scripts/lib/orchestration/plan-critics-evaluate.js +31 -22
  111. package/.agents/scripts/lib/orchestration/plan-metrics.js +38 -6
  112. package/.agents/scripts/lib/orchestration/plan-persist/fan-out-gate.js +16 -6
  113. package/.agents/scripts/lib/orchestration/plan-persist/persist-helpers.js +173 -25
  114. package/.agents/scripts/lib/orchestration/plan-persist/plan-context-source.js +116 -0
  115. package/.agents/scripts/lib/orchestration/plan-persist/run-plan-persist.js +280 -100
  116. package/.agents/scripts/lib/orchestration/plan-persist/story-ops.js +472 -55
  117. package/.agents/scripts/lib/orchestration/plan-persist/summary.js +21 -16
  118. package/.agents/scripts/lib/orchestration/plan-persist/supersede-ops.js +509 -0
  119. package/.agents/scripts/lib/orchestration/plan-text-hygiene.js +230 -0
  120. package/.agents/scripts/lib/orchestration/planning/authoring-context.js +41 -40
  121. package/.agents/scripts/lib/orchestration/planning/decomposer-context.js +1 -2
  122. package/.agents/scripts/lib/orchestration/planning/spec-authoring-grounding.js +1 -1
  123. package/.agents/scripts/lib/orchestration/resolve-stories.js +344 -0
  124. package/.agents/scripts/lib/orchestration/retro-proposals.js +7 -7
  125. package/.agents/scripts/lib/orchestration/review-depth.js +105 -40
  126. package/.agents/scripts/lib/orchestration/review-providers/findings-renderer.js +3 -13
  127. package/.agents/scripts/lib/orchestration/review-providers/native.js +1 -154
  128. package/.agents/scripts/lib/orchestration/review-providers/review-depth.js +3 -2
  129. package/.agents/scripts/lib/orchestration/review-providers/security-review.js +1 -1
  130. package/.agents/scripts/lib/orchestration/review-providers/types.js +5 -4
  131. package/.agents/scripts/lib/orchestration/review-providers/ultrareview.js +1 -1
  132. package/.agents/scripts/lib/orchestration/run-epilogue.js +374 -16
  133. package/.agents/scripts/lib/orchestration/single-story-close/phases/auto-merge.js +24 -0
  134. package/.agents/scripts/lib/orchestration/single-story-close/phases/base-sync.js +11 -9
  135. package/.agents/scripts/lib/orchestration/single-story-close/phases/close-validation.js +4 -4
  136. package/.agents/scripts/lib/orchestration/single-story-close/phases/code-review.js +4 -13
  137. package/.agents/scripts/lib/orchestration/single-story-close/phases/confirm-merge.js +608 -152
  138. package/.agents/scripts/lib/orchestration/single-story-close/phases/options.js +72 -30
  139. package/.agents/scripts/lib/orchestration/single-story-close/phases/post-land.js +305 -0
  140. package/.agents/scripts/lib/orchestration/single-story-close/phases/pull-request.js +1 -1
  141. package/.agents/scripts/lib/orchestration/single-story-close/phases/review-block.js +12 -8
  142. package/.agents/scripts/lib/orchestration/single-story-close/phases/worktree-reap.js +37 -4
  143. package/.agents/scripts/lib/orchestration/single-story-close/phases/wrong-tree-guard.js +2 -2
  144. package/.agents/scripts/lib/orchestration/single-story-close/runner.js +264 -43
  145. package/.agents/scripts/lib/orchestration/single-story-lease-guard.js +1 -1
  146. package/.agents/scripts/lib/orchestration/story-close/format-autofix.js +10 -10
  147. package/.agents/scripts/lib/orchestration/story-close/phases/code-review.js +104 -279
  148. package/.agents/scripts/lib/orchestration/story-close/phases/local-lens-review.js +191 -0
  149. package/.agents/scripts/lib/orchestration/story-close/phases/review-core.js +120 -0
  150. package/.agents/scripts/lib/orchestration/story-deliver-terminal.js +360 -0
  151. package/.agents/scripts/lib/orchestration/story-follow-ups.js +75 -14
  152. package/.agents/scripts/lib/orchestration/story-init-remote.js +12 -8
  153. package/.agents/scripts/lib/orchestration/story-plan-state.js +14 -29
  154. package/.agents/scripts/lib/orchestration/task-body-validator.js +52 -7
  155. package/.agents/scripts/lib/orchestration/ticket-lease.js +27 -74
  156. package/.agents/scripts/lib/orchestration/ticket-validator-conflicts.js +119 -14
  157. package/.agents/scripts/lib/orchestration/ticket-validator-sizing.js +3 -4
  158. package/.agents/scripts/lib/orchestration/ticket-validator.js +121 -18
  159. package/.agents/scripts/lib/orchestration/ticketing/bulk.js +14 -47
  160. package/.agents/scripts/lib/orchestration/ticketing/reads.js +19 -32
  161. package/.agents/scripts/lib/orchestration/ticketing/transition.js +61 -1
  162. package/.agents/scripts/lib/orchestration/ticketing.js +0 -1
  163. package/.agents/scripts/lib/plan-phase-cleanup.js +12 -14
  164. package/.agents/scripts/lib/planning-corpus.js +12 -286
  165. package/.agents/scripts/lib/preflight-runner.js +2 -2
  166. package/.agents/scripts/lib/qa/qa-context-hydrator.js +5 -5
  167. package/.agents/scripts/lib/signals/index.js +4 -17
  168. package/.agents/scripts/lib/signals/read.js +35 -35
  169. package/.agents/scripts/lib/signals/schema.js +8 -11
  170. package/.agents/scripts/lib/signals/span-tree.js +7 -7
  171. package/.agents/scripts/lib/signals/write.js +0 -1
  172. package/.agents/scripts/lib/single-story/story-merged-notify.js +13 -2
  173. package/.agents/scripts/lib/skills/parse-skill.js +16 -3
  174. package/.agents/scripts/lib/story-adjacency.js +8 -7
  175. package/.agents/scripts/lib/story-body/story-body.js +81 -13
  176. package/.agents/scripts/lib/templates/decomposer-prompts.js +15 -16
  177. package/.agents/scripts/lib/test-env.js +14 -1
  178. package/.agents/scripts/lib/test-tiers.js +0 -3
  179. package/.agents/scripts/lib/ticket-body-sections.js +0 -14
  180. package/.agents/scripts/lib/validation-evidence.js +31 -59
  181. package/.agents/scripts/lib/wave-runner/live-probe.js +315 -0
  182. package/.agents/scripts/lib/wave-runner/ready-set.js +32 -6
  183. package/.agents/scripts/lib/worktree/lifecycle/pending-cleanup.js +1 -1
  184. package/.agents/scripts/lib/worktree/lifecycle/reap.js +68 -19
  185. package/.agents/scripts/lib/worktree/lifecycle-manager.js +1 -2
  186. package/.agents/scripts/plan-context.js +38 -7
  187. package/.agents/scripts/plan-critics.js +203 -0
  188. package/.agents/scripts/plan-persist.js +145 -35
  189. package/.agents/scripts/plan-run-epilogue.js +83 -38
  190. package/.agents/scripts/post-structured-comment.js +0 -38
  191. package/.agents/scripts/pr-watch-with-update.js +43 -22
  192. package/.agents/scripts/providers/github/compose.js +0 -1
  193. package/.agents/scripts/providers/github/errors.js +0 -19
  194. package/.agents/scripts/providers/github/issues.js +1 -11
  195. package/.agents/scripts/providers/github/mappers.js +5 -0
  196. package/.agents/scripts/providers/github/sub-issues.js +0 -47
  197. package/.agents/scripts/providers/github/tickets.js +33 -153
  198. package/.agents/scripts/providers/github.js +17 -6
  199. package/.agents/scripts/quality-preview.js +13 -6
  200. package/.agents/scripts/resolve-stories.js +236 -0
  201. package/.agents/scripts/run-coverage.js +4 -1
  202. package/.agents/scripts/run-lint.js +2 -2
  203. package/.agents/scripts/run-verify.js +31 -2
  204. package/.agents/scripts/signals-view.js +9 -10
  205. package/.agents/scripts/single-story-close.js +173 -18
  206. package/.agents/scripts/single-story-confirm-merge.js +288 -15
  207. package/.agents/scripts/single-story-init.js +6 -10
  208. package/.agents/scripts/stories-wave-tick.js +380 -53
  209. package/.agents/scripts/story-plan.js +3 -3
  210. package/.agents/scripts/update-ticket-state.js +8 -50
  211. package/.agents/skills/core/code-review-and-quality/SKILL.md +28 -450
  212. package/.agents/skills/core/code-review-and-quality/reference.md +458 -0
  213. package/.agents/skills/core/debugging-and-error-recovery/SKILL.md +22 -315
  214. package/.agents/skills/core/debugging-and-error-recovery/reference.md +323 -0
  215. package/.agents/skills/core/diagnose-friction/SKILL.md +14 -18
  216. package/.agents/skills/core/documentation-and-adrs/SKILL.md +25 -397
  217. package/.agents/skills/core/documentation-and-adrs/reference.md +403 -0
  218. package/.agents/skills/core/gates-and-baselines/SKILL.md +12 -12
  219. package/.agents/skills/core/idea-refinement/SKILL.md +3 -3
  220. package/.agents/skills/core/scope-triage/SKILL.md +3 -0
  221. package/.agents/skills/core/security-and-hardening/SKILL.md +22 -367
  222. package/.agents/skills/core/security-and-hardening/reference.md +375 -0
  223. package/.agents/skills/skills.index.json +2 -12
  224. package/.agents/skills/stack/qa/playwright-bdd/SKILL.md +2 -4
  225. package/.agents/skills/stack/qa/qa-explore-driving/SKILL.md +1 -1
  226. package/.agents/skills/stack/qa/qa-harness/SKILL.md +1 -3
  227. package/.agents/workflows/audit-architecture.md +3 -4
  228. package/.agents/workflows/audit-clean-code.md +4 -4
  229. package/.agents/workflows/audit-documentation.md +4 -5
  230. package/.agents/workflows/audit-lighthouse.md +8 -0
  231. package/.agents/workflows/audit-navigability.md +10 -0
  232. package/.agents/workflows/audit-performance.md +2 -3
  233. package/.agents/workflows/audit-quality.md +8 -9
  234. package/.agents/workflows/audit-security.md +1 -2
  235. package/.agents/workflows/audit-seo.md +10 -0
  236. package/.agents/workflows/audit-ux-ui.md +7 -0
  237. package/.agents/workflows/deliver.md +133 -45
  238. package/.agents/workflows/git-cleanup.md +2 -2
  239. package/.agents/workflows/git-deliver.md +1 -1
  240. package/.agents/workflows/helpers/acceptance-self-eval.md +34 -17
  241. package/.agents/workflows/helpers/code-quality-guardrails.md +15 -12
  242. package/.agents/workflows/helpers/code-review.md +14 -12
  243. package/.agents/workflows/helpers/deliver-story-reference.md +73 -32
  244. package/.agents/workflows/helpers/deliver-story.md +209 -118
  245. package/.agents/workflows/helpers/parallel-tooling.md +2 -2
  246. package/.agents/workflows/helpers/worktree-lifecycle.md +28 -32
  247. package/.agents/workflows/plan.md +239 -19
  248. package/.agents/workflows/qa-assist.md +6 -6
  249. package/.agents/workflows/qa-explore.md +3 -3
  250. package/.agents/workflows/qa-run.md +1 -5
  251. package/bin/mandrel.js +12 -1
  252. package/docs/CHANGELOG.md +62 -0
  253. package/lib/cli/registry.js +262 -19
  254. package/lib/cli/sync-agents.js +157 -0
  255. package/lib/cli/sync-commands.js +115 -6
  256. package/lib/cli/sync.js +168 -6
  257. package/lib/cli/update.js +105 -8
  258. package/lib/cli/version-helpers.js +131 -0
  259. package/lib/migrations/README.md +7 -5
  260. package/lib/migrations/index.js +17 -9
  261. package/lib/migrations/steps/2.1.0-retire-mi-drop-knobs.js +100 -0
  262. package/lib/migrations/steps/2.1.0-retire-verify-concurrency-cap.js +101 -0
  263. package/lib/migrations/steps/2.2.0-retire-epic-ac-tags.js +154 -0
  264. package/package.json +2 -2
  265. package/.agents/schemas/epic-perf-report.schema.json +0 -89
  266. package/.agents/schemas/lifecycle/acceptance.reconcile.failed.schema.json +0 -13
  267. package/.agents/schemas/lifecycle/acceptance.reconcile.ok.schema.json +0 -13
  268. package/.agents/schemas/lifecycle/acceptance.reconcile.skipped.schema.json +0 -13
  269. package/.agents/schemas/lifecycle/acceptance.reconcile.start.schema.json +0 -12
  270. package/.agents/schemas/lifecycle/acceptance.reconcile.waived.schema.json +0 -13
  271. package/.agents/schemas/lifecycle/epic.automerge.end.schema.json +0 -15
  272. package/.agents/schemas/lifecycle/epic.automerge.start.schema.json +0 -13
  273. package/.agents/schemas/lifecycle/epic.blocked.schema.json +0 -13
  274. package/.agents/schemas/lifecycle/epic.cleanup.end.schema.json +0 -12
  275. package/.agents/schemas/lifecycle/epic.cleanup.start.schema.json +0 -12
  276. package/.agents/schemas/lifecycle/epic.close.end.schema.json +0 -12
  277. package/.agents/schemas/lifecycle/epic.complete.schema.json +0 -13
  278. package/.agents/schemas/lifecycle/epic.finalize.end.schema.json +0 -13
  279. package/.agents/schemas/lifecycle/epic.finalize.start.schema.json +0 -12
  280. package/.agents/schemas/lifecycle/epic.merge.armed.schema.json +0 -13
  281. package/.agents/schemas/lifecycle/epic.merge.blocked.schema.json +0 -14
  282. package/.agents/schemas/lifecycle/epic.merge.confirmed.schema.json +0 -17
  283. package/.agents/schemas/lifecycle/epic.merge.ready.schema.json +0 -15
  284. package/.agents/schemas/lifecycle/epic.plan.end.schema.json +0 -18
  285. package/.agents/schemas/lifecycle/epic.plan.start.schema.json +0 -12
  286. package/.agents/schemas/lifecycle/epic.snapshot.end.schema.json +0 -16
  287. package/.agents/schemas/lifecycle/epic.snapshot.start.schema.json +0 -12
  288. package/.agents/schemas/lifecycle/epic.watch.end.schema.json +0 -29
  289. package/.agents/schemas/lifecycle/epic.watch.start.schema.json +0 -16
  290. package/.agents/schemas/lifecycle/story.heartbeat.schema.json +0 -20
  291. package/.agents/schemas/risk-verdict.schema.json +0 -53
  292. package/.agents/schemas/story-perf-summary.schema.json +0 -73
  293. package/.agents/scripts/analyze-execution.js +0 -444
  294. package/.agents/scripts/check-prepush-recovery.js +0 -90
  295. package/.agents/scripts/lib/git-merge-orchestrator.js +0 -261
  296. package/.agents/scripts/lib/observability/baseline-refresh-rate.js +0 -221
  297. package/.agents/scripts/lib/observability/hook-heartbeat.js +0 -187
  298. package/.agents/scripts/lib/observability/perf-aggregator.js +0 -813
  299. package/.agents/scripts/lib/observability/perf-report-readers.js +0 -328
  300. package/.agents/scripts/lib/observability/perf-report-render.js +0 -182
  301. package/.agents/scripts/lib/orchestration/audit-lens-routing.js +0 -128
  302. package/.agents/scripts/lib/orchestration/bookkeeping-outbox.js +0 -273
  303. package/.agents/scripts/lib/orchestration/error-journal.js +0 -139
  304. package/.agents/scripts/lib/orchestration/lifecycle/emit-story-heartbeat.js +0 -155
  305. package/.agents/scripts/lib/orchestration/lifecycle/ledger-diff.js +0 -140
  306. package/.agents/scripts/lib/orchestration/lifecycle/listeners/merge-watcher.js +0 -665
  307. package/.agents/scripts/lib/orchestration/plan-review-routing.js +0 -63
  308. package/.agents/scripts/lib/orchestration/planning/risk-verdict.js +0 -104
  309. package/.agents/scripts/lib/orchestration/planning-context-budget.js +0 -213
  310. package/.agents/scripts/lib/orchestration/planning-risk.js +0 -194
  311. package/.agents/scripts/lib/orchestration/post-merge/phases/branch-cleanup.js +0 -56
  312. package/.agents/scripts/lib/orchestration/post-merge/phases/dashboard-refresh.js +0 -21
  313. package/.agents/scripts/lib/orchestration/post-merge/phases/notification.js +0 -78
  314. package/.agents/scripts/lib/orchestration/post-merge/phases/temp-cleanup.js +0 -68
  315. package/.agents/scripts/lib/orchestration/post-merge/phases/ticket-closure.js +0 -118
  316. package/.agents/scripts/lib/orchestration/post-merge/phases/worktree-reap.js +0 -397
  317. package/.agents/scripts/lib/orchestration/preflight-cache.js +0 -187
  318. package/.agents/scripts/lib/orchestration/resolve-plan-run.js +0 -155
  319. package/.agents/scripts/lib/orchestration/retro-perf-heuristics.js +0 -275
  320. package/.agents/scripts/lib/orchestration/story-progress/story-run-progress-writer.js +0 -400
  321. package/.agents/scripts/lib/single-story/confirm-merge-follow-ups.js +0 -36
  322. package/.agents/scripts/resolve-plan-run.js +0 -117
  323. package/.agents/skills/core/analyze-execution/SKILL.md +0 -101
@@ -17,9 +17,8 @@ the lift the floor gate represents.
17
17
 
18
18
  The configuration knobs that drive these gates live in
19
19
  [`.agents/docs/configuration.md`](../docs/configuration.md) under
20
- `delivery.quality.*` and the framework-internal `DEFAULT_STORY_MERGE_RETRY` constant. This
21
- file is the runbook side — what the gate does, when it fires, and how to
22
- bootstrap or refresh it.
20
+ `delivery.quality.*`. This file is the runbook side what the gate does,
21
+ when it fires, and how to bootstrap or refresh it.
23
22
 
24
23
  The **baseline envelope, per-kind shapes, component model, writer/reader
25
24
  contract, and floor-override path** are documented in the
@@ -37,14 +36,13 @@ it once and reuse the context as you read through any individual gate.
37
36
  ## Concurrent close safety
38
37
 
39
38
  `/deliver` may close multiple Stories from separate Story branches in quick
40
- succession. The push step inside `single-story-close.js` refreshes against the
41
- latest `main` and retries a rejected Story-branch push — bounded by
42
- `DEFAULT_STORY_MERGE_RETRY.maxAttempts` (3) and
43
- `DEFAULT_STORY_MERGE_RETRY.backoffMs` (`[250, 500, 1000]`) from
44
- `.agents/scripts/lib/config/runners.js`.
45
- A real
46
- content conflict (both stories touched the same lines) aborts the loop
47
- with a clear error and leaves the local tree clean for manual resolution.
39
+ succession. Each Story rebases onto the latest `main` in its own base-sync
40
+ phase (`phases/base-sync.js`) before the push, so concurrent closes serialize
41
+ through their own worktrees rather than racing one shared branch. The push
42
+ step itself does not retry: a rejected push fails the close non-zero and the
43
+ operator resolves it, and a real content conflict (both Stories touched the
44
+ same lines) surfaces at base-sync with a clear error, leaving the local tree
45
+ clean for manual resolution.
48
46
 
49
47
  ---
50
48
 
@@ -262,9 +260,9 @@ per-round mechanic lives in
262
260
  with the gate CLI at
263
261
  [`.agents/scripts/acceptance-eval.js`](../scripts/acceptance-eval.js)).
264
262
  Each round, a fresh-context **critic pass** — independent of the
265
- implementing agent — scores the working diff against every inline
266
- `acceptance[]` item, using `verify[]` output as evidence, and yields one
267
- of three decisions:
263
+ implementing agent — scores the change set its caller injected (never one
264
+ it re-derives) against every inline `acceptance[]` item, using `verify[]`
265
+ output as evidence, and yields one of three decisions:
268
266
 
269
267
  - **proceed** — all criteria met; the Story continues to close.
270
268
  - **redraft** — unmet criteria are redrafted and re-implemented, then
@@ -515,7 +513,7 @@ does not pause automatically on `risk::high`.
515
513
 
516
514
  The sole runtime HITL pause point is `agent::blocked`: when an agent
517
515
  encounters an unresolvable blocker (including unsafe destructive actions
518
- lacking explicit authorization), it flips the ticket/Epic to
516
+ lacking explicit authorization), it flips the ticket to
519
517
  `agent::blocked`, posts friction context, and waits for operator resume
520
518
  (`agent::executing`).
521
519
 
@@ -753,10 +751,10 @@ Behaviour:
753
751
  - The `components` map is optional. When omitted, the default
754
752
  `{ "*": ["**"] }` applies and only `*` rows are ever evaluated.
755
753
  - The unified `check-baselines.js` reports breaches per component, with
756
- `*` always present in the output. The per-component progress signals
757
- (`crap-drift.js#detectComponentRegressions`,
758
- `maintainability-drift.js#detectComponentRegressions`) name the
759
- breached component in their bullet so a `*` rollup is not falsely
754
+ `*` always present in the output. The shared baselines kernel
755
+ (`lib/baselines/kernel.js`, via the per-kind rollups in
756
+ `lib/baselines/kinds/`) groups rows by component and names the
757
+ breached component in its output so a `*` rollup is not falsely
760
758
  implicated when only a component-scoped floor was crossed.
761
759
 
762
760
  #### Floor axes must match rollup axes
@@ -14,10 +14,10 @@ modules, not runnable commands). The canonical workflow narrative lives in
14
14
  compose. This file is only for "which command does X?" lookups.
15
15
 
16
16
  Every command file lives at `.agents/workflows/<name>.md` and is projected
17
- into a flat `.claude/commands/` tree by `npm run sync:commands` (the
18
- UserPromptSubmit hook keeps it current) so it shows up as a bare `/<name>`
19
- slash command (e.g. `/deliver`). The projection writes only
20
- `.claude/commands/<name>.md` — there is no plugin manifest and no
17
+ into a flat `.claude/commands/` tree by `npm run sync:commands` (kept
18
+ current at install time and on every `mandrel sync`/`update`) so it shows
19
+ up as a bare `/<name>` slash command (e.g. `/deliver`). The projection
20
+ writes only `.claude/commands/<name>.md` — there is no plugin manifest and no
21
21
  marketplace listing. The commands load in every Claude Code environment.
22
22
 
23
23
  Loop units are the one namespaced exception: files under
@@ -43,7 +43,7 @@ description, edit the workflow file’s front-matter and regenerate.
43
43
  | `/audit-documentation` | Audit the repository's main documentation for staleness, semantic drift, and completeness; emit a structured High/Medium/Low findings report. |
44
44
  | `/audit-lighthouse` | Run a Lighthouse audit (Performance / Accessibility / Best Practices / SEO) and produce a structured findings report |
45
45
  | `/audit-navigability` | Audit the whole route tree against the consumer's nav-registry SSOT — every route has a persona nav door and no nav href is dead. A deliberately-global lens (Epic #4131, F2/F3) exempt from the cross-epic-leak guard and routed onto route-adding change sets. |
46
- | `/audit-performance` | Audit hot paths, algorithmic complexity, and I/O bottlenecks in the tooling surface (`epic-close`, dispatcher, gates); propose remediations. |
46
+ | `/audit-performance` | Audit hot paths, algorithmic complexity, and I/O bottlenecks in the tooling surface (`single-story-close`, dispatcher, gates); propose remediations. |
47
47
  | `/audit-privacy` | Audit logs, telemetry, and persistence paths for PII leakage and retention violations; surface secrets exposure and consent gaps. |
48
48
  | `/audit-quality` | Audit test coverage gaps, flaky tests, missing assertions, and test-pyramid balance; recommend a remediation batch. |
49
49
  | `/audit-security` | Audit dependency CVEs, input-validation gaps, secrets handling, and auth boundaries; emit a structured High/Medium/Low findings report. |
@@ -51,7 +51,7 @@ description, edit the workflow file’s front-matter and regenerate.
51
51
  | `/audit-sre` | "Audit production-readiness for a release candidate: SLOs, observability, runbooks, error budgets, and rollback paths." |
52
52
  | `/audit-to-stories` | Convert findings produced by the audit-\* workflows into actionable GitHub Stories. Reads temp/audits/audit-\*-results.md, groups findings cross-audit, deduplicates against existing Issues by fingerprint, and either chains into /plan --seed-file or opens standalone Stories. |
53
53
  | `/audit-ux-ui` | Audit UX/UI consistency and design system adherence |
54
- | `/deliver` | Unified delivery entry point. Delivers one or more Stories via the single deliver-story engine — story-<id> → PR → main. Sequences N>1 by depends\_on and runs the per-run epilogue once at the end. |
54
+ | `/deliver` | Unified delivery entry point. Takes a list of Story ids, resolves their dependency graph from live state, and delivers each via the single deliver-story engine — story-<id> → PR → main. |
55
55
  | `/git-cleanup` | Tidy the local checkout in four phases: fast-forward `main`, prune stale remote-tracking refs, sweep merged branches (squash-aware), and triage `git stash` entries — each step gated by operator confirmation. |
56
56
  | `/git-deliver` | Single ad-hoc delivery command for working-tree changes. Detects the git setup and escalates to the right terminal step — commit only, commit + push, or commit + push + open a PR with native auto-merge — picking the default from observable state and letting flags pin any level explicitly. Replaces the retired git-commit-all, git-push, and git-pr-all trio. |
57
57
  | `/mandrel-update` | npm-era upgrade wraparound for a Mandrel consumer. Runs `npx mandrel update` (resolve newest published version → install → re-materialize `.agents/` → migrate → doctor → surface changelog) as the single mechanical step, then walks the operator through the judgment wraparound the CLI deliberately leaves unowned: reconcile `.agentrc.json`, install the Epic #1386 quality-gate surface, refresh the harness permission allowlist, reconcile the consumer's `AGENTS.md` / runbooks against the surfaced changelog, and stage + commit the staged lockfile bump. |
@@ -38,9 +38,14 @@ The skill library uses a **two-tier architecture**:
38
38
 
39
39
  When a task involves a specific domain or technology, you MUST read the
40
40
  corresponding `.agents/skills/[tier]/[category]/[skill-name]/SKILL.md` file and
41
- apply its constraints. Review the skill's `examples/` directory or
42
- `examples.md` sibling **when present and relevant** to the taskmost skills
43
- do not ship one, so do not probe blindly. When uncertain which skill applies,
41
+ apply its constraints. A `SKILL.md` leads with its **Policy Capsule** — the
42
+ contract, and the whole cost of activating the skillfollowed by pointers
43
+ into an on-demand `reference.md` sibling holding the long-form material
44
+ (patterns, worked examples, checklists). This is the same split the always-on
45
+ rules use (§ 1.F): read the capsule on activation, and open a `reference.md`
46
+ section only when the task actually engages it. Review the skill's `examples/`
47
+ directory or `examples.md` sibling **when present and relevant** to the task —
48
+ most skills do not ship one, so do not probe blindly. When uncertain which skill applies,
44
49
  match the task against the one-line `description` in each skill's frontmatter
45
50
  (catalogued in `.agents/skills/skills.index.json`). Skills compose: a complete
46
51
  feature typically flows `idea-refinement` → the `/plan` workflow →
@@ -157,18 +162,17 @@ technology context is intentionally kept out of `.agentrc.json`.
157
162
 
158
163
  You MUST log telemetry about operational difficulty or automation
159
164
  opportunities you hit. Friction is a **local NDJSON signal**:
160
- `diagnose-friction.js` appends one `kind: friction` record to the per-Epic/
165
+ `diagnose-friction.js` appends one `kind: friction` record to the per-run/
161
166
  per-Story `signals.ndjson` stream on local disk — not posted to the ticket at
162
167
  capture time; the retro phase surfaces the aggregate as routed proposals.
163
168
 
164
169
  - **Command**:
165
170
  `node .agents/scripts/diagnose-friction.js --story [STORY_ID] --cmd [FAILED_COMMAND]`
166
- (add `--epic [EPIC_ID]` under an Epic).
167
171
  - **When to fire**: after repeated tool-validation errors, an unrecoverable
168
172
  command failure, ambiguity needing self-correction, or repetitive
169
173
  boilerplate steps a workflow/skill could simplify.
170
174
 
171
- The schema validation, the standalone (no-Epic) stream path, and the
175
+ The schema validation, the standalone stream path, and the
172
176
  never-silently-dropped guarantee are reference detail — see
173
177
  [`docs/execution-reference.md` § Friction telemetry](docs/execution-reference.md#friction-telemetry).
174
178
 
@@ -203,15 +207,11 @@ recurred, and what assumption you would test next, then either Re-Plan or
203
207
  hand back to the operator. Do not paper over the loop with another
204
208
  just-in-case retry.
205
209
 
206
- This protocol is not soft-prompt-only it has a runtime substrate. While
207
- executing as a Story delivery sub-agent (via `helpers/deliver-story`), you
208
- MUST emit a `story.heartbeat` lifecycle event on every Task transition (or
209
- whenever you stall on a long-running step) so the parent `/deliver`
210
- sequencer can distinguish a child still making progress from a dead one. If
211
- you genuinely cannot proceed, transition to `agent::blocked` and exit
212
- non-zero — never fall silent. A child with no recent `story.heartbeat`, no
213
- commit on its `story-<id>` branch, and no `agent::blocked` label is exactly
214
- the stall shape the parent run must detect and escalate.
210
+ While executing as a Story delivery sub-agent (via `helpers/deliver-story`),
211
+ if you genuinely cannot proceed you MUST transition to `agent::blocked` and
212
+ exit non-zero **never fall silent**. A stalled child that reports nothing
213
+ is indistinguishable from a dead one, and the parent `/deliver` run can only
214
+ escalate what you surface.
215
215
 
216
216
  ### J. HITL Blocker Escalation (Safe Execution)
217
217
 
@@ -258,14 +258,16 @@ Two carve-outs refine the ordering:
258
258
 
259
259
  ## 2. FinOps & Token Budgeting (Economic Guardrails)
260
260
 
261
- Mandrel does **not** enforce live LLM spend from response metadata. It caps
262
- **planning context budget** (`planning.context.maxBytes`) and related
263
- envelopes; your host
264
- runtime owns session quota and hard stops. The config keys, the ≈4-char/token
265
- estimate, and the elision behaviour are reference detail see
261
+ Mandrel does **not** enforce live LLM spend from response metadata, and it has
262
+ no operator-tunable context budget. What it does bound are fixed framework
263
+ ceilings the `/plan` context envelope and plan-time Story sizing — and they
264
+ **fail closed** with a message naming what to trim, rather than silently
265
+ handing the model a truncated context. Your host runtime owns session quota and
266
+ hard stops. The constants, the ≈4-char/token estimate, and the trim options are
267
+ reference detail — see
266
268
  [`docs/execution-reference.md` § FinOps & token budgeting](docs/execution-reference.md#finops--token-budgeting-economic-guardrails).
267
- Consult it when a task prompt was elided or `/deliver` refused a fan-out on
268
- budget grounds.
269
+ Consult it when `/plan` refused an over-ceiling envelope or an over-budget
270
+ Story count.
269
271
 
270
272
  ---
271
273
 
@@ -273,70 +275,51 @@ budget grounds.
273
275
 
274
276
  1. **Context First:** Before proposing any solution, understand the
275
277
  repository's tech stack, historical context, and structure.
276
- - **Digest-first Reading (planning & interactive tasks, Story #4433)**:
277
- For planning (`/plan`) and interactive tasks, read the project's **docs
278
- digest** before reading any full doc file do not read every file
279
- listed in `project.docsContextFiles` up front. The epic planning path
280
- ensures (generates or reuses) a per-Epic docs digest a single compact
281
- outline (path, byte size, heading outline with line numbers, and the
282
- first paragraph under each `##`) built from `project.docsContextFiles`
283
- at `temp/run-<id>/docs-digest.md` (`plan-context.js`, via the
284
- shared generator in
285
- `.agents/scripts/lib/orchestration/docs-digest.js`; the same file the
286
- `/deliver` story sub-agents below already consume). Use the digest to
287
- decide which docs bear on the task at hand, then **pull the full file
288
- on demand** (jump to the section at the line number the digest names)
289
- when a section actually bears on the decision. The decisions log
290
- (`decisions.md`) may be either a single-file dated-entry log or an
291
- **index** into a `decisions/` ADR directory — both are first-class
292
- layouts (see
278
+ - **Digest-first Reading (Story #4433)** stated once here; it governs
279
+ every call site. **Never ingest the whole `project.docsContextFiles` set
280
+ up front.** Read the **docs digest**a compact outline (path, byte
281
+ size, heading outline with line numbers, and the first paragraph under
282
+ each `##`) built from those files — decide which docs bear on the task at
283
+ hand, then **pull the full file on demand**, jumping to the section at
284
+ the line number the digest names. This is a hard cutover: no
285
+ read-every-file branch is retained on any path.
286
+
287
+ The call sites differ only in how the digest reaches you — the
288
+ discipline above is identical for all of them:
289
+ - `/plan` and interactive tasks a file at `temp/run-<id>/docs-digest.md`
290
+ (`plan-context.js`, via the shared generator in
291
+ `.agents/scripts/lib/orchestration/docs-digest.js`).
292
+ - `/deliver` Story sub-agents (`helpers/deliver-story`) the
293
+ `docsDigestPath` the caller threads.
294
+ - Standalone-Story planning (`story-plan.js --emit-context`) — inline as
295
+ `corpusContext.docsDigest` (no per-run directory to anchor a
296
+ file), alongside `corpusContext.relevantSections`.
297
+
298
+ When no digest exists for the task at hand — an ad hoc task outside
299
+ `/deliver`, `project.docsContextFiles` unset, or a null `docsDigestPath` —
300
+ there is **no mandatory docs read**: read a full doc only when the task's
301
+ own context points you at one.
302
+
303
+ The decisions log (`decisions.md`) may be either a single-file
304
+ dated-entry log or an **index** into a `decisions/` ADR directory — both
305
+ are first-class layouts (see
293
306
  [`skills/core/documentation-and-adrs`](skills/core/documentation-and-adrs/SKILL.md)).
294
- When it is an index, treat the index like any other digested doc
295
- link-follow the per-ADR bodies under `decisions/` on demand, not
296
- auto-loaded into every task's context. When no digest exists yet for
297
- the task at hand (an ad hoc interactive task with no Epic in scope, or
298
- `project.docsContextFiles` unset) there is no mandatory docs read —
299
- read a full doc only when the task itself points you at one. This is a
300
- hard cutover: there is no read-every-`docsContextFiles`-file branch
301
- retained.
302
- - **Digest-first Reading (`/deliver` story sub-agents)**: A `/deliver`
303
- Story delivery sub-agent (dispatched via `helpers/deliver-story`) does
304
- **not** re-read the full `project.docsContextFiles` set per Story. When
305
- the caller threads a `docsDigestPath`, use that compact outline to decide
306
- which docs are relevant, then **pull the full file on demand**. When
307
- `docsDigestPath` is null there is no digest to read and no per-Story docs
308
- mandate — read a full doc only if the Story's own context points you at
309
- one. This is the hard cutover from the former
310
- read-every-file-per-Story rule: delivery children no longer ingest the
311
- whole docs set up front.
312
- - **Standalone-Story planning path (`story-plan.js --emit-context`)**:
313
- The standalone counterpart to `/plan` for Stories that do not attach
314
- to an Epic does not write a `docs-digest.md` file at all — there is
315
- no per-Epic directory to anchor one. Instead `buildCorpusContext`
316
- (`.agents/scripts/lib/planning-corpus.js`) builds the same compact
317
- digest shape in memory and threads it inline as
318
- `corpusContext.docsDigest` on the `--emit-context` envelope, next to
319
- `corpusContext.relevantSections` (ranked excerpts from existing
320
- Epics' Tech Spec sections). Treat `corpusContext.docsDigest` exactly
321
- like the file-based digest above — decide relevance from the outline,
322
- then pull the full file on demand — the only difference is the
323
- delivery mechanism (inline JSON field vs. a temp file path), not the
324
- content or the digest-first discipline.
307
+ Treat an index like any other digested doc: link-follow the per-ADR
308
+ bodies on demand rather than auto-loading them.
325
309
  - **Conditional Reads**: When the task touches UI copy, layout, or
326
310
  routing and the corresponding file is present in the project, also
327
311
  read `docs/style-guide.md` and `docs/web-routes.md`. Skip both when
328
312
  absent or unrelated to the task — they are not part of the universal
329
313
  mandatory set.
330
- - **Epic Context**: Additionally, read the current Epic's body — the
331
- single planning document (ideation sections plus the folded Tech
332
- Spec sections; Story #4324 retired the separate context tickets) —
333
- and the task-specific instructions.
314
+ - **Story Context**: Additionally, read the current Story's body — the
315
+ inline `## Spec` plus its `acceptance[]` / `verify[]` entries — and
316
+ the task-specific instructions.
334
317
  - **Optimization**: For large projects, prioritize targeted retrieval
335
318
  (semantic code search or focused text search) to isolate specific
336
319
  schemas or decisions before reading broad files.
337
320
  2. **Plan First:** For non-trivial tasks (3+ steps or architectural
338
- decisions), enter **Plan Mode**. Update the Epic body's Tech Spec
339
- sections (via `/plan`) or create a new Technical Specification document
321
+ decisions), enter **Plan Mode**. Update the Story's `## Spec`
322
+ (via `/plan`) or create a new Technical Specification document
340
323
  in the `docs/` root (if not already handled by a ticket) before
341
324
  touching code.
342
325
  3. **Artifacts over Chat:** Create log files for test results, build
@@ -429,10 +412,12 @@ v2 collapses the ticket model to **Story**. Acceptance criteria and
429
412
  verification steps live inline on the Story body (`acceptance[]` /
430
413
  `verify[]`); the folded Tech Spec lives inline in `## Spec` (over-budget
431
414
  Specs fail closed — split or tighten; never write under `docs/`). Optional
432
- `depends_on` edges order rare multi-Story plan-runs.
415
+ `depends_on` edges order rare multi-Story runs — and, because `/deliver`
416
+ resolves them from live state, they order Stories **across plan runs and
417
+ over time**, not just within one batch.
433
418
 
434
- - `/plan` emits one or more `type::story` issues (default N=1); N>1 shares a
435
- `plan-run::<id>` label.
419
+ - `/plan` emits one or more `type::story` issues (default N=1). There is no
420
+ batch label: `/deliver` takes ids and discovers the graph.
436
421
  - Each Story is executed by `helpers/deliver-story` (invoked from
437
422
  [`/deliver`](workflows/deliver.md)). There is no per-Task sub-loop; the
438
423
  agent authors commit subjects directly per
@@ -26,8 +26,8 @@ guess.
26
26
 
27
27
  Fetch the failing job log and record the failure signature (the failing check
28
28
  name, the run id / run link, and the first distinctive error line). The
29
- watcher already writes this to `temp/epic-<epicId>-ci-digest.{json,md}` (Epic
30
- path) or surfaces it inline (standalone path) — start from that digest.
29
+ watcher already writes this to `temp/story-<id>-ci-digest.{json,md}` — start
30
+ from that digest.
31
31
 
32
32
  ### 2. Classify the failure
33
33
 
@@ -71,7 +71,7 @@ get to wave it off because "CI was flaky."
71
71
  genuine attempt, that itself is a finding — record it in the issue you file
72
72
  in step 4.
73
73
  2. **Check whether it also fails on `main`.** Run the same check against an
74
- unmodified `main` (or the Epic base branch) checkout. If it fails on `main`
74
+ unmodified `main` checkout. If it fails on `main`
75
75
  too, the defect is **pre-existing** — it is not caused by the diff under
76
76
  review, and the fix belongs in a separate change, not silently folded into
77
77
  this delivery.
@@ -23,6 +23,16 @@ scenarios. Use the canonical set below; do not invent ad-hoc tags.
23
23
  - `@flaky` — operational quarantine tag. Scenarios carrying this tag are
24
24
  excluded from the gating suite and run in a dedicated non-blocking job
25
25
  until stabilized. Treat `@flaky` as a debt marker, not a permanent label.
26
+ - `@skip` — scaffold-gating tag. Applied to scenarios scaffolded ahead of
27
+ their implementation (e.g. by a wave-0 BDD scaffold Story); the scenario
28
+ is excluded from the gating suite until the implementing Story removes
29
+ the tag (the "de-skip" edit). Unlike `@flaky`, `@skip` marks planned
30
+ not-yet-implemented behavior, never a stability problem.
31
+
32
+ Retired: the `@epic-<id>-ac-N` namespaced AC tag. Its consumer
33
+ (`acceptance-spec-reconciler.js`) was deleted in the v2 Epic removal, so
34
+ the tag is inert — do not apply it to new scenarios. The `mandrel update`
35
+ migration strips surviving instances from consumer feature files.
26
36
 
27
37
  Rules:
28
38
 
@@ -37,8 +37,10 @@ which deleted the existing compatibility shim layer across
37
37
  `wave-session.js`, `IExecutionAdapter` / `ManualDispatchAdapter`, lifecycle
38
38
  emit shims, and duplicate progress/comment writers in one pass. The
39
39
  per-finding closing references (audit Findings #10, #11, #13, #17) live in
40
- the merged PRs and the Epic #2646 history; the standing forward-looking
41
- audit lives at [`docs/roadmap.md`](../../docs/roadmap.md) (Part 1 Model-Evolution Audit).
40
+ the merged PRs and the Epic #2646 history; the Part 1 — Model-Evolution
41
+ Audit analysis this section grew out of is preserved at
42
+ `docs/roadmap.md` @ tag `mandrel-v1.94.0` (see the Historical-anchors
43
+ table in the live [`docs/roadmap.md`](../../docs/roadmap.md)).
42
44
 
43
45
  Practical guidance when authoring a contract change:
44
46
 
@@ -117,55 +119,44 @@ operator intervention:
117
119
  owning flow's hygiene step regressed — fix the flow, do not codify the manual
118
120
  sweep.
119
121
 
120
- ### Shared-checkout contention (Story #4460)
121
-
122
- `story-close.js`'s merge phase runs `git checkout <epic-branch>` directly in
123
- the **shared main repo checkout** (`close-inputs.js` resolves `mainCwd` to
124
- `PROJECT_ROOT`), not an isolated worktree. `lib/epic-merge-lock.js` guards
125
- that checkout with a **per-Epic** filesystem lock
126
- (`epic-<epicId>.merge.lock`) so two `story-close.js` runs for the **same**
127
- Epic serialize against each otherbut nothing stops a **different**
128
- Epic's concurrently-running `story-close.js` from treating the same shared
129
- checkout as scratch space at the same time.
130
-
131
- - **Recognition signature**: a `git checkout`/`git switch` failure during
132
- the merge phase whose message is `error: Your local changes ... would be
133
- overwritten by checkout`, where the shared checkout is parked on a
134
- **different** epic's branch (e.g. `epic/4405`) than the one the current
135
- `story-close.js` run is trying to merge (e.g. `epic/4425`), with
136
- uncommitted edits that belong to that other Epic's delivery. This was
137
- observed live during Epic #4425 delivery (Stories #4427/#4428) colliding
138
- with a concurrently-running Epic #4405 session, and had to be worked
139
- around by hand via `git stash push -u`.
140
- - **The fix `assertSharedCheckoutAvailable`**
141
- (`lib/orchestration/story-close/shared-checkout-guard.js`), called from
142
- `runFinalizeMerge` in `lib/orchestration/story-close/merge-runner.js`
143
- immediately before the merge-phase `git checkout <epicBranch>`. It
144
- **composes with, not replaces,** the per-Epic lock:
145
- - It first checks the shared common `.git/` dir for a **foreign**
146
- (different-epic) `epic-*.merge.lock` file whose recorded PID is still
147
- alive (`findForeignActiveEpicLock` in `lib/epic-merge-lock.js`). If
148
- found, the merge phase fails fast with a diagnostic naming the holding
149
- epic id, its lock-file path, and its PID/acquired-at timestamp
150
- instead of surfacing the raw git checkout error.
151
- - It then checks whether the shared checkout is simply dirty (via `git
152
- status --porcelain`), regardless of whose branch is checked out, and
153
- reports the dirty file list plus the currently-checked-out branch in
154
- the failure diagnostic.
155
- - It never inspects the **caller's own** epic-id lock namespace, so
156
- same-epic concurrent `story-close.js` runs continue to serialize
157
- solely through `withEpicMergeLock` (the existing per-Epic lock) before
158
- this guard ever executes — this guard only ever refuses on a truly
159
- _foreign_ epic's live lock or unrelated dirt.
160
- - **Not fixed by this guard**: the guard reports the contention early and
161
- actionably; it does not redesign the merge phase to use an isolated
162
- worktree, and it does not change `restoreStartingBranch`'s existing
163
- dirty-tree refusal behavior (`phases/branch-restore.js`) — both remain
164
- out of scope. Resolution of an actual collision is still manual: wait for
165
- the other Epic's story-close run to finish, or — only once you have
166
- independently confirmed that process is no longer running — remove the
167
- stale lock file and resolve the dirty tree by hand (stash/commit/reset;
168
- never `git reset --hard` or `git checkout --force`).
122
+ ### Shared-checkout contention (Stories #4460, #4424, #4545)
123
+
124
+ **One delivery per checkout is the model.** v2 has no Epic integration branch
125
+ and no merge phase that parks the shared checkout on someone else's branch:
126
+ each Story works in its own worktree (`.worktrees/story-<id>/`) and lands by
127
+ pushing `story-<id>` and opening a PR. The Epic-era collision this section used
128
+ to describe `story-close.js` running `git checkout <epic-branch>` in the
129
+ shared main checkout under a per-Epic `epic-*.merge.lock` is gone with the
130
+ machinery that caused it (Story #4545 deleted the last of that prose; the six
131
+ modules it named had already been removed in the v2.0.0 cutover).
132
+
133
+ Two guards remain, and they cover different hazards:
134
+
135
+ - **Per-Story lease** (`lib/orchestration/single-story-lease-guard.js`). The
136
+ standalone path has no Epic-scoped dispatch manifest to serialize two
137
+ operators driving the **same** Story, so `single-story-init.js` takes an
138
+ exclusive, time-bounded lease on the Story ticket (assignee-as-lease) and
139
+ clears it at close. It **fails closed** on a foreign assignee — there is no
140
+ heartbeat ledger to judge staleness from so a foreign holder always blocks
141
+ unless you pass `--steal`, which you should do only after independently
142
+ confirming the other run is dead.
143
+
144
+ - **Wrong-tree guard** (`lib/orchestration/single-story-close/phases/wrong-tree-guard.js`,
145
+ Stories #3364 / #4424). `cd <workCwd>` steers the Bash tool's cwd but does
146
+ **not** scope path-based Edit/Write tools, which resolve absolute paths and
147
+ ignore cwd. An agent whose shell is correctly inside the worktree can still
148
+ edit the main checkout; close then gates a clean worktree and opens a
149
+ silent empty-diff PR. The guard inspects
150
+ `git -C <mainCheckout> status --porcelain` and intersects stray **tracked**
151
+ paths with the Story's own diff-path set, so a concurrent session's unrelated
152
+ dirt does not false-positive (framework-gap #4420). Untracked files are
153
+ ignored as scratch.
154
+
155
+ - **Recognition signature**: close aborts naming stray files in the main
156
+ checkout that intersect the Story's diff. **Resolution**: relocate those
157
+ edits under the worktree, restore the main checkout
158
+ (`git -C <main-repo> checkout -- <files>`), then re-run `/deliver <storyId>`.
159
+ Never `git reset --hard` or `git checkout --force` to clear the way.
169
160
 
170
161
  ## Documentation Freshness Gate
171
162
 
@@ -2,7 +2,7 @@
2
2
  "$schema": "https://json-schema.org/draft/2020-12/schema",
3
3
  "$id": "acceptance-eval-verdict",
4
4
  "title": "Acceptance Self-Eval Verdict",
5
- "description": "Structured output of one independent (fresh-context) acceptance self-eval round (Story #3819). Produced by the critic pass in the Story-implementation phase (helpers/deliver-story.md Step 1a), written under the gitignored temp tree, and consumed by acceptance-eval.js to enforce the bounded round cap and decide whether the Story proceeds to `closing`, redrafts, or escalates to `agent::blocked`. The author MUST NOT be the evaluator — the verdict is an independent judgment of the working diff against each inline acceptance[] item.",
5
+ "description": "Structured output of one independent (fresh-context) acceptance self-eval round (Story #3819). Produced by the critic pass in the Story-implementation phase (helpers/deliver-story.md Step 1a), written under the gitignored temp tree, and consumed by acceptance-eval.js to enforce the bounded round cap and decide whether the Story proceeds to `closing`, redrafts, or escalates to `agent::blocked`. The author MUST NOT be the evaluator — the verdict is an independent judgment of the caller-injected change set against each inline acceptance[] item.",
6
6
  "type": "object",
7
7
  "required": ["storyId", "schemaVersion", "round", "criteria"],
8
8
  "properties": {
@@ -52,7 +52,7 @@
52
52
  "verdict": {
53
53
  "type": "string",
54
54
  "enum": ["met", "partial", "unmet"],
55
- "description": "Per-criterion judgment of the working diff. `met` clears the criterion; `partial` and `unmet` both trigger a redraft round (subject to the cap)."
55
+ "description": "Per-criterion judgment of the caller-injected change set. `met` clears the criterion; `partial` and `unmet` both trigger a redraft round (subject to the cap)."
56
56
  },
57
57
  "evidence": {
58
58
  "type": "string",