mandrel 2.31.0 → 2.32.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 (250) hide show
  1. package/.agents/README.md +13 -17
  2. package/.agents/agents/acceptance-critic.md +1 -2
  3. package/.agents/docs/SDLC.md +4 -4
  4. package/.agents/docs/agentrc-reference.json +61 -57
  5. package/.agents/docs/configuration.md +274 -227
  6. package/.agents/docs/execution-reference.md +13 -14
  7. package/.agents/docs/quality-gates.md +195 -23
  8. package/.agents/instructions.md +2 -5
  9. package/.agents/rules/git-conventions-reference.md +27 -27
  10. package/.agents/rules/git-conventions.md +4 -2
  11. package/.agents/rules/known-tooling-behavior.md +66 -30
  12. package/.agents/rules/testing-standards.md +35 -71
  13. package/.agents/runtime-deps.json +0 -1
  14. package/.agents/schemas/agentrc.schema.json +1939 -1400
  15. package/.agents/schemas/lifecycle/README.md +21 -14
  16. package/.agents/schemas/lifecycle/ledger-record.schema.json +76 -22
  17. package/.agents/schemas/story-deliver-terminal.schema.json +2 -2
  18. package/.agents/scripts/README.md +7 -29
  19. package/.agents/scripts/apply-quality-bootstrap.js +27 -34
  20. package/.agents/scripts/bootstrap.js +28 -26
  21. package/.agents/scripts/check-baseline-drift.js +73 -13
  22. package/.agents/scripts/check-baseline-scope.js +362 -0
  23. package/.agents/scripts/check-dead-exports.js +9 -1
  24. package/.agents/scripts/check-gherkin-corpus.js +508 -0
  25. package/.agents/scripts/check-knip-entries.js +136 -0
  26. package/.agents/scripts/check-lifecycle-lint.js +36 -112
  27. package/.agents/scripts/check-schema-references.js +1 -1
  28. package/.agents/scripts/diagnose-friction.js +7 -4
  29. package/.agents/scripts/generate-config-docs.js +263 -171
  30. package/.agents/scripts/install-matrix-assert.js +0 -1
  31. package/.agents/scripts/lib/ITicketingProvider.js +0 -58
  32. package/.agents/scripts/lib/audit-baselines/staleness.js +6 -6
  33. package/.agents/scripts/lib/audit-baselines/trend.js +7 -8
  34. package/.agents/scripts/lib/audit-baselines/weights.js +4 -5
  35. package/.agents/scripts/lib/audit-suite/checklist-threading.js +1 -1
  36. package/.agents/scripts/lib/audit-to-stories/build-story-body.js +0 -1
  37. package/.agents/scripts/lib/baselines/envelope.js +41 -60
  38. package/.agents/scripts/lib/baselines/git-base.js +30 -37
  39. package/.agents/scripts/lib/baselines/kinds/_crap-new-method-gate.js +103 -0
  40. package/.agents/scripts/lib/baselines/kinds/_crap-read.js +150 -0
  41. package/.agents/scripts/lib/baselines/kinds/crap.js +25 -65
  42. package/.agents/scripts/lib/baselines/orphan-pruner.js +233 -0
  43. package/.agents/scripts/lib/baselines/refresh-service.js +6 -8
  44. package/.agents/scripts/lib/baselines/scope-assert.js +223 -0
  45. package/.agents/scripts/lib/baselines/scope-inventory.js +314 -0
  46. package/.agents/scripts/lib/bdd-step-index.js +326 -0
  47. package/.agents/scripts/lib/bootstrap/install-ledger.js +5 -3
  48. package/.agents/scripts/lib/bootstrap/issue-forms-template.js +4 -6
  49. package/.agents/scripts/lib/bootstrap/manifest.js +17 -40
  50. package/.agents/scripts/lib/bootstrap/project-bootstrap.js +12 -59
  51. package/.agents/scripts/lib/bootstrap/quality-bootstrap.js +62 -2
  52. package/.agents/scripts/lib/checks/loop-health.js +9 -37
  53. package/.agents/scripts/lib/child-exec.js +193 -0
  54. package/.agents/scripts/lib/cli/standard-args.js +1 -1
  55. package/.agents/scripts/lib/cli-args.js +64 -0
  56. package/.agents/scripts/lib/close-validation/gates.js +2 -2
  57. package/.agents/scripts/lib/close-validation/runner.js +3 -3
  58. package/.agents/scripts/lib/config/acceptance-eval.js +5 -52
  59. package/.agents/scripts/lib/config/commands.js +3 -5
  60. package/.agents/scripts/lib/config/explain.js +5 -7
  61. package/.agents/scripts/lib/config/gates/bundle-size.schema.js +32 -6
  62. package/.agents/scripts/lib/config/gates/coverage.schema.js +25 -5
  63. package/.agents/scripts/lib/config/gates/crap-incremental-coverage.schema.js +12 -2
  64. package/.agents/scripts/lib/config/gates/crap.schema.js +68 -23
  65. package/.agents/scripts/lib/config/gates/duplication.schema.js +29 -17
  66. package/.agents/scripts/lib/config/gates/index.js +5 -2
  67. package/.agents/scripts/lib/config/gates/lighthouse.schema.js +34 -6
  68. package/.agents/scripts/lib/config/gates/lint.schema.js +11 -2
  69. package/.agents/scripts/lib/config/gates/maintainability.schema.js +37 -15
  70. package/.agents/scripts/lib/config/gates/mutation.schema.js +15 -3
  71. package/.agents/scripts/lib/config/gates/shared.js +58 -9
  72. package/.agents/scripts/lib/config/github.js +0 -1
  73. package/.agents/scripts/lib/config/limits.js +3 -48
  74. package/.agents/scripts/lib/config/qa.js +105 -0
  75. package/.agents/scripts/lib/config/temp-paths.js +6 -5
  76. package/.agents/scripts/lib/config-settings-schema-delivery.js +237 -56
  77. package/.agents/scripts/lib/config-settings-schema-quality.js +209 -29
  78. package/.agents/scripts/lib/config-settings-schema.js +386 -39
  79. package/.agents/scripts/lib/crap-baseline-join.js +126 -9
  80. package/.agents/scripts/lib/crap-utils.js +84 -520
  81. package/.agents/scripts/lib/dead-exports-knip.js +79 -10
  82. package/.agents/scripts/lib/degraded-mode.js +2 -2
  83. package/.agents/scripts/lib/doc-tiers.js +3 -3
  84. package/.agents/scripts/lib/feedback-loop/graduator-core.js +46 -104
  85. package/.agents/scripts/lib/feedback-loop/retro-proposals-graduator.js +10 -8
  86. package/.agents/scripts/lib/fs-walk.js +52 -0
  87. package/.agents/scripts/lib/git-branch-lifecycle.js +2 -2
  88. package/.agents/scripts/lib/git-utils.js +16 -36
  89. package/.agents/scripts/lib/knip-entry-sync.js +469 -0
  90. package/.agents/scripts/lib/observability/metrics-ledger.js +1 -1
  91. package/.agents/scripts/lib/observability/runtime-friction.js +10 -0
  92. package/.agents/scripts/lib/observability/signal-validator.js +5 -85
  93. package/.agents/scripts/lib/observability/signals-writer.js +19 -62
  94. package/.agents/scripts/lib/observability/source-classifier.js +5 -7
  95. package/.agents/scripts/lib/observability/terse-result.js +3 -3
  96. package/.agents/scripts/lib/orchestration/behind-recovery.js +114 -0
  97. package/.agents/scripts/lib/orchestration/ceremony-routing.js +7 -8
  98. package/.agents/scripts/lib/orchestration/ci-rerun-guard.js +34 -33
  99. package/.agents/scripts/lib/orchestration/code-review.js +2 -2
  100. package/.agents/scripts/lib/orchestration/complexity-gate.js +43 -161
  101. package/.agents/scripts/lib/orchestration/diff-magnitude.js +4 -4
  102. package/.agents/scripts/lib/orchestration/label-transitions.js +3 -2
  103. package/.agents/scripts/lib/orchestration/lease-guard-shared.js +12 -38
  104. package/.agents/scripts/lib/orchestration/lifecycle/emit-merge-unlanded.js +5 -6
  105. package/.agents/scripts/lib/orchestration/plan-metrics.js +2 -3
  106. package/.agents/scripts/lib/orchestration/plan-persist/persist-helpers.js +6 -0
  107. package/.agents/scripts/lib/orchestration/plan-persist/story-ops.js +0 -1
  108. package/.agents/scripts/lib/orchestration/{lifecycle/listeners/watcher.js → pr-watch.js} +58 -208
  109. package/.agents/scripts/lib/orchestration/resolve-stories.js +5 -15
  110. package/.agents/scripts/lib/orchestration/review-providers/codex.js +1 -1
  111. package/.agents/scripts/lib/orchestration/review-providers/mi-exemptions.js +130 -0
  112. package/.agents/scripts/lib/orchestration/review-providers/native.js +30 -16
  113. package/.agents/scripts/lib/orchestration/single-story-close/phases/code-review.js +1 -1
  114. package/.agents/scripts/lib/orchestration/single-story-close/phases/confirm-merge.js +37 -26
  115. package/.agents/scripts/lib/orchestration/single-story-close/phases/conventional-subject.js +376 -0
  116. package/.agents/scripts/lib/orchestration/single-story-close/phases/normalize-pr-title.js +161 -151
  117. package/.agents/scripts/lib/orchestration/single-story-close/phases/options.js +15 -3
  118. package/.agents/scripts/lib/orchestration/single-story-close/phases/pull-request.js +10 -15
  119. package/.agents/scripts/lib/orchestration/single-story-close/phases/review-block.js +5 -0
  120. package/.agents/scripts/lib/orchestration/single-story-close/phases/review-override.js +157 -0
  121. package/.agents/scripts/lib/orchestration/single-story-close/phases/worktree-reap.js +0 -14
  122. package/.agents/scripts/lib/orchestration/single-story-close/runner.js +59 -25
  123. package/.agents/scripts/lib/orchestration/single-story-lease-guard.js +20 -31
  124. package/.agents/scripts/lib/orchestration/spec-spill.js +17 -3
  125. package/.agents/scripts/lib/orchestration/story-close/phases/review-core.js +7 -6
  126. package/.agents/scripts/lib/orchestration/story-deliver-terminal.js +2 -1
  127. package/.agents/scripts/lib/orchestration/task-body-validator.js +4 -1
  128. package/.agents/scripts/lib/orchestration/ticket-lease.js +28 -127
  129. package/.agents/scripts/lib/orchestration/ticket-validator-sizing.js +1 -1
  130. package/.agents/scripts/lib/orchestration/ticketing/reads.js +5 -5
  131. package/.agents/scripts/lib/orchestration/ticketing/transition.js +5 -4
  132. package/.agents/scripts/lib/orchestration/verify-tier-repair.js +107 -0
  133. package/.agents/scripts/lib/qa/coverage-verdict.js +5 -87
  134. package/.agents/scripts/lib/signals/detectors/common.js +1 -1
  135. package/.agents/scripts/lib/signals/index.js +8 -6
  136. package/.agents/scripts/lib/signals/schema.js +20 -25
  137. package/.agents/scripts/lib/signals/write.js +8 -8
  138. package/.agents/scripts/lib/story-body/story-body.js +12 -59
  139. package/.agents/scripts/lib/temp-retention.js +1 -1
  140. package/.agents/scripts/lib/templates/decomposer-prompts.js +16 -14
  141. package/.agents/scripts/lib/ticket-body-sections.js +4 -5
  142. package/.agents/scripts/lib/worktree/lifecycle/merge-reachability.js +13 -45
  143. package/.agents/scripts/lib/worktree/lifecycle/reap.js +4 -5
  144. package/.agents/scripts/lib/worktree-manager.js +2 -3
  145. package/.agents/scripts/lint-label-vocabulary.js +2 -24
  146. package/.agents/scripts/pr-watch-with-update.js +7 -5
  147. package/.agents/scripts/providers/github/cache.js +2 -2
  148. package/.agents/scripts/providers/github/comments.js +6 -28
  149. package/.agents/scripts/providers/github/compose.js +0 -15
  150. package/.agents/scripts/providers/github/errors.js +10 -27
  151. package/.agents/scripts/providers/github/request-helpers.js +1 -2
  152. package/.agents/scripts/providers/github/sub-issues.js +10 -218
  153. package/.agents/scripts/providers/github.js +4 -7
  154. package/.agents/scripts/prune-baseline-orphans.js +181 -0
  155. package/.agents/scripts/resolve-stories.js +0 -2
  156. package/.agents/scripts/run-lint.js +61 -61
  157. package/.agents/scripts/run-test-profile.js +6 -6
  158. package/.agents/scripts/run-verify.js +48 -30
  159. package/.agents/scripts/single-story-close.js +20 -0
  160. package/.agents/scripts/single-story-init.js +12 -35
  161. package/.agents/scripts/update-dead-exports-baseline.js +321 -0
  162. package/.agents/skills/core/gates-and-baselines/SKILL.md +2 -2
  163. package/.agents/skills/skills.index.json +1 -11
  164. package/.agents/workflows/audit-documentation.md +5 -6
  165. package/.agents/workflows/audit-to-stories.md +2 -2
  166. package/.agents/workflows/helpers/audit-lens-core.md +11 -12
  167. package/.agents/workflows/helpers/code-quality-guardrails.md +15 -14
  168. package/.agents/workflows/helpers/code-review.md +3 -8
  169. package/.agents/workflows/helpers/deliver-reference.md +2 -1
  170. package/.agents/workflows/helpers/deliver-story-reference.md +27 -16
  171. package/.agents/workflows/helpers/worktree-lifecycle.md +1 -2
  172. package/.agents/workflows/mandrel-update.md +10 -10
  173. package/.agents/workflows/qa-assist.md +15 -20
  174. package/.agents/workflows/qa-explore.md +9 -8
  175. package/README.md +1 -1
  176. package/docs/CHANGELOG.md +42 -0
  177. package/lib/migrations/index.js +2 -0
  178. package/lib/migrations/steps/2.32.0-retire-lint-baseline-command.js +127 -0
  179. package/package.json +12 -3
  180. package/.agents/schemas/lifecycle/checkpoint.written.schema.json +0 -13
  181. package/.agents/schemas/lifecycle/close-validate.end.schema.json +0 -18
  182. package/.agents/schemas/lifecycle/close-validate.start.schema.json +0 -13
  183. package/.agents/schemas/lifecycle/code-review.end.schema.json +0 -30
  184. package/.agents/schemas/lifecycle/code-review.start.schema.json +0 -12
  185. package/.agents/schemas/lifecycle/intervention.recorded.schema.json +0 -15
  186. package/.agents/schemas/lifecycle/loop.tick.schema.json +0 -20
  187. package/.agents/schemas/lifecycle/notification.emitted.schema.json +0 -18
  188. package/.agents/schemas/lifecycle/pr.created.schema.json +0 -14
  189. package/.agents/schemas/lifecycle/retro.end.schema.json +0 -16
  190. package/.agents/schemas/lifecycle/retro.start.schema.json +0 -12
  191. package/.agents/schemas/lifecycle/story.blocked.schema.json +0 -13
  192. package/.agents/schemas/lifecycle/story.dispatch.end.schema.json +0 -17
  193. package/.agents/schemas/lifecycle/story.dispatch.start.schema.json +0 -15
  194. package/.agents/schemas/lifecycle/story.merged.schema.json +0 -13
  195. package/.agents/scripts/check-gherkin-placeholders.js +0 -663
  196. package/.agents/scripts/check-lifecycle-doc-drift.js +0 -411
  197. package/.agents/scripts/lib/audit-suite/cli.js +0 -64
  198. package/.agents/scripts/lib/bootstrap/baselines-layout-migration.js +0 -202
  199. package/.agents/scripts/lib/bootstrap/ci-workflow-template.js +0 -212
  200. package/.agents/scripts/lib/checks/baseline-drift-main-checkout.js +0 -104
  201. package/.agents/scripts/lib/checks/push-hook-parity.js +0 -106
  202. package/.agents/scripts/lib/checks/windows-coverage-noise-floor.js +0 -92
  203. package/.agents/scripts/lib/checks/worktree-bootstrap-env.js +0 -81
  204. package/.agents/scripts/lib/checks/worktree-residue-biome.js +0 -55
  205. package/.agents/scripts/lib/crap-baseline-index.js +0 -46
  206. package/.agents/scripts/lib/crap-utils-incremental.js +0 -113
  207. package/.agents/scripts/lib/dynamic-workflow/capability.js +0 -396
  208. package/.agents/scripts/lib/feedback-loop/audit-results-graduator.js +0 -335
  209. package/.agents/scripts/lib/mutation/baseline-snapshot.js +0 -239
  210. package/.agents/scripts/lib/mutation/config-detector.js +0 -119
  211. package/.agents/scripts/lib/mutation/stryker-runner.js +0 -306
  212. package/.agents/scripts/lib/mutation/survivor-report.js +0 -160
  213. package/.agents/scripts/lib/observability/active-story-env.js +0 -170
  214. package/.agents/scripts/lib/observability/tool-trace-hook.js +0 -456
  215. package/.agents/scripts/lib/orchestration/acceptance-clusters.js +0 -111
  216. package/.agents/scripts/lib/orchestration/context-envelope.js +0 -277
  217. package/.agents/scripts/lib/orchestration/detectors-phase.js +0 -194
  218. package/.agents/scripts/lib/orchestration/lifecycle/bus.js +0 -309
  219. package/.agents/scripts/lib/orchestration/lifecycle/emit-loop-tick.js +0 -181
  220. package/.agents/scripts/lib/orchestration/lifecycle/ledger-writer.js +0 -229
  221. package/.agents/scripts/lib/orchestration/lifecycle/listeners/README.md +0 -54
  222. package/.agents/scripts/lib/orchestration/lifecycle/trace-logger.js +0 -344
  223. package/.agents/scripts/lib/orchestration/lint-baseline-service.js +0 -114
  224. package/.agents/scripts/lib/orchestration/pr-base-guard.js +0 -37
  225. package/.agents/scripts/lib/orchestration/resolves-token.js +0 -127
  226. package/.agents/scripts/lib/orchestration/spec-section-validator.js +0 -130
  227. package/.agents/scripts/lib/orchestration/story-close/emit-blocked.js +0 -55
  228. package/.agents/scripts/lib/orchestration/story-close/phases/code-review.js +0 -211
  229. package/.agents/scripts/lib/planning-corpus.js +0 -37
  230. package/.agents/scripts/lib/qa/coverage-report.js +0 -181
  231. package/.agents/scripts/lib/qa/propose-missing-test.js +0 -95
  232. package/.agents/scripts/lib/qa/qa-context-hydrator.js +0 -217
  233. package/.agents/scripts/lib/signals/detectors/index.js +0 -14
  234. package/.agents/scripts/lib/signals/detectors/retry.js +0 -253
  235. package/.agents/scripts/lib/signals/detectors/rework.js +0 -167
  236. package/.agents/scripts/lib/signals/read.js +0 -268
  237. package/.agents/scripts/lib/signals/span-tree.js +0 -291
  238. package/.agents/scripts/lib/story-lifecycle.js +0 -194
  239. package/.agents/scripts/lib/story-plan.js +0 -379
  240. package/.agents/scripts/lib/util/phase-timer-state.js +0 -72
  241. package/.agents/scripts/lib/util/phase-timer.js +0 -163
  242. package/.agents/scripts/lib/workers/combined-mi-crap-worker.js +0 -169
  243. package/.agents/scripts/lint-baseline.js +0 -507
  244. package/.agents/scripts/providers/github/prs.js +0 -103
  245. package/.agents/scripts/signals-view.js +0 -309
  246. package/.agents/scripts/story-plan.js +0 -370
  247. package/.agents/scripts/sync-branch-from-base.js +0 -149
  248. package/.agents/scripts/validate-docs-freshness.js +0 -314
  249. package/.agents/skills/core/diagnose-friction/SKILL.md +0 -78
  250. package/.agents/workflows/helpers/signals.md +0 -112
@@ -8,6 +8,12 @@
8
8
  // byte-for-byte equivalent in effect).
9
9
  // ---------------------------------------------------------------------------
10
10
 
11
+ import { ACCEPTANCE_EVAL_DEFAULTS } from './config/acceptance-eval.js';
12
+ import { CI_DELIVERY_DEFAULTS } from './config/ci.js';
13
+ import { DELIVERY_ROUTING_DEFAULTS } from './config/delivery-routing.js';
14
+ import { LIMITS_DEFAULTS } from './config/limits.js';
15
+ import { DEFAULT_CODE_REVIEW } from './config/runners.js';
16
+ import { WORKTREE_ISOLATION_DEFAULTS } from './config/worktree-isolation.js';
11
17
  import { SHELL_INJECTION_PATTERN_STRING } from './config-schema-shared.js';
12
18
  // `delivery.quality` and `delivery.codeReview` sub-schemas live in a
13
19
  // further-split module (refs #3457) so each schema file stays above the
@@ -24,34 +30,30 @@ const SAFE_STRING = {
24
30
 
25
31
  const EXECUTION_SCHEMA = {
26
32
  type: 'object',
33
+ description: 'Wall-clock bounds on the subprocesses delivery spawns.',
27
34
  properties: {
28
- timeoutMs: { type: 'integer', minimum: 1 },
29
- },
30
- additionalProperties: false,
31
- };
32
-
33
- /**
34
- * `delivery.lease` — assignee-as-lease primitive (Story #3480). `ttlMs` is
35
- * the staleness window: a ticket claim whose owner's last heartbeat is older
36
- * than this many milliseconds is reclaimable by another operator. Defaults to
37
- * 900000 (15 min) in `lib/config/limits.js`. Note the shipped guards fail
38
- * closed (no live heartbeat source since A22 removed the inert emitter), so
39
- * a stranded claim is cleared with `--steal` rather than by TTL expiry.
40
- */
41
- const LEASE_SCHEMA = {
42
- type: 'object',
43
- properties: {
44
- ttlMs: { type: 'integer', minimum: 1 },
35
+ timeoutMs: {
36
+ type: 'integer',
37
+ minimum: 1,
38
+ description:
39
+ 'Per-command timeout (ms) for the long-running spawns delivery drives — the close-validation chain and the gate CLIs.',
40
+ default: LIMITS_DEFAULTS.executionTimeoutMs,
41
+ },
45
42
  },
46
43
  additionalProperties: false,
47
44
  };
48
45
 
49
46
  const DOCS_FRESHNESS_SCHEMA = {
50
47
  type: 'object',
48
+ description:
49
+ 'Documentation-freshness scope: the files a change of consequence is expected to touch. Read by the audit-documentation lens to seed its target set; no delivery gate enforces it.',
51
50
  properties: {
52
51
  paths: {
53
52
  type: 'array',
54
53
  items: { ...SAFE_STRING, minLength: 1 },
54
+ description:
55
+ 'Repo-relative documentation paths the audit-documentation lens adds to its target set.',
56
+ default: ['README.md'],
55
57
  },
56
58
  },
57
59
  additionalProperties: false,
@@ -64,8 +66,17 @@ const DOCS_FRESHNESS_SCHEMA = {
64
66
  */
65
67
  const DELIVER_RUNNER_SCHEMA = {
66
68
  type: 'object',
69
+ description: 'Bounded-concurrency knob for the /deliver fan-out.',
67
70
  properties: {
68
- concurrencyCap: { type: 'integer', minimum: 1 },
71
+ concurrencyCap: {
72
+ type: 'integer',
73
+ minimum: 1,
74
+ description:
75
+ '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.',
76
+ // getRunners() resolves this inline rather than from an exported
77
+ // constant; the rewritten parity suite asserts the two agree.
78
+ default: 3,
79
+ },
69
80
  },
70
81
  additionalProperties: false,
71
82
  };
@@ -75,25 +86,57 @@ const DELIVER_RUNNER_SCHEMA = {
75
86
  */
76
87
  const WORKTREE_ISOLATION_SCHEMA = {
77
88
  type: 'object',
89
+ description:
90
+ 'Per-Story git worktree provisioning. Each Story is implemented in its own checkout so concurrent siblings never share a working tree.',
78
91
  properties: {
79
- enabled: { type: 'boolean' },
80
- root: { type: 'string', minLength: 1 },
92
+ enabled: {
93
+ type: 'boolean',
94
+ description:
95
+ 'When true, `single-story-init.js` materializes a worktree per Story. False implements every Story in the main checkout, which is only safe for strictly serial delivery.',
96
+ default: WORKTREE_ISOLATION_DEFAULTS.enabled,
97
+ },
98
+ root: {
99
+ type: 'string',
100
+ minLength: 1,
101
+ description:
102
+ 'Repo-relative directory the per-Story worktrees are created under. Required whenever `enabled` is explicitly true.',
103
+ default: WORKTREE_ISOLATION_DEFAULTS.root,
104
+ },
81
105
  nodeModulesStrategy: {
82
106
  type: 'string',
83
107
  enum: ['per-worktree', 'clone', 'symlink', 'pnpm-store'],
108
+ description:
109
+ 'How each worktree gets its dependencies. `clone` copy-on-writes the main checkout tree (fast, cross-platform); `per-worktree` runs a full install; `symlink` links the shared tree (POSIX only unless `allowSymlinkOnWindows`); `pnpm-store` re-links from the pnpm content store.',
110
+ // Pinned to the cross-platform documented default. The runtime constant
111
+ // is evaluated at import time and resolves to `per-worktree` on win32,
112
+ // so it must not be imported here.
113
+ default: 'clone',
114
+ },
115
+ primeFromPath: {
116
+ type: ['string', 'null'],
117
+ minLength: 1,
118
+ description:
119
+ 'Absolute path to an existing `node_modules` tree to prime new worktrees from, instead of the main checkout. `null` uses the main checkout.',
120
+ default: WORKTREE_ISOLATION_DEFAULTS.primeFromPath,
121
+ },
122
+ allowSymlinkOnWindows: {
123
+ type: 'boolean',
124
+ description:
125
+ 'Permit the `symlink` strategy on win32, where it needs Developer Mode or elevation. Off by default so a Windows consumer fails over to a strategy that works.',
126
+ default: WORKTREE_ISOLATION_DEFAULTS.allowSymlinkOnWindows,
127
+ },
128
+ reapOnSuccess: {
129
+ type: 'boolean',
130
+ description:
131
+ "Remove the Story's worktree once its PR merges. False keeps it for post-mortem inspection.",
132
+ default: WORKTREE_ISOLATION_DEFAULTS.reapOnSuccess,
84
133
  },
85
- primeFromPath: { type: ['string', 'null'], minLength: 1 },
86
- allowSymlinkOnWindows: { type: 'boolean' },
87
- reapOnSuccess: { type: 'boolean' },
88
134
  bootstrapFiles: {
89
135
  type: 'array',
90
136
  items: { type: 'string', minLength: 1 },
91
- default: [
92
- '.env',
93
- '.mcp.json',
94
- '.agentrc.local.json',
95
- '.agents/instructions.local.md',
96
- ],
137
+ description:
138
+ 'Gitignored files copied from the main checkout into every new worktree. A worktree checks out tracked files only, so local secrets and overrides would otherwise be missing.',
139
+ default: [...WORKTREE_ISOLATION_DEFAULTS.bootstrapFiles],
97
140
  },
98
141
  },
99
142
  additionalProperties: false,
@@ -118,18 +161,34 @@ const WORKTREE_ISOLATION_SCHEMA = {
118
161
  */
119
162
  const SIGNALS_SCHEMA = {
120
163
  type: 'object',
164
+ description:
165
+ 'Detector thresholds for the surviving performance-signal categories. Each block is shallow-merged by the resolver.',
121
166
  properties: {
122
167
  rework: {
123
168
  type: 'object',
169
+ description: 'Rework detector — repeated edits to one file in a run.',
124
170
  properties: {
125
- editsPerFile: { type: 'integer', minimum: 1 },
171
+ editsPerFile: {
172
+ type: 'integer',
173
+ minimum: 1,
174
+ description:
175
+ 'Edits to a single file within one run that trip the rework signal.',
176
+ default: LIMITS_DEFAULTS.signals.rework.editsPerFile,
177
+ },
126
178
  },
127
179
  additionalProperties: false,
128
180
  },
129
181
  retry: {
130
182
  type: 'object',
183
+ description: 'Retry detector — the same command failing repeatedly.',
131
184
  properties: {
132
- repeatCount: { type: 'integer', minimum: 1 },
185
+ repeatCount: {
186
+ type: 'integer',
187
+ minimum: 1,
188
+ description:
189
+ 'Repeats of an identical failing command that trip the retry signal.',
190
+ default: LIMITS_DEFAULTS.signals.retry.repeatCount,
191
+ },
133
192
  },
134
193
  additionalProperties: false,
135
194
  },
@@ -171,12 +230,40 @@ const SIGNALS_SCHEMA = {
171
230
  */
172
231
  const MERGE_WATCH_SCHEMA = {
173
232
  type: 'object',
233
+ description:
234
+ "Knobs consumed by the close-and-land merge wait (Story #4543; defaults in `lib/orchestration/merge-poll.js`). `mode` (Story #4698) selects the close-time merge posture. `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.",
174
235
  properties: {
175
- mode: { type: 'string', enum: ['sync', 'async'] },
176
- intervalSeconds: { type: 'integer', minimum: 1 },
177
- maxWaitSeconds: { type: 'integer', minimum: 1 },
178
- maxBudgetSeconds: { type: 'integer', minimum: 1 },
179
- updateAttempts: { type: 'integer', minimum: 0 },
236
+ mode: {
237
+ type: 'string',
238
+ enum: ['sync', 'async'],
239
+ description:
240
+ 'Close-time merge-wait posture (Story #4698). `sync` (default) keeps the in-close foreground merge wait unchanged. `async` caps the per-invocation wait to a short ~60s probe window — long enough to catch an instant merge and, via the head-anchored required-check predicate, an instantly-red required check — then returns the resumable `pending` terminal (exit 3) with a `nextCommand`. Opt in when slow CI makes the foreground wait routinely expire: the worker launches `nextCommand` in the background instead of burning the host tool slot polling. `maxBudgetSeconds` (the cumulative give-up) is unchanged.',
241
+ },
242
+ intervalSeconds: {
243
+ type: 'integer',
244
+ minimum: 1,
245
+ description: 'Seconds between merge-wait polls. Default 30.',
246
+ default: 30,
247
+ },
248
+ maxWaitSeconds: {
249
+ type: 'integer',
250
+ minimum: 1,
251
+ description:
252
+ '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.',
253
+ },
254
+ maxBudgetSeconds: {
255
+ type: 'integer',
256
+ minimum: 1,
257
+ description:
258
+ "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.",
259
+ default: 3600,
260
+ },
261
+ updateAttempts: {
262
+ type: 'integer',
263
+ minimum: 0,
264
+ description:
265
+ '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.',
266
+ },
180
267
  },
181
268
  additionalProperties: false,
182
269
  };
@@ -198,14 +285,36 @@ const MERGE_WATCH_SCHEMA = {
198
285
  // acceptance clusters through a fresh critic.
199
286
  const ROUTING_SCHEMA = {
200
287
  type: 'object',
288
+ description:
289
+ 'v2 delivery-spawn routing: role-scoped boot contexts and maker-checker sampling. The v1 singleDelivery epic-route kill-switch was removed in Stage 6.',
201
290
  properties: {
202
- roleScopedAgents: { type: 'boolean' },
203
- freshCriticSampleRate: { type: 'number', minimum: 0, maximum: 1 },
291
+ roleScopedAgents: {
292
+ type: 'boolean',
293
+ description:
294
+ '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. 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.',
295
+ default: DELIVERY_ROUTING_DEFAULTS.roleScopedAgents,
296
+ },
297
+ freshCriticSampleRate: {
298
+ type: 'number',
299
+ minimum: 0,
300
+ maximum: 1,
301
+ description:
302
+ '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. Consumed by resolveCeremonyForRisk (lib/orchestration/ceremony-routing.js).',
303
+ default: DELIVERY_ROUTING_DEFAULTS.freshCriticSampleRate,
304
+ },
204
305
  ceremonyProfile: {
205
306
  type: 'string',
206
307
  enum: ['minimal', 'standard', 'strict'],
308
+ description:
309
+ '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.',
310
+ default: DELIVERY_ROUTING_DEFAULTS.ceremonyProfile,
311
+ },
312
+ closeAndLand: {
313
+ type: 'boolean',
314
+ description:
315
+ 'When true (default), single-story-close lands through merge in one close. Opt out per-run with --no-wait-merge.',
316
+ default: DELIVERY_ROUTING_DEFAULTS.closeAndLand,
207
317
  },
208
- closeAndLand: { type: 'boolean' },
209
318
  },
210
319
  additionalProperties: false,
211
320
  };
@@ -218,22 +327,60 @@ const ROUTING_SCHEMA = {
218
327
  // EMPTY required-check set before it stops waiting for one. This block is
219
328
  // `additionalProperties: false`, so the knob is inert unless it lands here AND
220
329
  // in the `.agents/schemas/agentrc.schema.json` mirror.
330
+ // The four `watch.*` defaults below mirror WATCH_DEFAULTS in
331
+ // `pr-watch-with-update.js`. Restated rather than imported: that module is a
332
+ // CLI, and importing it behind a schema declaration would drag its
333
+ // `runAsCli` wiring into every config read. The rewritten parity suite
334
+ // asserts the two agree.
221
335
  const CI_WATCH_SCHEMA = {
222
336
  type: 'object',
337
+ description:
338
+ 'Story #4356 (Epic #4355). Poll-loop tuning for the merge/CI watch. pollIntervalMs is the cadence between check probes; maxPolls caps total probes before the watcher gives up; maxResumes caps how many times the watcher may resume after a transient stall; attachWindowMs bounds the wait for a required context to attach at all.',
223
339
  properties: {
224
- pollIntervalMs: { type: 'integer', minimum: 1 },
225
- maxPolls: { type: 'integer', minimum: 1 },
226
- maxResumes: { type: 'integer', minimum: 0 },
227
- attachWindowMs: { type: 'integer', minimum: 1 },
340
+ pollIntervalMs: {
341
+ type: 'integer',
342
+ minimum: 1,
343
+ description: 'Milliseconds between check probes.',
344
+ default: 10000,
345
+ },
346
+ maxPolls: {
347
+ type: 'integer',
348
+ minimum: 1,
349
+ description:
350
+ 'Total probes before the watcher gives up on one invocation.',
351
+ default: 180,
352
+ },
353
+ maxResumes: {
354
+ type: 'integer',
355
+ minimum: 0,
356
+ description:
357
+ 'How many times the watcher may resume after a transient stall. 0 disables resuming.',
358
+ default: 3,
359
+ },
360
+ attachWindowMs: {
361
+ type: 'integer',
362
+ minimum: 1,
363
+ description:
364
+ 'Story #4890. How long (ms) the watch keeps re-resolving an EMPTY `gh pr checks --required` set before it stops waiting for a required context to attach. A ruleset attaches its contexts asynchronously and the arrival latency is set by the slowest one, so a required context that is an aggregator job gated on every other tier is the last to appear — measured at 16m52s on this repository. Default 1200000 (20 minutes). Raise it for a repository whose contexts arrive later still; exhausting the window is never reported as a red check (the watch exits 2, not-yet-started).',
365
+ default: 1200000,
366
+ },
228
367
  },
229
368
  additionalProperties: false,
230
369
  };
231
370
 
232
371
  const CI_DELIVERY_SCHEMA = {
233
372
  type: 'object',
373
+ description:
374
+ 'CI-aware delivery namespace (Story #4356, Epic #4355): the merge/CI watch poll loop and the merge posture.',
234
375
  properties: {
235
376
  watch: CI_WATCH_SCHEMA,
236
- autoMerge: { type: 'string', enum: ['trust-ci', 'strict'] },
377
+ autoMerge: {
378
+ type: 'string',
379
+ enum: ['trust-ci', 'strict'],
380
+ description:
381
+ "Story #4356 (Epic #4355). Merge posture. 'trust-ci' (default) merges once required checks pass; 'strict' additionally requires a clean review gate.",
382
+ default: CI_DELIVERY_DEFAULTS.autoMerge,
383
+ },
237
384
  },
238
385
  additionalProperties: false,
239
386
  };
@@ -249,11 +396,14 @@ const CI_DELIVERY_SCHEMA = {
249
396
  */
250
397
  const REFACTOR_STAGE_SCHEMA = {
251
398
  type: 'object',
399
+ description:
400
+ 'Opt-in, config-gated post-green refactor checkpoint wired into story-deliver (Story #3430, Epic #3418). Strictly additive and default-OFF: when disabled, story-deliver behaves exactly as before. Advisory only — never changes existing close-validation gate semantics.',
252
401
  properties: {
253
402
  enabled: {
254
403
  type: 'boolean',
255
404
  description:
256
405
  'When true, story-deliver runs an advisory post-green refactor stage (core/code-review-and-quality skill, Post-Green Refactor Pass) after the suite is green. Default false — when unset the stage is skipped and close-validation gate semantics are unchanged.',
406
+ default: false,
257
407
  },
258
408
  },
259
409
  additionalProperties: false,
@@ -277,18 +427,15 @@ const REFACTOR_STAGE_SCHEMA = {
277
427
  */
278
428
  const ACCEPTANCE_EVAL_SCHEMA = {
279
429
  type: 'object',
430
+ description:
431
+ 'Story #3819. Bounded per-Story acceptance self-eval loop. After the implementation commits land and before the Story-implementation phase flips to `closing`, an independent (fresh-context) critic pass scores the caller-injected change set against each inline `acceptance[]` item, redrafts the unmet items, and re-evaluates — capped at `maxRounds` redraft rounds, then escalates to `agent::blocked` when criteria remain unmet. There is no `enabled` flag: the loop is a hard cutover (always on).',
280
432
  properties: {
281
433
  maxRounds: {
282
434
  type: 'integer',
283
435
  minimum: 1,
284
436
  description:
285
- 'Maximum number of redraft rounds the acceptance self-eval loop runs before escalating to agent::blocked when criteria remain unmet. Default 2; clamped into [1, hard ceiling] by the resolver so the cap can never be disabled.',
286
- },
287
- clusterCeiling: {
288
- type: 'integer',
289
- minimum: 1,
290
- description:
291
- 'Epic #4475 (M4-B). Max acceptance criteria one single-delivery acceptance critic scores in a single fresh-context pass. Single delivery clusters the Epic ## Acceptance Table ACs into ceil(totalACs / clusterCeiling) groups and spawns one maker-blind critic per cluster, restoring the distributed acceptance coverage the per-Story critic fan-out gave for free. Default 4; clamped into [1, 8] by the resolver so a large value cannot collapse the fan-out to a single diluted critic. Ignored on the fan-out route.',
437
+ 'Maximum number of redraft rounds before escalation. Default 2; clamped into [1, hard ceiling] by lib/config/acceptance-eval.js so the cap can never be disabled (maxRounds: 0 clamps up to 1).',
438
+ default: ACCEPTANCE_EVAL_DEFAULTS.maxRounds,
292
439
  },
293
440
  },
294
441
  additionalProperties: false,
@@ -303,6 +450,8 @@ const ACCEPTANCE_EVAL_SCHEMA = {
303
450
  */
304
451
  const REVIEW_SCHEMA = {
305
452
  type: 'object',
453
+ description:
454
+ 'Close-scope review tuning (Story #4699). Governs the Story-scope local-lens pass that runs inside the close subprocess; the maker-blind code-review pass and all hard gates are unaffected.',
306
455
  properties: {
307
456
  lensDiffFloor: {
308
457
  type: 'integer',
@@ -337,10 +486,27 @@ const REVIEW_SCHEMA = {
337
486
  */
338
487
  const FEEDBACK_LOOP_SCHEMA = {
339
488
  type: 'object',
489
+ description:
490
+ 'Opt-out toggles for the close-time auto-file graduators. All default to auto-filing on.',
340
491
  properties: {
341
- auditResultsAutoFile: { type: 'boolean' },
342
- retroProposals: { type: 'boolean' },
343
- frictionWindowDays: { type: 'integer', minimum: 1 },
492
+ auditResultsAutoFile: {
493
+ type: 'boolean',
494
+ description:
495
+ '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.',
496
+ default: true,
497
+ },
498
+ retroProposals: {
499
+ type: 'boolean',
500
+ description:
501
+ '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.',
502
+ default: true,
503
+ },
504
+ frictionWindowDays: {
505
+ type: 'integer',
506
+ minimum: 1,
507
+ description:
508
+ "How many days back the run-scope friction recurrence window reaches (Story #4850). The window spans every surviving per-Story signal stream rather than the triggering run's own Stories, so that a defect firing once per Story can reach the actionable threshold; this bounds it by age so a defect fixed weeks ago stops re-routing. Rows older than the bound — and rows carrying no readable timestamp — are excluded and counted on the roll-up step result. Default 30.",
509
+ },
344
510
  },
345
511
  additionalProperties: false,
346
512
  };
@@ -355,12 +521,20 @@ const FEEDBACK_LOOP_SCHEMA = {
355
521
  */
356
522
  const AUDIT_TO_STORIES_SCHEMA = {
357
523
  type: 'object',
524
+ description:
525
+ 'Knobs for the `/audit-to-stories` unattended (`--auto`) sweep (Story #4626).',
358
526
  properties: {
359
527
  severityFloor: {
360
528
  type: 'string',
361
529
  enum: ['critical', 'high', 'medium', 'low', 'all'],
530
+ description:
531
+ 'Minimum severity a finding must meet to be proposed as a Story on an unattended `/audit-to-stories --auto` sweep (Story #4626). Default high.',
532
+ },
533
+ autoComment: {
534
+ type: 'boolean',
535
+ description:
536
+ 'When true (default), `/audit-to-stories --auto` posts a re-detected comment on an already-open matched Issue instead of silently skipping it.',
362
537
  },
363
- autoComment: { type: 'boolean' },
364
538
  },
365
539
  additionalProperties: false,
366
540
  };
@@ -388,6 +562,7 @@ const TEMP_RETENTION_SCHEMA = {
388
562
  "Master switch. Default true — reclaiming a landed Story's gate " +
389
563
  'transcripts and validation evidence is the behaviour, and this knob ' +
390
564
  'turns it off. When false every purge path is a reported no-op.',
565
+ default: true,
391
566
  },
392
567
  staleDays: {
393
568
  type: 'integer',
@@ -397,6 +572,7 @@ const TEMP_RETENTION_SCHEMA = {
397
572
  'recovered from — roster-level audit reports and abandoned ' +
398
573
  'plan-<slug>/ dirs. Story-keyed artifacts do not wait for it: they are ' +
399
574
  'purged as soon as their merge is confirmed.',
575
+ default: 7,
400
576
  },
401
577
  classes: {
402
578
  type: 'object',
@@ -409,22 +585,26 @@ const TEMP_RETENTION_SCHEMA = {
409
585
  description:
410
586
  '<tempRoot>/orchestration/*.log — close gate transcripts and ' +
411
587
  'terse-result detail dumps.',
588
+ default: true,
412
589
  },
413
590
  validationEvidence: {
414
591
  type: 'boolean',
415
592
  description:
416
593
  'Per-Story validation-evidence.json, lifecycle.ndjson, and ' +
417
594
  'manifest.md under the standalone and per-run story trees.',
595
+ default: true,
418
596
  },
419
597
  auditResults: {
420
598
  type: 'boolean',
421
599
  description: '<tempRoot>/audits/ — audit lens reports.',
600
+ default: true,
422
601
  },
423
602
  planDirs: {
424
603
  type: 'boolean',
425
604
  description:
426
605
  '<tempRoot>/plan-<slug>/ — abandoned plan authoring dirs. ' +
427
606
  'Age-floored only; the current run is always excluded.',
607
+ default: true,
428
608
  },
429
609
  },
430
610
  additionalProperties: false,
@@ -435,9 +615,10 @@ const TEMP_RETENTION_SCHEMA = {
435
615
 
436
616
  export const DELIVERY_SCHEMA = {
437
617
  type: 'object',
618
+ description:
619
+ 'Everything `/deliver` and `single-story-close` consume: execution timeouts, worktree isolation, runner concurrency, docs freshness, signals, quality gates, merge/CI watch, review ceremony, and the feedback loop.',
438
620
  properties: {
439
621
  execution: EXECUTION_SCHEMA,
440
- lease: LEASE_SCHEMA,
441
622
  docsFreshness: DOCS_FRESHNESS_SCHEMA,
442
623
  tempRetention: TEMP_RETENTION_SCHEMA,
443
624
  deliverRunner: DELIVER_RUNNER_SCHEMA,