@gtrabanco/pi-agentic-workflow 0.19.0 → 0.20.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/README.md CHANGED
@@ -246,9 +246,13 @@ dialog.
246
246
 
247
247
  ## Notes
248
248
 
249
- - Verified against Pi 0.99.1 (2026-09-29) (`pi install`, package skills, friendly
249
+ - Verified against the peer floor Pi 0.99.1 (2026-09-29) (`pi install`, package skills, friendly
250
250
  command registration, routed set/clear, settings console round-trip, `sendUserMessage`
251
- with prompt template expansion).
251
+ with prompt template expansion). Also verified against Pi 1.2.0 (2026-10-14) via a local
252
+ two-leg `tsc --noEmit` run (legs `0.99.1` + `latest`, the `latest` leg resolving to pi
253
+ 1.2.0; COMPAT-OK); continuously against the
254
+ `latest` dist-tag by the `pi-compat-guard` PR gate (the leg is a moving tripwire,
255
+ not a pinned version — a breaking release shows red here first).
252
256
  - The package declares Pi as a peer dependency; it bundles no copy of Pi.
253
257
  - Skills can instruct the model to run commands. Review them as you would any
254
258
  third-party package.
@@ -284,12 +284,16 @@ export default function extension(pi) {
284
284
  });
285
285
  return decision.block ? { block: true, reason: decision.reason } : undefined;
286
286
  });
287
- pi.on("agent_settled", (_event, ctx) => {
288
- void router.settle(toInvocationContext(ctx));
287
+ pi.on("agent_settled", (event, ctx) => {
288
+ // pi 1.1.0+: event may carry { aborted: true }
289
+ const aborted = event?.aborted === true;
290
+ void router.settle(toInvocationContext(ctx), aborted);
289
291
  // Terminal hygiene is said out loud once the turn is over; a clean tree
290
292
  // stays silent. The probe is time-bounded (2000 ms) and swallows timeout,
291
293
  // spawn error and non-zero status, so an unresponsive git can never park
292
294
  // the settled turn — best-effort by construction (issue #182 F4).
295
+ // The dirty-worktree warning still fires on abort (an aborted run is exactly
296
+ // when half-applied edits can be left behind).
293
297
  const warning = guards.dirtyWorktreeWarning(readGitStatusBounded(ctx.cwd));
294
298
  if (warning)
295
299
  ctx.ui.notify(warning, "warning");
@@ -29,7 +29,7 @@ export interface Router<M extends ModelRef = ModelRef> {
29
29
  /** Pi `thinking_level_select` — same distinction for the thinking level. */
30
30
  noteThinkingLevelSelect(level: ThinkingLevel): void;
31
31
  /** Pi `agent_settled` — restores whatever this turn still owns. */
32
- settle(ctx: InvocationContext<M>): Promise<void>;
32
+ settle(ctx: InvocationContext<M>, aborted?: boolean): Promise<void>;
33
33
  /** True while a routed turn owns the session. The console shows and clears it. */
34
34
  inFlight(): boolean;
35
35
  /**
@@ -79,13 +79,20 @@ export function createRouter({ surface, loadConfig, hint, settingsCommand, known
79
79
  await restore(turn, surface(ctx), ctx, `undo: nothing was dispatched by /${turn.command}`);
80
80
  return true;
81
81
  },
82
- async settle(ctx) {
82
+ async settle(ctx, aborted) {
83
83
  const turn = pending;
84
84
  if (!turn)
85
85
  return;
86
86
  // Cleared first: the restore fires its own select events, and a turn that is
87
87
  // already over must not read them as operator changes.
88
88
  pending = undefined;
89
+ // `aborted`: pi 1.1.0 added `agent_settled.aborted` to distinguish a
90
+ // cancelled run from a finished one. An aborted turn is cleared without
91
+ // restoring the snapshot — an interrupted run must not silently swap the
92
+ // session model underneath the operator, matching the backing-off stance
93
+ // for an operator mid-turn change (AC7, pi 1.1.0 scope extension).
94
+ if (aborted)
95
+ return;
89
96
  // `keep`: leave the routed model and thinking level in the open chat window,
90
97
  // so a follow-up edit or question keeps running on the model that planned it.
91
98
  // The operator's own mid-turn choice is still untouched (nothing is restored,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gtrabanco/pi-agentic-workflow",
3
- "version": "0.19.0",
3
+ "version": "0.20.0",
4
4
  "description": "Pi package: canonical agentic-workflow skills, friendly slash commands, and per-command model routing.",
5
5
  "keywords": [
6
6
  "pi-package",
@@ -58,7 +58,7 @@
58
58
  },
59
59
  "dependencies": {
60
60
  "@gtrabanco/agentic-workflow": "0.2.0",
61
- "@gtrabanco/agentic-workflow-schema": "4.5.0"
61
+ "@gtrabanco/agentic-workflow-schema": "4.6.0"
62
62
  },
63
63
  "devDependencies": {
64
64
  "@types/node": "24.13.3",
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: audit-pr
3
3
  user-invocable: true
4
- version: 5.4.0
4
+ version: 5.6.0
5
5
  argument-hint: <pr-number> (optional — defaults to the current branch's PR)
6
6
  author: "Gabriel Trabanco <1969593+gtrabanco@users.noreply.github.com>"
7
7
  license: MIT
@@ -120,9 +120,20 @@ gh pr view <N> --json headRefOid,comments
120
120
  review evidence, then evaluate the delivery gates below.
121
121
  - **absent** — no matching marker on the PR → **BLOCKER**: no review evidence at
122
122
  the head; route to `/review-change`.
123
- - **stale** — a marker exists but its `sha` does not equal `headRefOid`. Any SHA
124
- mismatch voids the receipt → **BLOCKER**: route to `/review-change` for a
125
- re-review. Do not use a local `git diff` to override the PR-head comparison.
123
+ - **stale** — a marker exists but its `sha` does not equal `headRefOid`. Before
124
+ voiding, apply the scope-aware judge (fix/286, #182 AC 3/9): a receipt that
125
+ recorded a scope manifest (`scope=<64-hex>` in the marker) stays **current**
126
+ when the head delta (receipt sha → head, `git diff --name-only`) touches only
127
+ non-affecting paths — the closed classes (session log `docs/LOGS.md`, agent
128
+ toolstate/memory `.engram/`, `.pi/`, `.serena/`) are owned by
129
+ `scripts/scope-manifest.mjs`; any path matching no named class is affecting.
130
+ Run `bun scripts/review-receipt.mjs verify --pr <N>` — it computes the delta
131
+ locally and answers `current` (exit 0) or `stale` (exit 4, naming the
132
+ affecting paths). A legacy receipt without a scope attribute, an affecting
133
+ delta, or an unresolvable delta voids the receipt → **BLOCKER**: route to
134
+ `/review-change` for a re-review. Do not use a local `git diff` to override
135
+ the PR-head comparison — the delta check only ever *keeps* a scoped receipt
136
+ current; it never manufactures currency for a scope-less one.
126
137
 
127
138
  Never compose, reconstruct, or "spot-check" the review from the diff to clear a
128
139
  missing/stale receipt — that is `review-change`'s turn, and re-litigating axes
@@ -88,16 +88,57 @@ This gate sits downstream of both pre-execution reviews, so it verifies their
88
88
  authority **survived the build** — it never re-reviews a plan and never re-judges a
89
89
  verdict:
90
90
 
91
- 1. **Upstream lineage is current.** The unit's `progress.md` carries
92
- `## Pre-execution review receipt v1 — plan` whose digest re-derives identically
93
- (`scripts/pre-execution-snapshot.mjs verify --stage plan --parent <the receipt's
94
- Product digest>`; a fix unit binds no parent —
95
- `structural.reasonCode`/`changedPaths` name the drifted dimension), and — for a
96
- feature unit — its named `— spec` parent re-derives the same way. Bound artifacts
97
- are frozen: new implementation-phase files are allowed, edits to a bound artifact
98
- are not. Stale, missing, wrong-stage **or impossible-timeline** lineage → **BLOCKED**,
99
- `→ Next: /unit-lane <unit>` (the lane's `review` step re-derives the artifact). A `SPEC-REVIEW-PASS` never satisfies the plan hop, and vice versa.
100
- 2. **Obligations are closed.** Every row of the unit's obligation ledger is
91
+ 1. **Upstream lineage is current** — run the machine check and read its fixed
92
+ verdict; the gate never re-implements the check by hand:
93
+ `bun scripts/unit-lineage.mjs --unit <unit>` prints exactly one of
94
+ `LINEAGE OK — legacy …` / `LINEAGE OK — lane-era …` (pass) or
95
+ `LINEAGE BLOCKED — <reason>` followed by a `→ Next:` route (**BLOCKED** —
96
+ that route). The check keys the lane-era/legacy split on evidence, not on an
97
+ author-controlled artifact (fix/285; the lane-era pipeline structurally never
98
+ writes `progress.md` or `ACCEPTANCE.md`, so demanding them made the gate
99
+ unsatisfiable for every lane-era unit — issue #285):
100
+ - **Legacy path** — opened only when the unit's `progress.md` carries a
101
+ `## Pre-execution review receipt v1 — plan` whose digest **re-derives**
102
+ (`scripts/pre-execution-snapshot.mjs verify --stage plan` exits 0 over the
103
+ bound bytes): the unit's
104
+ `progress.md` carries
105
+ `## Pre-execution review receipt v1 — plan` whose digest re-derives
106
+ identically (`scripts/pre-execution-snapshot.mjs verify --stage plan
107
+ --parent <the receipt's Product digest>`; a fix unit binds no parent —
108
+ `structural.reasonCode`/`changedPaths` name the drifted dimension), and —
109
+ for a feature unit — its named `— spec` parent re-derives the same way.
110
+ The acceptance manifest binds when present (fix/285): a unit that carries
111
+ `ACCEPTANCE.md` still binds it in the snapshot. Bound artifacts
112
+ are frozen: new implementation-phase files are allowed, edits to a bound
113
+ artifact are not. A receipt that does not re-derive — stale, missing,
114
+ wrong-stage **or impossible-timeline** — is never a pass: the check falls
115
+ through to the lane-era path, so a planted or stale `progress.md` cannot
116
+ buy a weaker gate (and a unit doc with no lane-era surface left is then
117
+ **BLOCKED**, `→ Next: /unit-lane <unit>`).
118
+ - **Lane-era path** (feature 61's single-doc contract) — the unit doc's
119
+ Evidence section carries the `## Triaged steps` block whose `Steps:` /
120
+ `Skipped:` / `Budget:` lines re-derive identically from the doc's own
121
+ facts (`bun scripts/unit-route.mjs --triage <unit>`), and the obligation
122
+ ledger carries ≥1 row with every row `verified` or an explicit
123
+ `n/a: <reason>` (see item 2 for the ledger shapes). This comparison binds
124
+ the unit doc's **bytes**: the triage output is a pure function of the
125
+ doc's content, so any tampering — with the pasted block *or* with the
126
+ facts (Tasks, scope, tests) the block is derived from — changes the
127
+ re-derived lines and the check answers **BLOCKED**,
128
+ `→ Next: /unit-lane <unit> --retriage`. No separate digest surface is
129
+ needed (the earlier "frozen digest anchor" wording claimed
130
+ `unit-route.mjs --triage` emits a digest of the pasted block; it never
131
+ did, and the paragraph is retracted — review finding F9). An absent or
132
+ empty obligation ledger is a producer defect, not an audit pass: the
133
+ lane's plan step writes the ledgers (see item 2), and a vacuous ledger
134
+ cannot demonstrate closure — **BLOCKED**, `→ Next: /unit-lane <unit>`; if
135
+ there are truly no obligations, the ledger carries a single
136
+ `n/a: <reason>` row.
137
+ A `SPEC-REVIEW-PASS` never satisfies the plan hop, and vice versa.
138
+ 2. **Obligations are closed.** Every row of the unit's obligation ledger —
139
+ `### Obligations` inside the unit doc (embedded shape) or
140
+ `planning-obligations.md` (separate-file shape, per the sizing rule in
141
+ `pre-execution-review`'s `LEDGERS.md`; never both) — is
101
142
  `verified` — with the validator that ran on this candidate — or an explicit
102
143
  `n/a: <reason>`. Any `planned`, `in-progress`, blank, or `deferred` row is
103
144
  **BLOCKED**, naming the ids. `deferred` is legal only when the user amended the
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: execute-phase
3
3
  user-invocable: true
4
- version: 5.0.1
4
+ version: 5.1.0
5
5
  argument-hint: <NN-slug> [P<k>|step] [--max-attempts N] [--force]
6
6
  allowed-tools: [Bash, Read, Edit, Write, MultiEdit]
7
7
  author: "Gabriel Trabanco <1969593+gtrabanco@users.noreply.github.com>"
@@ -39,7 +39,8 @@ done:
39
39
  ✓ Unit doc read and step selected (explicit P<k> or first unfinished)
40
40
  ✓ Step executed and committed (one commit per step, conventional format)
41
41
  ✓ Evidence rows updated (command → exit/digest → output → verified-by)
42
- ✓ Progress log updated with a dated `YYYY-MM-DD HH:MM` entry (what, commit, next)
42
+ ✓ Progress log updated with a dated `YYYY-MM-DD HH:MM` entry that names the
43
+ phase id (what, commit, next)
43
44
  ✓ Diff guard passed (on implement steps) — see `diff-guard` in PREFLIGHT.md
44
45
  ✓ → Next: block printed as the absolute last output
45
46
  ```
@@ -139,10 +140,13 @@ After each step: run the project's verification gate (type-check + tests + build
139
140
  ### 7. Whole-unit mode
140
141
 
141
142
  When invoked as `<NN-slug>` with no step: loop all remaining steps, one commit
142
- each. After each step: gates, execute, diff guard (if implement), evidence/
143
- progress update, commit. Skip intermediate review checkpoints; the mandatory end
144
- review covers the full accumulated diff. On gate red at any step: repair that
145
- step (up to `--max-attempts`), then continue the loop. Terminal:
143
+ each. This is an **explicit operator choice only** — the lane's hand-offs
144
+ always name exactly one phase (`<NN-slug> P<k>`), so a bare `<NN-slug>` from a
145
+ lane hand-off is a defect; re-read the hand-off before looping. After each
146
+ step: gates, execute, diff guard (if implement), evidence/progress update,
147
+ commit. Skip intermediate review checkpoints; the mandatory end review covers
148
+ the full accumulated diff. On gate red at any step: repair that step (up to
149
+ `--max-attempts`), then continue the loop. Terminal:
146
150
 
147
151
  ```text
148
152
  UNIT LOOP — <unit> COMPLETE
@@ -195,12 +199,17 @@ These files must be loaded when their topic is active:
195
199
 
196
200
  ## Relationship to other skills
197
201
 
198
- `unit-lane` conducts (triage → steps → doc updates); this executes (one step at a
199
- time or all remaining). `fold-findings` handles review finding repairs. The review
200
- pack axes (`review-implementation`, `review-code`, `review-security`, `review-perf`,
202
+ `unit-lane` conducts (triage → judgment steps → close-out ladder) and hands
203
+ execution off **one phase per turn** (`<NN-slug> P<k>` with the catalog tier);
204
+ this executes the named phase — or, as an explicit operator choice only, all
205
+ remaining steps. The closing hand-off names exactly one phase and the tier
206
+ while phases remain, and resumes the lane after the last one.
207
+ `fold-findings` handles review finding repairs. The review pack axes
208
+ (`review-implementation`, `review-code`, `review-security`, `review-perf`,
201
209
  `review-a11y`, `review-debt`) compose the review step; `workflow-status` routes
202
- here. `triage-issue` feeds issues into the lane. This skill is the **step executor**
203
- a turn invokes to perform one triaged step of a unit under the full gate machinery.
210
+ here. `triage-issue` feeds issues into the lane. This skill is the **step
211
+ executor** a turn invokes to perform one triaged step of a unit under the full
212
+ gate machinery.
204
213
 
205
214
  ## Portability (agents other than Claude Code)
206
215
 
@@ -215,15 +224,30 @@ a turn invokes to perform one triaged step of a unit under the full gate machine
215
224
 
216
225
  ## Done when
217
226
 
218
- - Requested scope is implemented (all remaining steps, one explicit step), gate
219
- is green, unit doc Evidence/Progress are current, and the work is committed.
227
+ - Requested scope is implemented (the named phase, or all remaining steps in an
228
+ explicit operator run), gate is green, unit doc Evidence/Progress are current
229
+ (the Progress entry names the phase id), and the work is committed.
220
230
  - **The closing `→ Next:` block is printed.**
221
231
 
222
232
  ## Closing recommendation
223
233
 
234
+ Exactly one end-state applies — pick by the unit's Tasks section, never print a
235
+ phase id the Tasks section does not define:
236
+
237
+ Phases remain:
238
+
239
+ ```
240
+ → Next: /execute-phase <NN-slug> P<k+1> (tier: <tier>) — one phase per turn; <tier> is the catalog's implement entry
241
+ · whole-unit operator run complete → /review-change (mandatory end review)
242
+ · findings (REVIEW-FAIL) → /fold-findings repairs them; a fresh /review-change follows the fold
243
+ · merge gate after REVIEW-PASS → /audit-pr — the merge gate
244
+ ```
245
+
246
+ The last phase just closed (a lane-run unit):
247
+
224
248
  ```
225
- → Next: /unit-lane <NN-slug> — the conductor continues with the next triaged step
226
- · all steps done → /review-change — the mandatory end review
249
+ → Next: /unit-lane <NN-slug> — resume the conductor for the remaining judgment steps
250
+ · whole-unit operator run complete → /review-change (mandatory end review)
227
251
  · findings (REVIEW-FAIL) → /fold-findings repairs them; a fresh /review-change follows the fold
228
252
  · merge gate after REVIEW-PASS → /audit-pr — the merge gate
229
253
  ```
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: pre-execution-review
3
3
  user-invocable: false
4
- version: 2.6.0
4
+ version: 2.7.0
5
5
  author: "Gabriel Trabanco <1969593+gtrabanco@users.noreply.github.com>"
6
6
  license: MIT
7
7
  description: >
@@ -28,9 +28,15 @@ digest at all; the fixed form that stands in the digest's place is each stage's
28
28
 
29
29
  Rules the builder enforces and no caller may improvise around:
30
30
 
31
- - **`SPEC.md` and `ACCEPTANCE.md` are required** for their stage: a missing one is
31
+ - **`SPEC.md` is required** for its stage: a missing one is
32
32
  refused, not silently dropped, because dropping it would bind a smaller set than
33
33
  the contract reviewed.
34
+ - **`ACCEPTANCE.md` binds when present** (fix/285): the acceptance manifest is a
35
+ pre-lane artifact. A unit that carries one (pre-lane and adoption units) binds
36
+ it as the `acceptance` row; a lane-era unit whose acceptance criteria live in
37
+ the unit doc builds without that row. Requiring the manifest made every
38
+ lane-era plan snapshot unsatisfiable — the enforcer demanded a file the
39
+ current pipeline structurally never writes (issue #285).
34
40
  - **A ledger that lives inside the SPEC has no row** (D20): an XS/S or fix unit
35
41
  embeds `### Planning evidence` / `### Obligations`, so those rows are absent and
36
42
  their bytes are already bound by the `spec` row. Never point a row at a file that
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: review-change
3
3
  user-invocable: true
4
- version: 3.10.0
4
+ version: 3.11.0
5
5
  argument-hint: <path-or-glob> [--adversarial N] [--synthesize]
6
6
  author: "Gabriel Trabanco <1969593+gtrabanco@users.noreply.github.com>"
7
7
  license: MIT
@@ -31,6 +31,13 @@ For a final PR review, the turn is incomplete until this additional box passes:
31
31
  `review-change:pass` marker is confirmed, so its exit code IS this box
32
32
  ```
33
33
 
34
+ When the receipt emitter runs, it also records the affecting-path scope
35
+ manifest (fix/286) so a foreign-only commit after the review (a session-log or
36
+ toolstate commit on a shared checkout) does not void the receipt at the merge
37
+ gate — pass `--scope-base main` (the unit's base ref) and the runtime derives
38
+ the manifest itself; never hand-assemble a digest. A receipt without a scope
39
+ manifest stays head-bound (legacy semantics).
40
+
34
41
  The receipt closeout is a precondition of the report, not a follow-up: do not
35
42
  print the fixed report block on a non-zero exit. A clean report without a
36
43
  current receipt must not recommend `/audit-pr`.
@@ -60,9 +60,16 @@ exact command tokens.
60
60
  bun scripts/review-receipt.mjs emit --pr <N> \
61
61
  --head "$(git rev-parse HEAD)" --scope "<reviewed surface>" \
62
62
  --axes "<axes run and skipped>" --coverage "<criterion-to-evidence>" \
63
- --invariants pass|n/a --proposals <n> --manual "<items or none>"
63
+ --invariants pass|n/a --proposals <n> --manual "<items or none>" \
64
+ --scope-base main
64
65
  ```
65
66
 
67
+ `--scope-base <ref>` (fix/286) records the affecting-path scope manifest
68
+ beside the reviewed head: the emitter derives it from the branch delta vs
69
+ that ref, so a later foreign-only commit (session log, agent toolstate) no
70
+ longer voids the receipt at the merge gate — any affecting-path delta still
71
+ voids it. Never hand-assemble the manifest or its digest.
72
+
66
73
  The script is the contract: it refuses a PR whose `headRefOid` differs from
67
74
  the reviewed head, posts the one idempotent SHA-bound comment (skipping an
68
75
  identical one), re-reads the comments, and **exits non-zero unless the newest
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: unit-lane
3
3
  user-invocable: true
4
- version: 1.2.0
4
+ version: 1.5.0
5
5
  argument-hint: <NN-slug | "<idea>"> [--retriage] | --fix <issue-number> | --from-issue <issue-number>
6
6
  description: >
7
7
  One-shot lane conductor for a delivery unit: triage, implement, evidence, and
@@ -48,7 +48,9 @@ Both `--fix <n>` and `--from-issue <n>` are the exact forms
48
48
 
49
49
  Per the agent guide's **Workflow conventions** + **documentation map**, then read
50
50
  `docs/features/_TEMPLATE/SPEC.md` (the unit doc template). If the unit folder
51
- exists, read its current `SPEC.md` to avoid overwriting.
51
+ exists, read its current `SPEC.md` to avoid overwriting. If this work returns
52
+ to an area other unit docs already touch, scan their `## Future` sections and
53
+ surface each open row as plan-now / keep-deferred / discard before continuing.
52
54
 
53
55
  ## Process
54
56
 
@@ -67,7 +69,11 @@ For `--fix`/`--from-issue`, read the tracked issue in the forge first and keep
67
69
  its number; the folder name carries it (`fix/<issue-number>-<topic>`). Fill
68
70
  objective, why, user outcome, and non-goals from the invocation (or the issue).
69
71
  Acceptance criteria are induced from user scenarios — **ask-don't-infer**; if the
70
- request is too vague, STOP and ask the user with concrete options. See
72
+ request is too vague, STOP and ask the user with concrete options. Open
73
+ decisions that are not acceptance criteria run through the design step's
74
+ **gap interview** — one batched form-turn with recommended options + why,
75
+ `Decide for me` (recorded in `decisions.md`), and cheap defaults recorded as
76
+ assumptions. See
71
77
  [the unit doc template](references/STEPS.md) for section order.
72
78
 
73
79
  ### 2. Triage — read the catalog, never re-derive
@@ -79,8 +85,9 @@ re-derives, reorders, or invents steps — it executes only what the catalog say
79
85
 
80
86
  ### 3. Execute triaged steps in order
81
87
 
82
- For each step the triage returned, follow its reference file. Execute **one step
83
- per turn-commit**:
88
+ For each step the triage returned, follow its reference file. Judgment steps
89
+ (research, design, plan, evidence, docs, review) run inline, **one step per
90
+ turn-commit**:
84
91
 
85
92
  1. Read the step's reference — for example:
86
93
  [research](references/RESEARCH.md), [design](references/DESIGN.md),
@@ -94,6 +101,23 @@ per turn-commit**:
94
101
  5. Commit with a conventional commit message.
95
102
  6. For implement steps, run the diff guard (step 4 below).
96
103
 
104
+ Execution steps (implement, tests) **never run inline at the conductor's
105
+ tier** — per-step model routing is reachable only across a turn boundary, so
106
+ execution work hands off one phase per turn:
107
+
108
+ ```
109
+ → Next: /execute-phase <NN-slug> P<k> (tier: <tier>) — run phase P<k>; the lane resumes after the last phase
110
+ · no unfinished phase → continue the close-out ladder (step 6)
111
+ ```
112
+
113
+ `<k>` is the first unfinished phase (the unit doc's Progress log records the
114
+ phases done so far; `bun scripts/unit-route.mjs <NN-slug>` prints it) and
115
+ `<tier>` is the `implement` entry of the triage block's `Tiers:` line. Never
116
+ print the bare whole-unit `/execute-phase <NN-slug>` — whole-unit loop mode
117
+ survives only as an explicit operator choice. When the last phase's turn
118
+ closes, `execute-phase` resumes the lane and the remaining judgment steps
119
+ (evidence, review, docs, release) run here.
120
+
97
121
  ### 4. Diff-size guard (after each implement step)
98
122
 
99
123
  Run `bun scripts/diff-guard.mjs --base <last-reviewed-ref> --unit <NN>`. Paste
@@ -110,16 +134,33 @@ Before every commit:
110
134
  - **Progress log**: `YYYY-MM-DD HH:MM — <what was done> → <commit sha> — next:
111
135
  <what is next>`
112
136
 
113
- ### 6. Close the unit
137
+ ### 6. Close the unit — the close-out ladder
138
+
139
+ When all triaged steps are done, in order:
140
+
141
+ 1. Run the review step (the in-doc `REVIEW-VERDICT` per
142
+ [review](references/REVIEW.md)).
143
+ 2. Resolve every `## Future` row with the user (planned now — registered on
144
+ explicit request only —, kept deferred, or discarded, dated).
145
+ 3. Update the unit doc's status and the index row (release step: branch
146
+ hygiene, PR creation, forge reconciliation).
147
+ 4. **Receipt stage.** The in-doc verdict is not the machine receipt. Verify
148
+ the PR's review receipt (`bun scripts/review-receipt.mjs verify --pr <N>`):
149
+ - **exit 0** (a current `review-change:pass` receipt at the settled head) →
150
+ the closing `→ Next:` recommends `/audit-pr <PR-url>` as the terminal
151
+ stage, with the receipt stated as its precondition.
152
+ - **otherwise** → the closing block is `→ Next: /review-change <NN-slug>`
153
+ (the receipt's sole owner) and `/audit-pr` is not printed — the gate is
154
+ never named before its precondition exists.
114
155
 
115
- When all triaged steps are done, run the review pack axis summary, update the
116
- unit doc's status, and print the closing block.
156
+ A turn that ends with an unchecked ladder step is not done.
117
157
 
118
158
  ## Guardrails
119
159
 
120
160
  **Allowed:**
121
161
  - Only the triaged steps listed by the catalog
122
162
  - Changes scoped to the acceptance criteria
163
+ - Deferred user ideas recorded in the unit doc's `## Future`, never implemented
123
164
  - Documentation updates in docs/ and template/
124
165
  - Conventional commit messages per the project's Workflow conventions
125
166
 
@@ -131,16 +172,25 @@ unit doc's status, and print the closing block.
131
172
  - Findings never authorize scope growth — record them, route to their owner
132
173
  - Never commit red (test failure) — fix or replan, never silence tests
133
174
  - Never alter a triaged step's order
175
+ - Never run an execution phase inline or print a bare whole-unit
176
+ `/execute-phase` command — one phase per hand-off, tier attached
177
+ - Never print `/audit-pr` before the PR's review receipt verifies current —
178
+ the receipt stage precedes the gate, always
134
179
 
135
180
  ## Relationship to other skills
136
181
 
137
182
  `unit-lane` absorbed the retired fixed-pipeline skills (design-feature,
138
- plan-feature, review-spec, review-plan) into catalog steps. The review pack axes
139
- (`review-implementation`, `review-code`, `review-security`, `review-perf`,
140
- `review-a11y`, `review-debt`) compose the review step; `triage-issue` feeds
141
- issues into the lane; `workflow-status` computes the next lane invocation.
142
- `init-workspace` seeds the unit doc template and catalog conventions into target
143
- projects.
183
+ plan-feature, review-spec, review-plan) into catalog steps. `execute-phase` is
184
+ the lane's executor: the lane conducts (triage, plan, evidence, review,
185
+ close-out) and hands execution off one phase per turn at the phase's tier;
186
+ its closing block names the next single phase and resumes the lane after the
187
+ last one. The review pack axes (`review-implementation`, `review-code`,
188
+ `review-security`, `review-perf`, `review-a11y`, `review-debt`) compose the
189
+ review step; `/review-change` owns the SHA-bound receipt the close-out ladder
190
+ verifies; `/audit-pr` is the terminal merge gate. `triage-issue` feeds issues
191
+ into the lane; `workflow-status` computes the next lane invocation.
192
+ `init-workspace` seeds the unit doc template and catalog conventions into
193
+ target projects.
144
194
 
145
195
  ## Portability (agents other than Claude Code)
146
196
 
@@ -153,17 +203,20 @@ projects.
153
203
 
154
204
  ## Done when
155
205
 
156
- - Every triaged step is executed and committed.
206
+ - Every triaged step is executed and committed — execution phases one
207
+ `/execute-phase <NN-slug> P<k>` turn each, never inline.
157
208
  - The unit doc's Evidence rows, Progress log, and References section are current.
158
- - The diff guard passed for all implement steps.
209
+ - The diff guard passed for all implement steps (or an exception is recorded).
159
210
  - The review step is complete (or skipped per catalog).
211
+ - The close-out ladder ran: receipt verified current, or the closing block
212
+ hands off to `/review-change` before any `/audit-pr` mention.
160
213
  - **The closing `→ Next:` block is printed.**
161
214
 
162
215
  ## Closing recommendation
163
216
 
164
217
  ```
165
- → Next: /unit-lane <NN-slug> — continue to the next triaged step
166
- · all steps done → /review-change (review the accumulated diff)
218
+ → Next: /execute-phase <NN-slug> P<k> (tier: <tier>) — run the next unfinished phase
219
+ · execution done, receipt current (verify --pr <N> exit 0) → /audit-pr <PR-url> — terminal merge gate; the current review-change:pass receipt is its precondition
220
+ · execution done, PR open, receipt missing → /review-change <NN-slug> — post the SHA-bound receipt first
167
221
  · re-triage needed → /unit-lane <NN-slug> --retriage
168
- · finished and merge-ready → /audit-pr (merge gate)
169
222
  ```
@@ -2,14 +2,58 @@
2
2
 
3
3
  ## Purpose
4
4
 
5
- Induce acceptance criteria from user scenarios and close entity, role, and
6
- expectation boundaries — distilled from the full design skill's closure.
5
+ Run the gap interview, induce acceptance criteria from user scenarios, and
6
+ close entity, role, and expectation boundaries — distilled from the full design
7
+ skill's closure.
7
8
 
8
9
  ## Inputs
9
10
 
10
11
  - The unit's objective, why, and user outcome from the SPEC
12
+ - The user's original request, the repository's current state, and the
13
+ installed tooling — whatever they already answer is never asked again
11
14
  - Research findings from the research step
12
15
 
16
+ ## The gap interview (runs before acceptance criteria lock)
17
+
18
+ Collect every open decision the unit depends on and filter each one:
19
+
20
+ | The gap… | The lane does |
21
+ |---|---|
22
+ | The request, the repo, or the installed tooling already answers it | Never asks |
23
+ | Blocks now and is expensive to undo once code sits on top | Asks |
24
+ | Blocks a later task that is already foreseeable | Asks now as a possibility; re-asks only if conditions change |
25
+ | Cheap to change later | Takes a reasonable default and records it as an assumption — never silent |
26
+
27
+ Expensive to undo = the choices that cost a lot to change once code exists on
28
+ top: **scope** (personal / team / global), **stack**, **architecture pattern**,
29
+ **data model**, **deployment target**, and **security configuration**.
30
+
31
+ Mechanics — one batched form-turn, never one-question-per-turn:
32
+
33
+ - Group all independent questions into a single turn; ≤6 slots, one-word
34
+ defaults accepted, ≤2 ambiguity follow-ups per slot.
35
+ - Ask a single question first only when its answer changes the others. When
36
+ more than five gaps remain, the root decision (objective or scope) goes
37
+ first — its answer usually removes most of the rest.
38
+ - Every slot carries: the **recommended option with its why**, one
39
+ alternative, **"Decide for me"**, and **"Explain the options"** — the user
40
+ may always answer freely.
41
+ - **"Decide for me"**: the lane chooses, then records the choice and its
42
+ reason as a dated row in the unit folder's `decisions.md` — explicit, never
43
+ guessed silently.
44
+ - **"Explain the options"**: explain each alternative didactically, then
45
+ re-ask only that slot.
46
+ - A tool the project lacks may be offered as one more option (with its
47
+ recommendation and why); installing it always needs the user's explicit
48
+ consent.
49
+ - **Ready when:** no expensive-to-undo blocking gap remains unanswered — not
50
+ when no gaps remain. An answer the user already gave is never re-asked.
51
+
52
+ Deferred ideas ("down the road I'd like…") are never implemented, never turned
53
+ into spec or tasks by this unit: they go verbatim to the unit doc's
54
+ `## Future` section, dated, so the architecture may accommodate them without
55
+ building them.
56
+
13
57
  ## Fixed output contract
14
58
 
15
59
  Fill the unit doc's **Acceptance criteria** section. Each AC must be:
@@ -19,6 +63,12 @@ Fill the unit doc's **Acceptance criteria** section. Each AC must be:
19
63
 
20
64
  ## Checklist (pass only if)
21
65
 
66
+ - [ ] The gap interview ran before the ACs locked: one batched form-turn,
67
+ each gap filtered through the table above
68
+ - [ ] No expensive-to-undo blocking gap remains unanswered
69
+ - [ ] Every "Decide for me" choice is recorded with its reason in `decisions.md`
70
+ - [ ] Cheap defaults are recorded as assumptions, correctable by the user
71
+ - [ ] Deferred user ideas landed in `## Future`, not in scope
22
72
  - [ ] Every AC is induced from a user scenario, not inferred from vague intent
23
73
  - [ ] Acceptance criteria are command-verified where possible
24
74
  - [ ] Entity closure: every entity mentioned has its role in the unit stated
@@ -28,8 +78,12 @@ Fill the unit doc's **Acceptance criteria** section. Each AC must be:
28
78
 
29
79
  ## Forbidden
30
80
 
81
+ - Do not ask what the request, the repo, or the installed tooling already answers
82
+ - Do not ask one question per turn when slots are independent
83
+ - Do not implement, spec, or task anything from `## Future`
84
+ - Do not install a missing tool without explicit user consent
31
85
  - Do not build a separate DESIGN.md — one SPEC, all in the unit doc
32
86
  - Do not invent product scope the user did not confirm
33
87
  - Do not pre-fill engineering content (phases, tests, architecture)
34
88
  - Do not stamp "designed" with an incomplete closure row
35
- - An incomplete row silently un-does the skill's purpose
89
+ - An incomplete row silently un-does the skill's purpose
@@ -2,42 +2,55 @@
2
2
 
3
3
  ## Purpose
4
4
 
5
- Execute the plan's tasks against the code. One phase per commit. Layer order
6
- respected. Guard enforced.
5
+ Hand the plan's phases to the executor, one phase per turn. The conductor
6
+ never runs an execution phase inline — per-step model routing is reachable
7
+ only across a turn boundary (issue #291 AC3/AC4).
7
8
 
8
9
  ## Inputs
9
10
 
10
11
  - The unit's Tasks section (filled by the plan step)
11
- - The project's architecture doc (layer rules)
12
- - The diff guard baseline from the triage step's reference
12
+ - The triage block's `Tiers:` line (the `implement` entry is the execution tier)
13
+ - The unit's Progress log (which phases are done)
13
14
 
14
15
  ## Fixed output contract
15
16
 
16
- After each phase commit, update the unit doc's **Evidence** section and
17
- **Progress log**:
17
+ At each execution boundary, print exactly one phase hand-off and end the turn:
18
+
19
+ ```
20
+ → Next: /execute-phase <NN-slug> P<k> (tier: <tier>) — run phase P<k>; the lane resumes after the last phase
21
+ · no unfinished phase → continue the close-out ladder
22
+ ```
23
+
24
+ `<k>` = first unfinished phase (lowest `P<n>` bullet the Progress log does not
25
+ record; `bun scripts/unit-route.mjs <NN-slug>` prints it). `<tier>` = the
26
+ `implement` entry of the triage block's `Tiers:` line. Never the bare
27
+ whole-unit command.
28
+
29
+ When the last phase's turn closes, `execute-phase` resumes the lane. Verify
30
+ its work landed in the unit doc before continuing:
18
31
 
19
32
  | AC | What was run | Exit / digest | Output (≤2 lines) | Verified-by |
20
33
  |---|---|---|---|---|
21
- | P1 | <git commit sha> | 0 · <sha> | <result ≤2 lines> | <model> |
34
+ | P1 | <phase validator> | 0 · <sha> | <result ≤2 lines> | <executor model> |
22
35
 
23
36
  ## Checklist (pass only if)
24
37
 
25
- - [ ] Phases executed in P1, P2, … order from the Tasks section
26
- - [ ] One phase per commit (no bundling)
27
- - [ ] Layer order respected (inner layers don't import outer)
28
- - [ ] `git status --porcelain` is empty after each commit
29
- - [ ] Diff guard passed after each phase (see step 4 in SKILL.md)
30
- - [ ] Red run avoided — tests pass before committing, or tests-first red-run
31
- evidence recorded
38
+ - [ ] Every phase handed off as `/execute-phase <NN-slug> P<k> (tier: <tier>)`
39
+ — exactly one phase, never a bare whole-unit command
40
+ - [ ] Phases ran in P1, P2, … order from the Tasks section
41
+ - [ ] Each executor turn recorded its Evidence row and dated Progress entry
42
+ - [ ] Diff guard run at the lane's resume (see step 4 in SKILL.md)
43
+ - [ ] `git status --porcelain` is empty when the lane resumes
32
44
 
33
45
  ## Allowed
34
46
 
35
- - Changes scoped to the phase's acceptance criteria only
36
- - Bug fixes in affected paths that the phase touches
47
+ - Changes scoped to the phase's acceptance criteria only (enforced by the
48
+ executor's own gates)
37
49
  - Documentation updates in the same commit as the code change
38
50
 
39
51
  ## Forbidden
40
52
 
53
+ - Never run an execution phase inline at the conductor's tier
41
54
  - No unrelated refactors in the same commit
42
55
  - No new abstractions or dependencies beyond what the unit doc demands
43
56
  - Never commit red (test failure)
@@ -64,6 +64,29 @@ candidate match is clean and proceeds** — a miss never blocks it, a missed
64
64
  candidate can never void a plan, and the sweep issues no stage verdict and grants no
65
65
  gate of its own.
66
66
 
67
+ ## Planning ledgers (same step)
68
+
69
+ Cut both planning ledgers in the same pass — the plan snapshot binds them, and
70
+ the audit's lineage gate closes obligations from them (fix/285). The closed row
71
+ shapes, column orders, and vocabularies are owned by
72
+ `skills/pre-execution-review/references/LEDGERS.md`; this step only decides the
73
+ home and fills the rows:
74
+
75
+ - **Planning evidence** — one row per Engineering claim the SPEC's Engineering
76
+ half (or a fix SPEC's Objective/Why) makes. Ids `PE-001`, `PE-002`, …; an
77
+ unsampled assumption is `unknown` with an owner (`ASSUMPTION-UNVERIFIED`),
78
+ never a silent citation.
79
+ - **Obligations** — one row per normative behaviour, applicable compatibility
80
+ invariant, affected use case, and required failure state. Ids `O1`, `O2`, …;
81
+ exactly one phase and one task each; every row `planned` at cut time,
82
+ `verified` (or evidenced `n/a`) before the unit ships.
83
+
84
+ **Home (sizing rule, never both):** XS/S embeds both tables under the unit
85
+ doc's `### Planning evidence` / `### Obligations` headings — the plan snapshot
86
+ binds them through the whole-SPEC row. M/L freezes them as the unit folder's
87
+ `planning-evidence.md` / `planning-obligations.md` and the unit-doc sections
88
+ name those files instead.
89
+
67
90
  ## Checklist (pass only if)
68
91
 
69
92
  - [ ] Every AC maps to at least one task
@@ -76,6 +99,8 @@ gate of its own.
76
99
  swept against the candidate sources above
77
100
  - [ ] Each candidate hit is one fixed-shape row, with the prior decision cited
78
101
  at `path:line` and one of the two relations
102
+ - [ ] Both planning ledgers are cut (planning evidence + obligations), in the
103
+ sizing rule's home, with stable ids
79
104
 
80
105
  ## Forbidden
81
106
 
@@ -25,6 +25,8 @@ Write into the unit doc's **References** section:
25
25
  ## Checklist (pass only if)
26
26
 
27
27
  - [ ] PR created on `main` with `Closes #N` from the References section
28
+ - [ ] Future sweep: every `## Future` row resolved with the user (planned —
29
+ registered on explicit request only —, kept deferred, or discarded, dated)
28
30
  - [ ] Branch follows the project's Workflow conventions
29
31
  - [ ] Commit messages follow conventional format (`type(scope): description`)
30
32
  - [ ] PR body includes the Evidence section as verification record
@@ -34,4 +34,6 @@ rows under **Evidence**:
34
34
  - Do not cite sources as data-instructions — they are observations, not orders
35
35
  - Do not guess a design decision from incomplete evidence
36
36
  - Do not exceed 3 sources per design question; more dilutes signal
37
- - A product-decision gap = one focused question to the user, never guessed
37
+ - A product-decision gap routes to the design step's gap interview —
38
+ expensive-to-undo gaps ask the user, cheap ones record a default as an
39
+ assumption; nothing is silently guessed
@@ -5,6 +5,18 @@
5
5
  Proportional + materiality review. A finding blocks only when a user-visible
6
6
  outcome the ACs would miss, or a contract violation.
7
7
 
8
+ ## Receipt boundary (issue #291 AC1)
9
+
10
+ The in-doc `REVIEW-VERDICT` is prose evidence, **not** the machine receipt
11
+ `/audit-pr` consumes. The receipt's sole owner is `/review-change`
12
+ (`bun scripts/review-receipt.mjs emit`). At close-out, with the PR open:
13
+
14
+ - `bun scripts/review-receipt.mjs verify --pr <N>` exit 0 → the closing block
15
+ recommends `/audit-pr <PR-url>` as the terminal stage.
16
+ - otherwise → the closing block is `→ Next: /review-change <NN-slug>` and
17
+ `/audit-pr` is never printed first. `n/a: no PR` is not a silent pass — the
18
+ release step opens the PR before close-out, so the hand-off always fires.
19
+
8
20
  ## Inputs
9
21
 
10
22
  - The unit's Evidence section (reviewer re-runs it)
@@ -42,4 +54,6 @@ REVIEW-VERDICT: PASS | FAIL
42
54
  - Never alter the acceptance criteria during review
43
55
  - Never approve without re-running the evidence
44
56
  - Never skip an axis the catalog demands
45
- - Never reuse a finding from a previous cycle without re-evaluating it
57
+ - Never reuse a finding from a previous cycle without re-evaluating it
58
+ - Never treat the in-doc verdict as the merge gate's receipt — the close-out
59
+ ladder verifies `review-receipt.mjs` before any `/audit-pr` mention
@@ -2,7 +2,11 @@
2
2
 
3
3
  ## Purpose
4
4
 
5
- Run and verify the tests the triage determined are applicable.
5
+ Run and verify the tests the triage determined are applicable. Test execution
6
+ rides the executor's phases (each phase's `validator:` runs the project's
7
+ gate); when the tests step is the turn's own boundary, it hands off like
8
+ implement does — one `/execute-phase <NN-slug> P<k> (tier: <tier>)` turn,
9
+ never inline.
6
10
 
7
11
  ## Inputs
8
12