mandrel 1.91.0 → 1.93.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 (112) hide show
  1. package/.agents/README.md +5 -5
  2. package/.agents/docs/SDLC.md +75 -107
  3. package/.agents/docs/configuration.md +1 -1
  4. package/.agents/docs/quality-gates.md +8 -7
  5. package/.agents/docs/workflows.md +4 -10
  6. package/.agents/instructions.md +2 -2
  7. package/.agents/schemas/agentrc.schema.json +1 -1
  8. package/.agents/schemas/lifecycle/README.md +2 -1
  9. package/.agents/schemas/lifecycle/ledger-record.schema.json +1 -1
  10. package/.agents/schemas/risk-verdict.schema.json +14 -1
  11. package/.agents/scripts/README.md +0 -46
  12. package/.agents/scripts/analyze-execution.js +76 -1
  13. package/.agents/scripts/check-doc-links.js +3 -0
  14. package/.agents/scripts/check-workflow-cli-lint.js +208 -0
  15. package/.agents/scripts/epic-audit-recheck.js +1 -1
  16. package/.agents/scripts/epic-plan-clarity.js +16 -6
  17. package/.agents/scripts/epic-plan-decompose.js +37 -59
  18. package/.agents/scripts/epic-plan-healthcheck.js +39 -6
  19. package/.agents/scripts/epic-plan-spec.js +41 -168
  20. package/.agents/scripts/epic-reconcile.js +7 -1
  21. package/.agents/scripts/lib/Logger.js +4 -4
  22. package/.agents/scripts/lib/audit-suite/index.js +4 -5
  23. package/.agents/scripts/lib/audit-suite/runner.js +6 -4
  24. package/.agents/scripts/lib/audit-suite/selector.js +2 -3
  25. package/.agents/scripts/lib/bdd-runner-detect.js +1 -1
  26. package/.agents/scripts/lib/command-header.js +20 -0
  27. package/.agents/scripts/lib/config/github.js +1 -3
  28. package/.agents/scripts/lib/config-settings-schema.js +4 -3
  29. package/.agents/scripts/lib/degraded-mode.js +1 -1
  30. package/.agents/scripts/lib/label-constants.js +18 -3
  31. package/.agents/scripts/lib/label-taxonomy.js +14 -3
  32. package/.agents/scripts/lib/mutation/baseline-snapshot.js +7 -6
  33. package/.agents/scripts/lib/orchestration/consolidation-precondition.js +18 -8
  34. package/.agents/scripts/lib/orchestration/context-hydration-engine.js +3 -4
  35. package/.agents/scripts/lib/orchestration/docs-digest.js +2 -2
  36. package/.agents/scripts/lib/orchestration/epic-plan-decompose/phases/persist-helpers.js +4 -0
  37. package/.agents/scripts/lib/orchestration/epic-plan-decompose/phases/persist.js +22 -12
  38. package/.agents/scripts/lib/orchestration/epic-plan-spec/phases/authoring-context.js +6 -1
  39. package/.agents/scripts/lib/orchestration/epic-spec-reconciler-diff.js +18 -2
  40. package/.agents/scripts/lib/orchestration/file-assumptions.js +68 -7
  41. package/.agents/scripts/{lifecycle-diff.js → lib/orchestration/lifecycle/ledger-diff.js} +10 -76
  42. package/.agents/scripts/lib/orchestration/lifecycle/listeners/acceptance-reconciler.js +1 -1
  43. package/.agents/scripts/lib/orchestration/plan-context.js +696 -0
  44. package/.agents/scripts/lib/orchestration/plan-critic-conditions.js +177 -0
  45. package/.agents/scripts/lib/orchestration/plan-critics-evaluate.js +99 -0
  46. package/.agents/scripts/lib/orchestration/plan-metrics.js +445 -0
  47. package/.agents/scripts/lib/orchestration/plan-persist/amend.js +359 -0
  48. package/.agents/scripts/lib/orchestration/plan-persist/delivery-mode.js +127 -0
  49. package/.agents/scripts/lib/orchestration/plan-persist/run-plan-persist.js +1015 -0
  50. package/.agents/scripts/lib/orchestration/plan-persist/summary.js +206 -0
  51. package/.agents/scripts/lib/orchestration/plan-reachability.js +160 -0
  52. package/.agents/scripts/lib/orchestration/plan-runner/worktree-sweep.js +3 -3
  53. package/.agents/scripts/lib/orchestration/planning-risk.js +1 -1
  54. package/.agents/scripts/lib/orchestration/spec-freshness.js +1 -1
  55. package/.agents/scripts/lib/orchestration/ticket-validator.js +18 -1
  56. package/.agents/scripts/lib/orchestration/ticketing/bulk.js +1 -1
  57. package/.agents/scripts/lib/orchestration/ticketing/reads.js +11 -2
  58. package/.agents/scripts/lib/plan-phase-cleanup.js +16 -0
  59. package/.agents/scripts/lib/presentation/manifest-persistence.js +2 -3
  60. package/.agents/scripts/lib/templates/spec-author-prompts.js +74 -0
  61. package/.agents/scripts/plan-context.js +204 -0
  62. package/.agents/scripts/plan-critics.js +199 -0
  63. package/.agents/scripts/plan-persist.js +383 -0
  64. package/.agents/scripts/pr-watch-with-update.js +8 -7
  65. package/.agents/scripts/run-lint.js +10 -11
  66. package/.agents/scripts/story-plan.js +19 -7
  67. package/.agents/scripts/sync-claude-commands.js +10 -5
  68. package/.agents/skills/core/knowledge-transfer/SKILL.md +11 -7
  69. package/.agents/workflows/audit-documentation.md +5 -7
  70. package/.agents/workflows/audit-lighthouse.md +1 -0
  71. package/.agents/workflows/audit-security.md +1 -0
  72. package/.agents/workflows/audit-to-stories.md +16 -5
  73. package/.agents/workflows/git-deliver.md +76 -243
  74. package/.agents/workflows/helpers/_merge-conflict-template.md +1 -1
  75. package/.agents/workflows/helpers/code-review.md +7 -6
  76. package/.agents/workflows/helpers/deliver-epic.md +5 -4
  77. package/.agents/workflows/helpers/plan-epic-reference.md +120 -96
  78. package/.agents/workflows/helpers/plan-epic.md +307 -994
  79. package/.agents/workflows/helpers/plan-story.md +14 -14
  80. package/.agents/workflows/helpers/scope-triage-gate.md +15 -4
  81. package/.agents/workflows/helpers/single-story-deliver.md +5 -4
  82. package/.agents/workflows/helpers/worktree-lifecycle.md +9 -7
  83. package/.agents/workflows/mandrel-update.md +144 -466
  84. package/.agents/workflows/plan.md +87 -145
  85. package/docs/CHANGELOG.md +20 -0
  86. package/lib/cli/registry.js +21 -3
  87. package/package.json +1 -1
  88. package/.agents/schemas/loop-unit.schema.json +0 -70
  89. package/.agents/scripts/assert-branch.js +0 -81
  90. package/.agents/scripts/check-loop-units.js +0 -204
  91. package/.agents/scripts/detect-merges.js +0 -111
  92. package/.agents/scripts/git-pr-quality-gate.js +0 -205
  93. package/.agents/scripts/git-rebase-and-resolve.js +0 -234
  94. package/.agents/scripts/hierarchy-gate.js +0 -192
  95. package/.agents/scripts/hydrate-context.js +0 -179
  96. package/.agents/scripts/lib/loop-units/validate-loop-unit.js +0 -197
  97. package/.agents/scripts/lib/orchestration/epic-plan-decompose/phases/cli.js +0 -167
  98. package/.agents/scripts/lib/orchestration/epic-plan-spec/phases/cli-args.js +0 -69
  99. package/.agents/scripts/lib/orchestration/plan-runner/plan-router.js +0 -86
  100. package/.agents/scripts/loc-delta.js +0 -205
  101. package/.agents/scripts/render-manifest.js +0 -143
  102. package/.agents/scripts/run-audit-suite.js +0 -97
  103. package/.agents/scripts/select-audits.js +0 -155
  104. package/.agents/scripts/update-mutation-baseline.js +0 -189
  105. package/.agents/workflows/explain.md +0 -118
  106. package/.agents/workflows/git-merge-pr.md +0 -377
  107. package/.agents/workflows/helpers/epic-plan-decompose.md +0 -22
  108. package/.agents/workflows/helpers/epic-plan-spec.md +0 -22
  109. package/.agents/workflows/loops/README.md +0 -65
  110. package/.agents/workflows/loops/fix-failing-tests.md +0 -74
  111. package/.agents/workflows/loops/nightly-audit.md +0 -81
  112. package/.agents/workflows/loops/watch-ci.md +0 -68
@@ -41,9 +41,9 @@ If a Story-under-Epic needs replanning, use `/plan <epicId> --force`. If you
41
41
  have a refactor, framework-maintenance idea, or any standalone unit of
42
42
  work, use this workflow.
43
43
 
44
- **Inbound from `/plan` scope triage.** `/plan` Phase 1.5 runs the
45
- [`core/scope-triage`](../../skills/core/scope-triage/SKILL.md) rubric over the
46
- sharpened one-pager. On a `story` / `borderline` verdict the operator may route
44
+ **Inbound from `/plan` scope triage.** The Epic path's interrogate step runs
45
+ the [`core/scope-triage`](../../skills/core/scope-triage/SKILL.md) rubric over
46
+ the sharpened one-pager. On a `story` / `borderline` verdict the operator may route
47
47
  the work here via `/plan --from-notes <path>`. That invocation is a
48
48
  **scope-triage handoff** — the triage decision is already made, so `/plan`
49
49
  MUST NOT re-triage it (the no-re-triage rule in the skill); it proceeds straight
@@ -116,7 +116,7 @@ when there is nothing to surface.
116
116
  (or empty). Pass `--refine` / `--no-refine` to override. When the
117
117
  envelope advises refinement, activate the
118
118
  [`core/idea-refinement`](../../skills/core/idea-refinement/SKILL.md) skill
119
- before drafting the body — same skill `/plan` Phase 1 drives.
119
+ before drafting the body — same skill the Epic path's interrogate step drives.
120
120
 
121
121
  ## Phase 2 — Host LLM Authors a Draft Body
122
122
 
@@ -155,11 +155,11 @@ Check `corpusContext` before authoring the `## Context` section:
155
155
 
156
156
  Write the draft to `temp/single-story-draft.md`.
157
157
 
158
- ### Scope-triage escalation gate (symmetric counterpart to `/plan` Phase 1.5)
158
+ ### Scope-triage escalation gate (symmetric counterpart to the Epic path's ideation triage)
159
159
 
160
160
  This gate runs the shared scope-triage gate over the **drafted Story body** to
161
161
  catch an Epic-sized scope before it is persisted as a standalone Story — the
162
- outbound mirror of `/plan` Phase 1.5's inbound downgrade gate. The gate
162
+ outbound mirror of the Epic path's inbound downgrade gate. The gate
163
163
  mechanics (verdict meanings, the three-way operator choice, the `--yes`
164
164
  resolution, and the no-re-triage rule) live in the single-homed fragment
165
165
  [`scope-triage-gate.md`](scope-triage-gate.md); read it and follow it. This
@@ -172,13 +172,13 @@ phase supplies only its path-specific firing conditions:
172
172
  `refine` heuristic in `story-plan.js` is unchanged — it is a deterministic
173
173
  seed-length proxy, not a scope-size judgment.)
174
174
  - **When it is skipped**: entirely, when `/plan` was entered via a scope-triage
175
- handoff — from `/plan` Phase 1.5 (the inbound route above) or the `/plan`
176
- Phase 5.5 existing-Epic conversion path (the no-re-triage rule in the
175
+ handoff — from the Epic path's ideation triage (the inbound route above) or
176
+ its existing-Epic story-sized conversion path (the no-re-triage rule in the
177
177
  fragment).
178
178
  - **Recommended branch on an `epic` verdict**: escalate to `/plan --idea` —
179
179
  persist the notes/draft to a notes file and hand off to `/plan --idea` (or
180
180
  `--from-notes <path>`), identifying the invocation as a scope-triage handoff
181
- so `/plan` skips its own Phase 1.5 gate, then **abandon the draft and exit
181
+ so `/plan` skips its own ideation triage gate, then **abandon the draft and exit
182
182
  `/plan`** (no standalone Story is created). The alternative branches are
183
183
  **persist as a standalone Story anyway** (proceed to Phase 3 with the draft
184
184
  unchanged) and **abort**.
@@ -186,8 +186,8 @@ phase supplies only its path-specific firing conditions:
186
186
  ### HITL — operator confirms the draft (verdict folded in)
187
187
 
188
188
  Display the draft to the operator and **STOP**. Do not call the persist phase
189
- until the operator explicitly confirms the draft. This mirrors the HITL gate
190
- `/plan` Phase 3 enforces before opening the Epic Issue. This is the
189
+ until the operator explicitly confirms the draft. This mirrors the Epic
190
+ path's gate #1 at the exit of its interrogate step. This is the
191
191
  story-path face of `/plan`'s **gate #1** (the ideation one-pager /
192
192
  scope-triage confirm). The scope-triage verdict folds into this same stop, per
193
193
  the branch bindings above; on a **`story` verdict (or gate skipped via
@@ -229,8 +229,8 @@ exact `gh issue create` shape that would run.
229
229
  ## Constraints
230
230
 
231
231
  - **No `Epic: #N` references.** This is the standalone contract; persist
232
- fails fast if one is present. To attach a Story to an Epic, use
233
- `/plan` Phase 8 instead.
232
+ fails fast if one is present. To attach a Story to an Epic, plan it
233
+ through the Epic path (`/plan <epicId>`) instead.
234
234
  - **No external LLM APIs.** Mirrors the v5.6 contract: the host LLM does
235
235
  the authoring; the Node wrapper does the I/O.
236
236
  - **Idempotent.** Re-running `--emit-context` is safe. Re-running
@@ -245,7 +245,7 @@ exact `gh issue create` shape that would run.
245
245
 
246
246
  - [`/single-story-deliver`](single-story-deliver.md) — the consumer
247
247
  workflow that picks the Story up after this one creates it.
248
- - [`/plan`](plan-epic.md) — the Epic-tier equivalent. Phases 1–4
248
+ - [`/plan`](plan-epic.md) — the Epic-tier equivalent. Its ideation entry
249
249
  inspired the seed-capture + envelope-emit pattern used here.
250
250
  - [`core/idea-refinement`](../../skills/core/idea-refinement/SKILL.md) —
251
251
  optional pre-authoring skill activated when the seed is short.
@@ -11,7 +11,8 @@ caller: plan-epic.md, plan-story.md
11
11
 
12
12
  > **Not a slash command.** This file lives in `helpers/` and is a
13
13
  > path-included fragment (not projected into the plugin command tree). It is
14
- > referenced by [`plan-epic.md`](plan-epic.md) (Phases 1.5 and 5.5) and
14
+ > referenced by [`plan-epic.md`](plan-epic.md) (its interrogate step the
15
+ > ideation triage and the existing-Epic story-sized advisory) and
15
16
  > [`plan-story.md`](plan-story.md) (Phase 2), which supply only their
16
17
  > path-specific firing conditions and defer the gate mechanics here.
17
18
 
@@ -44,7 +45,7 @@ The rubric emits exactly one verdict:
44
45
  presented so the operator makes the call.
45
46
 
46
47
  The verdict is **advisory**. Being wrong in the `epic` direction is cheap
47
- (Phase 8.3 consolidation and the sizing validator catch an over-planned Story
48
+ (the consolidation critic and the sizing validator catch an over-planned Story
48
49
  later), so the gate never costs the operator a stop on an `epic` verdict; the
49
50
  gate exists to avoid the ceremony tax of pushing a story-sized scope through
50
51
  the full Epic pipeline.
@@ -86,11 +87,21 @@ meanings; it only forces the Recommended resolution where the gate would
86
87
  otherwise STOP. See
87
88
  [`plan.md` § Headless / non-interactive mode](../plan.md#headless--non-interactive-mode---yes).
88
89
 
90
+ **Headless seed entry — the verdict is already in the envelope (#4496).**
91
+ On the `--idea` `--yes` path the rubric is applied **CLI-side** by
92
+ `plan-context.js --seed` and shipped as the envelope's `scopeTriage` field
93
+ (`{ verdict, reasons, advisory: true, appliedBy: "cli" }`), anchored to the
94
+ same sizing SSOT this skill anchors to. Do **not** Read the
95
+ `core/scope-triage` skill headless — use the envelope verdict and resolve it
96
+ per this section. The attended paths keep the skill-based judgment
97
+ unchanged.
98
+
89
99
  ## No-re-triage rule
90
100
 
91
101
  A **scope-triage handoff** is a triage decision *already made*. When `/plan` is
92
- entered via a handoff (from the ideation-path Phase 1.5, the existing-Epic
93
- Phase 5.5 conversion, or the standalone-Story Phase 2 escalation), the
102
+ entered via a handoff (from the Epic path's ideation triage, its
103
+ existing-Epic story-sized conversion, or the standalone-Story Phase 2
104
+ escalation), the
94
105
  receiving path **MUST NOT** re-run this gate. Re-triaging a settled call would
95
106
  re-litigate it and risk a ping-pong between the two `/plan` paths. Each
96
107
  referencing path states its own skip-on-handoff condition and defers the
@@ -351,13 +351,14 @@ When the watch exits, branch on the exit code:
351
351
  commit on `story-<storyId>`, then re-watch. Auto-merge stays enabled
352
352
  across retries; no need to re-arm it. The Story stays at
353
353
  `agent::closing` throughout, so a failed/abandoned PR never strands a
354
- CLOSED issue. If the same failure class recurs, hand convergence off to
355
- the host loop: `/loop /loops:fix-failing-tests`.
354
+ CLOSED issue. If the same failure class recurs, hand convergence off to a
355
+ self-paced host loop (`/loop`) that re-runs the failing check and applies
356
+ the smallest fix until it exits green.
356
357
  - **Exit 2 (still-running — slow CI, not red)** — the poll cap fired with
357
358
  checks still pending and the watcher exhausted its resume budget with
358
359
  nothing red. This is **never** a failure. Hand the wait off to the
359
- host's interval loop rather than ending your turn:
360
- `/loop 5m /loops:watch-ci`.
360
+ host's interval loop rather than ending your turn: `/loop 5m` polling
361
+ `gh pr checks` until the checks settle.
361
362
 
362
363
  > **Triage authority.** How to classify and remediate a red (or repeatedly
363
364
  > slow) check — the root-cause-only decision tree for infra/transient and
@@ -102,7 +102,7 @@ or stale locks.
102
102
 
103
103
  `.worktrees/.pending-cleanup.json` accumulates entries when
104
104
  `story-close.js` cannot remove a worktree on Windows because of an
105
- EBUSY-class lock. Plan boot ([`drainPendingCleanupAtBoot`](../../scripts/epic-plan-spec.js) → [`worktree-sweep.js`](../../scripts/lib/orchestration/plan-runner/worktree-sweep.js))
105
+ EBUSY-class lock. Plan boot ([`drainPendingCleanupAtBoot`](../../scripts/lib/orchestration/epic-plan-spec/phases/drain.js), run by `plan-persist.js` → [`worktree-sweep.js`](../../scripts/lib/orchestration/plan-runner/worktree-sweep.js))
106
106
  retries the entries — but if the holder
107
107
  is a long-lived user-mode process (a stranded test runner, a lingering
108
108
  biome/tsc, a node REPL), the lock never clears and the entry pins.
@@ -127,7 +127,7 @@ PowerShell `Get-CimInstance Win32_Process`, terminating them with
127
127
  | Trigger | Caller |
128
128
  | ---------------- | ---------------------------------------------------------------------------- |
129
129
  | `/deliver` | [`Cleaner` lifecycle listener](../../scripts/lib/orchestration/lifecycle/listeners/cleaner.js) at the close-tail cleanup phase (before `wm.gc()`) |
130
- | `/plan` | [`drainPendingCleanupAtBoot`](../../scripts/epic-plan-spec.js) → [`worktree-sweep.js`](../../scripts/lib/orchestration/plan-runner/worktree-sweep.js) |
130
+ | `/plan` | [`drainPendingCleanupAtBoot`](../../scripts/lib/orchestration/epic-plan-spec/phases/drain.js) (run by `plan-persist.js`) → [`worktree-sweep.js`](../../scripts/lib/orchestration/plan-runner/worktree-sweep.js) |
131
131
  | Story merge close | [`story-close.js`](../../scripts/story-close.js) (`drainPendingCleanupAfterClose`) |
132
132
 
133
133
  All automatic paths call `forceDrainPendingCleanup()` (or are folded into
@@ -242,7 +242,8 @@ Symlink strategy:
242
242
  content-addressable store at `~/.local/share/pnpm/store` (or the platform
243
243
  equivalent) — reused packages are hard-linked into the worktree instead of
244
244
  re-downloaded and re-extracted. First-run on a cold store is no faster than
245
- `per-worktree`, and `epic-plan-healthcheck.js` primes the store in the
245
+ `per-worktree`, and the plan healthcheck (`epic-plan-healthcheck.js
246
+ --prime-install`, an opt-in manual run) primes the store in the
246
247
  main checkout to avoid paying that cost in parallel story windows.
247
248
 
248
249
  ## Windows notes
@@ -334,8 +335,9 @@ Set `delivery.worktreeIsolation.enabled: false` (or omit the block) to
334
335
  restore v5.5.1 single-tree behavior:
335
336
 
336
337
  - No `git worktree add` / `remove` calls.
337
- - `assert-branch.js` and `computeStoryWaves` focus-area serialization remain in
338
- place as the primary race guards.
338
+ - The native `git branch --show-current` pre-commit check and
339
+ `computeStoryWaves` focus-area serialization remain in place as the primary
340
+ race guards.
339
341
  - All existing v5.5.1 tests pass in this mode.
340
342
 
341
343
  Pick single-tree mode when:
@@ -370,8 +372,8 @@ Human reviewers should **keep using the main checkout** — not a worktree:
370
372
  - **Always** use the main checkout for code review — not a per-story worktree.
371
373
  - **Always** respect `delivery.worktreeIsolation.enabled: false` as a
372
374
  first-class fallback mode, not a degraded one. v5.5.1 single-tree guards
373
- (`assert-branch.js`, focus-area serialization) remain the primary defense in
374
- that mode.
375
+ (the `git branch --show-current` pre-commit check, focus-area serialization)
376
+ remain the primary defense in that mode.
375
377
 
376
378
  ## Operator escape hatches
377
379