mandrel 2.0.0 → 2.1.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 (311) hide show
  1. package/.agents/README.md +59 -28
  2. package/.agents/agents/acceptance-critic.md +9 -7
  3. package/.agents/agents/story-worker.md +41 -46
  4. package/.agents/audit-checklists/performance.md +1 -1
  5. package/.agents/docs/SDLC.md +51 -44
  6. package/.agents/docs/agentrc-reference.json +8 -13
  7. package/.agents/docs/configuration.md +32 -56
  8. package/.agents/docs/execution-reference.md +39 -10
  9. package/.agents/docs/quality-gates.md +14 -16
  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/git-conventions-reference.md +42 -51
  14. package/.agents/schemas/agentrc.schema.json +34 -45
  15. package/.agents/schemas/audit-rules.json +59 -1
  16. package/.agents/schemas/audit-rules.schema.json +33 -1
  17. package/.agents/schemas/lifecycle/README.md +1 -2
  18. package/.agents/schemas/lifecycle/ledger-record.schema.json +1 -1
  19. package/.agents/schemas/lifecycle/merge.flip-failed.schema.json +33 -0
  20. package/.agents/schemas/lifecycle/merge.unlanded.schema.json +1 -0
  21. package/.agents/schemas/lifecycle/story.merged.schema.json +1 -1
  22. package/.agents/schemas/signal-event.schema.json +3 -3
  23. package/.agents/schemas/story-deliver-terminal.schema.json +152 -0
  24. package/.agents/schemas/validation-evidence.schema.json +1 -1
  25. package/.agents/scripts/acceptance-eval.js +22 -66
  26. package/.agents/scripts/agents-bootstrap-github.js +1 -1
  27. package/.agents/scripts/bootstrap.js +3 -3
  28. package/.agents/scripts/check-dead-exports.js +43 -104
  29. package/.agents/scripts/check-doc-links.js +2 -2
  30. package/.agents/scripts/check-lifecycle-lint.js +1 -1
  31. package/.agents/scripts/check-workflow-cli-lint.js +91 -0
  32. package/.agents/scripts/deliver-recover.js +122 -0
  33. package/.agents/scripts/drain-pending-cleanup.js +1 -1
  34. package/.agents/scripts/evidence-gate.js +20 -50
  35. package/.agents/scripts/generate-skills-index.js +17 -1
  36. package/.agents/scripts/generate-workflows-doc.js +4 -4
  37. package/.agents/scripts/lib/ITicketingProvider.js +1 -19
  38. package/.agents/scripts/lib/audit-suite/selector.js +323 -23
  39. package/.agents/scripts/lib/baselines/kinds/maintainability.js +0 -11
  40. package/.agents/scripts/lib/bootstrap/ci-workflow-template.js +28 -33
  41. package/.agents/scripts/lib/bootstrap/manifest.js +8 -11
  42. package/.agents/scripts/lib/bootstrap/project-bootstrap.js +30 -53
  43. package/.agents/scripts/lib/bootstrap/quality-bootstrap.js +0 -2
  44. package/.agents/scripts/lib/checks/core-bare-clean.js +4 -1
  45. package/.agents/scripts/lib/checks/index.js +1 -1
  46. package/.agents/scripts/lib/checks/loop-health.js +12 -11
  47. package/.agents/scripts/lib/checks/state.js +17 -248
  48. package/.agents/scripts/lib/checks/story-init-not-backgrounded.js +3 -3
  49. package/.agents/scripts/lib/checks/subagent-agent-tool-required.js +3 -4
  50. package/.agents/scripts/lib/checks/worktree-bootstrap-env.js +2 -2
  51. package/.agents/scripts/lib/checks/worktree-residue-biome.js +3 -3
  52. package/.agents/scripts/lib/cli-args.js +23 -2
  53. package/.agents/scripts/lib/close-validation/gates.js +13 -13
  54. package/.agents/scripts/lib/close-validation/projections/inputs.js +7 -7
  55. package/.agents/scripts/lib/close-validation/projections/maintainability.js +12 -12
  56. package/.agents/scripts/lib/close-validation/runner.js +13 -21
  57. package/.agents/scripts/lib/close-validation/telemetry.js +17 -8
  58. package/.agents/scripts/lib/config/delivery-routing.js +7 -6
  59. package/.agents/scripts/lib/config/explain.js +10 -16
  60. package/.agents/scripts/lib/config/github.js +7 -5
  61. package/.agents/scripts/lib/config/limits.js +15 -25
  62. package/.agents/scripts/lib/config/quality.js +11 -14
  63. package/.agents/scripts/lib/config/runners.js +8 -21
  64. package/.agents/scripts/lib/config/temp-paths.js +18 -56
  65. package/.agents/scripts/lib/config-settings-schema-delivery.js +31 -13
  66. package/.agents/scripts/lib/config-settings-schema-quality.js +9 -2
  67. package/.agents/scripts/lib/config-settings-schema.js +48 -22
  68. package/.agents/scripts/lib/dead-exports-knip.js +105 -0
  69. package/.agents/scripts/lib/dead-exports-mode.js +51 -0
  70. package/.agents/scripts/lib/duplicate-search.js +38 -7
  71. package/.agents/scripts/lib/findings/promote-finding.js +23 -14
  72. package/.agents/scripts/lib/format-generated-json.js +97 -0
  73. package/.agents/scripts/lib/framework-version.js +19 -189
  74. package/.agents/scripts/lib/gh-exec.js +8 -0
  75. package/.agents/scripts/lib/git-branch-lifecycle.js +0 -158
  76. package/.agents/scripts/lib/git-utils.js +0 -14
  77. package/.agents/scripts/lib/json-utils.js +1 -2
  78. package/.agents/scripts/lib/label-constants.js +0 -15
  79. package/.agents/scripts/lib/label-taxonomy.js +1 -12
  80. package/.agents/scripts/lib/observability/active-story-env.js +42 -163
  81. package/.agents/scripts/lib/observability/runtime-friction.js +243 -0
  82. package/.agents/scripts/lib/observability/signal-validator.js +4 -4
  83. package/.agents/scripts/lib/observability/signals-writer.js +6 -82
  84. package/.agents/scripts/lib/observability/source-classifier.js +2 -2
  85. package/.agents/scripts/lib/observability/tool-trace-hook.js +2 -12
  86. package/.agents/scripts/lib/orchestration/acceptance-clusters.js +1 -1
  87. package/.agents/scripts/lib/orchestration/acceptance-eval-decision.js +2 -2
  88. package/.agents/scripts/lib/orchestration/ceremony-routing.js +43 -45
  89. package/.agents/scripts/lib/orchestration/code-review.js +58 -168
  90. package/.agents/scripts/lib/orchestration/consolidation-precondition.js +3 -3
  91. package/.agents/scripts/lib/orchestration/deliver-recover.js +328 -0
  92. package/.agents/scripts/lib/orchestration/detectors-phase.js +12 -6
  93. package/.agents/scripts/lib/orchestration/git-cleanup/phases/fast-forward.js +34 -0
  94. package/.agents/scripts/lib/orchestration/lease-guard-shared.js +3 -2
  95. package/.agents/scripts/lib/orchestration/lifecycle/emit-ledger-event.js +142 -0
  96. package/.agents/scripts/lib/orchestration/lifecycle/emit-loop-tick.js +9 -11
  97. package/.agents/scripts/lib/orchestration/lifecycle/emit-merge-flip-failed.js +86 -0
  98. package/.agents/scripts/lib/orchestration/lifecycle/emit-merge-unlanded.js +37 -103
  99. package/.agents/scripts/lib/orchestration/lifecycle/listeners/README.md +7 -3
  100. package/.agents/scripts/lib/orchestration/lifecycle/listeners/watcher.js +50 -85
  101. package/.agents/scripts/lib/orchestration/lifecycle/trace-logger.js +3 -14
  102. package/.agents/scripts/lib/orchestration/merge-block-class.js +76 -20
  103. package/.agents/scripts/lib/orchestration/merge-poll.js +104 -0
  104. package/.agents/scripts/lib/orchestration/plan-context.js +114 -24
  105. package/.agents/scripts/lib/orchestration/plan-critic-conditions.js +11 -22
  106. package/.agents/scripts/lib/orchestration/plan-critics-evaluate.js +3 -7
  107. package/.agents/scripts/lib/orchestration/plan-metrics.js +38 -6
  108. package/.agents/scripts/lib/orchestration/plan-persist/fan-out-gate.js +16 -6
  109. package/.agents/scripts/lib/orchestration/plan-persist/persist-helpers.js +173 -25
  110. package/.agents/scripts/lib/orchestration/plan-persist/plan-context-source.js +116 -0
  111. package/.agents/scripts/lib/orchestration/plan-persist/run-plan-persist.js +280 -75
  112. package/.agents/scripts/lib/orchestration/plan-persist/story-ops.js +472 -55
  113. package/.agents/scripts/lib/orchestration/plan-persist/summary.js +21 -16
  114. package/.agents/scripts/lib/orchestration/plan-persist/supersede-ops.js +509 -0
  115. package/.agents/scripts/lib/orchestration/planning/authoring-context.js +41 -40
  116. package/.agents/scripts/lib/orchestration/planning/spec-authoring-grounding.js +1 -1
  117. package/.agents/scripts/lib/orchestration/resolve-stories.js +344 -0
  118. package/.agents/scripts/lib/orchestration/retro-proposals.js +7 -7
  119. package/.agents/scripts/lib/orchestration/review-depth.js +105 -40
  120. package/.agents/scripts/lib/orchestration/review-providers/findings-renderer.js +3 -13
  121. package/.agents/scripts/lib/orchestration/review-providers/native.js +1 -154
  122. package/.agents/scripts/lib/orchestration/review-providers/review-depth.js +3 -2
  123. package/.agents/scripts/lib/orchestration/review-providers/security-review.js +1 -1
  124. package/.agents/scripts/lib/orchestration/review-providers/types.js +5 -4
  125. package/.agents/scripts/lib/orchestration/review-providers/ultrareview.js +1 -1
  126. package/.agents/scripts/lib/orchestration/run-epilogue.js +374 -16
  127. package/.agents/scripts/lib/orchestration/single-story-close/phases/auto-merge.js +24 -0
  128. package/.agents/scripts/lib/orchestration/single-story-close/phases/base-sync.js +11 -9
  129. package/.agents/scripts/lib/orchestration/single-story-close/phases/close-validation.js +4 -4
  130. package/.agents/scripts/lib/orchestration/single-story-close/phases/code-review.js +3 -12
  131. package/.agents/scripts/lib/orchestration/single-story-close/phases/confirm-merge.js +608 -152
  132. package/.agents/scripts/lib/orchestration/single-story-close/phases/options.js +72 -30
  133. package/.agents/scripts/lib/orchestration/single-story-close/phases/post-land.js +305 -0
  134. package/.agents/scripts/lib/orchestration/single-story-close/phases/pull-request.js +1 -1
  135. package/.agents/scripts/lib/orchestration/single-story-close/phases/review-block.js +12 -8
  136. package/.agents/scripts/lib/orchestration/single-story-close/phases/worktree-reap.js +37 -4
  137. package/.agents/scripts/lib/orchestration/single-story-close/phases/wrong-tree-guard.js +2 -2
  138. package/.agents/scripts/lib/orchestration/single-story-close/runner.js +264 -43
  139. package/.agents/scripts/lib/orchestration/single-story-lease-guard.js +1 -1
  140. package/.agents/scripts/lib/orchestration/story-close/format-autofix.js +10 -10
  141. package/.agents/scripts/lib/orchestration/story-close/phases/code-review.js +15 -32
  142. package/.agents/scripts/lib/orchestration/story-deliver-terminal.js +360 -0
  143. package/.agents/scripts/lib/orchestration/story-follow-ups.js +75 -14
  144. package/.agents/scripts/lib/orchestration/story-init-remote.js +12 -8
  145. package/.agents/scripts/lib/orchestration/story-plan-state.js +14 -29
  146. package/.agents/scripts/lib/orchestration/task-body-validator.js +52 -7
  147. package/.agents/scripts/lib/orchestration/ticket-lease.js +27 -74
  148. package/.agents/scripts/lib/orchestration/ticket-validator-conflicts.js +119 -14
  149. package/.agents/scripts/lib/orchestration/ticket-validator-sizing.js +3 -4
  150. package/.agents/scripts/lib/orchestration/ticket-validator.js +121 -18
  151. package/.agents/scripts/lib/orchestration/ticketing/bulk.js +14 -47
  152. package/.agents/scripts/lib/orchestration/ticketing/reads.js +19 -32
  153. package/.agents/scripts/lib/orchestration/ticketing/transition.js +61 -1
  154. package/.agents/scripts/lib/orchestration/ticketing.js +0 -1
  155. package/.agents/scripts/lib/plan-phase-cleanup.js +12 -14
  156. package/.agents/scripts/lib/planning-corpus.js +12 -286
  157. package/.agents/scripts/lib/preflight-runner.js +2 -2
  158. package/.agents/scripts/lib/qa/qa-context-hydrator.js +5 -5
  159. package/.agents/scripts/lib/signals/index.js +4 -17
  160. package/.agents/scripts/lib/signals/read.js +35 -35
  161. package/.agents/scripts/lib/signals/schema.js +8 -11
  162. package/.agents/scripts/lib/signals/span-tree.js +7 -7
  163. package/.agents/scripts/lib/signals/write.js +0 -1
  164. package/.agents/scripts/lib/single-story/story-merged-notify.js +13 -2
  165. package/.agents/scripts/lib/skills/parse-skill.js +16 -3
  166. package/.agents/scripts/lib/story-adjacency.js +8 -7
  167. package/.agents/scripts/lib/story-body/story-body.js +6 -5
  168. package/.agents/scripts/lib/templates/decomposer-prompts.js +7 -3
  169. package/.agents/scripts/lib/test-env.js +14 -1
  170. package/.agents/scripts/lib/test-tiers.js +0 -3
  171. package/.agents/scripts/lib/ticket-body-sections.js +0 -14
  172. package/.agents/scripts/lib/validation-evidence.js +31 -59
  173. package/.agents/scripts/lib/wave-runner/ready-set.js +32 -6
  174. package/.agents/scripts/lib/worktree/lifecycle/pending-cleanup.js +1 -1
  175. package/.agents/scripts/lib/worktree/lifecycle/reap.js +68 -19
  176. package/.agents/scripts/lib/worktree/lifecycle-manager.js +1 -2
  177. package/.agents/scripts/plan-context.js +38 -6
  178. package/.agents/scripts/plan-persist.js +145 -35
  179. package/.agents/scripts/plan-run-epilogue.js +83 -38
  180. package/.agents/scripts/post-structured-comment.js +0 -38
  181. package/.agents/scripts/pr-watch-with-update.js +43 -22
  182. package/.agents/scripts/providers/github/compose.js +0 -1
  183. package/.agents/scripts/providers/github/errors.js +0 -19
  184. package/.agents/scripts/providers/github/issues.js +1 -11
  185. package/.agents/scripts/providers/github/mappers.js +5 -0
  186. package/.agents/scripts/providers/github/sub-issues.js +0 -47
  187. package/.agents/scripts/providers/github/tickets.js +33 -153
  188. package/.agents/scripts/providers/github.js +17 -6
  189. package/.agents/scripts/resolve-stories.js +236 -0
  190. package/.agents/scripts/run-coverage.js +4 -1
  191. package/.agents/scripts/run-lint.js +2 -2
  192. package/.agents/scripts/run-verify.js +31 -2
  193. package/.agents/scripts/signals-view.js +9 -10
  194. package/.agents/scripts/single-story-close.js +173 -18
  195. package/.agents/scripts/single-story-confirm-merge.js +288 -15
  196. package/.agents/scripts/single-story-init.js +6 -10
  197. package/.agents/scripts/stories-wave-tick.js +79 -4
  198. package/.agents/scripts/story-plan.js +3 -3
  199. package/.agents/scripts/update-ticket-state.js +8 -50
  200. package/.agents/skills/core/code-review-and-quality/SKILL.md +28 -450
  201. package/.agents/skills/core/code-review-and-quality/reference.md +458 -0
  202. package/.agents/skills/core/debugging-and-error-recovery/SKILL.md +22 -315
  203. package/.agents/skills/core/debugging-and-error-recovery/reference.md +323 -0
  204. package/.agents/skills/core/diagnose-friction/SKILL.md +14 -18
  205. package/.agents/skills/core/documentation-and-adrs/SKILL.md +25 -397
  206. package/.agents/skills/core/documentation-and-adrs/reference.md +403 -0
  207. package/.agents/skills/core/gates-and-baselines/SKILL.md +12 -12
  208. package/.agents/skills/core/idea-refinement/SKILL.md +3 -3
  209. package/.agents/skills/core/scope-triage/SKILL.md +3 -0
  210. package/.agents/skills/core/security-and-hardening/SKILL.md +22 -367
  211. package/.agents/skills/core/security-and-hardening/reference.md +375 -0
  212. package/.agents/skills/skills.index.json +2 -12
  213. package/.agents/skills/stack/qa/playwright-bdd/SKILL.md +2 -4
  214. package/.agents/skills/stack/qa/qa-explore-driving/SKILL.md +1 -1
  215. package/.agents/skills/stack/qa/qa-harness/SKILL.md +1 -3
  216. package/.agents/workflows/audit-architecture.md +3 -4
  217. package/.agents/workflows/audit-clean-code.md +4 -4
  218. package/.agents/workflows/audit-documentation.md +4 -5
  219. package/.agents/workflows/audit-lighthouse.md +8 -0
  220. package/.agents/workflows/audit-navigability.md +10 -0
  221. package/.agents/workflows/audit-performance.md +2 -3
  222. package/.agents/workflows/audit-quality.md +8 -9
  223. package/.agents/workflows/audit-security.md +1 -2
  224. package/.agents/workflows/audit-seo.md +10 -0
  225. package/.agents/workflows/audit-ux-ui.md +7 -0
  226. package/.agents/workflows/deliver.md +98 -45
  227. package/.agents/workflows/git-cleanup.md +2 -2
  228. package/.agents/workflows/git-deliver.md +1 -1
  229. package/.agents/workflows/helpers/acceptance-self-eval.md +21 -13
  230. package/.agents/workflows/helpers/code-quality-guardrails.md +7 -7
  231. package/.agents/workflows/helpers/code-review.md +12 -10
  232. package/.agents/workflows/helpers/deliver-story-reference.md +73 -32
  233. package/.agents/workflows/helpers/deliver-story.md +193 -118
  234. package/.agents/workflows/helpers/parallel-tooling.md +2 -2
  235. package/.agents/workflows/helpers/worktree-lifecycle.md +28 -32
  236. package/.agents/workflows/plan.md +184 -19
  237. package/.agents/workflows/qa-assist.md +6 -6
  238. package/.agents/workflows/qa-explore.md +3 -3
  239. package/.agents/workflows/qa-run.md +1 -5
  240. package/bin/mandrel.js +12 -1
  241. package/docs/CHANGELOG.md +40 -0
  242. package/lib/cli/registry.js +262 -19
  243. package/lib/cli/sync-agents.js +157 -0
  244. package/lib/cli/sync-commands.js +115 -6
  245. package/lib/cli/sync.js +168 -6
  246. package/lib/cli/update.js +105 -8
  247. package/lib/cli/version-helpers.js +131 -0
  248. package/lib/migrations/README.md +7 -5
  249. package/lib/migrations/index.js +12 -9
  250. package/lib/migrations/steps/2.1.0-retire-mi-drop-knobs.js +100 -0
  251. package/lib/migrations/steps/2.1.0-retire-verify-concurrency-cap.js +101 -0
  252. package/package.json +1 -1
  253. package/.agents/schemas/epic-perf-report.schema.json +0 -89
  254. package/.agents/schemas/lifecycle/acceptance.reconcile.failed.schema.json +0 -13
  255. package/.agents/schemas/lifecycle/acceptance.reconcile.ok.schema.json +0 -13
  256. package/.agents/schemas/lifecycle/acceptance.reconcile.skipped.schema.json +0 -13
  257. package/.agents/schemas/lifecycle/acceptance.reconcile.start.schema.json +0 -12
  258. package/.agents/schemas/lifecycle/acceptance.reconcile.waived.schema.json +0 -13
  259. package/.agents/schemas/lifecycle/epic.automerge.end.schema.json +0 -15
  260. package/.agents/schemas/lifecycle/epic.automerge.start.schema.json +0 -13
  261. package/.agents/schemas/lifecycle/epic.blocked.schema.json +0 -13
  262. package/.agents/schemas/lifecycle/epic.cleanup.end.schema.json +0 -12
  263. package/.agents/schemas/lifecycle/epic.cleanup.start.schema.json +0 -12
  264. package/.agents/schemas/lifecycle/epic.close.end.schema.json +0 -12
  265. package/.agents/schemas/lifecycle/epic.complete.schema.json +0 -13
  266. package/.agents/schemas/lifecycle/epic.finalize.end.schema.json +0 -13
  267. package/.agents/schemas/lifecycle/epic.finalize.start.schema.json +0 -12
  268. package/.agents/schemas/lifecycle/epic.merge.armed.schema.json +0 -13
  269. package/.agents/schemas/lifecycle/epic.merge.blocked.schema.json +0 -14
  270. package/.agents/schemas/lifecycle/epic.merge.confirmed.schema.json +0 -17
  271. package/.agents/schemas/lifecycle/epic.merge.ready.schema.json +0 -15
  272. package/.agents/schemas/lifecycle/epic.plan.end.schema.json +0 -18
  273. package/.agents/schemas/lifecycle/epic.plan.start.schema.json +0 -12
  274. package/.agents/schemas/lifecycle/epic.snapshot.end.schema.json +0 -16
  275. package/.agents/schemas/lifecycle/epic.snapshot.start.schema.json +0 -12
  276. package/.agents/schemas/lifecycle/epic.watch.end.schema.json +0 -29
  277. package/.agents/schemas/lifecycle/epic.watch.start.schema.json +0 -16
  278. package/.agents/schemas/lifecycle/story.heartbeat.schema.json +0 -20
  279. package/.agents/schemas/risk-verdict.schema.json +0 -53
  280. package/.agents/schemas/story-perf-summary.schema.json +0 -73
  281. package/.agents/scripts/analyze-execution.js +0 -444
  282. package/.agents/scripts/check-prepush-recovery.js +0 -90
  283. package/.agents/scripts/lib/git-merge-orchestrator.js +0 -261
  284. package/.agents/scripts/lib/observability/baseline-refresh-rate.js +0 -221
  285. package/.agents/scripts/lib/observability/hook-heartbeat.js +0 -187
  286. package/.agents/scripts/lib/observability/perf-aggregator.js +0 -813
  287. package/.agents/scripts/lib/observability/perf-report-readers.js +0 -328
  288. package/.agents/scripts/lib/observability/perf-report-render.js +0 -182
  289. package/.agents/scripts/lib/orchestration/audit-lens-routing.js +0 -128
  290. package/.agents/scripts/lib/orchestration/bookkeeping-outbox.js +0 -273
  291. package/.agents/scripts/lib/orchestration/error-journal.js +0 -139
  292. package/.agents/scripts/lib/orchestration/lifecycle/emit-story-heartbeat.js +0 -155
  293. package/.agents/scripts/lib/orchestration/lifecycle/ledger-diff.js +0 -140
  294. package/.agents/scripts/lib/orchestration/lifecycle/listeners/merge-watcher.js +0 -665
  295. package/.agents/scripts/lib/orchestration/plan-review-routing.js +0 -63
  296. package/.agents/scripts/lib/orchestration/planning/risk-verdict.js +0 -104
  297. package/.agents/scripts/lib/orchestration/planning-context-budget.js +0 -213
  298. package/.agents/scripts/lib/orchestration/planning-risk.js +0 -194
  299. package/.agents/scripts/lib/orchestration/post-merge/phases/branch-cleanup.js +0 -56
  300. package/.agents/scripts/lib/orchestration/post-merge/phases/dashboard-refresh.js +0 -21
  301. package/.agents/scripts/lib/orchestration/post-merge/phases/notification.js +0 -78
  302. package/.agents/scripts/lib/orchestration/post-merge/phases/temp-cleanup.js +0 -68
  303. package/.agents/scripts/lib/orchestration/post-merge/phases/ticket-closure.js +0 -118
  304. package/.agents/scripts/lib/orchestration/post-merge/phases/worktree-reap.js +0 -397
  305. package/.agents/scripts/lib/orchestration/preflight-cache.js +0 -187
  306. package/.agents/scripts/lib/orchestration/resolve-plan-run.js +0 -155
  307. package/.agents/scripts/lib/orchestration/retro-perf-heuristics.js +0 -275
  308. package/.agents/scripts/lib/orchestration/story-progress/story-run-progress-writer.js +0 -400
  309. package/.agents/scripts/lib/single-story/confirm-merge-follow-ups.js +0 -36
  310. package/.agents/scripts/resolve-plan-run.js +0 -117
  311. package/.agents/skills/core/analyze-execution/SKILL.md +0 -101
@@ -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.
@@ -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
 
@@ -249,7 +249,12 @@
249
249
  "type": "array",
250
250
  "items": {
251
251
  "type": "string",
252
- "enum": ["state-transition", "story-merged", "operator-message"]
252
+ "enum": [
253
+ "state-transition",
254
+ "story-merged",
255
+ "story-closing",
256
+ "operator-message"
257
+ ]
253
258
  },
254
259
  "uniqueItems": true
255
260
  },
@@ -258,11 +263,13 @@
258
263
  "items": {
259
264
  "type": "string",
260
265
  "enum": [
261
- "epic-started",
262
- "epic-progress",
263
- "epic-blocked",
264
- "epic-unblocked",
265
- "epic-complete"
266
+ "state-transition",
267
+ "story-merged",
268
+ "story-closing",
269
+ "operator-message",
270
+ "merge.unlanded",
271
+ "merge.flip-failed",
272
+ "loop.tick"
266
273
  ]
267
274
  },
268
275
  "uniqueItems": true
@@ -311,29 +318,12 @@
311
318
  },
312
319
  "additionalProperties": false
313
320
  },
314
- "planningContext": {
315
- "type": "object",
316
- "properties": {
317
- "maxBytes": {
318
- "type": "integer",
319
- "minimum": 1024
320
- },
321
- "summaryMode": {
322
- "type": "string",
323
- "enum": ["auto", "always", "never"]
324
- }
325
- },
326
- "additionalProperties": false
327
- },
328
321
  "planning": {
329
322
  "type": "object",
330
323
  "properties": {
331
324
  "riskHeuristics": {
332
325
  "$ref": "#/$defs/listOrExtenderOfStrings"
333
326
  },
334
- "context": {
335
- "$ref": "#/$defs/planningContext"
336
- },
337
327
  "codebaseSnapshot": {
338
328
  "$ref": "#/$defs/codebaseSnapshot"
339
329
  },
@@ -426,7 +416,7 @@
426
416
  },
427
417
  "lease": {
428
418
  "type": "object",
429
- "description": "Story #3480 (Epic #3457). Assignee-as-lease primitive. ttlMs is the staleness window — a ticket claim whose owner has not emitted a story.heartbeat within this many milliseconds is reclaimable by another operator. Defaults to 900000 (15 min) in lib/config/limits.js.",
419
+ "description": "Story #3480 (Epic #3457). Assignee-as-lease primitive. ttlMs is the staleness window — a ticket claim whose owner's last heartbeat is older than this many milliseconds is reclaimable by another operator. Defaults to 900000 (15 min) in lib/config/limits.js. Note the shipped guards fail closed (there is no live heartbeat source), so a stranded claim is cleared with --steal rather than by TTL expiry.",
430
420
  "properties": {
431
421
  "ttlMs": {
432
422
  "type": "integer",
@@ -461,11 +451,6 @@
461
451
  "type": "integer",
462
452
  "minimum": 1,
463
453
  "description": "Maximum ready Stories dispatched by /deliver at once. Default 3. Moderate by design — keeps host-quota consumption predictable while allowing a small ready-set fan-out. Set 1 for strictly sequential delivery; raise further on hosts with adequate parallel-agent quota. See deliver.md for the sequencing model and throughput tradeoff."
464
- },
465
- "verifyConcurrencyCap": {
466
- "type": "integer",
467
- "minimum": 1,
468
- "description": "Bounded-concurrency cap for the per-wave verifyWaveResults loop (Epic #3019 Tech Spec §1.4). Separate from the wave-execution `concurrencyCap` so operators can tune ticket-verification parallelism independently of Story dispatch parallelism. Default 4."
469
454
  }
470
455
  },
471
456
  "additionalProperties": false
@@ -1076,10 +1061,6 @@
1076
1061
  "type": "integer",
1077
1062
  "minimum": 1
1078
1063
  },
1079
- "miDropMustRefactor": {
1080
- "type": "number",
1081
- "minimum": 0
1082
- },
1083
1064
  "requireSiblingTest": {
1084
1065
  "type": "boolean"
1085
1066
  }
@@ -1092,10 +1073,6 @@
1092
1073
  "enabled": {
1093
1074
  "type": "boolean"
1094
1075
  },
1095
- "miDropCap": {
1096
- "type": "number",
1097
- "minimum": 0
1098
- },
1099
1076
  "crapJumpCap": {
1100
1077
  "type": "number",
1101
1078
  "minimum": 0
@@ -1173,19 +1150,31 @@
1173
1150
  },
1174
1151
  "mergeWatch": {
1175
1152
  "type": "object",
1176
- "description": "Knobs consumed by the MergeWatcher lifecycle listener (Story #2896, Epic #2880). `intervalSeconds` is the poll cadence between `gh pr view --json mergeCommit,mergedAt` probes after epic.merge.armed; `maxBudgetSeconds` is the total wall-clock budget before the watcher surfaces `agent::blocked` with reason `budget-exceeded`.",
1153
+ "description": "Knobs consumed by the close-and-land merge wait (Story #4543; defaults in `lib/orchestration/merge-poll.js`). `intervalSeconds` is the poll cadence between `gh pr view` probes after the arm. `maxWaitSeconds` bounds ONE invocation of the merge wait and its expiry returns a resumable `pending` terminal with no label mutation; `maxBudgetSeconds` bounds the CUMULATIVE wait across resumes (anchored at the PR's createdAt, so a resume does not restart the clock) and exhausting it is the genuine give-up that classifies and blocks. `updateAttempts` caps the bounded update of a behind-the-base PR.",
1177
1154
  "properties": {
1178
1155
  "intervalSeconds": {
1179
1156
  "type": "integer",
1180
1157
  "minimum": 1,
1181
1158
  "default": 30,
1182
- "description": "Seconds between MergeWatcher polls. Default 30."
1159
+ "description": "Seconds between merge-wait polls. Default 30."
1160
+ },
1161
+ "maxWaitSeconds": {
1162
+ "type": "integer",
1163
+ "minimum": 1,
1164
+ "default": 300,
1165
+ "description": "Per-invocation merge-wait bound (seconds). Default 300 (5 minutes) — chosen to fit inside a single host tool invocation (~10 min ceiling) alongside the close gates that precede the wait. Expiry yields `pending` (exit 3), never a block. Headless callers with no host ceiling raise this to land in one block."
1183
1166
  },
1184
1167
  "maxBudgetSeconds": {
1185
1168
  "type": "integer",
1186
1169
  "minimum": 1,
1187
1170
  "default": 3600,
1188
- "description": "Total wall-clock budget (seconds) for the MergeWatcher poll loop. Default 3600 (60 minutes)."
1171
+ "description": "Cumulative wall-clock budget (seconds) across merge-wait resumes, anchored at the PR's createdAt. Default 3600 (60 minutes). Exhausting this classifies the block and transitions the Story to agent::blocked."
1172
+ },
1173
+ "updateAttempts": {
1174
+ "type": "integer",
1175
+ "minimum": 0,
1176
+ "default": 3,
1177
+ "description": "Maximum times the merge wait will bring a behind-the-base PR up to date before giving up on the branch. Default 3. Set 0 to disable the update."
1189
1178
  }
1190
1179
  },
1191
1180
  "additionalProperties": false
@@ -1217,7 +1206,7 @@
1217
1206
  },
1218
1207
  "navigability": {
1219
1208
  "type": "object",
1220
- "description": "Navigability lens + journey-suite config (Epic #4131, F2/F3/F1/F4). Read by audit-suite/selector.js (route globs) and /deliver's risk-routed ceremony (journey suite). Opt-in: absent or empty routeGlobs degrades to a silent no-op.",
1209
+ "description": "Navigability lens + journey-suite config (Epic #4131, F2/F3/F1/F4). Read by audit-suite/selector.js (route globs) and /deliver's per-Story ceremony (journey suite). Opt-in: absent or empty routeGlobs degrades to a silent no-op.",
1221
1210
  "properties": {
1222
1211
  "routeGlobs": {
1223
1212
  "type": "array",
@@ -1235,7 +1224,7 @@
1235
1224
  },
1236
1225
  "journeySuite": {
1237
1226
  "type": "string",
1238
- "description": "Path or command for the per-persona journey suite /deliver's risk-routed ceremony runs."
1227
+ "description": "Path or command for the per-persona journey suite /deliver's per-Story ceremony runs."
1239
1228
  }
1240
1229
  },
1241
1230
  "additionalProperties": false
@@ -1350,12 +1339,12 @@
1350
1339
  "type": "number",
1351
1340
  "minimum": 0,
1352
1341
  "maximum": 1,
1353
- "description": "Epic #4478 (M7-B, Part 2). Maker-checker sampling floor. Risk-routed ceremony sends a low-risk acceptance cluster down the contract-identical inline critic path, but this fraction of low-risk clusters is still forced through a fresh-context critic so low risk never means zero independent checking. Clamped to [0, 1]; 0 disables the floor, 1 forces every cluster fresh. Default 0.2. Consumed by resolveCeremonyForRisk (lib/orchestration/ceremony-routing.js)."
1342
+ "description": "Epic #4478 (M7-B, Part 2). Maker-checker sampling floor. Under the standard profile, a change set touching no sensitive path routes its acceptance clusters down the contract-identical inline critic path, but this fraction of them is still forced through a fresh-context critic so a low derived level never means zero independent checking. Clamped to [0, 1]; 0 disables the floor, 1 forces every cluster fresh. Default 0.2. Consumed by resolveCeremonyForRisk (lib/orchestration/ceremony-routing.js)."
1354
1343
  },
1355
1344
  "ceremonyProfile": {
1356
1345
  "type": "string",
1357
1346
  "enum": ["minimal", "standard", "strict"],
1358
- "description": "Acceptance-ceremony depth. minimal = always inline critic; strict = always fresh-context critic; standard (default) = risk-routed with the maker-checker sampling floor."
1347
+ "description": "Acceptance-ceremony depth. minimal = always inline critic; strict = always fresh-context critic; standard (default) = routed off the change level derived from the Story diff, with the maker-checker sampling floor."
1359
1348
  },
1360
1349
  "closeAndLand": {
1361
1350
  "type": "boolean",
@@ -1370,7 +1359,7 @@
1370
1359
  "auditResultsAutoFile": {
1371
1360
  "type": "boolean",
1372
1361
  "default": true,
1373
- "description": "When true (default), the Epic finalize listener auto-files non-blocking audit-results findings as follow-up issues routed by source classification. Set to false to suppress auto-filing; findings remain accessible in the structured comments on the Epic."
1362
+ "description": "When true (default), the close-time audit-results graduator auto-files non-blocking audit-results findings as follow-up issues routed by source classification. Set to false to suppress auto-filing; findings remain accessible in the structured comments on the Story."
1374
1363
  },
1375
1364
  "retroProposals": {
1376
1365
  "type": "boolean",
@@ -7,7 +7,10 @@
7
7
  "substitutionKeys": []
8
8
  },
9
9
  "audit-architecture": {
10
- "triggers": { "gates": ["gate1", "gate3"] },
10
+ "triggers": {
11
+ "gates": ["gate1", "gate3"],
12
+ "filePatterns": [".agents/scripts/lib/**", "lib/**", "bin/**", "src/**"]
13
+ },
11
14
  "scope": "cumulative",
12
15
  "substitutionKeys": []
13
16
  },
@@ -58,6 +61,7 @@
58
61
  "**/frontend/**/*.js"
59
62
  ]
60
63
  },
64
+ "target": "web",
61
65
  "scope": "local",
62
66
  "substitutionKeys": []
63
67
  },
@@ -147,6 +151,7 @@
147
151
  "keywords": ["seo", "meta", "structured data", "schema.org", "sitemap"],
148
152
  "filePatterns": ["**/*.html", "**/sitemap*", "**/robots.txt"]
149
153
  },
154
+ "target": "web",
150
155
  "scope": "local",
151
156
  "substitutionKeys": []
152
157
  },
@@ -160,6 +165,7 @@
160
165
  "**/*.css"
161
166
  ]
162
167
  },
168
+ "target": "web",
163
169
  "scope": "local",
164
170
  "substitutionKeys": []
165
171
  },
@@ -173,8 +179,60 @@
173
179
  "route tree"
174
180
  ]
175
181
  },
182
+ "target": "web",
176
183
  "scope": "global",
177
184
  "substitutionKeys": []
178
185
  }
186
+ },
187
+ "sensitivePaths": {
188
+ "security": {
189
+ "description": "Authentication, authorization, session, and secret-handling surfaces.",
190
+ "filePatterns": [
191
+ "**/auth/**",
192
+ "**/authn/**",
193
+ "**/authz/**",
194
+ "**/crypto/**",
195
+ "**/session/**",
196
+ "**/*credential*",
197
+ "**/*permission*",
198
+ "**/*.pem",
199
+ "**/*.key"
200
+ ]
201
+ },
202
+ "data-migration": {
203
+ "description": "Schema migrations and seed data — changes that rewrite persisted state.",
204
+ "filePatterns": [
205
+ "**/migrations/**",
206
+ "**/migrate/**",
207
+ "**/seeds/**",
208
+ "**/*.sql",
209
+ "**/schema.prisma"
210
+ ]
211
+ },
212
+ "billing": {
213
+ "description": "Money movement: payment, checkout, invoicing, and subscription surfaces.",
214
+ "filePatterns": [
215
+ "**/billing/**",
216
+ "**/payment/**",
217
+ "**/payments/**",
218
+ "**/checkout/**",
219
+ "**/invoice*/**",
220
+ "**/subscription*/**"
221
+ ]
222
+ },
223
+ "destructive-mutation": {
224
+ "description": "Irreversible mutation paths — deletion, purge, and teardown.",
225
+ "filePatterns": ["**/*delete*", "**/*destroy*", "**/*purge*"]
226
+ },
227
+ "public-api": {
228
+ "description": "The externally-consumed contract surface: routes, controllers, and API schemas.",
229
+ "filePatterns": [
230
+ "**/api/**",
231
+ "**/routes/**",
232
+ "**/controllers/**",
233
+ "**/openapi/**",
234
+ "**/graphql/**"
235
+ ]
236
+ }
179
237
  }
180
238
  }