@gtrabanco/pi-agentic-workflow 0.13.2 → 0.14.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 (95) hide show
  1. package/README.md +3 -9
  2. package/dist/routing/catalogue.d.ts +1 -1
  3. package/dist/routing/catalogue.js +1 -1
  4. package/dist/runtime.d.ts +45 -0
  5. package/dist/runtime.js +62 -0
  6. package/package.json +10 -8
  7. package/skills/audit-docs/SKILL.md +6 -5
  8. package/skills/audit-pr/SKILL.md +1 -1
  9. package/skills/audit-pr/references/PORTABILITY.md +1 -1
  10. package/skills/execute-phase/SKILL.md +207 -116
  11. package/skills/execute-phase/references/DESCOPE.md +22 -18
  12. package/skills/execute-phase/references/EXECUTION_CONTRACT.md +69 -77
  13. package/skills/execute-phase/references/FOLDING.md +34 -47
  14. package/skills/execute-phase/references/PREFLIGHT.md +103 -114
  15. package/skills/execute-phase/references/PRE_EXECUTION_GATE.md +53 -60
  16. package/skills/init-workspace/SKILL.md +52 -16
  17. package/skills/init-workspace/references/BOOTSTRAP_DISCOVERY.md +6 -6
  18. package/skills/init-workspace/references/BOOTSTRAP_WRITE.md +17 -10
  19. package/skills/init-workspace/references/PORTABILITY.md +1 -1
  20. package/skills/init-workspace/references/UPGRADE.md +50 -15
  21. package/skills/log-session/SKILL.md +4 -3
  22. package/skills/orchestration-envelope/references/TURN_CONTRACT.md +1 -1
  23. package/skills/pre-execution-review/references/LEDGERS.md +39 -39
  24. package/skills/pre-execution-review/references/POLICY.md +1 -0
  25. package/skills/product-audit/SKILL.md +4 -4
  26. package/skills/product-audit/references/AUDIT_PROCESS.md +3 -3
  27. package/skills/review-change/SKILL.md +1 -1
  28. package/skills/review-change/references/PORTABILITY.md +1 -1
  29. package/skills/unit-lane/SKILL.md +154 -0
  30. package/skills/unit-lane/references/DESIGN.md +35 -0
  31. package/skills/unit-lane/references/DOCS.md +36 -0
  32. package/skills/unit-lane/references/EVIDENCE.md +34 -0
  33. package/skills/unit-lane/references/IMPLEMENT.md +45 -0
  34. package/skills/unit-lane/references/PLAN.md +38 -0
  35. package/skills/unit-lane/references/RELEASE.md +45 -0
  36. package/skills/unit-lane/references/RESEARCH.md +37 -0
  37. package/skills/unit-lane/references/REVIEW.md +45 -0
  38. package/skills/unit-lane/references/STEPS.md +23 -0
  39. package/skills/unit-lane/references/TESTS.md +32 -0
  40. package/skills/workflow-status/references/ENVELOPE_FIELDS.md +5 -6
  41. package/skills/workflow-status/references/SENSOR_CORE.md +16 -20
  42. package/skills/workflow-status/references/SENSOR_SIGNALS.md +5 -7
  43. package/skills/design-feature/SKILL.md +0 -231
  44. package/skills/design-feature/references/INTERVIEW.md +0 -74
  45. package/skills/design-feature/references/PORTABILITY.md +0 -15
  46. package/skills/design-feature/references/REPAIR.md +0 -88
  47. package/skills/design-feature/references/UPSERT_EXAMPLE.md +0 -8
  48. package/skills/design-feature/references/WRITE_AND_UPSERT.md +0 -115
  49. package/skills/evidence-grounding/SKILL.md +0 -174
  50. package/skills/evidence-grounding/references/DELEGATION.md +0 -131
  51. package/skills/evidence-grounding/references/READINESS.md +0 -130
  52. package/skills/evidence-grounding/references/ROWS.md +0 -93
  53. package/skills/execute-phase/references/BATCH_AND_PORTABILITY.md +0 -57
  54. package/skills/execute-phase/references/CLOSEOUT.md +0 -77
  55. package/skills/execute-phase/references/HANDOFF.md +0 -21
  56. package/skills/execute-phase/references/OPPORTUNISTIC_FINDING.md +0 -45
  57. package/skills/execute-phase/references/UNIT_LOOP.md +0 -88
  58. package/skills/execute-phase/references/WORKFLOWS_FEATURE.md +0 -37
  59. package/skills/execute-phase/references/WORKFLOWS_FIX.md +0 -43
  60. package/skills/execute-phase/references/WORKFLOWS_LEGACY.md +0 -26
  61. package/skills/execute-phase/references/WORKFLOWS_SMALL_PHASED.md +0 -38
  62. package/skills/generate-docs/SKILL.md +0 -145
  63. package/skills/generate-docs/references/ADAPTERS.md +0 -15
  64. package/skills/generate-docs/references/ADAPTER_DISCOVERY.md +0 -33
  65. package/skills/generate-docs/references/GENERATION_PROCESS.md +0 -90
  66. package/skills/implementation-discovery/SKILL.md +0 -209
  67. package/skills/plan-feature/SKILL.md +0 -208
  68. package/skills/plan-feature/references/ROUTING.md +0 -155
  69. package/skills/plan-feature-from-issue/SKILL.md +0 -162
  70. package/skills/plan-feature-scaffold/SKILL.md +0 -112
  71. package/skills/plan-feature-scaffold/references/SCAFFOLD_PROCESS.md +0 -122
  72. package/skills/plan-fix/SKILL.md +0 -161
  73. package/skills/plan-fix/references/PLANNING_PROCESS.md +0 -148
  74. package/skills/plan-fix/references/SPEC_CONTRACT.md +0 -22
  75. package/skills/planning-preflight/SKILL.md +0 -130
  76. package/skills/replan-findings/SKILL.md +0 -131
  77. package/skills/replan-findings/references/PHASE_APPEND.md +0 -89
  78. package/skills/review-plan/SKILL.md +0 -154
  79. package/skills/review-plan/references/CHECKS.md +0 -111
  80. package/skills/review-plan/references/ENG-CHECKS.md +0 -30
  81. package/skills/review-plan/references/OUTPUT.md +0 -166
  82. package/skills/review-spec/SKILL.md +0 -145
  83. package/skills/review-spec/references/CHECKS.md +0 -108
  84. package/skills/review-spec/references/OUTPUT.md +0 -160
  85. package/skills/ship-roadmap/SKILL.md +0 -120
  86. package/skills/ship-roadmap/references/ADVANCE.md +0 -117
  87. package/skills/ship-roadmap/references/AUDIT_AND_MERGE.md +0 -64
  88. package/skills/ship-roadmap/references/CLOSEOUT_AND_LOG.md +0 -27
  89. package/skills/ship-roadmap/references/FOUNDING.md +0 -101
  90. package/skills/ship-roadmap/references/GUARDRAILS.md +0 -56
  91. package/skills/ship-roadmap/references/MODEL_ROUTING.md +0 -16
  92. package/skills/ship-roadmap/references/PORTABILITY.md +0 -34
  93. package/skills/ship-roadmap/references/RECOVERY_AND_SELECTION.md +0 -94
  94. package/skills/ship-roadmap/references/STOP_CONDITIONS.md +0 -9
  95. package/skills/ship-roadmap/references/TERMINAL_REPORT.md +0 -34
@@ -1,209 +0,0 @@
1
- ---
2
- name: implementation-discovery
3
- user-invocable: false
4
- version: 1.1.0
5
- author: "Gabriel Trabanco <1969593+gtrabanco@users.noreply.github.com>"
6
- license: MIT
7
- description: >
8
- Internal contract: the single owner of the bounded pre-write implementation
9
- discovery step. One read-only mapper that closes seven evidence questions,
10
- emits one fixed compact map, and routes READY | REPLAN | NEEDS-DESIGN |
11
- BLOCKED before any branch, planning, or source write. Consumed only by
12
- execute-phase on the pre-write route. Not a menu entry.
13
- ---
14
-
15
- # Implementation Discovery (internal)
16
-
17
- The one authoritative owner of the bounded, read-only pre-write mapper consumed
18
- by `execute-phase`. A phase does not touch the repository until this step has
19
- closed its questions and said `READY`. Nothing else may define what a valid
20
- pre-write discovery pass is.
21
-
22
- ## When to use
23
-
24
- - `execute-phase` — before any branch/planning/source write, after the read-only
25
- dependency/status/acceptance/phase/feature-28 receipt checks.
26
- - The step runs only on the pre-write route; it is never a general-purpose
27
- orientation pass and never a substitute for planning.
28
-
29
- ## Inputs (exact, only these)
30
-
31
- The mapper receives only:
32
-
33
- - the governing SPEC/fix obligations for the current phase;
34
- - the current feature-28 SPEC and Plan receipt digests;
35
- - the phase-relevant rows from frozen planning evidence, with source revision,
36
- affected decision/obligation, freshness, and declared unknowns;
37
- - the phase fingerprint, ordered tasks, acceptance/obligation ids, and the last
38
- progress receipt;
39
- - source HEAD plus clean-source / allowed-planning-path evidence;
40
- - applicable NRS / decision / invariant evidence;
41
- - the repository discovery tools available in this environment.
42
-
43
- ## Advisory locators
44
-
45
- Semantic/symbol navigation and Engram/memory tools are optional adapters that may
46
- locate evidence faster; they are never authority. Direct repository/Git/search/
47
- read/test fallback must satisfy the identical evidence contract, and only
48
- repository bytes answer a map field. The tool that found a citation does not
49
- excuse a missing `path:line` or a contradictory claim.
50
-
51
- ## Seven evidence questions
52
-
53
- Every pass must answer — each answer citing repository-relative `path:line`,
54
- symbol, or test plus exact source revision / content identity:
55
-
56
- 1. Which entry points and public/internal interfaces own current behaviour?
57
- 2. Which callers, adapters, roles, compatibility surfaces, and failure paths
58
- can this phase affect?
59
- 3. Which helpers, patterns, decisions, and invariants constrain the change?
60
- 4. Which tests, fixtures, probes, and production-like scenarios establish
61
- current behaviour?
62
- 5. Which exact writes are expected, and which reviewed obligation does each
63
- serve?
64
- 6. Which carried planning-evidence claims and Plan assumptions are directly
65
- confirmed, refined, stale, missing, or contradicted by source?
66
- 7. Which relevant unknowns remain, who owns them, and what evidence resolves
67
- them?
68
-
69
- The mapper records conclusions, not every search. Repeating a search/read
70
- requires a new question, changed source, or insufficient cited evidence;
71
- otherwise it stops (no-progress).
72
-
73
- ## Inline and fresh routing
74
-
75
- **Inline** is permitted only when behaviour is localized/familiar, targeted
76
- evidence answers every question, no public/persistence/security/recovery/
77
- compatibility boundary may change, and the executor can finish the map before
78
- writing.
79
-
80
- **A fresh read-only mapper** is required for cross-module/layer or unfamiliar
81
- work, public/persistence/security/recovery/compatibility impact, competing
82
- project patterns, an unproven material Plan assumption, prior failed
83
- attempts/review bias, or any case where editing would begin before the map
84
- closes. Same-model fresh context is useful but is not model diversity. Manual
85
- sequential fresh conversations are the portable fallback.
86
-
87
- No file-count threshold participates in the route or the verdict.
88
-
89
- ## Fixed implementation map
90
-
91
- ```text
92
- IMPLEMENTATION MAP — unit-id phase-id
93
- Map revision: opaque single-consumption id
94
- Source identity: HEAD + clean-source proof + cited-evidence manifest digest
95
- Authority: SPEC receipt + Plan receipt + phase fingerprint
96
- Planning evidence: carried row ids + current confirmation/refinement/conflict
97
- Obligations: ordered acceptance/fix/obligation ids
98
- Entry points: path:line or symbol + role + exact evidence
99
- Affected surfaces: callers/adapters/roles/compatibility/failure paths + evidence
100
- Current behaviour: evidence-backed summary
101
- Reuse and constraints: helper/pattern/decision/invariant/fixture + evidence
102
- Expected writes: ordered path + obligation served + reason
103
- Validation: falsification probe + TDD target + phase gate
104
- Plan assumptions: confirmed items + evidence
105
- Contradictions: none or exact Plan/source conflict
106
- Unknowns: none or exact missing fact + owner + resolution evidence
107
- Decision: READY | REPLAN | NEEDS-DESIGN | BLOCKED
108
- ```
109
-
110
- ## Verdicts
111
-
112
- `READY` requires every field, question, and owned obligation covered, no
113
- material contradiction/unknown, an observed falsification probe, and expected
114
- writes inside phase authority. It also requires every carried planning-evidence
115
- row to be confirmed or narrowly refined.
116
-
117
- `REPLAN` means source disproves Engineering assumptions while Product remains
118
- stable, or Plan-level topology/architecture/obligation/validator evidence is
119
- absent.
120
-
121
- `NEEDS-DESIGN` means Product, acceptance, authority, or architecture intent is
122
- missing or conflicting.
123
-
124
- `BLOCKED` names evidence that cannot currently be obtained.
125
-
126
- No other verdict exists.
127
-
128
- ## Routes and upstream owners
129
-
130
- A verdict routes, it never repairs. Missing/contradicted Plan-level topology,
131
- architecture, obligations, validators, or assumptions return to
132
- `plan-feature`/`plan-fix` plus a fresh `review-plan`. Product/acceptance/
133
- authority/architecture gaps return to `design-feature` then `review-spec`. A
134
- verdict with unavailable evidence is one exact `BLOCKED` prerequisite. Mapping
135
- does not decide code correctness — candidate review, verification, and audit
136
- authority are unchanged, and a second repair/re-review cycle inherits feature
137
- 28's `CONVERGENCE-ANOMALY` diagnosis.
138
-
139
- Source-local findings stay local; Plan/Product defects return upstream. A
140
- missing current-unit behaviour entailed by reviewed scope joins the obligation
141
- map and routes upstream; it is never a follow-up issue and never calls the
142
- forge.
143
-
144
- ## Legacy and manual routes
145
-
146
- The portable fallback uses sequential fresh conversations with exact
147
- artifact/source bindings. It may not claim a machine receipt or a durable
148
- guarantee it cannot produce; it says plainly what was observed and what was
149
- not.
150
-
151
- ## Early falsification
152
-
153
- Before READY, run the cheapest relevant read-only probe: a focused existing
154
- test, current parser/CLI output, public type/schema inspection, symbol callers,
155
- or an existing fixture. Record the command/query, the observed result, and the
156
- evidence. A failed probe informs REPLAN/NEEDS-DESIGN; unavailable high-risk
157
- evidence is BLOCKED, never rewritten as confident evidence. This does not
158
- replace TDD or later verification.
159
-
160
- ## No-progress
161
-
162
- Conclusion once. Do not re-read or re-search to reconfirm the same conclusion
163
- without a new question, changed source, or insufficient cited evidence. On
164
- repetition, stop with `BLOCKED` and name what is still missing. Re-read is
165
- allowed only for a changed source revision, a new question, insufficient
166
- evidence, or a contradiction.
167
-
168
- ## Read-only boundary
169
-
170
- The mapper reads; it may not write. It creates no forge issue, no committed
171
- map, no planning unit, no schema, no source edit, and no test edit. It emits the
172
- map and reuses `SkillOutcome v1`. A missing current-unit behaviour entailed by
173
- reviewed scope joins the obligation map and routes upstream; it is not a
174
- follow-up issue. Discovery never calls the forge.
175
-
176
- ## Writer handoff
177
-
178
- The writer receives frozen phase authority plus the fixed compact map. It does
179
- not receive raw files, repeated summaries, raw planning discovery, raw
180
- exploration history, or the authoring conversation unless a cited claim cannot
181
- be interpreted without a focused excerpt. The map preserves the phase-relevant planning-evidence ids and
182
- their current confirmation. The writer may only touch expected paths /
183
- obligations; a newly discovered path or contradiction stops and remaps/routes
184
- rather than expanding silently.
185
-
186
- ## Source identity
187
-
188
- Source identity is exact pre-map HEAD, proof that tracked/untracked changes
189
- outside the allowed planning paths are absent, an ordered manifest digest of
190
- every cited evidence path/content plus the current phase/receipt bindings, and
191
- an opaque `mappingRevisionId` created for this mapping event.
192
-
193
- ## Preparation continuity
194
-
195
- After READY, deterministic setup may create the branch and commit only the
196
- already-reviewed planning paths. Before the first source/test edit the executor
197
- proves either HEAD is unchanged or the new commit is a direct descendant whose
198
- entire diff is the allowed planning set and whose authority/content digests
199
- match. Any other path, parent, receipt, phase, or evidence change invalidates
200
- the map and routes again.
201
-
202
- ## Consumption and recovery
203
-
204
- READY is single-consumption: the first implementation write consumes it. A crash
205
- before the write may resume only after freshness/no-consumption proof. A crash
206
- after any partial write remaps current source during recovery. A new map
207
- revision plus changed Git causal identity prevents reuse after revert; direct
208
- out-of-protocol state manipulation cannot be claimed detectable without runtime
209
- history.
@@ -1,208 +0,0 @@
1
- ---
2
- name: plan-feature
3
- user-invocable: true
4
- version: 5.3.1
5
- argument-hint: <NN-slug | #N> | --from-issue N | --scaffold <slug> | --next
6
- author: "Gabriel Trabanco <1969593+gtrabanco@users.noreply.github.com>"
7
- license: MIT
8
- description: >
9
- Route designed features or issues into engineering planning and roadmap
10
- registration; undesigned work stops at design-feature. Supports `--next`,
11
- `--from-issue`, and `--scaffold`. Triggers: "plan-feature", "plan a feature",
12
- "plan the next roadmap feature", "create SPEC and TASKS".
13
- ---
14
-
15
- # Plan Feature (router)
16
-
17
- The engineering-planning door for a feature whose product definition already
18
- exists. Routes to a focused internal step so only the work you need runs (no
19
- fat single skill). **Docs only — no code, no branch.** Product definition
20
- (raw-idea interview, capability closure) is `design-feature`'s job, not this
21
- one — the routed redirect gate enforces that split.
22
-
23
- ## Turn contract — verify before ending the turn
24
-
25
- ```
26
- ✓ The redirect gate ran FIRST, before any SPEC edit: undesigned input → STOP,
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
31
- ✓ Designed input only: engineering half filled, artifacts written, and the
32
- roadmap entry registered (number, order, deps verified)
33
- ✓ If `plan-feature-scaffold` ran this turn: the roadmap row was re-read
34
- AFTER the write and literally reads `planned` — a dropped `defined→planned`
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
40
- ✓ The dependency & blocker check was RUN and its result decides which closing block is printed
41
- ✓ An unmet dependency? The closing block lists the complete dependency chain, deepest first, joined with ` + `
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
43
- ✓ The closing `→ Next:` block is printed as the ABSOLUTE last output
44
- ```
45
-
46
- About to end the turn with any box unchecked? The turn is NOT done — complete
47
- the missing box first (weak models drop end-of-document duties; this list is
48
- first on purpose).
49
-
50
- ## Step 0 — Discover the project (always first)
51
-
52
- Per the agent guide's **Workflow conventions** + **documentation map**, then read
53
- what THIS skill needs: the **roadmap** (`docs/features/ROADMAP.md`), so routing
54
- and roadmap registration match the project's real layout.
55
-
56
- ## Progressive loading — route before planning
57
-
58
- The allowlist:
59
-
60
- 1. Every invocation: read [redirect gate and routing](references/ROUTING.md),
61
- apply the status gate, then the Product-review gate, and stop on its exact
62
- block when instructed.
63
- 2. Any route that can write planning artifacts: after the redirect gate permits
64
- routing, consume the [planning preflight](<../planning-preflight/SKILL.md>) —
65
- it owns the normalized repository-state read and the ONE final architectural
66
- classification — before composing an internal step.
67
- 3. Before composing an internal step: load the [phase contract](<../phase-contract/SKILL.md>)
68
- so every SPEC written this turn carries the canonical 8-box phase-lint and
69
- the normalized phase fingerprint.
70
- 4. Only when `node scripts/unit-route.mjs <NN>` prints `route: replan`: load the
71
- [replan contract](<../replan-findings/SKILL.md>); it owns the exemption.
72
-
73
- Do not load planning gates after a redirect stop. Both resources are normative,
74
- one hop from this file, and fail closed when missing.
75
-
76
- ## Process
77
-
78
- 1. **Redirect gate** from `ROUTING.md` — always first.
79
- 2. **Product-review gate** from the same resource — current `spec-review-pass`
80
- receipt bound to the recomputed snapshot, or STOP. No bypass flag.
81
- 3. **Route** from the same resource. For issue input, resolve and validate the issue
82
- identity only; after the [planning preflight](<../planning-preflight/SKILL.md>)
83
- confirms that planning may write, compose the from-issue internal to produce
84
- a **filled, sized SPEC product half**; that internal stops at the Product-review
85
- gate, so `plan-feature-scaffold` runs only once `review-spec` has passed the half:
86
- it fills the engineering half, scales the artifacts to the SPEC's size (XS/S →
87
- SPEC-only; M/L → full set) and registers the roadmap. The
88
- already-designed scoped path runs `plan-feature-scaffold` directly. Every
89
- path holds **one immutable planning context** — the roadmap snapshot taken
90
- before writing (and one issue payload when `--from-issue`) — reused across
91
- the internal steps; never re-fetched mid-plan.
92
- 4. **Confirm roadmap.** Verify the feature is registered in
93
- `docs/features/ROADMAP.md` with the right number, ordering, and dependencies;
94
- if any of the three is missing or wrong, fix the entry now — never leave registration for later.
95
- `plan-feature` verifies and repairs the roadmap entry; `plan-feature-scaffold`
96
- is the sole writer of the `defined → planned` write.
97
- 5. **Dependency & blocker check (always, before recommending execution).**
98
- - Walk the feature's `Depends on:` closure (transitively): every dependency
99
- must be `done` **and merged**. Any unmet → the closing block recommends
100
- building the deepest unmet dependency first, NOT this feature.
101
- - Check the fix index + open issues (forge CLI) for fix-now items touching
102
- the same modules this SPEC names. Any hit → the closing block recommends
103
- `/plan-fix <n>` before execution ("building on a known defect bakes it in").
104
- - Planning itself never blocks on either — the SPEC/artifacts are still
105
- written; only the **recommended next step** changes.
106
- 5. **Print the next step** per the check above (see Done when).
107
-
108
- ## Guardrails
109
-
110
- - Docs only — no code, no branch (that is `execute-phase`).
111
- - **Never plan an undesigned feature** — the redirect gate has no bypass flag,
112
- ever. Do not add one, even if asked; point at `/design-feature` instead.
113
- - **Never plan an unreviewed Product half** — this gate has no bypass flag either.
114
- Planning binds the reviewer's receipt; it may never write, widen, or "refresh"
115
- one, and a receipt bound to older bytes is stale, not close enough.
116
- - Don't re-ask what a flag, the issue, or the docs already settle.
117
- - Surface conflicts (numbering clashes, dependency cycles, scope overlap) before
118
- writing, not after.
119
- - Otherwise per the project's **Workflow conventions** (docs-language).
120
-
121
- ## Internal steps (not user-invocable)
122
-
123
- - `plan-feature-from-issue` — issue → scoped SPEC product half, `Closes #N`.
124
- - `plan-feature-scaffold` — SPEC → engineering half + full artifact set +
125
- roadmap entry.
126
-
127
- These run **within this same conversation** (that's what "composing" means) —
128
- on any agent, just follow their `SKILL.md` inline as the routed step. The
129
- raw-idea interview that used to be an internal step of this router is retired
130
- — see `docs/workflow/MIGRATION.md`; that logic now lives in `design-feature`,
131
- a user-facing skill in its own right (product definition is its own pipeline
132
- stage, not an internal routing detail of this one).
133
-
134
- ## Portability (agents other than Claude Code)
135
-
136
- The workflow is the contract; Claude Code features are conveniences. On an
137
- agent that lacks one, apply the fallback — never skip the step the feature
138
- enables:
139
-
140
- - **No slash-command menu** — where this skill says `/<skill>`, open that
141
- skill's `SKILL.md` (wherever your agent installed the skills) and follow it
142
- literally, in a fresh conversation: hand-offs assume a clean context. The
143
- internal steps above are the exception — they run inline, in this one.
144
- - **No per-skill `model:`/`effort:`** — on the `#claude` branch the frontmatter pins these tiers; here, pick tiers yourself:
145
- planning is judgment work — run it on your **strongest** model. The
146
- execution it hands off to may run cheaper.
147
-
148
- ## Relationship to other skills
149
-
150
- - **Redirects to** `design-feature` when the redirect gate stops on an
151
- undesigned feature — never composed in-turn (planning-class, ≥-tier hand-off).
152
- - **Redirects to** `review-spec` when the Product-review gate stops: designed is not
153
- reviewed. Its receipt is this skill's input, and `plan-feature-scaffold` binds it
154
- as the Plan snapshot's Product parent.
155
- - `triage-issue` routes here to promote an issue to a feature (still subject to
156
- the redirect gate if the promoted issue is undesigned).
157
- - `execute-phase` executes the phases afterward (`audit-docs` audits anytime).
158
-
159
- ## Done when
160
-
161
- - The redirect gate ran, and if it stopped, nothing else in this turn touched
162
- the SPEC.
163
- - Designed input only: a planned feature with its full artifact set exists and
164
- is roadmap-registered — **and the roadmap row was re-read after the write and
165
- literally reads `planned`** (never assumed from having run the write step).
166
- - The two planning ledgers were frozen with the Engineering half
167
- ([planning ledgers](<../../pre-execution-review/SKILL.md>)), the
168
- `stage: plan` readiness preflight printed `READY-FOR-REVIEW`, and the new
169
- `artifactRevisionId` is named in the hand-off. A planned unit is **not** an
170
- executable unit: this skill never reviews its own plan.
171
- - The dependency & blocker check ran, and **the closing `→ Next:` block matches
172
- its result** — clean:
173
-
174
- ```
175
- → Next: /review-plan <NN> — the plan is written; an independent context must
176
- review it before any phase is executed
177
- · the review returned PLAN-REVIEW-FAIL → this skill replans the batch, then re-reviews
178
- · adjust scope first → re-run /design-feature <slug> · audit the planning docs → /audit-docs
179
- ```
180
-
181
- already-planned feature (redirect gate stopped, never re-scaffolded):
182
-
183
- ```
184
- → Next: /execute-phase <NN> — this feature is already planned; execute every
185
- remaining phase, don't re-plan it.
186
- · explicit atomic mode → /execute-phase <NN> P1
187
- ```
188
-
189
- undesigned feature (redirect gate stopped):
190
-
191
- ```
192
- → Next: /design-feature <slug> — this feature has no completed product design yet
193
- (capability closure not done). Design it first; then re-run /plan-feature <slug>.
194
- ```
195
-
196
- designed but unreviewed/stale (Product-review gate stopped): the fixed
197
- `PRODUCT-REVIEW GATE … BLOCKED` block from `ROUTING.md`, closing with
198
- `/review-spec <NN>-<slug>`.
199
-
200
- unmet dependency and/or blocking fix-now issue:
201
-
202
- ```
203
- Dependency chain (deepest first): <deepest> + <dependency> + <NN> (replace with every actual member; never print `…`)
204
- → Next: /plan-feature <deepest-unmet-dep> (or /execute-phase <deepest-unmet-dep>) — build the
205
- complete dependency chain first: <deepest> + <dependency> + <NN>
206
- · blocking fix-now issue #<n> in the same area → /plan-fix <n> before executing
207
- · proceed anyway → /execute-phase <NN> --force (the gate logs the override)
208
- ```
@@ -1,155 +0,0 @@
1
- ## Redirect gate (always, before routing)
2
-
3
- Before any other step, resolve the target slug/issue. An issue input
4
- (`--from-issue <N>` or issue URL/number) resolves and validates the issue
5
- identity only; it does not invoke `plan-feature-from-issue` here. The parent
6
- must consume the [planning preflight](<../../planning-preflight/SKILL.md>) and
7
- confirm that planning may write before composing that internal writer. The
8
- internal step supplies the feature slug for the later roadmap gate.
9
-
10
- **Replan exemption — the router runs first.** Before the status gate, run
11
- `node scripts/unit-route.mjs <NN>`. A `route: replan` line means the unit
12
- carries an open finding whose frozen route is the plan owner: skip the STOP and
13
- load [the replan contract](<../../replan-findings/SKILL.md>) to re-cut the plan
14
- from the router's bounded read set. Any other route keeps the gate and the
15
- hand-off its line names; a router that cannot run is `BLOCKED`.
16
-
17
- For other inputs, read **the roadmap status** (`docs/features/ROADMAP.md` → the five-state machine
18
- `idea/defined/planned/in-progress/done`) — the **primary** gate signal. The
19
- SPEC's `## Design status` marker is the SPEC-local record and the
20
- **legacy-compat fallback** only (see step 6 below), never the primary check:
21
-
22
- 1. **Roadmap row status `defined`** → proceed to Routing below (the product
23
- half is designed; the engineering half still needs scaffolding).
24
- 2. **Roadmap row status `planned`** (SPEC + artifacts already present) →
25
- **STOP**. Never invoke `plan-feature-scaffold` — re-scaffolding an
26
- already-planned feature is the re-plan-loop bug this gate exists to close.
27
- Print exactly:
28
-
29
- ```
30
- → Next: /execute-phase <NN> — this feature is already planned; execute every
31
- remaining phase, don't re-plan it.
32
- · explicit atomic mode → /execute-phase <NN> P1
33
- ```
34
- 3. **Roadmap row status `in-progress`** → **STOP**. Print exactly:
35
-
36
- ```
37
- → Next: /execute-phase <NN> <next-phase> — this feature is already being
38
- implemented; resume the current phase, don't re-plan it.
39
- ```
40
- 4. **Roadmap row status `done`** → **STOP** (replanning stays forbidden — the
41
- feature is fully built), and: `done` means built + PR open with the human merge
42
- pending (a lifecycle label, never a gate verdict), so this is **not** "nothing
43
- pending". Route to the merge gate instead. Print exactly:
44
-
45
- ```
46
- → Next: /audit-pr <PR> — done means built + PR open, merge pending (a lifecycle label, never a gate verdict)
47
- · the row's PR is merged → nothing pending, pick the next unit → /plan-feature --next
48
- · no PR is open → the row is mislabeled or execution stopped → /execute-phase <NN> (never a replan)
49
- ```
50
- 5. **Roadmap row status `idea`, or no row at all** → **STOP**. Print exactly:
51
-
52
- ```
53
- → Next: /design-feature <slug> — this feature has no completed product design yet
54
- (capability closure not done). Design it first; then re-run /plan-feature <slug>.
55
- ```
56
-
57
- No bypass flag exists for this gate — an undesigned feature is never
58
- planned by this skill, under any flag or instruction.
59
- 6. **Legacy compat.** A roadmap row still reading a plain `planned` with no
60
- five-state history (predates this repo's roadmap-status-machine feature):
61
- fall back to the SPEC marker — `## Design status: designed` and Capability
62
- closure filled → treat as `defined`+`planned`, STOP per step 2 above (a
63
- legacy `planned` row is still already-planned — hand off to
64
- `/execute-phase`, never re-scaffold). Marker missing/`not designed`/closure
65
- empty → treat as `idea`, STOP per step 5. See `docs/workflow/MIGRATION.md`.
66
- 7. **A raw idea with no slug at all** (nothing to check) → the same STOP
67
- applies: print the block above pointing at `/design-feature "<idea>"`
68
- instead of a slug.
69
-
70
- ## Product-review gate (after the redirect gate, before Routing)
71
-
72
- The redirect gate proves the Product half was **designed**; this proves it was
73
- **independently reviewed** and unchanged since. Run it before any write on every
74
- planning route. Issue input has no slug yet: evaluate it on the slug
75
- `plan-feature-from-issue` produces, just before `plan-feature-scaffold` would run.
76
-
77
- 1. Read the newest `## Pre-execution review receipt v1 — spec` block in the unit's
78
- `progress.md`; none → fail closed.
79
- 2. Recompute the SPEC-stage snapshot from the bytes on disk now — exactly one
80
- artifact row (`kind: spec`, `selector: spec-product-v1`) plus the current
81
- `artifactRevisionId` — digested with the schema package's canonical entry (no
82
- package: record `validated: manual` and compare the stored digest line by line).
83
- 3. Accept only when all hold: contract `agentic-workflow/
84
- pre-execution-review-receipt@1`, `stage: spec`, verdict `spec-review-pass`,
85
- `snapshotDigest` equals step 2, zero open or unverified material findings,
86
- `contextClean: true`, and under `authorExclusion: enforced` reviewer ≠ author.
87
- 4. Refuse, never silently: **missing** · **stale** (digest or `artifactRevisionId`
88
- differs — any Product write, context change, or mutate-and-revert) ·
89
- **wrong-stage** (a `plan` receipt) · **substitute** (candidate `ReviewReceipt v1`
90
- or staged `VerificationReceipt v1`: different contracts, never interchangeable) ·
91
- **self-approved** (reused identity under enforced exclusion, or `contextClean:
92
- false`) · **author-readiness** (`READY-FOR-REVIEW` licenses a review request, it
93
- is not one).
94
-
95
- Fail closed — print exactly, then touch nothing else this turn:
96
-
97
- ```
98
- PRODUCT-REVIEW GATE — <NN>-<slug> BLOCKED (<missing|stale|wrong-stage|substitute|self-approved|author-readiness>)
99
- Expected: current spec-review-pass receipt bound to snapshot <digest>
100
- Actual: <receipt state>
101
-
102
- → Next: /review-spec <NN>-<slug> — the Product half needs a current independent
103
- review before engineering planning can start
104
- · a product choice is genuinely open → /design-feature <NN>-<slug> "<question>"
105
- · no bypass flag exists for this gate
106
- ```
107
-
108
- A stale receipt is never "refreshed" by editing the block — only a new review of a
109
- new snapshot produces one, and `--force` is not a `plan-feature` flag.
110
-
111
- ## Routing
112
-
113
- Once the gate passes, pick the mode — first match wins:
114
-
115
- 1. **Flag forces it** (skip detection): `--scaffold <slug>`, `--next`.
116
- 2. **Issue input** — `--from-issue <N>`, an issue URL, or a bare numeric argument
117
- `<N>` (for example, `131`) selects the issue-derived route; detection itself
118
- does not compose `plan-feature-from-issue`. The parent route owns the
119
- [planning preflight](<../../planning-preflight/SKILL.md>) consumption and must
120
- confirm that planning may write before it composes `plan-feature-from-issue`,
121
- then `plan-feature-scaffold`.
122
- 3. **Scoped** — an existing, designed roadmap slug or a filled `SPEC.md` →
123
- `plan-feature-scaffold`.
124
- 4. **`--next` / no input** — read the roadmap, take the next `defined` entry
125
- (the units that still need engineering planning — a `planned` row is
126
- already scaffolded); apply the redirect gate to it, then scaffold.
127
- 5. **Ambiguous** — ask one question, then route.
128
-
129
- ### Example (routing)
130
-
131
- | You run | Detected | Routes to | Then |
132
- |---|---|---|---|
133
- | `plan-feature 14-csv-export` (not designed) | undesigned slug | — | STOP → `/design-feature 14-csv-export` |
134
- | `plan-feature 14-csv-export` (designed, no current spec review) | unreviewed Product half | — | STOP → `/review-spec 14-csv-export` |
135
- | `plan-feature 131` | issue #131 | `plan-feature-from-issue` (stops at the Product-review gate) | `/review-spec` → re-run `plan-feature 131` |
136
- | `plan-feature 14-csv-export` (designed + reviewed) | designed slug | `plan-feature-scaffold` | `execute-phase 14 P1` |
137
- | `plan-feature 14-csv-export` (already `planned`) | already-planned slug | — | STOP → `/execute-phase 14 P1` (no re-scaffold) |
138
- | `plan-feature --next` | next `defined` roadmap entry | gate, then scaffold | `execute-phase NN P1` |
139
-
140
- ## Mode grammar (versioned — read by `scripts/normative-drift.test.mjs`)
141
-
142
- The detection order above is prose for the human; this table is the machine form
143
- of the same routing: `flag` must be a flag this skill's `argument-hint:` accepts
144
- and `route` must be a skill that exists. A flag or a route no surface declares is
145
- a defect in this table, never in the hint.
146
-
147
- ```text
148
- plan-mode-routes@1
149
- # owner: plan-feature
150
- mode | flag | route
151
- issue-derived | --from-issue | plan-feature-from-issue
152
- forced-scaffold | --scaffold | plan-feature-scaffold
153
- next-defined | --next | plan-feature-scaffold
154
- designed-slug | n/a | plan-feature-scaffold
155
- ```