mandrel 1.93.0 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (463) hide show
  1. package/.agents/README.md +59 -73
  2. package/.agents/agents/acceptance-critic.md +129 -0
  3. package/.agents/agents/story-worker.md +161 -0
  4. package/.agents/docs/SDLC.md +489 -1285
  5. package/.agents/docs/agentrc-reference.json +177 -67
  6. package/.agents/docs/configuration.md +108 -136
  7. package/.agents/docs/execution-reference.md +44 -22
  8. package/.agents/docs/quality-gates.md +13 -19
  9. package/.agents/docs/workflows.md +3 -3
  10. package/.agents/instructions.md +107 -108
  11. package/.agents/rules/ci-remediation.md +8 -12
  12. package/.agents/rules/git-conventions-reference.md +224 -0
  13. package/.agents/rules/git-conventions.md +42 -223
  14. package/.agents/rules/security-baseline.md +5 -0
  15. package/.agents/rules/testing-standards.md +106 -13
  16. package/.agents/schemas/acceptance-eval-verdict.schema.json +1 -1
  17. package/.agents/schemas/agentrc.schema.json +71 -201
  18. package/.agents/schemas/lifecycle/ledger-record.schema.json +1 -1
  19. package/.agents/schemas/lifecycle/retro.end.schema.json +1 -1
  20. package/.agents/schemas/risk-verdict.schema.json +0 -13
  21. package/.agents/scripts/acceptance-eval.js +62 -18
  22. package/.agents/scripts/agents-bootstrap-github.js +1 -1
  23. package/.agents/scripts/analyze-execution.js +1 -1
  24. package/.agents/scripts/audit-to-stories.js +7 -7
  25. package/.agents/scripts/boot-sweep.js +1 -1
  26. package/.agents/scripts/check-context-budget.js +62 -5
  27. package/.agents/scripts/check-lifecycle-lint.js +6 -9
  28. package/.agents/scripts/check-prepush-recovery.js +1 -1
  29. package/.agents/scripts/cleanup-repo-test-temp.js +6 -1
  30. package/.agents/scripts/diagnose-friction.js +0 -6
  31. package/.agents/scripts/lib/Logger.js +6 -10
  32. package/.agents/scripts/lib/audit-suite/runner.js +2 -2
  33. package/.agents/scripts/lib/audit-suite/selector.js +5 -5
  34. package/.agents/scripts/lib/audit-to-stories/{seed-epic-from-findings.js → seed-from-findings.js} +9 -9
  35. package/.agents/scripts/lib/baselines/kernel.js +206 -18
  36. package/.agents/scripts/lib/baselines/kinds/maintainability.js +0 -4
  37. package/.agents/scripts/lib/baselines/reader.js +1 -6
  38. package/.agents/scripts/lib/bdd-runner-detect.js +5 -9
  39. package/.agents/scripts/lib/bootstrap/issue-forms-template.js +32 -33
  40. package/.agents/scripts/lib/bootstrap/project-bootstrap.js +56 -18
  41. package/.agents/scripts/lib/checks/core-bare-clean.js +2 -2
  42. package/.agents/scripts/lib/checks/index.js +2 -1
  43. package/.agents/scripts/lib/checks/story-init-not-backgrounded.js +23 -21
  44. package/.agents/scripts/lib/cli/standard-args.js +13 -22
  45. package/.agents/scripts/lib/cli-args.js +16 -7
  46. package/.agents/scripts/lib/close-validation/gates.js +160 -22
  47. package/.agents/scripts/lib/config/acceptance-eval.js +52 -5
  48. package/.agents/scripts/lib/config/ci.js +6 -31
  49. package/.agents/scripts/lib/config/delivery-routing.js +103 -0
  50. package/.agents/scripts/lib/config/explain.js +57 -36
  51. package/.agents/scripts/lib/config/limits.js +17 -58
  52. package/.agents/scripts/lib/config/paths.js +0 -2
  53. package/.agents/scripts/lib/config/quality.js +1 -1
  54. package/.agents/scripts/lib/config/runners.js +17 -50
  55. package/.agents/scripts/lib/config/temp-paths.js +19 -14
  56. package/.agents/scripts/lib/config/worktree-isolation.js +0 -5
  57. package/.agents/scripts/lib/config-resolver.js +3 -8
  58. package/.agents/scripts/lib/config-settings-schema-delivery.js +46 -136
  59. package/.agents/scripts/lib/config-settings-schema-quality.js +17 -14
  60. package/.agents/scripts/lib/config-settings-schema.js +52 -38
  61. package/.agents/scripts/lib/dependency-parser.js +3 -2
  62. package/.agents/scripts/lib/doc-tiers.js +39 -4
  63. package/.agents/scripts/lib/duplicate-search.js +211 -41
  64. package/.agents/scripts/lib/feedback-loop/retro-proposals-graduator.js +1 -1
  65. package/.agents/scripts/lib/findings/promote-finding.js +5 -5
  66. package/.agents/scripts/lib/framework-version.js +2 -3
  67. package/.agents/scripts/lib/git-branch-cleanup.js +1 -10
  68. package/.agents/scripts/lib/git-branch-lifecycle.js +17 -22
  69. package/.agents/scripts/lib/git-utils.js +32 -6
  70. package/.agents/scripts/lib/github/framework-repo.js +6 -0
  71. package/.agents/scripts/lib/label-constants.js +10 -23
  72. package/.agents/scripts/lib/label-taxonomy.js +9 -43
  73. package/.agents/scripts/lib/observability/active-story-env.js +112 -3
  74. package/.agents/scripts/lib/observability/hook-heartbeat.js +187 -0
  75. package/.agents/scripts/lib/observability/source-classifier.js +3 -3
  76. package/.agents/scripts/lib/observability/tool-trace-hook.js +15 -4
  77. package/.agents/scripts/lib/onboard/init-tail.js +1 -3
  78. package/.agents/scripts/lib/orchestration/acceptance-clusters.js +111 -0
  79. package/.agents/scripts/lib/orchestration/acceptance-eval-decision.js +32 -4
  80. package/.agents/scripts/lib/orchestration/audit-lens-routing.js +128 -0
  81. package/.agents/scripts/lib/orchestration/bookkeeping-outbox.js +273 -0
  82. package/.agents/scripts/lib/orchestration/ceremony-routing.js +204 -0
  83. package/.agents/scripts/lib/orchestration/code-review.js +20 -268
  84. package/.agents/scripts/lib/orchestration/column-sync.js +1 -1
  85. package/.agents/scripts/lib/orchestration/consolidation-precondition.js +1 -1
  86. package/.agents/scripts/lib/orchestration/context-envelope.js +2 -5
  87. package/.agents/scripts/lib/orchestration/docs-digest.js +8 -8
  88. package/.agents/scripts/lib/orchestration/file-assumptions.js +7 -13
  89. package/.agents/scripts/lib/orchestration/git-cleanup/phases/cli.js +1 -1
  90. package/.agents/scripts/lib/orchestration/lifecycle/emit-loop-tick.js +8 -8
  91. package/.agents/scripts/lib/orchestration/lifecycle/emit-story-heartbeat.js +2 -2
  92. package/.agents/scripts/lib/orchestration/lifecycle/ledger-writer.js +6 -3
  93. package/.agents/scripts/lib/orchestration/lifecycle/listeners/README.md +17 -43
  94. package/.agents/scripts/lib/orchestration/lint-baseline-service.js +4 -4
  95. package/.agents/scripts/lib/orchestration/merge-block-class.js +1 -1
  96. package/.agents/scripts/lib/orchestration/phase-runner.js +3 -2
  97. package/.agents/scripts/lib/orchestration/plan-context.js +248 -266
  98. package/.agents/scripts/lib/orchestration/plan-critic-conditions.js +3 -2
  99. package/.agents/scripts/lib/orchestration/plan-critics-evaluate.js +1 -1
  100. package/.agents/scripts/lib/orchestration/plan-navigation.js +92 -0
  101. package/.agents/scripts/lib/orchestration/plan-persist/fan-out-gate.js +61 -0
  102. package/.agents/scripts/lib/orchestration/plan-persist/persist-helpers.js +97 -0
  103. package/.agents/scripts/lib/orchestration/plan-persist/run-plan-persist.js +223 -854
  104. package/.agents/scripts/lib/orchestration/plan-persist/story-ops.js +361 -0
  105. package/.agents/scripts/lib/orchestration/plan-persist/summary.js +35 -108
  106. package/.agents/scripts/lib/orchestration/plan-reachability.js +9 -14
  107. package/.agents/scripts/lib/orchestration/plan-runner/worktree-sweep.js +1 -1
  108. package/.agents/scripts/lib/orchestration/{epic-plan-spec/phases → planning}/authoring-context.js +14 -14
  109. package/.agents/scripts/lib/orchestration/planning/decomposer-context.js +27 -0
  110. package/.agents/scripts/lib/orchestration/{epic-plan-spec/phases → planning}/risk-verdict.js +3 -4
  111. package/.agents/scripts/lib/orchestration/post-merge/phases/branch-cleanup.js +2 -2
  112. package/.agents/scripts/lib/orchestration/post-merge/phases/dashboard-refresh.js +8 -20
  113. package/.agents/scripts/lib/orchestration/post-merge/phases/worktree-reap.js +3 -2
  114. package/.agents/scripts/lib/orchestration/pr-base-guard.js +18 -28
  115. package/.agents/scripts/lib/orchestration/preflight-cache.js +5 -5
  116. package/.agents/scripts/lib/orchestration/remote-verifier.js +1 -1
  117. package/.agents/scripts/lib/orchestration/resolve-plan-run.js +155 -0
  118. package/.agents/scripts/lib/orchestration/resolves-token.js +1 -1
  119. package/.agents/scripts/lib/orchestration/retro-perf-heuristics.js +8 -8
  120. package/.agents/scripts/lib/orchestration/retro-proposals.js +140 -79
  121. package/.agents/scripts/lib/orchestration/review-depth.js +26 -12
  122. package/.agents/scripts/lib/orchestration/review-providers/codex.js +2 -2
  123. package/.agents/scripts/lib/orchestration/review-providers/review-provider-factory.js +21 -56
  124. package/.agents/scripts/lib/orchestration/run-epilogue.js +426 -0
  125. package/.agents/scripts/lib/orchestration/single-story-close/phases/auto-merge.js +1 -1
  126. package/.agents/scripts/lib/orchestration/single-story-close/phases/close-validation.js +1 -0
  127. package/.agents/scripts/lib/orchestration/single-story-close/phases/code-review.js +95 -41
  128. package/.agents/scripts/lib/orchestration/single-story-close/phases/options.js +16 -13
  129. package/.agents/scripts/lib/orchestration/single-story-close/phases/review-block.js +40 -0
  130. package/.agents/scripts/lib/orchestration/single-story-close/runner.js +11 -3
  131. package/.agents/scripts/lib/orchestration/spec-freshness.js +14 -205
  132. package/.agents/scripts/lib/orchestration/spec-section-validator.js +4 -5
  133. package/.agents/scripts/lib/orchestration/spec-spill.js +60 -0
  134. package/.agents/scripts/lib/orchestration/split-policy-validator.js +188 -0
  135. package/.agents/scripts/lib/orchestration/story-close/emit-blocked.js +49 -0
  136. package/.agents/scripts/lib/orchestration/story-close/phases/code-review.js +15 -12
  137. package/.agents/scripts/lib/orchestration/story-follow-ups.js +237 -0
  138. package/.agents/scripts/lib/orchestration/story-init-remote.js +47 -0
  139. package/.agents/scripts/lib/orchestration/story-plan-state.js +48 -0
  140. package/.agents/scripts/lib/orchestration/{epic-runner → story-progress}/story-run-progress-writer.js +3 -3
  141. package/.agents/scripts/lib/orchestration/structured-comment-parser.js +1 -1
  142. package/.agents/scripts/lib/orchestration/task-body-validator.js +8 -18
  143. package/.agents/scripts/lib/orchestration/ticket-validator-conflicts.js +11 -61
  144. package/.agents/scripts/lib/orchestration/ticket-validator-sizing.js +189 -373
  145. package/.agents/scripts/lib/orchestration/ticket-validator.js +3 -8
  146. package/.agents/scripts/lib/orchestration/ticketing/bulk.js +0 -25
  147. package/.agents/scripts/lib/orchestration/ticketing/reads.js +29 -26
  148. package/.agents/scripts/lib/orchestration/ticketing/transition.js +5 -5
  149. package/.agents/scripts/lib/planning-corpus.js +16 -11
  150. package/.agents/scripts/lib/preflight-runner.js +2 -2
  151. package/.agents/scripts/lib/provider-factory.js +1 -1
  152. package/.agents/scripts/lib/qa/coverage-verdict.js +5 -5
  153. package/.agents/scripts/lib/single-story/confirm-merge-follow-ups.js +36 -0
  154. package/.agents/scripts/lib/single-story-sweep/protection-ctx.js +1 -1
  155. package/.agents/scripts/lib/story-adjacency.js +11 -14
  156. package/.agents/scripts/lib/story-body/story-body.js +124 -70
  157. package/.agents/scripts/lib/story-plan.js +2 -4
  158. package/.agents/scripts/lib/templates/decomposer-prompts.js +46 -45
  159. package/.agents/scripts/lib/templates/spec-author-prompts.js +47 -45
  160. package/.agents/scripts/lib/{epic-body-sections.js → ticket-body-sections.js} +26 -26
  161. package/.agents/scripts/lib/validation-evidence.js +1 -1
  162. package/.agents/scripts/lib/wave-runner/ready-set.js +6 -6
  163. package/.agents/scripts/lib/workspace-provisioner.js +1 -1
  164. package/.agents/scripts/lib/worktree/lifecycle/reap.js +5 -7
  165. package/.agents/scripts/lint-issue-body.js +71 -40
  166. package/.agents/scripts/mandrel-update-preflight.js +1 -1
  167. package/.agents/scripts/notify.js +4 -3
  168. package/.agents/scripts/plan-context.js +64 -74
  169. package/.agents/scripts/plan-persist.js +121 -280
  170. package/.agents/scripts/plan-run-epilogue.js +97 -0
  171. package/.agents/scripts/post-structured-comment.js +38 -0
  172. package/.agents/scripts/providers/github/issues.js +17 -33
  173. package/.agents/scripts/providers/github/mappers.js +0 -12
  174. package/.agents/scripts/providers/github/tickets.js +2 -5
  175. package/.agents/scripts/resolve-plan-run.js +117 -0
  176. package/.agents/scripts/signals-view.js +24 -19
  177. package/.agents/scripts/single-story-close.js +11 -14
  178. package/.agents/scripts/single-story-confirm-merge.js +39 -23
  179. package/.agents/scripts/single-story-init.js +29 -20
  180. package/.agents/scripts/stories-wave-tick.js +6 -6
  181. package/.agents/scripts/story-plan.js +26 -47
  182. package/.agents/scripts/sync-claude-agents.js +165 -0
  183. package/.agents/scripts/update-ticket-state.js +37 -15
  184. package/.agents/skills/core/analyze-execution/SKILL.md +21 -18
  185. package/.agents/skills/core/api-and-interface-design/SKILL.md +5 -3
  186. package/.agents/skills/core/code-review-and-quality/SKILL.md +63 -7
  187. package/.agents/skills/core/debugging-and-error-recovery/SKILL.md +1 -1
  188. package/.agents/skills/core/gates-and-baselines/SKILL.md +149 -0
  189. package/.agents/skills/core/idea-refinement/SKILL.md +8 -14
  190. package/.agents/skills/core/qa-coverage-mapping/SKILL.md +7 -7
  191. package/.agents/skills/core/scope-triage/SKILL.md +28 -172
  192. package/.agents/skills/skills.index.json +8 -418
  193. package/.agents/starter-agentrc.json +0 -5
  194. package/.agents/templates/agent-protocol.md +9 -10
  195. package/.agents/workflows/audit-architecture.md +3 -3
  196. package/.agents/workflows/audit-clean-code.md +3 -3
  197. package/.agents/workflows/audit-dependencies.md +3 -3
  198. package/.agents/workflows/audit-devops.md +3 -3
  199. package/.agents/workflows/audit-documentation.md +5 -5
  200. package/.agents/workflows/audit-lighthouse.md +3 -3
  201. package/.agents/workflows/audit-navigability.md +3 -2
  202. package/.agents/workflows/audit-performance.md +3 -3
  203. package/.agents/workflows/audit-privacy.md +3 -3
  204. package/.agents/workflows/audit-quality.md +3 -3
  205. package/.agents/workflows/audit-security.md +3 -3
  206. package/.agents/workflows/audit-seo.md +3 -3
  207. package/.agents/workflows/audit-sre.md +3 -3
  208. package/.agents/workflows/audit-to-stories.md +20 -20
  209. package/.agents/workflows/audit-ux-ui.md +3 -3
  210. package/.agents/workflows/deliver.md +122 -131
  211. package/.agents/workflows/git-cleanup.md +3 -4
  212. package/.agents/workflows/helpers/_merge-conflict-template.md +1 -1
  213. package/.agents/workflows/helpers/acceptance-self-eval.md +52 -40
  214. package/.agents/workflows/helpers/code-review.md +70 -193
  215. package/.agents/workflows/helpers/{single-story-deliver-reference.md → deliver-story-reference.md} +12 -14
  216. package/.agents/workflows/helpers/{single-story-deliver.md → deliver-story.md} +113 -139
  217. package/.agents/workflows/helpers/diagnose.md +10 -10
  218. package/.agents/workflows/helpers/mandrel-sync-config.md +1 -1
  219. package/.agents/workflows/helpers/parallel-tooling.md +1 -1
  220. package/.agents/workflows/helpers/signals.md +16 -16
  221. package/.agents/workflows/helpers/worktree-lifecycle.md +48 -64
  222. package/.agents/workflows/mandrel-update.md +3 -2
  223. package/.agents/workflows/plan.md +112 -145
  224. package/.agents/workflows/qa-assist.md +24 -30
  225. package/.agents/workflows/qa-explore.md +29 -38
  226. package/.agents/workflows/qa-run.md +2 -2
  227. package/README.md +9 -8
  228. package/docs/CHANGELOG.md +46 -0
  229. package/lib/cli/registry.js +95 -0
  230. package/lib/migrations/index.js +6 -5
  231. package/package.json +5 -3
  232. package/.agents/personas/architect.md +0 -113
  233. package/.agents/personas/devops-engineer.md +0 -38
  234. package/.agents/personas/engineer-mobile.md +0 -120
  235. package/.agents/personas/engineer-web.md +0 -111
  236. package/.agents/personas/engineer.md +0 -119
  237. package/.agents/personas/product.md +0 -94
  238. package/.agents/personas/project-manager.md +0 -114
  239. package/.agents/personas/qa-engineer.md +0 -95
  240. package/.agents/personas/refactorer.md +0 -113
  241. package/.agents/personas/security-engineer.md +0 -112
  242. package/.agents/personas/sre.md +0 -86
  243. package/.agents/personas/technical-writer.md +0 -101
  244. package/.agents/personas/ux-designer.md +0 -95
  245. package/.agents/schemas/dispatch-manifest.json +0 -232
  246. package/.agents/schemas/epic-spec.schema.json +0 -153
  247. package/.agents/scripts/acceptance-spec-reconciler.js +0 -642
  248. package/.agents/scripts/dispatcher.js +0 -295
  249. package/.agents/scripts/epic-audit-prepare.js +0 -497
  250. package/.agents/scripts/epic-audit-recheck.js +0 -274
  251. package/.agents/scripts/epic-deliver-note-intervention.js +0 -192
  252. package/.agents/scripts/epic-deliver-preflight.js +0 -462
  253. package/.agents/scripts/epic-deliver-prepare.js +0 -590
  254. package/.agents/scripts/epic-execute-record-wave.js +0 -449
  255. package/.agents/scripts/epic-plan-clarity.js +0 -211
  256. package/.agents/scripts/epic-plan-decompose.js +0 -54
  257. package/.agents/scripts/epic-plan-healthcheck.js +0 -581
  258. package/.agents/scripts/epic-plan-spec.js +0 -64
  259. package/.agents/scripts/epic-reconcile.js +0 -625
  260. package/.agents/scripts/lib/baseline-snapshot.js +0 -979
  261. package/.agents/scripts/lib/checks/epic-merge-lock-stale.js +0 -54
  262. package/.agents/scripts/lib/checks/stale-origin-epic.js +0 -49
  263. package/.agents/scripts/lib/config/lifecycle.js +0 -40
  264. package/.agents/scripts/lib/config/preflight.js +0 -58
  265. package/.agents/scripts/lib/config/retro.js +0 -77
  266. package/.agents/scripts/lib/epic-merge-lock.js +0 -322
  267. package/.agents/scripts/lib/epic-plan-clarity.js +0 -181
  268. package/.agents/scripts/lib/epic-plan-ideation.js +0 -261
  269. package/.agents/scripts/lib/orchestration/context-hydration-engine.js +0 -660
  270. package/.agents/scripts/lib/orchestration/dispatch-engine.js +0 -134
  271. package/.agents/scripts/lib/orchestration/dispatch-pipeline.js +0 -183
  272. package/.agents/scripts/lib/orchestration/epic-cleanup.js +0 -801
  273. package/.agents/scripts/lib/orchestration/epic-deliver-lease-guard.js +0 -310
  274. package/.agents/scripts/lib/orchestration/epic-plan-decompose/phases/context.js +0 -163
  275. package/.agents/scripts/lib/orchestration/epic-plan-decompose/phases/creation.js +0 -140
  276. package/.agents/scripts/lib/orchestration/epic-plan-decompose/phases/dag.js +0 -64
  277. package/.agents/scripts/lib/orchestration/epic-plan-decompose/phases/diagnostics.js +0 -72
  278. package/.agents/scripts/lib/orchestration/epic-plan-decompose/phases/persist-helpers.js +0 -156
  279. package/.agents/scripts/lib/orchestration/epic-plan-decompose/phases/persist.js +0 -345
  280. package/.agents/scripts/lib/orchestration/epic-plan-decompose/phases/planning-artifacts.js +0 -41
  281. package/.agents/scripts/lib/orchestration/epic-plan-decompose/phases/reconcile-spawn.js +0 -86
  282. package/.agents/scripts/lib/orchestration/epic-plan-lease-guard.js +0 -391
  283. package/.agents/scripts/lib/orchestration/epic-plan-spec/phases/drain.js +0 -94
  284. package/.agents/scripts/lib/orchestration/epic-plan-spec/phases/plan-epic.js +0 -236
  285. package/.agents/scripts/lib/orchestration/epic-plan-spec/phases/run-spec-phase.js +0 -307
  286. package/.agents/scripts/lib/orchestration/epic-plan-spec/phases/spec-freshness.js +0 -117
  287. package/.agents/scripts/lib/orchestration/epic-plan-state-store.js +0 -117
  288. package/.agents/scripts/lib/orchestration/epic-run-state-store.js +0 -388
  289. package/.agents/scripts/lib/orchestration/epic-runner/concurrency-gate.js +0 -186
  290. package/.agents/scripts/lib/orchestration/epic-runner/deliver-phases.js +0 -50
  291. package/.agents/scripts/lib/orchestration/epic-runner/phases/build-wave-dag.js +0 -129
  292. package/.agents/scripts/lib/orchestration/epic-runner/phases/snapshot.js +0 -103
  293. package/.agents/scripts/lib/orchestration/epic-runner/progress-reporter/composition.js +0 -267
  294. package/.agents/scripts/lib/orchestration/epic-runner/progress-reporter/signals.js +0 -210
  295. package/.agents/scripts/lib/orchestration/epic-runner/progress-reporter/transport.js +0 -238
  296. package/.agents/scripts/lib/orchestration/epic-runner/progress-signals/_bullet-format.js +0 -32
  297. package/.agents/scripts/lib/orchestration/epic-runner/progress-signals/component-drift.js +0 -203
  298. package/.agents/scripts/lib/orchestration/epic-runner/progress-signals/crap-drift.js +0 -227
  299. package/.agents/scripts/lib/orchestration/epic-runner/progress-signals/maintainability-drift.js +0 -117
  300. package/.agents/scripts/lib/orchestration/epic-runner/progress-signals/stalled-worktree.js +0 -37
  301. package/.agents/scripts/lib/orchestration/epic-runner/story-launcher.js +0 -127
  302. package/.agents/scripts/lib/orchestration/epic-runner/sub-agent-return.js +0 -276
  303. package/.agents/scripts/lib/orchestration/epic-runner/wave-scheduler.js +0 -66
  304. package/.agents/scripts/lib/orchestration/epic-spec-reconciler-apply.js +0 -789
  305. package/.agents/scripts/lib/orchestration/epic-spec-reconciler-diff.js +0 -676
  306. package/.agents/scripts/lib/orchestration/epic-spec-reconciler-discriminator.js +0 -389
  307. package/.agents/scripts/lib/orchestration/epic-spec-reconciler-format.js +0 -230
  308. package/.agents/scripts/lib/orchestration/epic-spec-reconciler-ops.js +0 -361
  309. package/.agents/scripts/lib/orchestration/finalize/open-or-locate-pr.js +0 -306
  310. package/.agents/scripts/lib/orchestration/finalize/post-handoff-comment.js +0 -489
  311. package/.agents/scripts/lib/orchestration/finalize/sanitize-skip-ci.js +0 -88
  312. package/.agents/scripts/lib/orchestration/lifecycle/emit-story-dispatch-end.js +0 -147
  313. package/.agents/scripts/lib/orchestration/lifecycle/listeners/acceptance-reconciler.js +0 -384
  314. package/.agents/scripts/lib/orchestration/lifecycle/listeners/automerge-armer.js +0 -501
  315. package/.agents/scripts/lib/orchestration/lifecycle/listeners/automerge-predicate.js +0 -984
  316. package/.agents/scripts/lib/orchestration/lifecycle/listeners/branch-cleaner.js +0 -264
  317. package/.agents/scripts/lib/orchestration/lifecycle/listeners/checkpoint-pointer-writer.js +0 -278
  318. package/.agents/scripts/lib/orchestration/lifecycle/listeners/cleaner.js +0 -355
  319. package/.agents/scripts/lib/orchestration/lifecycle/listeners/finalizer.js +0 -673
  320. package/.agents/scripts/lib/orchestration/lifecycle/listeners/index.js +0 -378
  321. package/.agents/scripts/lib/orchestration/lifecycle/listeners/intervention-recorder.js +0 -140
  322. package/.agents/scripts/lib/orchestration/lifecycle/listeners/label-transitioner.js +0 -144
  323. package/.agents/scripts/lib/orchestration/lifecycle/listeners/notify-dispatcher.js +0 -174
  324. package/.agents/scripts/lib/orchestration/manifest-builder.js +0 -222
  325. package/.agents/scripts/lib/orchestration/plan-persist/amend.js +0 -359
  326. package/.agents/scripts/lib/orchestration/plan-persist/delivery-mode.js +0 -127
  327. package/.agents/scripts/lib/orchestration/post-merge-pipeline.js +0 -205
  328. package/.agents/scripts/lib/orchestration/recurring-failure-detector.js +0 -152
  329. package/.agents/scripts/lib/orchestration/retro/phases/checks.js +0 -94
  330. package/.agents/scripts/lib/orchestration/retro/phases/compose-body.js +0 -571
  331. package/.agents/scripts/lib/orchestration/retro/phases/gather-signals.js +0 -450
  332. package/.agents/scripts/lib/orchestration/retro/phases/post-and-mirror.js +0 -191
  333. package/.agents/scripts/lib/orchestration/retro-heuristics.js +0 -57
  334. package/.agents/scripts/lib/orchestration/retro-runner.js +0 -197
  335. package/.agents/scripts/lib/orchestration/skill-capsule-loader.js +0 -109
  336. package/.agents/scripts/lib/orchestration/spec-renderer.js +0 -447
  337. package/.agents/scripts/lib/orchestration/story-close/auto-refresh-runner.js +0 -747
  338. package/.agents/scripts/lib/orchestration/story-close/baseline-attribution/phases/gate-failure.js +0 -211
  339. package/.agents/scripts/lib/orchestration/story-close/baseline-attribution/phases/pre-merge-attribution.js +0 -158
  340. package/.agents/scripts/lib/orchestration/story-close/baseline-attribution/phases/refresh-commit.js +0 -446
  341. package/.agents/scripts/lib/orchestration/story-close/baseline-attribution/phases/regression-projection.js +0 -297
  342. package/.agents/scripts/lib/orchestration/story-close/baseline-attribution/phases/scope-discovery.js +0 -48
  343. package/.agents/scripts/lib/orchestration/story-close/baseline-attribution-wiring.js +0 -67
  344. package/.agents/scripts/lib/orchestration/story-close/baseline-attribution.js +0 -161
  345. package/.agents/scripts/lib/orchestration/story-close/baseline-friction-body.js +0 -117
  346. package/.agents/scripts/lib/orchestration/story-close/cd-out-guard.js +0 -86
  347. package/.agents/scripts/lib/orchestration/story-close/cleanup-reconciler.js +0 -147
  348. package/.agents/scripts/lib/orchestration/story-close/close-inputs.js +0 -142
  349. package/.agents/scripts/lib/orchestration/story-close/comment-bodies.js +0 -62
  350. package/.agents/scripts/lib/orchestration/story-close/merge-runner.js +0 -658
  351. package/.agents/scripts/lib/orchestration/story-close/merge-subject.js +0 -198
  352. package/.agents/scripts/lib/orchestration/story-close/phases/branch-restore.js +0 -105
  353. package/.agents/scripts/lib/orchestration/story-close/phases/close.js +0 -222
  354. package/.agents/scripts/lib/orchestration/story-close/phases/gates.js +0 -292
  355. package/.agents/scripts/lib/orchestration/story-close/phases/locked-pipeline.js +0 -270
  356. package/.agents/scripts/lib/orchestration/story-close/phases/preflight.js +0 -110
  357. package/.agents/scripts/lib/orchestration/story-close/phases/refresh.js +0 -86
  358. package/.agents/scripts/lib/orchestration/story-close/phases/timeout-blocked-emitter.js +0 -112
  359. package/.agents/scripts/lib/orchestration/story-close/phases/timeout-blocked.js +0 -157
  360. package/.agents/scripts/lib/orchestration/story-close/post-merge-close.js +0 -421
  361. package/.agents/scripts/lib/orchestration/story-close/pre-merge-validation.js +0 -301
  362. package/.agents/scripts/lib/orchestration/story-close/shared-checkout-guard.js +0 -163
  363. package/.agents/scripts/lib/orchestration/story-close-recovery.js +0 -690
  364. package/.agents/scripts/lib/orchestration/wave-marker.js +0 -28
  365. package/.agents/scripts/lib/orchestration/wave-record-io.js +0 -218
  366. package/.agents/scripts/lib/orchestration/wave-record-notifications.js +0 -145
  367. package/.agents/scripts/lib/orchestration/wave-record-projection.js +0 -212
  368. package/.agents/scripts/lib/presentation/dispatch-manifest-render.js +0 -111
  369. package/.agents/scripts/lib/presentation/manifest-builder.js +0 -239
  370. package/.agents/scripts/lib/presentation/manifest-formatter.js +0 -242
  371. package/.agents/scripts/lib/presentation/manifest-helpers.js +0 -213
  372. package/.agents/scripts/lib/presentation/manifest-persistence.js +0 -261
  373. package/.agents/scripts/lib/presentation/manifest-procedures.js +0 -55
  374. package/.agents/scripts/lib/presentation/manifest-render-waves.js +0 -306
  375. package/.agents/scripts/lib/presentation/manifest-renderer.js +0 -188
  376. package/.agents/scripts/lib/presentation/manifest-story-views.js +0 -110
  377. package/.agents/scripts/lib/push-epic-retry.js +0 -209
  378. package/.agents/scripts/lib/spec/index.js +0 -36
  379. package/.agents/scripts/lib/spec/loader.js +0 -425
  380. package/.agents/scripts/lib/spec/state.js +0 -208
  381. package/.agents/scripts/lib/story-init/blocker-validator.js +0 -68
  382. package/.agents/scripts/lib/story-init/branch-initializer.js +0 -408
  383. package/.agents/scripts/lib/story-init/context-resolver.js +0 -92
  384. package/.agents/scripts/lib/story-init/donor-precheck.js +0 -207
  385. package/.agents/scripts/lib/story-init/state-transitioner.js +0 -80
  386. package/.agents/scripts/lib/story-init/task-graph-builder.js +0 -124
  387. package/.agents/scripts/lib/story-init/transition-summary.js +0 -34
  388. package/.agents/scripts/lib/test-reserved-epic-temp-ids.js +0 -35
  389. package/.agents/scripts/lib/wave-runner/tick.js +0 -754
  390. package/.agents/scripts/lib/wave-runner/wave-runner-error.js +0 -20
  391. package/.agents/scripts/lifecycle-emit-story-dispatch.js +0 -194
  392. package/.agents/scripts/lifecycle-emit.js +0 -510
  393. package/.agents/scripts/plan-critics.js +0 -199
  394. package/.agents/scripts/retro-run.js +0 -218
  395. package/.agents/scripts/standalone-feedback-rollup.js +0 -188
  396. package/.agents/scripts/story-close.js +0 -294
  397. package/.agents/scripts/story-init.js +0 -599
  398. package/.agents/scripts/story-phase.js +0 -369
  399. package/.agents/scripts/wave-tick.js +0 -335
  400. package/.agents/skills/core/baseline-refresh/SKILL.md +0 -181
  401. package/.agents/skills/core/ci-cd-and-automation/SKILL.md +0 -274
  402. package/.agents/skills/core/ci-cd-and-automation/examples.md +0 -211
  403. package/.agents/skills/core/code-simplification/SKILL.md +0 -389
  404. package/.agents/skills/core/context-engineering/SKILL.md +0 -309
  405. package/.agents/skills/core/context-engineering/examples.md +0 -58
  406. package/.agents/skills/core/deprecation-and-migration/SKILL.md +0 -250
  407. package/.agents/skills/core/epic-plan-consolidate/SKILL.md +0 -172
  408. package/.agents/skills/core/epic-plan-consolidate/examples.md +0 -51
  409. package/.agents/skills/core/epic-plan-decompose-author/SKILL.md +0 -441
  410. package/.agents/skills/core/epic-plan-decompose-author/examples.md +0 -47
  411. package/.agents/skills/core/epic-plan-premortem/SKILL.md +0 -146
  412. package/.agents/skills/core/epic-plan-premortem/examples.md +0 -53
  413. package/.agents/skills/core/epic-plan-spec-author/SKILL.md +0 -413
  414. package/.agents/skills/core/epic-plan-spec-author/examples.md +0 -91
  415. package/.agents/skills/core/frontend-ui-engineering/SKILL.md +0 -357
  416. package/.agents/skills/core/hydrate-context/SKILL.md +0 -123
  417. package/.agents/skills/core/idea-refinement/examples.md +0 -437
  418. package/.agents/skills/core/idea-refinement/frameworks.md +0 -135
  419. package/.agents/skills/core/incremental-implementation/SKILL.md +0 -271
  420. package/.agents/skills/core/introducing-a-baseline-gate/SKILL.md +0 -213
  421. package/.agents/skills/core/knowledge-transfer/SKILL.md +0 -180
  422. package/.agents/skills/core/mutation-survivor-remediation/SKILL.md +0 -117
  423. package/.agents/skills/core/performance-optimization/SKILL.md +0 -314
  424. package/.agents/skills/core/planning-and-task-breakdown/SKILL.md +0 -277
  425. package/.agents/skills/core/property-based-testing/SKILL.md +0 -148
  426. package/.agents/skills/core/refactoring-discipline/SKILL.md +0 -111
  427. package/.agents/skills/core/shipping-and-launch/SKILL.md +0 -328
  428. package/.agents/skills/core/spec-driven-development/SKILL.md +0 -252
  429. package/.agents/skills/core/test-driven-development/SKILL.md +0 -475
  430. package/.agents/skills/core/using-agent-skills/SKILL.md +0 -232
  431. package/.agents/skills/stack/architecture/monorepo-path-strategist/SKILL.md +0 -31
  432. package/.agents/skills/stack/architecture/structured-output-zod/SKILL.md +0 -51
  433. package/.agents/skills/stack/architecture/subagent-orchestration/SKILL.md +0 -76
  434. package/.agents/skills/stack/backend/cloudflare-hono-architect/SKILL.md +0 -31
  435. package/.agents/skills/stack/backend/cloudflare-hono-architect/examples/route-template.ts +0 -33
  436. package/.agents/skills/stack/backend/cloudflare-queue-manager/SKILL.md +0 -31
  437. package/.agents/skills/stack/backend/cloudflare-workers/SKILL.md +0 -51
  438. package/.agents/skills/stack/backend/highlevel-crm/SKILL.md +0 -54
  439. package/.agents/skills/stack/backend/sqlite-drizzle-expert/SKILL.md +0 -29
  440. package/.agents/skills/stack/backend/sqlite-drizzle-expert/examples/schema-template.ts +0 -30
  441. package/.agents/skills/stack/backend/stripe-integration/SKILL.md +0 -57
  442. package/.agents/skills/stack/backend/stripe-integration/scripts/listen-stripe.sh +0 -9
  443. package/.agents/skills/stack/backend/turso-sqlite/SKILL.md +0 -48
  444. package/.agents/skills/stack/frontend/astro/SKILL.md +0 -62
  445. package/.agents/skills/stack/frontend/astro-react-island-strategist/SKILL.md +0 -30
  446. package/.agents/skills/stack/frontend/expo-react-native-developer/SKILL.md +0 -29
  447. package/.agents/skills/stack/frontend/google-analytics-v4/SKILL.md +0 -50
  448. package/.agents/skills/stack/frontend/tailwind-v4/SKILL.md +0 -58
  449. package/.agents/skills/stack/frontend/ui-accessibility-engineer/SKILL.md +0 -34
  450. package/.agents/skills/stack/qa/audit-accessibility/SKILL.md +0 -51
  451. package/.agents/skills/stack/qa/lighthouse-baseline/SKILL.md +0 -199
  452. package/.agents/skills/stack/security/backend-security-patterns/SKILL.md +0 -68
  453. package/.agents/workflows/helpers/deliver-epic-reference.md +0 -534
  454. package/.agents/workflows/helpers/deliver-epic.md +0 -955
  455. package/.agents/workflows/helpers/deliver-stories.md +0 -440
  456. package/.agents/workflows/helpers/epic-audit.md +0 -189
  457. package/.agents/workflows/helpers/epic-deliver-story.md +0 -427
  458. package/.agents/workflows/helpers/epic-testing.md +0 -125
  459. package/.agents/workflows/helpers/plan-epic-reference.md +0 -160
  460. package/.agents/workflows/helpers/plan-epic.md +0 -351
  461. package/.agents/workflows/helpers/plan-story.md +0 -251
  462. package/.agents/workflows/helpers/scope-triage-gate.md +0 -108
  463. /package/.agents/scripts/lib/orchestration/{epic-plan-spec/phases → planning}/spec-authoring-grounding.js +0 -0
@@ -1,10 +1,11 @@
1
1
  ---
2
2
  name: code-review-and-quality
3
3
  description:
4
- Conducts multi-axis code review. Use before merging any change. Use when
5
- reviewing code written by yourself, another agent, or a human. Use when you
6
- need to assess code quality across multiple dimensions before it enters the
7
- main branch.
4
+ Conducts multi-axis code review and runs the disciplined post-green refactor
5
+ pass. Use before merging any change, when reviewing code written by yourself,
6
+ another agent, or a human, or when the opt-in `delivery.refactorStage`
7
+ checkpoint asks for a behaviour-preserving CRAP/duplication pass after the
8
+ suite is green.
8
9
  ---
9
10
 
10
11
  # Code Review and Quality
@@ -18,9 +19,11 @@ description:
18
19
  - Reject "clever" code in favour of the boring, obvious solution. Abstractions MUST earn their complexity (no generalizing before the third use case).
19
20
  - Flag dead code artifacts (`_unused` vars, backwards-compat shims, `// removed` comments) and require their removal before merge.
20
21
  - Defer to `.agents/rules/security-baseline.md` and the `security-and-hardening` skill for security review; explicit checks include input validation, no hardcoded secrets, parameterized queries, encoded output, authn+authz, and treating external data as untrusted.
21
- - Defer to `performance-optimization` for perf review; explicit checks include no N+1 queries, no unbounded fetches, no blocking sync work, no obviously oversized bundles.
22
+ - Review performance on the hot path only, and measure before optimizing; explicit checks include no N+1 queries, no unbounded fetches, no blocking sync work, no obviously oversized bundles.
22
23
  - Disallow scope creep in a PR: drive-by cleanups, adjacent refactors, and "while I'm here" edits should be split into a separate change.
23
24
  - Bug-fix reviews cover **both** the fix and the regression test; a fix without a failing-then-passing test is not approvable.
25
+ - **Refactoring is post-green and behaviour-preserving.** Run the refactor pass only when the suite is already green and gates pass; inputs, outputs, side effects, error semantics, and ordering MUST be identical before and after, and existing tests MUST keep passing **without modification** (if a test had to change, behaviour changed — revert).
26
+ - **Lower CRAP by lowering complexity, and remove duplication at the root.** Target the highest-CRAP well-covered functions and the largest verbatim duplications by measurement (`check-baselines.js`), not by smell; extract one well-named helper rather than leaving near-copies. CRAP must not rise and maintainability must not fall on any touched file, and no gate, floor, or threshold may be retuned to make the pass "succeed".
24
27
 
25
28
  ## Overview
26
29
 
@@ -105,8 +108,8 @@ introduce vulnerabilities?
105
108
 
106
109
  ### 5. Performance
107
110
 
108
- For detailed profiling and optimization, see `performance-optimization`. Does
109
- the change introduce performance problems?
111
+ Measure before optimizing, and only on the hot path. Does the change introduce
112
+ performance problems?
110
113
 
111
114
  - Any N+1 query patterns?
112
115
  - Any unbounded loops or unconstrained data fetching?
@@ -409,6 +412,50 @@ Every dependency is a liability.
409
412
  optional
410
413
  - Accepting "I'll fix it later" — it never happens
411
414
 
415
+ ## Post-Green Refactor Pass
416
+
417
+ Review's sibling discipline is the **behaviour-preserving refactor** that drives
418
+ CRAP (Change Risk Anti-Patterns) and duplication down _after_ the code is green
419
+ — the pass wired in as the opt-in `delivery.refactorStage` checkpoint. It
420
+ optimises for the measured CRAP and duplication axes the baselines ratchet, not
421
+ for subjective readability, and it never runs from red.
422
+
423
+ **When to run:** a baseline report flags a high-CRAP function that is already
424
+ well-covered (so the lever is complexity, not coverage); the same logic is
425
+ duplicated across two or more files and the copies are drifting; or the
426
+ `delivery.refactorStage` checkpoint fires after gates pass and before a Story
427
+ closes. **When NOT to:** before tests are green (write/fix tests first), or when
428
+ a function's CRAP is high because it is _uncovered_ — that is a missing-test
429
+ problem, so drive it with the TDD cycle in
430
+ [`.agents/rules/testing-standards.md`](../../../rules/testing-standards.md).
431
+
432
+ ```text
433
+ Confirm green + baseline → pick highest-CRAP / largest dup
434
+ ▲ │
435
+ │ ▼
436
+ re-run gates, confirm ◄── refactor ◄── comprehend the target
437
+ CRAP↓ / maint↑, tests pass (one change) (call sites + tests)
438
+ ```
439
+
440
+ 1. **Baseline.** Confirm green and capture current CRAP and maintainability
441
+ (`node .agents/scripts/check-baselines.js`) — your do-no-harm reference.
442
+ 2. **Target by measurement.** Pick the highest-CRAP well-covered function, or
443
+ the largest verbatim duplication. Work worst-first.
444
+ 3. **Comprehend before you touch (Chesterton's Fence).** Read the call sites and
445
+ the tests that pin the behaviour first; an "unnecessary" abstraction may
446
+ exist for testability or extensibility.
447
+ 4. **Refactor one step.** Extract a focused function, flatten nesting into guard
448
+ clauses, replace a nested ternary / boolean-flag param, or extract a single
449
+ shared helper for the duplication (dedup the _behaviour_, not just the text —
450
+ look-alike blocks that encode different responsibilities stay separate).
451
+ 5. **Verify.** Re-run the affected tests (unmodified) and the baselines. CRAP
452
+ must not rise, maintainability must not fall, tests must pass. If a test
453
+ needed editing, revert — behaviour changed.
454
+
455
+ Keep each refactor an isolated, reviewable commit separate from feature or fix
456
+ work, refactor only the targeted functions/duplications (no drive-by rewrites),
457
+ and leave no dead code behind (unused imports, orphaned helpers).
458
+
412
459
  ## Verification
413
460
 
414
461
  After review is complete:
@@ -419,3 +466,12 @@ After review is complete:
419
466
  - [ ] Tests pass
420
467
  - [ ] Build succeeds
421
468
  - [ ] The verification story is documented (what changed, how it was verified)
469
+
470
+ After a post-green refactor pass:
471
+
472
+ - [ ] The suite was green before and after, with **no test modifications**
473
+ - [ ] CRAP did not rise and maintainability did not fall on any touched file
474
+ (baselines re-run and compared)
475
+ - [ ] No gate, floor, or coverage threshold was loosened
476
+ - [ ] Duplication was removed at the root (one helper), not just locally patched
477
+ - [ ] Each refactor is an isolated commit, separate from feature or fix work
@@ -15,7 +15,7 @@ description:
15
15
  - Follow the triage checklist in order — **Reproduce → Localize → Diagnose → Fix → Verify → Guard** — and never skip steps.
16
16
  - A bug you cannot reproduce reliably is a bug you cannot fix with confidence. Invest in reproduction before patching.
17
17
  - Fix the **root cause**, not the symptom. Suppressing an error, swallowing an exception, or stubbing an assertion is not a fix.
18
- - Every bug fix ships with a **failing-then-passing regression test** (the Prove-It Pattern from `test-driven-development`). A fix without a guard test is incomplete.
18
+ - Every bug fix ships with a **failing-then-passing regression test** (the Prove-It Pattern in `.agents/rules/testing-standards.md`). A fix without a guard test is incomplete.
19
19
  - Apply the **Anti-Thrashing** rule: if you have applied the same kind of fix more than once and the failure mode hasn't changed, the diagnosis is wrong — re-plan.
20
20
  - For non-reproducible bugs, classify them (timing / environment / state / random), add targeted instrumentation, and document conditions instead of chasing in the dark.
21
21
  - Bisect history with `git bisect` (or equivalent) when "something used to work" and you cannot localize from the diff.
@@ -0,0 +1,149 @@
1
+ ---
2
+ name: gates-and-baselines
3
+ description:
4
+ Governs quality gates and the unified-baseline snapshots. Use when authoring
5
+ a baseline refresh commit (CRAP, maintainability, dead-exports, lighthouse),
6
+ when setting up or modifying CI quality gates, or when introducing a new gate
7
+ that asserts on pre-existing state without turning the integration branch red.
8
+ allowed_tools:
9
+ - Read
10
+ - Write
11
+ - Bash
12
+ ---
13
+
14
+ # Gates and Baselines
15
+
16
+ ## Policy Capsule
17
+
18
+ - **No gate may be skipped.** Failing lint means fix lint, not disable the rule; a failing test means fix the code, not `.skip` or delete the test. Gates are ordered shift-left so cheap checks fail first, and CI failure output is fed back verbatim with the directive to reproduce and fix locally before re-pushing.
19
+ - **Introducing a gate that asserts on pre-existing state** (doc-drift, lint-vocabulary, dependency-cycle, missing-coverage) MUST land green at merge: either advisory-first (report-only until the backlog is burned down) or with the populated baseline committed in the same change that turns the gate on. Never wire a gate into `requiredChecks` that lands red on latent findings nobody authored.
20
+ - **Refresh a baseline only when the change is deliberate** — a rename/move, an operator-approved complexity bump, a signed-off perf delta, an intentional API-surface change. Never refresh to paper over an unintentional regression; fix the regression instead.
21
+ - Run the kind-specific update command (`npm run crap:update` / `maintainability:update` / `dead-exports:update` / `lighthouse:update`) on the **Story branch**, not on `main`.
22
+ - Verify the refresh diff is scoped to the relevant `baselines/<kind>.json` (plus cosmetic `package-lock.json` churn only). If unrelated files appear, STOP — the refresh is contaminated. Stage baseline files **explicitly** (`git add baselines/<kind>.json`); never `git add -A` in a refresh commit.
23
+ - Commit-subject contract: a **Conventional-Commits** subject `chore(baselines): refresh <kind> snapshot for <reason>` — never an ad-hoc leading token like `baseline-refresh:` (commitlint and the planner validator reject it). The body is **mandatory** and non-empty: what changed, why the new floor is correct, and the Story/Epic that triggered it.
24
+ - Add the machine-readable trailer `baseline-refresh: true` (git-trailer `Key: value` style) and `Epic: #<epic-id>` to the body whenever observability classification matters. Never pass `--no-verify`; the `commit-msg` hook (commitlint) MUST run and pass.
25
+ - After the refresh lands, re-run `node .agents/scripts/check-baselines.js` to confirm the gate passes against the new snapshot; if it still fails, a sibling kind drifted — refresh that kind too.
26
+ - Keep credentials in GitHub Secrets (or platform equivalent) even for CI-only test databases; treat the security audit (`npm audit` or equivalent) as gating for critical/high vulnerabilities reachable in production code.
27
+
28
+ ## The Quality Gate Pipeline
29
+
30
+ Automate quality gates so no change reaches production without passing tests,
31
+ lint, type checking, and build. **Shift left** — a bug caught in linting costs
32
+ minutes; the same bug caught in production costs hours — and prefer many small,
33
+ frequent releases over big-bang merges (a deploy of 3 changes is debuggable, one
34
+ of 30 is not).
35
+
36
+ ```text
37
+ lint → typecheck → unit tests → build → integration → E2E (optional)
38
+ → security audit → bundle-size
39
+ ```
40
+
41
+ **No gate can be skipped.** If lint fails, fix lint. If a test fails, fix the
42
+ code. When CI fails, feed the specific error back into the agent loop with the
43
+ directive to verify locally before re-pushing.
44
+
45
+ ### Introducing a gate on pre-existing state
46
+
47
+ A new gate that asserts on latent state (doc-drift, lint-vocabulary,
48
+ dependency-cycle, missing-test-coverage) lands red because of findings nobody
49
+ authored, and every downstream PR is blocked until someone hotfixes the
50
+ integration branch. Before wiring such a gate into `requiredChecks`, land it in
51
+ a shape that is green at merge — **advisory-first** (report-only until the
52
+ backlog is burned down) or by **committing the populated baseline in the same
53
+ change** that turns the gate on.
54
+
55
+ ## Baseline Refresh
56
+
57
+ The close-validation chain enforces unified baseline snapshots
58
+ (`baselines/crap.json`, `baselines/maintainability.json`,
59
+ `baselines/dead-exports.json`, `baselines/lighthouse.json`). A refresh is **not**
60
+ a regression entry — it tells the ratchet that the new baseline key is
61
+ intentional, so the gate compares future runs against the refreshed snapshot
62
+ rather than the prior one.
63
+
64
+ **When to refresh:** a file rename/move detached an MI/CRAP key; a method rename
65
+ inside a file produced a phantom new + phantom deleted key (escomplex keys CRAP
66
+ rows on `<file>::<methodName>`); an operator-approved complexity bump or perf
67
+ delta needs to be enshrined as the new floor; a dead-export gate flagged a
68
+ signed-off API-surface change. If the underlying change is an **unintentional**
69
+ regression, do not refresh — remediate first.
70
+
71
+ ### Commit-subject contract (authoritative)
72
+
73
+ ```text
74
+ chore(baselines): refresh <kind> snapshot for <reason>
75
+
76
+ <non-empty body explaining the refresh — what changed, why the new
77
+ baseline is the correct floor, and any operator sign-off reference>
78
+
79
+ baseline-refresh: true
80
+ Epic: #<epic-id>
81
+ ```
82
+
83
+ The `commit-msg` hook (`commitlint`) rejects any subject whose leading token is
84
+ not one of `feat|fix|chore|refactor|perf|docs|style|test|build|ci|revert`, and
85
+ `--no-verify` is forbidden by
86
+ [`.agents/rules/git-conventions.md`](../../../rules/git-conventions.md), so the
87
+ subject MUST conform. `release-please` consumes the subject on `main`;
88
+ `chore(baselines):` keeps the refresh out of the user-facing changelog (correct —
89
+ it is internal hygiene) while staying machine-parseable. The
90
+ `baseline-refresh: true` **body trailer** is the canonical machine-readable
91
+ marker (what
92
+ [`.agents/scripts/lib/observability/baseline-refresh-rate.js`](../../../scripts/lib/observability/baseline-refresh-rate.js)
93
+ classifies against) — subject-level leading tokens are not, and must not be, used
94
+ for this purpose.
95
+
96
+ ### Procedure
97
+
98
+ | Kind | Update command |
99
+ | --------------- | -------------------------------- |
100
+ | CRAP | `npm run crap:update` |
101
+ | Maintainability | `npm run maintainability:update` |
102
+ | Dead-exports | `npm run dead-exports:update` |
103
+ | Lighthouse | `npm run lighthouse:update` |
104
+
105
+ 1. **Run the matching update command** on the Story branch (HEAD must already be
106
+ the Story branch, not `main`).
107
+ 2. **Verify the diff is scoped** to the relevant `baselines/<kind>.json` (and
108
+ possibly cosmetic `package-lock.json` churn). Unrelated files → STOP, the
109
+ refresh is contaminated.
110
+ 3. **Author the commit.** Stage the baseline file(s) explicitly, then commit with
111
+ the Conventional-Commits subject + body trailer above:
112
+
113
+ ```bash
114
+ git add baselines/<kind>.json
115
+ git commit -m "$(cat <<'EOF'
116
+ chore(baselines): refresh <kind> snapshot for <reason>
117
+
118
+ <body: what changed, why the new floor is correct, linking the Story/Epic.>
119
+
120
+ baseline-refresh: true
121
+ Epic: #<epic-id>
122
+ EOF
123
+ )"
124
+ ```
125
+
126
+ Do NOT pass `--no-verify`.
127
+ 4. **Re-run the gate** — `node .agents/scripts/check-baselines.js`. If it still
128
+ fails, a sibling kind drifted; repeat from step 1 for that kind.
129
+
130
+ ## Red Flags
131
+
132
+ - CI failures ignored or silenced; tests disabled in CI to make the pipeline pass.
133
+ - A new required gate merged red on pre-existing findings, blocking every
134
+ downstream PR.
135
+ - A legacy ad-hoc leading token (`baseline-refresh:`) as the commit subject type.
136
+ - An empty-body refresh — unreviewable, hides the operator decision.
137
+ - A refresh commit whose diff touches unrelated files (contaminated refresh).
138
+ - Refreshing to paper over an unintentional regression.
139
+ - Secrets stored in code or CI config instead of a secrets manager.
140
+
141
+ ## Verification
142
+
143
+ - [ ] Every quality gate is present (lint, types, tests, build, audit) and
144
+ failures block merge (branch protection configured).
145
+ - [ ] Any newly introduced gate is green at merge (advisory-first or
146
+ baseline-in-same-change).
147
+ - [ ] A baseline refresh uses the Conventional-Commits subject + non-empty body
148
+ + `baseline-refresh: true` trailer, staged explicitly, no `--no-verify`.
149
+ - [ ] `check-baselines.js` passes against the refreshed snapshot.
@@ -35,12 +35,12 @@ structured divergent and convergent thinking.
35
35
 
36
36
  ## Activation
37
37
 
38
- Called from `/plan` Phase 1 (ideation entry, when no `<epic#>` is
39
- supplied or `--idea "<seed>"` is passed) and Phase 6 (Epic Clarity Gate,
40
- when an existing Epic body fails the section-presence rubric). In Phase 6
41
- the skill is seeded from the **current Epic body** — not a blank seed —
42
- with the rubric gap list (`missingOrPlaceholder`) as the convergence
43
- target.
38
+ Called from [`/plan`](../../../workflows/plan.md) during ideation when the
39
+ operator supplies `--seed "<text>"` (or runs ideation with no seed and
40
+ the host collects one interactively). The skill sharpens freeform intent
41
+ into canonical planning sections that `/plan` then folds into a Story.
42
+ There is no separate Epic Clarity Gate path in v2 — N=1 Story authoring
43
+ with a folded `## Spec` is the lean default.
44
44
 
45
45
  ## Usage
46
46
 
@@ -124,17 +124,14 @@ conversation, not a template.
124
124
  wouldn't?"
125
125
 
126
126
  Push beyond what the user initially asked for. Create products people don't
127
- know they need yet.
127
+ know they need yet. Pick the lens that fits the idea — don't run every one
128
+ mechanically.
128
129
 
129
130
  **If running inside a codebase:** Use `Glob`, `Grep`, and `Read` to scan for
130
131
  relevant context — existing architecture, patterns, constraints, prior art.
131
132
  Ground your variations in what actually exists. Reference specific files and
132
133
  patterns when relevant.
133
134
 
134
- Read `frameworks.md` in this skill directory for additional ideation frameworks
135
- you can draw from. Use them selectively — pick the lens that fits the idea,
136
- don't run every framework mechanically.
137
-
138
135
  #### Phase 2: Evaluate & Converge (Grill)
139
136
 
140
137
  After the user reacts to Phase 1 (indicates which ideas resonate, pushes back,
@@ -283,9 +280,6 @@ Direct, thoughtful, slightly provocative. You're a sharp thinking partner, not a
283
280
  facilitator reading from a script. Channel the energy of "that's interesting,
284
281
  but what if..." -- always pushing one step further without being exhausting.
285
282
 
286
- Read `examples.md` in this skill directory for examples of what great ideation
287
- sessions look like.
288
-
289
283
  ## Red Flags
290
284
 
291
285
  - Generating 20+ shallow variations instead of 5-8 considered ones
@@ -22,7 +22,7 @@ allowed_tools:
22
22
  - Read the verdict as a `{unit, contract, acceptance}` object: each tier is `{status: 'present'|'absent', note}`. A surface with only a colocated unit test reports `unit: present` and `contract`/`acceptance`: `absent` with explanatory notes.
23
23
  - Route remediation by the absent tiers, honoring the assertion-placement rule: wire-shape and status-code gaps become **contract** tests, user-visible journey gaps become **acceptance** scenarios — never push those into unit tests or `.feature` files incorrectly.
24
24
  - Treat `absent` as a coverage gap to surface, not an automatic failure: some surfaces legitimately need only one tier (a pure formatter needs no acceptance scenario). Use the notes to justify, not to mandate, the missing tier.
25
- - This skill is read + classify only: it does not author tests, mutate tickets, or run the suite. Hand the verdict to `core/test-driven-development` to actually write the missing tier.
25
+ - This skill is read + classify only: it does not author tests, mutate tickets, or run the suite. Hand the verdict to the TDD cycle in `.agents/rules/testing-standards.md` to actually write the missing tier.
26
26
 
27
27
  ## Role
28
28
 
@@ -45,9 +45,9 @@ missing so remediation is aimed correctly.
45
45
  - During a test-pyramid audit, to roll up many surfaces into a tier-by-tier
46
46
  gap report.
47
47
 
48
- **When NOT to use:** for authoring tests (use
49
- [`core/test-driven-development`](../test-driven-development/SKILL.md)), for
50
- measuring line/branch coverage percentages (that is the unit-tier coverage
48
+ **When NOT to use:** for authoring tests (use the TDD cycle in
49
+ [`.agents/rules/testing-standards.md`](../../../rules/testing-standards.md#applying-the-standards)),
50
+ for measuring line/branch coverage percentages (that is the unit-tier coverage
51
51
  config, not this skill), or for anything that requires running the suite.
52
52
 
53
53
  ## The verdict shape
@@ -79,9 +79,9 @@ config, not this skill), or for anything that requires running the suite.
79
79
  explicit `tier` field when you already know it.
80
80
  3. **Read the gaps.** Every `absent` tier is a candidate gap. Apply judgment
81
81
  from the Policy Capsule: not every surface needs all three tiers.
82
- 4. **Route remediation.** For real gaps, hand off to
83
- `core/test-driven-development` with the missing tier named, honoring the
84
- assertion-placement rule so each assertion lands in its correct tier.
82
+ 4. **Route remediation.** For real gaps, hand off to the TDD cycle in
83
+ `.agents/rules/testing-standards.md` with the missing tier named, honoring
84
+ the assertion-placement rule so each assertion lands in its correct tier.
85
85
 
86
86
  ## Example
87
87
 
@@ -1,189 +1,45 @@
1
1
  ---
2
2
  name: scope-triage
3
3
  description:
4
- Judge whether a piece of planned work is epic-sized or story-sized before the
5
- planning ceremony is paid for. Emits one of three verdicts
6
- `epic` | `story` | `borderline` over any planning artifact (a one-pager, an
7
- Epic body, or a Story draft). Use from `/plan` Phase 1.5 and any other
8
- planning gate that needs the canonical story-vs-epic rubric.
4
+ Optional split-advisory for `/plan`. Under v2 there is no epic|story routing
5
+ verdict `/plan` always authors Stories. Use this skill only when judging
6
+ whether a draft should stay one Story or legitimately split (near-zero
7
+ overlap or an architectural seam).
9
8
  ---
10
9
 
11
- # scope-triage
10
+ # scope-triage (split advisory)
12
11
 
13
12
  ## Policy Capsule
14
13
 
15
- - Produce exactly one verdict — `epic` | `story` | `borderline` for the
16
- artifact under judgment. Never auto-route on the verdict; the verdict is
17
- **advisory**, and the operator always decides what to do with it.
18
- - Anchor every sizing judgment to the existing sizing SSOT **by reference**:
19
- `DELIVERABLE_GRANULARITY_GUIDANCE` and `DEFAULT_TASK_SIZING` in
14
+ - There is **no** `epic | story | borderline` routing verdict in v2. `/plan`
15
+ is a single path that emits **one Story by default**.
16
+ - This skill is an optional **split advisory**: should the author keep one
17
+ Story, or does the seed clear the default-single split policy?
18
+ - Anchor sizing judgment to `DEFAULT_MODEL_CAPACITY` and
19
+ `DELIVERABLE_GRANULARITY_GUIDANCE` in
20
20
  [`ticket-validator-sizing.js`](../../../scripts/lib/orchestration/ticket-validator-sizing.js).
21
- **Do not restate the numeric thresholds** — read them from that module so the
22
- rubric cannot drift from the validator that enforces them.
23
- - The verdict is **host-LLM judgment**, not a deterministic score. There is no
24
- `--flag`, no scorer, no schema, and no label transition behind this skill —
25
- it is read-on-demand library content, evaluated with judgment per
26
- [`.agents/instructions.md` § 1.B](../../../instructions.md).
27
- - Lead with **cohesion**, the same primary heuristic the sizing SSOT leads
28
- with: one Story is *one coherent change with one reason to exist*. The file /
29
- acceptance ceilings are the backstop, not the first cut.
30
- - Bias toward `epic` only when the work genuinely spans multiple independent
31
- capabilities, crosses subsystems, or carries a real dependency graph. Being
32
- wrong in the `epic` direction is cheap — the Phase 8.3 consolidation pass and
33
- the sizing validator catch an over-planned Story later. Being wrong in the
34
- `story` direction is expensive — a story-sized scope pushed through the full
35
- Epic ceremony pays a sectioned-Epic-body (Tech Spec + Acceptance Table) +
36
- Story backlog +
37
- `epic/<id>` integration-branch tax for a degenerate one-Story output.
38
- - Keep the rubric prose **artifact-agnostic**. The thing under judgment may be a
39
- sharpened one-pager, an existing Epic body, or a draft Story — the rubric
40
- reads the same against all three so every consumer reuses it verbatim.
21
+ Do not restate numeric thresholds.
22
+ - Lead with **cohesion**: one Story is one coherent change with one reason
23
+ to exist. Coupled work stays one Story and uses `## Slicing` for
24
+ intra-session checkpoints.
41
25
 
42
- ## Verdicts
26
+ ## Split policy (when N>1 is allowed)
43
27
 
44
- The skill emits exactly one of three verdicts.
28
+ Split into sibling Stories **only** when:
45
29
 
46
- ### `story`
30
+ 1. **Near-zero overlap** — genuinely independent capabilities that happen to
31
+ share a seed idea, or
32
+ 2. **Architectural seam** — different deployables, or a migration vs the
33
+ feature that consumes it.
47
34
 
48
- The work is a single shippable capability. Signals:
35
+ Otherwise keep one Story. Persist refuses coupled splits via
36
+ `assertAcceptancePartition` (identical AC text across Stories).
49
37
 
50
- - **One capability, one reason to exist.** The artifact describes one coherent
51
- change a reviewer would accept as a single PR — the
52
- `DELIVERABLE_GRANULARITY_GUIDANCE.definition` notion of a Story.
53
- - **Acceptance fits one Story.** The acceptance-criteria list reads as the
54
- binding contract of one coherent capability rather than spanning many
55
- independent outcomes. Acceptance mass is advisory-only (the
56
- `softAcceptanceCount` nudge in `DEFAULT_TASK_SIZING` — there is no hard
57
- ceiling), so the question is cohesion, not count.
58
- - **Footprint fits Story sizing.** The plausible file footprint fits the Story
59
- width described by `DEFAULT_TASK_SIZING` (the `softFiles` / `hardFiles`
60
- knobs); a legitimately broad-but-cohesive change would declare `wide` rather
61
- than being two Stories.
62
- - **No novel architecture, no high-risk trigger.** The work introduces no novel
63
- architectural decision and matches none of the `planning.riskHeuristics` in
64
- `.agentrc.json` (destructive/irreversible changes, shared auth/security,
65
- CI/CD gate changes, monorepo-wide rewrites, destructive migrations).
66
- - **Decomposition would degenerate.** Running it through `/plan` would
67
- plausibly yield exactly **one Feature with one Story** — the shape the Phase
68
- 8.3 consolidation skill flags only after all the spec authoring is already
69
- sunk cost.
38
+ ## Advisory output
70
39
 
71
- ### `epic`
40
+ Emit one of:
72
41
 
73
- The work is genuinely Epic-sized. Signals (any one is sufficient):
42
+ - `keep-single` default; fold complexity into `## Spec` / `## Slicing`
43
+ - `split` — list the proposed Stories and the seam/overlap rationale
74
44
 
75
- - **Multiple independent capabilities.** The artifact bundles two or more
76
- capabilities that each stand alone as a unit of work.
77
- - **Cross-subsystem blast radius.** The change reaches across subsystems that
78
- do not share one cohesive reason to exist.
79
- - **A real dependency graph.** The work has internal ordering — slices that
80
- must land before others — rather than one atomic change.
81
-
82
- ### `borderline`
83
-
84
- The work is genuinely on the line — it could reasonably be one ambitious Story
85
- or a small Epic, and neither call is clearly right. **Present the choice rather
86
- than deciding for the operator.** Do not force a verdict to avoid the third
87
- option; a borderline scope surfaced as borderline is the correct output.
88
-
89
- ## Change-Request Triage Rubric
90
-
91
- A **change request** — "fix this", "tweak that", "extend the existing X" —
92
- is the common case this rubric routes cheaply: a delta against a surface the
93
- project already shipped, not a from-scratch capability. Route it to `story`
94
- by default when all three delta signals hold; treat any one signal's absence
95
- as a prompt to re-check, not an automatic `epic` bump.
96
-
97
- ### Delta signals
98
-
99
- - **Delta to an already-delivered surface.** The request references a
100
- concrete existing capability (a module, workflow, script, or shipped
101
- feature) rather than proposing a new one. "Fix the flaky retry in
102
- `evidence-gate.js`" is a delta; "add a retry framework" is not.
103
- - **Existing corpus covers the touched area.** The project's docs digest
104
- and/or an already-closed or in-flight Epic's Tech Spec section already
105
- describe the surface being changed — the standalone-Story path can draft
106
- against that inherited context (`corpusContext` in the `/plan --idea`
107
- envelope) instead of re-deriving architecture from a blank slate. When no
108
- corpus hit exists for the touched area, that is a signal the request may
109
- be reaching into genuinely new territory — re-check the `epic` signals
110
- below before defaulting to `story`.
111
- - **Footprint fits Story sizing.** The plausible file footprint and
112
- acceptance-criteria count still fit the Story width in
113
- `DEFAULT_TASK_SIZING` (per the `story` verdict signals above) — a change
114
- request that fans out across independent subsystems is sized like an Epic
115
- regardless of how small the originating request sounded.
116
-
117
- ### Story-verdict rationale template
118
-
119
- Use this template to record the verdict — it names which delta signal
120
- carried the call, so a reviewer can sanity-check the routing decision without
121
- re-deriving it:
122
-
123
- ```text
124
- Verdict: story
125
- Delta: <the existing surface this change targets>
126
- Corpus hit: <docs digest section / Epic # and Tech Spec excerpt that covers
127
- this area, or "none — re-checked epic signals, still story-sized">
128
- Footprint: <rough file/AC count vs DEFAULT_TASK_SIZING>
129
- ```
130
-
131
- ### Worked example
132
-
133
- > Request: "The `/plan` standalone-Story path always drafts from a blank
134
- > slate even when a change request is a small delta against something we
135
- > already shipped — thread the existing docs digest and matching Epic
136
- > Tech Spec sections into the draft context."
137
- >
138
- > ```text
139
- > Verdict: story
140
- > Delta: story-plan.js's --emit-context envelope and the plan-story.md
141
- > Phase 2 drafting instructions — both already exist and ship today.
142
- > Corpus hit: Epic #4429's own Tech Spec section (this rubric's parent
143
- > Epic) already describes the docs-digest reuse pattern from
144
- > orchestration/docs-digest.js.
145
- > Footprint: one new lib module (planning-corpus.js), one envelope field,
146
- > one helper-doc instruction — comfortably inside DEFAULT_TASK_SIZING's
147
- > softFiles/softAcceptanceCount band.
148
- > ```
149
-
150
- ## Handoff & no-re-triage rule
151
-
152
- A workflow entered via a scope-triage **handoff** MUST NOT re-triage. A handoff
153
- *is* a triage decision already made — re-running this gate on the receiving side
154
- would re-litigate a settled call and risk a ping-pong between two planning
155
- workflows. Handoff invocations identify themselves as such (e.g. `/plan`
156
- entered via a `/plan` scope-triage escalation, or `/plan` entered
157
- via an `/plan` Phase 1.5 handoff), and the receiving workflow skips its own
158
- scope-triage gate when it detects the handoff marker.
159
-
160
- ## When to use
161
-
162
- - **`/plan` Phase 1.5** (ideation path only) — judge the sharpened
163
- one-pager Phase 1 produced before the Epic ceremony is paid for. The verdict
164
- folds into the existing Phase 1 HITL stop; on a `story` / `borderline`
165
- verdict the operator may hand off to
166
- [`/plan --from-notes`](../../../workflows/helpers/plan-story.md).
167
- - Any other planning gate that needs the canonical story-vs-epic rubric. Keep
168
- the rubric here as the SSOT; consumers reference this file rather than
169
- forking the prose.
170
-
171
- ## Output
172
-
173
- A single verdict (`epic` | `story` | `borderline`) plus a one-paragraph
174
- rationale grounded in the signals above. The rationale names the deciding
175
- signal (cohesion, capability count, blast radius, dependency graph, or sizing
176
- fit) so the operator can sanity-check the call before acting on it.
177
-
178
- ## Anti-patterns to avoid
179
-
180
- - **Restating the sizing numbers.** Reference `DEFAULT_TASK_SIZING` /
181
- `DELIVERABLE_GRANULARITY_GUIDANCE`; never copy the thresholds into this file
182
- (they would drift from the validator).
183
- - **Auto-routing on the verdict.** The verdict is advisory; the operator
184
- decides. Never silently fork a workflow on a `story` verdict.
185
- - **Forcing a binary call.** When the work is genuinely on the line, emit
186
- `borderline` and present the choice. Do not collapse it to `epic` or `story`
187
- to look decisive.
188
- - **Re-triaging after a handoff.** A handoff is a settled decision. Skip the
189
- gate when the invocation identifies itself as a scope-triage handoff.
45
+ Never auto-route. The operator (or `--yes` default = `keep-single`) decides.