@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,7 +1,7 @@
1
1
  {
2
2
  "name": "agile-workflow",
3
3
  "description": "Markdown-based work-tracking substrate for AI-driven projects. Items as files in .work/, late-binding releases, gates that produce items, goal-backed autopilot queue runner. See docs/VISION.md.",
4
- "version": "0.15.3",
4
+ "version": "0.16.3",
5
5
  "author": {
6
6
  "name": "nklisch"
7
7
  },
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agile-workflow",
3
- "version": "0.15.3",
3
+ "version": "0.16.3",
4
4
  "description": "Markdown-based work-tracking substrate for AI-driven projects. Items as files in .work/, late-binding releases, gates that produce items, goal-backed autopilot queue runner.",
5
5
  "author": {
6
6
  "name": "nklisch"
package/CHANGELOG.md CHANGED
@@ -2,6 +2,14 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ### Autonomous review convergence
6
+
7
+ - **Removed the two-bounce circuit-breaker** — autopilot no longer parks an item
8
+ at review or blocks the run after two failed correction passes. Review findings
9
+ re-enter implementation until they pass; recurring findings trigger deeper
10
+ root-cause/design diagnosis and fresh context where useful. Only a separate,
11
+ genuine blocker may stop autonomous progress.
12
+
5
13
  ### Dynamic subagent prompting
6
14
 
7
15
  - **No shipped custom agents** — removed agile-workflow's Claude/Pi agent
@@ -59,14 +59,19 @@ An item flows through tiers as work progresses on it.
59
59
  (design written into body; child stories spawned)
60
60
 
61
61
 
62
- /implement-orchestrator (default; scope-driven,
63
- cross-feature waves) or /implement (inline alternative)
62
+ /implement-orchestrator (delegated topology)
63
+ or /implement (cohesive inline delivery)
64
64
 
65
65
 
66
66
  stage: review
67
+ (real state; optional stop boundary)
67
68
 
68
69
 
69
- /review (advance to done)
70
+ risk-appropriate /review lane
71
+ (production skills invoke it by default)
72
+
73
+
74
+ stage: done
70
75
 
71
76
  ┌─────────────────┼─────────────────┐
72
77
  ▼ ▼ ▼
@@ -98,11 +103,20 @@ Stages advance only when work completes; they are never pre-populated.
98
103
 
99
104
  | Kind | drafting | implementing | review | done |
100
105
  |---|---|---|---|---|
101
- | epic | initial state when scoped | once children are designed and started | once all children are at review/done | once all children are at done |
102
- | feature | initial state when scoped | once design is written into body and acceptance criteria clear | once code lands and tests pass | once user-facing review approves |
103
- | story | optional initial state | initial state more often (skips drafting) | once code lands | once user/code-review approves |
106
+ | epic | initial state when scoped | once children are designed and started | once all children are terminal and the epic is ready for its own review | once the epic's selected review lane approves |
107
+ | feature | initial state when scoped | once design is written into the body and acceptance criteria are clear | once implementation is verified, or all child work is terminal, and the feature is ready for its own review | once the feature's selected review lane approves |
108
+ | story | optional initial state | initial state more often (skips drafting) | once implementation and required verification complete | once the story's selected review lane approves |
104
109
  | release | initial state when cut | once gates begin running (`stage: quality-gate`) | n/a | n/a — terminal stage is `released` |
105
110
 
111
+ `review` is a real state but not a mandatory user handoff. `implement`, `fix`,
112
+ and `implement-orchestrator` continue through the selected review lane in the
113
+ same invocation by default. An explicit `stop-at-review` request or stable
114
+ project convention leaves the item there. Approval advances to `done`; a bounce
115
+ returns to `implementing` with durable findings, and blockers remain recorded in
116
+ the item body. Child completion only makes an ancestor eligible for its own
117
+ review: conservative roll-up never substitutes child evidence for parent
118
+ approval.
119
+
106
120
  The PostToolUse hook auto-bumps `updated:` whenever an item file is edited;
107
121
  skills only need to advance `stage:` explicitly.
108
122
 
@@ -291,7 +305,7 @@ git log --since='1 day ago' -- .work/
291
305
  ## Foundation docs (rolling-forward principle)
292
306
  docs/ holds standing context: VISION.md, SPEC.md, ARCHITECTURE.md, etc.
293
307
  - Foundation docs describe the system's current state or intended future state
294
- - Never add "previously this was…" or "note: in v1.2 we…"
308
+ - Never retain superseded behavior descriptions or versioned migration notes
295
309
  - When implementation changes a foundation-doc assertion, update the doc
296
310
  - Git history is the audit trail; the doc carries the active truth
297
311
  ````
@@ -336,45 +350,29 @@ Direct skill invocation remains supported: `/agile-workflow:autopilot
336
350
  maintain a progress file; harness goal/continuation owns long-running
337
351
  persistence and `.work/active/` is the resume point.
338
352
 
339
- ### Pre-flight: align on strategic questions first
340
-
341
- **Before kicking off autopilot, run `epic-design --only-questions` over the
342
- epics you're about to drain.** This is the single highest-leverage step in
343
- the agile-workflow loop and should generally always be done.
344
-
345
- ```bash
346
- # Per-epic align on one epic before autopilot picks it up
347
- /agile-workflow:epic-design --only-questions <epic-id>
348
-
349
- # Cover the whole active queue at once recommended before a --all autopilot goal
350
- /agile-workflow:epic-design --only-questions --all
351
- ```
352
-
353
- What the pass does (see `epic-design` SKILL Phase 4.7): for each epic at
354
- `stage: drafting`, it grounds in foundation docs + codebase, surfaces the
355
- 2–5 directional product / architecture / scope questions specific to that
356
- epic, asks the user via `AskUserQuestion`, and writes the answers under
357
- `## Design decisions` in the epic body. It does NOT decompose into child
358
- features and does NOT advance stage that's left to the real design pass.
359
-
360
- Why it matters:
361
-
362
- - **Autopilot inherits the answers.** When `epic-design` (full pass) runs
363
- later under autopilot, it reads the already-captured `## Design decisions`
364
- and skips Phase 4.7 — no autonomous judgment on directional choices,
365
- because they're already locked in by the user.
366
- - **Cheap up front, expensive later.** Five minutes of interactive Q&A on
367
- the whole drafting queue prevents autopilot from committing to a wrong
368
- architectural direction across multiple features before the user notices.
369
- - **One human checkpoint instead of N.** A single `--only-questions --all`
370
- pass answers every strategic question across the queue in one sitting,
371
- rather than autopilot pausing per-epic mid-run (or worse, not pausing and
372
- guessing).
373
-
374
- `--only-questions` mode refuses to run under autopilot itself — it's
375
- explicitly a pre-autopilot, human-in-the-loop step. The right invocation
376
- shape is: `--only-questions --all` first, review the captured decisions,
377
- then start an autopilot goal for `--all` (or `<epic-id>`).
353
+ ### Strategic alignment before autonomous work
354
+
355
+ Normal design resolves routine, reversible decisions with judgment and records
356
+ the rationale. Use the structured question tool only for choices that set
357
+ product direction, materially affect user-facing behavior or an external
358
+ contract, or commit the project to an expensive, difficult-to-reverse path.
359
+
360
+ `epic-design --only-questions <id>` (or `--all`) remains the explicit
361
+ interactive alignment mode when the operator wants those strategic decisions
362
+ captured under `## Design decisions` before autonomous work. It does not design,
363
+ decompose, or advance an item, and it refuses to run inside autopilot. Autopilot
364
+ does not stop for ordinary ambiguity: it uses the existing decisions and
365
+ foundation evidence, chooses the least irreversible sound path, and records the
366
+ rationale.
367
+
368
+ Advisory review follows risk in both direct and autopilot design. Independent
369
+ review uses completeness/advisory before adversarial posture, is labeled
370
+ cross-model only for a known different model class, and is non-blocking at
371
+ design time. Final autopilot completion still requires the successful review
372
+ path selected by the effective review weight. The receiving orchestrator owns
373
+ finding disposition: it verifies reviewer proposals in repository context,
374
+ keeps only credible material current-cycle risks blocking, and parks valid
375
+ lower-priority work in the unbound backlog.
378
376
 
379
377
  ### Queue selection algorithm
380
378
 
@@ -392,22 +390,52 @@ then start an autopilot goal for `--all` (or `<epic-id>`).
392
390
  - created ascending (FIFO tie-break)
393
391
  5. Pop the first item.
394
392
  6. Work it:
395
- - if drafting → invoke /design (or /refactor-design / /perf-design by tag)
393
+ - if drafting → invoke the design skill selected by kind and tags
396
394
  - if implementing → invoke /implement-orchestrator with the autopilot
397
- scope (the picked item is an anchor; the orchestrator drains the whole
398
- in-scope implementing band as one batch, cross-feature is fine).
399
- /implement is reserved for the inline small-delivery case.
400
- - if review → invoke /review (autonomous: produces verdict, advances
401
- review→done or sends back to implementing)
402
- 7. Advance stage on completion. Commit.
403
- 8. Goto 1 unless stop condition.
395
+ scope (the picked item is an anchor; the orchestrator derives execution
396
+ topology from the unified graph, ownership, repository shape, and risk).
397
+ Use /implement when one cohesive delivery is safer in the host context.
398
+ - if review → invoke /review (autonomous: produces a verdict, advances
399
+ review→done, or sends the item back to implementing)
400
+ 7. Re-read substrate state after the production skill returns; it may already
401
+ have completed review and eligible parent roll-up. Commit each item
402
+ transition separately.
403
+ 8. If review bounced an item, treat only receiver-confirmed material blockers as
404
+ the next implementation input and keep cycling implementation → verification
405
+ → review. Park valid lower-priority findings unbound; they do not reopen the
406
+ scoped queue. Bounce count is diagnostic history, never a stop condition.
407
+ Recurring blockers trigger deeper root-cause/design diagnosis and fresh
408
+ context where useful, but repetition alone does not elevate severity.
409
+ 9. Goto 1 unless a stop condition applies.
404
410
  ```
405
411
 
412
+ The implementation orchestrator guarantees outcomes rather than prescribing a
413
+ recipe: dependency-graph scheduling, cycle validation, write-set-independent
414
+ parallelism, explicit ownership, per-wave integration verification, one commit
415
+ per item, worker self-containment, and conservative parent roll-up. It chooses
416
+ bundle shape, wave width, isolation, and worker briefs for the actual work; no
417
+ fixed sizes or prompt templates are part of the contract. Worker capability is
418
+ chosen from scope and risk unless an explicit caller or stable project
419
+ convention overrides it, and the choice is recorded rather than routinely
420
+ asked.
421
+
422
+ Autopilot resolves one effective `review_weight` for the run: explicit
423
+ invocation selector, then `.work/CONVENTIONS.md`, then `standard`. The five
424
+ levels — `none`, `light`, `standard`, `thorough`, and `maximum` — scale
425
+ independent-review intent from administrative evidence-only closure through
426
+ multi-model, multi-pass review. They do not prescribe reviewer counts or exact
427
+ orchestration. Even `none` requires green implementation verification and
428
+ acceptance evidence.
429
+
406
430
  ### Stop conditions
407
431
 
408
432
  - Empty queue (all candidates exhausted)
409
433
  - User invokes a halt command or sends a manual prompt
410
- - A skill reports a blocker that can't be resolved autonomously
434
+ - A skill reports a genuine blocker that autonomous diagnosis and correction
435
+ cannot resolve
436
+
437
+ Repeated review bounces are not a stop condition. Autopilot keeps correcting and
438
+ re-reviewing until the item passes or exposes a separate genuine blocker.
411
439
 
412
440
  ### Harness goal continuation
413
441
 
@@ -476,6 +504,9 @@ session epoch:
476
504
  Code-design capsule:
477
505
  - Ports & Adapters: keep domain logic independent of DB/filesystem/HTTP/time/randomness.
478
506
  - Single Source of Truth: define growing variant sets once; derive downstream behavior.
507
+ - Proportional rigor: validate real boundaries; add invariants, edge handling, and determinism only when context warrants them.
508
+ - Code economy: prefer the shortest clear solution; test useful interfaces, complex units, and bug regressions.
509
+ - Leave it simpler: eliminate unnecessary code, tests, checks, abstractions, and compatibility paths; ask before reducing guarantees.
479
510
  ...
480
511
  ```
481
512
 
@@ -524,14 +555,19 @@ Override via `gates_for_release` in `.work/CONVENTIONS.md`.
524
555
 
525
556
  ### Gate-as-item-producer pattern
526
557
 
527
- Each gate scans the bundle of items at `release_binding: <current-version>`
528
- and produces new items rather than emitting a pass/fail report:
558
+ Each gate focuses on the bundle of items at
559
+ `release_binding: <current-version>` and produces new items rather than
560
+ emitting a pass/fail report. The bundle is a center of gravity, not a hard scan
561
+ boundary: gates may follow concrete evidence into adjacent dependencies, shared
562
+ infrastructure, or system-wide mechanisms. Findings caused by, exposed by, or
563
+ materially relevant to the release bind to it; merely ambient discoveries go
564
+ to the unbound backlog so the gate does not silently expand release scope.
529
565
 
530
566
  | Gate | What it scans | What it produces |
531
567
  |---|---|---|
532
568
  | `gate-security` | Bound items' code changes against security checklist | Items with `gate_origin: security`, tagged `[security]`, `release_binding` set |
533
- | `gate-tests` | Coverage of bound items' acceptance criteria | Items with `gate_origin: tests`, tagged `[testing]` for gaps |
534
- | `gate-cruft` | Dead code introduced or revealed by the bundle | Items with `gate_origin: cruft`, tagged `[cleanup]` |
569
+ | `gate-tests` | Useful coverage at stable interfaces, complex units, and bug regressions; low-value tests exposed by the bundle | Items with `gate_origin: tests`, tagged `[testing]` for valuable gaps or removals |
570
+ | `gate-cruft` | Local or system-wide code, tests, checks, compatibility paths, and abstractions that may no longer earn their cost | Items with `gate_origin: cruft`, tagged `[cleanup]`; guarantee-reducing removals require user confirmation |
535
571
  | `gate-docs` | Foundation-doc alignment with the bundle's behavior changes | Items with `gate_origin: docs`, tagged `[documentation]` — enforces rolling-foundation |
536
572
  | `gate-patterns` | Reusable patterns that emerged in the bundle | Detailed pattern-skill files in `.agents/skills/patterns/` (single source of truth) with optional Claude mirror, the generated hook-loaded `.agents/rules/patterns.md` digest (slug+one-liner index pointing back at the skill, with banner + source hash), plus a tracking item with `gate_origin: patterns` |
537
573
 
@@ -642,6 +678,15 @@ cross-model only when the host explicitly spawns the subagent with a different
642
678
  model class; otherwise use `peeragent` only when a cross-harness different model
643
679
  class is needed and allowed.
644
680
 
681
+ Concrete model guidance lives in `skills/principles/references/models.md` and is
682
+ resolved against current availability when selection matters. GPT-5.6 Luna is
683
+ the implementation workhorse; Sol is preferred for design, review, complex code,
684
+ and as the low-thinking bridge above Luna; Terra is a situational middle pick;
685
+ and Claude Fable is a high-cost design, orchestration, and review specialist
686
+ rather than the default implementer. These are capability recommendations, not
687
+ fixed routing. Luna, Terra, Sol, and Codex share OpenAI lineage, so moving among
688
+ them can provide fresh context but is not cross-model evidence.
689
+
645
690
  ### Bootstrap (user-invocable only)
646
691
 
647
692
  | Skill | Role | Trigger |
@@ -656,7 +701,7 @@ class is needed and allowed.
656
701
  |---|---|---|
657
702
  | `park` | Capture an unscoped idea, context note, or roadmap-style thought into `.work/backlog/`. Minimal frontmatter; body sized to the supplied context. | "park this", "remind me about X", "add to backlog" |
658
703
  | `scope` | Promote backlog item or fresh request to `.work/active/`. Sizes as epic/feature/story. If large, rolls foundation docs forward. Declares dependencies. | "scope this", "promote this", "let's track this" |
659
- | `fix` | Park-and-implement quick bug as a story. Single-stride: creates story at `stage: implementing`, writes fix, advances to review. | "fix bug X", "fix the typo in", "fix this issue" |
704
+ | `fix` | Diagnose a verified bug as a cohesive story, reproduce it, add the failing test, apply the bounded repair, verify it, and continue through the selected review lane to `done` by default. Honors an explicit `stop-at-review` boundary and records bounces/blockers. | "fix bug X", "fix the typo in", "fix this issue" |
660
705
  | `groom` | Backlog-hygiene sweep over `.work/backlog/`. Classifies items DONE/SUPERSEDED/DUPLICATE/STALE/MERGEABLE/VALID via mechanical signals (`work-view --stale`, missing-field, cites-done-work) + a grounded semantic pass; writes a triage report. Propose-not-prune: dispositions are operator-confirmed and route through terminal-tier retention; never auto-prunes. Not a release gate. Opt-in; staleness face inert unless `backlog_staleness_days` is set. | "groom the backlog", "backlog hygiene", "find stale/dead/duplicate items" |
661
706
 
662
707
  ### Design family (model-invocable, kind- and tag-routed)
@@ -672,14 +717,19 @@ class is needed and allowed.
672
717
 
673
718
  | Skill | Role | Trigger |
674
719
  |---|---|---|
675
- | `implement-orchestrator` | Default. Orchestrates implementation sub-agents over a scope (feature, epic, --all, or explicit list). Builds a unified `depends_on` graph across the scope (cross-feature is fine), chooses bundles/waves/write-scope isolation, and advances every parent feature whose children all reach `review`. | item(s) at `stage: implementing` |
676
- | `implement` | Inline alternative. Read item body, write code, run build+tests, advance stage. | small / focused work where sub-agent fan-out wouldn't pay off, or user asks to implement inline |
720
+ | `implement-orchestrator` | Delegated implementation over a feature, epic, `--all`, or explicit set. Derives ownership and waves from the unified dependency graph, write-set independence, repository shape, and risk; verifies every wave, keeps one commit per item, rolls eligible parents conservatively, and continues through review by default. | implementing scope where separate ownership, isolation, or sequencing improves the result |
721
+ | `implement` | Cohesive inline delivery. Grounds in the item, implements and verifies it in the host context, records capability and evidence, then continues through the selected review lane to `done` by default. | work best kept under one ownership context, or an explicit inline request |
722
+
723
+ Choose between these production lanes from cohesion, write ownership,
724
+ dependency sequencing, isolation needs, and uncertainty. Line or file counts may
725
+ inform judgment but never gate the choice. Both honor `stop-at-review`, and
726
+ neither substitutes inline self-approval for a required fresh-context lane.
677
727
 
678
728
  ### Review & delivery (mixed invocability)
679
729
 
680
730
  | Skill | Invocability | Role | Trigger |
681
731
  |---|---|---|---|
682
- | `review` | model-invocable | Code review of changes for an item. Triages findings into items with proper tags. Advances to done if approved. | item at `stage: review` |
732
+ | `review` | model-invocable | Selects fast, standard, or deep review from effective weight, risk, evidence, and kind as a heuristic; preserves fresh context for deep review, records durable findings, advances or bounces the item, and conservatively rolls approved children through each eligible ancestor's own review. | item at `stage: review` or explicit review target |
683
733
  | `board` | user-invocable | Launch the live localhost substrate board through `work-view board`. Opens a browser after binding when a desktop session is available; prints the URL in headless sessions. | User-invoked when the user wants to inspect active work visually |
684
734
  | `release-deploy` | user-invocable | Bind items to release, run gates, ship, archive. Idempotent. | User-invoked when ready to cut a version |
685
735
  | `bold-refactor` | user-invocable | Multi-feature architectural refactor. Scopes a refactor epic with child features. Aggressive — only on user request. | User-invoked |
@@ -703,11 +753,13 @@ configured in `CONVENTIONS.md` (default: security → tests → cruft → docs
703
753
 
704
754
  | Skill | Role | Notes |
705
755
  |---|---|---|
706
- | `principles` | Loads code-design + substrate-execution principles | Code-design (Ports & Adapters, SSOT, Generated Contracts, Fail Fast) carried from workflow; substrate-execution (item-IS-the-work, rolling-foundation, late-binding) added |
756
+ | `principles` | Loads code-design + substrate-execution principles | Code-design includes clear boundaries, proportional rigor, code economy, useful tests, and continuous simplification; substrate-execution includes item-IS-the-work, rolling-foundation, and late-binding |
707
757
  | `research` | Investigate libraries/APIs | Carried; produces research docs in `docs/research/` (separate from `.work/`) |
708
758
  | `refactor-conventions-creator` | Create project-specific refactor conventions skill | Carried |
709
759
 
710
- (`repo-eval` and `tool-evaluator` were originally carried here. `repo-eval` now lives in the standalone `code-audit` plugin as the supported report-only scorecard, while `tool-evaluator` was extracted to `nates-toolkit` and renamed `agent-reflection`.)
760
+ Holistic report-only repository scoring is provided by `code-audit:repo-eval`;
761
+ end-of-session tool and skill reflection is provided by
762
+ `nates-toolkit:agent-reflection`.
711
763
 
712
764
  ---
713
765
 
@@ -2,8 +2,8 @@
2
2
 
3
3
  The plugin's `principles` skill loads two distinct paradigms:
4
4
 
5
- - **Code-design principles** — Ports & Adapters, Single Source of Truth,
6
- Generated Contracts, Fail Fast. Carried from the `workflow` plugin.
5
+ - **Code-design principles** — clear boundaries and sources of truth,
6
+ proportional rigor, code economy, useful tests, and continuous simplification.
7
7
  These tell the agent how to write good code at design time and
8
8
  implementation time.
9
9
  - **Substrate-execution principles** — Item-IS-the-Work, Rolling-Foundation,
@@ -18,7 +18,7 @@ shapes how work moves through the system.
18
18
 
19
19
  # Part I — Code-Design Principles
20
20
 
21
- These four principles govern both architectural decisions and how code is
21
+ These principles govern both architectural decisions and how code is
22
22
  written. Each section has guidance for design time and implementation time.
23
23
 
24
24
  ## 1. Ports & Adapters
@@ -213,21 +213,20 @@ If a generated type needs extending, use
213
213
  `type MyType = GeneratedType & { extra: string }` — extend the source of
214
214
  truth, don't replace it.
215
215
 
216
- ## 4. Fail Fast (implementation only)
216
+ ## 4. Fail Fast—Where It Matters
217
217
 
218
- Catch bad data at the door, not three calls deep where the stack trace is
219
- useless. Validate inputs at the entry point of every function or system
220
- boundary.
218
+ Catch bad data at real trust boundaries, not three calls deep. Validate
219
+ untrusted input and required external contracts before domain logic runs. Add
220
+ internal checks only where a violated precondition is plausible and
221
+ consequential for this project.
221
222
 
222
223
  - At system boundaries (HTTP handlers, CLI args, external API responses,
223
- config files): parse with Zod or equivalent before any logic runs
224
- - At internal function boundaries: assert preconditions at the top of the
225
- function guard clauses, not nested ifs
226
- - Prefer `throw`/`return early` over propagating bad state deep into call
227
- chains
228
- - Errors should be loud and specific at the point of violation —
229
- "expected positive number, got -3" beats a cryptic null reference five
230
- layers down
224
+ config files): parse before logic runs
225
+ - At internal boundaries: add guards when they protect a real invariant, not
226
+ mechanically at every function
227
+ - Prefer early, specific failure when failure is part of the required contract
228
+ - Do not manufacture exhaustive edge handling, invariants, retries, or firm
229
+ determinism that the project's scope and consequences do not need
231
230
 
232
231
  **Good:**
233
232
  ```typescript
@@ -250,6 +249,73 @@ function processOrder(input: any) {
250
249
  }
251
250
  ```
252
251
 
252
+ ## 5. Code Economy
253
+
254
+ Short, direct code is a virtue when it stays clear. Prefer fewer concepts,
255
+ layers, branches, options, and lines over speculative generality. Terse does not
256
+ mean cryptic: simplify the model first, then its expression. Every abstraction
257
+ or extension point must earn its maintenance cost in current scope.
258
+
259
+ ### At design time
260
+
261
+ - Start with the most direct solution that satisfies the actual brief
262
+ - Reject hypothetical flexibility without a current second use or committed need
263
+ - Compare approaches by concepts removed as well as capabilities added
264
+
265
+ ### At implementation time
266
+
267
+ - Delete obsolete paths and incidental machinery exposed by the change
268
+ - Inline or consolidate before extracting another abstraction
269
+ - Match rigor to the project's context rather than treating every codebase as
270
+ critical infrastructure
271
+
272
+ ## 6. Tests Earn Their Keep
273
+
274
+ Tests are maintained code. Prioritize stable public interfaces, important seams,
275
+ high-consequence behavior, and regressions learned from real bugs. Unit tests
276
+ belong around genuinely complex isolated logic, not every wrapper, branch, or
277
+ line. Coverage numbers are evidence, not goals.
278
+
279
+ ### At design time
280
+
281
+ - Name the interface, risk, or regression each proposed test protects
282
+ - Prefer one useful interface test over several implementation-bound unit tests
283
+ - Do not require one automated test per unit, edge, or acceptance statement
284
+
285
+ ### At implementation time
286
+
287
+ - Add regression tests when bugs reveal meaningful risk
288
+ - Remove duplicate, tautological, brittle, obsolete, or low-value tests
289
+ - Keep simple code simple when an isolated test adds no useful confidence
290
+
291
+ ## 7. Leave It Simpler
292
+
293
+ Exploration, design, and implementation include an elimination pass. Look for
294
+ code, tests, checks, abstractions, configuration, and compatibility paths the
295
+ feature can make unnecessary. Fold safe cohesive cleanup into the task or create
296
+ explicit cleanup/refactor stories; park broader opportunities.
297
+
298
+ Question whole systems, not only local fragments. A validation layer, invariant
299
+ system, test suite, compatibility mechanism, or defensive subsystem may no
300
+ longer justify its cost. Removing behavior, guarantees, validation, determinism,
301
+ compatibility, or safety is a product decision: explain the trade-off and ask
302
+ the user rather than silently weakening it.
303
+
304
+ ### Review proportionality
305
+
306
+ Reviewer output is evidence, not authority. The receiving agent verifies claims
307
+ and judges their current-cycle risk against the repository's acceptance criteria,
308
+ supported users and deployment shape, likelihood, blast radius, recoverability,
309
+ safeguards, and delay cost. Credible material risks to required correctness,
310
+ security, data, public contracts, acceptance, release safety, or trustworthy
311
+ verification block. Valid lower-priority concerns are parked unbound; nits stay
312
+ in review notes; unsupported advice is rejected with a brief rationale.
313
+
314
+ A successful independent review path requires adjudicating every proposal, not
315
+ implementing every suggestion. A rare severe case may still block, while a real
316
+ corner case with negligible consequence need not. Reviewer labels, model
317
+ strength, and repeated mention do not replace the receiving agent's judgment.
318
+
253
319
  ---
254
320
 
255
321
  # Part II — Substrate-Execution Principles
@@ -259,7 +325,7 @@ shape stage transitions, item bodies, foundation-doc evolution, and
259
325
  release binding. The agent applies these whenever operating on `.work/`
260
326
  or `docs/`.
261
327
 
262
- ## 5. Item-IS-the-Work
328
+ ## 8. Item-IS-the-Work
263
329
 
264
330
  The unit of work is its file. The brief, the design, the implementation
265
331
  notes, and the review findings all accumulate in the item's body as
@@ -314,7 +380,7 @@ stages advance. Reading the file IS reading the state of the work.
314
380
  - [ ] Item body at completion is a complete record
315
381
  - [ ] Code does not reference item IDs; only logical concepts
316
382
 
317
- ## 6. Rolling-Foundation
383
+ ## 9. Rolling-Foundation
318
384
 
319
385
  Foundation docs (`docs/VISION.md`, `docs/SPEC.md`, `docs/ARCHITECTURE.md`,
320
386
  and any others) describe the project's vision (future-looking) and current
@@ -398,7 +464,7 @@ which timing style was used.
398
464
  - [ ] `git log docs/<file>.md` shows the audit trail; the doc shows the
399
465
  present
400
466
 
401
- ## 7. Late-Binding
467
+ ## 10. Late-Binding
402
468
 
403
469
  Items advance stages when work actually completes. Releases bind items
404
470
  only when the user cuts a version. Foundation docs are not pre-decided
package/docs/SPEC.md CHANGED
@@ -12,7 +12,7 @@ Located at `plugins/agile-workflow/.claude-plugin/plugin.json`:
12
12
  {
13
13
  "name": "agile-workflow",
14
14
  "description": "Markdown-based work-tracking substrate for AI-driven projects. Items as files in .work/, late-binding releases, gates that produce items, goal-backed autopilot queue runner. See docs/VISION.md.",
15
- "version": "0.10.0",
15
+ "version": "0.15.3",
16
16
  "author": { "name": "nklisch" },
17
17
  "repository": "https://github.com/nklisch/skills",
18
18
  "license": "MIT"
@@ -81,7 +81,59 @@ release: planned → quality-gate → released
81
81
  task: [ ] → [x] (checklist line in parent body)
82
82
  ```
83
83
 
84
- Stages advance only when work completes. No pre-population.
84
+ Stages advance only when work completes. No pre-population. For epics,
85
+ features, and stories, `review` is a real evaluation state and `done` means the
86
+ selected review lane approved the item. It is not a mandatory user handoff:
87
+ production skills drive verified work through the risk-appropriate review lane
88
+ in the same invocation by default. An explicit `stop-at-review` request (or
89
+ project convention) leaves the item at `review`. Approval advances to `done`;
90
+ a review bounce returns the item to `implementing` with durable findings, and a
91
+ blocker remains recorded in the item body.
92
+
93
+ Review effort is selected from risk, evidence, effective `review_weight`, and
94
+ item kind as a starting heuristic. Low-risk stories can close from recorded
95
+ green verification, while risky stories, features, and epics receive the
96
+ fresh-context coverage allowed by the effective weight. Child completion may
97
+ make a parent eligible for its own review, but never approves the parent by
98
+ itself. Fresh-reviewer findings are proposals: the receiving agent verifies and
99
+ classifies them against repository context. Only credible material current-cycle
100
+ risk blocks advancement; valid lower-priority findings are parked unbound.
101
+
102
+ ### Questions and advisory review
103
+
104
+ Normal design resolves routine, reversible decisions with judgment and records
105
+ the rationale. The structured question tool is reserved for choices that set
106
+ product direction, materially change user-facing behavior or an external
107
+ contract, or commit the project to an expensive, difficult-to-reverse path.
108
+ `--only-questions` remains an explicit interactive alignment mode and does not
109
+ design or advance an item; an active autopilot run instead chooses the least
110
+ irreversible sound option and logs it.
111
+
112
+ Advisory review is risk-driven in direct and autopilot modes. When independent
113
+ review is warranted, completeness/advisory review precedes adversarial review,
114
+ and a pass is called cross-model only when the reviewer is a known different
115
+ model class. Design-time advisory failure is non-blocking; final autopilot
116
+ completion must clear the review path required by its effective weight. The
117
+ effective `review_weight` resolves from an explicit invocation, then project
118
+ convention, then `standard`:
119
+
120
+ - `none` — no independent reviewer; green implementation verification and
121
+ acceptance evidence are still required.
122
+ - `light` — minimal independent ceremony with focused scrutiny where risk
123
+ clearly warrants it.
124
+ - `standard` — balanced, risk-driven independent review.
125
+ - `thorough` — increased fresh-context breadth and depth for meaningful risk.
126
+ - `maximum` — multi-model, multi-pass complementary-then-adversarial review is
127
+ available for the highest-risk scopes.
128
+
129
+ These levels state review intent and ceilings, not fixed reviewer counts or pass
130
+ recipes. A successful review path requires every proposed finding to be
131
+ adjudicated, not implemented. The receiving orchestrator weighs acceptance
132
+ criteria, supported users and deployment shape, likelihood, blast radius,
133
+ recoverability, safeguards, and delay cost. It fixes or activates material
134
+ current-cycle blockers, parks valid lower-priority concerns in the unbound
135
+ backlog, and rejects unsupported advice with a rationale. Reviewer labels and
136
+ repetition are evidence, not authority.
85
137
 
86
138
  ### Backlog item shape
87
139
 
@@ -153,12 +205,22 @@ gate_refactor_scan_library_roots:
153
205
  - .claude/skills
154
206
  binding_guard: warn
155
207
  epic_cohesion: phased
208
+ review_weight: standard
156
209
  backlog_staleness_days: 90
157
210
  ```
158
211
 
159
212
  The default `gates_for_release` order is fixed: **security → tests → cruft
160
213
  → docs → patterns**. Override only if the project has a justified reason.
161
214
 
215
+ Release-bound items define each gate's focus, not a hard scan boundary. A gate
216
+ may follow concrete evidence into adjacent dependencies, shared infrastructure,
217
+ or system-wide mechanisms. Findings caused by, exposed by, or materially
218
+ relevant to the release bind to it. Merely ambient discoveries must be written
219
+ to the unbound backlog, so wider inspection does not silently expand release
220
+ scope. Any cruft proposal that reduces behavior, validation, determinism,
221
+ compatibility, safety, or another meaningful guarantee requires explicit user
222
+ confirmation before it becomes active removal work.
223
+
162
224
  **`gate-refactor` is an opt-in gate** — not in the default list. Add it when your project has
163
225
  scan-rule libraries installed under `gate_refactor_scan_library_roots` (defaults:
164
226
  `{project}/.agents/skills/scan-*/SKILL.md`, then
@@ -204,6 +266,12 @@ treats them as mismatches acted on per `binding_guard`, like CONFLICTs (the proj
204
266
  ship whole"). CONFLICTs (a child bound to a *different* version than its bound parent, or a done
205
267
  parent unbound while its children are bound) always follow `binding_guard` regardless of this dial.
206
268
 
269
+ **`review_weight`** is optional and defaults to **`standard`** when absent. Valid values are
270
+ `none`, `light`, `standard`, `thorough`, and `maximum`. An explicit invocation selector overrides
271
+ the project value. The setting controls independent-review intent; it never relaxes implementation
272
+ verification or acceptance evidence. The canonical level semantics and lane selection live in the
273
+ `principles` and `review` skills rather than in project bootstrap configuration.
274
+
207
275
  **`backlog_staleness_days`** (integer; **absent ⇒ feature inert**) is the age threshold for the
208
276
  opt-in backlog staleness query `work-view --stale`. When set, `--stale` lists `.work/backlog/`
209
277
  items whose last-touched date — `updated` if present, else `created` — is more than this many days