@haposoft/cafekit 0.16.7 → 0.18.0

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 (193) 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 +0 -36
  4. package/bin/__tests__/codex-native.test.js +46 -88
  5. package/bin/__tests__/develop-contract.test.js +26 -57
  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 +159 -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 +100 -541
  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 +0 -27
  20. package/bin/__tests__/specs-v2-execution-closeout.test.js +4 -69
  21. package/bin/__tests__/ui-ux-skill.test.js +101 -0
  22. package/bin/__tests__/usage-hook-retired.test.js +114 -0
  23. package/bin/__tests__/validator-grounding.test.js +9 -28
  24. package/bin/phases/codex-runtime.js +24 -0
  25. package/bin/phases/omp-runtime.js +22 -0
  26. package/package.json +1 -1
  27. package/src/claude/CLAUDE.md +3 -10
  28. package/src/claude/agents/brainstormer.md +7 -3
  29. package/src/claude/agents/code-auditor.md +35 -50
  30. package/src/claude/agents/debugger.md +5 -79
  31. package/src/claude/agents/deployer.md +3 -5
  32. package/src/claude/agents/docs-keeper.md +2 -7
  33. package/src/claude/agents/implementer.md +6 -9
  34. package/src/claude/agents/inspector.md +2 -3
  35. package/src/claude/agents/project-manager.md +7 -15
  36. package/src/claude/agents/researcher.md +9 -3
  37. package/src/claude/agents/spec-maker.md +11 -11
  38. package/src/claude/hooks/__tests__/fixtures/statusline-default.golden +1 -1
  39. package/src/claude/hooks/__tests__/spec-gate.test.js +74 -3
  40. package/src/claude/hooks/__tests__/spec-state-touched.test.js +134 -0
  41. package/src/claude/hooks/__tests__/state.test.js +68 -0
  42. package/src/claude/hooks/__tests__/statusline.test.js +140 -11
  43. package/src/claude/hooks/agent.cjs +2 -1
  44. package/src/claude/hooks/lib/context.cjs +0 -89
  45. package/src/claude/hooks/lib/hook-payload.cjs +2 -2
  46. package/src/claude/hooks/rules.cjs +2 -1
  47. package/src/claude/hooks/session.cjs +0 -1
  48. package/src/claude/hooks/spec-gate.cjs +17 -28
  49. package/src/claude/hooks/spec-state.cjs +95 -1
  50. package/src/claude/hooks/state.cjs +21 -2
  51. package/src/claude/migration-manifest.json +30 -15
  52. package/src/claude/rules/ai-dev-rules.md +1 -1
  53. package/src/claude/rules/hook-protocols.md +8 -15
  54. package/src/claude/rules/manage-docs.md +9 -23
  55. package/src/claude/rules/orchestrator.md +3 -4
  56. package/src/claude/rules/review-audit-self-decision.md +3 -3
  57. package/src/claude/rules/skill-domain-routing.md +1 -3
  58. package/src/claude/rules/skill-workflow-routing.md +4 -5
  59. package/src/claude/rules/state-sync.md +3 -12
  60. package/src/claude/rules/workflow.md +10 -18
  61. package/src/claude/runtime.schema.json +5 -3
  62. package/src/claude/scripts/generate-skill-catalog.cjs +7 -6
  63. package/src/claude/scripts/provenance.cjs +23 -5
  64. package/src/claude/scripts/spec-receipt.cjs +24 -7
  65. package/src/claude/scripts/spec-resolver.cjs +1 -2
  66. package/src/claude/scripts/validate-spec-output.cjs +5 -32
  67. package/src/claude/settings/settings.json +1 -32
  68. package/src/claude/skills/{question → ask}/SKILL.md +9 -75
  69. package/src/claude/skills/brainstorm/SKILL.md +43 -131
  70. package/src/claude/skills/code-review/SKILL.md +48 -17
  71. package/src/claude/skills/code-review/references/spec-compliance-review.md +2 -3
  72. package/src/claude/skills/code-review/references/verification-gate.md +22 -27
  73. package/src/claude/skills/debug/SKILL.md +29 -149
  74. package/src/claude/skills/develop/SKILL.md +27 -36
  75. package/src/claude/skills/develop/references/parallel-waves.md +0 -8
  76. package/src/claude/skills/develop/references/quality-gate.md +15 -13
  77. package/src/claude/skills/docs/SKILL.md +2 -2
  78. package/src/claude/skills/docs/references/update-workflow.md +1 -1
  79. package/src/claude/skills/fix/SKILL.md +153 -0
  80. package/src/claude/skills/{hotfix → fix}/references/diagnosis-protocol.md +2 -2
  81. package/src/claude/skills/{hotfix → fix}/references/parallel-patterns.md +2 -2
  82. package/src/claude/skills/{hotfix → fix}/references/prevention-gate.md +3 -3
  83. package/src/claude/skills/{hotfix → fix}/references/review-cycle.md +1 -1
  84. package/src/claude/skills/git/SKILL.md +48 -9
  85. package/src/claude/skills/git/references/commit-protocols.md +35 -16
  86. package/src/claude/skills/git/references/worktree-blueprint.md +42 -6
  87. package/src/claude/skills/orca/SKILL.md +9 -8
  88. package/src/claude/skills/research/SKILL.md +2 -0
  89. package/src/claude/skills/scout/SKILL.md +61 -0
  90. package/src/claude/skills/{inspect → scout}/references/internal-inspection.md +26 -10
  91. package/src/claude/skills/specs/SKILL.md +22 -29
  92. package/src/claude/skills/specs/references/review.md +8 -6
  93. package/src/claude/skills/specs/references/templates.md +34 -41
  94. package/src/claude/skills/sync/SKILL.md +8 -15
  95. package/src/claude/skills/sync/references/rebind-and-audit.md +59 -0
  96. package/src/claude/skills/sync/references/sync-protocols.md +4 -13
  97. package/src/claude/skills/test/SKILL.md +22 -3
  98. package/src/claude/skills/test/references/execution-strategy.md +83 -0
  99. package/src/claude/skills/test/references/failure-triage.md +1 -1
  100. package/src/claude/skills/ui-ux/LICENSE +21 -0
  101. package/src/claude/skills/ui-ux/SKILL.md +497 -0
  102. package/src/claude/skills/ui-ux/references/brand-tokens.md +90 -0
  103. package/src/claude/skills/ui-ux/references/budgets.md +113 -0
  104. package/src/claude/skills/ui-ux/references/checklist.md +271 -0
  105. package/src/claude/skills/ui-ux/references/components/accordion.md +246 -0
  106. package/src/claude/skills/ui-ux/references/components/avatar.md +153 -0
  107. package/src/claude/skills/ui-ux/references/components/banner.md +43 -0
  108. package/src/claude/skills/ui-ux/references/components/breadcrumb.md +201 -0
  109. package/src/claude/skills/ui-ux/references/components/button.md +142 -0
  110. package/src/claude/skills/ui-ux/references/components/card.md +113 -0
  111. package/src/claude/skills/ui-ux/references/components/charts.md +376 -0
  112. package/src/claude/skills/ui-ux/references/components/chat.md +132 -0
  113. package/src/claude/skills/ui-ux/references/components/choice-controls.md +369 -0
  114. package/src/claude/skills/ui-ux/references/components/comment-thread.md +17 -0
  115. package/src/claude/skills/ui-ux/references/components/description-list.md +116 -0
  116. package/src/claude/skills/ui-ux/references/components/empty-state.md +98 -0
  117. package/src/claude/skills/ui-ux/references/components/file-upload.md +107 -0
  118. package/src/claude/skills/ui-ux/references/components/inline-edit.md +128 -0
  119. package/src/claude/skills/ui-ux/references/components/input.md +161 -0
  120. package/src/claude/skills/ui-ux/references/components/list-row.md +56 -0
  121. package/src/claude/skills/ui-ux/references/components/loading.md +198 -0
  122. package/src/claude/skills/ui-ux/references/components/logo.md +147 -0
  123. package/src/claude/skills/ui-ux/references/components/otp-input.md +43 -0
  124. package/src/claude/skills/ui-ux/references/components/quantity-input.md +100 -0
  125. package/src/claude/skills/ui-ux/references/components/range-slider.md +16 -0
  126. package/src/claude/skills/ui-ux/references/components/small-controls.md +340 -0
  127. package/src/claude/skills/ui-ux/references/components/sortable-header.md +86 -0
  128. package/src/claude/skills/ui-ux/references/components/tag-input.md +14 -0
  129. package/src/claude/skills/ui-ux/references/components/timeline.md +38 -0
  130. package/src/claude/skills/ui-ux/references/components/tree.md +30 -0
  131. package/src/claude/skills/ui-ux/references/design-process.md +650 -0
  132. package/src/claude/skills/ui-ux/references/layouts/app-kanban.html +303 -0
  133. package/src/claude/skills/ui-ux/references/layouts/app.md +1369 -0
  134. package/src/claude/skills/ui-ux/references/layouts/form.md +430 -0
  135. package/src/claude/skills/ui-ux/references/layouts/overlay.md +552 -0
  136. package/src/claude/skills/ui-ux/references/layouts/pricing.md +204 -0
  137. package/src/claude/skills/ui-ux/references/locked-rules.md +35 -0
  138. package/src/claude/skills/ui-ux/references/principles.md +408 -0
  139. package/src/claude/skills/ui-ux/references/refactor.md +245 -0
  140. package/src/claude/skills/ui-ux/references/responsive.md +195 -0
  141. package/src/claude/skills/ui-ux/references/review.md +528 -0
  142. package/src/claude/skills/ui-ux/references/rules-color.md +623 -0
  143. package/src/claude/skills/ui-ux/references/rules-form.md +235 -0
  144. package/src/claude/skills/ui-ux/references/rules-state.md +680 -0
  145. package/src/claude/skills/ui-ux/references/rules-type.md +369 -0
  146. package/src/claude/skills/ui-ux/references/styles.md +311 -0
  147. package/src/claude/skills/ui-ux/references/system.md +219 -0
  148. package/src/claude/skills/ui-ux/references/tailwind-v4-traps.md +237 -0
  149. package/src/claude/skills/ui-ux/references/tokens.css +362 -0
  150. package/src/claude/skills/ui-ux/scripts/lint-skill.mjs +216 -0
  151. package/src/claude/skills/ui-ux/scripts/package.json +9 -0
  152. package/src/claude/skills/ui-ux/scripts/probe.mjs +4447 -0
  153. package/src/claude/skills/ui-ux-pro-max/SKILL.md +1 -1
  154. package/src/claude/status.cjs +149 -144
  155. package/src/codex/AGENTS.md +8 -13
  156. package/src/codex/hooks/agent.cjs +2 -1
  157. package/src/codex/hooks/lib/spec-receipt.cjs +2 -2
  158. package/src/codex/hooks/lib/spec-utils.cjs +0 -7
  159. package/src/codex/hooks/rules.cjs +2 -1
  160. package/src/codex/hooks/session.cjs +0 -2
  161. package/src/codex/hooks/spec-gate.cjs +7 -18
  162. package/src/codex/hooks.json +0 -20
  163. package/src/codex/rules/state-sync.md +3 -12
  164. package/src/common/AGENTS.md +2 -2
  165. package/src/omp/extensions/cafekit-bridge.mjs +6 -6
  166. package/src/claude/hooks/__tests__/completion-authority.test.js +0 -990
  167. package/src/claude/hooks/__tests__/semantic-review-authority.test.js +0 -259
  168. package/src/claude/hooks/completion-authority-check.cjs +0 -56
  169. package/src/claude/hooks/completion-authority-state.cjs +0 -527
  170. package/src/claude/hooks/completion-authority.cjs +0 -163
  171. package/src/claude/hooks/semantic-review-authority.cjs +0 -154
  172. package/src/claude/hooks/task-scaffold-guard.cjs +0 -114
  173. package/src/claude/hooks/usage.cjs +0 -197
  174. package/src/claude/skills/delegate/SKILL.md +0 -124
  175. package/src/claude/skills/delegate/references/codex-delegation.md +0 -71
  176. package/src/claude/skills/delegate/references/grok-delegation.md +0 -84
  177. package/src/claude/skills/hotfix/SKILL.md +0 -289
  178. package/src/claude/skills/inspect/SKILL.md +0 -142
  179. package/src/claude/skills/loop/SKILL.md +0 -114
  180. package/src/claude/skills/loop/references/bounded-loop-protocol.md +0 -104
  181. package/src/claude/skills/loop/references/metric-and-guard-contract.md +0 -76
  182. package/src/claude/skills/route/SKILL.md +0 -94
  183. package/src/claude/skills/route/references/agent-timing.md +0 -46
  184. package/src/claude/skills/route/references/chaining-patterns.md +0 -53
  185. package/src/claude/skills/route/references/task-taxonomy.md +0 -48
  186. package/src/codex/hooks/completion-authority-check.cjs +0 -67
  187. package/src/codex/hooks/completion-authority-state.cjs +0 -527
  188. package/src/codex/hooks/completion-authority.cjs +0 -109
  189. package/src/codex/hooks/semantic-review-authority.cjs +0 -130
  190. package/src/codex/hooks/task-scaffold-guard.cjs +0 -63
  191. /package/src/claude/skills/{question → ask}/templates/question.md +0 -0
  192. /package/src/claude/skills/{hotfix → fix}/references/escalation-tactics.md +0 -0
  193. /package/src/claude/skills/{hotfix → fix}/references/workflow-specialized.md +0 -0
@@ -1,6 +1,6 @@
1
1
  # Conditional Discovery with Explore Subagents
2
2
 
3
- Use native Explore agents only after the `SKILL.md` Delegation Gate passes.
3
+ Use native Explore agents only after the delegation gate in `SKILL.md` ("Delegate only when …") passes.
4
4
  Focused discovery stays in the main agent even when Explore is available.
5
5
 
6
6
  ## Delegation Preconditions
@@ -15,6 +15,17 @@ All are required:
15
15
  If any precondition fails, use scoped `rg`, file listing, and targeted reads in
16
16
  the main agent. Do not request extra authority for an ordinary focused scout.
17
17
 
18
+ ## Two-Phase Broad Scout
19
+
20
+ Use when the scope is broad; delegate only when the gate is open.
21
+
22
+ 1. **Structure map** (main agent, or one Explore agent once the gate is open): list the scope
23
+ root's immediate children and monorepo markers, estimate files per directory, and return a
24
+ division plan of 1–10 sub-scopes (path or glob, estimated files, focus).
25
+ 2. **Parallel scout**: merge sub-scopes under 10 files and split those over 100; spawn Explore agents
26
+ on distinct sub-scopes, or scout them sequentially in the main agent when the gate is closed; then
27
+ aggregate into the findings `SKILL.md` asks for.
28
+
18
29
  ## Agent Tool Configuration
19
30
 
20
31
  ```
@@ -28,13 +39,18 @@ Quickly search {DIRECTORY} for files related to: {USER_PROMPT}
28
39
 
29
40
  Instructions:
30
41
  - Search for relevant files matching the task (Glob/Grep)
31
- - List files with brief descriptions; timeout 3 minutes; skip if timed out
42
+ - Read-only: do not edit, write, or run anything that changes state
43
+ - Report each relevant file as `path:line` with one clause on why
32
44
 
33
45
  Report format:
34
- ## Found Files
35
- - `path/file.ext` - description
36
- ## Patterns
37
- - Key patterns observed
46
+ ## Relevant Files
47
+ - `path/file.ext:line` - why it matters
48
+ ## Entrypoint and Call Path
49
+ - where the behavior starts, then each hop
50
+ ## Blast Radius
51
+ - callers, tests, config a change would touch
52
+ ## Unknowns
53
+ - what this scope could not settle
38
54
  ```
39
55
 
40
56
  ## Spawning Strategy
@@ -53,12 +69,12 @@ distinct and non-overlapping.
53
69
  | ≥ 3 | Yes |
54
70
 
55
71
  Use the live task or plan surface when available. Record scope and ownership
56
- before spawn, then completion or timeout after collection. Do not create task
72
+ before spawn, then completion or non-response after collection. Do not create task
57
73
  state solely for one or two short probes.
58
74
 
59
- ## Timeout, Aggregation, Reading
75
+ ## Aggregation and Reading
60
76
 
61
- - 3 min/agent; skip non-responders; do not restart; dedupe paths; note gaps in Unresolved Questions
77
+ - Skip agents that do not respond; do not restart them; dedupe paths; note gaps under Unknowns
62
78
  - Stay under ~150K tokens; ~500 lines/chunk; max 3–5 small files or 1 large file chunked (`chunks = ceil(total_lines / 500)`); Read with offset/limit
63
79
 
64
80
  ## Scope Discipline
@@ -67,4 +83,4 @@ Start from concrete directories (not repo root); prefer scoped globs; skip `NO_S
67
83
 
68
84
  ## Output Contract
69
85
 
70
- Return: file paths, brief description per file, notable relationships/patterns, unresolved questions.
86
+ Return the findings `SKILL.md` names — relevant files as `path:line`, entrypoint and call path, blast radius, patterns, unknowns — for the controller to merge and fold into the caller's report.
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: cf:specs
3
- description: "Turn a substantial or risk-elevated feature idea into a bounded, reviewed plan and executable flat task files, with human decisions at scope, findings, and completion. Use when work needs durable coordination or is not eligible for direct work; skip only when a change is clear, isolated, reversible, routine, and likely limited to one or two files."
3
+ description: "Plan a feature before anyone implements it. Use the moment a user asks to add, build, implement, or change a capability: a payment flow, an external integration, a schema change, anything touching more than one or two files. Auth, data, or money risk comes here first even when the request is clear, urgent, or says to just do it now; do not implement it yourself. A short or vague request belongs here too: the scope gate asks what is still undecided in one turn and prevents a wrong build, so a hurry is no reason to skip it. Reach for cf:brainstorm instead only when the outcome is already agreed and two designs genuinely compete. It produces a bounded plan and flat task files with human decisions at scope, findings, and completion; it never writes code. Use when work needs durable coordination or is not eligible for direct work; answer directly when the user only wants to be told or shown something, and skip only when a change is clear, isolated, reversible, routine, and likely limited to one or two files."
4
4
  user-invocable: true
5
5
  argument-hint: "<feature-description>"
6
6
  metadata:
@@ -14,6 +14,7 @@ Quality comes from a short decision process; honesty comes from evidence. Keep t
14
14
  ## Step 0 — classify risk before routing
15
15
 
16
16
  Classify material risk before choosing a workflow; user wording never lowers an observed floor.
17
+ Request size is not a risk signal; a one-line request that touches a shared contract is `elevated`.
17
18
 
18
19
  - `critical`: auth/secrets/privacy; destructive/irreversible work or possible data loss/corruption; money/privilege/safety; production-state mutation.
19
20
  - `elevated`: cross-component contracts, compatibility, concurrency, external integration, or installed/runtime behavior.
@@ -21,7 +22,7 @@ Classify material risk before choosing a workflow; user wording never lowers an
21
22
 
22
23
  Work directly only when the cause and change are clear, isolated, reversible,
23
24
  `routine`, and likely limited to one or two files. Route unresolved user-owned
24
- observable choices to C1/C2 first; after they settle, route material competing
25
+ observable choices to GATE-SCOPE/GATE-REVIEW first; after they settle, route material competing
25
26
  technical designs through Brainstorm. Split three or more independent
26
27
  subsystems; otherwise use one Specs packet for any material work that does not qualify for direct work or Brainstorm-only exploration. A subsystem is independent only when its outcome, boundary, and verification/deployment path can move through the lifecycle separately.
27
28
 
@@ -31,11 +32,11 @@ Do not create a plan merely because documentation mentions this skill; the user
31
32
 
32
33
  | Gate | Timing | Human decision |
33
34
  |---|---|---|
34
- | C1 — Scope | before writing the plan | EXPAND, KEEP, or CUT the proposed minimum change |
35
- | C2 — Findings | after adversarial review | accept, reject, or revise each deduplicated finding |
36
- | C3 — Done | after execution | accept completion from current command output and receipts |
35
+ | GATE-SCOPE | before writing the plan | EXPAND, KEEP, or CUT the proposed minimum change |
36
+ | GATE-REVIEW | after adversarial review | accept, reject, or revise each deduplicated finding |
37
+ | GATE-DONE | after execution | accept completion from current command output and receipts |
37
38
 
38
- Ask once at each gate. Do not ask for routine implementation choices between them. New evidence that invalidates scope returns to C1.
39
+ Ask once at each gate. Do not ask for routine implementation choices between them. New evidence that invalidates scope returns to GATE-SCOPE.
39
40
 
40
41
  ## Primary output layout
41
42
 
@@ -52,7 +53,7 @@ Task files are flat beside `plan.md`. Do not create a nested task directory. Use
52
53
 
53
54
  ## Flow
54
55
 
55
- ### 1. Challenge scope, then open C1
56
+ ### 1. Challenge scope, then open GATE-SCOPE
56
57
 
57
58
  Inspect the repository before drafting. Answer three questions with current `path:line` evidence:
58
59
 
@@ -60,12 +61,12 @@ Inspect the repository before drafting. Answer three questions with current `pat
60
61
  2. What is the smallest change set that delivers the requested outcome?
61
62
  3. What signals expansion: more than eight touched files, more than two new services/classes, or three or more independently deliverable subsystems?
62
63
 
63
- Present the answers and ask the user to EXPAND, KEEP, or CUT. Record the chosen
64
- scope and explicit exclusions in `plan.md`.
64
+ Ask GATE-SCOPE in one message: list every `decision-needed` item (the ambiguity action in `references/templates.md`) as `[NEEDS CLARIFICATION: <question>]`, offer EXPAND, KEEP, and CUT together, and never choose a product outcome on the user's behalf; if an answer leaves an item unsettled, re-ask only that item.
65
+ Record the chosen scope and explicit exclusions in `plan.md`.
65
66
 
66
67
  ### 2. Write the plan and task packets
67
68
 
68
- Keep `plan.md` as the short index: C1 decision, EARS criteria, exclusions, and task table. Give every criterion a stable ID mapped by task rows.
69
+ Keep `plan.md` as the short index: GATE-SCOPE decision, EARS criteria, exclusions, and task table. Give every criterion a stable ID mapped by task rows.
69
70
 
70
71
  For a Specs route, persist the canonical `## Coverage profile` from
71
72
  `references/templates.md`: one `CP-NN` row per observable outcome; tasks reference IDs instead of copying it.
@@ -73,15 +74,17 @@ For a Specs route, persist the canonical `## Coverage profile` from
73
74
  Each task has one usable outcome, normally at most about five owned files, explicit dependencies, measurable acceptance, and a runnable verification command; no preparation-only tasks.
74
75
 
75
76
  Author exact state: `pending` means semantically ready for the dependency-aware queue.
76
- Use `blocked` while a C1/C2 decision, accepted finding, or `UNKNOWN` closure remains
77
+ Use `blocked` while a GATE-SCOPE/GATE-REVIEW decision, accepted finding, or `UNKNOWN` closure remains
77
78
  open. Dependencies alone do not change `pending`; the resolver queues them. Promote only after current evidence closes every non-dependency blocker; keep pre-execution Receipts empty.
78
79
 
79
80
  `Required proof` is planned, not executed evidence. Unknown command/caller/environment
80
81
  reachability blocks `pending`; known unrun proof does not. Missing, failed, or unavailable
81
- required evidence blocks `done`/C3; levels never promote. Rederive affected CP rows after accepted scope, outcome, criteria, ownership, dependency, risk, or proof deltas, before status.
82
+ required evidence blocks `done`/GATE-DONE; levels never promote. Rederive affected CP rows after accepted scope, outcome, criteria, ownership, dependency, risk, or proof deltas, before status.
82
83
  Source/static checks prove the written contract, not live-model adherence.
83
84
 
84
- ### 3. Review adversarially, then open C2
85
+ ### 3. Review adversarially, then open GATE-REVIEW
86
+
87
+ Before GATE-REVIEW, re-run a sample of the plan's `path:line` citations sized by the claim budget in `review.md`; relabel any stale citation `[UNVERIFIED]`.
85
88
 
86
89
  Read [`references/review.md`](references/review.md) and run its fresh-context review. Require reproducible `path:line` plus a failure scenario; deduplicate, rank, and cap at 15.
87
90
 
@@ -89,16 +92,13 @@ Ask the user to accept, reject, or revise each finding; apply only accepted deci
89
92
 
90
93
  ### 4. Execute one task at a time
91
94
 
92
- An implementation workflow owns execution. It selects one unblocked task with
93
- `Status: pending`, changes its single `Status:` field to `in_progress`, respects
94
- owned paths, runs the task's verification, and appends a real inline `## Receipt`
95
- only after the command finishes.
95
+ An implementation workflow owns execution. It selects one unblocked task with `Status: pending`, changes its single `Status:` field to `in_progress`, respects owned paths, runs the task's verification, and appends a real inline `## Receipt` only after the command finishes.
96
96
 
97
97
  Parallel work is allowed only for tasks with disjoint write ownership and
98
98
  satisfied dependencies. One file has one writer in a wave. The controller is
99
99
  the sole writer of task status and receipts.
100
100
 
101
- ### 5. Prove completion, then open C3
101
+ ### 5. Prove completion, then open GATE-DONE
102
102
 
103
103
  A task may say `Status: done` only when its inline receipt contains the exact
104
104
  command, `Exit: 0`, `Verification: PASS`, runtime-bound Base and Head values,
@@ -106,12 +106,12 @@ and a non-empty fenced command-output block. Placeholder or remembered output
106
106
  is not evidence.
107
107
 
108
108
  Show the user the current evidence and unresolved limitations. The user decides
109
- at C3 whether the feature is done. A passing command proves only what it ran;
109
+ at GATE-DONE whether the feature is done. A passing command proves only what it ran;
110
110
  it does not invent product approval, review independence, or runtime coverage.
111
111
 
112
112
  ## Ten operating laws
113
113
 
114
- 1. **A1 — Scope once.** Raise scope pressure at C1; reopen only with new proof.
114
+ 1. **A1 — Scope once.** Raise scope pressure at GATE-SCOPE; reopen only with new proof.
115
115
  2. **A2 — Small packets.** One task, one outcome, one owner, one proof command.
116
116
  3. **A3 — One fact, one home.** Reference decisions; never copy mutable lists.
117
117
  4. **A4 — Files are state.** Markdown is canonical; indexes are disposable.
@@ -131,17 +131,10 @@ done Receipt, binding Base and Head to the live runtime only while the task file
131
131
  committed copy it no longer matches; work elsewhere in the tree never reopens it. It detects drift
132
132
  between a receipt and the tree, not invention: a valid pair costs one command and no
133
133
  verification run, so a receipt for a command that never ran satisfies it in either
134
- mode. C3 is where a human weighs the evidence. These checks are a final safety net,
135
- not a substitute for C1-C3 judgment. Do not add a new schema, approval field,
134
+ mode. GATE-DONE is where a human weighs the evidence. These checks are a final safety net,
135
+ not a substitute for human judgment at the three gates. Do not add a new schema, approval field,
136
136
  readiness bit, or review state to make the Markdown look more authoritative.
137
137
 
138
- ## Legacy compatibility
139
-
140
- Existing features that contain `spec.json`, nested task files, or separate
141
- receipt files stay on the installed legacy adapters. Do not migrate or rewrite
142
- them while authoring an unrelated v3 feature. New Specs output always uses the
143
- flat layout above and never requires the legacy kernel.
144
-
145
138
  ## Maintenance
146
139
 
147
140
  Keep this entrypoint focused on routing and invariants. Put templates and
@@ -1,4 +1,4 @@
1
- # Plan review — evidence, adversarial lenses, and C2
1
+ # Plan review — evidence, adversarial lenses, and GATE-REVIEW
2
2
 
3
3
  Review exists to find costly errors before code. It is not a prose-quality
4
4
  score. Every accepted finding must be reproducible from current repository
@@ -72,13 +72,15 @@ Apply these to the relevant boundary:
72
72
 
73
73
  Each finding must describe an observable failure, not a preference.
74
74
 
75
- ## Aggregate before C2
75
+ ## Aggregate before GATE-REVIEW
76
+
77
+ Before GATE-REVIEW the author re-runs a sample of the plan's citations sized by the claim budget above and relabels `[UNVERIFIED]` every citation whose cited text is no longer at that line.
76
78
 
77
79
  Normalize duplicate findings by root cause. Preserve the strongest evidence and
78
80
  smallest counterexample. Sort Critical, High, then Medium. Cap the presented
79
81
  list at 15; a larger useful set means the plan should be split.
80
82
 
81
- Present C2 as a table:
83
+ Present GATE-REVIEW as a table:
82
84
 
83
85
  | ID | Severity | Plan location | Failure scenario | Evidence | Proposed repair | Decision |
84
86
  |---|---|---|---|---|---|---|
@@ -88,7 +90,7 @@ decision. Record the result in the plan review log.
88
90
 
89
91
  ## Accepted-repair closure
90
92
 
91
- After applying an accepted C2 finding, a fresh-context closure pass records and
93
+ After applying an accepted GATE-REVIEW finding, a fresh-context closure pass records and
92
94
  freshly replays its original counterexample after the repair under this exact review-log header:
93
95
 
94
96
  | ID | Decision | Original counterexample | Repaired at | Proved at | Replay | Closure |
@@ -97,7 +99,7 @@ freshly replays its original counterexample after the repair under this exact re
97
99
  `Repaired at` cites the repair edit; `Proved at` must cite distinct evidence from the fresh replay, never the repair-edit citation.
98
100
  An accepted finding transitions `accepted → repaired → PASS|FAIL|UNKNOWN`.
99
101
  Only `PASS` closes it; `FAIL` remains open for the remaining paper-review round; `UNKNOWN` blocks implementation handoff.
100
- A repair that adds user semantics or scope returns to C1.
102
+ A repair that adds user semantics or scope returns to GATE-SCOPE.
101
103
 
102
104
  ## B3 — consistency sweep
103
105
 
@@ -119,7 +121,7 @@ Any unresolved contradiction keeps the plan unready.
119
121
  - Round three requires runtime evidence: an executed test, command output, or
120
122
  observed host behavior. More paper argument is not a new finding.
121
123
  - A repair round should not grow the plan unless evidence proves missing scope.
122
- - Two add-only rounds trigger a split, deferral, or return to C1.
124
+ - Two add-only rounds trigger a split, deferral, or return to GATE-SCOPE.
123
125
  - Stop early when remaining findings are duplicates, preferences, or already
124
126
  covered by one acceptance criterion and one verification command.
125
127
 
@@ -1,14 +1,6 @@
1
1
  # Process-first plan, task, and receipt templates
2
2
 
3
- Use these as compact starting points. Remove unused examples and placeholders
4
- before C2. The primary layout is always flat:
5
-
6
- ```text
7
- specs/<feature>/
8
- ├── plan.md
9
- ├── task-01-<slug>.md
10
- └── task-NN-<slug>.md
11
- ```
3
+ Use these as compact starting points. Remove unused examples and placeholders before GATE-REVIEW. The primary layout is always flat: `specs/<feature>/` holds `plan.md` beside `task-01-<slug>.md` through `task-NN-<slug>.md`, with no task subdirectory.
12
4
 
13
5
  ## `plan.md` template
14
6
 
@@ -18,7 +10,7 @@ Keep the plan short enough to scan as one index, normally under 100 lines.
18
10
  # <Feature name>
19
11
  Specs-Contract: process-first-ready-v1
20
12
 
21
- ## Scope decision (C1 — YYYY-MM-DD)
13
+ ## Scope decision (GATE-SCOPE — YYYY-MM-DD)
22
14
  - Existing: <reusable code with path:line>
23
15
  - Minimum change: <required behavior>
24
16
  - Expansion signals: <none or evidence>
@@ -27,6 +19,11 @@ Specs-Contract: process-first-ready-v1
27
19
  ## Out of scope
28
20
  - <deliberate exclusion>
29
21
 
22
+ ## Decisions
23
+ | ID | Chosen | Rejected | Why | Load-bearing assumption | Break signal → response |
24
+ |---|---|---|---|---|---|
25
+ | D-01 | <chosen path> | <rejected alternative> | <evidence-backed reason> | <assumption that must hold> | <observable signal> → <pre-decided response> |
26
+
30
27
  ## Coverage profile
31
28
  | ID | Outcome | Change kinds | Material surfaces | Ambiguity/action | Risk/evidence | Required proof |
32
29
  |---|---|---|---|---|---|---|
@@ -38,9 +35,9 @@ Specs-Contract: process-first-ready-v1
38
35
  | AC-01 | When <trigger>, the system shall <response>. | `<command>` |
39
36
 
40
37
  ## Tasks
41
- | # | Task | Criteria | Primary ownership | Dependencies | Status |
42
- |---|---|---|---|---|---|
43
- | 01 | <one outcome> | AC-01 | `src/example.ts` | - | blocked |
38
+ | # | Task | Priority | Criteria | Primary ownership | Dependencies | Status |
39
+ |---|---|---|---|---|---|---|
40
+ | 01 | <one outcome> | P1 | AC-01 | `src/example.ts` | - | blocked |
44
41
 
45
42
  ## Review log
46
43
  - Round 1: <findings accepted/rejected/revised>; sweep <result>.
@@ -48,6 +45,7 @@ Specs-Contract: process-first-ready-v1
48
45
 
49
46
  Each acceptance ID must map to at least one task and one proof. A task with no
50
47
  criterion is scope drift; a criterion with no task or proof is not executable.
48
+ `Priority`: P1 means the outcome is unusable without it, P2 is needed for acceptance, P3 improves it. Number tasks in priority order so the plan table, the filename order, and the queue agree.
51
49
 
52
50
  ## `task-NN-*.md` template
53
51
 
@@ -73,6 +71,9 @@ Status: blocked
73
71
  - Create: `test/a.test.ts`
74
72
  - Read: `src/caller.ts`
75
73
 
74
+ ## Steps
75
+ 1. <ordered action on one owned file → expected observation>
76
+
76
77
  ## Acceptance
77
78
  - AC-01: <task-local measurable condition>
78
79
 
@@ -87,6 +88,9 @@ Status: blocked
87
88
  - Counterexample: <material alternative behavior that must make this proof fail>
88
89
  - Artifacts: <required artifact path plus digest algorithm/comparison rule, or explicitly ephemeral with cleanup rule>
89
90
 
91
+ ## Failure Protocol
92
+ On a failed Step or Verification Plan run: stop; do not widen scope, change the Command, or weaken a test; record observed versus expected; repair only the cited cause; after three failed rounds, stop and ask the user.
93
+
90
94
  ## Receipt
91
95
  <!-- Fill only after execution; see canonical form below. -->
92
96
  ````
@@ -94,18 +98,20 @@ Status: blocked
94
98
  Trace `Command → Named probe → Reachability → Oracle`. Aggregate suites name the
95
99
  owning concrete probe. `Required proof` is a planned level set, not execution
96
100
  evidence: known but unrun proof may be `pending`; `UNKNOWN` reachability blocks
97
- `pending`; missing, failed, or unavailable required evidence blocks `done`/C3.
101
+ `pending`; missing, failed, or unavailable required evidence blocks `done`/GATE-DONE.
98
102
  Levels stay separate and never promote one another. Run mutation or destructive
99
103
  negative controls only on disposable copies under a verified temporary root,
100
104
  never tracked worktree or canonical source bytes.
101
105
  For every required level in each referenced CP row, map its named probe and
102
106
  reachability here; one command may own several explicitly named level probes.
107
+ Verification compares observed output with the Oracle; a judgment such as "looks right" is not a verification.
108
+ Example failure: the Command exits 1 with `expected 3 files, found 2` → record observed versus expected, add the missing writer, and rerun the same Command; never delete the assertion.
103
109
 
104
110
  ## Status matrix
105
111
 
106
112
  | Status condition | Persisted state |
107
113
  |---|---|
108
- | C1/C2 decision open | `blocked` |
114
+ | GATE-SCOPE/GATE-REVIEW decision open | `blocked` |
109
115
  | accepted finding open or `UNKNOWN` reachability | `blocked` |
110
116
  | every non-dependency blocker closed | `pending` |
111
117
  | named task dependency not done | keep `pending`; queue gates it |
@@ -138,16 +144,13 @@ bare PASS claim without the command output.
138
144
 
139
145
  ## EARS sentence patterns
140
146
 
141
- Use the narrowest pattern that describes observable behavior:
142
-
143
147
  1. **Ubiquitous:** `The <system> shall <response>.`
144
148
  2. **Event-driven:** `When <trigger>, the <system> shall <response>.`
145
149
  3. **State-driven:** `While <state>, the <system> shall <response>.`
146
150
  4. **Unwanted behavior:** `If <fault>, the <system> shall <response>.`
147
151
  5. **Optional feature:** `Where <feature is enabled>, the <system> shall <response>.`
148
152
 
149
- Avoid implementation detail unless it is a user-approved contract. Replace
150
- "fast", "robust", and "works" with a measurable threshold or observation.
153
+ Use the narrowest pattern that describes observable behavior. Avoid implementation detail unless it is a user-approved contract. Replace "fast", "robust", and "works" with a measurable threshold or observation.
151
154
 
152
155
  ## Example Mapping rule
153
156
 
@@ -157,7 +160,7 @@ Classify ambiguity in every affected CP row:
157
160
  |---|---|
158
161
  | `none` | proceed |
159
162
  | `examples-needed` | add two or three examples only for an already decided rule; promote to `decision-needed` if an example changes observable behavior |
160
- | `decision-needed` | ask the user at C1/C2 and keep affected tasks blocked |
163
+ | `decision-needed` | ask the user at GATE-SCOPE/GATE-REVIEW and keep affected tasks blocked |
161
164
  | `design-needed` | after user-owned decisions settle, route material competing technical designs through Brainstorm |
162
165
 
163
166
  Do not let examples choose a product outcome: retention of 30 versus 90 days is
@@ -165,7 +168,7 @@ Do not let examples choose a product outcome: retention of 30 versus 90 days is
165
168
 
166
169
  ## No-invention and conditional boundary contracts
167
170
 
168
- Before implementation handoff, apply the **no-invention gate**: if two implementations conform to the packet text yet can produce different externally observable output, state, error, security, or compatibility behavior, surface the missing choice as an explicit C1 or C2 question and block handoff.
171
+ Before implementation handoff, apply the **no-invention gate**: if two implementations conform to the packet text yet can produce different externally observable output, state, error, security, or compatibility behavior, surface the missing choice as an explicit GATE-SCOPE or GATE-REVIEW question and block handoff.
169
172
 
170
173
  For a Specs route, `plan.md` owns one `## Coverage profile` row per externally observable outcome; direct and Brainstorm-only routes do not persist it. Change kinds are multi-valued (`add`, `modify`, `fix`, `refactor`, `remove`, `migrate`, `integrate`), and unfamiliar kinds or surfaces use `other:<verbatim>` rather than disappearing. Each task references its CP IDs; authoring, review, edge, and proof obligations union only inside affected rows/tasks. Rederive affected CP rows after any accepted scope, outcome, criteria, ownership, dependency, risk, or proof delta before task status.
171
174
 
@@ -186,15 +189,11 @@ For every required row, name each listed choice exactly; labels such as “JSON
186
189
 
187
190
  ## Twelve edge-case dimensions
188
191
 
189
- For each material boundary, select relevant dimensions rather than filling a
190
- ceremonial matrix:
192
+ For each material boundary, select relevant dimensions rather than filling a ceremonial matrix:
191
193
 
192
- - Input shape, identity, state, order: malformed/duplicate/bounds, wrong actor,
193
- partial/stale state, replay/reordering.
194
- - Concurrency, dependency, failure, recovery: races/cancellation, version drift,
195
- timeout/nonzero exit, retry/rollback/cleanup.
196
- - Persistence, integration, security/privacy, observability/proof: partial
197
- writes, registration/reachability, traversal/secrets, artifacts/provenance.
194
+ - Input shape, identity, state, order: malformed/duplicate/bounds, wrong actor, partial/stale state, replay/reordering.
195
+ - Concurrency, dependency, failure, recovery: races/cancellation, version drift, timeout/nonzero exit, retry/rollback/cleanup.
196
+ - Persistence, integration, security/privacy, observability/proof: partial writes, registration/reachability, traversal/secrets, artifacts/provenance.
198
197
 
199
198
  `Crash` means abrupt unhandled termination before the claimed catch point; a catchable failure returns/raises an error or exits nonzero. Never use them interchangeably.
200
199
 
@@ -203,17 +202,11 @@ verification probe. Do not duplicate it across all three.
203
202
 
204
203
  ## Quality and saturation checks
205
204
 
206
- Before C2 confirm:
205
+ Before GATE-REVIEW confirm:
207
206
 
208
- - every repository fact has current evidence or `[UNVERIFIED]`;
209
- - every acceptance criterion maps to task and proof;
210
- - task ownership does not overlap within a proposed parallel wave;
211
- - dependencies are acyclic and refer to real task numbers;
212
- - commands are runnable from the named work context;
213
- - negative, recovery, and reachability probes exist where risk requires them;
214
- - every ambiguity follows its required action; examples only clarify decided rules;
215
- - the latest consistency sweep reports zero unresolved contradictions.
207
+ - evidence: every repository fact has a current citation or `[UNVERIFIED]`, and the sampled citations were re-run;
208
+ - mapping: each acceptance criterion reaches a task and a proof; ownership does not overlap inside one parallel wave; dependencies are acyclic and name real task files;
209
+ - proof: commands run from the named work context, and negative, recovery, and reachability probes exist where risk requires them;
210
+ - closure: each ambiguity followed its required action, examples only clarify decided rules, and the latest consistency sweep reports zero unresolved contradictions.
216
211
 
217
- Stop expanding when a fresh reviewer finds no new material failure with new
218
- evidence, the 12 dimensions yield no uncovered relevant boundary, and every
219
- accepted C2 finding is represented exactly once.
212
+ Stop expanding when a fresh reviewer finds no new material failure with new evidence, the 12 dimensions yield no uncovered relevant boundary, and each accepted GATE-REVIEW finding is represented exactly once.
@@ -1,11 +1,11 @@
1
1
  ---
2
2
  name: cf:sync
3
- description: "Synchronize process-first task Status and inline Receipts without inventing proof; also preserves existing legacy Specs state."
3
+ description: "Synchronize process-first task Status and inline Receipts without inventing proof."
4
4
  user-invocable: true
5
5
  when_to_use: "Invoke after implementation or verification changes a task's real state, or to audit a feature packet for drift."
6
6
  category: utilities
7
7
  keywords: [sync, state, tracking, consistency]
8
- argument-hint: "<feature> <task-file> <pending|in_progress|paused|blocked|done|sync-finalize> [blocker] | audit <feature>"
8
+ argument-hint: "<feature> <task-file> <pending|in_progress|paused|blocked|done|sync-finalize> [blocker] | audit <feature> | rebind <feature> [task-file] | (none: audit all, write nothing)"
9
9
  metadata:
10
10
  author: haposoft
11
11
  version: "3.0.0"
@@ -24,6 +24,8 @@ state. Never infer proof, approval, review independence, or product readiness.
24
24
  /cf:sync <feature> <task-NN-slug.md> done
25
25
  /cf:sync <feature> <task-NN-slug.md> sync-finalize
26
26
  /cf:sync audit <feature>
27
+ /cf:sync rebind <feature> [<task-NN-slug.md>]
28
+ /cf:sync
27
29
  ```
28
30
 
29
31
  Resolve one regular direct-child task inside `specs/<feature>/`. Reject path
@@ -59,21 +61,12 @@ task filenames, dependencies, Status, acceptance mapping, and Receipts. Report
59
61
  missing files, unknown rows, cycles, duplicate fields, done-without-proof,
60
62
  proof-on-unfinished-task, and overlapping ownership.
61
63
 
62
- Repair deterministic formatting drift only. A semantic conflict, missing
63
- evidence, or ownership decision requires user or implementation input; do not
64
- pick a winner. After any edit, report exact files changed and unresolved items.
65
-
66
- Read `references/sync-protocols.md` for surgical update and audit rules.
64
+ An audit writes nothing until the user confirms the named changes; then repair
65
+ deterministic formatting drift only and never pick a winner in a semantic conflict.
66
+ Read `references/rebind-and-audit.md` before a rebind, a bare call, or a file
67
+ report, and `references/sync-protocols.md` for surgical update and audit rules.
67
68
 
68
69
  ## Docs impact
69
70
 
70
71
  When a task becomes done, report `Docs impact: none|minor|major`. Create no docs
71
72
  work for `none`; update only affected existing docs for minor or major.
72
-
73
- ## Legacy workflow compatibility
74
-
75
- If `specs/<feature>/spec.json` exists, use the legacy adapter instead: preserve
76
- its machine authority, `task_registry`, nested `tasks/task-R*.md`, timestamps,
77
- typed topology, separate receipts, `workflow_policy`, `planning_depth`, lane,
78
- and `execution_tier`. Keep JSON and Markdown synchronized, retain the exact
79
- legacy sync-finalize contract, and require its feature receipt at closeout.
@@ -0,0 +1,59 @@
1
+ # Rebind, bare call, and the changed-files report
2
+
3
+ Read this before a rebind, a call without arguments, or any report of files
4
+ changed. Every rule here exists because a past sync run broke it.
5
+
6
+ ## Snapshot first
7
+
8
+ Before the first edit, record `git status --porcelain -uall` and the sha256 of
9
+ every path it lists. A file that was already modified is not yours to claim.
10
+
11
+ ## Rebind
12
+
13
+ `/cf:sync rebind <feature> [<task-NN-slug.md>]` refreshes the Receipt of tasks
14
+ that are already `done`. Any other Status is reported and not written.
15
+
16
+ 1. Take each task's Command exactly as the validator does: the last top-level
17
+ `- Command:` of its Verification Plan before the first `###` sub-heading,
18
+ or, when there is none at top level, the last `- Command:` under the
19
+ sub-headings. That one Command is the one you run and write.
20
+ 2. Run every selected Command verbatim, each once as one shell, so stdout,
21
+ stderr and the exit code cover the whole command. Never pipe it through
22
+ `| tail`, never redirect only its last `&&` link to a log, never edit it.
23
+ 3. A Command that exits non-zero, prints a failure marker, or runs zero
24
+ required tests never yields PASS. Set `Status: blocked` and, right under
25
+ the `Status:` line, add one line
26
+ `Blocker: rebind <date>: <Command> exited <code> (<failing test line>)`;
27
+ keep the old Receipt, and put this line directly under its `## Receipt`
28
+ heading:
29
+ `Not current proof: the rebind run of this Command exited <code>; the record below is historical.`
30
+ 4. After all Commands have run, run the provenance command once, exactly as
31
+ Develop names it:
32
+ `node .claude/scripts/provenance.cjs --project-root . --specs-root specs --spec-file <task file> --feature-name <feature> --session <any label> --json`
33
+ Copy its `Base` and `Head` fields into each passing Receipt. Never type,
34
+ compute, shorten, or `sed`-edit Base or Head, and never write a Receipt
35
+ from output that a run in this call did not print.
36
+ 5. Run the provenance command again. If Head moved, say so and do not claim
37
+ the receipts current.
38
+ 6. Re-read each edited task: exactly one `Status:` and one `## Receipt`.
39
+
40
+ ## Never silence the gate
41
+
42
+ A Stop-gate block is answered with fresh evidence or with a reported blocker.
43
+ Never archive, move, rename, or delete a packet, change the specs root, or edit
44
+ `.claude/` (including `runtime.json`) or any hook so the gate goes quiet.
45
+
46
+ ## Bare call
47
+
48
+ `/cf:sync` without arguments audits every process-first packet under the specs
49
+ root and writes nothing. Report legacy (`spec.json`) and archived packets
50
+ without touching them. End by asking with `AskUserQuestion` when the host has
51
+ it, otherwise ask in text and stop. Only a reply that arrives after the report
52
+ and names the changes counts as confirmation; an instruction given before the
53
+ report, such as "close everything", does not.
54
+
55
+ ## Report files from git
56
+
57
+ After the last edit, take the snapshot again and report every path whose
58
+ status line or sha256 changed. List changes that were already there before the
59
+ first edit apart from your own. Never write "no files changed" from memory.
@@ -40,23 +40,14 @@ provenance, and path or artifact mismatch.
40
40
 
41
41
  - Plan row without task file: report missing; do not synthesize scope.
42
42
  - Task file without plan row: report unknown; do not silently adopt it.
43
- - Done without valid Receipt: downgrade only when the repair is deterministic,
44
- otherwise block and request direction.
43
+ - Done without valid Receipt: after the user confirms, downgrade when the repair is deterministic,
44
+ otherwise report and request direction.
45
45
  - Receipt on unfinished task: preserve it only if it is clearly historical;
46
46
  otherwise report the conflict.
47
- - Missing or cyclic dependency: block affected tasks.
48
- - Overlapping write ownership in one proposed wave: serialize or request an
47
+ - Missing or cyclic dependency: report; block affected tasks only after the user confirms.
48
+ - Overlapping write ownership in one proposed wave: report and request an
49
49
  ownership decision.
50
50
  - Acceptance ID not mapped both ways: report traceability drift.
51
51
 
52
52
  After a repair, re-read every changed file and print a concise mismatch/fix/
53
53
  unresolved summary. Never claim execution proof from the audit itself.
54
-
55
- ## Legacy workflow compatibility
56
-
57
- For `spec.json` packets, resolve exact `task_registry` paths and synchronize
58
- registry timestamps plus nested task Markdown. Validate the canonical separate
59
- receipt (with legacy inline Evidence only as the supported fallback), reject
60
- conflicting proof identities, preserve classified minimum and planning_depth,
61
- and use the installed legacy policy for lane, execution_tier, Flash promotion,
62
- and final feature closeout.
@@ -87,10 +87,19 @@ For a process-first feature:
87
87
  1. Detect commands from task and repository files; never invent them.
88
88
  2. Run a cheap compile or typecheck precheck when the project provides one.
89
89
  3. Execute the exact task command and all named probes with real counts.
90
- 4. Inspect negative paths, runtime reachability, and declared artifacts.
91
- 5. Capture tracked, untracked, and ignored project-command drift separately
90
+ 4. For Ordinary non-Spec testing, before any `PASS` or `PASS_WITH_WARNINGS`,
91
+ read the tests that cover the target or changed code (every test file when
92
+ the suite is small). When an assertion or its pass condition depends on a
93
+ nondeterministic source — the clock, randomness, the network, shared
94
+ filesystem state or test order — the verdict is `FAIL`, naming the source,
95
+ even when every run passes. When only setup depends on one, rerun just the
96
+ suspect tests at least twice more; any differing outcome is `FAIL` as flaky.
97
+ A single green run of such a test is not `PASS`. This step does not apply to
98
+ process-first Named probes, which run exactly once.
99
+ 5. Inspect negative paths, runtime reachability, and declared artifacts.
100
+ 6. Capture tracked, untracked, and ignored project-command drift separately
92
101
  from runtime Head. Never silently clean or hide project changes.
93
- 6. Redact sensitive material, validate the complete proof object, then return a
102
+ 7. Redact sensitive material, validate the complete proof object, then return a
94
103
  concise human report separately from the machine handoff.
95
104
 
96
105
  Required proof follows the behavior:
@@ -165,6 +174,16 @@ Do not place the full JSON payload, secrets, verbose raw logs, or screenshots in
165
174
  the concise report. `PASS_WITH_WARNINGS` remains unfinished; only literal
166
175
  validated `PASS` may be synchronized by the controller.
167
176
 
177
+ When the target's task can be read — a process-first packet, or a packet
178
+ `BLOCKED` while it is classified that still holds exactly one regular flat task
179
+ with a readable `Command` and `Named probes` — end the final message with the
180
+ concise report, then a `### Machine handoff (test-proof-v1)` heading and exactly
181
+ one fenced `json` block holding the validated payload. The handoff block follows
182
+ the report and is not part of it. No further fenced block follows it. A
183
+ pre-execution `BLOCKED` takes the same placement; its shape is in
184
+ `references/execution-strategy.md` §4. For any other target, end with the
185
+ report and the line `No payload: target not identifiable.`
186
+
168
187
  ## Legacy workflow compatibility
169
188
 
170
189
  A valid legacy packet keeps the v2.1 adapter, legacy task resolution, and its