@gtrabanco/pi-agentic-workflow 0.1.0 → 0.2.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 (52) hide show
  1. package/README.es.md +2 -0
  2. package/README.md +2 -0
  3. package/package.json +1 -1
  4. package/skills/audit-pr/SKILL.md +4 -1
  5. package/skills/audit-pr/references/02_CLOSURE_AND_SCOPE_GATES.md +35 -0
  6. package/skills/design-feature/SKILL.md +58 -21
  7. package/skills/design-feature/references/INTERVIEW.md +17 -0
  8. package/skills/design-feature/references/REPAIR.md +81 -0
  9. package/skills/design-feature/references/WRITE_AND_UPSERT.md +25 -2
  10. package/skills/discover-repository-state/SKILL.md +2 -1
  11. package/skills/evidence-grounding/SKILL.md +163 -0
  12. package/skills/evidence-grounding/references/DELEGATION.md +131 -0
  13. package/skills/evidence-grounding/references/READINESS.md +130 -0
  14. package/skills/evidence-grounding/references/ROWS.md +93 -0
  15. package/skills/execute-phase/SKILL.md +6 -1
  16. package/skills/execute-phase/references/DESCOPE.md +11 -5
  17. package/skills/execute-phase/references/PREFLIGHT.md +38 -1
  18. package/skills/execute-phase/references/PRE_EXECUTION_GATE.md +78 -0
  19. package/skills/loop-review-fold/SKILL.md +25 -2
  20. package/skills/orchestration-envelope/references/TURN_CONTRACT.md +34 -0
  21. package/skills/plan-feature/SKILL.md +37 -10
  22. package/skills/plan-feature/references/ROUTING.md +61 -2
  23. package/skills/plan-feature-from-issue/SKILL.md +30 -8
  24. package/skills/plan-feature-scaffold/SKILL.md +1 -1
  25. package/skills/plan-feature-scaffold/references/SCAFFOLD_PROCESS.md +35 -2
  26. package/skills/plan-fix/SKILL.md +31 -8
  27. package/skills/plan-fix/references/PLANNING_PROCESS.md +15 -0
  28. package/skills/pre-execution-review/SKILL.md +73 -0
  29. package/skills/pre-execution-review/references/LEDGERS.md +174 -0
  30. package/skills/pre-execution-review/references/POLICY.md +182 -0
  31. package/skills/pre-execution-review/references/SNAPSHOT.md +112 -0
  32. package/skills/resolve-repository-state/SKILL.md +2 -1
  33. package/skills/review-change/SKILL.md +1 -1
  34. package/skills/review-change/references/PERSIST_AND_DECIDE.md +5 -0
  35. package/skills/review-implementation/SKILL.md +1 -1
  36. package/skills/review-implementation/references/CLASSIFY.md +24 -0
  37. package/skills/review-plan/SKILL.md +152 -0
  38. package/skills/review-plan/references/CHECKS.md +108 -0
  39. package/skills/review-plan/references/ENG-CHECKS.md +30 -0
  40. package/skills/review-plan/references/OUTPUT.md +140 -0
  41. package/skills/review-spec/SKILL.md +145 -0
  42. package/skills/review-spec/references/CHECKS.md +105 -0
  43. package/skills/review-spec/references/OUTPUT.md +126 -0
  44. package/skills/ship-roadmap/SKILL.md +1 -1
  45. package/skills/ship-roadmap/references/ADVANCE.md +34 -6
  46. package/skills/ship-roadmap/references/CLOSEOUT_AND_LOG.md +2 -1
  47. package/skills/ship-roadmap/references/MODEL_ROUTING.md +2 -0
  48. package/skills/ship-roadmap/references/RECOVERY_AND_SELECTION.md +3 -2
  49. package/skills/workflow-status/SKILL.md +11 -5
  50. package/skills/workflow-status/references/ENVELOPE_FIELDS.md +6 -2
  51. package/skills/workflow-status/references/PRE_EXECUTION.md +78 -0
  52. package/skills/workflow-status/references/SENSOR_CORE.md +46 -6
@@ -19,3 +19,37 @@
19
19
  **Single owner:** orchestration-envelope/references/TURN_CONTRACT.md. All skills load this + skill-specific additions only. Duplication forbidden. Missing reference = STOP.
20
20
 
21
21
  **Push policy supplement:** Box 4 covers the end-of-unit push. Some consumers (e.g. `execute-phase/references/PREFLIGHT.md`) define additional push rules for mid-phase commits when a PR is already open — those per-consumer supplements extend this contract and must be loaded alongside it by the consumer skill.
22
+
23
+ ## Hand-off grammar (versioned — read by `scripts/normative-drift.test.mjs`)
24
+
25
+ Box 9's closing hand-off and box 10's machine result are ordered here, so the
26
+ tokens they may use are declared as grammar rather than prose. Every `from`/`to`
27
+ pair below must exist in the schema package's `WORKFLOW_TRANSITION_TABLE`, and
28
+ every field row must be a key that package's envelope validator declares: a pair
29
+ or a key no machine surface defines is a defect in this file, never in the table.
30
+
31
+ ```text
32
+ hand-off-transitions@1
33
+ from | to
34
+ workflow-intent:review-spec | workflow-intent:plan-feature
35
+ workflow-intent:plan-feature | workflow-intent:review-plan
36
+ workflow-intent:review-plan | workflow-intent:execute-phase
37
+ workflow-intent:plan-fix | workflow-intent:review-plan
38
+ workflow-intent:review-plan | workflow-intent:design-feature
39
+ workflow-intent:execute-phase | workflow-intent:review-change
40
+ workflow-intent:review-change | workflow-intent:audit-pr
41
+ workflow-intent:audit-pr | workflow-intent:merge
42
+ workflow-intent:triage-issue | workflow-intent:execute-phase
43
+ workflow-intent:status | workflow-intent:design-feature
44
+ ```
45
+
46
+ ```text
47
+ hand-off-fields@1
48
+ # machine: envelope
49
+ object | field
50
+ next | recommended
51
+ next | alternatives
52
+ next | tier
53
+ next | suggested
54
+ ```
55
+
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: plan-feature
3
3
  user-invocable: true
4
- version: 3.5.1
4
+ version: 5.0.0
5
5
  argument-hint: <NN-slug | #N> | --from-issue N | --scaffold <slug> | --next
6
6
  author: "Gabriel Trabanco <gtrabanco@users.noreply.github.com>"
7
7
  license: MIT
@@ -25,11 +25,18 @@ one — the routed redirect gate enforces that split.
25
25
  ```
26
26
  ✓ The redirect gate ran FIRST, before any SPEC edit: undesigned input → STOP,
27
27
  print the fixed `/design-feature <slug>` block, do nothing else this turn
28
+ ✓ Then the Product-review gate ran: no current `spec-review-pass` receipt bound to
29
+ the recomputed snapshot → STOP with its fixed block and the `/review-spec`
30
+ hand-off; a candidate/verification receipt, a Plan receipt, or readiness never counts
28
31
  ✓ Designed input only: engineering half filled, artifacts written, and the
29
32
  roadmap entry registered (number, order, deps verified)
30
33
  ✓ If `plan-feature-scaffold` ran this turn: the roadmap row was re-read
31
34
  AFTER the write and literally reads `planned` — a dropped `defined→planned`
32
35
  write fails this box; do not end the turn until it's fixed
36
+ ✓ Planned, not reviewed: the ledgers are frozen, `stage: plan` readiness printed
37
+ `READY-FOR-REVIEW`, and the turn hands off to `/review-plan` — this skill never
38
+ reviews the plan it just wrote and never hands off to `/execute-phase` for a
39
+ plan with no current Plan review receipt
33
40
  ✓ The dependency & blocker check was RUN and its result decides which closing block is printed
34
41
  ✓ An unmet dependency? The closing block lists the complete dependency chain, deepest first, joined with ` + `
35
42
  ✓ Artifact language: explicit user instruction > the project's declared docs language > English. The CONVERSATION language never decides — a Spanish prompt still produces English PRs/issues/commits/SPECs unless one of the first two says otherwise
@@ -51,7 +58,8 @@ and roadmap registration match the project's real layout.
51
58
  The reference allowlist is exactly the two paths below:
52
59
 
53
60
  1. Every invocation: read [redirect gate and routing](references/ROUTING.md),
54
- apply the status gate first, and stop on its exact block when instructed.
61
+ apply the status gate first, then the Product-review gate, and stop on its
62
+ exact block when instructed.
55
63
  2. Any route that can write planning artifacts: after the redirect gate permits
56
64
  routing, consume the [planning preflight](<../planning-preflight/SKILL.md>) —
57
65
  it owns the normalized repository state read and the ONE final architectural
@@ -67,21 +75,24 @@ one hop from this file, and fail closed when missing.
67
75
  ## Process
68
76
 
69
77
  1. **Redirect gate** from `ROUTING.md` — always first.
70
- 2. **Route** from the same resource. For issue input, resolve and validate the issue
78
+ 2. **Product-review gate** from the same resource current `spec-review-pass`
79
+ receipt bound to the recomputed snapshot, or STOP. No bypass flag.
80
+ 3. **Route** from the same resource. For issue input, resolve and validate the issue
71
81
  identity only; after the [planning preflight](<../planning-preflight/SKILL.md>)
72
82
  confirms that planning may write, compose the from-issue internal to produce
73
- a **filled, sized SPEC product half**; then invoke `plan-feature-scaffold`,
74
- which fills the engineering half and scales the artifacts to the SPEC's size
75
- (XS/S SPEC-only; M/L full set) and registers the roadmap. The
83
+ a **filled, sized SPEC product half**; that internal stops at the Product-review
84
+ gate, so `plan-feature-scaffold` runs only once `review-spec` has passed the half:
85
+ it fills the engineering half, scales the artifacts to the SPEC's size (XS/S →
86
+ SPEC-only; M/L → full set) and registers the roadmap. The
76
87
  already-designed scoped path runs `plan-feature-scaffold` directly. Every
77
88
  path holds **one immutable planning context** — the roadmap snapshot taken
78
89
  before writing (and one issue payload when `--from-issue`) — reused across
79
90
  the internal steps; never re-fetched mid-plan.
80
- 3. **Confirm roadmap.** Verify the feature is registered in
91
+ 4. **Confirm roadmap.** Verify the feature is registered in
81
92
  `docs/features/ROADMAP.md` with the right number, ordering, and dependencies;
82
93
  if any of the three is missing or wrong, fix the entry now — never leave
83
94
  registration for later.
84
- 4. **Dependency & blocker check (always, before recommending execution).**
95
+ 5. **Dependency & blocker check (always, before recommending execution).**
85
96
  - Walk the feature's `Depends on:` closure (transitively): every dependency
86
97
  must be `done` **and merged**. Any unmet → the closing block recommends
87
98
  building the deepest unmet dependency first, NOT this feature.
@@ -97,6 +108,9 @@ one hop from this file, and fail closed when missing.
97
108
  - Docs only — no code, no branch (that is `execute-phase`).
98
109
  - **Never plan an undesigned feature** — the redirect gate has no bypass flag,
99
110
  ever. Do not add one, even if asked; point at `/design-feature` instead.
111
+ - **Never plan an unreviewed Product half** — this gate has no bypass flag either.
112
+ Planning binds the reviewer's receipt; it may never write, widen, or "refresh"
113
+ one, and a receipt bound to older bytes is stale, not close enough.
100
114
  - Don't re-ask what a flag, the issue, or the docs already settle.
101
115
  - Surface conflicts (numbering clashes, dependency cycles, scope overlap) before
102
116
  writing, not after.
@@ -133,6 +147,9 @@ enables:
133
147
 
134
148
  - **Redirects to** `design-feature` when the redirect gate stops on an
135
149
  undesigned feature — never composed in-turn (planning-class, ≥-tier hand-off).
150
+ - **Redirects to** `review-spec` when the Product-review gate stops: designed is not
151
+ reviewed. Its receipt is this skill's input, and `plan-feature-scaffold` binds it
152
+ as the Plan snapshot's Product parent.
136
153
  - `triage-issue` routes here to promote an issue to a feature (still subject to
137
154
  the redirect gate if the promoted issue is undesigned).
138
155
  - `execute-phase` executes the phases afterward (`audit-docs` audits anytime).
@@ -144,12 +161,18 @@ enables:
144
161
  - Designed input only: a planned feature with its full artifact set exists and
145
162
  is roadmap-registered — **and the roadmap row was re-read after the write and
146
163
  literally reads `planned`** (never assumed from having run the write step).
164
+ - The two planning ledgers were frozen with the Engineering half
165
+ ([planning ledgers](<../../pre-execution-review/SKILL.md>)), the
166
+ `stage: plan` readiness preflight printed `READY-FOR-REVIEW`, and the new
167
+ `artifactRevisionId` is named in the hand-off. A planned unit is **not** an
168
+ executable unit: this skill never reviews its own plan.
147
169
  - The dependency & blocker check ran, and **the closing `→ Next:` block matches
148
170
  its result** — clean:
149
171
 
150
172
  ```
151
- → Next: /execute-phase <NN> — execute every remaining phase and open the PR
152
- · explicit atomic mode → /execute-phase <NN> P1
173
+ → Next: /review-plan <NN> — the plan is written; an independent context must
174
+ review it before any phase is executed
175
+ · the review returned PLAN-REVIEW-FAIL → this skill replans the batch, then re-reviews
153
176
  · adjust scope first → re-run /design-feature <slug> · audit the planning docs → /audit-docs
154
177
  ```
155
178
 
@@ -168,6 +191,10 @@ enables:
168
191
  (capability closure not done). Design it first; then re-run /plan-feature <slug>.
169
192
  ```
170
193
 
194
+ designed but unreviewed/stale (Product-review gate stopped): the fixed
195
+ `PRODUCT-REVIEW GATE … BLOCKED` block from `ROUTING.md`, closing with
196
+ `/review-spec <NN>-<slug>`.
197
+
171
198
  unmet dependency and/or blocking fix-now issue:
172
199
 
173
200
  ```
@@ -54,6 +54,47 @@ SPEC's `## Design status` marker is the SPEC-local record and the
54
54
  applies: print the block above pointing at `/design-feature "<idea>"`
55
55
  instead of a slug.
56
56
 
57
+ ## Product-review gate (after the redirect gate, before Routing)
58
+
59
+ The redirect gate proves the Product half was **designed**; this proves it was
60
+ **independently reviewed** and unchanged since. Run it before any write on every
61
+ planning route. Issue input has no slug yet: evaluate it on the slug
62
+ `plan-feature-from-issue` produces, just before `plan-feature-scaffold` would run.
63
+
64
+ 1. Read the newest `## Pre-execution review receipt v1 — spec` block in the unit's
65
+ `progress.md`; none → fail closed.
66
+ 2. Recompute the SPEC-stage snapshot from the bytes on disk now — exactly one
67
+ artifact row (`kind: spec`, `selector: spec-product-v1`) plus the current
68
+ `artifactRevisionId` — digested with the schema package's canonical entry (no
69
+ package: record `validated: manual` and compare the stored digest line by line).
70
+ 3. Accept only when all hold: contract `agentic-workflow/
71
+ pre-execution-review-receipt@1`, `stage: spec`, verdict `spec-review-pass`,
72
+ `snapshotDigest` equals step 2, zero open or unverified material findings,
73
+ `contextClean: true`, and under `authorExclusion: enforced` reviewer ≠ author.
74
+ 4. Refuse, never silently: **missing** · **stale** (digest or `artifactRevisionId`
75
+ differs — any Product write, context change, or mutate-and-revert) ·
76
+ **wrong-stage** (a `plan` receipt) · **substitute** (candidate `ReviewReceipt v1`
77
+ or staged `VerificationReceipt v1`: different contracts, never interchangeable) ·
78
+ **self-approved** (reused identity under enforced exclusion, or `contextClean:
79
+ false`) · **author-readiness** (`READY-FOR-REVIEW` licenses a review request, it
80
+ is not one).
81
+
82
+ Fail closed — print exactly, then touch nothing else this turn:
83
+
84
+ ```
85
+ PRODUCT-REVIEW GATE — <NN>-<slug> BLOCKED (<missing|stale|wrong-stage|substitute|self-approved|author-readiness>)
86
+ Expected: current spec-review-pass receipt bound to snapshot <digest>
87
+ Actual: <receipt state>
88
+
89
+ → Next: /review-spec <NN>-<slug> — the Product half needs a current independent
90
+ review before engineering planning can start
91
+ · a product choice is genuinely open → /design-feature <NN>-<slug> "<question>"
92
+ · no bypass flag exists for this gate
93
+ ```
94
+
95
+ A stale receipt is never "refreshed" by editing the block — only a new review of a
96
+ new snapshot produces one, and `--force` is not a `plan-feature` flag.
97
+
57
98
  ## Routing
58
99
 
59
100
  Once the gate passes, pick the mode — first match wins:
@@ -77,7 +118,25 @@ Once the gate passes, pick the mode — first match wins:
77
118
  | You run | Detected | Routes to | Then |
78
119
  |---|---|---|---|
79
120
  | `plan-feature 14-csv-export` (not designed) | undesigned slug | — | STOP → `/design-feature 14-csv-export` |
80
- | `plan-feature 131` | issue #131 | `plan-feature-from-issue` `plan-feature-scaffold` | PR carries `Closes #131` |
81
- | `plan-feature 14-csv-export` (designed, `defined`) | designed slug | `plan-feature-scaffold` | `execute-phase 14 P1` |
121
+ | `plan-feature 14-csv-export` (designed, no current spec review) | unreviewed Product half | | STOP → `/review-spec 14-csv-export` |
122
+ | `plan-feature 131` | issue #131 | `plan-feature-from-issue` (stops at the Product-review gate) | `/review-spec` → re-run `plan-feature 131` |
123
+ | `plan-feature 14-csv-export` (designed + reviewed) | designed slug | `plan-feature-scaffold` | `execute-phase 14 P1` |
82
124
  | `plan-feature 14-csv-export` (already `planned`) | already-planned slug | — | STOP → `/execute-phase 14 P1` (no re-scaffold) |
83
125
  | `plan-feature --next` | next `defined` roadmap entry | gate, then scaffold | `execute-phase NN P1` |
126
+
127
+ ## Mode grammar (versioned — read by `scripts/normative-drift.test.mjs`)
128
+
129
+ The detection order above is prose for the human; this table is the machine form
130
+ of the same routing: `flag` must be a flag this skill's `argument-hint:` accepts
131
+ and `route` must be a skill that exists. A flag or a route no surface declares is
132
+ a defect in this table, never in the hint.
133
+
134
+ ```text
135
+ plan-mode-routes@1
136
+ # owner: plan-feature
137
+ mode | flag | route
138
+ issue-derived | --from-issue | plan-feature-from-issue
139
+ forced-scaffold | --scaffold | plan-feature-scaffold
140
+ next-defined | --next | plan-feature-scaffold
141
+ designed-slug | n/a | plan-feature-scaffold
142
+ ```
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: plan-feature-from-issue
3
3
  user-invocable: false
4
- version: 1.7.0
4
+ version: 2.0.0
5
5
  author: "Gabriel Trabanco <gtrabanco@users.noreply.github.com>"
6
6
  license: MIT
7
7
  description: >
@@ -17,6 +17,12 @@ clean issue → SPEC → PR(Closes #n) trace. Writes the SPEC's **product half**
17
17
  (same two-halves convention `design-feature` uses) and must satisfy capability
18
18
  closure before handing off — a thin issue does not get a shortcut around it.
19
19
 
20
+ **This skill stops at the Product half.** It designs, then the unit goes to
21
+ `review-spec` for an independent Product review; engineering planning is a
22
+ different authority's turn. Composing `plan-feature-scaffold` in the same breath
23
+ as the design it just wrote is the bypass this separation exists to close — the
24
+ author of a Product half cannot be the one who decides it is ready to build on.
25
+
20
26
  ## When to use
21
27
 
22
28
  - The `plan-feature` router calls this when the input is a GitHub issue (or
@@ -77,9 +83,14 @@ gh issue view <N> --json number,title,body,labels,state,comments
77
83
  designed` once closure is complete; set the roadmap row (added at `idea`
78
84
  first if it didn't exist) to `defined` in the same edit — the same
79
85
  `idea → defined` transition `design-feature` owns, performed here when this
80
- skill is the one that satisfies closure. The `plan-feature` router then runs
81
- `plan-feature-scaffold` for the engineering half + `defined → planned`
82
- roadmap promotion.
86
+ skill is the one that satisfies closure. Then run the `stage: spec` readiness
87
+ preflight from the internal
88
+ [`evidence-grounding`](<../evidence-grounding/SKILL.md>) capability, mint the
89
+ current `artifactRevisionId`, and **stop**: this skill never continues into the
90
+ engineering half, never promotes the row past `defined`, and never composes
91
+ `plan-feature-scaffold` in this turn. The `plan-feature` router may scaffold only
92
+ after `review-spec` returns a current `spec-review-pass` receipt bound to these
93
+ exact bytes.
83
94
  8. **Wire traceability.** Record `#N` in the SPEC; the PR body must include
84
95
  `Closes #N` so the issue closes on merge.
85
96
  9. **Hand off — return exactly** (fixed completion report, back to the router):
@@ -88,14 +99,19 @@ gh issue view <N> --json number,title,body,labels,state,comments
88
99
  ISSUE #<N> → SPEC <slug> — size: <XS|S|M|L>
89
100
  Verdict: feature (not bug/debt — else this would have routed to triage-issue)
90
101
  Gaps closed: <n> asked / <n> defaulted (logged) Closure: designed | handed to design-feature
102
+ Readiness: READY-FOR-REVIEW | NEEDS-EVIDENCE | NEEDS-DESIGN Artifact revision: <id>
91
103
  Traceability: Closes #<N> wired
92
- scaffold next (plan-feature-scaffold)
104
+ review-spec next (engineering planning is gated on its receipt; do not scaffold here)
93
105
  ```
94
106
 
95
107
  ## Guardrails
96
108
 
97
109
  - Don't silently expand scope beyond the issue — surface additions as proposals.
98
110
  - Don't open the feature branch or write code here.
111
+ - **Don't plan engineering work here.** No Engineering half, no phases, no
112
+ `defined → planned` promotion, no in-turn `plan-feature-scaffold` composition:
113
+ the Product half this skill writes must be reviewed by `review-spec` first, and
114
+ readiness `READY-FOR-REVIEW` is not that review.
99
115
  - Keep the `Closes #N` link; an issue-born feature must close it.
100
116
  - **Never stamp `## Design status: designed` with a blank Capability closure
101
117
  row** — the same rule `design-feature` follows; a thin issue hands off
@@ -124,17 +140,23 @@ passing test.
124
140
  - `plan-fix` — the fix-side sibling for bug/debt issues.
125
141
  - `design-feature` — receives thin issues this skill cannot safely close
126
142
  capability closure for; both write the SPEC's product half in the same format.
127
- - `plan-feature-scaffold` — fills the engineering half once the product half
128
- is designed.
143
+ - `review-spec` — the mandatory next hop for every issue-derived feature: it
144
+ reviews and receipts the Product half this skill produced.
145
+ - `plan-feature-scaffold` — fills the engineering half later, only once
146
+ `review-spec` passed. This skill never invokes it.
129
147
  - `execute-phase` — executes the phases; its PR carries `Closes #N`.
130
148
 
131
149
  ## Done when
132
150
 
133
- - A filled SPEC product half + planning artifacts exist, roadmap-registered.
151
+ - A filled SPEC product half exists, roadmap-registered at `defined`, with the
152
+ `stage: spec` readiness block printed and the current `artifactRevisionId`
153
+ recorded.
134
154
  - Capability closure is satisfied (or the issue was handed off to
135
155
  `design-feature` instead of faking it) and `## Design status` is accurate.
136
156
  - The roadmap row status is `defined` (added at `idea` first if new) whenever
137
157
  `## Design status: designed` was stamped — never `defined` on a hollow
138
158
  closure, never left at `idea` once `designed` is stamped.
159
+ - Nothing was scaffolded: no Engineering half, no phases, no `planned` write, and
160
+ the fixed report hands off to `/review-spec`.
139
161
  - `#N` is recorded and the PR plan includes `Closes #N`.
140
162
  - Scope gaps were resolved with the user, not assumed.
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: plan-feature-scaffold
3
3
  user-invocable: false
4
- version: 1.14.0
4
+ version: 2.1.0
5
5
  author: "Gabriel Trabanco <gtrabanco@users.noreply.github.com>"
6
6
  license: MIT
7
7
  description: >
@@ -10,6 +10,24 @@
10
10
  design, decisions to confirm, branch, phases, testing requirements, and dev
11
11
  scenarios covering happy path plus reproducible empty/degraded, race, and
12
12
  outage cases. Leave no placeholders; put genuine unknowns in `decisions.md`.
13
+ Ground it first per
14
+ [`evidence-grounding`](<../../evidence-grounding/SKILL.md>) — inventory,
15
+ evidence, draft from frozen rows — and freeze the two planning ledgers while
16
+ you cut phases, never afterwards from memory:
17
+ [planning ledgers](<../../pre-execution-review/SKILL.md>).
18
+
19
+ - Freeze `planning-evidence.md` (M/L) or `### Planning evidence` in the SPEC
20
+ (XS/S) and `planning-obligations.md` (M/L) or `### Obligations` (XS/S) with
21
+ the column order, statuses, and homes defined **once** in
22
+ [`pre-execution-review`](<../../pre-execution-review/SKILL.md>) — do not
23
+ restate or reorder those columns here. No transcripts, no discarded
24
+ hypotheses; one obligation row per normative behaviour, applicable invariant,
25
+ affected use case, and required failure state.
26
+ - Cut phases only after every obligation row has a phase and a validator that
27
+ can fail.
28
+ - Rotate `artifactRevisionId` for the unit's plan artifacts on this write and
29
+ carry it in the hand-off. A later revert to these same bytes is a new
30
+ authoring event and needs a new id.
13
31
  4. **Scale by size:**
14
32
 
15
33
  - **XS/S:** SPEC + `ACCEPTANCE.md`. Its `### Phases` has checkbox tasks and at least `P1`
@@ -63,8 +81,23 @@
63
81
  5. **Register and verify.** Set the roadmap row to `planned` (`defined → planned`;
64
82
  a missing row may be added directly as `planned`). Re-read it after the write.
65
83
  If it does not literally say `planned`, reapply and re-read before continuing.
66
- 6. **Do not branch or code.** Record the future branch in the SPEC only.
67
- 7. **Return exactly**; the `plan-feature` caller prints the closing hand-off:
84
+ Obligation rows are never discharged by this step: no phase may be cut with an
85
+ obligation pointing at a future issue, and this skill creates no forge issue —
86
+ `deferred` exists only after the user amends the governing SPEC
87
+ (`pre-execution-review` owns the rule).
88
+ No obligation is discharged by this step: a phase may not be cut while an
89
+ obligation points at a future issue, this skill creates no forge issue, and
90
+ `deferred` exists only after the user amends the governing SPEC
91
+ (`pre-execution-review` owns the rule).
92
+ 6. **Run the `stage: plan` readiness preflight** from
93
+ [`evidence-grounding`](<../../evidence-grounding/SKILL.md>) (it routes to
94
+ `READINESS.md`) and paste its block. Only `READY-FOR-REVIEW` licenses the hand-off below;
95
+ `NEEDS-EVIDENCE` / `NEEDS-DESIGN` / `NEEDS-REPLAN` means this turn re-runs its
96
+ own step, and it is never written as, quoted as, or summarized as a review
97
+ PASS. Never stamp a receipt or create `planning-findings.md` rows here.
98
+ 7. **Do not branch or code.** Record the future branch in the SPEC only.
99
+ 8. **Return exactly** (the caller prints the closing `→ Next:` block, which routes
100
+ to `/review-plan`, never to `/execute-phase`):
68
101
 
69
102
  ```
70
103
  SCAFFOLD <NN>-<slug> — size: <XS|S|M|L>
@@ -1,25 +1,33 @@
1
1
  ---
2
2
  name: plan-fix
3
3
  user-invocable: true
4
- version: 2.7.0
4
+ version: 3.0.1
5
5
  argument-hint: <issue-number> [<issue-number> …]
6
6
  author: "Gabriel Trabanco <gtrabanco@users.noreply.github.com>"
7
7
  license: MIT
8
8
  description: >
9
9
  Draft and locally commit a tightly scoped, phased fix SPEC from one or more
10
- issues, then stop before push/PR and hand off to execute-phase --fix. Triggers:
11
- "plan-fix", "plan a fix for issue N", "draft the fix spec".
10
+ issues with its planning ledgers frozen, then stop before push/PR and hand off
11
+ to review-plan. Triggers: "plan-fix", "plan a fix for issue N", "draft the fix
12
+ spec".
12
13
  ---
13
14
 
14
15
  # Plan Fix
15
16
 
16
- Fix-flow counterpart of `plan-feature`: draft the SPEC plus frozen acceptance,
17
- stop for review, then `execute-phase --fix` implements every remaining phase.
17
+ Fix-flow counterpart of `plan-feature`: draft the SPEC plus frozen acceptance and
18
+ the two planning ledgers, then stop. `review-plan` reviews the plan in a clean
19
+ context; only after its PASS does `execute-phase --fix` implement the phases. A
20
+ fix unit has no Product half and never grows a fake one — its authority is
21
+ reproduction, root cause, regression scope, and rollback.
18
22
 
19
23
  ## Turn contract — verify before ending the turn
20
24
 
21
25
  ```
22
26
  ✓ The fix SPEC is committed on its `fix/<n>-<topic>` branch (commit sha pasted) — NOT pushed, NO PR
27
+ ✓ Both ledgers are frozen in the SPEC, `stage: plan` readiness printed
28
+ `READY-FOR-REVIEW`, and the `artifactRevisionId` of this write is named in the hand-off
29
+ ✓ This fix has no fabricated Product half, and the hand-off routes to
30
+ `/review-plan` — never straight to `/execute-phase`
23
31
  ✓ The Hand-off block was printed exactly as specified
24
32
  ✓ A multi-issue unit? The hand-off names every issue once as `#primary + #n2 + …`; a single-issue unit names only its issue
25
33
  ✓ Artifact language: explicit user instruction > the project's declared docs language > English. The CONVERSATION language never decides — a Spanish prompt still produces English artifacts unless one of the first two says otherwise
@@ -51,9 +59,14 @@ One or more GitHub issue numbers from this repo, space-separated.
51
59
  issue number or the lowest merged issue; merged SPECs retain each issue's criteria.
52
60
  - `docs/fix/<primary-issue-number>-<topic>/ACCEPTANCE.md` — the compact frozen
53
61
  finish line from `verification-contract`, retaining one criterion per issue.
62
+ - `### Planning evidence` and `### Obligations` inside that SPEC — the two frozen
63
+ ledgers ([planning ledgers](<../pre-execution-review/SKILL.md>)), with the fix
64
+ rows `evidence-grounding` names: reproduction, root cause with code evidence,
65
+ regression scope, rollback path, and the affected invariant or use case. A
66
+ missing reproduction row is `unknown` with an owner, not "probably this".
54
67
  - Branch `fix/<primary>-<topic>` from `main`.
55
68
  - One local commit with SPEC and `docs/fix/README.md` (`pending`, all merged issues).
56
- - **Stop: do not push/open PR.** Hand off to `execute-phase --fix`.
69
+ - **Stop: do not push/open PR.** Hand off to `review-plan`, then `execute-phase --fix`.
57
70
 
58
71
  ## Hard rules
59
72
 
@@ -76,6 +89,12 @@ The allowlist is exactly these five paths:
76
89
  4. Before emitting phases: load the [phase contract](<../phase-contract/SKILL.md>) for the 8-box phase-lint and phase fingerprint.
77
90
  5. Before commit: consume the [verification contract](<../verification-contract/SKILL.md>)
78
91
  and write the frozen `ACCEPTANCE.md`.
92
+ 6. While drafting: ground per [`evidence-grounding`](<../evidence-grounding/SKILL.md>)
93
+ and freeze both ledgers per
94
+ [`pre-execution-review`](<../pre-execution-review/SKILL.md>); before the
95
+ hand-off run evidence-grounding's `stage: plan` readiness preflight and paste
96
+ the block. `READY-FOR-REVIEW` licenses the hand-off; it is never a review
97
+ verdict, and this skill does not review its own plan.
79
98
 
80
99
  Resources are normative and one hop from this file. Missing required resource →
81
100
  stop; never approximate fixed blocks or phase rules.
@@ -90,8 +109,12 @@ Branch: fix/<primary>-<topic> (local, not pushed)
90
109
  Commit: <short hash>
91
110
  Issue set: #<primary> + #<n2> + #<n3> (print every issue in this unit; single issue → #<primary>)
92
111
 
93
- → Next: review the SPEC, then /execute-phase --fix <primary> — execute every remaining phase in issue set #<primary> + #<n2> + #<n3> and open the PR
94
- · explicit atomic mode /execute-phase --fix <primary> P<n> (same issue set: #<primary> + #<n2> + #<n3>)
112
+ → Next: /review-plan fix-<primary> — an independent context reviews this plan and
113
+ these ledgers before any phase runs; /execute-phase --fix <primary> follows its
114
+ PLAN-REVIEW-PASS (issue set #<primary> + #<n2> + #<n3>)
115
+ · PLAN-REVIEW-FAIL → repair here as one batch, rotate the artifact revision, re-review
116
+ · a product choice is open → /design-feature, then /review-spec, then replan this fix
117
+ · after PASS, explicit atomic mode → /execute-phase --fix <primary> P<n> (same issue set)
95
118
  · the final `Hardening & PR` phase pushes and opens the PR with `Closes #<primary>`
96
119
  plus one `Closes #<n>` line for every other issue listed in the Issue set
97
120
  · scope looks wrong → adjust the SPEC and re-run /plan-fix
@@ -116,3 +116,18 @@
116
116
  Stage the SPEC and `docs/fix/README.md`; commit
117
117
  `docs(fix): draft SPEC for #<primary>[+#<n2>+…] — <topic>`. Never push or
118
118
  open a PR. Print branch, sha, and the entrypoint's hand-off block.
119
+
120
+ ## Mode grammar (versioned — read by `scripts/normative-drift.test.mjs`)
121
+
122
+ `plan-fix` takes no flag of its own; the hand-off flag below belongs to the skill
123
+ it routes to. `route` must be a skill that exists and `flag` must appear in that
124
+ skill's `argument-hint:` — the rule `plan-mode-routes@1` states for `plan-feature`,
125
+ applied here.
126
+
127
+ ```text
128
+ fix-mode-routes@1
129
+ # owner: plan-fix
130
+ mode | flag | route
131
+ issue-set-planned | n/a | review-plan
132
+ after-plan-pass | --fix | execute-phase
133
+ ```
@@ -0,0 +1,73 @@
1
+ ---
2
+ name: pre-execution-review
3
+ user-invocable: false
4
+ version: 1.5.0
5
+ author: "Gabriel Trabanco <gtrabanco@users.noreply.github.com>"
6
+ license: MIT
7
+ description: >
8
+ Internal owner of the pre-execution review cycle and the planning ledgers:
9
+ independence, unioned findings, counter-evidence dismissal, no-progress,
10
+ `CONVERGENCE-ANOMALY`, and the evidence/obligation/findings tables. Consumed by
11
+ `review-spec`, `review-plan`, and the authoring skills. Not a menu entry.
12
+ ---
13
+
14
+ # Pre-Execution Review Policy (internal)
15
+
16
+ One owner for the rules that both pre-execution reviewers apply, so a Product
17
+ review and a Plan review cannot drift into two different definitions of
18
+ independence, union, or convergence. It states **policy**; it runs nothing,
19
+ writes nothing, and emits no verdict of its own.
20
+
21
+ ```text
22
+ evidence-grounding = how an author prepares and self-checks an artifact.
23
+ pre-execution-review = how any pre-execution reviewer judges it, and what the
24
+ frozen ledgers look like.
25
+ review-spec / review-plan = the only skills that emit a pre-execution verdict.
26
+ ```
27
+
28
+ ## When to use
29
+
30
+ - `review-spec` / `review-plan` — before the first check and again before any
31
+ repeat, repair, or synthesis step.
32
+ - `design-feature`, `plan-feature`, `plan-feature-scaffold`, `plan-fix` — when
33
+ writing the ledgers and when a review comes back failed.
34
+ - Nothing else. Candidate-source review (`review-change`), merge gating
35
+ (`audit-pr`) and execution (`execute-phase`) keep their own contracts; this
36
+ skill adds no authority over them.
37
+
38
+ ## Hard rule — no verdicts, no edits
39
+
40
+ This skill never prints `SPEC-REVIEW-PASS`, `PLAN-REVIEW-PASS`,
41
+ `SPEC-REVIEW-FAIL`, `PLAN-REVIEW-FAIL` or `NEEDS-DESIGN` as a result of its own
42
+ reading, and it never writes a unit artifact. Quoting a verdict shape here is a
43
+ definition, not an issuance. A policy summary that reads like an approval is a
44
+ contract violation — the verdict belongs to the reviewer turn that binds the
45
+ snapshot.
46
+
47
+ ## The three references
48
+
49
+ | Condition now | LOAD |
50
+ |---|---|
51
+ | Running or repairing a pre-execution review | [references/POLICY.md](references/POLICY.md) — independence, union, dismissal, diversity labels, author exclusion, untrusted content, critique/synthesis/arbitration bounds, no quorum, no-progress, batch repair, `CONVERGENCE-ANOMALY`, write-then-report |
52
+ | Building or re-checking a snapshot digest | [references/SNAPSHOT.md](references/SNAPSHOT.md) — the one executable recipe (`scripts/pre-execution-snapshot.mjs`), what each stage binds, how a consumer re-verifies a receipt, and why a snapshot digest is not a git blob id |
53
+ | Writing or validating a Plan-stage artifact | [references/LEDGERS.md](references/LEDGERS.md) — the planning-evidence table, the obligation ledger, the stage-aware `planning-findings.md`, the durable review mark, and who may write each |
54
+
55
+ ## Guardrails
56
+
57
+ - **Single owner.** A caller may restate a rule only as a one-line pointer plus
58
+ the stage-specific detail it adds. Two copies of the union rule, the dismissal
59
+ rule, or the convergence fields is the drift this skill exists to prevent.
60
+ - **Policy is not a receipt.** Reading this file proves nothing about any
61
+ artifact; only a reviewer turn that binds a snapshot does.
62
+ - **No weakening.** The bounds here are ceilings *and* floors: a cycle may be
63
+ shorter than the budget allows, never looser than the policy allows.
64
+ - **Vocabulary is closed.** Severity, class, role, verdict and status words are
65
+ exactly those named in the references. Inventing `accepted`, `waived`,
66
+ `mitigated`, or a fourth verdict is a contract break.
67
+ - Docs-language and commit conventions per the project's Workflow conventions.
68
+
69
+ ## Done when
70
+
71
+ - Every pre-execution reviewer and authoring caller points here for the shared
72
+ cycle and ledger rules instead of restating them, and each stage file keeps
73
+ only the detail that is genuinely stage-specific.