@haposoft/cafekit 0.16.0-rc.3 → 0.16.0-rc.4

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 (91) hide show
  1. package/bin/__tests__/codex-hooks.test.js +444 -14
  2. package/bin/__tests__/codex-native.test.js +228 -7
  3. package/bin/__tests__/develop-contract.test.js +615 -185
  4. package/bin/__tests__/installer-safety.test.js +39 -0
  5. package/bin/__tests__/opencode-spec-gate.test.js +24 -16
  6. package/bin/__tests__/package-inventory.test.js +687 -13
  7. package/bin/__tests__/specs-v2-execution-closeout.test.js +421 -0
  8. package/bin/__tests__/specs-v2-policy-and-scaffold.test.js +601 -0
  9. package/bin/__tests__/specs-v2-validator-grounder-contract.test.js +952 -0
  10. package/bin/__tests__/test-runtime-dependency-closure.cjs +182 -0
  11. package/bin/__tests__/validator-grounding.test.js +1914 -221
  12. package/bin/lib/managed-writer.js +12 -3
  13. package/bin/phases/codex-runtime.js +17 -1
  14. package/package.json +1 -1
  15. package/src/claude/CLAUDE.md +6 -0
  16. package/src/claude/agents/code-auditor.md +20 -0
  17. package/src/claude/agents/spec-maker.md +143 -99
  18. package/src/claude/hooks/__tests__/completion-authority.test.js +291 -58
  19. package/src/claude/hooks/__tests__/privacy-block.test.js +172 -0
  20. package/src/claude/hooks/__tests__/semantic-review-authority.test.js +257 -0
  21. package/src/claude/hooks/__tests__/spec-gate.test.js +115 -40
  22. package/src/claude/hooks/completion-authority-check.cjs +37 -288
  23. package/src/claude/hooks/completion-authority-state.cjs +10 -8
  24. package/src/claude/hooks/completion-authority.cjs +13 -7
  25. package/src/claude/hooks/docs-sync.cjs +5 -2
  26. package/src/claude/hooks/lib/privacy-command-analysis.cjs +393 -0
  27. package/src/claude/hooks/lib/runtime-path-safety.cjs +119 -0
  28. package/src/claude/hooks/privacy-block.cjs +77 -30
  29. package/src/claude/hooks/semantic-review-authority.cjs +152 -0
  30. package/src/claude/hooks/spec-gate.cjs +47 -117
  31. package/src/claude/hooks/spec-state.cjs +8 -2
  32. package/src/claude/migration-manifest.json +9 -1
  33. package/src/claude/rules/state-sync.md +52 -21
  34. package/src/claude/rules/workflow.md +17 -9
  35. package/src/claude/scripts/spec-final-state.cjs +244 -0
  36. package/src/claude/scripts/spec-ground.cjs +535 -173
  37. package/src/claude/scripts/spec-readiness.cjs +118 -0
  38. package/src/claude/scripts/spec-receipt.cjs +162 -0
  39. package/src/claude/scripts/spec-resolver.cjs +67 -16
  40. package/src/claude/scripts/spec-scaffold.cjs +1354 -139
  41. package/src/claude/scripts/spec-semantic-model.cjs +396 -0
  42. package/src/claude/scripts/validate-spec-output.cjs +2782 -142
  43. package/src/claude/scripts/workflow-policy.cjs +501 -183
  44. package/src/claude/settings/settings.json +4 -0
  45. package/src/claude/skills/code-review/SKILL.md +12 -3
  46. package/src/claude/skills/code-review/references/spec-compliance-review.md +10 -2
  47. package/src/claude/skills/code-review/references/verification-gate.md +13 -0
  48. package/src/claude/skills/develop/SKILL.md +47 -60
  49. package/src/claude/skills/develop/references/parallel-waves.md +9 -6
  50. package/src/claude/skills/develop/references/quality-gate.md +19 -12
  51. package/src/claude/skills/specs/SKILL.md +183 -177
  52. package/src/claude/skills/specs/references/ask-user-question-gates.md +27 -18
  53. package/src/claude/skills/specs/references/cross-spec-dependency.md +8 -4
  54. package/src/claude/skills/specs/references/research-strategy.md +4 -1
  55. package/src/claude/skills/specs/references/review.md +200 -260
  56. package/src/claude/skills/specs/references/scope-inquiry.md +18 -5
  57. package/src/claude/skills/specs/rules/design-discovery-full.md +33 -81
  58. package/src/claude/skills/specs/rules/design-discovery-light.md +21 -42
  59. package/src/claude/skills/specs/rules/design-principles.md +136 -180
  60. package/src/claude/skills/specs/rules/design-review.md +42 -97
  61. package/src/claude/skills/specs/rules/ears-format.md +42 -50
  62. package/src/claude/skills/specs/rules/phase-decision-matrix.md +42 -41
  63. package/src/claude/skills/specs/rules/task-scoring-rubric.md +2 -1
  64. package/src/claude/skills/specs/rules/tasks-generation.md +189 -300
  65. package/src/claude/skills/specs/templates/design.md +49 -263
  66. package/src/claude/skills/specs/templates/requirements.md +26 -36
  67. package/src/claude/skills/specs/templates/research.md +9 -98
  68. package/src/claude/skills/specs/templates/spec-state.json +23 -85
  69. package/src/claude/skills/specs/templates/task.md +30 -102
  70. package/src/claude/skills/sync/SKILL.md +33 -10
  71. package/src/claude/skills/sync/references/sync-protocols.md +31 -13
  72. package/src/claude/skills/test/SKILL.md +17 -7
  73. package/src/codex/AGENTS.md +6 -0
  74. package/src/codex/hooks/completion-authority-check.cjs +43 -240
  75. package/src/codex/hooks/completion-authority-state.cjs +10 -8
  76. package/src/codex/hooks/completion-authority.cjs +13 -7
  77. package/src/codex/hooks/lib/hook-context.cjs +16 -2
  78. package/src/codex/hooks/lib/privacy-command-analysis.cjs +3 -0
  79. package/src/codex/hooks/lib/privacy-state.cjs +38 -16
  80. package/src/codex/hooks/lib/runtime-path-safety.cjs +3 -0
  81. package/src/codex/hooks/lib/spec-receipt.cjs +72 -134
  82. package/src/codex/hooks/lib/spec-utils.cjs +56 -5
  83. package/src/codex/hooks/privacy-approval.cjs +1 -1
  84. package/src/codex/hooks/privacy-block.cjs +67 -11
  85. package/src/codex/hooks/semantic-review-authority.cjs +130 -0
  86. package/src/codex/hooks/spec-gate.cjs +49 -34
  87. package/src/codex/hooks/spec-state.cjs +10 -3
  88. package/src/codex/hooks/state.cjs +2 -0
  89. package/src/codex/hooks.json +6 -1
  90. package/src/codex/rules/state-sync.md +47 -27
  91. package/src/common/AGENTS.md +1 -1
@@ -124,6 +124,10 @@
124
124
  "SubagentStop": [
125
125
  {
126
126
  "hooks": [
127
+ {
128
+ "type": "command",
129
+ "command": "node \"$CLAUDE_PROJECT_DIR/.claude/hooks/semantic-review-authority.cjs\""
130
+ },
127
131
  {
128
132
  "type": "command",
129
133
  "command": "node \"$CLAUDE_PROJECT_DIR/.claude/hooks/state.cjs\""
@@ -23,7 +23,8 @@ With no argument, review the pending diff. Supported targets are a PR, commit,
23
23
  pending changes, or an explicit path. Load only the spec and references needed
24
24
  for the target.
25
25
 
26
- Select review depth from the persisted lane, risk, and blast radius:
26
+ Select review depth from `assurance_level`, risk, and blast radius. Lane is a
27
+ derived view:
27
28
 
28
29
  - Direct: targeted correctness/security/spec check;
29
30
  - Standard: bounded feature review at closeout;
@@ -38,7 +39,9 @@ fixed Light/Standard/Deep sequence.
38
39
  ### 1. Specification compliance
39
40
 
40
41
  Compare the diff with `scope_lock`, requirements, design contracts, active task
41
- criteria, and declared runtime reachability. Identify missing behavior,
42
+ Outcome/Scope/Anchors and Ownership/Changes/Acceptance/Dependencies/
43
+ `Verification Plan`, typed `coordination.boundaries`, and declared
44
+ runtime reachability. Identify missing behavior,
42
45
  unjustified extras, contract substitution, orphaned outputs, and incorrect
43
46
  completion claims. If a design image or document carries requirements, load its
44
47
  multimodal reference only when needed; do not guess from a filename.
@@ -73,6 +76,12 @@ closeout to the test owner; do not claim PASS on the feature from review alone.
73
76
  A review can still return a correctness verdict when its review inputs are
74
77
  complete.
75
78
 
79
+ For new tasks, read proof from `receipts/<task-basename>.md`; use legacy task
80
+ `## Evidence` only as fallback. If both exist and their proof identities
81
+ conflict, fail closed. At feature closeout also consume `feature-receipt.md`.
82
+ Receipt validity never supplies approval, readiness, audit status, or product
83
+ semantics.
84
+
76
85
  ## Verdict
77
86
 
78
87
  Use the shared adapter surface exactly:
@@ -94,7 +103,7 @@ decision is unavailable.
94
103
 
95
104
  **Verdict:** PASS | PASS_WITH_WARNINGS | FAIL | BLOCKED
96
105
  **Target:** [PR | Commit | Path]
97
- **Lane / risk:** [snapshot and relevant signals]
106
+ **Assurance / risk:** [canonical policy input and relevant signals]
98
107
  **Execution proof:** consumed | unavailable (owned by hapo:test)
99
108
 
100
109
  ## Findings
@@ -23,11 +23,19 @@ Do not attempt a standard text-based review if the project includes Visual Specs
23
23
  - *Prompt:* "Hey `hapo:ai-multimodal`, please look at this design mockup/document and compare it with the layout/logic described in this Code. Are there any discrepancies?"
24
24
  3. If NO (Markdown Spec only): Read the spec directly and extract:
25
25
  - requirement bullets
26
- - task `Completion Criteria`
27
- - task `## Evidence` (legacy heading aliases still parse)
26
+ - task `Outcome`, `Scope`, `Anchors and Ownership`, `Changes`, `Acceptance`,
27
+ `Dependencies`, and `Verification Plan`
28
+ - typed `coordination.boundaries` as the only ownership/DAG/proof/parallel authority
29
+ - task `Verification Plan`
28
30
  - canonical contracts/invariants from `design.md`
29
31
  Then verify the changed files against those concrete obligations.
30
32
 
33
+ Execution proof is separate from the task plan. Consume
34
+ `receipts/<task-basename>.md` first and legacy `## Evidence` only as fallback;
35
+ conflicting proof identities fail closed. At final integration, consume
36
+ `feature-receipt.md`. Review never creates either receipt and never treats a
37
+ receipt as approval, readiness, audit status, or semantic judgment.
38
+
31
39
  ## 3. Verdict Scale
32
40
 
33
41
  Each Requirement in the Spec must return 1 of 3 states:
@@ -27,6 +27,19 @@ To clear the Verification Gate, you must cite one of the following concrete proo
27
27
  - **Linter Completion:** Output proving no syntax errors exist.
28
28
  - **Multimodal Visual Evidence:** `hapo:ai-multimodal` confirming that the visual rendering perfectly matches the design layout.
29
29
 
30
+ For Specs v2, accepted proof must be persisted by the test owner at
31
+ `receipts/<task-basename>.md`; legacy `## Evidence` remains fallback-only. The
32
+ receipt includes identity/path, exact command, exit/result, expected versus
33
+ observed behavior, applicable negative/reachability/artifact proof, and bound
34
+ Base/Head. Final integration uses `feature-receipt.md`. Missing final receipt is
35
+ normal before closeout, but mandatory at closeout. Neither receipt grants
36
+ approval, readiness, audit status, or product semantics.
37
+
38
+ For v2.1, the semantic receipt is reviewed input, not execution proof. It binds
39
+ exact criteria and counterexamples shaped as `criterion`, `case_kind`,
40
+ `scenario`, `expected`, `decision_refs`, and `verification_ref`. Deterministic
41
+ validator success is never a semantic-review verdict.
42
+
30
43
  ## 4. How to Handle Missing Proof
31
44
  If you are asked to review a PR or commit and no execution proof is available:
32
45
  1. **Return `BLOCKED`** and name missing commands, artifacts, permissions, or environment access.
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: hapo:develop
3
- description: "Implement an approved or explicitly low-risk change with lane-proportional evidence and one closeout owner."
3
+ description: "Implement an explicitly invoked ready or low-risk change with policy-proportional evidence and one closeout owner."
4
4
  user-invocable: true
5
5
  when_to_use: "Use to implement a ready spec, a specific task, or a Direct low-risk change."
6
6
  category: utilities
@@ -12,9 +12,12 @@ metadata:
12
12
  ---
13
13
  # Develop — implementation and closeout contract
14
14
 
15
- Implement the requested scope, then close it with one canonical execution owner. Keep the lane, not a legacy tier or fixed actor sequence, as authority.
16
-
17
- The executable policy source is `src/claude/scripts/workflow-policy.cjs`; the persisted workflow-policy snapshot is the contract (installed as `.claude/scripts/workflow-policy.cjs`). It owns `workflow_policy`, escalation, approvals, verdict adaptation, receipt validation, and flash promotion.
15
+ Implement the requested scope, then close it with one canonical execution owner.
16
+ For a durable spec, `spec.json` is machine authority and Markdown is a human
17
+ projection. The v2.1 policy snapshot persists minimum input; lane, label,
18
+ artifact profile, and ceremony are derived views. The executable policy source
19
+ is `src/claude/scripts/workflow-policy.cjs` (installed as
20
+ `.claude/scripts/workflow-policy.cjs`).
18
21
 
19
22
  ## Usage and pre-state guard
20
23
 
@@ -43,7 +46,12 @@ Remediation: run `/hapo:develop <feature> --flash` or `/hapo:develop <feature> -
43
46
  No spec state, task receipt, worktree, subagent, or commit was created.
44
47
  ```
45
48
 
46
- ## Lane authority
49
+ ## Policy authority
50
+
51
+ For durable specs, persisted `workflow_policy` authority is the v2.1 minimum.
52
+ Canonical authoring supplies `planning_depth`, `assurance_level`,
53
+ `classified_minimum`, and normalized `risks`; lane and ceremony remain derived
54
+ views.
47
55
 
48
56
  Classify before spec/state mutation:
49
57
 
@@ -51,45 +59,35 @@ Classify before spec/state mutation:
51
59
  node .claude/scripts/workflow-policy.cjs --classify-lane --task-json '<task JSON>' --json
52
60
  ```
53
61
 
54
- - **Direct**: clear, isolated, reversible, low-risk. Skip spec/state/registry
55
- ceremony and run targeted verification with proportional evidence.
56
- - **Standard**: use the bounded spec profile and focused inspection. A small
57
- feature need not have a task registry or task bundle. Close once at the
58
- feature boundary.
59
- - **Critical**: require the approved strict profile. Add durable task state,
60
- registry/DAG, research, or independent audit only when the persisted
61
- `proof_obligations` require each one.
62
+ - **Direct**: clear, isolated, reversible, low-risk. Skip spec/state/registry ceremony and run targeted verification with proportional evidence.
63
+ - **Standard**: use the bounded spec profile and focused inspection. A small feature needs no task registry/bundle and closes once at the feature boundary.
64
+ - **Critical**: derived Strict view. Add durable task state, research, or review
65
+ only when actual topology, uncertainty, or assurance requires it.
66
+
67
+ Risk can raise the classified minimum. Reclassify before persistence. After
68
+ persistence, a per-feature baseline is monotonic and no downgrade is supported
69
+ until a trusted issuer exists; the baseline applies only to that feature.
70
+ Legacy approval fields and caller booleans have zero authority.
62
71
 
63
- Risk can escalate but cannot downgrade the persisted lane. A downgrade without a
64
- trusted runtime-issued receipt is blocked; `user_approved` requires explicit user
65
- approval, and `userAuthorized` plus similar booleans are not authorization.
72
+ Develop starts only from the user's explicit Develop invocation. Technical
73
+ `ready_for_implementation` never dispatches Develop, and Specs must never
74
+ auto-chain into this workflow.
66
75
 
67
- `execution_tier` (`Light | Standard | Deep`) is a read-only legacy adapter
68
- (`Direct | Standard | Critical`). It cannot emit policy, create obligations,
69
- select a workflow, or override the lane. Do not branch on it for new behavior.
76
+ `execution_tier` (`Light | Standard | Deep`) is a read-only legacy adapter (`Direct | Standard | Critical`). It cannot emit policy, create obligations, select a workflow, or override the lane. Do not branch on it for new behavior.
70
77
 
71
78
  ## Modes
72
79
 
73
80
  ### Specific task
74
81
 
75
- Load exactly one task packet, implement only its scope, run its evidence, and
76
- stop after synchronization. Specific-task mode never selects or chains into the
77
- next task, even when another task is pending.
82
+ Load exactly one task packet, implement only its scope, run its evidence, and stop after synchronization. Specific-task mode never selects or chains into another pending task.
78
83
 
79
84
  ### Full feature
80
85
 
81
- For a task-bearing policy, resolve one unblocked task at a time, complete its
82
- cycle, synchronize, and recompute the queue. A bounded Standard feature without
83
- tasks runs one feature-level cycle. Stop on the first unresolved block or
84
- missing proof. Run a final integration check only when the feature has no more
85
- pending tasks.
86
+ For a task-bearing policy, resolve one unblocked task at a time, complete its cycle, synchronize, and recompute the queue. A bounded Standard feature without tasks runs one feature-level cycle. Stop on the first unresolved block or missing proof; run final integration only after all pending tasks finish.
86
87
 
87
88
  ### Parallel (opt-in)
88
89
 
89
- Load `references/parallel-waves.md` only when `--parallel` is present. It may
90
- use isolated worktrees and a bounded wave, but lane obligations, single-writer
91
- rules, immutable provenance, and the final integration check remain in force.
92
- Without `--parallel`, process one unblocked task at a time.
90
+ Load `references/parallel-waves.md` only with `--parallel`. It may use isolated worktrees and a bounded wave, but lane obligations, single-writer rules, immutable provenance, and final integration remain in force. Otherwise process one unblocked task at a time.
93
91
 
94
92
  ### 3. Flash Mode (`--flash`)
95
93
  Flash is an explicit speed trade-off, not a completion shortcut:
@@ -104,12 +102,7 @@ Flash is an explicit speed trade-off, not a completion shortcut:
104
102
  - never claim `Test PASS`, `Evidence PASS`, `Auto-Approved`, or
105
103
  `production-ready`.
106
104
 
107
- Only trusted sync-finalize may promote a flash task. It must receive the current
108
- `FLASH_UNVERIFIED` task plus explicit `--verdict PASS` and a canonical proof;
109
- caller-supplied promotion fields are ignored/rejected. A marker-only proof
110
- never promotes or finalizes. Stored state keeps `in_progress`,
111
- `FLASH_UNVERIFIED`, `dependencyBlocked: true`, `unblocks: false`, and a concrete
112
- blocker, omits promotion fields, and binds proof to expected Base/Head anchors.
105
+ Only trusted sync-finalize may promote a current `FLASH_UNVERIFIED` task with explicit `--verdict PASS` and canonical proof; caller promotion fields are ignored/rejected, and marker-only proof never promotes. Stored state remains `in_progress`/`FLASH_UNVERIFIED`, dependency-blocked with a concrete blocker, omits promotion fields, and binds proof to expected Base/Head anchors.
113
106
  ## Workflow
114
107
  `Classify lane → load lane artifacts → scout obligations → implement current
115
108
  scope → one closeout owner → test receipt → review → docs-impact sync.`
@@ -117,46 +110,46 @@ scope → one closeout owner → test receipt → review → docs-impact sync.`
117
110
  ### Step 1 — Load and scope
118
111
 
119
112
  - Direct does not create a spec, state, registry, task bundle, or notes file.
120
- - Standard requires its bounded artifacts and explicit approval, but not a
113
+ - Standard requires its bounded validated artifacts, but not a
121
114
  registry when the scope is small and no task obligation is persisted.
122
115
  - Critical requires only the artifacts named by its snapshot obligations.
123
116
  - For task-bearing work, load one requested task or one unblocked task and
124
- extract scope, requirements, contracts, completion criteria, and exact
125
- evidence commands.
117
+ extract the exact seven v2.1 sections: `Outcome`, `Scope`, `Anchors and Ownership`,
118
+ `Changes`, `Acceptance`, `Dependencies`, and `Verification Plan`.
119
+ Use typed `coordination.boundaries` for ownership/DAG/proof/parallel authority.
120
+ - Before implementation, transition `pending` to `in_progress` in task Markdown `**Status:**` and `spec.json.task_registry[path]` with synchronized timestamps. Never write execution proof into the task plan.
126
121
  - A spec-ready execution-evidence or independent-audit slot may be `PENDING`
127
122
  before implementation; pending is not proof and cannot close the feature.
128
123
 
129
124
  ### Step 2 — Scout
130
125
 
131
- Scout depth follows the persisted lane, risk, and blast radius. Identify real
132
- entrypoints/callers, integration points, dependent files, reachability risks,
133
- and safe scope. Do not use file count as a proxy for review depth. If a runtime
134
- entrypoint cannot be grounded, stop.
126
+ Scout depth follows assurance, risk, and blast radius. Identify real
127
+ entrypoints/callers, integration points, dependents, reachability risks, and
128
+ safe scope. File count is not review depth; stop if a runtime entrypoint cannot
129
+ be grounded.
135
130
 
136
131
  ### Step 3 — Implement
137
132
 
138
- Implement only the approved scope and named contracts. Do not silently replace
133
+ Implement only the scoped behavior and named contracts. Do not silently replace
139
134
  frameworks, auth, transport, storage, or runtime boundaries. Do not mark a
140
135
  runtime-facing file complete while it is orphaned, unmounted, unregistered, or
141
136
  uncalled. A specific-task request ends after that task; no automatic chain.
142
137
 
143
138
  <SCOPE-FIDELITY>
144
- The approved `scope_lock`, requirements, design contracts, and active task are
139
+ The `scope_lock`, requirements, design contracts, and active task are
145
140
  the implementation contract. Scope escape requires a concrete reachability or
146
141
  compile reason and must not deliver a later task early.
147
142
  </SCOPE-FIDELITY>
148
143
 
149
144
  ### Step 4 — Closeout owner
150
145
 
151
- The controller assigns exactly one closeout owner for the current task or
152
- feature. That owner invokes the test workflow once, receives its result, then
153
- invokes the review workflow once when the lane requires it. No other phase
154
- re-runs the same test or review as a hidden gate.
146
+ The controller assigns exactly one closeout owner for the current task or feature. It invokes testing once, then review once when required; no phase re-runs either as a hidden gate.
155
147
 
156
- - The test owner executes commands and creates the canonical execution receipt.
148
+ - For task-bearing work, the test owner executes the Verification Plan and writes the canonical execution receipt to `receipts/<task-basename>.md` only after real execution.
157
149
  - The review owner evaluates correctness, security, and spec compliance; it
158
150
  consumes existing proof but never creates or claims execution proof.
159
- - Review depth follows lane, risk, and blast radius. It does not follow the
151
+ - Review depth follows `assurance_level`, risk, and blast radius. Lane is only
152
+ a derived view, and depth does not follow the
160
153
  number of files changed.
161
154
  - Finding count never selects review depth or overrides missing execution proof.
162
155
  - Use the shared adapter surface: `PASS | PASS_WITH_WARNINGS | FAIL | BLOCKED`.
@@ -167,11 +160,7 @@ fixed Light/Standard/Deep agent sequence.
167
160
 
168
161
  ### Step 5 — Sync and docs checkpoint
169
162
 
170
- Only a canonical execution receipt with command, exit result, bound provenance,
171
- and required artifact hashes can close a task/feature. Missing, pending,
172
- marker-only, or contradictory evidence stays unfinished. Critical audits need
173
- distinct session IDs, expected Base/Head binding, concrete evidence, and literal
174
- `verdict: "PASS"`; `Audit: PASS` is not evidence.
163
+ Only a canonical receipt with task identity/path, exact command/result, expected versus observed behavior, bound provenance, applicable negative/reachability proof, and required artifact hashes can close a task. Prefer `receipts/<task-basename>.md`; legacy task `## Evidence` is read-compatible, but conflicting proof identities fail closed. Missing, pending, marker-only, or contradictory evidence stays unfinished. Critical audits need distinct session IDs, expected Base/Head binding, concrete evidence, and literal `verdict: "PASS"`; `Audit: PASS` is not evidence.
175
164
  After verification, synchronize status/timestamps/task state. Then evaluate
176
165
  actual docs impact:
177
166
 
@@ -188,9 +177,7 @@ a receipt bound to expected Base/Head, and every lane obligation. Only literal
188
177
  `PASS` can complete; `PASS_WITH_WARNINGS` remains unfinished.
189
178
  `--flash` records only `FLASH_UNVERIFIED` and never done.
190
179
 
191
- For a full feature, after the last task run the **Final Integration Scout** when
192
- runtime-facing surfaces exist; compare reachability and scope before reporting
193
- completion. For a specific task, stop after its synchronized result.
180
+ For a full feature, after the last task run the **Final Integration Scout** for runtime-facing surfaces and compare reachability/scope before completion. The same test owner creates `feature-receipt.md` exactly once from final integration proof. Task-bearing closeout requires every task receipt plus that feature receipt; taskless Compact/Full creates only the feature receipt at closeout. Its earlier absence is normal. A specific task stops after synchronization and creates no feature receipt unless it also completes the full integration boundary.
194
181
 
195
182
  ## Attached references
196
183
 
@@ -86,7 +86,8 @@ these mandatory lines:
86
86
 
87
87
  1. "You are in an isolated git worktree. Implement ONLY this task."
88
88
  2. "Do NOT edit `spec.json` or any `tasks/*.md` — the orchestrator owns spec state."
89
- 3. "Do NOT touch files outside this task's `Related Files`."
89
+ 3. "Write only exact targets granted by this task's `Anchors and Ownership`
90
+ table and typed ownership/parallel boundaries."
90
91
  4. "When done, `git add` your changes and `git commit -m \"task(<id>): <title>\"` —
91
92
  an uncommitted worktree cannot be merged."
92
93
  5. End with the standard `Status: DONE|CONCERNS|BLOCKED|NEEDS_INFO` block, plus
@@ -150,14 +151,15 @@ cherry-pick remains the recipe regardless.
150
151
  ## 6. Post-merge integration check (per wave)
151
152
 
152
153
  After the wave's last cherry-pick, run an affected integration command derived
153
- from the task's `## Evidence` and repository contract (build or affected test
154
+ from the task's `Verification Plan` and repository contract (build or affected test
154
155
  subset; never the full suite mid-flight). Record command, `base_sha`, `head_sha`,
155
156
  range, and result in the wave receipt. Failure blocks the next wave.
156
157
 
157
158
  After the final wave, run an explicit feature/full integration command derived
158
- from the repository contract — for example the feature's exact Evidence suite
159
+ from the repository contract — for example the feature's exact verification suite
159
160
  or the repository's documented full test/build command. A final scout is not a
160
- substitute. Classify every failure before acting as exactly one of:
161
+ substitute. On PASS, the test owner creates `feature-receipt.md` once; task
162
+ receipts alone cannot close the feature. Classify every failure before acting as exactly one of:
161
163
 
162
164
  - `baseline` — reproduces from the recorded destination `base_sha`;
163
165
  - `environment` — tool, dependency, permission, or service unavailable;
@@ -172,8 +174,9 @@ sequential fallback according to the task contract.
172
174
 
173
175
  Only the orchestrator writes `spec.json` and task markdown, after each task's
174
176
  cherry-pick: registry `status`/`completed_at`/`last_updated_at`, task-md `Status`,
175
- checkbox ticks, and a verification receipt citing the worktree gate evidence plus
176
- the post-merge check result. The Stop completion gate (`spec-gate.cjs`) applies
177
+ checkbox ticks, and a canonical `receipts/<task-basename>.md` citing the
178
+ worktree gate evidence plus the post-merge check result. Never append execution
179
+ proof to task Markdown. The Stop completion gate (`spec-gate.cjs`) applies
177
180
  unchanged — a receipt-less done blocks the turn. After syncing the wave, recompute
178
181
  §2 and continue until no pending tasks remain.
179
182
 
@@ -1,12 +1,12 @@
1
1
  # Quality Gate — one closeout, separate proof and review
2
2
 
3
3
  This reference is loaded at develop closeout. It is an executable contract, not
4
- a fixed actor checklist. The lane snapshot is authoritative; `execution_tier`
5
- is only a legacy read adapter.
4
+ a fixed actor checklist. Canonical v2.1 policy input is authoritative; lane and
5
+ `execution_tier` are derived/read-only compatibility views.
6
6
 
7
7
  ## Inputs and ownership
8
8
 
9
- The single closeout owner receives the current scope, lane, risk signals, blast
9
+ The single closeout owner receives the current scope, assurance, risk signals, blast
10
10
  radius, exact evidence commands, and the current diff. It calls the test owner
11
11
  once, then the review owner once when required. No parallel path, review path,
12
12
  or sync hook runs a duplicate hidden gate.
@@ -16,7 +16,7 @@ or sync hook runs a duplicate hidden gate.
16
16
  consumes the receipt but never creates or claims execution proof.
17
17
  - **Closeout owner:** combines both results and performs one state/docs sync.
18
18
 
19
- Review depth follows lane, risk, and blast radius, not the number of files or
19
+ Review depth follows assurance, risk, and blast radius, not the number of files or
20
20
  tasks. There is no fixed Light/Standard/Deep agent sequence. The shared verdict
21
21
  surface is `PASS | PASS_WITH_WARNINGS | FAIL | BLOCKED`; all adapters must use
22
22
  the same normalizer.
@@ -32,11 +32,12 @@ synchronization remain single-writer operations.
32
32
  Before completion, verify:
33
33
 
34
34
  1. compile/typecheck precheck and every exact command named by the active
35
- Evidence section;
35
+ `Verification Plan`;
36
36
  2. real runtime reachability and declared artifact inspection;
37
- 3. canonical receipt with non-empty command, successful exit result, both
38
- provenance anchors bound to the runtime's expected Base/Head pair, and
39
- required SHA-256 declarations;
37
+ 3. canonical `receipts/<task-basename>.md` with task identity/path, non-empty
38
+ exact command, successful exit/result, expected versus observed behavior,
39
+ applicable negative/reachability proof, both provenance anchors bound to the
40
+ runtime's expected Base/Head pair, and required SHA-256 declarations;
40
41
  4. correctness/security/spec review at the selected depth;
41
42
  5. a real independent audit when `needsIndependentAudit` is persisted. The
42
43
  audit must use schema version `1`, distinct reviewer and implementation
@@ -50,8 +51,8 @@ the shared completion verdict `PASS`.
50
51
 
51
52
  ## Spec compliance review
52
53
 
53
- Check scope lock, requirements, design contracts, completion criteria, evidence,
54
- runtime reachability, and artifact/provenance boundaries. A missing or orphaned
54
+ Check scope lock, requirements, design contracts, task Acceptance, Verification
55
+ Plan, runtime reachability, and artifact/provenance boundaries. A missing or orphaned
55
56
  runtime deliverable is a failure even when compilation succeeds.
56
57
 
57
58
  **Specific-task mode:** review exactly the requested task and its diff, then
@@ -67,7 +68,7 @@ Apply only the checks relevant to the touched boundary. For logging/redaction,
67
68
  check safe identifiers, quoted schemes, idempotence, and receipt secrecy. For
68
69
  filesystem writes, check lexical and canonical containment, symlink rejection,
69
70
  atomic same-directory replacement, cleanup, and canonical return paths. Add
70
- auth, persistence, provider, or concurrency checks only when lane/risk requires.
71
+ auth, persistence, provider, or concurrency checks only when scope/risk requires.
71
72
 
72
73
  ## Quality cycle
73
74
 
@@ -83,7 +84,7 @@ if retry_count reaches 3: stop and request user intervention
83
84
 
84
85
  Only `FAIL` enters remediation. `BLOCKED` is terminal until its prerequisite
85
86
  changes. `PASS_WITH_WARNINGS` is a review result only and remains unfinished;
86
- only literal `PASS` may close when all execution and lane obligations are
87
+ only literal `PASS` may close when all execution and policy obligations are
87
88
  complete.
88
89
 
89
90
  ## Flash Gate (`--flash`)
@@ -132,6 +133,12 @@ missing execution proof. Evaluate docs impact from the actual behavior change:
132
133
  Do not run a docs checkpoint merely because a task completed. Do not refresh the
133
134
  whole repository for a local change.
134
135
 
136
+ After every task receipt is valid, final integration execution creates
137
+ `feature-receipt.md` once. A task-bearing feature cannot close without all task
138
+ receipts and the feature receipt. A taskless Compact/Full feature closes from a
139
+ valid feature receipt; absence before final closeout is not a failure. Receipts
140
+ never supply or imply approval, readiness, audit status, or product semantics.
141
+
135
142
  ## Review threshold
136
143
 
137
144
  `PASS` requires no Critical or High correctness/security/spec finding and no