@punks/cli 3.1.10 → 3.1.11

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 (38) hide show
  1. package/dist/BASELINE_CHANGELOG.md +33 -0
  2. package/dist/CHANGELOG.md +30 -0
  3. package/dist/data/subagents/manifest.mjs +11 -6
  4. package/dist/index.js +29 -29
  5. package/dist/skills/agnostic/cli/hi-cli/references/post-command-flow.md +5 -0
  6. package/dist/skills/agnostic/planning/create-plan/REFERENCE.md +1 -1
  7. package/dist/skills/agnostic/planning/create-plan/SKILL.md +19 -7
  8. package/dist/skills/agnostic/planning/create-plan/references/plan-schema.md +19 -0
  9. package/dist/skills/agnostic/planning/create-plan/references/planner-task-graph.md +27 -10
  10. package/dist/skills/agnostic/planning/implement-spec/SKILL.md +6 -2
  11. package/dist/skills/agnostic/planning/implement-spec/assets/IMPLEMENTATION-NOTES-TEMPLATE.md +22 -6
  12. package/dist/skills/agnostic/planning/implement-spec/references/lifecycle.md +12 -0
  13. package/dist/skills/agnostic/planning/implement-spec/references/parallel-orchestration.md +10 -2
  14. package/dist/skills/agnostic/planning/implement-spec/references/parallel-worker-brief.md +10 -1
  15. package/dist/skills/agnostic/planning/implement-spec/references/parallel.md +2 -0
  16. package/dist/skills/agnostic/quality/autoreview/SKILL.md +11 -2
  17. package/dist/skills/agnostic/quality/review/SKILL.md +16 -11
  18. package/dist/skills/languages/python/python-backend-structure/SKILL.md +91 -0
  19. package/dist/skills/languages/python/python-backend-structure/agents/openai.yaml +4 -0
  20. package/dist/skills/languages/python/python-design-patterns/SKILL.md +93 -69
  21. package/dist/skills/languages/python/python-project-structure/SKILL.md +4 -247
  22. package/dist/skills/phases/delivery-phase/SKILL.md +13 -4
  23. package/dist/skills/phases/delivery-phase/phases/closeout.md +3 -0
  24. package/dist/skills/phases/delivery-phase/phases/debug.md +8 -1
  25. package/dist/skills/phases/delivery-phase/phases/implement.md +11 -2
  26. package/dist/skills/phases/delivery-phase/phases/review.md +50 -29
  27. package/dist/skills/phases/delivery-phase/phases/router.md +56 -36
  28. package/dist/skills/phases/delivery-phase/references/artifact-state.md +8 -2
  29. package/dist/skills/phases/delivery-phase/references/phase-handoff.md +60 -10
  30. package/dist/skills/phases/finder-phase/references/root-routing.md +6 -1
  31. package/dist/skills/phases/review-phase/REFERENCE.md +83 -145
  32. package/dist/skills/phases/review-phase/SKILL.md +41 -45
  33. package/dist/skills/phases/review-phase/agents/openai.yaml +2 -0
  34. package/dist/skills/phases/review-phase/references/durable-report.md +172 -0
  35. package/dist/skills/phases/review-phase/references/state-graph.md +69 -0
  36. package/dist/skills/phases/review-phase/references/targets.md +156 -0
  37. package/dist/skills/phases/review-phase/scripts/review-contract.mjs +819 -0
  38. package/package.json +9 -9
@@ -1,31 +1,52 @@
1
1
  # Review Phase
2
2
 
3
- Use this phase after implementation or when delivery resumes with an unreviewed
4
- diff, branch, PR, or implementation artifact.
5
-
6
- ## Delegate
7
-
8
- Mandatory step: after this phase is selected, load and call `review-phase`
9
- before routing or closing delivery. Preserve its findings-first, readonly
10
- posture even when tests pass.
11
-
12
- ## Rules
13
-
14
- - Review is mandatory even when tests pass.
15
- - Review remains findings-first and readonly unless the called review skill says otherwise.
16
- - Classify findings before routing:
17
- - No blocking findings: route to docs ingest or closeout.
18
- - In-scope non-runtime blockers: route back to implement.
19
- - Runtime evidence: route to debug.
20
- - Broad scope or architecture debt: capture follow-up debt instead of expanding delivery.
21
-
22
- ## Completion State
23
-
24
- Write or verify:
25
-
26
- - review command or process used
27
- - findings and severity
28
- - accepted no-op reason if no findings
29
- - next route decision and why
30
-
31
- Then stop or re-enter `delivery-phase` for routing.
3
+ Use after implementation or whenever delivery has `review_due` for a stale or
4
+ missing retained review.
5
+
6
+ ## Prepare Explicit Review
7
+
8
+ 1. Validate accepted bounds and normalize a supported Git/diff target without
9
+ mutating it. Unsupported targets or invalid bounds enter `review_failed`
10
+ with exact evidence, no report, and no counter change.
11
+ 2. Keep that result in memory and recover `review_count` from unique valid retained passes for the
12
+ delivery lineage and reconcile the handoff projection.
13
+ 3. If recovered `review_count >= 3`, return `review_budget_exhausted` with exact
14
+ current-route evidence. This is a zero-write no-op: do not persist
15
+ `review_due` or mutate any handoff, counter, or delivery status.
16
+ 4. Only when recovered `review_count < 3`, persist `review_due` with the valid
17
+ normalized target and exact explicit `$review-phase` invocation
18
+ context defined in the phase-handoff reference. Do not preallocate an ordinal
19
+ or derive `review_run_id` yet.
20
+ 5. Return that invocation context and stop. Only an explicit operator invocation
21
+ of `$review-phase` consumes it, preallocates ordinal `review_count + 1`, fixes
22
+ `review_run_id`, and enters `review_running`.
23
+
24
+ For `report_retention_pending`, return an explicit `$review-phase` resume context
25
+ with the existing run id, local report identity, and fresh target/source hashes,
26
+ then stop. The explicit review invocation resumes retention without rerunning
27
+ lenses.
28
+
29
+ ## Route Retained Findings
30
+
31
+ After the retained report establishes the completed ordinal:
32
+
33
+ 1. Runtime evidence routes primarily to debugging.
34
+ 2. Otherwise, an in-scope non-runtime blocker routes primarily to implementation.
35
+ 3. Otherwise, broad architecture debt routes to debt follow-up.
36
+ 4. Otherwise, route to docs ingest or closeout by documentation completeness.
37
+
38
+ Architecture debt may remain a secondary follow-up beside debugging or
39
+ implementation. Opening either repair route is one atomic durable handoff write
40
+ of active state, route, `repair_count = review_count`, and idempotency
41
+ `review_run_id`. Reject a mismatched or already-consumed repair ordinal.
42
+ Complete the transition only after that write. Resume an already-recorded run
43
+ directly without another increment.
44
+
45
+ ## Completion
46
+
47
+ Before review, completion is a durable `review_due` handoff plus exact explicit
48
+ invocation context and a stop. After review returns `review_routed`, completion
49
+ records report path, report SHA-256, report commit SHA, verified retained ref,
50
+ lineage, run id, recovered/projected counts, stable finding ids, primary route,
51
+ secondary debt route when present, and resulting state. Then stop or re-enter
52
+ delivery routing.
@@ -1,48 +1,68 @@
1
1
  # Router Phase
2
2
 
3
- Use this file to choose the next delivery phase. Do not read other phase files
4
- until this router selects one.
3
+ Choose one next phase from durable artifacts. Review counters and active repair
4
+ state take precedence over inferred artifact order.
5
5
 
6
- ## Inputs To Inspect
6
+ ## Inputs
7
7
 
8
- - User request and entry intent: full delivery, resume, HITL checkpoint, or closeout.
9
- - Tracker item, issue, PR, branch, or spec folder named by the user.
10
- - Existing `SPEC.md`, backlog projection evidence, `PLAN.md`, implementation notes, review output, debug evidence, docs ingest notes, stack state, and validation evidence.
11
- - Relevant repo guidance only when needed to identify ownership or validation surface.
8
+ - entry intent and accepted goal bounds
9
+ - matching spec, backlog projection, plan, implementation notes, and validation
10
+ - retained review reports plus durable phase handoff
11
+ - current diff/target and governing source hashes
12
+ - docs, stack, tracker, and PR state when relevant
12
13
 
13
- ## Routing Order
14
+ ## Route
14
15
 
15
- 1. If goal bounds are unclear, stop and ask one concrete question.
16
- 2. If no matching agent-ready `SPEC.md` exists, load [spec.md](spec.md).
17
- 3. If the spec exists but is stale, contradictory, or missing required child-story scope, load [spec.md](spec.md).
18
- 4. If the verified post-spec backlog projection is missing or stale, load [backlog.md](backlog.md).
19
- 5. If no execution-ready matching plan exists, load [plan.md](plan.md).
20
- 6. If the plan exists but lacks dependencies, owned paths, validation gates, or wave boundaries, load [plan.md](plan.md).
21
- 7. If accepted plan work is incomplete, load [implement.md](implement.md).
22
- 8. If implementation exists but mandatory review is missing or stale, load [review.md](review.md).
23
- 9. If review found in-scope non-runtime blockers, route back to [implement.md](implement.md).
24
- 10. If validation or review produced runtime evidence, load [debug.md](debug.md).
25
- 11. If docs-affecting changes exist and ingest is missing, load [docs-ingest.md](docs-ingest.md).
26
- 12. Otherwise load [closeout.md](closeout.md).
16
+ 1. Stop on unclear goal bounds and ask one concrete question.
17
+ 2. For durable `review_due`, load [review.md](review.md). It first validates
18
+ accepted bounds and normalizes a supported target. A rejection enters
19
+ `review_failed` even when a persisted counter is 3. Only after those checks
20
+ may it recover `review_count` and evaluate the budget in memory. Exhaustion
21
+ returns `review_budget_exhausted` with zero handoff or status writes. A count
22
+ below 3 persists `review_due` and returns the exact explicit `$review-phase`
23
+ invocation context. Then stop. Delivery never enters `review_running` itself.
24
+ 3. For `report_retention_pending`, load [review.md](review.md) only to return the
25
+ exact explicit `$review-phase` resume context, then stop. A fresh local report
26
+ resumes without rerunning lenses. Stop on terminal `review_failed` with its
27
+ exact evidence.
28
+ 4. Otherwise recover review state by `review_lineage_id`: read the highest valid
29
+ retained ordinal, reconcile the handoff `review_count` projection, then assess
30
+ target and source freshness separately.
31
+ 5. Route a fresh retained `review_routed` report through [review.md](review.md)
32
+ when no durable route handoff exists yet.
33
+ 6. Resume an atomic handoff already in `debug_active` through [debug.md](debug.md)
34
+ or `repair_active` through [implement.md](implement.md). A recorded
35
+ `review_run_id` cannot increment `repair_count` again.
36
+ 7. Route `focused_validation` to its recorded implementation or debugging owner.
37
+ Passing becomes `clean_handoff`; failure remains repair epoch 3.
38
+ 8. Route `clean_handoff` to [docs-ingest.md](docs-ingest.md) when docs remain,
39
+ otherwise [closeout.md](closeout.md).
40
+ 9. If no matching agent-ready `SPEC.md` exists, or it is stale,
41
+ contradictory, or incomplete, load [spec.md](spec.md).
42
+ 10. If the verified post-spec backlog projection is missing or stale, load
43
+ [backlog.md](backlog.md).
44
+ 11. If no execution-ready matching plan exists, or it lacks dependencies, owned
45
+ paths, validation gates, or wave boundaries, load [plan.md](plan.md).
46
+ 12. If accepted plan work is incomplete, load [implement.md](implement.md).
47
+ 13. If implementation exists and its retained review is missing or stale, load
48
+ [review.md](review.md). That phase validates accepted bounds and normalizes a
49
+ supported target before any delivery-budget evaluation, then returns either
50
+ `review_failed`, `review_budget_exhausted`, or the exact explicit
51
+ `$review-phase` invocation context and stops.
52
+ 14. Route remaining docs-affecting work to [docs-ingest.md](docs-ingest.md),
53
+ otherwise [closeout.md](closeout.md).
27
54
 
28
- ## HITL Behavior
55
+ Only an explicitly new delivery goal with materially changed accepted bounds
56
+ creates a new lineage and resets review/repair counters. Same-goal bounds
57
+ revision, resume, rebase, commit, retry, and handoff preserve them.
29
58
 
30
- A HITL checkpoint is explicit user control, never an inferred spec approval
31
- gate. When requested, route only the requested phase and stop after writing its
32
- phase handoff. On resume, an agent-ready `SPEC.md` proceeds directly to the next
33
- applicable phase; no reviewed or approved status is required.
59
+ ## HITL And Resume
34
60
 
35
- ## Resume Behavior
36
-
37
- Assume earlier phases may have been completed manually through their direct
38
- skills. Verify artifact freshness; do not re-run a phase only because
39
- `delivery-phase` did not run it.
61
+ A HITL checkpoint is explicit user control. Run only the requested phase and
62
+ stop after its handoff. Earlier phases may have completed through direct skills;
63
+ reuse fresh matching artifacts rather than rerunning them.
40
64
 
41
65
  ## Output
42
66
 
43
- Report:
44
-
45
- - selected phase
46
- - evidence that selected it
47
- - child skill or phase file to load next
48
- - blocker question if no phase can be selected safely
67
+ Report the selected state and phase, the durable evidence that selected it, the
68
+ next file or child skill, and any exact blocker.
@@ -30,8 +30,14 @@ Use this reference when deciding whether a phase is complete enough to skip.
30
30
 
31
31
  ## Review Complete
32
32
 
33
- - `review-phase` ran after the latest implementation diff.
34
- - Findings are resolved, accepted, routed to debug, or captured as follow-up.
33
+ - A fresh immutable report matches the delivery lineage, accepted bounds,
34
+ normalized target, governing source hashes, and latest implementation state.
35
+ - Its commit exists on a verified retained ref; a local report alone is pending.
36
+ - The highest valid retained ordinal is authoritative and the handoff
37
+ `review_count` is its reconciled projection.
38
+ - Findings are routed by stable ids. Review itself entered no repair state.
39
+ - After fix 3, `clean_handoff` supersedes the normal fresh-review requirement
40
+ and links report 3, final changes, focused validation, and clean status.
35
41
 
36
42
  ## Debug Complete
37
43
 
@@ -1,9 +1,8 @@
1
1
  # Phase Handoff
2
2
 
3
- Each phase must leave enough state for a later `delivery-phase` invocation to
4
- resume without guessing.
3
+ Each phase leaves enough durable state for resume without guessing.
5
4
 
6
- ## Minimum Handoff Shape
5
+ ## Base Shape
7
6
 
8
7
  ```text
9
8
  Phase:
@@ -17,11 +16,62 @@ Next suggested route:
17
16
  Blockers:
18
17
  ```
19
18
 
20
- ## Rules
19
+ State only what ran. Prefer durable artifact paths/links. Carry approved
20
+ artifacts and UI evidence. Give every skip an exact no-op reason. Honor explicit
21
+ HITL stops.
21
22
 
22
- - State what actually ran. Do not imply downstream phases ran.
23
- - Prefer links or paths to durable artifacts over prose-only claims.
24
- - Carry approved artifact links and before/after UI Evidence links forward; if links are missing, name whether `repo-asset-management` is blocked or not applicable.
25
- - If a phase is skipped, record the no-op reason.
26
- - If the user requested HITL control, stop after the handoff even when the next
27
- route is obvious.
23
+ ## Review And Repair Projection
24
+
25
+ For a delivery goal with review activity, also persist:
26
+
27
+ ```text
28
+ delivery_goal_identity:
29
+ accepted_bounds_identity:
30
+ accepted_bounds_hash:
31
+ review_lineage_id:
32
+ review_run_id:
33
+ state: review_due | review_running | report_retention_pending | review_routed | debug_active | repair_active | focused_validation | clean_handoff
34
+ primary_route:
35
+ review_count:
36
+ repair_count:
37
+ authoritative_report_path:
38
+ authoritative_report_commit:
39
+ verified_retained_ref:
40
+ stable_finding_ids:
41
+ ```
42
+
43
+ `review_count` is a projection of the highest valid retained report ordinal for
44
+ the lineage. Reconcile it on resume. An opening repair transition atomically
45
+ writes active state, primary route, `repair_count = review_count`, and
46
+ idempotency `review_run_id`; complete the transition only after the write. A
47
+ recorded run id resumes its state without increment or guard fallthrough.
48
+
49
+ ## Explicit Review Invocation Context
50
+
51
+ Delivery persists this block for `review_due` and returns it unchanged before
52
+ stopping:
53
+
54
+ ```text
55
+ explicit_operator_invocation_required: true
56
+ review_invocation_skill: $review-phase
57
+ review_invocation_mode: delivery
58
+ delivery_goal_identity:
59
+ accepted_bounds_identity:
60
+ accepted_bounds_hash:
61
+ review_lineage_id:
62
+ recovered_review_count:
63
+ current_route:
64
+ normalized_target:
65
+ ```
66
+
67
+ The `review_due` handoff leaves `review_run_id` unset. Only the explicit operator
68
+ invocation consumes this context, preallocates the next ordinal, fixes the run
69
+ id, and enters `review_running`.
70
+
71
+ For `report_retention_pending`, the explicit resume context additionally carries
72
+ the existing `review_run_id`, ordinal, local report path and SHA-256, target hash,
73
+ source hashes, and intended retained ref. Delivery returns it and stops; the
74
+ operator invokes `$review-phase` to retry retention without rerunning lenses.
75
+
76
+ After fix 3, `clean_handoff` is final authority. Link immutable review 3, final
77
+ changes, the same passing focused validation, and clean status.
@@ -15,7 +15,8 @@ Keep root prompt guidance short:
15
15
  - Unclear requirements inside a bounded topic route to `requirements-phase`.
16
16
  - Accepted specs, issues, or plans route to `delivery-phase`.
17
17
  - Runtime failures route to `debugging-phase`.
18
- - Reviews route to `review-phase`.
18
+ - Review requests persist the bounded target and accepted-bounds context, then
19
+ point the operator to the exact explicit `$review-phase` invocation.
19
20
  - Docs learning after proven changes routes to `docs-ingest-phase`.
20
21
 
21
22
  ## Boundary
@@ -28,3 +29,7 @@ Keep root prompt guidance short:
28
29
  - `create-spec`, `create-plan`, or `delivery-phase` after implementation scope is accepted.
29
30
 
30
31
  It chooses the route and updates the frontier handoff.
32
+
33
+ `finder-phase`, root routing, and `delivery-phase` never invoke, delegate to, or
34
+ model-select `review-phase`. They may only persist its input context, return the
35
+ exact explicit `$review-phase` instruction, and stop.
@@ -1,147 +1,85 @@
1
1
  # Review Phase Reference
2
2
 
3
- ## Use And Stop Rules
4
-
5
- Use for review-only goals, audits, PR review, suspicious code, external edits,
6
- merged or rebased branches, and `delivery-phase` review gates.
7
-
8
- Do not use when the user asks for immediate implementation, pure planning,
9
- requirements grilling, docs writing with no artifact to review, or an undefined
10
- target that cannot be inferred from branch, diff, issue, PR, or prompt.
11
-
12
- Standalone mode is readonly and stops after findings. Delivery mode may return
13
- findings to delivery for fixes, debugging, docs, or validation because delivery
14
- owns completion.
15
-
16
- ## Scope Policy
17
-
18
- Default to the smallest certain target:
19
-
20
- - open PR changes
21
- - highlighted diff
22
- - supplied code portions
23
- - branch range
24
- - named files, paths, packages, apps, domains, or features
25
-
26
- Use a full-codebase scan only when no PR is open and no certain domain, portion,
27
- or path is provided, or when the user explicitly asks for a full-codebase
28
- review.
29
-
30
- Pass the bounded target into every inner review step: `autoreview`,
31
- ClawPatch-backed review, delegated readonly checks, and lens prompts. Do not run
32
- review tooling against the full codebase when a bounded target exists.
33
-
34
- For PR review, use the actual PR base branch. Do not assume trunk.
35
-
36
- ## Runtime And Lenses
37
-
38
- Start review flow with `review`. It pins the fixed point, discovers
39
- Spec and Standards sources, carries baseline code smells, and keeps Standards
40
- findings separate from Spec findings. Use that frame for delegated review
41
- prompts, `autoreview` context, and final aggregation.
42
-
43
- `autoreview` remains the core structured review runtime. Capture the exact
44
- command and manually verify accepted findings against source, docs, scoped
45
- skills, and dependency contracts.
46
-
47
- Mandatory lenses:
48
-
49
- - `review`: two-axis Standards versus Spec wrapper, fixed diff, and
50
- separate aggregation.
51
- - `simplify`: clarity, avoidable complexity, unnecessary abstraction, derivable
52
- state, naming, and scope creep.
53
- - `improve-codebase-architecture`: boundary friction, shallow modules, module
54
- depth, and follow-up RFC candidates.
55
- - Scoped local guidance: nearest relevant `AGENTS.md`, stack skills, runbooks,
56
- ownership rules, and skills named by those instructions.
57
-
58
- Conditional lens:
59
-
60
- - `parallel-research`: split independent readonly checks by subsystem, risk, or
61
- hypothesis. Synthesize evidence; do not vote-count disagreements.
62
-
63
- ## Evidence And Validation
64
-
65
- Prefer primary artifacts over tracker summaries. Record exact files and
66
- commands consulted. Include stack status or prior delivery stack evidence when
67
- stack metadata is relevant.
68
-
69
- Safe readonly validation may include focused tests, typecheck, lint, build,
70
- docs link checks, or smoke commands. If a check cannot run, state why and the
71
- residual risk.
72
-
73
- For behavior-changing implementation plans or specs, missing RED/GREEN proof is
74
- a blocking finding unless the task has an explicit valid `reason_not_testable`.
75
- Reject `reason_not_testable` when the only reason is forgotten RED; the delivery
76
- owner must recover with public-result RED and GREEN evidence.
77
-
78
- ## Requirements Grill Wrapper Review
79
-
80
- When reviewed spec, plan, phase, or wrapper claims to use
81
- `requirements-grill` or design-phase grill, review shared interview behavior
82
- against `$grilling` and durable behavior against the `requirements-grill`
83
- inner flow, not just its outer handoff.
84
-
85
- Check:
86
-
87
- - Serious grill sessions pair `references/grilling-flow.md` with
88
- `references/artifact-output.md`.
89
- - Before each round is yielded, it is persisted with stable question ids,
90
- prerequisites, and the current frontier, with a stable mapping between live
91
- questions and the routed log/status artifacts.
92
- - Each response set is processed answer by answer; partially answered rounds
93
- preserve omitted questions as unanswered and carry them forward.
94
- - Status is updated after each response set, and branch percentages agree with
95
- the unanswered-question and shared-understanding confirmation fields.
96
- - Routed grill log/status artifacts are created or updated when grilling
97
- decisions, branches, parked scope, percentages, glossary, axioms, or
98
- ambiguities change.
99
- - Glossary, axiom, and status updates preserve current meaning while the
100
- log records accepted decisions and superseded decisions.
101
- - Added or renamed wiki grill artifacts update routed metadata/bookkeeping:
102
- `content/docs/project/grilling/meta.json`, section index when missing,
103
- and wiki `log.md` when the repo maintains one.
104
- - After `$grilling` completes, downstream handoff evidence exists as
105
- applicable: wiki synthesis, backlog/user stories, spec, or phase handoff
106
- carrying accepted decisions and recorded scope state.
107
-
108
- Missing inner-flow or durable-artifact evidence is a review finding when
109
- the wrapper promised grill behavior.
110
-
111
- ## Findings Policy
112
-
113
- Prioritize bugs, regressions, broken contracts, missing validation, unsafe
114
- assumptions, and user-facing risks. Include file and line references when
115
- available. Separate blocking findings from improvements and optional cleanup.
116
-
117
- Do not edit code in standalone mode unless the user explicitly asks after
118
- seeing the review scope. Do not use `simplify` as permission to refactor.
119
-
120
- Do not flatten scoped `AGENTS.md` guidance into generic advice; cite the
121
- concrete constraint. Do not skip scoped skills from `AGENTS.md` prompts.
122
-
123
- Do not run mutating stack commands in review. `review-phase` reports stack
124
- evidence only; delivery owns `stack sync`.
125
-
126
- ## Output Checklist
127
-
128
- Lead with findings, ordered by severity. For each finding include:
129
-
130
- - severity
131
- - file/line or artifact reference
132
- - issue and impact
133
- - evidence
134
- - recommended action
135
-
136
- Then include:
137
-
138
- - open questions or assumptions
139
- - validation run and result
140
- - exact `autoreview` command and clean/accepted-findings result
141
- - fixed point, Spec source or skipped reason, Standards sources
142
- - scoped `AGENTS.md` files and mandatory scoped skills checked
143
- - short summary after findings
144
- - mode: standalone readonly review or delivery-owned review
145
-
146
- If there are no findings, say so clearly and still report validation coverage
147
- and residual risk.
3
+ Load [references/targets.md](references/targets.md) for target normalization,
4
+ identity, or resume. Load
5
+ [references/state-graph.md](references/state-graph.md) for delivery budget,
6
+ failure, retention, routing, repair, or final-fix behavior. Load
7
+ [references/durable-report.md](references/durable-report.md) before writing or
8
+ retaining a report.
9
+
10
+ ## One All-Lens Run
11
+
12
+ Evaluate exactly one frozen bounded snapshot per completed invocation.
13
+
14
+ 1. Run `autoreview` exactly once as advisory candidate generation. A ClawPatch
15
+ helper, when present, stays inside that call and consumes no additional pass.
16
+ 2. The parent verifies all advisory candidates against the frozen target and
17
+ adjacent evidence. Only verified candidates become findings.
18
+ 3. Dispatch independent lenses against the same snapshot in parallel:
19
+ - Standards
20
+ - skill adherence and scoped skills
21
+ - architecture
22
+ - simplify
23
+ - Spec
24
+ 4. Record an explicit outcome for every lens. Standards and skill adherence,
25
+ architecture, simplify, then Spec controls presentation and triage order
26
+ only. Parallel execution is unchanged. Standards and Spec stay distinct
27
+ report sections without cross-axis merging or reranking.
28
+
29
+ The `review` skill supplies separate Standards and Spec checks. Apply
30
+ `improve-codebase-architecture`, `simplify`, the nearest `AGENTS.md`, and every
31
+ named scoped skill as their own bounded lenses.
32
+
33
+ ## Skill-Adherence Lens
34
+
35
+ Treat `assigned_skills` as planning provenance. For every implementation task:
36
+
37
+ 1. Match every implementation-applicable `assigned_skills` item to exactly one
38
+ `implementation_skill_guidance` entry.
39
+ 2. Match every guidance entry to exactly one `IMPLEMENTATION-NOTES.md` evidence
40
+ record.
41
+ 3. Check evidence cardinality and every record, including `not_applicable`,
42
+ against frozen changed artifacts and the cited how/where location.
43
+ 4. Report missing, extra, or contradicted claims as a skill-adherence finding.
44
+
45
+ When a requirements or design wrapper claims grilling behavior, verify its
46
+ named guidance, routed log/status artifacts, stable question mapping, carried
47
+ unanswered questions, and downstream synthesis evidence instead of accepting
48
+ the wrapper claim alone.
49
+
50
+ ## Validation Boundary
51
+
52
+ Run the smallest safe readonly validation needed to verify candidates or
53
+ governing acceptance evidence. Broader checks run only when the accepted spec
54
+ or plan explicitly requires them. Missing required RED/GREEN evidence becomes
55
+ a reported and routed finding; review never creates that evidence.
56
+
57
+ Before every validation command, record the frozen-target hash. A command may
58
+ run against the reviewed checkout only when its no-write mode is proven. Run any
59
+ command that may write caches, generated files, snapshots, lockfiles, or other
60
+ state in a disposable checkout or snapshot rooted at the frozen revision.
61
+
62
+ Always recompute and compare the frozen-target hash after validation. A mismatch
63
+ invalidates the run and any local report, returns `review_due` with exact
64
+ mutation evidence, and consumes no pass. Record exact commands, isolation mode,
65
+ before/after hashes, sources, skipped checks, and residual risk. Keep this
66
+ validation bounded; isolation is a safety boundary, not permission to broaden
67
+ the test surface.
68
+
69
+ Use the executable before/after decision in
70
+ [`scripts/review-contract.mjs`](scripts/review-contract.mjs); mutation returns
71
+ `review_due` and consumes no pass.
72
+
73
+ ## Finding And Route Output
74
+
75
+ Every stable finding records severity, location, impact, evidence, and action.
76
+ Determine route precedence from verified evidence:
77
+
78
+ 1. runtime evidence: debugging
79
+ 2. otherwise, an in-scope non-runtime blocker: implementation
80
+ 3. otherwise, broad architecture debt: debt follow-up
81
+ 4. otherwise: documentation ingest or closeout by documentation completeness
82
+
83
+ Broad architecture debt may accompany debugging or implementation as a
84
+ secondary follow-up. Review returns this routing output and stops. Delivery
85
+ owns route mutation and repairs.