@nklisch/pi-agile-workflow 0.15.3 → 0.16.3

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 (41) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/.codex-plugin/plugin.json +1 -1
  3. package/CHANGELOG.md +8 -0
  4. package/docs/ARCHITECTURE.md +117 -65
  5. package/docs/PRINCIPLES.md +84 -18
  6. package/docs/SPEC.md +70 -2
  7. package/docs/VISION.md +33 -12
  8. package/hooks/scripts/prompt-context.py +7 -1
  9. package/hooks/scripts/test_prompt_context.py +16 -0
  10. package/package.json +1 -1
  11. package/scripts/tests/convert-content-integrity.test.sh +4 -4
  12. package/scripts/tests/convert-review-weight.test.sh +61 -0
  13. package/scripts/work-view.sh +1 -1
  14. package/skills/autopilot/SKILL.md +138 -91
  15. package/skills/convert/SKILL.md +55 -11
  16. package/skills/epic-design/SKILL.md +37 -70
  17. package/skills/feature-design/SKILL.md +52 -68
  18. package/skills/fix/SKILL.md +52 -34
  19. package/skills/gate-cruft/SKILL.md +69 -24
  20. package/skills/gate-docs/SKILL.md +12 -5
  21. package/skills/gate-patterns/SKILL.md +7 -3
  22. package/skills/gate-refactor/SKILL.md +18 -6
  23. package/skills/gate-security/SKILL.md +16 -7
  24. package/skills/gate-tests/SKILL.md +86 -71
  25. package/skills/implement/SKILL.md +79 -58
  26. package/skills/implement-orchestrator/SKILL.md +274 -587
  27. package/skills/perf-design/SKILL.md +11 -12
  28. package/skills/principles/SKILL.md +175 -379
  29. package/skills/principles/references/advisory-review.md +76 -0
  30. package/skills/principles/references/code-design.md +164 -0
  31. package/skills/principles/references/models.md +42 -63
  32. package/skills/prose-author/SKILL.md +9 -4
  33. package/skills/refactor-design/SKILL.md +26 -17
  34. package/skills/review/SKILL.md +169 -64
  35. package/skills/review/references/substrate-side-effects.md +17 -10
  36. package/skills/scope/SKILL.md +20 -7
  37. package/work-view/crates/cli/.work-view-version +1 -1
  38. package/work-view/dist/aarch64-apple-darwin/work-view +0 -0
  39. package/work-view/dist/aarch64-unknown-linux-musl/work-view +0 -0
  40. package/work-view/dist/x86_64-apple-darwin/work-view +0 -0
  41. package/work-view/dist/x86_64-unknown-linux-musl/work-view +0 -0
@@ -1,10 +1,11 @@
1
1
  ---
2
2
  name: gate-tests
3
3
  description: >
4
- Test-quality gate that scans items bound to a release for test coverage gaps. Delegates the full
5
- analysis to a deep test scanner agent which derives expected coverage from each bound item's
6
- acceptance criteria (NOT from implementation code), maps existing test coverage, identifies gaps,
7
- and returns findings. The orchestrator converts findings into gate_origin:tests items in
4
+ Test-quality gate focused on release-bound items that may follow relevant evidence into adjacent
5
+ interfaces and test systems. Derives useful coverage from contracts, risk, and bug history—not
6
+ line coverage—and identifies both valuable gaps and low-value tests worth removing. Delegates the
7
+ analysis to a deep test scanner agent, which maps existing coverage and
8
+ returns findings. The orchestrator converts findings into gate_origin:tests items in
8
9
  .work/active/. Auto-triggers during /agile-workflow:release-deploy.
9
10
  ---
10
11
 
@@ -24,16 +25,18 @@ in the release body.
24
25
 
25
26
  ## Core principle
26
27
 
27
- The gate's principle: **tests derive from specs, not implementations**. Each
28
- bound item's acceptance criteria IS the spec. The scanner verifies those
29
- criteria are covered, finds gaps, and returns them. It also checks the seams
30
- BETWEEN bound items integration coverage where one item's output feeds
31
- another.
28
+ The gate's principle: **tests must earn their upkeep**. Tests derive from
29
+ stable contracts, meaningful risks, and regressions learned from real bugs—not
30
+ from implementation shape or a demand to cover every line. Prefer important
31
+ public interfaces and cross-item seams. Unit tests belong around genuinely
32
+ complex isolated logic, not every wrapper or branch. The gate identifies both
33
+ high-value gaps and duplicate, tautological, brittle, obsolete, or
34
+ implementation-bound tests that should be removed.
32
35
 
33
- Tests derived from reading implementation code are tautological they verify
34
- that the code does what the code does. Tests derived from specs verify what
35
- the code *should* do. That's where bugs live. The scanner brief enforces this
36
- discipline.
36
+ Bound items are the focus, not a hard scan boundary. Follow concrete evidence
37
+ into adjacent interfaces, shared test infrastructure, dependencies, or a whole
38
+ test/check system when needed. Bind findings to the release only when materially
39
+ relevant; route ambient discoveries to the unbound backlog.
37
40
 
38
41
  ## Trigger
39
42
 
@@ -90,8 +93,10 @@ test-design techniques to find gaps, and returns structured findings.
90
93
  **Brief template**:
91
94
 
92
95
  > You are conducting a test-quality gate for release `<version>`. Core
93
- > principle: **tests derive from specs, not implementations**. Each bound
94
- > item's acceptance criteria IS the spec.
96
+ > principle: **tests must earn their upkeep**. Derive tests from stable
97
+ > contracts, meaningful risk, and bug regressions—not implementation shape or
98
+ > universal coverage. Acceptance criteria are evidence of intent, not a mandate
99
+ > for one automated test per statement.
95
100
  >
96
101
  > Use read/search/shell tools as needed. Do not spawn nested sub-agents or implement
97
102
  > fixes.
@@ -143,32 +148,35 @@ test-design techniques to find gaps, and returns structured findings.
143
148
  > - Implementation units / unit names
144
149
  > - Public interface surface (functions, types, endpoints exposed)
145
150
  >
146
- > These four axes plus the explicit acceptance criteria form the spec.
151
+ > These axes and acceptance criteria describe candidate behavior. Rank them
152
+ > by consequence, stability, complexity, and demonstrated failure history
153
+ > before deciding that automated coverage is worthwhile.
147
154
  >
148
- > 2. **Map existing test coverage.** For each bound item, find tests that
155
+ > 2. **Map existing test value and coverage.** For each bound item, find tests that
149
156
  > reference its implementation. For files changed by item `<id>`, list all
150
157
  > tests covering those files. For each test, identify which acceptance
151
- > criterion or behavioral contract it verifies. Cite file:line. Note any
152
- > tests that appear to mirror implementation step-by-step (tautological —
153
- > should be reworked or deleted). Do NOT read implementation bodies; only
154
- > test files and types. Read 2-3 key test files yourself to verify the map.
158
+ > criterion, interface, regression, or complex unit it protects. Cite
159
+ > file:line. Flag tests that mirror implementation step-by-step, duplicate
160
+ > stronger interface coverage, exercise trivial wrappers, or protect obsolete
161
+ > behavior; recommend deletion when removal preserves useful confidence.
162
+ > Read implementation only to establish complexity, interfaces, or whether a
163
+ > test is coupled to internals—not to invent an assertion target. Read 2-3
164
+ > key test files yourself to verify the map.
155
165
  >
156
- > 3. **Apply test-design techniques** for each acceptance criterion not
157
- > covered by tests:
158
- > - **Equivalence partitioning** — one test per valid partition, one per
159
- > invalid
160
- > - **Boundary value analysis** — for ranges: just-below, at, just-above
161
- > - **Decision table** — for criteria with multiple conditions, enumerate
162
- > combinations
163
- > - **State transition** for state changes, test valid transitions and
164
- > verify invalid ones are rejected
166
+ > 3. **Apply test-design techniques selectively** to high-value contracts not
167
+ > already covered. Use only the techniques justified by actual risk:
168
+ > - **Equivalence partitioning** — choose representative partitions where
169
+ > distinctions matter
170
+ > - **Boundary value analysis** — sample consequential range boundaries
171
+ > - **Decision table** — cover combinations with materially different outcomes
172
+ > - **State transition** — cover important valid transitions and invalid ones
173
+ > the contract promises to reject
165
174
  > - **Error guessing (spec-driven)** — anything described as "should
166
175
  > not", "must not", "invalid", "error", "reject"
167
176
  >
168
- > 4. **Adversarial coverage** — for each bound item, surface failure
169
- > expectations along these axes. If the item body or design doesn't
170
- > state the answer, the gap itself is a finding (`stage: drafting`,
171
- > `tags: [testing]`):
177
+ > 4. **Risk review** — for each bound item, consider failure expectations along
178
+ > these axes only where the project's scope and consequences make them
179
+ > meaningful. Silence in the spec is not automatically a testing finding:
172
180
  > 1. Invalid input — when a caller passes invalid data, what should
173
181
  > happen? (Reject? Fall back? Log and continue?)
174
182
  > 2. Missing config — when required configuration is absent, what's the
@@ -182,9 +190,8 @@ test-design techniques to find gaps, and returns structured findings.
182
190
  > 6. Interrupted operations — if a multi-step operation is interrupted,
183
191
  > what's the expected end state?
184
192
  >
185
- > Where the spec is silent, produce either: (a) a `[testing]` story to
186
- > write the test once the spec is settled, or (b) a `[documentation]`
187
- > story to extend the spec with the missing assertion target.
193
+ > Where the spec is silent, emit a finding only when the missing contract is
194
+ > consequential for this project. Otherwise record that no test is warranted.
188
195
  >
189
196
  > 5. **Map e2e seams.** For items with `depends_on` chains, check whether
190
197
  > the seam between them is tested:
@@ -197,16 +204,17 @@ test-design techniques to find gaps, and returns structured findings.
197
204
  > feature's overall acceptance criteria are e2e-covered, not just
198
205
  > per-story unit-covered.
199
206
  >
200
- > 6. **Classify gaps**:
207
+ > 6. **Classify findings**:
201
208
  > | Priority | Definition |
202
209
  > |---|---|
203
- > | Critical | Acceptance criterion with no test |
204
- > | High | Boundary or error case from spec, no test |
205
- > | Medium | Valid partition or rule combination, no test |
206
- > | Low | Complementary coverage |
210
+ > | Critical | High-consequence public contract or known regression lacks protection |
211
+ > | High | Important interface, seam, or complex behavior lacks useful coverage |
212
+ > | Medium | Material confidence gain, but not release-critical |
213
+ > | Low | Ambient improvement or low-value test removal proposal |
207
214
  >
208
- > Also flag tautological tests found during step 2 they need rework or
209
- > deletion.
215
+ > No finding is created merely because a line, branch, unit, edge, or
216
+ > acceptance statement lacks its own test. Also classify relevance as
217
+ > `Release-relevant` or `Ambient`, and flag low-value tests for deletion.
210
218
  >
211
219
  > **Output format** — return a single markdown document with:
212
220
  >
@@ -216,10 +224,12 @@ test-design techniques to find gaps, and returns structured findings.
216
224
  > ### Finding 1
217
225
  > - **Title**: <one-line: spec condition not covered>
218
226
  > - **Priority**: Critical | High | Medium | Low
219
- > - **Bound item**: `<item-id>`
220
- > - **Acceptance criterion**: <quote the criterion>
221
- > - **Gap type**: missing test for valid partition / boundary / error case /
222
- > adversarial-spec-silent / e2e-seam / tautological-rework
227
+ > - **Bound item**: `<item-id>` | none
228
+ > - **Relevance**: Release-relevant | Ambient
229
+ > - **Value protected**: public interface | seam | complex unit | bug regression | test removal
230
+ > - **Contract / risk / regression evidence**: <quote or concrete evidence>
231
+ > - **Gap type**: important-interface / complex-unit / bug-regression /
232
+ > e2e-seam / low-value-test-removal
223
233
  > - **Suggested test**:
224
234
  > ```<lang>
225
235
  > // Sketch of the test — name, scenario, assertion target.
@@ -241,14 +251,14 @@ test-design techniques to find gaps, and returns structured findings.
241
251
  > ```
242
252
  >
243
253
  > **Rules**:
244
- > - Derive tests from specs, NOT from implementation code. If you find
245
- > yourself reading a function body to decide what to verify, stop — go
246
- > back to the spec.
247
- > - Test the public interface, not internal implementation.
248
- > - Cite spec references in every finding. A finding without a spec
249
- > reference is testing an assumption, not a contract.
250
- > - Prioritize invalid input, error cases, boundary conditions.
251
- > - Audit only the bundle's items, not the whole repo.
254
+ > - Derive assertion targets from contracts, risk, and bug history—not
255
+ > implementation steps. Implementation may establish complexity or coupling.
256
+ > - Prefer public interfaces and meaningful seams over internal implementation.
257
+ > - Cite a contract, demonstrated risk, bug regression, or concrete maintenance
258
+ > cost for every finding. No evidence means no test work.
259
+ > - Do not chase universal edge, branch, line, or surface coverage.
260
+ > - Bound items are the focus, not a hard boundary. Follow concrete evidence and
261
+ > record why out-of-bundle test systems were inspected.
252
262
  > - Skip already-tracked.
253
263
  >
254
264
  > **Test integrity findings** (additional pass — flag and surface as
@@ -259,8 +269,9 @@ test-design techniques to find gaps, and returns structured findings.
259
269
  > assertions.
260
270
  > - Tests that were silenced rather than diagnosed: broad `skip` /
261
271
  > `xfail` / `it.todo` with no linked backlog id or written reason.
262
- > - Tests deleted in the bundle's commits with no replacement coverage
263
- > for the same acceptance criterion. (Check `git log` of the bundle.)
272
+ > - Tests deleted in the bundle's commits when the removal leaves an important
273
+ > interface, complex behavior, or known regression without useful protection.
274
+ > (Check `git log` of the bundle.)
264
275
  > - Tests whose assertion was rewritten to match new-but-undocumented
265
276
  > behavior — i.e. the test was made to follow the code instead of the
266
277
  > code being made to follow the spec.
@@ -289,7 +300,7 @@ stage: implementing # critical/high
289
300
  tags: [testing]
290
301
  parent: null
291
302
  depends_on: []
292
- release_binding: <version>
303
+ release_binding: <version> | null # null for ambient findings
293
304
  gate_origin: tests
294
305
  created: YYYY-MM-DD
295
306
  updated: YYYY-MM-DD
@@ -300,9 +311,9 @@ updated: YYYY-MM-DD
300
311
  ## Priority
301
312
  Critical | High | Medium | Low
302
313
 
303
- ## Spec reference
304
- Item: `<bound-item-id>`
305
- Acceptance criterion: <quote the criterion>
314
+ ## Value evidence
315
+ Item: `<bound-item-id>` (or `none` for ambient findings)
316
+ Contract / risk / regression / maintenance cost: <concrete evidence>
306
317
 
307
318
  ## Gap type
308
319
  <missing test for valid partition / boundary / error case / etc.>
@@ -316,6 +327,10 @@ Acceptance criterion: <quote the criterion>
316
327
  `<test-file-path>` (following project conventions)
317
328
  ```
318
329
 
330
+ Release-relevant findings use the normal priority mapping and bind to the
331
+ release. Ambient findings—including repository-wide low-value test systems
332
+ merely discovered by the scan—go to the unbound backlog regardless of priority.
333
+
319
334
  Default priority -> placement mapping:
320
335
  - **Critical** / **High** → `stage: implementing` in `.work/active/stories/`
321
336
  - **Medium** → `stage: drafting` in `.work/active/stories/`
@@ -327,8 +342,8 @@ Tautological tests get items too:
327
342
  # id: gate-tests-rework-<original-test-slug>
328
343
  # kind: story
329
344
  # tags: [testing, refactor]
330
- # Body describes which test is tautological and what spec behavior it should be
331
- # rewritten to verify (or marked for deletion).
345
+ # Body describes why the test adds too little confidence for its upkeep and
346
+ # whether it should be rewritten around a valuable contract or deleted.
332
347
  ```
333
348
 
334
349
  ### Phase 5: Commit
@@ -343,7 +358,8 @@ git commit -m "gate-tests: <N> coverage gaps for <version>"
343
358
  In conversation:
344
359
  - **Bundle**: `<version>` — `<N>` items audited
345
360
  - **Coverage gaps**: count by priority
346
- - **Tautological tests flagged**: count
361
+ - **Low-value tests flagged for removal**: count
362
+ - **Ambient findings**: count routed to unbound backlog
347
363
  - **Items created**: count, with new ids
348
364
  - **Already-tracked**: count of duplicates skipped
349
365
 
@@ -352,12 +368,11 @@ In conversation:
352
368
  - **The analysis happens in the scanner agent, not here.** Your job is bundle
353
369
  prep, dispatch, and item-writing. Don't replicate the scanner's contract
354
370
  extraction or coverage mapping.
355
- - The scanner brief enforces "specs not implementations". Don't substitute
356
- your own judgment for findings.
357
- - Cite spec references in every item body. The scanner provides them.
358
- - Prioritize invalid input, error cases, boundary conditions — that's where
359
- bugs hide and specs are most often undertested.
360
- - Audit only the bundle's items, not the whole repo.
371
+ - The scanner brief enforces contract/risk/regression value over implementation
372
+ shape or coverage metrics. Don't substitute line-coverage pressure.
373
+ - Cite the contract, risk, regression, or maintenance cost in every item body.
374
+ - Release-bound items define focus, not a hard boundary. Follow concrete
375
+ evidence, but route ambient discoveries to the unbound backlog.
361
376
  - A failing test that exposes a real spec violation is the most valuable
362
377
  output. Don't sand it down — surface it as a Critical finding so the
363
378
  implementation gets fixed before shipping.
@@ -1,14 +1,14 @@
1
1
  ---
2
2
  name: implement
3
3
  description: >
4
- ALWAYS invoke this skill when the user explicitly asks to implement a substrate item inline OR the
5
- delivery is tiny (about 50 LoC or less, two files or fewer, no coordination) OR the deliverable is no-code prose (a
6
- [prose] item any size, as long as it needs no coordination) for any larger or default *code*
7
- work prefer /agile-workflow:implement-orchestrator. Inline single-stride implementation of a
8
- substrate item at stage:implementing. Reads the design embedded in the item body, writes code per
9
- the spec, runs build+tests, advances stage implementing to review, and updates the item body with
10
- implementation notes. Triggers on "implement this inline", "implement this item inline", "just do it
11
- inline", or a very small explicit delivery.
4
+ ALWAYS invoke this skill when the user explicitly asks to implement a substrate item inline, when
5
+ the work is cohesive enough for one owner, or when the deliverable is no-code prose (a [prose]
6
+ item of any size that needs no coordination). Inline implementation of an item at
7
+ stage:implementing. Reads the design in the item body, implements and verifies it, records the
8
+ chosen execution capability, and continues through review to done unless the caller requests
9
+ stop-at-review. Prefer /agile-workflow:implement-orchestrator when ownership, sequencing, or
10
+ uncertainty makes delegated coordination useful. Triggers on "implement this inline", "implement
11
+ this item inline", "just do it inline", or a focused explicit delivery.
12
12
  ---
13
13
 
14
14
  # Implement
@@ -20,24 +20,21 @@ notes there as you work.
20
20
 
21
21
  ## Trigger
22
22
 
23
- `/agile-workflow:implement-orchestrator` is the default routing for implementing
24
- work, including lone stories. This skill is the **inline alternative** — same
25
- work, no sub-agent fan-out and it's the right call when:
26
-
27
- - The delivery is small and focused (a tiny tweak, a single-file change, a
28
- flag flip, landing code already in the working tree)
29
- - The deliverable is **no-code prose** (a `[prose]` feature docs, a
30
- convention / rule, research write-up, copy). The ≤50 LoC / ≤2 files cap is a
31
- *code-coordination* proxy; it does not apply to prose, which qualifies on
32
- **no-coordination** alone regardless of length. A 600-line convention rewrite
33
- is one authoring stride, not an orchestrated fan-out.
34
- - The user explicitly asks to implement inline / "do it yourself"
35
- - You're already mid-flow on this item and a hand-off would lose context
36
-
37
- When the work is multi-unit *code*, spans several files, or has sibling stories
38
- that could run in parallel, prefer the orchestrator. When in doubt on code work
39
- and nothing strongly points either way, the orchestrator is the safer default.
40
- Prose work is never a reason to reach for the orchestrator.
23
+ `/agile-workflow:implement-orchestrator` is the default routing for implementation
24
+ that benefits from coordination. This skill is the **inline alternative** — the
25
+ same lifecycle, owned by the current agent without implementation fan-out.
26
+ Choose between them from cohesion, ownership, sequencing, and uncertainty:
27
+
28
+ - Prefer inline when one owner can carry a cohesive change end to end, a handoff
29
+ would lose useful context, or the caller explicitly requests inline execution.
30
+ - Prefer the orchestrator when work has independent ownership surfaces,
31
+ dependency-driven sequencing, useful parallelism, or enough uncertainty that
32
+ isolated workers improve delivery.
33
+ - Tiny changes (roughly tens of lines or a couple of files) are a useful hint
34
+ toward inline execution, never a routing gate.
35
+ - **No-code prose** (`[prose]`) qualifies for inline execution on
36
+ **no-coordination** grounds regardless of length. Prose is never routed to the
37
+ orchestrator merely because it is long.
41
38
 
42
39
  Common phrases:
43
40
  - "implement story X", "implement this feature"
@@ -87,7 +84,7 @@ Autopilot pre-filters via `work-view --ready` so this should rarely fire under
87
84
  autopilot. Interactive callers will see the note and can choose to fix the
88
85
  dep or remove it.
89
86
 
90
- ### Phase 2.5: Choose delivery mode
87
+ ### Phase 2.5: Choose delivery mode and capability
91
88
 
92
89
  If the item carries `tags: [prose]`, use **prose mode** for the rest of this skill:
93
90
 
@@ -100,6 +97,13 @@ If the item carries `tags: [prose]`, use **prose mode** for the rest of this ski
100
97
 
101
98
  For non-prose items, continue in code mode.
102
99
 
100
+ For either mode, select execution capability from the item's risk and scope
101
+ unless the caller, a stable project convention, or an autopilot caller note
102
+ overrides it. Do not ask a routine model-tier question. Also resolve the
103
+ effective `review_weight`: explicit caller override, then project convention,
104
+ otherwise `standard`. Record both choices in Phase 7; the principles and review
105
+ skills own the weight matrix.
106
+
103
107
  ### Phase 3: Map integration points
104
108
 
105
109
  For `[prose]` items, map prose integration points instead:
@@ -165,7 +169,8 @@ In land mode:
165
169
  as-built reality (paths, interfaces, signatures).
166
170
  2. Validate — typecheck, lint, tests scoped to touched packages
167
171
  (`pnpm --filter`, `cargo -p`, `pytest <path>`).
168
- 3. Fill test gaps for any meaningful behavior that lacks coverage.
172
+ 3. Fill high-value test gaps at stable interfaces, for complex logic, or for
173
+ demonstrated regressions; remove obsolete or low-value tests exposed by the work.
169
174
  4. Skip Phase 6 (no new code) and go straight to Phase 7 (notes — log
170
175
  "Land mode" explicitly), Phase 8 (verify), Phase 9 (commit + advance).
171
176
 
@@ -192,13 +197,19 @@ For code items:
192
197
  For each unit/file in the item's design:
193
198
  1. Write the code following the design's specifications — exact types, signatures,
194
199
  contracts
195
- 2. Apply established patterns from the codebase
196
- 3. Handle every error path the design specifies
197
- 4. Write tests that verify behavior, not implementation
200
+ 2. Apply established patterns from the codebase without adding speculative layers
201
+ 3. Handle the error paths and guarantees the design actually requires
202
+ 4. Write tests only where they protect an important interface, complex unit, or
203
+ demonstrated regression; remove low-value tests the change makes obsolete
198
204
  5. Update module exports (index files) so new code integrates cleanly
205
+ 6. Run an elimination pass over the touched area: delete, inline, or consolidate
206
+ code, checks, abstractions, compatibility paths, and test machinery made
207
+ unnecessary by the implementation
199
208
 
200
- Take pride in the details: clean variable names, idiomatic control flow, meaningful
201
- error messages. Code that a future developer would read with appreciation.
209
+ Safe behavior-preserving cleanup that is cohesive with the touched code is part
210
+ of the task. Park larger or unrelated cleanup, and stop for a design decision
211
+ before weakening behavior, guarantees, validation, compatibility, or safety.
212
+ Prefer short, direct, readable code over a generalized framework.
202
213
 
203
214
  ### Phase 7: Update item body with implementation notes
204
215
 
@@ -206,8 +217,11 @@ Append (or update) an "Implementation notes" section in the item's body:
206
217
 
207
218
  ```markdown
208
219
  ## Implementation notes
220
+ - Execution capability: <choice and brief risk/scope rationale>
221
+ - Review weight: <effective value and source: caller, project, or default>
209
222
  - Files changed: <list>
210
- - Tests added: <list>
223
+ - Tests added/removed: <list and the interface, complexity, or regression value>
224
+ - Simplification: <code, checks, abstractions, or compatibility paths removed/consolidated>
211
225
  - Discrepancies from design: <list with one-line explanation each, or "none">
212
226
  - Adjacent issues parked: <list of backlog ids if any, or "none">
213
227
  ```
@@ -234,42 +248,47 @@ Don't claim done if tests don't pass. A known gap reported is better than a hidd
234
248
 
235
249
  #### Test integrity
236
250
 
237
- When tests fail during verification, classify each failure before reacting:
238
-
239
- - **Bad test** (stale fixture, drifted assertion, broken mock, outdated
240
- snapshot) → fix in-session. Repairing the suite is part of the stride.
241
- - **Real production bug** surfaced by the test → park it via
242
- `/agile-workflow:park` with a short repro. Do NOT silently fix mid-pass.
243
- Once the suite is green, if the parked bug is small enough for a single
244
- stride, pick it up immediately with `/agile-workflow:scope` → design →
245
- implement. Larger bugs stay in backlog for prioritization.
246
- - **Pre-existing flake or unrelated regression** → park it. Don't bundle.
247
-
248
- NEVER game a test to make it pass. A failing test that documents *why* it
249
- fails (inline comment, `skip` linked to a backlog id, `xfail` with reason)
250
- is more honest than a green test that lies. No `expect(true).toBe(true)`,
251
- no asserting on whatever the code happens to return, no deleting a test
252
- as "flaky" without root-causing first.
251
+ Follow the project's test-integrity rules and the worker posture in
252
+ `../principles/references/subagents.md`: fix bad tests in-session, park real
253
+ production bugs, and never game a test to make it pass.
253
254
 
254
- ### Phase 9: Advance stage and commit
255
+ ### Phase 9: Commit and complete the lifecycle
255
256
 
256
257
  1. Edit the item's frontmatter: `stage: implementing → review`. PostToolUse hook
257
258
  bumps `updated:`.
258
- 2. Commit:
259
+ 2. Commit the implementation:
259
260
  ```bash
260
261
  git add <changed-files> <test-files> .work/active/<kind>s/<id>.md
261
262
  git commit -m "implement: <id>"
262
263
  ```
264
+ 3. Unless the caller explicitly requested `stop-at-review` (including "stop at
265
+ review", "leave at review", or "hand off for review") or a project convention
266
+ sets that boundary, invoke `/agile-workflow:review <id>` in the same invocation
267
+ and forward the effective `review_weight`. The review lane owns its required
268
+ context and verdict:
269
+ - approve: advance and commit `review → done`
270
+ - bounce: record `## Review findings`, return the item to `implementing`, and
271
+ report the bounce
272
+ - blocker: record `## Blocker` and report it without claiming completion
273
+
274
+ A weight of `none` skips independent review, but the review lane still requires
275
+ the same green verification and acceptance evidence before administrative
276
+ closure. Reaching `review` remains a real lifecycle transition; continuing
277
+ through it never means silently self-approving. With `stop-at-review`, finish
278
+ Phase 9 after the implementation commit and report that explicit boundary.
263
279
 
264
280
  ## Output
265
281
 
266
282
  In conversation:
267
- - **Implemented**: `<id>` advanced to `stage: review`
283
+ - **Implemented**: `<id>` advanced to `stage: done`, `stage: review` by explicit
284
+ override, or `stage: implementing` after a documented bounce
285
+ - **Review**: lane verdict, limitation, or blocker
268
286
  - **Files changed**: list
269
287
  - **Tests added**: list
288
+ - **Execution capability**: choice and rationale
289
+ - **Review weight**: effective value and source
270
290
  - **Discrepancies from design**: list (or "none")
271
291
  - **Adjacent issues parked**: backlog ids (or "none")
272
- - **Next**: `/agile-workflow:review <id>` to evaluate the change
273
292
 
274
293
  ## Guardrails
275
294
 
@@ -279,10 +298,12 @@ In conversation:
279
298
  When they disagree, adapt the implementation, document the why.
280
299
  - Implement fully or report a blocker. NEVER leave TODO comments or `unimplemented!`.
281
300
  - Don't add unrequested features. Adapt to repo reality freely; expand scope never.
282
- - Don't advance past `review` that's `/agile-workflow:review`'s job.
301
+ - Do not self-approve at `review`; invoke the review lane and honor its verdict.
283
302
  - If you discover a genuine design flaw, don't muscle through. Append a
284
303
  `## Implementation discovery` section, set stage back to `drafting`, and
285
304
  return. The design family will pick it up on the next pass.
286
- - Adjacent issues you notice get parked via `/agile-workflow:park`, not bundled.
287
- - Test integrity is non-negotiable. Fix bad tests in-session; park real
288
- production bugs; never make a test pass just to make it pass.
305
+ - Safe, cohesive simplification in the touched area belongs in the task. Park
306
+ larger, unrelated, or behavior-changing opportunities instead of silently
307
+ expanding scope.
308
+ - Test integrity is non-negotiable: follow the project rules and worker posture;
309
+ fix bad tests, park real production bugs, and never game tests.