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
@@ -56,19 +56,17 @@
56
56
  "mentionOperator": false,
57
57
  "commentEvents": ["state-transition", "story-merged", "operator-message"],
58
58
  "webhookEvents": [
59
- "epic-started",
60
- "epic-progress",
61
- "epic-blocked",
62
- "epic-unblocked",
63
- "epic-complete"
59
+ "state-transition",
60
+ "story-merged",
61
+ "story-closing",
62
+ "operator-message",
63
+ "merge.unlanded",
64
+ "merge.flip-failed",
65
+ "loop.tick"
64
66
  ]
65
67
  }
66
68
  },
67
69
  "planning": {
68
- "context": {
69
- "maxBytes": 50000,
70
- "summaryMode": "auto"
71
- },
72
70
  "codebaseSnapshot": {
73
71
  "tier": "skinny",
74
72
  "include": [
@@ -131,8 +129,7 @@
131
129
  "paths": ["README.md"]
132
130
  },
133
131
  "deliverRunner": {
134
- "concurrencyCap": 3,
135
- "verifyConcurrencyCap": 4
132
+ "concurrencyCap": 3
136
133
  },
137
134
  "worktreeIsolation": {
138
135
  "enabled": true,
@@ -336,12 +333,10 @@
336
333
  "codingGuardrails": {
337
334
  "cyclomaticFlag": 8,
338
335
  "cyclomaticMustFix": 12,
339
- "miDropMustRefactor": 1.5,
340
336
  "requireSiblingTest": false
341
337
  },
342
338
  "autoRefresh": {
343
339
  "enabled": true,
344
- "miDropCap": 1.5,
345
340
  "crapJumpCap": 5,
346
341
  "scope": "diff"
347
342
  },
@@ -97,9 +97,6 @@ top-level keys are validation errors.
97
97
  | Key | Required | Type | Default | Description |
98
98
  | --- | --- | --- | --- | --- |
99
99
  | `riskHeuristics` | No | `string[]` or `{ append?, prepend? }` | — | — |
100
- | `context` | No | `object` | — | Nested configuration block. |
101
- | `context.maxBytes` | No | `integer` | — | — |
102
- | `context.summaryMode` | No | `"auto"` \| `"always"` \| `"never"` | — | — |
103
100
  | `codebaseSnapshot` | No | `object` | — | Nested configuration block. |
104
101
  | `codebaseSnapshot.tier` | No | `"skinny"` \| `"medium"` | — | — |
105
102
  | `codebaseSnapshot.include` | No | `array<string>` | — | — |
@@ -121,13 +118,12 @@ top-level keys are validation errors.
121
118
  | --- | --- | --- | --- | --- |
122
119
  | `execution` | No | `object` | — | Nested configuration block. |
123
120
  | `execution.timeoutMs` | No | `integer` | — | — |
124
- | `lease` | No | `object` | — | 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. |
121
+ | `lease` | No | `object` | — | 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. |
125
122
  | `lease.ttlMs` | No | `integer` | — | — |
126
123
  | `docsFreshness` | No | `object` | — | Nested configuration block. |
127
124
  | `docsFreshness.paths` | No | `array` | — | — |
128
125
  | `deliverRunner` | No | `object` | — | Nested configuration block. |
129
126
  | `deliverRunner.concurrencyCap` | No | `integer` | — | 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. |
130
- | `deliverRunner.verifyConcurrencyCap` | No | `integer` | — | 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. |
131
127
  | `worktreeIsolation` | No | `object` | — | Nested configuration block. |
132
128
  | `worktreeIsolation.enabled` | No | `boolean` | — | — |
133
129
  | `worktreeIsolation.root` | No | `string` | — | — |
@@ -235,11 +231,9 @@ top-level keys are validation errors.
235
231
  | `quality.codingGuardrails` | No | `object` | — | Nested configuration block. |
236
232
  | `quality.codingGuardrails.cyclomaticFlag` | No | `integer` | — | — |
237
233
  | `quality.codingGuardrails.cyclomaticMustFix` | No | `integer` | — | — |
238
- | `quality.codingGuardrails.miDropMustRefactor` | No | `number` | — | — |
239
234
  | `quality.codingGuardrails.requireSiblingTest` | No | `boolean` | — | — |
240
235
  | `quality.autoRefresh` | No | `object` | — | Nested configuration block. |
241
236
  | `quality.autoRefresh.enabled` | No | `boolean` | — | — |
242
- | `quality.autoRefresh.miDropCap` | No | `number` | — | — |
243
237
  | `quality.autoRefresh.crapJumpCap` | No | `number` | — | — |
244
238
  | `quality.autoRefresh.scope` | No | `"diff"` \| `"full"` | — | — |
245
239
  | `quality.baselineEpsilon` | No | `object` | — | Per-kind epsilon for s-stability-epsilon (Story #1964). Sub-epsilon row deltas resolve to prior bytes so env variance does not rewrite the on-disk baseline. |
@@ -252,13 +246,15 @@ top-level keys are validation errors.
252
246
  | `quality.baselineEpsilon.bundle-size` | No | `number` | — | — |
253
247
  | `quality.baselineEpsilon.duplication` | No | `number` | — | — |
254
248
  | `quality.requireBaselines` | No | `boolean` | — | Story #4495. Fail-closed baseline-enforcement policy for the unified check-baselines close-validation gate. When false (default), a consumer that enables baseline gates (crap/maintainability/…) but has not committed the corresponding baseline artifacts under baselines/ gets a clean skip-with-reason instead of a deterministic first-try close failure. Set true to keep the gate registered so an absent baseline artifact fails close-validation with a preflight hint naming the fix (the fail-closed posture). |
255
- | `quality.navigability` | No | `object` | — | 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. |
249
+ | `quality.navigability` | No | `object` | — | 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. |
256
250
  | `quality.navigability.routeGlobs` | No | `array<string>` | — | Glob patterns (pages/**, app/**/route.ts) marking paths that add a user-facing route — the route-tree SSOT the navigability lens enumerates and the route-added routing predicate matches against. |
257
251
  | `quality.navigability.navRegistry` | No | `array<string>` | — | Tokens identifying the nav-registry SSOT the navigability lens checks every route resolves a nav door against. |
258
- | `quality.navigability.journeySuite` | No | `string` | — | Path or command for the per-persona journey suite /deliver's risk-routed ceremony runs. |
259
- | `mergeWatch` | No | `object` | — | 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`. |
260
- | `mergeWatch.intervalSeconds` | No | `integer` | `30` | Seconds between MergeWatcher polls. Default 30. |
261
- | `mergeWatch.maxBudgetSeconds` | No | `integer` | `3600` | Total wall-clock budget (seconds) for the MergeWatcher poll loop. Default 3600 (60 minutes). |
252
+ | `quality.navigability.journeySuite` | No | `string` | — | Path or command for the per-persona journey suite /deliver's per-Story ceremony runs. |
253
+ | `mergeWatch` | No | `object` | — | 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. |
254
+ | `mergeWatch.intervalSeconds` | No | `integer` | `30` | Seconds between merge-wait polls. Default 30. |
255
+ | `mergeWatch.maxWaitSeconds` | No | `integer` | `300` | 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. |
256
+ | `mergeWatch.maxBudgetSeconds` | No | `integer` | `3600` | 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. |
257
+ | `mergeWatch.updateAttempts` | No | `integer` | `3` | 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. |
262
258
  | `codeReview` | No | `object` | — | Nested configuration block. |
263
259
  | `codeReview.providers[]` | No | `array<object>` | — | Review-provider chain (Story #2871). When unset or empty, defaults to [{ name: "native" }]. The orchestrator iterates inline entries in declaration order and merges their Finding[] before posting one structured comment; manual-prompt entries (e.g. ultrareview) contribute a trailing 'Manual review suggestions' section. Selecting an adapter whose probe fails hard-fails at factory construction unless declared `optional: true` in the chain. Each item has: name, scopes, optional, manualPrompt, when. |
264
260
  | `codeReview.providerConfig` | No | `object` | — | Optional escape hatch for adapter-specific configuration. No documented keys in Epic #2815; reserved so future adapters can be configured without another schema migration. |
@@ -278,11 +274,11 @@ top-level keys are validation errors.
278
274
  | `ci.autoMerge` | No | `"trust-ci"` \| `"strict"` | — | Story #4356 (Epic #4355). Merge posture. 'trust-ci' (default) merges once required checks pass; 'strict' additionally requires a clean review gate. |
279
275
  | `routing` | No | `object` | — | v2 delivery-spawn routing: role-scoped boot contexts and maker-checker sampling. The v1 singleDelivery epic-route kill-switch was removed in Stage 6. |
280
276
  | `routing.roleScopedAgents` | No | `boolean` | — | Epic #4478 (M7-B). Kill-switch for the role-scoped boot contexts. When true (default), a converted delivery spawn (`story-worker`, `acceptance-critic`) boots on its own `.claude/agents/<role>.md` system prompt instead of re-paying the full CLAUDE.md @-import closure (≈50KB → ≈8KB per spawn — the payoff of the context diet). When false, every converted spawn falls back to `subagent_type: general-purpose` — the instant, code-rollback-free per-consumer revert, and the universal escape for hosts that ignore `.claude/agents/`. The fallback is the full-closure agent that ran before M7-B, so flipping it off never drops a gate. |
281
- | `routing.freshCriticSampleRate` | No | `number` | — | 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). |
282
- | `routing.ceremonyProfile` | No | `"minimal"` \| `"standard"` \| `"strict"` | — | Acceptance-ceremony depth. minimal = always inline critic; strict = always fresh-context critic; standard (default) = risk-routed with the maker-checker sampling floor. |
277
+ | `routing.freshCriticSampleRate` | No | `number` | — | 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). |
278
+ | `routing.ceremonyProfile` | No | `"minimal"` \| `"standard"` \| `"strict"` | — | 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. |
283
279
  | `routing.closeAndLand` | No | `boolean` | — | When true (default), single-story-close lands through merge in one close. Opt out per-run with --no-wait-merge. |
284
280
  | `feedbackLoop` | No | `object` | — | Nested configuration block. |
285
- | `feedbackLoop.auditResultsAutoFile` | No | `boolean` | `true` | 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. |
281
+ | `feedbackLoop.auditResultsAutoFile` | No | `boolean` | `true` | 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. |
286
282
  | `feedbackLoop.retroProposals` | No | `boolean` | `true` | When true (default), the retro auto-files its actionable routed proposals as meta::<framework-gap\|consumer-improvement> + friction::<category> issues via the graduator pre-parsed-findings seam, and the rendered retro sections list the filed issue numbers instead of paste-ready gh command stanzas. Set to false to fall back to the command stanzas. |
287
283
 
288
284
  <!-- END GENERATED:agentrc -->
@@ -405,15 +401,13 @@ Repository-level merge-method allowlist applied by bootstrap.
405
401
  | ----------------- | -------- | -------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------- |
406
402
  | `mentionOperator` | No | `false` | When `true`, friction comments @-mention `operatorHandle` for `medium`-severity dispatches (high always @mentions). |
407
403
  | `commentEvents` | No | `["state-transition", "story-merged", "operator-message"]` | Allowlist of event names that reach the GitHub ticket comment channel. |
408
- | `webhookEvents` | No | `["epic-started", "epic-progress", "epic-blocked", "epic-unblocked", "epic-complete"]` | Allowlist of event names that reach `NOTIFICATION_WEBHOOK_URL`. The webhook channel is curated for the epic narrative; story-level events are excluded. |
404
+ | `webhookEvents` | No | `["state-transition", "story-merged", "story-closing", "operator-message", "merge.unlanded", "merge.flip-failed", "loop.tick"]` | Allowlist of event names that reach `NOTIFICATION_WEBHOOK_URL`. The vocabulary mirrors the events the v2 runtime actually emits through `notify()`. |
409
405
 
410
406
  Both fields' enums are pinned in the schema and rejected if extended. To
411
407
  suppress a channel entirely, set its array to `[]`.
412
408
 
413
- > **Severity assignment.** Task transitions and `story-run-progress` upserts
414
- > fire `low` (frequency-driven). Story state transitions, `wave-run-progress`,
415
- > `epic-run-progress`, and epic-completion fire `medium`. Epic blockers and
416
- > HITL gates fire `high` (webhook prefix `[Action Required]` when an
409
+ > **Severity assignment.** Story state transitions fire `medium`. Blockers
410
+ > and HITL gates fire `high` (webhook prefix `[Action Required]` when an
417
411
  > allowlisted blocker event reaches the webhook).
418
412
 
419
413
  ---
@@ -456,17 +450,6 @@ is `soft` (visible to the planner, does not trip re-decompose). Set a
456
450
  explicit `--allow-large-fan-out` operator flag for very large delete blasts;
457
451
  that is separate from Story sizing.
458
452
 
459
- ### `planning.context`
460
-
461
- Caps the size of `--emit-context` JSON payloads emitted during `/plan`
462
- so a runaway Epic body (with its folded Tech Spec sections) can't blow the
463
- planning agent's context budget.
464
-
465
- | Field | Required | Default | Purpose |
466
- | ------------- | -------- | -------- | --------------------------------------------------------------------------------------------- |
467
- | `maxBytes` | No | `50000` | Hard ceiling on the JSON payload size (bytes). Truncation is summary-mode-aware. |
468
- | `summaryMode` | No | `'auto'` | `'auto'` truncates intelligently; `'never'` errors over the cap; `'always'` always summarizes. |
469
-
470
453
  ### `planning.codebaseSnapshot`
471
454
 
472
455
  Controls the codebase-snapshot fetcher that grounds Tech Spec / Story authoring.
@@ -536,8 +519,7 @@ fall back to documented defaults (or are no-ops when omitted).
536
519
 
537
520
  | Field | Required | Default | Purpose |
538
521
  | --------------------------- | -------- | ------- | ------------------------------------------------ |
539
- | `concurrencyCap` | No | `3` | Max parallel Story sub-agents per wave. |
540
- | `verifyConcurrencyCap` | No | `4` | Max parallel verify steps per wave. |
522
+ | `concurrencyCap` | No | `3` | Max ready Stories dispatched by `/deliver` at once. |
541
523
 
542
524
  ### `delivery.worktreeIsolation`
543
525
 
@@ -666,7 +648,6 @@ for `BUNDLE_SIZE_REFRESH=1` usage.
666
648
  | ---------------------- | -------- | ------- | ------------------------------------------------------------------ |
667
649
  | `cyclomaticFlag` | No | (none) | Cyclomatic-complexity value at which the engineer should refactor. |
668
650
  | `cyclomaticMustFix` | No | (none) | Cyclomatic-complexity value that hard-fails the gate. |
669
- | `miDropMustRefactor` | No | (none) | MI drop that mandates a refactor. |
670
651
  | `requireSiblingTest` | No | (none) | When `true`, a new function requires a sibling test file. |
671
652
 
672
653
  #### `delivery.quality.autoRefresh`
@@ -676,7 +657,6 @@ Controls Story-close auto-baseline-refresh for gated metrics.
676
657
  | Field | Required | Default | Purpose |
677
658
  | ------------- | -------- | ------- | -------------------------------------------------------- |
678
659
  | `enabled` | No | (none) | Master switch. |
679
- | `miDropCap` | No | (none) | Max MI drop the auto-refresher will absorb before failing. |
680
660
  | `crapJumpCap` | No | (none) | Max CRAP jump the auto-refresher will absorb before failing. |
681
661
  | `scope` | No | (none) | One of `'diff'` or `'full'`. |
682
662
 
@@ -791,22 +771,6 @@ Paths are configured in `delivery.quality.gates.<tier>.baselinePath`. The
791
771
  default values match the canonical layout above; override only when a
792
772
  project genuinely stores baselines elsewhere.
793
773
 
794
- ### Per-wave drift snapshots — `.agents/state/`
795
-
796
- The Epic runner's progress reporter writes wave-start snapshots so that a
797
- resumed run can detect intra-wave drift without re-reading the canonical
798
- baseline (which may have been refreshed mid-Epic).
799
-
800
- | File | Owner | Lifecycle |
801
- | --------------------------------------- | ---------------------------------------------------- | ----------------------------------------------- |
802
- | `.agents/state/wave-mi-snapshot.json` | `progress-signals/maintainability-drift.js` | Captured at wave-start; overwritten next wave. |
803
- | `.agents/state/wave-crap-snapshot.json` | `progress-signals/crap-drift.js` | Captured at wave-start; overwritten next wave. |
804
-
805
- These are **not** ratchet baselines and must not be committed as such. The
806
- filenames intentionally differ from the canonical files so a repo-wide grep
807
- for `baselines/maintainability.json` or `baselines/crap.json` only ever hits
808
- the canonical paths.
809
-
810
774
  The `.agents/state/` directory itself is created on demand by the progress
811
775
  reporter; the framework does not require it to exist ahead of time and does
812
776
  not commit its contents.
@@ -867,7 +831,7 @@ git.
867
831
  per-contributor value with two jobs: the `@`-handle the framework @mentions on
868
832
  friction comments, **and** the lease owner the workflow guards
869
833
  ([`ticket-lease.js`](../scripts/lib/orchestration/ticket-lease.js))
870
- assign to a ticket so two contributors cannot drive the same Epic/Story
834
+ assign to a ticket so two contributors cannot drive the same Story
871
835
  concurrently. Because the lease must distinguish *your* run from *another
872
836
  person's*, a shared committed handle would defeat it — everyone would coordinate
873
837
  under one identity. So each contributor sets their own in `.agentrc.local.json`:
@@ -1063,15 +1027,27 @@ mandrel explain --json # JSON report for scripting
1063
1027
 
1064
1028
  ### `mandrel sync-commands`
1065
1029
 
1066
- Regenerates the flat `.claude/commands/` tree from `.agents/workflows/`. The
1067
- bootstrap wires a `UserPromptSubmit` hook so this runs automatically on every
1068
- Claude Code prompt; manual invocations are only needed when the hook is absent
1069
- or the commands/ tree is manually deleted.
1030
+ Regenerates the flat `.claude/commands/` tree from `.agents/workflows/`. Runs
1031
+ automatically at install time (via `prepare`) and as part of `mandrel
1032
+ sync`/`update`; manual invocations are only needed when the commands/ tree is
1033
+ manually deleted or edited by hand. Refuses to project when the materialized
1034
+ `.agents/` tree doesn't match the running CLI's own version.
1070
1035
 
1071
1036
  ```bash
1072
1037
  mandrel sync-commands
1073
1038
  ```
1074
1039
 
1040
+ ### `mandrel sync-agents`
1041
+
1042
+ Regenerates the flat `.claude/agents/` tree from `.agents/agents/` — the
1043
+ role-scoped boot contexts `delivery.routing.roleScopedAgents` (default
1044
+ `true`) dispatches spawns against. Same wiring and version-match refusal as
1045
+ `mandrel sync-commands` above.
1046
+
1047
+ ```bash
1048
+ mandrel sync-agents
1049
+ ```
1050
+
1075
1051
  ### `mandrel uninstall`
1076
1052
 
1077
1053
  Reverses a recorded install using the install ledger
@@ -19,12 +19,13 @@ validated.
19
19
 
20
20
  - **Canonical record + schema validation**: `diagnose-friction.js` appends one
21
21
  `kind: friction` record, validated write-time against
22
- `signal-event.schema.json`, to the per-Epic/per-Story `signals.ndjson`
23
- stream on local disk. The retro roll-up reads that stream back to aggregate
22
+ `signal-event.schema.json`, to the per-run/per-Story `signals.ndjson`
23
+ stream on local disk (under `temp/run-<id>/`). The retro roll-up reads that
24
+ stream back to aggregate
24
25
  friction into routed proposals; nothing is posted to the GitHub ticket at
25
26
  capture time.
26
- - **No-Epic context**: Outside an Epic/Story loop there is no per-Epic stream
27
- to anchor to, so the record lands on the **standalone signal stream**
27
+ - **Standalone context**: Outside a delivery run there is no `temp/run-<id>/`
28
+ stream to anchor to, so the record lands on the **standalone signal stream**
28
29
  (`temp/standalone/stories/story-<sid>/signals.ndjson`) under the same
29
30
  canonical schema.
30
31
  - **Never silently dropped**: The signal is never silently dropped — a
@@ -57,12 +58,40 @@ schema mechanics are in [§ Friction telemetry](#friction-telemetry) above.
57
58
 
58
59
  ## FinOps & token budgeting (economic guardrails)
59
60
 
60
- Mandrel does **not** enforce live LLM spend from response metadata. The
61
- framework limits **hydrated prompt size** via section-aware elision
62
- (`elideEnvelope`) and optional **pre-dispatch estimates**; your host
63
- runtime (editor / CLI) owns session quota and hard stops. Consult this
64
- section when reasoning about why a task prompt was elided or why `/deliver`
65
- refused a fan-out on budget grounds.
61
+ Mandrel does **not** enforce live LLM spend from response metadata. It bounds
62
+ two things, both **fixed framework constants** rather than operator knobs, and
63
+ both **fail closed**: the assembled `/plan` context envelope, and plan-time
64
+ Story sizing. Your host runtime (editor / CLI) owns session quota and hard
65
+ stops. Consult this section when reasoning about why `/plan` refused an
66
+ over-ceiling envelope or an over-budget Story count.
67
+
68
+ > **There is no configurable context budget.** `planning.context.maxBytes` /
69
+ > `summaryMode` were removed outright in Story #4541, along with the
70
+ > `applyBudget` pass they fed: that pass lost its last caller in the v2
71
+ > cutover, and it was already bounding a field the envelope builders discarded
72
+ > before shipping the raw seed anyway. The schema now **rejects**
73
+ > `planning.context`, so a config carrying it fails loudly rather than silently
74
+ > capping nothing. The ceiling below is the replacement and the only live bound
75
+ > on planner-context size. Separately, `elideEnvelope` in
76
+ > `lib/orchestration/context-envelope.js` — which this section used to credit
77
+ > with limiting hydrated prompt size — has no production caller either (it is
78
+ > carried in `baselines/dead-exports-production.json`). Only `estimateTokens`
79
+ > from that module is live.
80
+
81
+ ### Planner-context envelope (`/plan`)
82
+
83
+ - **`PLAN_CONTEXT_ENVELOPE_BYTE_CEILING`** (`lib/orchestration/plan-context.js`):
84
+ 256 KB (≈64K tokens at the ≈4-chars/token estimate) on the serialized
85
+ envelope `buildPlanContext` assembles, checked at the single choke point
86
+ every mode returns through. Measured envelopes on this repo land at ~42 KB,
87
+ so the ceiling is >2× headroom over a worst-case seed plus a medium-tier
88
+ codebase snapshot.
89
+ - **On refusal**, the error names the envelope's largest fields. Trim the seed,
90
+ plan fewer `--tickets` source issues in one run, or narrow
91
+ `planning.codebaseSnapshot`. The seed is carried **verbatim** by design — it
92
+ is the operator's request, and summarizing it silently would degrade planning
93
+ quality precisely when the input is richest — so there is no elision path to
94
+ fall back on. Raising the ceiling needs a measured justification.
66
95
 
67
96
  ### Session-mass capacity (plan-time sizing)
68
97
 
@@ -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
 
@@ -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. |