@haposoft/cafekit 0.16.0-rc.5 → 0.16.0-rc.7

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 (86) hide show
  1. package/README.md +21 -58
  2. package/bin/__tests__/change-firewall.semantic-firewall.test.js +4 -5
  3. package/bin/__tests__/codex-hooks.test.js +137 -0
  4. package/bin/__tests__/codex-native.test.js +130 -74
  5. package/bin/__tests__/develop-contract.test.js +155 -76
  6. package/bin/__tests__/installer-safety.test.js +19 -154
  7. package/bin/__tests__/package-inventory.test.js +10 -20
  8. package/bin/__tests__/release-preflight.semantic-firewall.test.js +13 -5
  9. package/bin/__tests__/validator-grounding.test.js +11 -11
  10. package/bin/install.js +2 -7
  11. package/bin/lib/context.js +0 -45
  12. package/bin/lib/copy-utils.js +1 -1
  13. package/bin/lib/i18n.js +0 -3
  14. package/bin/lib/manifest.js +1 -1
  15. package/bin/phases/claude-runtime.js +1 -3
  16. package/bin/phases/codex-runtime.js +4 -2
  17. package/bin/phases/copy-payload.js +3 -15
  18. package/bin/phases/post-install.js +5 -17
  19. package/bin/phases/root-config.js +2 -3
  20. package/bin/phases/select-platform.js +2 -5
  21. package/bin/phases/summary.js +0 -1
  22. package/package.json +3 -8
  23. package/src/claude/CLAUDE.md +19 -6
  24. package/src/claude/agents/project-manager.md +41 -9
  25. package/src/claude/agents/spec-maker.md +76 -155
  26. package/src/claude/gitignore +1 -1
  27. package/src/claude/hooks/__tests__/spec-gate.test.js +162 -0
  28. package/src/claude/hooks/lib/context.cjs +1 -1
  29. package/src/claude/hooks/lib/detect.cjs +1 -1
  30. package/src/claude/hooks/spec-gate.cjs +44 -9
  31. package/src/claude/hooks/spec-state.cjs +22 -11
  32. package/src/claude/hooks/task-scaffold-guard.cjs +1 -1
  33. package/src/claude/migration-manifest.json +17 -3
  34. package/src/claude/rules/manage-docs.md +43 -24
  35. package/src/claude/rules/state-sync.md +57 -62
  36. package/src/claude/rules/workflow.md +30 -13
  37. package/src/claude/scripts/change-firewall.cjs +2 -2
  38. package/src/claude/scripts/generate-skill-catalog.cjs +0 -1
  39. package/src/claude/scripts/spec-receipt.cjs +141 -1
  40. package/src/claude/scripts/spec-resolver.cjs +288 -0
  41. package/src/claude/skills/develop/SKILL.md +89 -125
  42. package/src/claude/skills/develop/references/parallel-waves.md +75 -162
  43. package/src/claude/skills/develop/references/quality-gate.md +61 -121
  44. package/src/claude/skills/develop/references/subagent-patterns.md +31 -38
  45. package/src/claude/skills/question/SKILL.md +1 -1
  46. package/src/claude/skills/specs/SKILL.md +142 -204
  47. package/src/claude/skills/specs/references/review.md +109 -243
  48. package/src/claude/skills/specs/references/templates.md +173 -0
  49. package/src/claude/skills/sync/SKILL.md +66 -90
  50. package/src/claude/skills/sync/references/sync-protocols.md +62 -83
  51. package/src/codex/AGENTS.md +20 -7
  52. package/src/codex/hooks/lib/spec-receipt.cjs +18 -0
  53. package/src/codex/hooks/lib/spec-utils.cjs +25 -0
  54. package/src/codex/hooks/spec-gate.cjs +46 -16
  55. package/src/codex/hooks/spec-state.cjs +22 -12
  56. package/src/codex/rules/state-sync.md +57 -61
  57. package/src/common/AGENTS.md +8 -1
  58. package/bin/__tests__/opencode-spec-gate.test.js +0 -799
  59. package/bin/lib/opencode-install.js +0 -899
  60. package/bin/phases/opencode-runtime.js +0 -38
  61. package/src/claude/skills/specs/references/archive-workflow.md +0 -74
  62. package/src/claude/skills/specs/references/ask-user-question-gates.md +0 -70
  63. package/src/claude/skills/specs/references/codebase-analysis.md +0 -102
  64. package/src/claude/skills/specs/references/cross-spec-dependency.md +0 -76
  65. package/src/claude/skills/specs/references/research-strategy.md +0 -107
  66. package/src/claude/skills/specs/references/scope-inquiry.md +0 -107
  67. package/src/claude/skills/specs/references/translation-mirror.md +0 -83
  68. package/src/claude/skills/specs/rules/design-discovery-full.md +0 -45
  69. package/src/claude/skills/specs/rules/design-discovery-light.md +0 -28
  70. package/src/claude/skills/specs/rules/design-principles.md +0 -138
  71. package/src/claude/skills/specs/rules/design-review.md +0 -55
  72. package/src/claude/skills/specs/rules/ears-format.md +0 -42
  73. package/src/claude/skills/specs/rules/phase-decision-matrix.md +0 -56
  74. package/src/claude/skills/specs/rules/task-scoring-rubric.md +0 -52
  75. package/src/claude/skills/specs/rules/tasks-generation.md +0 -189
  76. package/src/opencode/AGENTS.md +0 -41
  77. package/src/opencode/plugins/docs-sync.ts +0 -175
  78. package/src/opencode/plugins/inspect-block.ts +0 -164
  79. package/src/opencode/plugins/privacy-block.ts +0 -182
  80. package/src/opencode/plugins/rules.ts +0 -155
  81. package/src/opencode/plugins/session.ts +0 -179
  82. package/src/opencode/plugins/spec-gate.ts +0 -457
  83. package/src/opencode/plugins/spec-state.ts +0 -311
  84. package/src/opencode/plugins/state.ts +0 -253
  85. package/src/opencode/plugins/task-scaffold-guard.ts +0 -161
  86. package/src/opencode/plugins/usage.ts +0 -178
@@ -1,194 +1,107 @@
1
- # Parallel Waves — hapo:develop `--parallel` operating procedure
2
-
3
- Normative protocol for executing independent spec tasks concurrently. Loaded by
4
- `develop/SKILL.md` when Full-Spec mode runs with `--parallel [N]`. Verified against
5
- live worktree-subagent behavior (spec `develop-parallel-wave`,
6
- `reports/worktree-spike.md`, 2026-07-19).
7
-
8
- ## 1. Preconditions (check before anything else)
9
-
10
- 1. `.claude/runtime.json` → `develop.parallel` is not `false` (escape hatch; missing
11
- key = allowed). If `false`: refuse `--parallel`, tell the user the hatch is active
12
- and which key controls it, then run the standard sequential loop.
13
- 2. The work context is a git repository and worktree isolation is available.
14
- Otherwise: state the reason ("not a git repo" / "isolation unavailable") and run
15
- the standard **sequential fallback**.
16
- 3. `--parallel N`: **wave cap** = N clamped to 1..5; default 3. Never exceed 5 —
17
- each subagent carries a ~200K context budget (orchestrator.md resource rule).
18
- 4. The destination tree must be clean (`git status --porcelain` is empty) and
19
- compatible with the selected base before dispatch. Record the destination
20
- `base_sha` and stop without mutation when cleanliness, repository, or base
21
- compatibility checks fail.
22
- 5. Before dispatch, state whether `--parallel` consent authorizes worker commits
23
- and orchestrator cherry-picks. If that consent is not explicit, obtain the
24
- separate confirmation before creating worktrees or asking workers to commit.
25
-
26
- ### Receipt contract (required per wave/task)
27
-
28
- Every task and wave receipt records these exact fields:
1
+ # Parallel waves — `hapo:develop --parallel`
2
+
3
+ Load this reference only for explicit parallel execution. The goal is bounded
4
+ concurrency with immutable provenance and one state writer.
5
+
6
+ ## Preconditions
7
+
8
+ 1. Confirm the work context is a Git repository and worktree isolation is
9
+ available. Otherwise state why and fall back to the sequential loop.
10
+ 2. Respect `.claude/runtime.json` `develop.parallel: false` when present.
11
+ 3. Clamp `--parallel N` to 1..5; default to 3.
12
+ 4. Require a clean destination and record its exact `base_sha`. Stop without
13
+ mutation if cleanliness or base compatibility fails.
14
+ 5. Confirm whether the user's parallel consent also authorizes worker commits
15
+ and controller cherry-picks before creating worktrees.
16
+
17
+ Every task receipt for a wave records:
29
18
 
30
19
  ```text
31
20
  base_sha: <destination commit before dispatch>
32
- head_sha: <latest worker/integration commit>
21
+ head_sha: <worker or integrated commit>
33
22
  branch: <worker branch>
34
- worktree_path: <retained or merged worktree path>
23
+ worktree_path: <path>
35
24
  commit_range: <base_sha>..<head_sha>
36
25
  retention: retained|released
37
26
  cleanup_authorization: pending|explicit-discard|merged-release
38
27
  ```
39
28
 
40
- Reviewer and tester commands MUST inspect `git diff <base_sha>..<head_sha>` (or
41
- `git diff --stat <base_sha>..<head_sha>`), never an ambient working-tree diff.
42
- Every fix is a new commit: advance `head_sha`, replace `commit_range`, and rerun
43
- only affected gates plus the wave integration check. A receipt without these
44
- fields is incomplete.
29
+ Test and review commands inspect `git diff <base_sha>..<head_sha>`, never an
30
+ ambient working-tree diff. A fix creates a new commit and advances Head.
45
31
 
46
- ## 2. Wave planning (normative)
47
-
48
- ```
49
- ready(t) = t.status == "pending" AND every dep in task_registry[t].dependencies
50
- has status == "done"
51
- candidates = ready tasks in task_registry order
52
- wave = first ≤cap candidates, EXCLUDING any task that conflicts with an
53
- earlier task already in the wave under the conflict graph below
54
- ```
32
+ ## Build a wave
55
33
 
56
- **Conflict graph.** A pair conflicts when either task writes the same exact file,
57
- one writes a directory another writes, or either touches a shared mutable surface:
58
- lockfiles, manifests/export barrels, migrations/registries, generated artifacts,
59
- or shared state writers. `Create`/`Modify`/`Delete` rows are writers; `Read` rows
60
- are still conflicts when they consume a mutable generated or registry surface.
61
- Normalize paths before comparison. If overlap is uncertain, classify it as a
62
- conflict and defer the task to the sequential fallback; never guess that two
63
- writers are independent.
34
+ Read dependencies from the plan task table and each flat task's
35
+ `## Dependencies`. A candidate is ready only when all named dependencies are
36
+ done with valid Receipts.
64
37
 
65
- **Single writer per file per wave** remains absolute. Read-only tasks can still
66
- be deferred when they inspect a directory or shared generated state that a sibling
67
- writes.
38
+ Add ready tasks in plan order up to the cap, excluding a task when it shares a
39
+ write target with an earlier task or touches the same mutable registry,
40
+ lockfile, manifest, generated output, migration, or export barrel. Normalize
41
+ paths. Uncertain overlap is a conflict, not an invitation to guess.
68
42
 
69
- If the wave is empty but pending tasks remain, dependencies or conflicts are
70
- unsatisfiable in parallel — finish them with the sequential loop and say so.
43
+ One file has one writer per wave. If no safe wave remains, use the sequential
44
+ loop and state the dependency or ownership conflict.
71
45
 
72
- ### Worked example
46
+ ## Dispatch
73
47
 
74
- Registry: A (deps: –), B (deps: –), C (deps: A), D (deps: – but shares
75
- `src/api/users.ts` Modify with B). Cap 3.
48
+ Each worker receives the complete task packet, work context, exact owned paths,
49
+ acceptance, Verification Plan, dependencies, and these constraints:
76
50
 
77
- - Wave 1 = A, B (D excluded: path collision with B; C excluded: dep on A)
78
- - Wave 2 = C, D (A done unblocks C; B done releases D's path)
51
+ 1. Work only in the assigned isolated worktree.
52
+ 2. Do not edit `plan.md`, task Status, or `## Receipt`; the controller owns
53
+ state and evidence synchronization.
54
+ 3. Do not touch a path outside granted ownership or undo another worker's edit.
55
+ 4. Run task-local prechecks and report exact commands and exits.
56
+ 5. Commit only when the user's authorization covers worker commits.
57
+ 6. Return status plus branch, worktree, Base, Head, range, and retention.
79
58
 
80
- ## 3. Dispatch (one implementer per wave task)
59
+ A blocked or failed worker keeps its identifiable worktree and branch. Never
60
+ force-delete it without merge success or explicit discard authorization.
81
61
 
82
- Every dispatch uses worktree isolation + background execution and a
83
- self-contained prompt per `rules/orchestrator.md` (task file content, design and
84
- requirements excerpts, work-context/specs/docs paths, acceptance criteria) plus
85
- these mandatory lines:
62
+ ## Verify before integration
86
63
 
87
- 1. "You are in an isolated git worktree. Implement ONLY this task."
88
- 2. "Do NOT edit `spec.json` or any `tasks/*.md` — the orchestrator owns spec state."
89
- 3. "Write only exact targets granted by this task's `Anchors and Ownership`
90
- table and typed ownership/parallel boundaries."
91
- 4. "When done, `git add` your changes and `git commit -m \"task(<id>): <title>\"` —
92
- an uncommitted worktree cannot be merged."
93
- 5. End with the standard `Status: DONE|CONCERNS|BLOCKED|NEEDS_INFO` block, plus
94
- the receipt fields from §1, including worktree path, branch, and commit range.
95
- 6. If a worker fails or blocks, do not remove its worktree or delete its branch.
96
- Mark `retention: retained` and `cleanup_authorization: pending` until merge
97
- succeeds or the user gives explicit discard authorization.
64
+ Inside each worktree, run the task's proof through `quality-gate.md` against the
65
+ immutable commit range. A task with missing proof, overlap, or unresolved High
66
+ or Critical finding is not eligible to integrate. Three failed repair rounds
67
+ collapse only that task; siblings may finish but do not erase its blocker.
98
68
 
99
- The orchestrator records `base_sha` immediately before dispatch. The worker's
100
- first accepted commit becomes `head_sha`; no receipt may use a moving ambient
101
- HEAD as a substitute. The Agent result returns `worktreePath` and
102
- `worktreeBranch`; record both in the receipt.
69
+ ## Integrate sequentially
103
70
 
104
- ## 4. Quality gate — inside the worktree, before merge
105
-
106
- Run the unchanged Stage A + Stage B gate (`references/quality-gate.md`) per task
107
- **with the task's worktree as working directory**. Before reviewing, tester and
108
- reviewer commands must inspect the receipt's immutable range:
71
+ Apply accepted worker commits one at a time in plan order:
109
72
 
110
73
  ```bash
111
- git diff --stat "$BASE_SHA..$HEAD_SHA"
112
- git diff "$BASE_SHA..$HEAD_SHA"
74
+ git cherry-pick <worker-commit>
113
75
  ```
114
76
 
115
- Do not replace this range with `git diff`, `git status`, or another ambient
116
- working-tree view. Gate evidence from that run feeds the task receipt. Three
117
- failed rounds → COLLAPSE protocol for that task only; sibling tasks in the wave
118
- keep running. Any fix creates a new commit and updates `head_sha`/`commit_range`
119
- before affected gates rerun.
77
+ On conflict, abort the cherry-pick, mark the task blocked, and retain its
78
+ worktree/branch. After success, update the receipt range to the integrated Head.
79
+ Release a worktree only after recording `cleanup_authorization: merged-release`.
120
80
 
121
- ## 5. Merge protocol (spike-verified — do not improvise)
81
+ ## Post-merge proof
122
82
 
123
- ⚠️ Spike finding: worktree branches are based on **`origin/<default-branch>`**
124
- (`worktree.baseRef: "fresh"` default), NOT the session HEAD. On repos whose origin
125
- default diverges, `git merge <agent-branch>` explodes into unrelated conflicts.
83
+ After the wave's last integration, run an affected integration command derived
84
+ from the tasks and repository contract. Record command, exit, Base, Head,
85
+ range, and output. Failure blocks the next wave.
126
86
 
127
- Therefore, for each gate-passed task, sequentially (one at a time, registry order):
87
+ Classify a failure before acting:
128
88
 
129
- ```bash
130
- git cherry-pick <agent-commit> # base-agnostic: applies only the agent's diff
131
- # conflict? → git cherry-pick --abort
132
- # → task_registry[task].status = "blocked", blocker = one-line conflict summary
133
- # → retain the worktree/branch; receipt says retention=retained
134
- ```
89
+ - `baseline`: reproduces from the recorded Base;
90
+ - `environment`: required tool, service, permission, or dependency unavailable;
91
+ - `spec`: acceptance or evidence contract is wrong or incomplete;
92
+ - `code`: implementation or integration regression.
135
93
 
136
- A successful merge may release the worktree and branch only after the receipt
137
- records `head_sha` at the merge result, the new `commit_range`, and
138
- `cleanup_authorization: merged-release`:
94
+ Do not blind-retry. Fix code/spec with a new commit and rerun affected proof;
95
+ record baseline/environment as blockers.
139
96
 
140
- ```bash
141
- git worktree remove .claude/worktrees/agent-<id>
142
- git branch -d worktree-agent-<id>
143
- ```
97
+ After the final wave, run the feature-level integration and reachability proof.
98
+ The controller then writes inline Receipts and Status updates one task at a
99
+ time. Worker reports are evidence inputs, not permission to claim done.
100
+
101
+ ## Legacy workflow compatibility
144
102
 
145
- Never use `--force` cleanup for failed or blocked work. Retain its identifiable
146
- worktree and branch for inspect/resume until the merge succeeds or the user
147
- explicitly authorizes discard; record `cleanup_authorization: explicit-discard`
148
- when that happens. Optionally set `worktree.baseRef: "head"` in settings;
149
- cherry-pick remains the recipe regardless.
150
-
151
- ## 6. Post-merge integration check (per wave)
152
-
153
- After the wave's last cherry-pick, run an affected integration command derived
154
- from the task's `Verification Plan` and repository contract (build or affected test
155
- subset; never the full suite mid-flight). Record command, `base_sha`, `head_sha`,
156
- range, and result in the wave receipt. Failure blocks the next wave.
157
-
158
- After the final wave, run an explicit feature/full integration command derived
159
- from the repository contract — for example the feature's exact verification suite
160
- or the repository's documented full test/build command. A final scout is not a
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:
163
-
164
- - `baseline` — reproduces from the recorded destination `base_sha`;
165
- - `environment` — tool, dependency, permission, or service unavailable;
166
- - `spec` — requirement, acceptance, or evidence contract mismatch;
167
- - `code` — implementation or integration regression.
168
-
169
- Do not blind-retry. Fix `code`/`spec` failures with a new commit and affected
170
- gates; record `baseline`/`environment` blockers and escalate or use the
171
- sequential fallback according to the task contract.
172
-
173
- ## 7. State sync — orchestrator is the single writer
174
-
175
- Only the orchestrator writes `spec.json` and task markdown, after each task's
176
- cherry-pick: registry `status`/`completed_at`/`last_updated_at`, task-md `Status`,
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
180
- unchanged — a receipt-less done blocks the turn. After syncing the wave, recompute
181
- §2 and continue until no pending tasks remain.
182
-
183
- ## 8. Failure summary
184
-
185
- | Event | Action |
186
- |---|---|
187
- | Escape hatch on / not a git repo / no isolation | Sequential fallback + stated reason |
188
- | Same-wave path collision | Defer the later task to next wave (§2) |
189
- | Gate fails 3× for a task | COLLAPSE for that task; retain worktree/branch and receipt; wave continues |
190
- | Worker failure or blocked task | Retain identifiable worktree/branch; no force-remove; classify and await resume or explicit discard |
191
- | Cherry-pick conflict | Abort pick; task `blocked` + conflict blocker; retain worktree/branch; wave continues |
192
- | Post-merge check fails | Classify baseline/environment/spec/code; no next wave until resolved or explicitly blocked |
193
- | Final integration fails | Record failure class and stop; do not claim completion from a final scout |
194
- | Empty wave, tasks pending | Sequential loop for the remainder + notice |
103
+ For an existing `spec.json` feature, readiness and dependencies come from the
104
+ persisted `task_registry` and typed `coordination.boundaries`. Workers still do
105
+ not edit that state. The controller writes the legacy separate task receipt,
106
+ synchronizes registry plus nested task Markdown, and creates the required final
107
+ feature receipt only after integrated proof.
@@ -1,99 +1,71 @@
1
- # Quality Gate — one closeout, separate proof and review
1
+ # Quality gate — one closeout, separate proof and review
2
2
 
3
- This reference is loaded at develop closeout. It is an executable contract, not
4
- a fixed actor checklist. Canonical v2.1 policy input is authoritative; lane and
5
- `execution_tier` are derived/read-only compatibility views.
3
+ Load this reference when closing a task or direct change. It defines ownership
4
+ and evidence, not a fixed agent sequence.
6
5
 
7
- ## Inputs and ownership
6
+ ## Ownership
8
7
 
9
- The single closeout owner receives the current scope, assurance, risk signals, blast
10
- radius, exact evidence commands, and the current diff. It calls the test owner
11
- once, then the review owner once when required. No parallel path, review path,
12
- or sync hook runs a duplicate hidden gate.
8
+ - **Test owner:** executes the named commands and is the sole producer of
9
+ execution proof.
10
+ - **Review owner:** evaluates correctness, security, scope, and reachability;
11
+ consumes proof but never creates it.
12
+ - **Closeout owner:** normalizes both results, writes the task Receipt and
13
+ Status, and reports docs impact.
13
14
 
14
- - **Test owner:** executes commands and creates the canonical execution receipt.
15
- - **Review owner:** evaluates correctness, security, scope, and spec compliance;
16
- consumes the receipt but never creates or claims execution proof.
17
- - **Closeout owner:** combines both results and performs one state/docs sync.
15
+ Use `PASS | PASS_WITH_WARNINGS | FAIL | BLOCKED`. Only literal PASS plus all
16
+ required proof can close. Review depth follows risk, blast radius, and repository
17
+ policy, not file count.
18
18
 
19
- Review depth follows assurance, risk, and blast radius, not the number of files or
20
- tasks. There is no fixed Light/Standard/Deep agent sequence. The shared verdict
21
- surface is `PASS | PASS_WITH_WARNINGS | FAIL | BLOCKED`; all adapters must use
22
- the same normalizer.
23
-
24
- ## Working directory (parallel mode)
25
-
26
- When an opt-in wave is active, each command runs in its task worktree. A
27
- collapse of one task does not cancel other in-flight tasks; merge and state
28
- synchronization remain single-writer operations.
29
-
30
- ## Required evidence
19
+ ## Required proof
31
20
 
32
21
  Before completion, verify:
33
22
 
34
- 1. compile/typecheck precheck and every exact command named by the active
35
- `Verification Plan`;
36
- 2. real runtime reachability and declared artifact inspection;
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;
41
- 4. correctness/security/spec review at the selected depth;
42
- 5. a real independent audit when `needsIndependentAudit` is persisted. The
43
- audit must use schema version `1`, distinct reviewer and implementation
44
- session IDs, matching expected Base/Head binding, concrete evidence, and
45
- literal `verdict: "PASS"`.
46
-
47
- `PRECHECK_FAIL` outranks no-tests. Missing, pending, marker-only, contradictory,
48
- or placeholder proof is unfinished. `Audit: PASS` is not an independent audit.
49
- `NO_TESTS` may be retained as a legacy diagnostic input, but it can never become
50
- the shared completion verdict `PASS`.
23
+ 1. applicable compile/typecheck and every exact task command;
24
+ 2. at least one real test when automated tests are required;
25
+ 3. runtime reachability through the declared entrypoint or consumer;
26
+ 4. negative/failure behavior named by Acceptance;
27
+ 5. artifact bytes and SHA-256 when the task declares an artifact;
28
+ 6. an inline `## Receipt` with `Verification: PASS`, exact `Command`, `Exit: 0`,
29
+ runtime-bound Base/Head, and non-empty fenced command output;
30
+ 7. correctness/security/scope review at the required depth.
51
31
 
52
- ## Spec compliance review
32
+ `PRECHECK_FAIL` outranks no-tests. Missing, pending, placeholder, contradictory,
33
+ zero-test, stale, copied, or marker-only proof is unfinished. A review PASS
34
+ cannot replace execution evidence.
53
35
 
54
- Check scope lock, requirements, design contracts, task Acceptance, Verification
55
- Plan, runtime reachability, and artifact/provenance boundaries. A missing or orphaned
56
- runtime deliverable is a failure even when compilation succeeds.
36
+ ## Review focus
57
37
 
58
- **Specific-task mode:** review exactly the requested task and its diff, then
59
- stop. Do not select a next task.
38
+ Check task Outcome, Scope, Acceptance, Dependencies, Verification Plan, changed
39
+ diff, and actual consumers. Treat an unmounted UI, unregistered route, uncalled
40
+ service, disconnected worker, missing export, or unconsumed artifact as a
41
+ reachability failure even when compilation passes.
60
42
 
61
- **Full-feature mode:** use the cumulative feature scope only at its closeout;
62
- intermediate synchronization does not claim feature completion. Run the Final
63
- Integration Scout when runtime-facing surfaces exist.
43
+ Apply security checks relevant to the touched boundary: auth and tenant scope,
44
+ input validation, secret redaction, path containment and symlinks, atomic writes,
45
+ concurrency, cleanup, and safe error behavior. Do not add unrelated ceremony.
64
46
 
65
- ## Correctness and security review
47
+ Specific-task mode reviews only that task and stops. Full-feature mode uses
48
+ cumulative scope only for the final integration check.
66
49
 
67
- Apply only the checks relevant to the touched boundary. For logging/redaction,
68
- check safe identifiers, quoted schemes, idempotence, and receipt secrecy. For
69
- filesystem writes, check lexical and canonical containment, symlink rejection,
70
- atomic same-directory replacement, cleanup, and canonical return paths. Add
71
- auth, persistence, provider, or concurrency checks only when scope/risk requires.
72
-
73
- ## Quality cycle
50
+ ## Repair cycle
74
51
 
75
52
  ```text
76
- retry_count = 0
77
- while closeout is not PASS:
78
- test owner executes required proof once
79
- if proof is BLOCKED: stop without blind retry
80
- review owner evaluates correctness/security/spec once
81
- if FAIL: fix only the affected scope and rerun affected proof/review
82
- if retry_count reaches 3: stop and request user intervention
53
+ test owner runs required proof once
54
+ if BLOCKED: record prerequisite and stop
55
+ if FAIL: repair the observed cause and rerun affected proof
56
+ review owner evaluates the proven diff once
57
+ if review FAIL: repair affected scope and rerun affected proof/review
58
+ after three failed repair rounds: stop and request user direction
83
59
  ```
84
60
 
85
- Only `FAIL` enters remediation. `BLOCKED` is terminal until its prerequisite
86
- changes. `PASS_WITH_WARNINGS` is a review result only and remains unfinished;
87
- only literal `PASS` may close when all execution and policy obligations are
88
- complete.
89
-
90
- ## Flash Gate (`--flash`)
61
+ `PASS_WITH_WARNINGS` may report non-blocking observations but remains
62
+ unfinished for state synchronization. Never retry an unchanged environment to
63
+ manufacture a green result.
91
64
 
92
- Use only when the flag is explicit. Skip dedicated tests, full evidence
93
- execution, extended UI/manual checks, and review retry loops. Still perform a
94
- cheap preflight and scope/reachability sanity check.
65
+ ## Flash gate
95
66
 
96
- The flash record must contain exactly the unfinished semantics:
67
+ With explicit `--flash`, run only a cheap available preflight and a basic
68
+ scope/reachability check. Record:
97
69
 
98
70
  ```text
99
71
  Mode: --flash
@@ -101,54 +73,22 @@ Tests: skipped by user request
101
73
  Evidence: FLASH_UNVERIFIED
102
74
  Status: in_progress
103
75
  Blocker: awaiting /hapo:test <feature>
104
- Next verification: /hapo:test <feature>
105
- ```
106
-
107
- The persisted flash input must also contain `dependencyBlocked: true`,
108
- `unblocks: false`, and a non-placeholder blocker, and must omit
109
- `readyForSync`, `flashTransition`, and `promotionReceipt`. Sync-finalize
110
- rejects minimal or caller-pre-promoted states.
111
-
112
- Terminal log:
113
-
114
- ```text
115
- ⚡ Step 4 Flash Gate: tests skipped by --flash; preflight=<pass|skipped>; evidence=FLASH_UNVERIFIED
116
76
  ```
117
77
 
118
- Do not report `Test PASS`, `Evidence PASS`, `Auto-Approved`, or
119
- `production-ready`. Flash never sets `done`, unblocks dependents, or promotes
120
- from a marker. Trusted sync-finalize alone may consume a fresh canonical PASS
121
- receipt and derive promotion.
122
-
123
- ## Closeout and docs impact
124
-
125
- After the test receipt and review verdict are both available, the closeout owner
126
- uses the policy adapter and synchronizes state. A review-only pass cannot close
127
- missing execution proof. Evaluate docs impact from the actual behavior change:
128
-
129
- - `none`: record no docs edit and stop;
130
- - `minor` or `major`: update only affected existing docs through the normal docs
131
- workflow.
132
-
133
- Do not run a docs checkpoint merely because a task completed. Do not refresh the
134
- whole repository for a local change.
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.
78
+ Flash does not write a PASS receipt, mark done, unblock dependents, or report
79
+ production readiness. Trusted sync-finalize may promote only after fresh proof
80
+ passes the same receipt contract above.
141
81
 
142
- ## Review threshold
82
+ ## Docs impact and C3
143
83
 
144
- `PASS` requires no Critical or High correctness/security/spec finding and no
145
- blocking Medium finding. `PASS_WITH_WARNINGS` may carry documented non-blocking
146
- findings. Finding count never selects review depth or overrides missing proof.
147
- Any missing proof, unresolved obligation, scope drift, contract substitution, or
148
- reachability failure remains unfinished regardless of review severity.
84
+ After proof and review, classify docs impact as `none`, `minor`, or `major`.
85
+ Update only affected existing docs when impact is not none. Show the user the
86
+ current command evidence and limitations at C3; do not infer approval from a
87
+ receipt.
149
88
 
150
- ### Reachability Failure
89
+ ## Legacy workflow compatibility
151
90
 
152
- An unmounted UI, unregistered route, uncalled service/loader, disconnected
153
- worker/command/provider/reducer, missing artifact consumer, or other orphaned
154
- runtime-facing output is a review failure.
91
+ Existing kernel packets keep their separate `receipts/<task-basename>.md`, task
92
+ identity/path metadata, final `feature-receipt.md`, persisted independent-audit
93
+ obligations, and completion-authority checks. The same proof/review ownership
94
+ applies. Do not copy that storage shape into a flat process-first task.
@@ -1,51 +1,44 @@
1
1
  # Capability dispatch patterns
2
2
 
3
- This reference is optional. Load it only when the persisted lane requires
4
- independent capability work. Role names are runtime configuration, not workflow
5
- policy: resolve them from the installed catalog instead of hardcoding an actor
6
- name or a sequence in a skill.
3
+ Load this optional reference only when a task benefits from independent
4
+ inspection, implementation, verification, review, or docs capability. Runtime
5
+ role names are configuration, not workflow policy.
7
6
 
8
- ## Dispatch contract
7
+ ## Dispatch packet
9
8
 
10
- Every dispatch prompt includes:
9
+ Every dispatch includes:
11
10
 
12
- - Work context: the git root of the primary files;
13
- - Reports path: `<work-context>/plans/reports/`;
14
- - Plans path: `<work-context>/plans/`;
15
- - exact task/scope and owned files;
16
- - lane snapshot, risk/blast-radius obligations, and stop conditions;
17
- - required output, evidence, and status.
11
+ - work context and reports/plans paths;
12
+ - exact task outcome, scope, acceptance, and dependencies;
13
+ - owned read/write paths and explicit exclusions;
14
+ - risk, blast radius, stop conditions, and required evidence;
15
+ - expected status and handoff format.
18
16
 
19
- Use a capability request such as:
20
-
21
- ```text
22
- dispatch(capability="inspection|implementation|verification|review|docs",
23
- work_context="<root>",
24
- scope="<task or feature>",
25
- owned_files=["<paths>"],
26
- obligations=["<persisted obligations>"],
27
- output="<required packet and evidence>")
28
- ```
29
-
30
- The runtime may map a capability to a local role. That mapping must not change
31
- the lane, add ceremony, or become a new persisted policy field.
17
+ Use one capability per concrete responsibility. The runtime may map it to an
18
+ available local role, but that mapping cannot add scope or weaken proof.
32
19
 
33
20
  ## Independence and ownership
34
21
 
35
- - Inspection may report entrypoints and blast radius but does not edit source.
36
- - Implementation edits only the active task scope and does not sync state.
37
- - Verification is the sole producer of canonical execution proof.
38
- - Review consumes proof and reports correctness/security/spec findings only.
39
- - Documentation work is invoked only after a real docs-impact decision.
22
+ - Inspection traces entrypoints and risks without editing source.
23
+ - Implementation edits only granted paths and does not write task state.
24
+ - Verification is the sole producer of executable proof.
25
+ - Review consumes proof and reports findings without claiming execution.
26
+ - Documentation starts only after a real docs-impact decision.
27
+ - The controller alone writes Status and inline Receipt.
40
28
 
41
- Specific-task mode ends after one task. Full-feature mode may continue only
42
- after the closeout owner synchronizes the current task and finds another
43
- unblocked task. A capability result marked `PENDING`, `BLOCKED`, or lacking
44
- provenance cannot be converted into PASS by the controller.
29
+ A specific-task invocation ends after that task. Full-feature execution may
30
+ continue only after the current task is synchronized and the next dependency
31
+ set is recomputed.
45
32
 
46
33
  ## Safe fallback
47
34
 
48
- If the required capability or isolated workspace is unavailable, keep the
49
- workflow in `BLOCKED` or run the permitted main-session check. Do not substitute
50
- a model, profile, or actor silently, and do not claim an independent result
51
- without an actually independent execution.
35
+ If a required capability or isolated workspace is unavailable, record BLOCKED
36
+ or run only a permitted main-session check. Never silently substitute an actor
37
+ for an independence requirement. A PENDING, BLOCKED, or provenance-free result
38
+ cannot be normalized to PASS.
39
+
40
+ ## Legacy workflow compatibility
41
+
42
+ When the selected packet is legacy, include its persisted lane snapshot and
43
+ obligations in the dispatch, but do not let workers edit that state or infer an
44
+ independent result from a role label.
@@ -73,7 +73,7 @@ If `unclear`, ask one focused follow-up with the minimum choices needed.
73
73
 
74
74
  Repo evidence priority:
75
75
  1. `README.md`, `AGENTS.md`, `CLAUDE.md`
76
- 2. relevant `docs/`, `specs/`, `.claude/`, `.opencode/`
76
+ 2. relevant `docs/`, `specs/`, `.claude/`
77
77
  3. source files, tests, scripts, package manifests, config files
78
78
  4. git history only when the question asks about changes or provenance
79
79