mandrel 2.21.0 → 2.22.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 (38) hide show
  1. package/.agents/README.md +1 -1
  2. package/.agents/agents/story-worker.md +5 -0
  3. package/.agents/instructions.md +14 -17
  4. package/.agents/rules/git-conventions.md +1 -1
  5. package/.agents/rules/known-tooling-behavior.md +114 -0
  6. package/.agents/scripts/check-context-budget.js +134 -2
  7. package/.agents/scripts/lib/audit-suite/selector.js +275 -162
  8. package/.agents/scripts/lib/config/temp-paths.js +51 -7
  9. package/.agents/scripts/lib/feedback-loop/graduator-core.js +604 -57
  10. package/.agents/scripts/lib/feedback-loop/retro-proposals-graduator.js +72 -21
  11. package/.agents/scripts/lib/label-constants.js +12 -1
  12. package/.agents/scripts/lib/observability/runtime-friction.js +13 -1
  13. package/.agents/scripts/lib/observability/signals-writer.js +133 -14
  14. package/.agents/scripts/lib/observability/source-classifier.js +131 -1
  15. package/.agents/scripts/lib/orchestration/code-review.js +12 -0
  16. package/.agents/scripts/lib/orchestration/complexity-gate.js +51 -46
  17. package/.agents/scripts/lib/orchestration/resolve-stories.js +17 -14
  18. package/.agents/scripts/lib/orchestration/retro-proposals.js +0 -0
  19. package/.agents/scripts/lib/orchestration/review-providers/degraded-gates.js +222 -0
  20. package/.agents/scripts/lib/orchestration/review-providers/findings-renderer.js +18 -3
  21. package/.agents/scripts/lib/orchestration/review-providers/native.js +82 -126
  22. package/.agents/scripts/lib/orchestration/review-providers/review-provider-factory.js +10 -0
  23. package/.agents/scripts/lib/orchestration/review-providers/scoped-lint.js +300 -0
  24. package/.agents/scripts/lib/orchestration/run-epilogue.js +51 -1
  25. package/.agents/scripts/lib/orchestration/single-story-close/phases/code-review.js +18 -8
  26. package/.agents/scripts/lib/orchestration/single-story-close/phases/review-outcome.js +66 -0
  27. package/.agents/scripts/lib/orchestration/story-close/phases/code-review.js +5 -1
  28. package/.agents/scripts/lib/orchestration/story-follow-ups.js +305 -10
  29. package/.agents/scripts/lib/story-body/story-body.js +248 -174
  30. package/.agents/scripts/resolve-stories.js +52 -33
  31. package/.agents/scripts/single-story-confirm-merge.js +5 -7
  32. package/.agents/workflows/helpers/deliver-digest.md +8 -6
  33. package/.agents/workflows/helpers/deliver-reference.md +15 -12
  34. package/.agents/workflows/helpers/deliver-story-reference.md +23 -21
  35. package/.agents/workflows/helpers/deliver-story.md +2 -2
  36. package/.agents/workflows/helpers/plan-reference.md +5 -4
  37. package/docs/CHANGELOG.md +20 -0
  38. package/package.json +1 -1
@@ -61,23 +61,26 @@ a cache write at full rate; an inline continuation is a cache read at ~10%).
61
61
  retained in full for multi-Story waves, and the rule changes **where** the
62
62
  engine runs, never what runs — gates, PR, and terminal envelope are identical.
63
63
 
64
- **Lite-shaped Stories execute inline.** Before spawning anything,
65
- read the Story's `dispatchMode` from the resolver envelope
66
- (`stories[].dispatchMode`, derived by `resolveStoryDispatchMode` in
67
- `lib/orchestration/complexity-gate.js` **from the fetched Story body's own
68
- shape** `changes[]` count, acceptance count, creates-vs-refactors mix, and
69
- sensitive-path classes; the `route::lite` label is a human-visible hint only,
70
- never the control signal, so a lost or never-written label cannot misroute
71
- delivery): a Story with `dispatchMode: "inline"` executes
72
- [`deliver-story.md`](deliver-story.md) **inline in this session** — no
64
+ **Read the mode; never infer it from shape.** Before spawning
65
+ anything, read the Story's `dispatchMode` from the resolver envelope
66
+ (`stories[].dispatchMode`, produced by `resolveStoryDispatchMode` in
67
+ `lib/orchestration/complexity-gate.js`). A Story with `dispatchMode: "inline"`
68
+ executes [`deliver-story.md`](deliver-story.md) **inline in this session** no
73
69
  `story-worker` sub-agent boot and no fresh acceptance-critic sub-agents
74
70
  (sub-agent boots are the dominant deliver-phase token cost at trivial scope) —
75
71
  threading the same `docsDigestPath` / `checklistPath` / change-set discipline
76
72
  as a spawned worker. Inline removes model-side fan-out only: every
77
73
  `single-story-close.js` gate, the PR to `main`, and the terminal envelope are
78
- identical. Everything else — a full-shaped body, a missing/unparseable body,
79
- or a footprint intersecting a sensitive-path class (sensitivity wins and
80
- keeps the fresh acceptance critic) takes the standard sub-agent path.
74
+ identical.
75
+
76
+ **A trivial shape does not buy that session.** Only the
77
+ one-Story rule above yields `inline`; every Story of a multi-Story run comes
78
+ back `subagent` however lite its body, because the ready set below may offer
79
+ several Stories on one beat and a session cannot be split between them. The
80
+ Story's derived shape is still reported (it sets ceremony, and a sensitive
81
+ footprint keeps the fresh acceptance critic), and the `route::lite` label
82
+ remains a human-visible hint only, never the control signal — a lost or
83
+ never-written label cannot misroute delivery.
81
84
 
82
85
  **Dispatch each `ready` Story (role-scoped by default).** When
83
86
  `delivery.routing.roleScopedAgents` is enabled (the **default**) and the host
@@ -133,23 +133,25 @@ and the `rules/security-baseline.md` MUSTs all run exactly as for a
133
133
  full-ceremony Story. The lite route's `preserves` field is the machine-readable
134
134
  record of those non-negotiables; there is no lite-specific gate bypass.
135
135
 
136
- **Deliver derives the route from the Story body's shape.**
137
- Persist stamps a lite cohort's Stories with the `route::lite` label as a
138
- *human-visible hint only* (and ledgers the authored verdict — recorded
139
- reason plus per-Story shape evidence — on the `story-plan-state`
140
- checkpoint); the label is never the control signal. `/deliver` computes the
141
- route from the fetched Story body via `resolveStoryDispatchMode`
142
- (`lib/orchestration/complexity-gate.js`) — the same shape taxonomy
143
- `deriveChangeLevel` applies to the landed diff at close: `changes[]` count,
144
- acceptance count, creates-vs-refactors mix, sensitive-path classes. A
145
- lite-shaped Story executes **inline in the deliver session** even when the
146
- label is absent or its write failed with no `story-worker` sub-agent boot,
147
- and the Step 1a acceptance self-eval runs its critics **inline** (no
148
- fresh-context acceptance-critic sub-agent dispatch; sub-agent boots are the
149
- dominant deliver-phase token cost at trivial scope). A footprint
150
- intersecting a sensitive-path class derives `full` sensitivity wins, and
151
- the Story keeps its fresh acceptance critic. Inline execution
152
- changes the isolation only: the engine, every script gate, and the
136
+ **Deliver derives the route from the Story body's shape — and the
137
+ dispatch mode from the run.** Persist stamps a lite cohort's Stories with the
138
+ `route::lite` label as a *human-visible hint only* (and ledgers the authored
139
+ verdict — recorded reason plus per-Story shape evidence — on the
140
+ `story-plan-state` checkpoint); the label is never the control signal.
141
+ `/deliver` computes the route from the fetched Story body via
142
+ `resolveStoryDispatchMode` (`lib/orchestration/complexity-gate.js`) — the same
143
+ shape taxonomy `deriveChangeLevel` applies to the landed diff at close:
144
+ `changes[]` count, acceptance count, creates-vs-refactors mix, sensitive-path
145
+ classes. A footprint intersecting a sensitive-path class derives `full`
146
+ sensitivity wins, and the Story keeps its fresh acceptance critic.
147
+
148
+ That derived route sets ceremony. It does **not** set the dispatch mode,
149
+ because `inline` names one indivisible resource the router's own session —
150
+ and only run topology can say whether it is free: a **single-Story run**
151
+ executes inline, and every Story of a multi-Story run dispatches as a
152
+ `story-worker` sub-agent whatever its shape a lite shape makes the work
153
+ cheap, it does not conjure a second session for a sibling. Inline
154
+ execution changes the isolation only: the engine, every script gate, and the
153
155
  terminal envelope are byte-identical either way.
154
156
 
155
157
  ---
@@ -247,10 +249,10 @@ Resolve fresh-vs-inline acceptance critics per AC-cluster with
247
249
  floor forces `fresh`). Review depth reads the same derived level via
248
250
  `review-depth.js` inside close, so the two decisions cannot disagree.
249
251
 
250
- **Lite-route override.** When the Story's body derives the
251
- lite shape (`resolveStoryDispatchMode` → `inline`), run every
252
- acceptance critic **inline** — do not spawn fresh-context critic sub-agents
253
- regardless of what the profile would otherwise resolve. The self-eval rigor
252
+ **Inline-dispatch override.** When the Story dispatches
253
+ `inline` (`resolveStoryDispatchMode` → `inline`, i.e. a single-Story run), run
254
+ every acceptance critic **inline** — do not spawn fresh-context critic
255
+ sub-agents regardless of what the profile would otherwise resolve. The self-eval rigor
254
256
  (scoring each `acceptance[]` item against the one computed change set, with
255
257
  `verify[]` output as evidence) is unchanged; only the sub-agent boot is
256
258
  removed. Hard gates are untouched.
@@ -22,8 +22,8 @@ mandatoryReads: [deliver-digest.md]
22
22
 
23
23
  ## Overview
24
24
 
25
- The **one** delivery engine in v2 — every Story (a lite-**shaped** Story
26
- runs inline with inline critics; engine, gates, envelope byte-identical):
25
+ The **one** delivery engine in v2 — every Story (a **one-Story** run
26
+ goes inline with inline critics; engine, gates, envelope byte-identical):
27
27
 
28
28
  ```text
29
29
  single-story-init.js → implement + commits → derived-level ceremony
@@ -120,10 +120,11 @@ decision:
120
120
  lite cohort's Stories with **`route::lite`** as a *human-visible hint only* —
121
121
  `/deliver` computes the route from each fetched Story body via the same shape
122
122
  function at dispatch, so neither a lost label nor an unread marker can
123
- misroute delivery: a lite-shaped Story executes **inline** (no story-worker
124
- or acceptance-critic sub-agent boots) even with the label absent, and a
125
- sensitive-footprint Story routes `full` and keeps its fresh critic even with
126
- the label present. The `route::*` axis stays runtime-derived: hand-authored
123
+ misroute delivery: a lite-shaped Story derives `lite` even with the label
124
+ absent, and a sensitive-footprint Story routes `full` and keeps its fresh
125
+ critic even with the label present. The derived route sets ceremony, not
126
+ where the engine runs sub-agent boots are collapsed by a **single-Story
127
+ run**, never by a trivial shape. The `route::*` axis stays runtime-derived: hand-authored
127
128
  `route::*` entries in `labels[]` are dropped by persist.
128
129
 
129
130
  The knobs (`planning.complexityGate.{enabled, maxArtifacts}`) are documented
package/docs/CHANGELOG.md CHANGED
@@ -2,6 +2,26 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file.
4
4
 
5
+ ## [2.22.0](https://github.com/dsj1984/mandrel/compare/mandrel-v2.21.0...mandrel-v2.22.0) (2026-07-30)
6
+
7
+
8
+ ### Fixed
9
+
10
+ * **context-budget:** hold agentBoot baseline rows in sync with the tree (refs [#4830](https://github.com/dsj1984/mandrel/issues/4830)) ([#4831](https://github.com/dsj1984/mandrel/issues/4831)) ([8a14f8b](https://github.com/dsj1984/mandrel/commit/8a14f8b85951819ef391382355fa2ba4d7998d43))
11
+ * correct the always-on instruction spine and give its budget one honest definition (refs [#4821](https://github.com/dsj1984/mandrel/issues/4821)) ([#4822](https://github.com/dsj1984/mandrel/issues/4822)) ([436d7f0](https://github.com/dsj1984/mandrel/commit/436d7f05d36bd35a6b1a934f19e9a85b37b69f93))
12
+ * feedback-loop: give an auto-filed issue a stable identity, an actionable body, and no path to the live API from a test ([#4837](https://github.com/dsj1984/mandrel/issues/4837)) ([#4838](https://github.com/dsj1984/mandrel/issues/4838)) ([43bbf57](https://github.com/dsj1984/mandrel/commit/43bbf578fc129c9b15ad068925722732fd264c7f))
13
+ * make an inline dispatch verdict mean the engine can actually run inline (refs [#4829](https://github.com/dsj1984/mandrel/issues/4829)) ([#4832](https://github.com/dsj1984/mandrel/issues/4832)) ([f554830](https://github.com/dsj1984/mandrel/commit/f55483085eb201aa126275bb0ed6250fc5a452a3))
14
+ * make the framework limb of the feedback loop reachable (refs [#4824](https://github.com/dsj1984/mandrel/issues/4824)) ([#4827](https://github.com/dsj1984/mandrel/issues/4827)) ([91816a2](https://github.com/dsj1984/mandrel/commit/91816a2dceda127a0cdf1ad3f48f53d7770cbf0b))
15
+ * make the friction roll-up file its proposals and make an all-empty result legible (refs [#4828](https://github.com/dsj1984/mandrel/issues/4828)) ([#4835](https://github.com/dsj1984/mandrel/issues/4835)) ([c017f9a](https://github.com/dsj1984/mandrel/commit/c017f9a9145122b15e41b55a9126a35171f3f1b9))
16
+ * review: stop the scoped-lint gate failing open silently, and fix why its runner cannot execute ([#4839](https://github.com/dsj1984/mandrel/issues/4839)) ([#4840](https://github.com/dsj1984/mandrel/issues/4840)) ([8f3f007](https://github.com/dsj1984/mandrel/commit/8f3f0072abef020439d555af698829ebfc8900f8))
17
+ * rules: ship a known-tooling-behavior rule so measured gate quirks stop being rediscovered per session ([#4825](https://github.com/dsj1984/mandrel/issues/4825)) ([#4826](https://github.com/dsj1984/mandrel/issues/4826)) ([2c20403](https://github.com/dsj1984/mandrel/commit/2c2040318055026307518de57b1433c11c56efc1))
18
+ * **test:** probe bins on either path separator so [#4839](https://github.com/dsj1984/mandrel/issues/4839)'s tests pass on Windows ([#4841](https://github.com/dsj1984/mandrel/issues/4841)) ([98e6048](https://github.com/dsj1984/mandrel/commit/98e6048774b7483717931d0b4a63179800815941))
19
+
20
+
21
+ ### Changed
22
+
23
+ * restore clean-code gate headroom: cover CRAP-capacity shells, flatten selectAudits, table-drive story-body parsing ([#4842](https://github.com/dsj1984/mandrel/issues/4842)) ([#4843](https://github.com/dsj1984/mandrel/issues/4843)) ([cc5dc5e](https://github.com/dsj1984/mandrel/commit/cc5dc5e7eaf423612495441f0f8f9007dbb9b8a4))
24
+
5
25
  ## [2.21.0](https://github.com/dsj1984/mandrel/compare/mandrel-v2.20.0...mandrel-v2.21.0) (2026-07-28)
6
26
 
7
27
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mandrel",
3
- "version": "2.21.0",
3
+ "version": "2.22.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/",