@haposoft/cafekit 0.16.7 → 0.18.1

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 (231) hide show
  1. package/README.md +14 -22
  2. package/bin/__tests__/codex-hooks-ownership.test.js +2 -2
  3. package/bin/__tests__/codex-hooks.test.js +169 -272
  4. package/bin/__tests__/codex-native.test.js +100 -202
  5. package/bin/__tests__/develop-contract.test.js +122 -1413
  6. package/bin/__tests__/docs-sync-on-demand.test.js +93 -0
  7. package/bin/__tests__/grok-envelope.test.js +0 -56
  8. package/bin/__tests__/hook-payload.test.js +4 -6
  9. package/bin/__tests__/legacy-authority-decoupled.test.js +154 -0
  10. package/bin/__tests__/legacy-hooks-retired.test.js +221 -0
  11. package/bin/__tests__/omp-bridge.test.js +20 -17
  12. package/bin/__tests__/omp-hooks.test.js +0 -19
  13. package/bin/__tests__/optional-skill-inventory.test.js +112 -4
  14. package/bin/__tests__/orca-session.test.js +0 -2
  15. package/bin/__tests__/package-inventory.test.js +90 -925
  16. package/bin/__tests__/runtime-dir.test.js +0 -3
  17. package/bin/__tests__/runtime-schema.test.js +3 -2
  18. package/bin/__tests__/skill-routing-source.test.js +27 -15
  19. package/bin/__tests__/spec-narrowing.test.js +30 -161
  20. package/bin/__tests__/specs-v2-execution-closeout.test.js +0 -437
  21. package/bin/__tests__/test-runtime-dependency-closure.cjs +1 -2
  22. package/bin/__tests__/ui-ux-skill.test.js +101 -0
  23. package/bin/__tests__/usage-hook-retired.test.js +114 -0
  24. package/bin/__tests__/validator-grounding.test.js +18 -2949
  25. package/bin/lib/managed-writer.js +2 -3
  26. package/bin/phases/codex-runtime.js +27 -0
  27. package/bin/phases/copy-payload.js +13 -28
  28. package/bin/phases/omp-runtime.js +25 -0
  29. package/package.json +2 -3
  30. package/src/claude/CLAUDE.md +3 -10
  31. package/src/claude/agents/brainstormer.md +7 -3
  32. package/src/claude/agents/code-auditor.md +44 -56
  33. package/src/claude/agents/debugger.md +8 -88
  34. package/src/claude/agents/deployer.md +3 -5
  35. package/src/claude/agents/docs-keeper.md +6 -14
  36. package/src/claude/agents/git-ops.md +2 -4
  37. package/src/claude/agents/implementer.md +12 -16
  38. package/src/claude/agents/inspector.md +4 -3
  39. package/src/claude/agents/project-manager.md +9 -17
  40. package/src/claude/agents/researcher.md +9 -3
  41. package/src/claude/agents/spec-maker.md +15 -15
  42. package/src/claude/agents/test-runner.md +8 -11
  43. package/src/claude/agents/ui-ux-designer.md +0 -1
  44. package/src/claude/hooks/__tests__/fixtures/statusline-default.golden +1 -1
  45. package/src/claude/hooks/__tests__/spec-gate.test.js +244 -333
  46. package/src/claude/hooks/__tests__/spec-state-touched.test.js +160 -0
  47. package/src/claude/hooks/__tests__/state.test.js +68 -0
  48. package/src/claude/hooks/__tests__/statusline.test.js +140 -11
  49. package/src/claude/hooks/agent.cjs +2 -1
  50. package/src/claude/hooks/lib/hook-payload.cjs +2 -2
  51. package/src/claude/hooks/rules.cjs +2 -1
  52. package/src/claude/hooks/session.cjs +0 -1
  53. package/src/claude/hooks/spec-gate.cjs +17 -83
  54. package/src/claude/hooks/spec-state.cjs +142 -39
  55. package/src/claude/hooks/state.cjs +21 -2
  56. package/src/claude/migration-manifest.json +42 -22
  57. package/src/claude/output-styles/coding-level-0-eli5.md +9 -9
  58. package/src/claude/output-styles/coding-level-1-junior.md +3 -3
  59. package/src/claude/output-styles/coding-level-2-mid.md +3 -3
  60. package/src/claude/output-styles/coding-level-3-senior.md +2 -2
  61. package/src/claude/output-styles/coding-level-4-lead.md +5 -5
  62. package/src/claude/output-styles/coding-level-5-god.md +6 -6
  63. package/src/claude/rules/ai-dev-rules.md +2 -3
  64. package/src/claude/rules/hook-protocols.md +8 -15
  65. package/src/claude/rules/manage-docs.md +9 -23
  66. package/src/claude/rules/orchestrator.md +3 -4
  67. package/src/claude/rules/review-audit-self-decision.md +3 -3
  68. package/src/claude/rules/skill-domain-routing.md +1 -3
  69. package/src/claude/rules/skill-workflow-routing.md +4 -5
  70. package/src/claude/rules/state-sync.md +3 -12
  71. package/src/claude/rules/workflow.md +11 -19
  72. package/src/claude/runtime.schema.json +5 -3
  73. package/src/claude/scripts/generate-skill-catalog.cjs +7 -6
  74. package/src/claude/scripts/provenance.cjs +23 -5
  75. package/src/claude/scripts/spec-receipt.cjs +24 -121
  76. package/src/claude/scripts/spec-resolver.cjs +41 -458
  77. package/src/claude/scripts/workflow-policy.cjs +3 -1801
  78. package/src/claude/settings/settings.json +1 -32
  79. package/src/claude/skills/agent-browser/SKILL.md +1 -1
  80. package/src/claude/skills/{question → ask}/SKILL.md +9 -75
  81. package/src/claude/skills/brainstorm/SKILL.md +43 -131
  82. package/src/claude/skills/chrome-devtools/SKILL.md +14 -31
  83. package/src/claude/skills/code-review/SKILL.md +29 -81
  84. package/src/claude/skills/code-review/references/spec-compliance-review.md +4 -8
  85. package/src/claude/skills/debug/SKILL.md +29 -149
  86. package/src/claude/skills/develop/SKILL.md +26 -83
  87. package/src/claude/skills/develop/references/parallel-waves.md +0 -8
  88. package/src/claude/skills/develop/references/quality-gate.md +15 -13
  89. package/src/claude/skills/develop/references/subagent-patterns.md +0 -6
  90. package/src/claude/skills/docs/SKILL.md +2 -2
  91. package/src/claude/skills/docs/references/update-workflow.md +1 -1
  92. package/src/claude/skills/fix/SKILL.md +153 -0
  93. package/src/claude/skills/{hotfix → fix}/references/diagnosis-protocol.md +2 -2
  94. package/src/claude/skills/{hotfix → fix}/references/parallel-patterns.md +2 -2
  95. package/src/claude/skills/{hotfix → fix}/references/prevention-gate.md +3 -3
  96. package/src/claude/skills/{hotfix → fix}/references/review-cycle.md +1 -1
  97. package/src/claude/skills/git/SKILL.md +48 -9
  98. package/src/claude/skills/git/references/commit-protocols.md +35 -16
  99. package/src/claude/skills/git/references/worktree-blueprint.md +42 -6
  100. package/src/claude/skills/orca/SKILL.md +9 -8
  101. package/src/claude/skills/research/SKILL.md +17 -46
  102. package/src/claude/skills/scout/SKILL.md +61 -0
  103. package/src/claude/skills/{inspect → scout}/references/internal-inspection.md +26 -10
  104. package/src/claude/skills/specs/SKILL.md +22 -29
  105. package/src/claude/skills/specs/references/review.md +8 -6
  106. package/src/claude/skills/specs/references/templates.md +34 -41
  107. package/src/claude/skills/sync/SKILL.md +16 -45
  108. package/src/claude/skills/sync/references/rebind-and-audit.md +59 -0
  109. package/src/claude/skills/sync/references/sync-protocols.md +4 -13
  110. package/src/claude/skills/test/SKILL.md +39 -104
  111. package/src/claude/skills/test/references/execution-strategy.md +93 -21
  112. package/src/claude/skills/test/references/failure-triage.md +1 -1
  113. package/src/claude/skills/ui-ux/LICENSE +21 -0
  114. package/src/claude/skills/ui-ux/SKILL.md +497 -0
  115. package/src/claude/skills/ui-ux/references/brand-tokens.md +90 -0
  116. package/src/claude/skills/ui-ux/references/budgets.md +113 -0
  117. package/src/claude/skills/ui-ux/references/checklist.md +271 -0
  118. package/src/claude/skills/ui-ux/references/components/accordion.md +246 -0
  119. package/src/claude/skills/ui-ux/references/components/avatar.md +153 -0
  120. package/src/claude/skills/ui-ux/references/components/banner.md +43 -0
  121. package/src/claude/skills/ui-ux/references/components/breadcrumb.md +201 -0
  122. package/src/claude/skills/ui-ux/references/components/button.md +142 -0
  123. package/src/claude/skills/ui-ux/references/components/card.md +113 -0
  124. package/src/claude/skills/ui-ux/references/components/charts.md +376 -0
  125. package/src/claude/skills/ui-ux/references/components/chat.md +132 -0
  126. package/src/claude/skills/ui-ux/references/components/choice-controls.md +369 -0
  127. package/src/claude/skills/ui-ux/references/components/comment-thread.md +17 -0
  128. package/src/claude/skills/ui-ux/references/components/description-list.md +116 -0
  129. package/src/claude/skills/ui-ux/references/components/empty-state.md +98 -0
  130. package/src/claude/skills/ui-ux/references/components/file-upload.md +107 -0
  131. package/src/claude/skills/ui-ux/references/components/inline-edit.md +128 -0
  132. package/src/claude/skills/ui-ux/references/components/input.md +161 -0
  133. package/src/claude/skills/ui-ux/references/components/list-row.md +56 -0
  134. package/src/claude/skills/ui-ux/references/components/loading.md +198 -0
  135. package/src/claude/skills/ui-ux/references/components/logo.md +147 -0
  136. package/src/claude/skills/ui-ux/references/components/otp-input.md +43 -0
  137. package/src/claude/skills/ui-ux/references/components/quantity-input.md +100 -0
  138. package/src/claude/skills/ui-ux/references/components/range-slider.md +16 -0
  139. package/src/claude/skills/ui-ux/references/components/small-controls.md +340 -0
  140. package/src/claude/skills/ui-ux/references/components/sortable-header.md +86 -0
  141. package/src/claude/skills/ui-ux/references/components/tag-input.md +14 -0
  142. package/src/claude/skills/ui-ux/references/components/timeline.md +38 -0
  143. package/src/claude/skills/ui-ux/references/components/tree.md +30 -0
  144. package/src/claude/skills/ui-ux/references/design-process.md +650 -0
  145. package/src/claude/skills/ui-ux/references/layouts/app-kanban.html +303 -0
  146. package/src/claude/skills/ui-ux/references/layouts/app.md +1369 -0
  147. package/src/claude/skills/ui-ux/references/layouts/form.md +430 -0
  148. package/src/claude/skills/ui-ux/references/layouts/overlay.md +552 -0
  149. package/src/claude/skills/ui-ux/references/layouts/pricing.md +204 -0
  150. package/src/claude/skills/ui-ux/references/locked-rules.md +35 -0
  151. package/src/claude/skills/ui-ux/references/principles.md +408 -0
  152. package/src/claude/skills/ui-ux/references/refactor.md +245 -0
  153. package/src/claude/skills/ui-ux/references/responsive.md +195 -0
  154. package/src/claude/skills/ui-ux/references/review.md +528 -0
  155. package/src/claude/skills/ui-ux/references/rules-color.md +623 -0
  156. package/src/claude/skills/ui-ux/references/rules-form.md +235 -0
  157. package/src/claude/skills/ui-ux/references/rules-state.md +680 -0
  158. package/src/claude/skills/ui-ux/references/rules-type.md +369 -0
  159. package/src/claude/skills/ui-ux/references/styles.md +311 -0
  160. package/src/claude/skills/ui-ux/references/system.md +219 -0
  161. package/src/claude/skills/ui-ux/references/tailwind-v4-traps.md +237 -0
  162. package/src/claude/skills/ui-ux/references/tokens.css +362 -0
  163. package/src/claude/skills/ui-ux/scripts/lint-skill.mjs +216 -0
  164. package/src/claude/skills/ui-ux/scripts/package.json +9 -0
  165. package/src/claude/skills/ui-ux/scripts/probe.mjs +4447 -0
  166. package/src/claude/skills/ui-ux-pro-max/SKILL.md +25 -80
  167. package/src/claude/skills/web-testing/SKILL.md +2 -20
  168. package/src/claude/status.cjs +149 -144
  169. package/src/codex/AGENTS.md +8 -13
  170. package/src/codex/hooks/agent.cjs +2 -1
  171. package/src/codex/hooks/lib/spec-receipt.cjs +4 -32
  172. package/src/codex/hooks/lib/spec-utils.cjs +6 -52
  173. package/src/codex/hooks/rules.cjs +2 -1
  174. package/src/codex/hooks/session.cjs +0 -2
  175. package/src/codex/hooks/spec-gate.cjs +13 -81
  176. package/src/codex/hooks/spec-state.cjs +37 -41
  177. package/src/codex/hooks.json +0 -20
  178. package/src/codex/rules/state-sync.md +3 -12
  179. package/src/common/AGENTS.md +6 -12
  180. package/src/omp/extensions/cafekit-bridge.mjs +6 -6
  181. package/bin/__tests__/change-firewall.semantic-firewall.test.js +0 -2133
  182. package/bin/__tests__/finalizer-pass-gate.semantic-firewall.test.js +0 -342
  183. package/bin/__tests__/release-preflight.semantic-firewall.test.js +0 -586
  184. package/bin/__tests__/review-receipt-c2.semantic-firewall.test.js +0 -378
  185. package/bin/__tests__/specs-v2-policy-and-scaffold.test.js +0 -665
  186. package/bin/__tests__/specs-v2-validator-grounder-contract.test.js +0 -1132
  187. package/src/claude/hooks/__tests__/completion-authority.test.js +0 -990
  188. package/src/claude/hooks/__tests__/semantic-review-authority.test.js +0 -259
  189. package/src/claude/hooks/completion-authority-check.cjs +0 -56
  190. package/src/claude/hooks/completion-authority-state.cjs +0 -527
  191. package/src/claude/hooks/completion-authority.cjs +0 -163
  192. package/src/claude/hooks/lib/context.cjs +0 -616
  193. package/src/claude/hooks/lib/detect.cjs +0 -474
  194. package/src/claude/hooks/semantic-review-authority.cjs +0 -154
  195. package/src/claude/hooks/task-scaffold-guard.cjs +0 -114
  196. package/src/claude/hooks/usage.cjs +0 -197
  197. package/src/claude/scripts/change-firewall.cjs +0 -1748
  198. package/src/claude/scripts/spec-authoring-digest.cjs +0 -151
  199. package/src/claude/scripts/spec-authoring-validation.cjs +0 -126
  200. package/src/claude/scripts/spec-final-state.cjs +0 -290
  201. package/src/claude/scripts/spec-ground.cjs +0 -650
  202. package/src/claude/scripts/spec-readiness.cjs +0 -425
  203. package/src/claude/scripts/spec-scaffold.cjs +0 -2317
  204. package/src/claude/scripts/spec-semantic-model.cjs +0 -396
  205. package/src/claude/scripts/validate-spec-output.cjs +0 -3941
  206. package/src/claude/skills/code-review/references/verification-gate.md +0 -46
  207. package/src/claude/skills/delegate/SKILL.md +0 -124
  208. package/src/claude/skills/delegate/references/codex-delegation.md +0 -71
  209. package/src/claude/skills/delegate/references/grok-delegation.md +0 -84
  210. package/src/claude/skills/hotfix/SKILL.md +0 -289
  211. package/src/claude/skills/inspect/SKILL.md +0 -142
  212. package/src/claude/skills/loop/SKILL.md +0 -114
  213. package/src/claude/skills/loop/references/bounded-loop-protocol.md +0 -104
  214. package/src/claude/skills/loop/references/metric-and-guard-contract.md +0 -76
  215. package/src/claude/skills/route/SKILL.md +0 -94
  216. package/src/claude/skills/route/references/agent-timing.md +0 -46
  217. package/src/claude/skills/route/references/chaining-patterns.md +0 -53
  218. package/src/claude/skills/route/references/task-taxonomy.md +0 -48
  219. package/src/claude/skills/specs/templates/design.md +0 -82
  220. package/src/claude/skills/specs/templates/requirements-init.md +0 -8
  221. package/src/claude/skills/specs/templates/requirements.md +0 -42
  222. package/src/claude/skills/specs/templates/spec-state.json +0 -56
  223. package/src/claude/skills/specs/templates/task.md +0 -47
  224. package/src/codex/hooks/completion-authority-check.cjs +0 -67
  225. package/src/codex/hooks/completion-authority-state.cjs +0 -527
  226. package/src/codex/hooks/completion-authority.cjs +0 -109
  227. package/src/codex/hooks/semantic-review-authority.cjs +0 -130
  228. package/src/codex/hooks/task-scaffold-guard.cjs +0 -63
  229. /package/src/claude/skills/{question → ask}/templates/question.md +0 -0
  230. /package/src/claude/skills/{hotfix → fix}/references/escalation-tactics.md +0 -0
  231. /package/src/claude/skills/{hotfix → fix}/references/workflow-specialized.md +0 -0
@@ -12,83 +12,50 @@ metadata:
12
12
  ---
13
13
  # Code Review — correctness and compliance owner
14
14
 
15
- Review evaluates correctness, security, scope, architecture, and specification
16
- compliance. It does not execute the test suite, create a canonical execution
17
- receipt, or turn a missing test result into a review-owned proof. `cf:test`
18
- owns execution proof; the single closeout owner combines both results.
15
+ Review evaluates correctness, security, scope, architecture, and specification compliance. It does not execute the test suite, create a canonical execution receipt, or turn a missing test result into a review-owned proof. `cf:test` owns execution proof; the single closeout owner combines both results.
19
16
 
20
17
  ## Input and depth
21
18
 
22
- With no argument, review the pending diff. Supported targets are a PR, commit,
23
- pending changes, or an explicit path. Load only current target bytes and needed
24
- references. For a valid process-first target, read `plan.md`, the active flat
25
- `task-NN-*.md`, and the controller-validated `test-proof-v1` handoff. Mixed,
26
- orphaned, malformed, symlinked, nonregular, or identity-conflicting packet state
27
- is `BLOCKED`; review never migrates it.
19
+ With no argument, review the pending diff. Supported targets are a PR, commit, pending changes, or an explicit path. Load only current target bytes and needed references. For a valid process-first target, read `plan.md`, the active flat `task-NN-*.md`, and the controller-validated `test-proof-v1` handoff. Orphaned, malformed, symlinked, nonregular, or identity-conflicting packet state is `BLOCKED`; review never migrates it.
28
20
 
29
- For process-first proof consumption, this skill's `## Execution-proof boundary`
30
- is authoritative. Do not load or follow legacy separate-receipt paragraphs from
31
- references; they apply only after the Legacy route below is selected.
21
+ For proof consumption, this skill's `## Execution-proof boundary` is authoritative.
32
22
 
33
- Select review depth from `assurance_level`, risk, and blast radius. Lane is a
34
- derived view:
23
+ Select review depth from risk and blast radius: for a process-first task, its coverage-profile Risk/evidence. Lane is a derived view:
35
24
 
36
25
  - Direct: targeted correctness/security/spec check;
37
26
  - Standard: bounded feature review at closeout;
38
27
  - Critical: independent, adversarial review covering every required obligation.
39
28
 
40
- Do not use file count as the depth selector. `execution_tier` is a read-only
41
- legacy adapter and cannot choose a review sequence. The review contract has no
42
- fixed Light/Standard/Deep sequence.
29
+ Do not use file count as the depth selector. The review contract has no fixed Light/Standard/Deep sequence.
43
30
 
44
- ## Review stages
31
+ ## Standards
45
32
 
46
- ### 1. Specification compliance
33
+ **Specification compliance.** For process-first work, compare the diff with current plan scope and the active task's Outcome, Scope, Coverage, Ownership, Acceptance, Dependencies, Verification Plan, and declared runtime reachability. Identify missing behavior, unjustified extras, contract substitution, orphaned outputs, and incorrect completion claims. If a design image or document carries requirements, load its multimodal reference only when needed; do not guess from a filename.
47
34
 
48
- For process-first work, compare the diff with current plan scope and the active
49
- task's Outcome, Scope, Coverage, Ownership, Acceptance, Dependencies,
50
- Verification Plan, and declared runtime reachability. Identify missing behavior,
51
- unjustified extras, contract substitution, orphaned outputs, and incorrect
52
- completion claims. If a design image or document carries requirements, load its
53
- multimodal reference only when needed; do not guess from a filename.
35
+ **Correctness and security.** Trace changed entrypoints and callers. Check boundary validation, error paths, resource handling, race assumptions, secrets, authorization, persistence, and failure recovery in proportion to risk. Apply YAGNI/KISS/DRY as maintainability signals, not as a numeric score.
54
36
 
55
- ### 2. Correctness and security
37
+ **Adversarial checks.** Try empty, malformed, unauthorized, duplicate, stale, boundary, and concurrent inputs where the changed contract makes them relevant. For Critical obligations, review the required independent evidence and provenance. A marker such as `Audit: PASS` is not independent evidence.
56
38
 
57
- Trace changed entrypoints and callers. Check boundary validation, error paths,
58
- resource handling, race assumptions, secrets, authorization, persistence, and
59
- failure recovery in proportion to risk. Apply YAGNI/KISS/DRY as maintainability
60
- signals, not as a numeric score.
39
+ ## Test-run boundary
61
40
 
62
- ### 3. Adversarial checks
41
+ Review reads code; it does not run tests. Never run the project's test suite or a test file, not even as a sanity check. A read-only run of the reviewed code (for example `node -e` on the changed function) may reproduce a defect; cite it as a reproduction, never as test evidence. Never report a test result, pass count, or exit code as the review's evidence. Without a `test-proof-v1` handoff, write the proof line exactly as `**Execution proof:** unavailable (owned by cf:test)` and do not otherwise say whether tests pass; the review still returns its correctness verdict.
63
42
 
64
- Try empty, malformed, unauthorized, duplicate, stale, boundary, and concurrent
65
- inputs where the changed contract makes them relevant. For Critical obligations,
66
- review the required independent evidence and provenance. A marker such as
67
- `Audit: PASS` is not independent evidence.
43
+ ## Execution-proof boundary
68
44
 
69
- The independent-audit proof must be a durable object with exactly
70
- `schema_version: "1"`, distinct concrete `reviewer_session_id` and
71
- `implementation_session_id`, `expected_provenance: { base, head }` matching the
72
- runtime binding, concrete `evidence`, and literal `verdict: "PASS"`.
73
- `independent: true`, `PASS_WITH_WARNINGS`, missing binding, or reused session
74
- provenance is insufficient.
45
+ For process-first work, consume only the controller-validated `test-proof-v1` handoff. Require its exact closed schema, stable digest, current Base/Head, target task, exact command, exit/counts, raw output, reachability, proof level, artifacts, branches, and redactions. Unknown keys/verdicts, duplicate or missing branches, stale provenance, zero execution, required skips, unsafe redaction, or `PASS_WITH_WARNINGS` remain unfinished. Never create or search for a separate process-first receipt; Develop alone writes Status and inline `## Receipt` after proof and review are both literal `PASS`.
75
46
 
76
- ## Execution-proof boundary
47
+ Never rerun commands to manufacture proof. If execution proof is missing or invalid, write the proof line from the test-run boundary and leave closeout unfinished; do not claim feature PASS from review alone. A review may still return a correctness verdict when its review inputs are complete, but that verdict is not execution proof or GATE-DONE approval.
48
+
49
+ ## Severity
50
+
51
+ Rate each finding by its production impact. Write the labels `Critical`, `High`, `Medium`, and `Low` verbatim in English, whatever language the report uses.
77
52
 
78
- For process-first work, consume only the controller-validated `test-proof-v1`
79
- handoff. Require its exact closed schema, stable digest, current Base/Head,
80
- target task, exact command, exit/counts, raw output, reachability, proof level,
81
- artifacts, branches, and redactions. Unknown keys/verdicts, duplicate or missing
82
- branches, stale provenance, zero execution, required skips, unsafe redaction, or
83
- `PASS_WITH_WARNINGS` remain unfinished. Never create or search for a separate
84
- process-first receipt; Develop alone writes Status and inline `## Receipt` after
85
- proof and review are both literal `PASS`.
86
-
87
- Never rerun commands to manufacture proof. If execution proof is missing or
88
- invalid, say `execution proof unavailable` and leave closeout unfinished; do not
89
- claim feature PASS from review alone. A review may still return a correctness
90
- verdict when its review inputs are complete, but that verdict is not execution
91
- proof or C3 approval.
53
+ - Critical: a concrete failure a user or operator hits that loses or corrupts data, breaks security, or stops the product (a login bypass).
54
+ - High: a concrete wrong result a user or operator hits (an order exactly at a tier boundary priced with the wrong discount).
55
+ - Medium: a real risk with a failure scenario that has not reached users (a changed boundary with no test; a leftover debug log).
56
+ - Low: cleanup, clarity, or a question (a naming nit; a behavior the change's README or docs state as intended).
57
+
58
+ A leftover debug log is at most Medium; if it prints a secret or credential, report that exposure as a separate security finding at its own severity. A behavior the change's README or docs state as intended is not a Medium or heavier defect; raise it as Low or a question. Task and spec compliance findings are Critical only when a task or spec is supplied, and there `UNVERIFIED` means supplied proof that failed, never proof that is unavailable. A blocking Medium is one with a concrete failure before merge. A review whose heaviest remaining finding is a non-blocking Medium returns `PASS_WITH_WARNINGS`; one with only Low findings returns `PASS`.
92
59
 
93
60
  ## Verdict
94
61
 
@@ -96,15 +63,9 @@ Use the shared adapter surface exactly:
96
63
 
97
64
  `PASS | PASS_WITH_WARNINGS | FAIL | BLOCKED`
98
65
 
99
- Legacy adapter inputs may include `PASS | FAIL | BLOCKED`, but they are
100
- normalized to the shared surface and no second enum is allowed. `PASS` means no
101
- Critical/High correctness, security, or compliance finding. `PASS_WITH_WARNINGS`
102
- means only documented non-blocking findings remain. `FAIL` requires remediation;
103
- `PASS` also requires no blocking Medium finding. `PASS_WITH_WARNINGS` may carry
104
- documented non-blocking findings. Finding count never selects depth or overrides
105
- missing execution proof. A review `PASS_WITH_WARNINGS` remains an unfinished
106
- closeout result; only literal `PASS` can finish a task. `BLOCKED` means the review input or a user-owned
107
- decision is unavailable.
66
+ No second verdict enum is allowed. `PASS` means no Critical, High, or Medium finding remains; Low findings may remain. `PASS_WITH_WARNINGS` means the heaviest remaining finding is a non-blocking Medium. `FAIL` means a Critical, High, or blocking Medium finding requires remediation. Finding count never selects depth or overrides missing execution proof. A review `PASS_WITH_WARNINGS` remains an unfinished closeout result; only literal `PASS` can finish a task. `BLOCKED` means the review input or a user-owned decision is unavailable.
67
+
68
+ Copy the header line `# Code Review Results [cf:code-review]`, the field labels, and the severity labels verbatim in English; write the content in the user's language.
108
69
 
109
70
  ```markdown
110
71
  # Code Review Results [cf:code-review]
@@ -124,23 +85,10 @@ decision is unavailable.
124
85
  - Reachability/provenance review: PASS | WARN | FAIL
125
86
  ```
126
87
 
127
- Do not add a test command, a fabricated receipt, or an `Audit: PASS` marker to
128
- make the review look complete. Return unresolved questions at the end.
129
-
130
- ## Legacy workflow compatibility
131
-
132
- For a valid legacy packet only, retain its current spec/task resolution,
133
- separate `receipts/<task-basename>.md` fallback, feature receipt, persisted audit
134
- obligations, and legacy verdict normalization. If separate and embedded legacy
135
- proof identities conflict, fail closed. Never copy that adapter into a flat
136
- process-first packet.
88
+ Do not add a test command, a fabricated receipt, or an `Audit: PASS` marker to make the review look complete. Return unresolved questions at the end.
137
89
 
138
90
  ## References
139
91
 
140
- - `references/spec-compliance-review.md` — load only its detailed scope checks;
141
- its separate-receipt paragraph is Legacy-only.
92
+ - `references/spec-compliance-review.md` — load for its detailed scope checks.
142
93
  - `references/pre-landing-checklists.md` — load for the selected risk surface.
143
94
  - `references/adversarial-review.md` — load for Critical/adversarial depth.
144
- - `references/verification-gate.md` — Legacy separate-receipt consumption only;
145
- process-first proof uses this skill's execution-proof boundary. Execution
146
- always stays with `cf:test`.
@@ -24,16 +24,12 @@ Do not attempt a standard text-based review if the project includes Visual Specs
24
24
  - requirement bullets
25
25
  - task `Outcome`, `Scope`, `Anchors and Ownership`, `Changes`, `Acceptance`,
26
26
  `Dependencies`, and `Verification Plan`
27
- - typed `coordination.boundaries` as the only ownership/DAG/proof/parallel authority
28
- - task `Verification Plan`
29
- - canonical contracts/invariants from `design.md`
27
+ - the plan's acceptance criteria and coverage profile rows the task references
30
28
  Then verify the changed files against those concrete obligations.
31
29
 
32
- Execution proof is separate from the task plan. Consume
33
- `receipts/<task-basename>.md` first and legacy `## Evidence` only as fallback;
34
- conflicting proof identities fail closed. At final integration, consume
35
- `feature-receipt.md`. Review never creates either receipt and never treats a
36
- receipt as approval, readiness, audit status, or semantic judgment.
30
+ Execution proof is separate from the task plan and lives only in the task's
31
+ inline `## Receipt`. Review never creates a receipt and never treats a receipt as
32
+ approval, readiness, audit status, or semantic judgment.
37
33
 
38
34
  ## 3. Verdict Scale
39
35
 
@@ -16,164 +16,61 @@ Debugging is diagnosis, not repair. Find the source of the failure before changi
16
16
 
17
17
  ## Arguments
18
18
 
19
- - `--quick` - Abbreviated path for syntax, lint, type, or single-test failures with obvious local scope
20
- - `--ci` - Focus on CI/CD logs, runner environment, dependency versions, and pipeline setup
21
- - `--frontend` - Include browser console, screenshot, accessibility tree, network, and responsive checks
22
- - `--perf` - Include baseline measurements, bottleneck layer, profiling, and before/after targets
19
+ - `--quick` - obvious local syntax, lint, type, or single-test failure
20
+ - `--ci` - CI/CD logs, runner environment, dependency versions, pipeline setup
21
+ - `--frontend` - browser console, screenshot, accessibility tree, network, responsive checks
22
+ - `--perf` - baseline measurements, bottleneck layer, profiling, before/after targets
23
23
 
24
- Default: systematic diagnosis with no product-code edits, scout first.
24
+ Flags are optional hints. Without one, choose the depth yourself from the evidence below.
25
25
 
26
26
  ## Proportional depth
27
27
 
28
- - **Quick/local:** one deterministic syntax, lint, type, or isolated-test failure. Keep the six-step flow, but omit an incident timeline and recurrence analysis when they cannot change the diagnosis or handoff.
28
+ - **Quick/local:** one deterministic syntax, lint, type, or isolated-test failure.
29
+ - **Standard:** a reproducible failure inside one component or service that fits neither other depth.
29
30
  - **Incident/deep:** production impact, multiple components, intermittent behavior, data/security risk, environment drift, concurrency, or two refuted hypotheses. Add a cross-source timeline, explicit elimination path, trigger/root-cause/contributing-factor separation, and recurrence-prevention gaps.
30
31
 
31
- Depth changes evidence breadth, never the diagnostic-only gate or root-cause standard. Do not make a routine local failure perform incident ceremony merely because more tools are available.
32
+ Quick/local and Standard reports write the root-cause contract, the confirmed hypothesis, the verification plan, and the fix direction; when the root cause is unknown, they list every hypothesis tested instead. Only Incident/deep reports add `Evidence Timeline`, the other hypotheses tested, `### Elimination Path`, and `### Recurrence-Prevention Handoff`. A shorter report omits those sections; it does not write them as skipped.
33
+
34
+ Depth changes evidence breadth and report length, never the standards below, the diagnostic-only gate, or the root-cause standard. Do not make a routine local failure perform incident ceremony merely because more tools are available.
32
35
 
33
36
  <DIAGNOSTIC-ONLY-GATE>
34
37
  `cf:debug` is read-only for product code.
35
38
  Do NOT edit product code, apply fixes, create migrations, or add regression tests as implementation.
36
39
  Do NOT change config, dependency versions, generated assets, or test snapshots to make the failure disappear.
40
+ Do NOT run heavy or costly reads — table scans, bulk exports, load or stress runs — against shared staging or production without the user's explicit permission; prefer local or fixture data.
37
41
  Temporary instrumentation is allowed only when it is the minimal way to observe hidden state; record the file/line, capture the proof, remove it before finishing, and report `Temporary instrumentation: removed`.
38
42
  </DIAGNOSTIC-ONLY-GATE>
39
43
 
40
44
  <HARD-GATE-SCOUT-FIRST>
41
45
  Before hypotheses, inspect the actual codebase context.
42
- You must identify:
43
- - project type, language, framework, runtime, and test runner
44
- - affected files/modules and exact symptom location
45
- - direct callers, dependents, and data/config boundaries
46
- - related tests and reproduction commands
47
- - recent commits touching affected paths
48
- - adjacent known-good implementation patterns
49
-
46
+ You must identify the project type, language, framework, runtime, and test runner; the affected files/modules and exact symptom location; direct callers, dependents, and data/config boundaries; related tests and reproduction commands; recent commits touching affected paths; and adjacent known-good implementation patterns.
50
47
  After scout, provide a 3-6 bullet codebase-context summary before evidence capture.
51
48
  Do not ask generic questions before this step unless the issue cannot be located from the prompt or repository.
52
49
  </HARD-GATE-SCOUT-FIRST>
53
50
 
54
51
  <ROOT-CAUSE-GATE>
55
52
  Do NOT recommend a fix until the root-cause contract is complete.
56
- Do NOT stop at the first plausible explanation. Test hypotheses against evidence.
53
+ Do NOT stop at the first plausible explanation unless evidence directly confirms it. Test hypotheses against evidence.
57
54
  If 2+ hypotheses are refuted, change strategy before continuing.
58
55
  If evidence is insufficient, report `Root cause: unknown`, `Missing Evidence`, and `Next Diagnostic Action`; do not hand off to `cf:fix` as ready.
56
+ Report confidence `high` only when the cause was reproduced or observed at runtime — the failing command run, a log or probe read. From static reading alone, report at most `medium`.
59
57
  Answer each item in one concrete sentence.
60
58
  If any answer contains 'probably', 'I think', 'something with', or 'maybe' — it is not an answer; gather evidence instead.
61
59
  </ROOT-CAUSE-GATE>
62
60
 
63
- If the user asks to fix while still inside `cf:debug`, finish the debug report first. Then hand off only the completed root-cause contract to `cf:fix`.
64
-
65
- ## Process Flow
66
-
67
- ```mermaid
68
- flowchart TD
69
- A[Issue Input] --> B[Step 1: Scout via cf:scout]
70
- B --> C[Step 2: Capture Evidence]
71
- C --> D[Step 3: Pattern Analysis]
72
- D --> E[Step 4: Hypothesis Tests]
73
- E --> F[Step 5: Root Cause Trace]
74
- F --> G[Step 6: Verification + Prevention Handoff]
75
- G --> H[Diagnostic Report]
76
- H --> I{Fix requested?}
77
- I -->|Yes| J[Hand off to cf:fix]
78
- I -->|No| K[Stop after diagnosis]
79
- ```
80
-
81
- **This diagram is the authoritative workflow.** `cf:debug` stops at diagnosis unless the user explicitly asks to fix.
82
-
83
- ---
84
-
85
- ## Step 1: Scout
86
-
87
- Understand the affected code before forming hypotheses.
88
-
89
- **Action:** Activate `cf:scout` for the relevant scope.
90
- If `cf:scout` is unavailable, use direct read-only reconnaissance (`rg`, file reads, test discovery, and `git log`) and state that fallback.
91
-
92
- **Checklist:**
93
- - [ ] Project type, language, framework, runtime, and test runner identified
94
- - [ ] Affected files and modules identified
95
- - [ ] Direct dependencies and call paths mapped
96
- - [ ] Inputs/outputs, data boundaries, and config/env boundaries mapped
97
- - [ ] Related tests located
98
- - [ ] Recent changes checked: `git log --oneline -10 -- <affected-files>`
99
- - [ ] Existing working examples or adjacent patterns identified
100
-
101
- **Output:** `✓ Step 1: Scouted - [N] files, [M] deps, [K] tests` plus a 3-6 bullet context summary.
102
-
103
- ---
61
+ `cf:debug` stops at diagnosis unless the user explicitly asks to fix. If the user asks to fix while still inside `cf:debug`, finish the debug report first. Then hand off only the completed root-cause contract to `cf:fix`.
104
62
 
105
- ## Step 2: Capture Evidence
63
+ ## Standards
106
64
 
107
- Create a baseline that can later prove whether the issue changed.
65
+ **Scout.** Invoke the `scout` skill (`cf:scout`) for the affected scope and fold its findings into the codebase-context summary the scout-first gate requires, including `git log --oneline -10 -- <affected-files>`. If `cf:scout` is not installed, use direct read-only reconnaissance (`rg`, file reads, test discovery, and `git log`) and say so.
108
66
 
109
- **Capture:**
110
- - Exact command, URL, user flow, or trigger
111
- - Exact error message, stack trace, failing assertion, or visual symptom
112
- - Expected vs actual behavior
113
- - Relevant logs with timestamps
114
- - Environment facts: runtime, dependency versions, OS, browser, CI runner, config
115
- - Whether the issue reproduces consistently or intermittently
116
-
117
- For Incident/deep work, build an `Evidence Timeline` from timestamped facts across relevant sources. Normalize timezones, preserve request/trace/run IDs, and distinguish observed ordering from inferred causation. Quick/local work records `Timeline: skipped - local deterministic failure`.
118
-
119
- For frontend issues, use `.claude/references/debugger/frontend-verification.md`.
120
- For CI/log issues, use `.claude/references/debugger/log-ci-analysis.md`.
121
- For performance issues, use `.claude/references/debugger/performance-diagnostics.md`.
122
-
123
- **Output:** `✓ Step 2: Evidence captured - baseline command/symptom recorded`
124
-
125
- ---
126
-
127
- ## Step 3: Pattern Analysis
128
-
129
- Before proposing a cause, compare against known-good patterns.
130
-
131
- **Check:**
132
- - Similar implementation that works
133
- - Similar tests that pass
134
- - Recent code that changed the same contract
135
- - Config/env differences between passing and failing contexts
136
- - Dependency/API contract changes
137
-
138
- **Output:** `✓ Step 3: Patterns compared - [working reference] vs [failing path]`
139
-
140
- ---
67
+ **Evidence baseline.** Capture what can later prove whether the issue changed: the exact command, URL, user flow, or trigger; the exact error, stack trace, failing assertion, or visual symptom; expected vs actual behavior; relevant logs with timestamps; environment facts (runtime, dependency versions, OS, browser, CI runner, config); and whether it reproduces consistently or intermittently. For Incident/deep work, build an `Evidence Timeline` from timestamped facts across relevant sources. Normalize timezones, preserve request/trace/run IDs, and distinguish observed ordering from inferred causation. When no source carries timestamps, the timeline says so in one line and names the sources checked. For frontend issues, use `.claude/references/debugger/frontend-verification.md`; for CI/log issues, `.claude/references/debugger/log-ci-analysis.md`; for performance issues, `.claude/references/debugger/performance-diagnostics.md`.
141
68
 
142
- ## Step 4: Hypothesis Tests
69
+ **Known-good comparison.** Before proposing a cause, compare against known-good patterns: a similar implementation that works, similar tests that pass, recent code that changed the same contract, config/env differences between passing and failing contexts, and dependency/API contract changes.
143
70
 
144
- Create 2-3 competing hypotheses. Test one variable at a time.
71
+ **Hypotheses.** When evidence does not directly confirm the first explanation, create 2-3 competing hypotheses. Test one variable at a time, each stated as `Hypothesis:`, `Confirm if:` (evidence that proves it), `Refute if:` (evidence that disproves it), `Quick test:` (command/search/log/query), and `Result: confirmed | refuted | inconclusive`. Never batch unrelated changes as a test. Prefer read-only evidence: logs, grep, stack traces, DB queries, browser traces. For flaky async tests, use `.claude/references/debugger/condition-based-waiting.md`. If 2+ hypotheses are refuted, use inversion: ask what evidence would make the current explanation impossible. Preserve an elimination path: for every confirmed, refuted, or inconclusive hypothesis, cite the observation and explain why it changes the candidate set. Quick/local and Standard reports fold it into the confirmed hypothesis's evidence; only Incident/deep reports write it under `### Elimination Path`.
145
72
 
146
- ```text
147
- Hypothesis: [statement]
148
- Confirm if: [evidence that proves it]
149
- Refute if: [evidence that disproves it]
150
- Quick test: [command/search/log/query]
151
- Result: confirmed | refuted | inconclusive
152
- ```
153
-
154
- Rules:
155
- - Never batch unrelated changes as a test.
156
- - Prefer read-only evidence: logs, grep, stack traces, DB queries, browser traces.
157
- - For flaky async tests, use `.claude/references/debugger/condition-based-waiting.md`.
158
- - If 2+ hypotheses are refuted, use inversion: ask what evidence would make the current explanation impossible.
159
- - Preserve an elimination path: for every confirmed, refuted, or inconclusive hypothesis, cite the observation and explain why it changes the candidate set.
160
-
161
- **Output:** `✓ Step 4: Hypotheses tested - [confirmed/refuted counts]`
162
-
163
- ---
164
-
165
- ## Step 5: Root Cause Trace
166
-
167
- Trace backward from symptom to origin.
168
-
169
- ```text
170
- Symptom
171
- <- immediate cause
172
- <- contributing factor
173
- <- ROOT CAUSE
174
- ```
175
-
176
- **Exact root-cause contract:**
73
+ **Root cause.** Trace backward from the symptom through the immediate cause and contributing factors to the root cause, and complete the exact root-cause contract:
177
74
  - Symptom: exact observable failure
178
75
  - Reproduction: command/user flow/log trigger
179
76
  - Expected vs actual behavior
@@ -186,35 +83,18 @@ Symptom
186
83
 
187
84
  Do not collapse correlation into causation. The root cause must explain the mechanism from trigger to symptom and identify the earliest owned invariant whose correction would prevent recurrence. Read `.claude/references/debugger/root-cause-tracing.md` for deep call/data flow or test-pollution cases.
188
85
 
189
- **Output:** `✓ Step 5: Root cause traced - [file:line/config/env]`
190
-
191
- ---
192
-
193
- ## Step 6: Blast Radius + Verification And Prevention Plan
194
-
195
- Prepare the handoff to `cf:fix` or the user.
196
-
197
- **Verification plan must include:**
198
- - Original failing command or reproduction path
199
- - Targeted regression test or scenario
200
- - Affected-module tests
201
- - Typecheck/lint/build commands when relevant
202
- - UI screenshot/console/network checks when relevant
203
- - Side-effect sweep from `.claude/references/debugger/side-effect-gate.md`
204
-
205
- For Incident/deep work, add recurrence-prevention candidates: missing invariant or validation layer, observability/alerting gap, and one regression scenario. These are evidence-backed handoff directions only; `cf:debug` does not implement them.
206
-
207
- **Output:** `✓ Step 6: Verification planned - [commands/scenarios]`
208
-
209
- ---
86
+ **Verification and prevention plan.** Prepare the handoff to `cf:fix` or the user. Verification plan must include: the original failing command or reproduction path; a targeted regression test or scenario; affected-module tests; typecheck/lint/build commands when relevant; UI screenshot/console/network checks when relevant; and the side-effect sweep from `.claude/references/debugger/side-effect-gate.md`. For Incident/deep work, add recurrence-prevention candidates: missing invariant or validation layer, observability/alerting gap, and one regression scenario. These are evidence-backed handoff directions only; `cf:debug` does not implement them.
210
87
 
211
88
  ## Diagnostic Report Format
212
89
 
90
+ Open the final answer with `## Debug Report` in this shape, keeping only the sections its depth requires under Proportional depth. Write `Temporary Instrumentation` only when instrumentation was added, and `Missing Evidence` and `Next Diagnostic Action` only when the root cause is unknown.
91
+
213
92
  ```markdown
214
93
  ## Debug Report
215
94
 
216
95
  **Issue:** [one-line summary]
217
96
  **Mode:** quick | standard | ci | frontend | perf
97
+ **Depth:** quick/local | standard | incident/deep
218
98
  **Root cause confidence:** high | medium | low | unknown
219
99
 
220
100
  ### Root Cause Contract
@@ -229,12 +109,12 @@ For Incident/deep work, add recurrence-prevention candidates: missing invariant
229
109
  - Evidence chain:
230
110
  - Blast radius:
231
111
 
232
- ### Evidence Timeline
233
- - skipped: [reason] | [timestamp/source/id/event]
234
-
235
112
  ### Hypotheses Tested
236
113
  1. [confirmed/refuted/inconclusive] [hypothesis] - [evidence]
237
114
 
115
+ ### Evidence Timeline
116
+ - [timestamp/source/id/event]
117
+
238
118
  ### Elimination Path
239
119
  - [candidate removed or retained] - [decisive observation]
240
120
 
@@ -249,7 +129,7 @@ For Incident/deep work, add recurrence-prevention candidates: missing invariant
249
129
  - Regression scenario:
250
130
 
251
131
  ### Temporary Instrumentation
252
- - none | removed: [file:line, purpose, proof captured]
132
+ - removed: [file:line, purpose, proof captured]
253
133
 
254
134
  ### Recommended Fix Direction
255
135
  [Smallest root-cause fix, or "insufficient evidence"]
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: cf:develop
3
- description: "Implement an explicitly requested process-first feature or task, run its real verification, and close it with one evidence owner. Also supports existing legacy Specs packets."
3
+ description: "Implement an explicitly requested process-first feature or task, run its real verification, and close it with one evidence owner."
4
4
  user-invocable: true
5
5
  when_to_use: "Use to implement a ready feature packet, one named task, or a clear low-risk change."
6
6
  category: utilities
@@ -12,10 +12,7 @@ metadata:
12
12
  ---
13
13
  # Develop — implement, prove, synchronize
14
14
 
15
- Implement only the explicitly requested scope. For a process-first feature,
16
- `plan.md` and flat tasks are the durable packet; one closeout owner coordinates
17
- verification, review, sync, and docs impact without borrowing evidence.
18
- Develop never starts merely because Specs finished. The user invokes it.
15
+ Implement only the explicitly requested scope. For a process-first feature, `plan.md` and flat tasks are the durable packet; one closeout owner coordinates verification, review, sync, and docs impact without borrowing evidence. Develop never starts merely because Specs finished. The user invokes it.
19
16
 
20
17
  ## Usage and pre-state guard
21
18
 
@@ -28,8 +25,7 @@ Develop never starts merely because Specs finished. The user invokes it.
28
25
  /cf:develop <feature> --notes
29
26
  ```
30
27
 
31
- `--notes` is opt-in. Only then load `references/implementation-notes-template.html`;
32
- record decisions, scope exceptions, risks, gaps, and verification limits. Never create it by default.
28
+ `--notes` is opt-in. Only then load `references/implementation-notes-template.html`; record decisions, scope exceptions, risks, gaps, and verification limits. Never create it by default.
33
29
 
34
30
  Before any state mutation, reject `--flash` combined with `--parallel`:
35
31
 
@@ -41,31 +37,22 @@ The pair exits `2` before a task edit, receipt, worktree, subagent, or commit. D
41
37
 
42
38
  ## Resolve the work packet
43
39
 
44
- 1. Resolve one `specs/<feature>/plan.md` plus flat `task-NN-*.md`; an explicit task path wins.
45
- 2. Read C1 scope, exclusions, acceptance mapping, ownership, and task order.
46
- 3. A task is unblocked only when every named dependency is `done` with a valid current inline Receipt.
47
- 4. Without a packet, work directly only when the change is clear, isolated, reversible, and low-risk.
40
+ - Resolve one `specs/<feature>/plan.md` plus flat `task-NN-*.md`; an explicit task path wins.
41
+ - Read GATE-SCOPE scope, exclusions, acceptance mapping, ownership, and task order.
42
+ - A task is unblocked only when every named dependency is `done` with a valid current inline Receipt.
43
+ - Without a packet, work directly only when the change is clear, isolated, reversible, and low-risk.
48
44
 
49
45
  Ambiguity, overlapping ownership, a dependency cycle, or a missing Verification Plan is a blocker. Do not guess.
50
46
 
51
47
  ### Accepted process-first fast path
52
48
 
53
- When line two is `Specs-Contract: process-first-ready-v1`, reuse the accepted C1/C2.
54
- Perform only a narrow freshness scout for target revision, scope drift, ownership
55
- conflict, and dependency/state changes. Reopen C1 only for evidenced scope drift;
56
- do not research, replan, or add a routine user gate before a real blocker or C3.
57
- This is a source instruction contract, not a parser/runtime or live-model guarantee;
58
- live-model adherence is `[UNVERIFIED]` without a host invocation.
49
+ When line two is `Specs-Contract: process-first-ready-v1`, reuse the accepted GATE-SCOPE/GATE-REVIEW. Perform only a narrow freshness scout for target revision, scope drift, ownership conflict, and dependency/state changes. Reopen GATE-SCOPE only for evidenced scope drift; do not research, replan, or add a routine user gate before a real blocker or GATE-DONE. This is a source instruction contract, not a parser/runtime or live-model guarantee; live-model adherence is `[UNVERIFIED]` without a host invocation.
59
50
 
60
- Load the plan index into working context once. Later byte rereads are narrow drift
61
- checks; load only the active task's referenced coverage-profile rows, Outcome,
62
- Scope, Ownership, Acceptance, Dependencies, Verification Plan, owned code, and consumers.
51
+ Load the plan index into working context once. Later byte rereads are narrow drift checks; load only the active task's referenced coverage-profile rows, Outcome, Scope, Ownership, Steps, Acceptance, Dependencies, Verification Plan, Failure Protocol, owned code, and consumers.
63
52
 
64
53
  ## Current-byte selection
65
54
 
66
- Reread current plan/task bytes before each selection and controller write. Concurrent
67
- Develop invocations are unsupported; detected state, task, or owned-path drift stops
68
- before any Status or Receipt write.
55
+ Reread current plan/task bytes before each selection and controller write. Concurrent Develop invocations are unsupported; detected state, task, or owned-path drift stops before any Status or Receipt write.
69
56
 
70
57
  | Current bytes | Feature mode | Explicit task mode |
71
58
  |---|---|---|
@@ -77,89 +64,54 @@ before any Status or Receipt write.
77
64
  | No task is active | Select the first dependency-valid `pending` row in `plan.md` order. | Start only the exact pending target when dependencies are valid. |
78
65
  | Status is missing, duplicate, or unknown | Stop as malformed state. | Stop as malformed state. |
79
66
 
80
- Feature mode repeats this selection only after the current task closes. Specific-task
81
- mode never touches a sibling and returns after its successful sync without chaining or C3.
67
+ Feature mode repeats this selection only after the current task closes. Specific-task mode never touches a sibling and returns after its successful sync without chaining or GATE-DONE.
82
68
 
83
69
  ## Modes
84
70
 
85
71
  ### Sequential feature or specific task
86
72
 
87
- The controller sets the selected task's single `Status:` to `in_progress`.
88
- Implement its Outcome and Acceptance only. Keep one unblocked task at a time;
89
- never start the next before proof, review, and sync finish for the current task.
73
+ The controller sets the selected task's single `Status:` to `in_progress`. Implement its Outcome and Acceptance only. Keep one unblocked task at a time; never start the next before proof, review, and sync finish for the current task.
90
74
 
91
75
  ### Parallel (`--parallel [N]`)
92
76
 
93
- Load `references/parallel-waves.md`. Require disjoint writes, satisfied dependencies,
94
- isolated worktrees, a bounded wave, and one controller writer; otherwise work sequentially.
77
+ Load `references/parallel-waves.md`. Require disjoint writes, satisfied dependencies, isolated worktrees, a bounded wave, and one controller writer; otherwise work sequentially.
95
78
 
96
79
  ### Flash (`--flash`)
97
80
 
98
- Flash is an explicit speed trade-off, never completion:
99
-
100
- - run only an available cheap syntax, typecheck, or compile preflight;
101
- - skip dedicated tests, extended manual checks, and review retry loops;
102
- - keep `Status: in_progress` and record `FLASH_UNVERIFIED` plus blocker
103
- `awaiting /cf:test <feature>`;
104
- - do not unblock dependents or report Test PASS, Evidence PASS, production-ready, or done;
105
- - stop this invocation without chaining.
106
-
107
- Only a later explicit non-Flash invocation may recover the task. It treats Flash
108
- output as ephemeral, inspects current bytes and the owned diff, and obtains fresh
109
- canonical proof through the trusted sync-finalize path. Never weaken, delete, or
110
- rewrite tests to make Flash look complete.
81
+ Load `references/quality-gate.md`. Flash is an explicit speed trade-off, never completion: run a cheap preflight, skip dedicated tests, keep `Status: in_progress` with `FLASH_UNVERIFIED` and the blocker `awaiting /cf:test <feature>`, do not unblock dependents or report PASS, and stop this invocation without chaining. Only a later explicit non-Flash invocation may recover the task. It treats Flash output as ephemeral, inspects current bytes and the owned diff, and obtains fresh canonical proof through the trusted sync-finalize path. Never weaken, delete, or rewrite tests to make Flash look complete.
111
82
 
112
83
  ## Task cycle
113
84
 
114
85
  ### 1. Scout
115
86
 
116
- Trace entrypoints, callers, dependents, registration, errors, and owned files.
117
- Compilation does not prove an unmounted UI, unregistered route, uncalled service,
118
- or missing consumer.
87
+ Trace entrypoints, callers, dependents, registration, errors, and owned files. Read the test or probe that will judge this task before implementing against it. Compilation does not prove an unmounted UI, unregistered route, uncalled service, or missing consumer.
119
88
 
120
- For an interrupted `in_progress` task, preserve and inspect current owned changes;
121
- discard ephemeral, remembered, or prior-attempt proof; compare unmet Acceptance
122
- against current task bytes and owned diff. Do not blindly replay a non-idempotent
123
- mutation. Resume only unmet work, then run fresh verification.
89
+ For an interrupted `in_progress` task, preserve and inspect current owned changes; discard ephemeral, remembered, or prior-attempt proof; compare unmet Acceptance against current task bytes and owned diff. Do not blindly replay a non-idempotent mutation. Resume only unmet work, then run fresh verification.
124
90
 
125
91
  ### 2. Implement
126
92
 
127
- Honor Scope, Ownership, Acceptance, and Dependencies. Do not silently replace named contracts;
128
- scope expansion requires evidence and a return to C1, not implementation convenience.
129
- Load `references/subagent-patterns.md` when dispatch helps; only the controller writes Status or Receipt.
93
+ Unless under `--flash` or the command costs money or writes artifacts, run the task's exact Verification Plan command once before changing anything and expect it to fail; this pre-change run is not a repair round.
94
+ Passing before any change, outside a resumed task, means the plan cannot judge the work and is a blocker; so is a failure naming something other than the unmet Acceptance, which is a blocker to raise, not a defect to work around while implementing. A failure from the command itself — a wrong path, a missing tool or module, the environment — is BLOCKED, not FAIL, even when the runner reports `not ok` and even when the Acceptance or a test file shows the right command: set the task's single `Status:` to `blocked` with a `Blocker:` line naming the command and its error, write no Receipt, revert any edit made in this run, and report; you may suggest a corrected command for the plan, but never run it as proof.
95
+
96
+ Honor Scope, Ownership, Acceptance, and Dependencies. Do not silently replace named contracts; scope expansion requires evidence and a return to GATE-SCOPE, not implementation convenience. Load `references/subagent-patterns.md` when dispatch helps; only the controller writes Status or Receipt.
130
97
 
131
98
  ### 3. Verify, review, and close
132
99
 
133
- The test owner executes each exact Verification Plan and records real output. The
134
- review owner evaluates correctness, security, scope, and reachability without
135
- manufacturing proof. Use `PASS | PASS_WITH_WARNINGS | FAIL | BLOCKED`; only literal PASS can close.
100
+ The test owner executes each exact Verification Plan and records real output. The review owner evaluates correctness, security, scope, and reachability without manufacturing proof. Use `PASS | PASS_WITH_WARNINGS | FAIL | BLOCKED`; only literal PASS can close.
136
101
 
137
- Load `references/quality-gate.md`. Remediate an observed failure, then rerun only
138
- affected proof/review. Do not blind-retry a blocked environment. After three failed
139
- repair rounds, stop and ask the user.
102
+ Load `references/quality-gate.md`. Remediate an observed failure (a blocked Command is not a failure to remediate), then rerun only affected proof/review. Do not blind-retry a blocked environment. One repair round is one observed failure plus its repair and rerun, from proof or from review alike. After three failed repair rounds, stop and ask the user.
140
103
 
141
- After a real pass, the controller writes the task's final inline `## Receipt` with
142
- `Verification: PASS`, exact `Command`, `Exit: 0`, runtime-derived `Base:` and `Head:`,
143
- non-empty current output, and required negative/reachability/artifact proof; then it
144
- sets `Status: done` and only implemented checkboxes. Missing, stale, contradictory,
145
- zero-test, placeholder, marker-only, skipped, or remembered proof is unfinished.
104
+ **The Receipt is written last, after proof and review have both passed**; writing it earlier and reopening the task is a defect, not a shortcut. After a real pass, the controller writes the task's final inline `## Receipt` with `Verification: PASS`, exact `Command`, `Exit: 0`, `Base:` and `Head:` copied from the `Base` and `Head` fields of `node .claude/scripts/provenance.cjs --project-root . --specs-root specs --spec-file <task file> --feature-name <feature> --session <any label> --json` run after the last change outside the specs root (never typed or computed by hand), non-empty current output in a fenced block, and required negative/reachability/artifact proof; then it sets `Status: done` and only implemented checkboxes. Missing, stale, contradictory, zero-test, placeholder, marker-only, skipped, or remembered proof is unfinished.
146
105
 
147
106
  ### 4. Finish the requested boundary
148
107
 
149
- Reread the task after sync and recompute the queue from current bytes. Specific-task
150
- mode has already returned. Full-feature mode continues one task at a time, then runs
151
- the named feature-level integration and reachability checks. Before C3, apply the
152
- quality-gate final-Head fixed point; show current evidence and limitations, and let
153
- the user decide completion.
108
+ Reread the task after sync and recompute the queue from current bytes. Specific-task mode has already returned. Full-feature mode continues one task at a time, then runs the named feature-level integration and reachability checks. Before GATE-DONE, apply the quality-gate final-Head fixed point; show current evidence and limitations, and let the user decide completion.
154
109
 
155
- Evaluate docs impact from behavior actually changed: `none` means report only;
156
- `minor` or `major` updates only affected existing docs through the docs flow.
110
+ Evaluate docs impact from behavior actually changed: `none` means report only; `minor` or `major` updates only affected existing docs through the docs flow.
157
111
 
158
112
  ## Definition of done
159
113
 
160
- Done requires satisfied acceptance, reachable behavior, current executable proof,
161
- stable Base/Head binding, resolved blocking review findings, and no scope substitution.
162
- `PASS_WITH_WARNINGS`, `NO_TESTS`, `FLASH_UNVERIFIED`, or review-only pass cannot close.
114
+ Done requires satisfied acceptance, reachable behavior, current executable proof, stable Base/Head binding, resolved blocking review findings, and no scope substitution. `PASS_WITH_WARNINGS`, `NO_TESTS`, `FLASH_UNVERIFIED`, or review-only pass cannot close.
163
115
 
164
116
  ## Attached references
165
117
 
@@ -167,12 +119,3 @@ stable Base/Head binding, resolved blocking review findings, and no scope substi
167
119
  - `references/parallel-waves.md` — opt-in isolated worktree waves.
168
120
  - `references/subagent-patterns.md` — task-local briefs and controller-only handoff.
169
121
  - `references/implementation-notes-template.html` — only with `--notes`.
170
-
171
- ## Legacy workflow compatibility
172
-
173
- If the selected feature contains `spec.json`, use its persisted `workflow_policy`,
174
- `task_registry`, nested task paths, typed boundaries, separate task receipts, and
175
- feature closeout receipt exactly as legacy adapters require. Preserve `planning_depth`,
176
- `assurance_level`, derived lane, and read-only `execution_tier`; do not project these
177
- fields into a new v3 packet. Keep JSON and Markdown status synchronized, and use the
178
- existing completion-authority path for final closeout.