mandrel 2.8.0 → 2.10.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 (73) hide show
  1. package/.agents/agents/.markdownlint.json +4 -0
  2. package/.agents/agents/acceptance-critic.md +30 -5
  3. package/.agents/agents/auditor.md +36 -19
  4. package/.agents/agents/plan-critic.md +31 -5
  5. package/.agents/agents/story-worker.md +91 -100
  6. package/.agents/docs/configuration.md +39 -1
  7. package/.agents/docs/execution-reference.md +13 -0
  8. package/.agents/docs/workflows.md +1 -1
  9. package/.agents/instructions.md +131 -265
  10. package/.agents/rules/git-conventions.md +47 -83
  11. package/.agents/rules/orchestration-error-handling.md +28 -0
  12. package/.agents/schemas/agentrc.schema.json +44 -1
  13. package/.agents/schemas/validation-evidence.schema.json +3 -1
  14. package/.agents/scripts/acceptance-eval.js +1 -1
  15. package/.agents/scripts/apply-quality-bootstrap.js +1 -1
  16. package/.agents/scripts/audit-to-stories.js +51 -0
  17. package/.agents/scripts/check-test-temp-hygiene.js +438 -0
  18. package/.agents/scripts/deliver-recover.js +23 -6
  19. package/.agents/scripts/lib/audit-suite/index.js +5 -0
  20. package/.agents/scripts/lib/audit-suite/lens-diff-floor.js +179 -0
  21. package/.agents/scripts/lib/audit-suite/selector.js +1 -1
  22. package/.agents/scripts/lib/audit-to-stories/dedupe-against-github.js +120 -55
  23. package/.agents/scripts/lib/config/temp-paths.js +121 -1
  24. package/.agents/scripts/lib/config-settings-schema-delivery.js +30 -0
  25. package/.agents/scripts/lib/config-settings-schema.js +32 -0
  26. package/.agents/scripts/lib/findings/semantic-issue-search.js +43 -5
  27. package/.agents/scripts/lib/observability/metrics-ledger.js +217 -0
  28. package/.agents/scripts/lib/observability/runtime-friction.js +7 -0
  29. package/.agents/scripts/lib/observability/terse-result.js +114 -0
  30. package/.agents/scripts/lib/orchestration/complexity-gate.js +318 -0
  31. package/.agents/scripts/lib/orchestration/deliver-recover.js +137 -10
  32. package/.agents/scripts/lib/orchestration/merge-block-class.js +36 -15
  33. package/.agents/scripts/lib/orchestration/merge-poll.js +213 -0
  34. package/.agents/scripts/lib/orchestration/plan-context.js +60 -0
  35. package/.agents/scripts/lib/orchestration/plan-critic-conditions.js +182 -9
  36. package/.agents/scripts/lib/orchestration/plan-critics-evaluate.js +29 -2
  37. package/.agents/scripts/lib/orchestration/plan-metrics.js +31 -82
  38. package/.agents/scripts/lib/orchestration/plan-persist/run-plan-persist.js +102 -2
  39. package/.agents/scripts/lib/orchestration/plan-persist/story-ops.js +215 -14
  40. package/.agents/scripts/lib/orchestration/resolve-stories.js +7 -0
  41. package/.agents/scripts/lib/orchestration/review-providers/native.js +34 -16
  42. package/.agents/scripts/lib/orchestration/single-story-close/phases/auto-merge.js +221 -8
  43. package/.agents/scripts/lib/orchestration/single-story-close/phases/code-review.js +8 -3
  44. package/.agents/scripts/lib/orchestration/single-story-close/phases/confirm-merge.js +230 -79
  45. package/.agents/scripts/lib/orchestration/single-story-close/runner.js +55 -14
  46. package/.agents/scripts/lib/orchestration/story-close/emit-blocked.js +9 -3
  47. package/.agents/scripts/lib/orchestration/story-close/phases/local-lens-review.js +89 -1
  48. package/.agents/scripts/lib/orchestration/story-close/phases/review-core.js +73 -0
  49. package/.agents/scripts/lib/orchestration/story-deliver-terminal.js +4 -1
  50. package/.agents/scripts/lib/orchestration/task-body-validator.js +13 -40
  51. package/.agents/scripts/lib/story-body/body-format-lints.js +215 -0
  52. package/.agents/scripts/lib/story-body/story-body.js +18 -2
  53. package/.agents/scripts/lib/templates/decomposer-prompts.js +29 -6
  54. package/.agents/scripts/lib/test-env.js +65 -0
  55. package/.agents/scripts/plan-context.js +66 -9
  56. package/.agents/scripts/plan-critics.js +115 -3
  57. package/.agents/scripts/plan-persist.js +11 -1
  58. package/.agents/scripts/plan-run-epilogue.js +1 -1
  59. package/.agents/scripts/providers/github/issues.js +54 -7
  60. package/.agents/scripts/providers/github/search-budget.js +124 -0
  61. package/.agents/scripts/providers/github/search-query.js +71 -0
  62. package/.agents/scripts/single-story-confirm-merge.js +79 -10
  63. package/.agents/scripts/single-story-init.js +19 -3
  64. package/.agents/scripts/stories-wave-tick.js +1 -1
  65. package/.agents/scripts/sync-branch-from-base.js +9 -3
  66. package/.agents/workflows/deliver.md +86 -230
  67. package/.agents/workflows/helpers/deliver-reference.md +167 -0
  68. package/.agents/workflows/helpers/deliver-story-reference.md +203 -0
  69. package/.agents/workflows/helpers/deliver-story.md +114 -422
  70. package/.agents/workflows/helpers/plan-reference.md +211 -0
  71. package/.agents/workflows/plan.md +107 -279
  72. package/docs/CHANGELOG.md +47 -0
  73. package/package.json +1 -1
@@ -1,64 +1,52 @@
1
1
  ---
2
2
  description:
3
3
  Unified planning entry point. Interrogate → author → persist. Emits one
4
- Story by default (folded Tech Spec in the Story body); splits into N>1
5
- only under the default-single split policy.
4
+ Story by default; splits into N>1 only under the default-single split
5
+ policy.
6
6
  ---
7
7
 
8
8
  # /plan --seed "<text>" | --seed-file <path> | --tickets <ids>
9
9
 
10
- ## Role
11
-
12
- Single planning path. `/plan` owns the full ceremony — there is no
13
- Epic/Story router, no scope-triage `epic|story` verdict, and no
14
- `deliveryShape`. Two operator modes only:
15
-
16
- 1. **Text** — seed from chat or a file.
17
- 2. **Tickets** — analyze existing issue(s) into proper Stories.
18
-
19
- Audit findings become Stories via [`/audit-to-stories`](audit-to-stories.md)
20
- (separate workflow), which hands off with `--emit-plan-seed` →
21
- `/plan --seed-file <path>`.
10
+ > **Lean spine.** Happy path + gate list; edge-case and reference detail
11
+ > lives in the on-demand
12
+ > [`helpers/plan-reference.md`](helpers/plan-reference.md).
22
13
 
23
14
  ## Inputs
24
15
 
16
+ Single planning path — there is no
17
+ Epic/Story router, no scope-triage `epic|story` verdict:
18
+
25
19
  | Invocation | Behavior |
26
20
  | --- | --- |
27
- | `/plan --seed "<text>"` | Ideation from chat text: interrogate → author **one Story by default** → persist. |
28
- | `/plan --seed-file <path>` | Author from on-disk notes / plan seed (e.g. audit-to-stories handoff). |
21
+ | `/plan --seed "<text>"` / `--seed-file <path>` | Ideation from chat text or on-disk notes: interrogate → author **one Story by default** → persist. |
29
22
  | `/plan --tickets 123[,456…]` | Fetch issue(s), analyze into proper Stories (prefer N=1 rewrite). |
30
23
 
31
- `--body` is **not** a `/plan` entry. Persist always goes through
32
- `plan-persist.js --stories …`.
24
+ `--body` is **not** a `/plan` entry; persist always goes through
25
+ `plan-persist.js`.
33
26
 
34
27
  ## Flags
35
28
 
36
29
  | Flag | Meaning |
37
30
  | --- | --- |
38
- | `--seed "<text>"` | Seed text for ideation. |
39
- | `--seed-file <path>` | Pre-authored notes / plan-seed path. |
40
- | `--tickets <ids>` | Comma-separated issue ids to analyze. Closed as superseded at persist (see below). |
41
- | `--no-close-superseded` | Keep the `--tickets` source issues openno supersede comment, no close. |
42
- | `--force-review` | STOP at gate #2 for operator review of the assembled plan. The only thing that gates review — there is no risk-derived routing (Story #4542). |
43
- | `--allow-over-budget` | Permit a plan that exceeds `maxTickets` (rare N>1). |
31
+ | `--seed "<text>"` / `--seed-file <path>` | Seed text / pre-authored notes path. |
32
+ | `--tickets <ids>` | Issue ids to analyze; closed as superseded at persist. |
33
+ | `--no-close-superseded` | Keep the source issues open no supersede comment, no close. |
34
+ | `--force-review` | STOP at gate #2 for operator review the only review gate (Story #4542). |
35
+ | `--route-downgrade-reason "<text>"` | Audited `full`→`lite` downgrade (Story #4707), ledgered per Story. |
36
+ | `--allow-over-budget` | Permit a plan exceeding `maxTickets`. |
44
37
  | `--yes` | Non-interactive: auto-proceed gate #1 and gate #2 HITL waits. |
45
- | `--dry-run` | Author + validate without GitHub writes. Run it as a pre-pass before every real persist (see below). |
38
+ | `--dry-run` | Author + validate without GitHub writes; run as a pre-pass. |
46
39
 
47
40
  ## Default-single split policy
48
41
 
49
- Author **one Story** unless:
50
-
51
- 1. the pieces have **near-zero overlap** (genuinely independent capabilities), or
52
- 2. there is an **architectural seam** (different deployables, migration vs consumer).
53
-
54
- Coupled work stays one Story decompose it inside `## Slicing` as
55
- intra-session checkpoints, not sibling tickets. When N>1, every acceptance
56
- criterion must belong to exactly one Story; `plan-persist` runs
57
- `assertAcceptancePartition` and refuses coupled splits.
58
-
59
- **N=1 is the lean path:** one authoring prompt, folded `## Spec` in the
60
- Story body, light risk/critic profile. Do not run Epic-scale decompose,
61
- clarity, or reconciler ceremony for a single Story.
42
+ Author **one Story** unless (1) the pieces have **near-zero overlap**
43
+ (genuinely independent capabilities), or (2) there is an **architectural
44
+ seam** (different deployables, migration vs consumer). Coupled work stays
45
+ one Story decompose it inside `## Slicing` as intra-session checkpoints,
46
+ not sibling tickets. When N>1, every acceptance criterion belongs to exactly
47
+ one Story (`assertAcceptancePartition` refuses coupled splits). **N=1 is the
48
+ lean path:** one authoring prompt, folded `## Spec`, light risk/critic
49
+ profile no Epic-scale ceremony.
62
50
 
63
51
  ## Procedure
64
52
 
@@ -71,16 +59,18 @@ node .agents/scripts/plan-context.js --seed "<seed>" \
71
59
  # or: --tickets 123,456
72
60
  ```
73
61
 
74
- **Always pass `--out temp/plan-<slug>/plan-context.json`.** The CLI writes the
75
- envelope there (creating parent dirs); persist auto-discovers that file from
76
- `--plan-dir` and derives the `--tickets` source ids from its `sourceTickets[]`.
77
- That is what makes superseding work without anyone re-typing ids
78
- (Story #4554). The envelope still goes to stdout too, so piping is unaffected.
79
-
80
- The envelope carries docs context, codebase snapshot, BDD probe, risk
81
- heuristics, the story-author system prompt, `sourceTickets[]` (`--tickets`
82
- mode), and `duplicates[]` (open **Stories** whose title/body overlap the
83
- seed never Epics).
62
+ **Always pass `--out`.** Persist auto-discovers that envelope from
63
+ `--plan-dir` and derives source-ticket ids from its `sourceTickets[]`
64
+ (Story #4554); the CLI also writes **`stories.template.json`** the
65
+ authoring skeleton step 2 starts from.
66
+
67
+ The envelope carries docs context, codebase snapshot, the story-author
68
+ prompt, `sourceTickets[]`, `duplicates[]` (open **Stories** overlapping the
69
+ seed never Epics), and the `complexityRoute` signal:
70
+ `"lite"` (trivial single-artifact scope author one minimal Story, skip
71
+ fresh-critic / Tech-Spec ceremony; every close gate still runs) or `"full"`
72
+ (everything else; fails toward `full` on any doubt). Detail:
73
+ [`helpers/plan-reference.md` § Ceremony-lite gate](helpers/plan-reference.md).
84
74
  Under `--yes`, do not ask free-form operator questions — unresolved
85
75
  unknowns land in Key Assumptions.
86
76
 
@@ -89,272 +79,110 @@ duplicate-candidate review. Under `--yes`, auto-proceed.
89
79
 
90
80
  ### 2. Author
91
81
 
92
- Write artifacts under `temp/plan-<slug>/`:
93
-
94
- - `stories.json` array of Story tickets (**length 1 by default**). Each
95
- body uses the canonical `story-body` shape (`## Goal`, optional
96
- `## Slicing`, optional `## Spec`, `## Changes`, `## Acceptance`,
97
- `## Verify`, …). The Story is the single executable document: put lean
98
- approach prose in `## Spec`, binding criteria in top-level
99
- `acceptance[]` / `verify[]` (persist syncs them into the body). Do not
100
- restate Goal/Acceptance inside Spec. Over-budget Specs fail closed —
101
- split the Story or tighten Spec; never write Specs under `docs/`.
102
- - optional `techspec.md` — **N===1 only** convenience when Spec was authored
103
- outside the Story JSON; persist folds it into that Story's `## Spec`.
104
- Forbidden for N>1 (each Story must carry its own Spec).
105
- - optional `acceptance-manifest.json` — plan-level AC list (a JSON
106
- `string[]`) for partition coverage when N>1. Pass it to persist as
107
- `--plan-acceptance` or it is not read.
108
-
109
- For N=1, use the envelope `systemPrompts.story` and emit one cohesive
110
- Story. Split only under the policy above.
111
-
112
- **Tickets mode — author `supersedes[]` on every Story.** In `--tickets`
113
- mode each Story carries a top-level `supersedes` array claiming the source
114
- issues it replaces. It is bookkeeping, not part of the Story body, so it is
115
- never serialized into the markdown:
82
+ **One-shot authoring (Story #4707).** Start from `stories.template.json`
83
+ (or the skeleton below); author `stories.json` in one pass. `body` is a
84
+ markdown string **or** a structured object; persist parses either,
85
+ serializes the canonical markdown, and syncs the top-level `acceptance[]` /
86
+ `verify[]` into the body never dual-author those lists.
116
87
 
117
88
  ```jsonc
118
- {
119
- "slug": "close-superseded",
120
- "supersedes": [
121
- 4525,
122
- { "id": 4529, "note": "The filed `--changed-only` fix is provably inert; the correction is recorded here." }
123
- ]
124
- }
89
+ // temp/plan-<slug>/stories.json
90
+ [
91
+ {
92
+ "slug": "hyphen-case-slug", // ^[a-z0-9][a-z0-9-]*$
93
+ "type": "story",
94
+ "title": "Short descriptive title",
95
+ "body": {
96
+ "goal": "One sentence: why this Story exists.",
97
+ "spec": "Optional — contract and invariants.",
98
+ "changes": [{ "path": "path/to/file.ext", "assumption": "refactors-existing" }], // creates | refactors-existing | deletes
99
+ "non_goals": [],
100
+ "reason_to_exist": "One coherent reason this Story exists."
101
+ },
102
+ "acceptance": ["A testable, observable criterion"],
103
+ "verify": ["exact command (unit|contract|e2e|validate)"],
104
+ "depends_on": [] // sibling Story slugs, N>1 only
105
+ }
106
+ ]
125
107
  ```
126
108
 
127
- Entries are bare issue numbers, or `{ id, note }` when the plan has
128
- something to say about *that* source issuea correction to its analysis,
129
- or why it was folded in with others. The optional `note` is rendered into
130
- that issue's supersede comment, so planning that materially corrects a
131
- source issue records the correction on the ticket rather than emitting
132
- template-only prose.
133
-
134
- ### Supersede-map partition
109
+ Artifacts under `temp/plan-<slug>/`: `stories.json`
110
+ (**length 1 by default**; over-budget Specs fail closed split or tighten,
111
+ never write Specs under `docs/`); optional `techspec.md` (**N===1 only**
112
+ folded into `## Spec`); optional `acceptance-manifest.json` (N>1 partition
113
+ list pass as `--plan-acceptance` or it is not read). For N=1,
114
+ use the envelope `systemPrompts.story` and emit one cohesive Story.
115
+ Split only under the policy above.
135
116
 
136
- `plan-persist` refuses a partial supersede map **before** it creates any
137
- Story (mirroring `assertAcceptancePartition`): every id passed to
138
- `--tickets` must be claimed by **exactly one** Story, and no Story may
139
- claim an id that was not a source ticket. With N>1 the mapping is not
140
- total by default — an authored map is the only thing that can say
141
- `#4525-#4528 → #4530` while `#4529 → #4531`, which a blanket "superseded by
142
- this plan-run" reference could not.
117
+ **Tickets mode:** every Story authors a top-level `supersedes[]` claiming
118
+ the source issues it replaces; persist refuses a partial map (shape:
119
+ [`helpers/plan-reference.md` § Tickets mode](helpers/plan-reference.md)).
143
120
 
144
121
  ### 2.5 Critics
145
122
 
146
- Evaluate the critic-dispatch conditions against the authored draft — here,
147
- **before** persist, because this is the last point where a finding can still
148
- be folded into a re-author round rather than into live issues:
149
-
150
123
  ```bash
151
124
  node .agents/scripts/plan-critics.js \
152
125
  --stories temp/plan-<slug>/stories.json \
153
126
  [--tech-spec temp/plan-<slug>/techspec.md]
154
127
  ```
155
128
 
156
- It prints a verdict on stdout and exits 0 on **any** verdict — the verdict
157
- routes work, it does not gate the run. It exits **1** only on a usage/IO
158
- error (an unreadable or malformed `--stories` / `--tech-spec` path). That is
159
- not an advisory "proceed": no critic ran and no skip was ledgered, so **do
160
- not proceed to Persist** — fix the path and re-run:
129
+ Run **before** persist the last point a finding folds into a re-author
130
+ round. It exits 0 on **any** verdict (verdicts route work, they do not
131
+ gate) and exits **1** only on a usage/IO error no critic ran, no skip
132
+ ledgered: **do not proceed to Persist**; fix and re-run.
161
133
 
162
- ```jsonc
163
- {
164
- "consolidation": { "critic": "consolidation", "dispatch": false, "reasons": ["…"] },
165
- "premortem": { "critic": "pre-mortem", "dispatch": true, "reasons": ["…"] },
166
- "textHygiene": { "critic": "text-hygiene", "findings": [] }
167
- }
168
- ```
169
-
170
- The verdict's third entry, `textHygiene`, is advisory-only (Story #4599): it
171
- carries deterministic body lints (`dangling-citation` / `open-question` /
172
- `slicing-mass`) with no dispatch semantics — it spawns nothing and never
173
- gates the run. Fold `textHygiene.findings[]` into the re-author round the
174
- same way critic findings fold in: fix each named defect in `stories.json`
175
- (anchor or inline the citation, resolve the question into a declarative
176
- assumption, thin the Slicing checkpoint) and re-run this step. Empty
177
- `findings` add nothing to the round.
178
-
179
- - **Both `dispatch: false`** — proceed straight to Persist. The conditions
180
- provably have nothing for a critic to find, and each skip is recorded on the
181
- plan-metrics ledger so under-firing stays auditable.
182
- - **Either `dispatch: true`** — dispatch **one fresh-context sub-agent per
183
- firing critic**, then fold its findings into the Gate #2 view or a re-author
184
- round before persist. When `delivery.routing.roleScopedAgents` is enabled
185
- (the **default**), dispatch each firing critic with `subagent_type:
186
- plan-critic` — it boots on the role-scoped
187
- [`plan-critic`](../agents/plan-critic.md) context (its own system prompt, no
188
- `CLAUDE.md` @-closure) that carries the maker-blind invariant, the
189
- `consolidation` and `pre-mortem` charters, and the output shape standalone.
190
- When the kill-switch is off (`roleScopedAgents: false`) or the host cannot
191
- spawn at this depth, fall back to a generic sub-agent and hand it the same
192
- charter (the `consolidation` / `pre-mortem` definitions in
193
- [`plan-critic.md`](../agents/plan-critic.md)). Either way the critic is
194
- **maker-blind**: hand it the draft artifacts (`stories.json`, and
195
- `techspec.md` when present) — never the authoring transcript or the reasons
196
- the planner believed its own draft is sound. A critic that reads the maker's
197
- case grades the case, not the draft.
198
-
199
- Fold what survives back into `stories.json` and re-run this step. Findings are
200
- advisory input to the operator's Gate #2 decision, not an automatic re-author
201
- mandate.
134
+ - **Both `dispatch: false`** — proceed to Persist (each skip is ledgered).
135
+ - **Either `dispatch: true`** — dispatch **one fresh-context, maker-blind
136
+ sub-agent per firing critic** (hand it only the draft artifacts,
137
+ never the authoring transcript), fold findings into Gate #2 or a
138
+ re-author round, re-run this step. Pre-mortem triggers (incl. the
139
+ external-dependency probe, #4700), folding the advisory-only
140
+ `textHygiene.findings[]` lints, and the role-scoped dispatch shape:
141
+ [`helpers/plan-reference.md` § Critic dispatch detail](helpers/plan-reference.md).
202
142
 
203
143
  ### 3. Persist
204
144
 
205
- **Gate #2** — when the operator passed `--force-review`, STOP for approval of
206
- the assembled plan before persist. Under `--yes`, auto-proceed.
207
-
208
- `--force-review` is the **only** thing that raises this gate — there is no
209
- risk-derived routing (Story #4542): a gate a plan can lower for itself is not a
210
- gate.
211
-
212
- #### Dry-run pre-pass (always)
145
+ **Gate #2** — with `--force-review`, STOP for approval before persist (the
146
+ **only** trigger). Under `--yes`, auto-proceed.
213
147
 
214
- Run persist with `--dry-run` **before** the real one. It is the same command
215
- with the same flags only the GitHub writes are suppressed:
148
+ Run persist with `--dry-run` **first** same command, GitHub writes
149
+ suppressed; every gate (ticket validator, body parse, DAG, capacity,
150
+ budget, reachability, split-policy and supersede partitions, Spec fold)
151
+ runs before the first `createIssue`. Then:
216
152
 
217
153
  ```bash
218
154
  node .agents/scripts/plan-persist.js \
219
155
  --stories temp/plan-<slug>/stories.json \
220
- [--plan-acceptance temp/plan-<slug>/acceptance-manifest.json] \
221
- [--tech-spec temp/plan-<slug>/techspec.md] \
222
156
  --plan-dir temp/plan-<slug> \
223
- --dry-run
224
- ```
225
-
226
- Every gate — ticket validator, body parse, subject-prefix, DAG, capacity,
227
- budget, reachability, split-policy and supersede partitions, Spec fold —
228
- runs **before** the first `createIssue`, so a dry-run exercises all of them
229
- write-free. An authoring mistake surfaces here, where the fix costs one
230
- re-author, instead of after `k` of `N` Stories are already live.
231
-
232
- #### The real persist
233
-
234
- ```bash
235
- node .agents/scripts/plan-persist.js \
236
- --stories temp/plan-<slug>/stories.json \
237
157
  [--plan-acceptance temp/plan-<slug>/acceptance-manifest.json] \
238
158
  [--tech-spec temp/plan-<slug>/techspec.md] \
239
- [--plan-dir temp/plan-<slug>] \
240
- [--plan-context temp/plan-<slug>/plan-context.json] \
241
- [--source-tickets 123,456] \
242
- [--no-close-superseded] \
243
- [--force-review] \
244
- [--allow-over-budget]
159
+ [--source-tickets 123,456] [...flags from the table above]
245
160
  ```
246
161
 
247
- Pass `--plan-acceptance` whenever step 2 wrote an `acceptance-manifest.json`
248
- it is what `assertAcceptancePartition` checks the N>1 split against.
249
-
250
- Persist creates Story issue(s) with `type::story` (plus any sanitized
251
- authored `labels[]`) and, when N>1, writes each authored `depends_on` edge
252
- into the sibling's body as a `blocked by #<id>` footer — the ordering
253
- `/deliver` resolves from. No batch label is applied (Story #4540 retired
254
- `plan-run::<id>`). Ends by naming the exact command:
255
- `/deliver <storyId> [<storyId> ...]`.
256
-
257
- stdout is a pure JSON result; all log lines go to stderr, so a headless
258
- driver can `JSON.parse` the stdout stream directly.
259
-
260
- #### Ready means fully persisted
261
-
262
- `agent::ready` is the **terminal** step, not part of the creating POST
263
- (Story #4541). The order is: create unlabelled → upsert `story-plan-state` on
264
- every Story → upsert `plan-summary` on the primary → flip every Story to
265
- `agent::ready`.
266
-
267
- This is what lets `/deliver` trust the label: a Story carrying
268
- `agent::ready` always has its persist receipt on the ticket, so nothing can
269
- pick it up mid-write and read a half-persisted plan.
270
-
271
- #### Resuming a failed persist
272
-
273
- Persist is **idempotent over the same authored artifacts**. Each created body
274
- carries an invisible plan fingerprint (derived from the Story's slug +
275
- title), and persist indexes the open `type::story` backlog by it before
276
- creating anything.
277
-
278
- So if a transient GitHub failure strands the run at Story `k` of `N`:
279
-
280
- | | Behaviour |
281
- | --- | --- |
282
- | The `1..k-1` Stories | Live, but **not** `agent::ready` — invisible to `/deliver`, not half-delivered. |
283
- | Re-running persist | Adopts them by fingerprint, creates only the missing ones, then flips the whole cohort ready. |
284
- | Editing `stories.json` first | Changing a slug or title changes the fingerprint — the old issue is orphaned rather than adopted. Close it by hand. |
285
-
286
- Just re-run the same command. Do not hand-delete the stranded issues first.
287
-
288
- #### Temp hygiene
289
-
290
- A terminal-success run deletes its own `--plan-dir`. Every persist also reaps
291
- abandoned `temp/plan-*` directories older than 7 days, so dry-runs, failed
292
- gates, and abandoned authoring sessions do not accumulate under `temp/`.
293
-
294
- ### How the source ids reach persist
295
-
296
- In `--tickets` mode persist needs to know which ids were fetched. It resolves
297
- them **envelope-first** (Story #4554):
298
-
299
- | Channel | When it wins |
300
- | --- | --- |
301
- | Envelope `sourceTickets[]` | **The normal path.** Written by step 1's `--out`, then read from `--plan-context <file>` or auto-discovered at `<plan-dir>/plan-context.json`. No ids to re-type. |
302
- | `--source-tickets <ids>` | Explicit **override** for hand-driven runs (no captured envelope, or deliberately narrowing the set). Wins over the envelope; a disagreement is warned about, not silently reconciled. |
303
-
304
- The result envelope's `supersede.sourceTicketOrigin` reports which channel was
305
- used (`envelope` \| `flag` \| `none`).
306
-
307
- Every path with no envelope is **audible** — persist cannot tell a legitimate
308
- `--seed` run from a `--tickets` run whose envelope was never captured, so it
309
- says so rather than deciding silently:
310
-
311
- | Situation | Behaviour |
312
- | --- | --- |
313
- | Neither `--plan-dir` nor `--plan-context` | **Warn** — nothing was read; only `--source-tickets` can supply ids. |
314
- | Auto-discovered `<plan-dir>/plan-context.json` absent | **Warn** — degrade to `--source-tickets`; a `--seed` run legitimately has none. |
315
- | Explicit `--plan-context` missing | **Fatal** — the operator named a file and meant it. |
316
- | Envelope present but unparseable | **Fatal** — a corrupt envelope is not "no source tickets"; treating it as such is how a `--tickets` run used to report success having superseded nothing. |
317
-
318
- Whichever channel supplies them, the supersede-map partition above still
319
- fail-closes: a `--tickets` run whose Stories forgot `supersedes[]` is now
320
- **caught** (`source ticket #N is not claimed by any Story`) instead of
321
- partitioning an empty set and passing vacuously.
322
-
323
- ### Closing superseded source tickets
324
-
325
- **Default on.** After the Stories exist, persist comments on each source
326
- issue naming the specific Story that claims it — plus that Story's optional
327
- per-supersede `note` — and closes it with reason **`not_planned`**
328
- (`state_reason`). Nothing has shipped at persist time and the issue will not
329
- be actioned in its own right, so `not_planned` is the honest reason;
330
- `completed` would be a lie. This is what keeps the tracker from asserting
331
- that already-planned work is still unowned, and it writes down the supersede
332
- link that makes the history readable.
333
-
334
- | Behaviour | Contract |
335
- | --- | --- |
336
- | Default | Comment + close every source ticket as `not_planned`. |
337
- | `--no-close-superseded` | Skips all commenting and closing. Story creation is unchanged. Use it for a genuinely partial supersede — when the plan folded in only *part* of an issue and the remainder must stay open. |
338
- | `--dry-run` | Posts no comment and closes nothing; reports what it would have done. |
339
- | Re-run | Idempotent — the comment is keyed off a `superseded-by` structured-comment marker, and an already-closed source is skipped. |
340
- | Already closed / deleted / inaccessible | Skipped and reported. Never throws. |
341
- | Close-phase failure | **Never fails the run.** Stories stay created; the result envelope's `supersede` report names which tickets were and were not closed so the operator can finish by hand. |
162
+ Persist creates Story issue(s) with `type::story` plus a `plan-run::<id>`
163
+ grouping label (**metadata only** never a delivery-resolution input, Story #4692); N>1 `depends_on` edges become `blocked by #<id>` body footers.
164
+ `agent::ready` is the **terminal** flip, after all receipts are upserted — a
165
+ ready Story is always fully persisted (Story #4541). stdout is pure JSON
166
+ (logs on stderr).
342
167
 
343
- `--seed` / `--seed-file` modes have no source tickets, so no close phase
344
- runs at all.
168
+ In `--tickets` mode persist resolves source ids **envelope-first** and
169
+ closes each superseded source as `not_planned` with a comment (default on).
170
+ Detail (channels, close contract, resume, temp hygiene):
171
+ [`helpers/plan-reference.md`](helpers/plan-reference.md) — on a stranded
172
+ persist, re-run the same command; never hand-delete issues.
345
173
 
346
174
  ## Constraints
347
175
 
348
- - `/plan` never starts delivery.
349
- - No Epic ticket is opened. No reconciler. No `delivery::single` marker.
176
+ - `/plan` never starts delivery. No Epic ticket, no reconciler, no
177
+ `delivery::single` marker.
350
178
  - Duplicate search targets open Stories (`type::story`), not Epics.
351
- - Deterministic gates (ticket validator, split policy, reachability, budget)
352
- still fail closed under `--yes`.
179
+ - Deterministic gates still fail closed under `--yes`.
353
180
 
354
181
  ## See also
355
182
 
356
- - [`/deliver`](deliver.md) — delivery entry point (`/deliver <storyId>`).
357
- - [`/audit-to-stories`](audit-to-stories.md) — audit findings → plan seed
358
- `/plan --seed-file`.
183
+ - [`/deliver`](deliver.md) — delivery entry point.
184
+ - [`/audit-to-stories`](audit-to-stories.md) — audit findings → plan seed.
185
+ - [`helpers/plan-reference.md`](helpers/plan-reference.md) — ceremony-lite,
186
+ supersede, critic, and persist-resume detail.
359
187
  - [`core/scope-triage`](../skills/core/scope-triage/SKILL.md) — optional
360
188
  split-advisory notes only (no routing verdict).
package/docs/CHANGELOG.md CHANGED
@@ -2,6 +2,53 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file.
4
4
 
5
+ ## [2.10.0](https://github.com/dsj1984/mandrel/compare/mandrel-v2.9.0...mandrel-v2.10.0) (2026-07-23)
6
+
7
+
8
+ ### Added
9
+
10
+ * ceremony-proportional lite route: end-to-end lite delivery, one-shot authoring, contract-level Story prose ([#4707](https://github.com/dsj1984/mandrel/issues/4707)) ([#4709](https://github.com/dsj1984/mandrel/issues/4709)) ([d9d543a](https://github.com/dsj1984/mandrel/commit/d9d543a40ec55c063e8b3bff143782b053f8ef52))
11
+ * **ceremony:** findings-yield instrumentation + pre-eval full-suite discipline + lens diff-floor ([#4699](https://github.com/dsj1984/mandrel/issues/4699)) ([#4706](https://github.com/dsj1984/mandrel/issues/4706)) ([f7a6582](https://github.com/dsj1984/mandrel/commit/f7a658218f8a42997cb5bdbfe018c8b27e211b94))
12
+ * **close:** async merge-confirm mode — probe once, return pending, land via background confirm ([#4698](https://github.com/dsj1984/mandrel/issues/4698)) ([#4705](https://github.com/dsj1984/mandrel/issues/4705)) ([79360ce](https://github.com/dsj1984/mandrel/commit/79360ce224d48896050494e15b227c68d430e003))
13
+ * **plan:** external-dependency pre-mortem trigger so N=1 plans get a viability check ([#4700](https://github.com/dsj1984/mandrel/issues/4700)) ([#4702](https://github.com/dsj1984/mandrel/issues/4702)) ([4874890](https://github.com/dsj1984/mandrel/commit/4874890fab5ae346c2daf43b873ac374dc4a8df8))
14
+ * **plan:** reintroduce a per-plan-run grouping label on persisted Stories (metadata-only) ([#4692](https://github.com/dsj1984/mandrel/issues/4692)) ([#4693](https://github.com/dsj1984/mandrel/issues/4693)) ([1ca7d75](https://github.com/dsj1984/mandrel/commit/1ca7d7582972585a414268b242fb88cfcc94953e))
15
+ * residency & cache topology: always-on diet, shared-prefix subagent boots, lean-spine workflows ([#4708](https://github.com/dsj1984/mandrel/issues/4708)) ([#4718](https://github.com/dsj1984/mandrel/issues/4718)) ([8ba40d8](https://github.com/dsj1984/mandrel/commit/8ba40d84982a046a2f11e4be5e2a562b74c8f67e))
16
+
17
+
18
+ ### Fixed
19
+
20
+ * **close:** harden the merge wait — gh subprocess timeouts, extracted fail-fast tree, resume-CLI wait override, honest required-run evidence ([#4710](https://github.com/dsj1984/mandrel/issues/4710)) ([#4717](https://github.com/dsj1984/mandrel/issues/4717)) ([3edc9b5](https://github.com/dsj1984/mandrel/commit/3edc9b53b8176aa2386e0d12023bf69ab28bd87f))
21
+ * **close:** require head-anchored required-check evidence before the checks-failed fail-fast (refs [#4695](https://github.com/dsj1984/mandrel/issues/4695)) ([#4703](https://github.com/dsj1984/mandrel/issues/4703)) ([6b0b4db](https://github.com/dsj1984/mandrel/commit/6b0b4db021eb11ef46aa65fe6ed906f567ffef05))
22
+ * **evidence:** extend gateName enum to the real close-gate set (refs [#4697](https://github.com/dsj1984/mandrel/issues/4697)) ([#4701](https://github.com/dsj1984/mandrel/issues/4701)) ([49be21b](https://github.com/dsj1984/mandrel/commit/49be21bc9556de5db60871e5140e674e02bb9667))
23
+ * **observability:** isolate test-suite emissions from real telemetry streams and guard CI against fixture pollution ([#4696](https://github.com/dsj1984/mandrel/issues/4696)) ([#4704](https://github.com/dsj1984/mandrel/issues/4704)) ([992a5a2](https://github.com/dsj1984/mandrel/commit/992a5a2fa31091e9ae021c50c5ae8a7ec323ccd7))
24
+ * **observability:** make the test-temp hygiene guard airtight (refs [#4711](https://github.com/dsj1984/mandrel/issues/4711)) ([#4716](https://github.com/dsj1984/mandrel/issues/4716)) ([7520cfb](https://github.com/dsj1984/mandrel/commit/7520cfb66fae3aa5c6802af109becbc2b2795b56))
25
+ * **recover:** stability re-probe before trusting a mid-flight strand verdict ([#4719](https://github.com/dsj1984/mandrel/issues/4719)) ([a2edc9f](https://github.com/dsj1984/mandrel/commit/a2edc9f4465ca130b025deaaf12fb87174b242a4))
26
+
27
+
28
+ ### Changed
29
+
30
+ * **metrics:** single ledger-append implementation and clean close boundary (refs [#4712](https://github.com/dsj1984/mandrel/issues/4712)) ([#4715](https://github.com/dsj1984/mandrel/issues/4715)) ([a9b019b](https://github.com/dsj1984/mandrel/commit/a9b019b6c68e3874950728578e535e4614751553))
31
+
32
+ ## [2.9.0](https://github.com/dsj1984/mandrel/compare/mandrel-v2.8.0...mandrel-v2.9.0) (2026-07-21)
33
+
34
+
35
+ ### Added
36
+
37
+ * ceremony-lite path: complexity-gate the full plan/deliver pipeline for trivial scopes ([#4683](https://github.com/dsj1984/mandrel/issues/4683)) ([#4688](https://github.com/dsj1984/mandrel/issues/4688)) ([1002776](https://github.com/dsj1984/mandrel/commit/10027761c7bf375aa32b4ffe8b526015433311ca))
38
+ * harden /audit-to-stories dedup search: budget the fan-out, bound the query, soft-fail instead of aborting ([#4678](https://github.com/dsj1984/mandrel/issues/4678)) ([#4679](https://github.com/dsj1984/mandrel/issues/4679)) ([c043b70](https://github.com/dsj1984/mandrel/commit/c043b708dca9daf10525fe0e810da9b13998454b))
39
+ * **plan:** pre-empt deterministic body-format lints in the story-author prompt and auto-fix mechanical ones (refs [#4684](https://github.com/dsj1984/mandrel/issues/4684)) ([#4689](https://github.com/dsj1984/mandrel/issues/4689)) ([8dea7ad](https://github.com/dsj1984/mandrel/commit/8dea7adc71e9adcb746022747f3d436ccb520758))
40
+
41
+
42
+ ### Fixed
43
+
44
+ * land tail: tolerate/pre-empt a worktree-held story branch so a merged PR is never stranded at agent::blocked ([#4681](https://github.com/dsj1984/mandrel/issues/4681)) ([#4686](https://github.com/dsj1984/mandrel/issues/4686)) ([0436af0](https://github.com/dsj1984/mandrel/commit/0436af0ab183c6e423cf2b56e749d63fa0c6b150))
45
+ * root-cause and fix: second-touch change-request deliveries complete but their PR never lands ([#4682](https://github.com/dsj1984/mandrel/issues/4682)) ([#4687](https://github.com/dsj1984/mandrel/issues/4687)) ([2010739](https://github.com/dsj1984/mandrel/commit/20107399a9a1645c0d8b259245b275a965ffdcbc))
46
+
47
+
48
+ ### Performance
49
+
50
+ * **orchestration:** quiet hot-path script stdout to terse summaries (refs [#4685](https://github.com/dsj1984/mandrel/issues/4685)) ([#4690](https://github.com/dsj1984/mandrel/issues/4690)) ([310ee4a](https://github.com/dsj1984/mandrel/commit/310ee4a70726dee0ace6da8bb866cb01e57f7c2b))
51
+
5
52
  ## [2.8.0](https://github.com/dsj1984/mandrel/compare/mandrel-v2.7.0...mandrel-v2.8.0) (2026-07-21)
6
53
 
7
54
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mandrel",
3
- "version": "2.8.0",
3
+ "version": "2.10.0",
4
4
  "description": "Claude Code-first opinionated workflow framework: instructions, skills, rules, and SDLC workflows that govern AI coding assistants.",
5
5
  "files": [
6
6
  ".agents/",