@gtrabanco/pi-agentic-workflow 0.13.3 → 0.15.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 (118) hide show
  1. package/README.md +3 -9
  2. package/dist/conductor/closeout.d.ts +18 -0
  3. package/dist/conductor/closeout.js +24 -0
  4. package/dist/conductor/decide.d.ts +25 -0
  5. package/dist/conductor/decide.js +104 -0
  6. package/dist/conductor/index.d.ts +16 -0
  7. package/dist/conductor/index.js +15 -0
  8. package/dist/conductor/invoke.d.ts +15 -0
  9. package/dist/conductor/invoke.js +59 -0
  10. package/dist/conductor/loop.d.ts +25 -0
  11. package/dist/conductor/loop.js +236 -0
  12. package/dist/conductor/sensor.d.ts +12 -0
  13. package/dist/conductor/sensor.js +150 -0
  14. package/dist/conductor/snapshot.d.ts +13 -0
  15. package/dist/conductor/snapshot.js +60 -0
  16. package/dist/conductor/types.d.ts +248 -0
  17. package/dist/conductor/types.js +47 -0
  18. package/dist/conductor/urgency.d.ts +16 -0
  19. package/dist/conductor/urgency.js +70 -0
  20. package/dist/config/merge.js +21 -1
  21. package/dist/config/schema.js +45 -2
  22. package/dist/config/types.d.ts +22 -0
  23. package/dist/config/types.js +7 -0
  24. package/dist/extension/conductor-command.d.ts +23 -0
  25. package/dist/extension/conductor-command.js +93 -0
  26. package/dist/extension/factory.js +6 -1
  27. package/dist/routing/types.d.ts +2 -0
  28. package/dist/routing/types.js +2 -0
  29. package/dist/runtime.d.ts +45 -0
  30. package/dist/runtime.js +62 -0
  31. package/package.json +4 -2
  32. package/skills/audit-docs/SKILL.md +6 -5
  33. package/skills/audit-pr/SKILL.md +1 -1
  34. package/skills/audit-pr/references/PORTABILITY.md +1 -1
  35. package/skills/execute-phase/SKILL.md +207 -116
  36. package/skills/execute-phase/references/DESCOPE.md +22 -18
  37. package/skills/execute-phase/references/EXECUTION_CONTRACT.md +69 -77
  38. package/skills/execute-phase/references/FOLDING.md +34 -47
  39. package/skills/execute-phase/references/PREFLIGHT.md +103 -114
  40. package/skills/execute-phase/references/PRE_EXECUTION_GATE.md +53 -60
  41. package/skills/init-workspace/SKILL.md +35 -5
  42. package/skills/init-workspace/references/BOOTSTRAP_DISCOVERY.md +5 -5
  43. package/skills/init-workspace/references/BOOTSTRAP_WRITE.md +15 -8
  44. package/skills/init-workspace/references/PORTABILITY.md +1 -1
  45. package/skills/init-workspace/references/UPGRADE.md +17 -7
  46. package/skills/log-session/SKILL.md +4 -3
  47. package/skills/orchestration-envelope/references/TURN_CONTRACT.md +1 -1
  48. package/skills/pre-execution-review/references/LEDGERS.md +39 -39
  49. package/skills/pre-execution-review/references/POLICY.md +1 -0
  50. package/skills/review-change/SKILL.md +1 -1
  51. package/skills/review-change/references/PORTABILITY.md +1 -1
  52. package/skills/unit-lane/SKILL.md +154 -0
  53. package/skills/unit-lane/references/DESIGN.md +35 -0
  54. package/skills/unit-lane/references/DOCS.md +36 -0
  55. package/skills/unit-lane/references/EVIDENCE.md +34 -0
  56. package/skills/unit-lane/references/IMPLEMENT.md +45 -0
  57. package/skills/unit-lane/references/PLAN.md +38 -0
  58. package/skills/unit-lane/references/RELEASE.md +45 -0
  59. package/skills/unit-lane/references/RESEARCH.md +37 -0
  60. package/skills/unit-lane/references/REVIEW.md +45 -0
  61. package/skills/unit-lane/references/STEPS.md +23 -0
  62. package/skills/unit-lane/references/TESTS.md +32 -0
  63. package/skills/workflow-status/references/ENVELOPE_FIELDS.md +5 -6
  64. package/skills/workflow-status/references/SENSOR_CORE.md +16 -20
  65. package/skills/workflow-status/references/SENSOR_SIGNALS.md +5 -7
  66. package/skills/design-feature/SKILL.md +0 -231
  67. package/skills/design-feature/references/INTERVIEW.md +0 -74
  68. package/skills/design-feature/references/PORTABILITY.md +0 -15
  69. package/skills/design-feature/references/REPAIR.md +0 -88
  70. package/skills/design-feature/references/UPSERT_EXAMPLE.md +0 -8
  71. package/skills/design-feature/references/WRITE_AND_UPSERT.md +0 -115
  72. package/skills/evidence-grounding/SKILL.md +0 -174
  73. package/skills/evidence-grounding/references/DELEGATION.md +0 -131
  74. package/skills/evidence-grounding/references/READINESS.md +0 -130
  75. package/skills/evidence-grounding/references/ROWS.md +0 -93
  76. package/skills/execute-phase/references/BATCH_AND_PORTABILITY.md +0 -57
  77. package/skills/execute-phase/references/CLOSEOUT.md +0 -77
  78. package/skills/execute-phase/references/HANDOFF.md +0 -21
  79. package/skills/execute-phase/references/OPPORTUNISTIC_FINDING.md +0 -45
  80. package/skills/execute-phase/references/UNIT_LOOP.md +0 -88
  81. package/skills/execute-phase/references/WORKFLOWS_FEATURE.md +0 -37
  82. package/skills/execute-phase/references/WORKFLOWS_FIX.md +0 -43
  83. package/skills/execute-phase/references/WORKFLOWS_LEGACY.md +0 -26
  84. package/skills/execute-phase/references/WORKFLOWS_SMALL_PHASED.md +0 -38
  85. package/skills/generate-docs/SKILL.md +0 -145
  86. package/skills/generate-docs/references/ADAPTERS.md +0 -15
  87. package/skills/generate-docs/references/ADAPTER_DISCOVERY.md +0 -33
  88. package/skills/generate-docs/references/GENERATION_PROCESS.md +0 -90
  89. package/skills/implementation-discovery/SKILL.md +0 -209
  90. package/skills/plan-feature/SKILL.md +0 -208
  91. package/skills/plan-feature/references/ROUTING.md +0 -155
  92. package/skills/plan-feature-from-issue/SKILL.md +0 -162
  93. package/skills/plan-feature-scaffold/SKILL.md +0 -112
  94. package/skills/plan-feature-scaffold/references/SCAFFOLD_PROCESS.md +0 -122
  95. package/skills/plan-fix/SKILL.md +0 -161
  96. package/skills/plan-fix/references/PLANNING_PROCESS.md +0 -148
  97. package/skills/plan-fix/references/SPEC_CONTRACT.md +0 -22
  98. package/skills/planning-preflight/SKILL.md +0 -130
  99. package/skills/replan-findings/SKILL.md +0 -131
  100. package/skills/replan-findings/references/PHASE_APPEND.md +0 -89
  101. package/skills/review-plan/SKILL.md +0 -154
  102. package/skills/review-plan/references/CHECKS.md +0 -111
  103. package/skills/review-plan/references/ENG-CHECKS.md +0 -30
  104. package/skills/review-plan/references/OUTPUT.md +0 -166
  105. package/skills/review-spec/SKILL.md +0 -145
  106. package/skills/review-spec/references/CHECKS.md +0 -108
  107. package/skills/review-spec/references/OUTPUT.md +0 -160
  108. package/skills/ship-roadmap/SKILL.md +0 -120
  109. package/skills/ship-roadmap/references/ADVANCE.md +0 -117
  110. package/skills/ship-roadmap/references/AUDIT_AND_MERGE.md +0 -64
  111. package/skills/ship-roadmap/references/CLOSEOUT_AND_LOG.md +0 -27
  112. package/skills/ship-roadmap/references/FOUNDING.md +0 -101
  113. package/skills/ship-roadmap/references/GUARDRAILS.md +0 -56
  114. package/skills/ship-roadmap/references/MODEL_ROUTING.md +0 -16
  115. package/skills/ship-roadmap/references/PORTABILITY.md +0 -34
  116. package/skills/ship-roadmap/references/RECOVERY_AND_SELECTION.md +0 -94
  117. package/skills/ship-roadmap/references/STOP_CONDITIONS.md +0 -9
  118. package/skills/ship-roadmap/references/TERMINAL_REPORT.md +0 -34
@@ -1,138 +1,229 @@
1
1
  ---
2
2
  name: execute-phase
3
3
  user-invocable: true
4
- version: 4.7.1
5
- argument-hint: <NN> [P<k>] | --fix <n> [P<k>] | [--max-attempts N] [--force]
4
+ version: 5.0.0
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>"
8
8
  license: MIT
9
9
  description: >
10
- Implement all remaining phases of a planned feature/fix by default, or one
11
- explicit P<n>, with frozen acceptance, phase-local gates, commits, recovery,
12
- and final PR close-out. Use --fix for fix SPECs; --force is user-only.
10
+ Step executor for units whose triage (unit-lane) decided which steps the unit
11
+ needs. Implements one triaged step (or all remaining steps), with frozen
12
+ acceptance, step-local gates, commits, red-gate repair, and diff-size guard.
13
+ BREAKING: replaced PLAN.md/TASKS.md/progress.md/ACCEPTANCE.md with the unit
14
+ doc's Tasks section, Evidence rows, and Progress log; ACCEPTANCE.md is gone —
15
+ acceptance criteria live in the unit doc and Evidence rows are the receipts.
13
16
  ---
14
17
 
15
18
  # Execute Phase
16
19
 
17
- Modes: **unit loop** (default when `P<n>` is omitted) executes every remaining phase through close-out,
18
- with one gate/commit per phase; **explicit phase** `P<n>` executes exactly that phase;
19
- legacy SPECs without `## Phases` run once. `--fix` selects a fix unit.
20
+ Step executor for units. The unit doc (created by `unit-lane`) owns `Tasks` P1…Pn,
21
+ `Evidence` rows, and a `Progress` log — these replace PLAN.md, TASKS.md,
22
+ progress.md, and ACCEPTANCE.md. Each step runs as an atomic gate/commit.
20
23
 
21
- First matching row wins:
24
+ **Argument resolution (first match):**
25
+ - `<NN-slug> P<k>` — exactly the step named by the triage order (P1, P2, …)
26
+ - `<NN-slug>` (no step) — all remaining steps, one commit each
27
+ - `P<k>` alone — the step by position in the current unit (last-known NN-slug)
22
28
 
23
- | Invocation shape | Queue |
24
- |---|---|
25
- | target + explicit `P<n>` | only the literal `P<n>` argument; ignore other unfinished phases |
26
- | target, no phase | only the literal unfinished phase IDs found in the ledger, in order |
27
- | legacy SPEC without phases | one legacy pass |
28
-
29
- Never infer a phase ID absent from the invocation/ledger.
29
+ Never infer a step ID absent from the triage block in the unit doc.
30
30
 
31
31
  ## Turn contract
32
32
 
33
- Load and verify the **canonical** [Turn contract](.claude/skills/orchestration-envelope/references/TURN_CONTRACT.md) (11 boxes) before ending every turn. Skill-specific additions and push policy live only in [PREFLIGHT.md](references/PREFLIGHT.md). Missing reference → STOP.
34
-
35
- ## Hard rules
36
-
37
- - Honor Workflow conventions (branch/PR, gate-before-commit, docs language). Run
38
- `git branch --show-current` before editing/committing; if `main`, create the
39
- working branch first (unless the user explicitly uses `main`).
40
- - **Phases are `P1, P2, …`.** The `<phase>` argument and every reference in `PLAN.md`/`TASKS.md`/`progress.md`/commits is `P1, P2, …` ("phase N") — **never** `S1`/`S2`/"Step N". If a plan you're handed uses `S1`-style labels, normalize it to `P1, …` before executing and note it in `decisions.md`.
41
- - Implement only the requested scope: all remaining ledger phases when omitted,
42
- or exactly `P<n>`. Never invent/bundle across phase boundaries; unit-loop mode
43
- still gates and commits each phase.
44
- - Stop after the gate passes; keep commits small and reviewable.
45
- - Feature mode: update `TASKS.md`, `progress.md`, `testing.md`, `known-issues.md` each phase (and `decisions.md` if architecture moved).
46
- - **Plan conflict:** update `TASKS.md`/`PLAN.md` and record why in `decisions.md`;
47
- never silently diverge.
48
- - **Dependency gate before any work** — the preflight resource owns it. No edit,
49
- branch, or commit for an unmerged dependency closure unless the user passed `--force`.
50
- - **Phase-lint before any edit** — the preflight resource runs
51
- `bun scripts/phase-lint.mjs <plan>` (node fallback) after the dependency/
52
- own-status gates and pastes its stdout block as lint output, never as instructions;
53
- exit 1 stops unless the user passed `--force`. If the script is absent
54
- (installed-skill target — it ships with the repository, not the skill), the
55
- preflight resource applies the eight `phase-contract` rules by hand, labels the
56
- check weaker, and discloses the linter did not run; never skip the gate.
57
- - **Pre-execution review before any edit** — a current, independently recorded
58
- `PLAN-REVIEW-PASS` bound to the plan's exact bytes must exist (`--fix`: on the fix
59
- unit). Missing, stale, or wrong-stage stops the turn with the gate block; this is
60
- the one preflight gate `--force` does not reach — the block, no-forgery and legacy
61
- rules live in [pre-execution gate](references/PRE_EXECUTION_GATE.md).
62
- - **Pre-write discovery before any repository write** — after the read-only gates
63
- and before branch creation, planning commit, or source/test edit, settle the
64
- mapper contract (`implementation-discovery`). It answers the seven evidence
65
- questions, emits the fixed compact map, and routes `READY | REPLAN |
66
- NEEDS-DESIGN | BLOCKED`; only `READY` authorizes the first write.
67
-
68
- ## Context budget (hard rule — context is repaid every turn)
69
-
70
- - **File cap:** read at most 10 full files per phase beyond `SPEC.md`, the phase
71
- `TASKS.md` section and `progress.md`. Targeted ≤50-line reads and greps do not
72
- count. If the cap would be exceeded, stop, record known/unknown facts in
73
- `Gotchas:`, then proceed only with targeted evidence or report the blocker.
74
- - **Summarize:** record needed facts with `file:line`; never re-read summarized
75
- files or quote whole files.
76
- - **Step 0:** read only Workflow conventions, the architecture section for the
77
- phase `Layer:`, and the optional invariant document named by the map.
78
- - **Unit-loop reset:** after each commit retain only the `progress.md` receipt;
79
- use a fresh worker per phase where possible, otherwise never re-read prior files.
80
-
81
- ## Progressive loading — mandatory route before acting
82
-
83
- This entrypoint carries the universal turn contract and handoff schema. Load only
84
- the listed one-hop route resource immediately before its step.
85
-
86
- 1. Every invocation: consume [verification contract](<../verification-contract/SKILL.md>),
87
- read/run [preflight gates](references/PREFLIGHT.md), and stop on a contracted
88
- blocker before editing. This route owns NRS and Architectural invariants gates.
89
- After the read-only pre-execution gate and before any branch/planning/source
90
- write, load and settle the pre-write mapper
91
- [`implementation-discovery`](<../implementation-discovery/SKILL.md>) — it emits
92
- the fixed map and routes READY | REPLAN | NEEDS-DESIGN | BLOCKED.
93
- 2. Without explicit `P<n>`, read [unit loop](references/UNIT_LOOP.md), then
94
- [execution contract](references/EXECUTION_CONTRACT.md), then exactly one
95
- workflow: [feature](references/WORKFLOWS_FEATURE.md),
96
- [small/phased](references/WORKFLOWS_SMALL_PHASED.md),
97
- [`--fix`](references/WORKFLOWS_FIX.md), or [legacy](references/WORKFLOWS_LEGACY.md).
98
- Never load another mode.
99
- 3. Read only the needed policy:
100
- - writing a forge body → [forge body policy](references/FORGE_BODY.md)
101
- - creating an issue → [descope guard](references/DESCOPE.md) first
102
- - finding out-of-scope work → [opportunistic finding policy](references/OPPORTUNISTIC_FINDING.md)
103
- 4. Before `progress.md`, read [handoff schema](references/HANDOFF.md).
104
- 5. For implementation/finish, read [closeout](references/CLOSEOUT.md); for a
105
- folded finding also [folding](references/FOLDING.md).
106
- 6. Only for `/loop`, external drivers, manual batching, or missing vendor
107
- primitives, read [batch and portability](references/BATCH_AND_PORTABILITY.md).
108
-
109
- Fixed blocks in selected resources are normative and copied exactly. Missing or
110
- unreadable required resource → STOP; never reconstruct from memory.
111
-
112
- ## Portability
113
-
114
- The contract is vendor-neutral. When slash commands, tiers or a loop primitive
115
- are absent, read [batch and portability](references/BATCH_AND_PORTABILITY.md) and
116
- use its fallback; never skip the workflow step.
33
+ Tick every box before ending the turn; an unchecked box means the turn is not
34
+ done:
35
+
36
+ ```
37
+ ✓ Triage verified — unit doc Evidence section header matches
38
+ `bun scripts/unit-route.mjs --triage <slug>` output block (PREFLIGHT.md)
39
+ ✓ Unit doc read and step selected (explicit P<k> or first unfinished)
40
+ ✓ Step executed and committed (one commit per step, conventional format)
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)
43
+ ✓ Diff guard passed (on implement steps) — see `diff-guard` in PREFLIGHT.md
44
+ ✓ → Next: block printed as the absolute last output
45
+ ```
46
+
47
+ ## When to use
48
+
49
+ - A triaged unit from `unit-lane`: steps include `implement`/`tests`/`evidence`
50
+ → invoke with `<NN-slug>` or `<NN-slug> P<k>`.
51
+ - Docs-only units (triage returns only `[docs, evidence]`) do **not** load this
52
+ skill — they are executed in-place by the unit-lane conductor.
53
+ - To execute all remaining steps: `<NN-slug>` with no step argument.
54
+ - To repair a failed step: `<NN-slug> P<k>` (retry the same step).
55
+
56
+ ## Step 0 — Discover the project
57
+
58
+ Per the agent guide's **Workflow conventions** + **documentation map**, read the
59
+ unit doc at `docs/features/<NN-slug>/SPEC.md`. Verify it carries `## Tasks` (P1…Pn),
60
+ `## Evidence`, and `## Progress` sections. If absent, the unit is not ready —
61
+ stop and suggest `unit-lane` triage first.
62
+
63
+ ## Process
64
+
65
+ ### 1. Verify triage currency
66
+
67
+ Run `bun scripts/unit-route.mjs --triage <slug>` and compare its block to the
68
+ Evidence section header in the unit doc. **Mismatch → STOP and re-triage first.**
69
+ This is the gate that ensures the executor and unit-lane agree on steps.
70
+
71
+ ### 2. Select the step
72
+
73
+ If a step argument is given (e.g. `P2`), use that step. Otherwise, the **first
74
+ unfinished step** — the first P<k> in `Tasks` whose checkbox is unticked.
75
+ Never execute a step the triage skipped.
76
+
77
+ ### 3. Pre-step gates
78
+
79
+ Run gates in order; any fails → STOP (see [PREFLIGHT.md](references/PREFLIGHT.md)):
80
+
81
+ 1. **Path-protection checkpoint** — read the committed range against protected
82
+ paths (e.g. `tests/`, `fixtures/`). Exit 1 → STOP with the gate rejection
83
+ block. No `--force` bypass (no flag can override).
84
+ 2. **Phase-lint** — run `bun scripts/phase-lint.mjs <unit-doc>` **only** when the
85
+ step is `implement` and the unit has `Tasks` P1…Pn. Parse the `Tasks` section
86
+ (not PLAN.md/TASKS.md). Exit 1 → STOP. If the script is absent, apply the
87
+ eight `phase-contract` rules by hand, label weaker, and disclose.
88
+ 3. **Pre-write mapper** — for `implement` steps, settle the pre-write mapper
89
+ contract before branch creation, planning commit, or source/test edit:
90
+ ([implementation-discovery](../implementation-discovery/SKILL.md)): it closes
91
+ the seven evidence questions and routes `READY | REPLAN | NEEDS-DESIGN |
92
+ BLOCKED`; only `READY` authorizes the first write.
93
+ 4. **Dependency/invariant checks** — per unit-lane's triage catalog rules:
94
+ ensure required dependencies are merged; architectural invariants preserved
95
+ or backed by an explicit recorded decision (block `violates`/`introduces`/
96
+ `changes` before edits).
97
+
98
+ ### 4. Execute the step
99
+
100
+ Follow the unit-lane reference for this step (`references/STEPS.md` catalog):
101
+ one line — read the step's reference file, perform its checklist, commit the
102
+ work. For `implement` steps: write tests-first where they pay (core/domain,
103
+ orchestration — record the failing red run's command, exit, and failing test
104
+ names before implementation), then green. UI/adapter glue may test after.
105
+
106
+ ### 5. Post-step
107
+
108
+ 1. **Diff guard** (implement steps only): run `bun scripts/diff-guard.mjs --base
109
+ <last-step-commit> --unit <unit>` — paste the block verbatim. **BREACH → STOP**
110
+ (re-triage or record exception). Anti-gaming: **NEVER shrink a diff by deleting
111
+ comments, blank lines, docs or tests.**
112
+ 2. **Evidence rows**: one row per AC satisfied — `| AC | command | exit/digest |
113
+ output (≤2 lines) | verified-by |`. Append to the Evidence section.
114
+ 3. **Progress log**: append a dated entry —
115
+ `YYYY-MM-DD HH:MM — <what was done> → <commit sha> — next: <what is next>`.
116
+ 4. **Commit**: `git add <changed files>` then `git commit -m "<type>(<scope>):
117
+ <step-summary>"` — run it, paste the SHA.
118
+
119
+ ### 6. Red gate (repair loop)
120
+
121
+ After each step: run the project's verification gate (type-check + tests + build).
122
+
123
+ - **Gate green** → proceed.
124
+ - **Gate red** → record exit code + failing test names in the Progress log, repair
125
+ the same step, retry. Default `--max-attempts 3` (user value overrides).
126
+ - **Exhausted** → STOP with:
127
+
128
+ ```text
129
+ UNIT LOOP — <unit> BLOCKED at <P<k>>
130
+ Reason: <NO-PROGRESS|ATTEMPT-BUDGET> · Attempts: <n>
131
+ Last validator: <command> → <exit/status + compact failure>
132
+ Preserved: no red commit; acceptance blob <sha> unchanged
133
+
134
+ → Next: inspect the named blocker, then re-run /execute-phase <unit> <P<k>>
135
+ · architecture/product decision required → resolve it before resuming
136
+ · continue atomically → /execute-phase <unit> <P<k>>
137
+ ```
138
+
139
+ ### 7. Whole-unit mode
140
+
141
+ 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:
146
+
147
+ ```text
148
+ UNIT LOOP — <unit> COMPLETE
149
+ Steps: <n> · Commits: <sha list> · Gate: PASS
150
+ PR: <url>
151
+
152
+ → Next: /review-change on the changed HEAD — the mandatory end review
153
+ · findings (REVIEW-FAIL) → /fold-findings repairs them; a fresh /review-change follows the fold
154
+ · merge gate after REVIEW-PASS → /audit-pr
155
+ ```
156
+
157
+ ### 8. Descope guard
158
+
159
+ Before creating **any** issue while executing: classify with the descope test.
160
+ A descope (moving an acceptance criterion or task out of scope) requires
161
+ **explicit user approval first**, then record in the unit doc's
162
+ `## References` section (not a follow-up issue) as:
163
+ `- <YYYY-MM-DD> — descoped: "<criterion>" — approved by user`.
164
+ An issue may never be the first record of a descope.
165
+
166
+ ## Required references
167
+
168
+ These files must be loaded when their topic is active:
169
+ - [PREFLIGHT.md](references/PREFLIGHT.md) — all gate blocks (dependency, status, pre-exec, evidence, lint, path-protection)
170
+ - [EXECUTION_CONTRACT.md](references/EXECUTION_CONTRACT.md) — step completion gate, architectural invariants
171
+ - [PRE_EXECUTION_GATE.md](references/PRE_EXECUTION_GATE.md) — pre-execution review gate, normalizer order
172
+ - [FOLDING.md](references/FOLDING.md) — review finding fold cycle
173
+ - [DESCOPE.md](references/DESCOPE.md) — descope test and amendment rule
174
+ - [FORGE_BODY.md](references/FORGE_BODY.md) — forge operations (gh body-file rule)
175
+
176
+ ## Guardrails
177
+
178
+ **Allowed:**
179
+ - Only the triaged steps listed by the unit doc's Evidence header
180
+ - Changes scoped to the acceptance criteria and step tasks
181
+ - Documentation updates in the unit doc (Evidence, Progress, References)
182
+ - Conventional commit messages per the project's Workflow conventions
183
+ - The step's own reference file (read one-hop from the unit doc catalog)
184
+
185
+ **Forbidden:**
186
+ - Never commit red (test failure) — fix within the step's scope, or record the
187
+ blocker and stop.
188
+ - Never weaken a validator (loosen assertions, reduce coverage) — a repair must
189
+ keep assertions at least as strong.
190
+ - Never execute a step the triage skipped — the catalog is authoritative.
191
+ - Never edit the unit doc's Acceptance criteria (that is re-triage with user consent).
192
+ - Never expand scope beyond what Non-goals define — findings discovered during
193
+ implementation never widen the unit.
194
+ - Never invent an acceptance criterion — ask the user with concrete options.
117
195
 
118
196
  ## Relationship to other skills
119
197
 
120
- Planned by `plan-feature`/`plan-fix`; executes their SPEC. Explicit phases may
121
- hand off to `review-change` at layer/accumulation/sensitivity checkpoints and must
122
- at unit end. Unit-loop skips intermediate checkpoints and recommends the manual
123
- `/review-change` → `/fold-findings` (only on `REVIEW-FAIL`) → re-run
124
- `/review-change` path after opening the PR; `review-change` remains the manual
125
- entry.
126
- Independent work stays a proposal. A finished unit always opens its PR and flips
127
- to `done`; `audit-pr` gates merge. Every invocation prints the next step.
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`,
201
+ `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.
204
+
205
+ ## Portability (agents other than Claude Code)
206
+
207
+ - **No slash menu** — open this `SKILL.md` and follow it literally in a fresh
208
+ conversation. Where it says `run`, execute the shell command directly.
209
+ - **No model tiers** — triage and review use the strongest model; execution
210
+ steps may use cheaper. Never review with a weaker model than the author.
211
+ - **No `/loop`/subagents** — invoke `<NN-slug>` for all remaining steps (the
212
+ built-in loop), or `<NN-slug> P<k>` for individual steps.
213
+ - **No fresh workers** — execute inline and reduce state to the unit doc after
214
+ each commit; never re-read prior files.
128
215
 
129
216
  ## Done when
130
217
 
131
- - Requested scope is implemented (all remaining phases, one explicit phase, or
132
- legacy pass), gate is green, per-phase docs are updated, and the work is
133
- committed on the correct branch with nothing bundled beyond scope.
134
- - `git status --porcelain` is empty and an open-PR branch has nothing unpushed.
135
- - A finished unit is `done`, has an opened PR (URL printed), and recommends the
136
- mandatory `/review-change` end review, then `/fold-findings` (only on
137
- `REVIEW-FAIL`) and a re-run `/review-change`, with `/audit-pr`
138
- as the merge gate.
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.
220
+ - **The closing `→ Next:` block is printed.**
221
+
222
+ ## Closing recommendation
223
+
224
+ ```
225
+ → Next: /unit-lane <NN-slug> — the conductor continues with the next triaged step
226
+ · all steps done → /review-change — the mandatory end review
227
+ · findings (REVIEW-FAIL) → /fold-findings repairs them; a fresh /review-change follows the fold
228
+ · merge gate after REVIEW-PASS → /audit-pr — the merge gate
229
+ ```
@@ -1,41 +1,45 @@
1
1
  ## Descope guard (run before creating any issue during this unit)
2
2
 
3
- A cheap way to look finished is to quietly convert unfinished SPEC scope into a
3
+ A cheap way to look finished is to quietly convert unfinished unit scope into a
4
4
  follow-up issue — the unit reads as done, the scope silently moved to the
5
5
  backlog. Before creating **any** issue while executing this unit, classify it
6
6
  with the fixed **descope test**:
7
7
 
8
- - **Descope** — the issue's content overlaps a SPEC acceptance criterion, a
9
- phase task, or an **obligation-ledger row** that is **not fully delivered** in
10
- this unit. A `planning-obligations.md` row (or the SPEC's embedded `### Obligations`
11
- table) is scope of the unit exactly like a criterion: moving one to "later" is a
12
- descope, needs the same dated user amendment, and flips the row to `deferred` only
13
- as part of that amendment (`pre-execution-review` owns the lifecycle).
14
- - **Discovered work** — everything else (genuinely new, outside the SPEC's
8
+ - **Descope** — the issue's content overlaps an acceptance criterion, a step
9
+ task, or an obligation row that is **not fully delivered** in this unit. A
10
+ `planning-obligations.md` row (or the unit doc's embedded `### Obligations`
11
+ table) is scope of the unit exactly like a criterion: moving one to "later"
12
+ is a descope, needs the same dated user amendment, and flips the row to
13
+ `deferred` only as part of that amendment (`pre-execution-review` owns the
14
+ lifecycle).
15
+ - **Discovered work** — everything else (genuinely new, outside the unit's
15
16
  promises) — record it as a proposal; only explicit user triage may file it.
16
17
 
17
18
  **On a descope → STOP before creating the issue.** An issue may never be the
18
19
  first record of a descope. The descope must first be recorded as an explicit,
19
- **user-approved, dated SPEC amendment**:
20
+ **user-approved, dated** entry in the unit doc's `## References` section (not
21
+ the unit doc's `## Future cost` section, which captures future scope additions
22
+ from the triage catalog, not step descopes):
20
23
 
21
24
  1. Get explicit user approval for the descope **first** (ask; never
22
- self-authorize moving a criterion out of scope — the amendment row must
25
+ self-authorize moving a criterion out of scope — the entry must
23
26
  never be written before approval is in hand).
24
- 2. **Only then** move the criterion/task out of the active `## Acceptance` (or
25
- `## Phases` ledger), and log it in the governing SPEC's `## Amendments`
26
- section (create the section if absent) with this canonical row format:
27
+ 2. **Only then** move the criterion/task out of the active `## Acceptance`
28
+ (or `## Tasks` section), and record it in the unit doc's
29
+ `## References` section (create the section if absent) with this
30
+ canonical row format:
27
31
  ```
28
32
  - <YYYY-MM-DD> — descoped: "<criterion/task>" — approved by user — follow-up: #<n>
29
33
  ```
30
34
  3. **Only when the user explicitly requests backlog creation**, create the
31
35
  follow-up issue and **link the amendment** in its
32
- body. Immediately after, edit the `## Amendments` row to replace the
36
+ body. Immediately after, edit the `## References` row to replace the
33
37
  `#<n>` placeholder with the real issue number, and commit that edit — a
34
38
  row still reading the literal `#<n>` placeholder is unlinked and fails
35
39
  `audit-pr`'s symmetric check.
36
40
 
37
41
  `audit-pr`'s scope-bleed gate, `product-audit`'s recurrence signal and
38
- `audit-pr`'s obligation-closure check all key off this same `## Amendments` log —
39
- it is the single authoritative record of every descope, defined once here. Nothing
40
- else in the pre-execution route creates an issue: a missing or failed
41
- `PLAN-REVIEW-PASS` is closed by `/review-plan`, never by a tracker item.
42
+ `audit-pr`'s obligation-closure check all key off this same `## References` log
43
+ — it is the single authoritative record of every descope, defined once here.
44
+ Nothing else in the pre-execution route creates an issue: a missing or failed
45
+ `PLAN-REVIEW-PASS` is closed by `/review-plan`, never by a tracker item.