mandrel 2.12.0 → 2.13.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.
- package/.agents/docs/workflows.md +2 -1
- package/.agents/scripts/deliver-light.js +385 -0
- package/.agents/scripts/lib/orchestration/complexity-gate.js +7 -4
- package/.agents/scripts/lib/orchestration/light-suitability.js +439 -0
- package/.agents/scripts/lib/orchestration/plan-context.js +256 -15
- package/.agents/scripts/plan-context.js +45 -3
- package/.agents/scripts/plan-persist.js +106 -9
- package/.agents/workflows/deliver-light.md +117 -0
- package/.agents/workflows/plan.md +66 -84
- package/docs/CHANGELOG.md +8 -0
- package/package.json +1 -1
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
---
|
|
2
|
+
description:
|
|
3
|
+
Single-session delivery for genuinely small work. Judges a prompt's
|
|
4
|
+
predicted footprint, authors a receipt Story, then lands it through the same
|
|
5
|
+
single-story-init / single-story-close engine — every close gate unchanged.
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# /deliver-light "<prompt>" | --amends '#<id>' "<prompt>"
|
|
9
|
+
|
|
10
|
+
> **Thin entry point, not a second engine.** `/deliver-light` removes the
|
|
11
|
+
> `/plan` session for small work — nothing else. It runs a suitability gate,
|
|
12
|
+
> authors a minimal receipt Story, then hands off to the SAME scripts
|
|
13
|
+
> [`/deliver`](deliver.md) uses. Read
|
|
14
|
+
> [`helpers/deliver-digest.md`](helpers/deliver-digest.md) once first — the
|
|
15
|
+
> engine invariants, gates, and terminal-envelope contract below are its.
|
|
16
|
+
|
|
17
|
+
## Role
|
|
18
|
+
|
|
19
|
+
For a genuinely trivial change — a one-file fix, a small addition, a small
|
|
20
|
+
amendment — the multi-session plan→deliver ceremony buys nothing the bare model
|
|
21
|
+
lacks except **gates and landing**. `/deliver-light` keeps exactly those: one
|
|
22
|
+
session straight to execution from an operator prompt, landing through the
|
|
23
|
+
unchanged close path. It never relaxes a close gate, never bypasses the PR to
|
|
24
|
+
`main`, and never lands over-scope work silently.
|
|
25
|
+
|
|
26
|
+
## Four invariants (do not skip one)
|
|
27
|
+
|
|
28
|
+
1. **Suitability gate.** The prompt's predicted footprint is judged by the
|
|
29
|
+
shared shape machinery (`deriveStoryShape` / `deriveChangeLevel`) **and** a
|
|
30
|
+
ledgered model verdict with a recorded reason. Both must agree on `lite`.
|
|
31
|
+
2. **Over-scope stops — it never hard-fails.** An over-ceiling prompt STOPS and
|
|
32
|
+
asks the operator to escalate to `/plan` or proceed light. Under `--yes` it
|
|
33
|
+
fails closed to recommending `/plan`.
|
|
34
|
+
3. **Diff-derived backstop.** After implementation the ACTUAL change set is
|
|
35
|
+
re-checked — the diff is the real scope signal — and an over-ceiling diff is
|
|
36
|
+
blocked rather than landed.
|
|
37
|
+
4. **Minimal receipt Story.** A `type::story` is authored inline so `refs #`,
|
|
38
|
+
history, telemetry, and the `agent::executing → agent::done` state machine
|
|
39
|
+
all survive.
|
|
40
|
+
|
|
41
|
+
## Procedure
|
|
42
|
+
|
|
43
|
+
1. **Predict + gate.** Form the predicted footprint (new files, edited files,
|
|
44
|
+
acceptance count) and your ledgered verdict (a recorded reason for `lite`),
|
|
45
|
+
then run the gate:
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
node .agents/scripts/deliver-light.js --prompt "<prompt>" \
|
|
49
|
+
--creates <csv> --refactors <csv> --acceptance <n> \
|
|
50
|
+
--route lite --reason "<why this is trivial>" [--amends '#<id>'] [--yes]
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Branch on `action` in the JSON envelope:
|
|
54
|
+
- **`proceed-light`** — the receipt Story is authored; read `storyId` and
|
|
55
|
+
`nextCommands`. Continue to step 2.
|
|
56
|
+
- **`ask-operator`** — predicted scope exceeds the light ceilings. STOP and
|
|
57
|
+
ask the operator to escalate to `/plan` or proceed light. Do not proceed
|
|
58
|
+
on your own.
|
|
59
|
+
- **`escalate-plan`** — over-scope under `--yes`: recommend `/plan` and stop.
|
|
60
|
+
`/deliver-light` never lands over-scope work.
|
|
61
|
+
|
|
62
|
+
`--amends '#<id>'` is the canonical light case — shape-checked identically; a
|
|
63
|
+
heavy amendment escalates to `/plan` like any other over-scope prompt.
|
|
64
|
+
|
|
65
|
+
2. **Init (same engine).** From the main checkout, synchronously, with the
|
|
66
|
+
maximum Bash timeout:
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
node .agents/scripts/single-story-init.js --story <storyId>
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
Capture `workCwd`; `remoteVerified: false` → flip `agent::blocked` and stop.
|
|
73
|
+
This is [`/deliver`](deliver.md)'s worktree/branch/lease/label engine,
|
|
74
|
+
invoked, not reimplemented.
|
|
75
|
+
|
|
76
|
+
3. **Implement + self-eval.** `cd` into `workCwd`, implement the change, run
|
|
77
|
+
`npm test` once in the worktree, then run the bounded acceptance self-eval
|
|
78
|
+
loop ([`helpers/deliver-story.md`](helpers/deliver-story.md) Step 1a). Commit
|
|
79
|
+
on `story-<id>` with `(refs #<storyId>)`.
|
|
80
|
+
|
|
81
|
+
4. **Diff backstop.** Before close, re-check the ACTUAL diff:
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
node .agents/scripts/deliver-light.js --backstop --story <storyId>
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
Exit `3` (`blocked: true`) means the landed diff exceeds the light ceilings
|
|
88
|
+
(file count or a sensitive-path class). STOP, flip `agent::blocked`, and
|
|
89
|
+
escalate to `/plan` — do not land.
|
|
90
|
+
|
|
91
|
+
5. **Close and land (same engine).** Exactly [`/deliver`](deliver.md)'s close:
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
node .agents/scripts/single-story-close.js --story <storyId> --cwd <main-repo>
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
Branch on the terminal envelope's `status` per
|
|
98
|
+
[`helpers/deliver-digest.md`](helpers/deliver-digest.md) § 5 — every close
|
|
99
|
+
gate runs byte-identical to the full path.
|
|
100
|
+
|
|
101
|
+
## Constraints
|
|
102
|
+
|
|
103
|
+
- **Land or block — never a silent local build.** The close push is the only
|
|
104
|
+
sanctioned landing.
|
|
105
|
+
- **No parallel engine.** `/deliver-light` invokes `single-story-init.js` and
|
|
106
|
+
`single-story-close.js`; it never reimplements worktree, branch, PR, or merge
|
|
107
|
+
mechanics.
|
|
108
|
+
- **State only via `update-ticket-state.js`.** Drive every `agent::*`
|
|
109
|
+
transition through the script; report state, not process.
|
|
110
|
+
|
|
111
|
+
## See also
|
|
112
|
+
|
|
113
|
+
- [`/deliver`](deliver.md) — the multi-Story / planned delivery entry point.
|
|
114
|
+
- [`helpers/deliver-story.md`](helpers/deliver-story.md) — the one Story
|
|
115
|
+
delivery engine both entry points share.
|
|
116
|
+
- [`helpers/deliver-digest.md`](helpers/deliver-digest.md) — engine invariants,
|
|
117
|
+
gates, and the terminal-envelope contract.
|
|
@@ -7,8 +7,7 @@ description:
|
|
|
7
7
|
|
|
8
8
|
# /plan --seed "<text>" | --seed-file <path> | --tickets <ids>
|
|
9
9
|
|
|
10
|
-
> **Lean spine.** Happy path + gate list; edge-case
|
|
11
|
-
> lives in the on-demand
|
|
10
|
+
> **Lean spine.** Happy path + gate list; edge-case detail lives in on-demand
|
|
12
11
|
> [`helpers/plan-reference.md`](helpers/plan-reference.md).
|
|
13
12
|
|
|
14
13
|
## Inputs
|
|
@@ -20,9 +19,9 @@ Epic/Story router, no scope-triage `epic|story` verdict:
|
|
|
20
19
|
| --- | --- |
|
|
21
20
|
| `/plan --seed "<text>"` / `--seed-file <path>` | Ideation from chat text or on-disk notes: interrogate → author **one Story by default** → persist. |
|
|
22
21
|
| `/plan --tickets 123[,456…]` | Fetch issue(s), analyze into proper Stories (prefer N=1 rewrite). |
|
|
22
|
+
| `/plan --amends #<id>` | Amend a shipped Story from a **delta envelope** (prior body + acceptance + delivered file map), not a from-scratch re-interrogation (#4741). |
|
|
23
23
|
|
|
24
|
-
`--body` is **not** a `/plan` entry; persist always goes through
|
|
25
|
-
`plan-persist.js`.
|
|
24
|
+
`--body` is **not** a `/plan` entry; persist always goes through `plan-persist.js`.
|
|
26
25
|
|
|
27
26
|
## Flags
|
|
28
27
|
|
|
@@ -30,23 +29,24 @@ Epic/Story router, no scope-triage `epic|story` verdict:
|
|
|
30
29
|
| --- | --- |
|
|
31
30
|
| `--seed "<text>"` / `--seed-file <path>` | Seed text / pre-authored notes path. |
|
|
32
31
|
| `--tickets <ids>` | Issue ids to analyze; closed as superseded at persist. |
|
|
32
|
+
| `--amends #<id>` | Prior Story to amend; emits a delta envelope, not a full re-interrogation (#4741). |
|
|
33
|
+
| `--chain-on-clean` | Persist: chain a clean lite dry-run into the real persist in one round-trip; full-route plans keep the review round-trip (#4741). |
|
|
33
34
|
| `--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 (
|
|
35
|
-
| `--route-downgrade-reason "<text>"` | Authored `lite` verdict + reason (
|
|
35
|
+
| `--force-review` | STOP at gate #2 for operator review — the only review gate (#4542). |
|
|
36
|
+
| `--route-downgrade-reason "<text>"` | Authored `lite` verdict + reason (#4722); shape-validated, fails closed to `full`. |
|
|
36
37
|
| `--allow-over-budget` | Permit a plan exceeding `maxTickets`. |
|
|
37
38
|
| `--yes` | Non-interactive: auto-proceed gate #1 and gate #2 HITL waits. |
|
|
38
39
|
| `--dry-run` | Author + validate without GitHub writes; run as a pre-pass. |
|
|
39
40
|
|
|
40
41
|
## Default-single split policy
|
|
41
42
|
|
|
42
|
-
Author **one Story** unless
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
profile — no Epic-scale ceremony.
|
|
43
|
+
Author **one Story** unless the pieces have **near-zero overlap** (genuinely
|
|
44
|
+
independent capabilities) or sit across an **architectural seam** (different
|
|
45
|
+
deployables, migration vs consumer). Coupled work stays one Story —
|
|
46
|
+
`## Slicing` intra-session checkpoints, not sibling tickets; when N>1 every
|
|
47
|
+
acceptance criterion belongs to exactly one Story
|
|
48
|
+
(`assertAcceptancePartition` refuses coupled splits). **N=1 is the lean
|
|
49
|
+
path:** one authoring prompt, folded `## Spec`, no Epic-scale ceremony.
|
|
50
50
|
|
|
51
51
|
## Procedure
|
|
52
52
|
|
|
@@ -55,69 +55,52 @@ profile — no Epic-scale ceremony.
|
|
|
55
55
|
```bash
|
|
56
56
|
node .agents/scripts/plan-context.js --seed "<seed>" \
|
|
57
57
|
--out temp/plan-<slug>/plan-context.json
|
|
58
|
-
# or: --seed-file <path>
|
|
59
|
-
# or: --tickets 123,456
|
|
58
|
+
# or: --seed-file <path> | --tickets 123,456 | --amends #<id>
|
|
60
59
|
```
|
|
61
60
|
|
|
62
|
-
**Always pass `--out`.** Persist auto-discovers that envelope from
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
Under `--yes`, do not ask free-form operator questions — unresolved
|
|
75
|
-
unknowns land in Key Assumptions.
|
|
61
|
+
**Always pass `--out`.** Persist auto-discovers that envelope from `--plan-dir`
|
|
62
|
+
and derives source-ticket ids from its `sourceTickets[]` (#4554); the CLI also
|
|
63
|
+
writes **`stories.template.json`** — the authoring skeleton step 2 starts from.
|
|
64
|
+
|
|
65
|
+
The envelope carries docs context, the codebase snapshot, the story-author
|
|
66
|
+
prompt, `sourceTickets[]`, `duplicates[]` (open **Stories**, never Epics), and
|
|
67
|
+
advisory `complexitySignals` (**no routing authority**, #4722). A trivial scope
|
|
68
|
+
earns `--route-downgrade-reason "<why>"` at persist — shape-validated, failing
|
|
69
|
+
closed to `full`
|
|
70
|
+
([detail](helpers/plan-reference.md)).
|
|
71
|
+
Under `--yes`, do not ask free-form operator questions — unresolved unknowns
|
|
72
|
+
land in Key Assumptions.
|
|
76
73
|
|
|
77
74
|
**Gate #1** — STOP to confirm the sharpened plan intent and any
|
|
78
|
-
duplicate-candidate review. Under `--yes`, auto-proceed.
|
|
75
|
+
duplicate-candidate review. Under `--yes`, auto-proceed. When
|
|
76
|
+
`complexitySignals.deliverLightSuggestion.suggested` is `true`, surface an
|
|
77
|
+
**advisory** `/deliver-light` suggestion — the operator decides; under `--yes`
|
|
78
|
+
it is recorded and planning proceeds, **never an automatic reroute** (#4741).
|
|
79
79
|
|
|
80
80
|
### 2. Author
|
|
81
81
|
|
|
82
82
|
**One-shot authoring (Story #4707).** Start from `stories.template.json`;
|
|
83
83
|
author `stories.json` in one pass. Entries are pre-resolved (#4723); keep
|
|
84
|
-
tiers/assumptions valid. `body` is a
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
[
|
|
92
|
-
|
|
93
|
-
"slug": "hyphen-case-slug", // ^[a-z0-9][a-z0-9-]*$
|
|
94
|
-
"type": "story",
|
|
95
|
-
"title": "Short descriptive title",
|
|
96
|
-
"body": {
|
|
97
|
-
"goal": "One sentence: why this Story exists.",
|
|
98
|
-
"spec": "Optional — contract and invariants.",
|
|
99
|
-
"changes": [{ "path": "path/to/file.ext", "assumption": "refactors-existing" }], // creates | refactors-existing | deletes
|
|
100
|
-
"non_goals": [],
|
|
101
|
-
"reason_to_exist": "One coherent reason this Story exists."
|
|
102
|
-
},
|
|
103
|
-
"acceptance": ["A testable, observable criterion"],
|
|
104
|
-
"verify": ["exact command (unit|contract|e2e|validate)"],
|
|
105
|
-
"depends_on": [] // sibling Story slugs, N>1 only
|
|
106
|
-
}
|
|
107
|
-
]
|
|
108
|
-
```
|
|
84
|
+
tiers/assumptions valid. `body` is a markdown string **or** a structured
|
|
85
|
+
object; persist parses either, serializes the canonical markdown, and syncs the
|
|
86
|
+
top-level `acceptance[]` / `verify[]` into it — never dual-author those lists.
|
|
87
|
+
|
|
88
|
+
Each entry (the `stories.template.json` shape): `slug`
|
|
89
|
+
(`^[a-z0-9][a-z0-9-]*$`), `type: "story"`, `title`, `body` (`goal`, optional
|
|
90
|
+
`spec`, `changes[{path, assumption}]` — `creates|refactors-existing|deletes`,
|
|
91
|
+
`non_goals`, `reason_to_exist`), top-level `acceptance[]`, `verify[]`
|
|
92
|
+
(`… (unit|contract|e2e|validate)`), `depends_on[]` (N>1 only).
|
|
109
93
|
|
|
110
94
|
Artifacts under `temp/plan-<slug>/`: `stories.json`
|
|
111
95
|
(**length 1 by default**; over-budget Specs fail closed — split or tighten,
|
|
112
|
-
never
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
Split only under the policy above.
|
|
96
|
+
never under `docs/`); optional `techspec.md` (**N===1 only** — folded into
|
|
97
|
+
`## Spec`); optional `acceptance-manifest.json` (N>1 partition list — pass as
|
|
98
|
+
`--plan-acceptance`). For N=1, use the envelope `systemPrompts.story` and emit
|
|
99
|
+
one cohesive Story. Split only under the policy above.
|
|
117
100
|
|
|
118
|
-
**Tickets mode:** every Story authors a top-level `supersedes[]` claiming
|
|
119
|
-
|
|
120
|
-
[
|
|
101
|
+
**Tickets mode:** every Story authors a top-level `supersedes[]` claiming the
|
|
102
|
+
source issues it replaces; persist refuses a partial map
|
|
103
|
+
([shape](helpers/plan-reference.md)).
|
|
121
104
|
|
|
122
105
|
### 2.5 Critics
|
|
123
106
|
|
|
@@ -147,9 +130,9 @@ ledgered: **do not proceed to Persist**; fix and re-run.
|
|
|
147
130
|
**only** trigger). Under `--yes`, auto-proceed.
|
|
148
131
|
|
|
149
132
|
Run persist with `--dry-run` **first** — same command, GitHub writes
|
|
150
|
-
suppressed; every gate (
|
|
151
|
-
|
|
152
|
-
|
|
133
|
+
suppressed; every gate (validator, body parse, DAG, capacity, budget,
|
|
134
|
+
reachability, split/supersede partitions, Spec fold) runs before the first
|
|
135
|
+
`createIssue`. Then:
|
|
153
136
|
|
|
154
137
|
```bash
|
|
155
138
|
node .agents/scripts/plan-persist.js \
|
|
@@ -160,30 +143,29 @@ node .agents/scripts/plan-persist.js \
|
|
|
160
143
|
[--source-tickets 123,456] [...flags from the table above]
|
|
161
144
|
```
|
|
162
145
|
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
(
|
|
146
|
+
At lite shape, `--chain-on-clean` chains that dry-run into the real persist in
|
|
147
|
+
one round-trip **only** when it is clean and `lite`; a full-route plan keeps
|
|
148
|
+
its review round-trip (#4741).
|
|
149
|
+
|
|
150
|
+
Persist creates `type::story` issue(s) plus a `plan-run::<id>` grouping label
|
|
151
|
+
(**metadata only**, #4692); N>1 `depends_on` edges become `blocked by #<id>`
|
|
152
|
+
footers. `agent::ready` is the **terminal** flip after all receipts land — a
|
|
153
|
+
ready Story is fully persisted (#4541). stdout is pure JSON.
|
|
168
154
|
|
|
169
|
-
In `--tickets` mode persist resolves source ids **envelope-first** and
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
persist, re-run the same command; never hand-delete issues.
|
|
155
|
+
In `--tickets` mode persist resolves source ids **envelope-first** and closes
|
|
156
|
+
each as `not_planned` with a comment (default on;
|
|
157
|
+
[detail](helpers/plan-reference.md)). On a stranded persist, re-run the same
|
|
158
|
+
command — never hand-delete issues.
|
|
174
159
|
|
|
175
160
|
## Constraints
|
|
176
161
|
|
|
177
|
-
- `/plan` never starts delivery
|
|
178
|
-
`
|
|
179
|
-
- Duplicate search targets open Stories (`type::story`), not Epics.
|
|
162
|
+
- `/plan` never starts delivery — no Epic ticket, no reconciler. Duplicate
|
|
163
|
+
search targets open Stories (`type::story`), not Epics.
|
|
180
164
|
- Deterministic gates still fail closed under `--yes`.
|
|
181
165
|
|
|
182
166
|
## See also
|
|
183
167
|
|
|
184
|
-
- [`/deliver`](deliver.md)
|
|
185
|
-
|
|
186
|
-
- [`helpers/plan-reference.md`](helpers/plan-reference.md) — on-demand
|
|
187
|
-
detail.
|
|
168
|
+
- [`/deliver`](deliver.md), [`/audit-to-stories`](audit-to-stories.md),
|
|
169
|
+
[`helpers/plan-reference.md`](helpers/plan-reference.md) — on-demand detail.
|
|
188
170
|
- [`core/scope-triage`](../skills/core/scope-triage/SKILL.md) — optional
|
|
189
171
|
split-advisory notes only (no routing verdict).
|
package/docs/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
|
|
5
|
+
## [2.13.0](https://github.com/dsj1984/mandrel/compare/mandrel-v2.12.0...mandrel-v2.13.0) (2026-07-24)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Added
|
|
9
|
+
|
|
10
|
+
* **orchestration:** add /deliver-light — validated single-session delivery with full gates (refs [#4740](https://github.com/dsj1984/mandrel/issues/4740)) ([#4742](https://github.com/dsj1984/mandrel/issues/4742)) ([605c20b](https://github.com/dsj1984/mandrel/commit/605c20b5ce9c17c6dc7c40356a2e496bb2f25a44))
|
|
11
|
+
* plan-phase turn diet: same artifacts, fewer round-trips, amendment-aware envelope ([#4741](https://github.com/dsj1984/mandrel/issues/4741)) ([#4744](https://github.com/dsj1984/mandrel/issues/4744)) ([65b6790](https://github.com/dsj1984/mandrel/commit/65b67900ae58aea8a15e8a96e28895b1283df079))
|
|
12
|
+
|
|
5
13
|
## [2.12.0](https://github.com/dsj1984/mandrel/compare/mandrel-v2.11.0...mandrel-v2.12.0) (2026-07-24)
|
|
6
14
|
|
|
7
15
|
|
package/package.json
CHANGED