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

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 (51) hide show
  1. package/bin/__tests__/codex-hooks.test.js +355 -12
  2. package/bin/__tests__/codex-native.test.js +1 -1
  3. package/bin/__tests__/develop-contract.test.js +1374 -78
  4. package/bin/__tests__/installer-safety.test.js +43 -29
  5. package/bin/__tests__/opencode-spec-gate.test.js +791 -0
  6. package/bin/__tests__/package-inventory.test.js +157 -0
  7. package/bin/__tests__/validator-grounding.test.js +707 -2
  8. package/package.json +1 -1
  9. package/src/claude/agents/code-auditor.md +8 -1
  10. package/src/claude/agents/spec-maker.md +107 -200
  11. package/src/claude/hooks/__tests__/completion-authority.test.js +720 -0
  12. package/src/claude/hooks/__tests__/spec-gate.test.js +511 -38
  13. package/src/claude/hooks/completion-authority-check.cjs +307 -0
  14. package/src/claude/hooks/completion-authority-state.cjs +525 -0
  15. package/src/claude/hooks/completion-authority.cjs +148 -0
  16. package/src/claude/hooks/session.cjs +33 -19
  17. package/src/claude/hooks/spec-gate.cjs +173 -61
  18. package/src/claude/hooks/spec-state.cjs +104 -45
  19. package/src/claude/migration-manifest.json +6 -1
  20. package/src/claude/scripts/provenance.cjs +315 -0
  21. package/src/claude/scripts/spec-resolver.cjs +450 -0
  22. package/src/claude/scripts/spec-scaffold.cjs +716 -41
  23. package/src/claude/scripts/validate-spec-output.cjs +355 -53
  24. package/src/claude/scripts/workflow-policy.cjs +1529 -162
  25. package/src/claude/settings/settings.json +8 -0
  26. package/src/claude/skills/backend-development/references/backend-security.md +52 -0
  27. package/src/claude/skills/code-review/SKILL.md +85 -66
  28. package/src/claude/skills/develop/SKILL.md +153 -285
  29. package/src/claude/skills/develop/references/quality-gate.md +112 -124
  30. package/src/claude/skills/develop/references/subagent-patterns.md +42 -37
  31. package/src/claude/skills/specs/SKILL.md +170 -381
  32. package/src/claude/skills/specs/rules/task-scoring-rubric.md +45 -46
  33. package/src/claude/skills/specs/rules/tasks-generation.md +49 -20
  34. package/src/claude/skills/specs/templates/spec-state.json +23 -2
  35. package/src/claude/skills/specs/templates/task.md +20 -0
  36. package/src/claude/skills/sync/SKILL.md +15 -8
  37. package/src/claude/skills/sync/references/sync-protocols.md +4 -4
  38. package/src/claude/skills/test/SKILL.md +141 -167
  39. package/src/codex/hooks/completion-authority-check.cjs +260 -0
  40. package/src/codex/hooks/completion-authority-state.cjs +525 -0
  41. package/src/codex/hooks/completion-authority.cjs +100 -0
  42. package/src/codex/hooks/lib/hook-context.cjs +42 -2
  43. package/src/codex/hooks/lib/spec-receipt.cjs +76 -43
  44. package/src/codex/hooks/lib/spec-utils.cjs +53 -27
  45. package/src/codex/hooks/session.cjs +2 -0
  46. package/src/codex/hooks/spec-gate.cjs +132 -20
  47. package/src/codex/hooks/spec-state.cjs +56 -10
  48. package/src/codex/hooks.json +10 -0
  49. package/src/opencode/AGENTS.md +4 -2
  50. package/src/opencode/plugins/spec-gate.ts +296 -122
  51. package/src/opencode/plugins/spec-state.ts +183 -116
@@ -1,159 +1,147 @@
1
- # Quality Gate — Task Evidence + Two-Stage Review Loop
1
+ # Quality Gate — one closeout, separate proof and review
2
2
 
3
- This is the critical checkpoint protecting codebase quality at Step 4 of `hapo:develop`.
4
- Runs AUTOMATICALLY. Only escalates to user after 3 consecutive failures or a critical block.
5
- Green tests are NOT enough. The gate requires four proofs:
6
- 1. Automated verification (typecheck/test/build)
7
- 2. Spec compliance review (scope/task/design adherence)
8
- 3. Code quality review
9
- 4. Task evidence (completion criteria + runtime/artifact/reachability proof from the task file)
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.
10
6
 
11
- `--flash` is the explicit fast path. It bypasses this full gate and uses the Flash Gate defined below.
7
+ ## Inputs and ownership
12
8
 
13
- Executable policy source: `src/claude/scripts/workflow-policy.cjs` (installed as `.claude/scripts/workflow-policy.cjs`). Use its tier delegation, verdict consumer, flash conflict, and promotion semantics; do not duplicate policy in prose or tests.
9
+ The single closeout owner receives the current scope, lane, 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.
14
13
 
15
- ## Tier input (from develop Delegation policy)
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.
16
18
 
17
- Quality-gate input MUST include `execution_tier` and `ship_point`:
19
+ Review depth follows lane, 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.
18
23
 
19
- - **Light:** main session runs verification commands and the same spec-compliance checklist. Spawn zero `test-runner` or `code-auditor` subagents.
20
- - **Standard:** main session runs tests and spec checks. At the ship point, run exactly one combined `code-auditor` review for spec compliance plus code quality.
21
- - **Deep / `--parallel`:** retain the documented per-worktree Stage A+B chain in Track A. Do not treat that chain as a permanent product contract.
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
31
+
32
+ Before completion, verify:
22
33
 
23
- Checklist and FAIL conditions stay identical for every tier; tier changes only who executes each check and when.
34
+ 1. compile/typecheck precheck and every exact command named by the active
35
+ Evidence section;
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;
40
+ 4. correctness/security/spec review at the selected depth;
41
+ 5. a real independent audit when `needsIndependentAudit` is persisted. The
42
+ audit must use schema version `1`, distinct reviewer and implementation
43
+ session IDs, matching expected Base/Head binding, concrete evidence, and
44
+ literal `verdict: "PASS"`.
45
+
46
+ `PRECHECK_FAIL` outranks no-tests. Missing, pending, marker-only, contradictory,
47
+ or placeholder proof is unfinished. `Audit: PASS` is not an independent audit.
48
+ `NO_TESTS` may be retained as a legacy diagnostic input, but it can never become
49
+ the shared completion verdict `PASS`.
24
50
 
25
51
  ## Spec compliance review
26
52
 
27
- Stage A applies same spec compliance review checklist for every tier: scope, requirements, completion criteria, evidence, and runtime reachability. A missing or unreachable deliverable is a FAIL.
53
+ Check scope lock, requirements, design contracts, completion criteria, evidence,
54
+ runtime reachability, and artifact/provenance boundaries. A missing or orphaned
55
+ runtime deliverable is a failure even when compilation succeeds.
56
+
57
+ **Specific-task mode:** review exactly the requested task and its diff, then
58
+ stop. Do not select a next task.
28
59
 
60
+ **Full-feature mode:** use the cumulative feature scope only at its closeout;
61
+ intermediate synchronization does not claim feature completion. Run the Final
62
+ Integration Scout when runtime-facing surfaces exist.
29
63
 
30
- - **Specific-task mode:** requested task is ship point. Review that task packet and its diff exactly once.
31
- - **Full-spec Standard:** intermediate tasks receive only the main-session gate. After the final task and Final Integration Scout, run one combined auditor over the cumulative feature diff, all acceptance criteria, and runtime reachability.
32
- - Do not set feature-level `code_done` or completion before combined auditor returns `PASS`.
33
- - Auditor `FAIL` maps each finding to its owning task/surface. Fix only affected evidence, then rerun affected checks and the combined review; do not replay unrelated gates already passed.
64
+ ## Correctness and security review
34
65
 
35
- ## Automation Semantics
66
+ Apply only the checks relevant to the touched boundary. For logging/redaction,
67
+ check safe identifiers, quoted schemes, idempotence, and receipt secrecy. For
68
+ filesystem writes, check lexical and canonical containment, symlink rejection,
69
+ atomic same-directory replacement, cleanup, and canonical return paths. Add
70
+ auth, persistence, provider, or concurrency checks only when lane/risk requires.
36
71
 
37
- - If the task names exact commands in `## Evidence` (legacy heading aliases still parse), those exact commands are mandatory and must run before any fallback repo defaults.
38
- - Preflight compile/typecheck/build health is mandatory. If compile/typecheck/build fails before tests are meaningful, the gate result is `PRECHECK_FAIL`, not `NO_TESTS`.
39
- - `NO_TESTS` is never an automatic PASS.
40
- - `NO_TESTS` is acceptable only when the task does **not** require a dedicated test suite command and every other required automated command/evidence item passes.
41
- - If the task explicitly requires tests and the repo has no such test command or suite, the task is FAIL or BLOCKED, not done.
42
- - If the task kind implies a concrete test type, the gate must enforce it: unit tests for logic/regression, component or integration tests for stateful UI or cross-module wiring, E2E/UI-flow checks for complete user workflows, visual/responsive checks for layout/theme work, accessibility checks for interactive UI, and smoke checks for scaffold/config. Performance/security checks are mandatory only when specified by requirement/risk/boundary.
43
- - Named frameworks, auth systems, transports, datastores, and runtime boundaries in the task/spec are contractual. Silent substitutions are review failures, not acceptable implementation trade-offs.
44
- - Multi-process or multi-runtime flows must prove shared real state or a real boundary contract. Matching in-memory placeholders on both sides do not count as working integration.
45
- - Scope fidelity is mandatory: missing scoped behavior, extra unapproved behavior, or task output that exists only as orphaned/unreachable code is a review failure even when build/tests pass.
46
- - Runtime-facing artifacts must be reachable from the real entrypoint/caller named by the task or the task-aware scout report.
72
+ ## Quality cycle
73
+
74
+ ```text
75
+ retry_count = 0
76
+ while closeout is not PASS:
77
+ test owner executes required proof once
78
+ if proof is BLOCKED: stop without blind retry
79
+ review owner evaluates correctness/security/spec once
80
+ if FAIL: fix only the affected scope and rerun affected proof/review
81
+ if retry_count reaches 3: stop and request user intervention
82
+ ```
83
+
84
+ Only `FAIL` enters remediation. `BLOCKED` is terminal until its prerequisite
85
+ 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
+ complete.
47
88
 
48
89
  ## Flash Gate (`--flash`)
49
90
 
50
- Use this only when `/hapo:develop ... --flash` is present.
51
-
52
- - Skip dedicated test commands, E2E/browser/manual QA, full task evidence execution, test-runner delegation, and code-auditor retry loops.
53
- - Do not report `Test PASS`, `Evidence PASS`, `Auto-Approved`, or `production-ready`.
54
- - Still perform a scope sanity check against active task Completion Criteria.
55
- - Still perform a reachability sanity check for runtime-facing files: imported, mounted, registered, routed, or invoked where applicable.
56
- - Run a cheap compile/syntax/typecheck/build command only when available and expected to complete quickly without dependency install or external services.
57
- - If the cheap preflight fails, return to implementation; do not sync.
58
- - If the cheap preflight is unavailable or too slow, record `Preflight: skipped in --flash mode`.
59
- - Sync only with receipt fields:
60
- - `Mode: --flash`
61
- - `Tests: skipped by user request`
62
- - `Evidence: FLASH_UNVERIFIED`
63
- - `Status: in_progress`
64
- - `Blocker: awaiting /hapo:test <feature>`
65
- - `Next verification: /hapo:test <feature>`
91
+ Use only when the flag is explicit. Skip dedicated tests, full evidence
92
+ execution, extended UI/manual checks, and review retry loops. Still perform a
93
+ cheap preflight and scope/reachability sanity check.
66
94
 
67
- Terminal log:
95
+ The flash record must contain exactly the unfinished semantics:
68
96
 
69
97
  ```text
70
- ⚡ Step 4 Flash Gate: tests skipped by --flash; preflight=<pass|skipped>; evidence=FLASH_UNVERIFIED
98
+ Mode: --flash
99
+ Tests: skipped by user request
100
+ Evidence: FLASH_UNVERIFIED
101
+ Status: in_progress
102
+ Blocker: awaiting /hapo:test <feature>
103
+ Next verification: /hapo:test <feature>
71
104
  ```
72
105
 
73
- ## Quality Cycle
106
+ The persisted flash input must also contain `dependencyBlocked: true`,
107
+ `unblocks: false`, and a non-placeholder blocker, and must omit
108
+ `readyForSync`, `flashTransition`, and `promotionReceipt`. Sync-finalize
109
+ rejects minimal or caller-pre-promoted states.
74
110
 
75
- Maximum retry counter: **3 attempts**. Exceeding 3 triggers a collapse warning.
111
+ Terminal log:
76
112
 
77
113
  ```text
78
- Variable: retry_count = 0
79
-
80
- Before START_LOOP:
81
- - Read the active task file(s)
82
- - Extract Related Files, Completion Criteria, `## Evidence` (legacy heading aliases still parse)
83
- - Extract the exact executable verification commands in declaration order
84
- - Extract relevant design contracts/invariants for the touched area
85
- - Extract scope_lock, requirement IDs, runtime entrypoints/callers, and reachability proof obligations
86
- - If any of these are missing or too vague to verify, FAIL immediately and route back to spec correction
87
-
88
- START_LOOP:
89
- ---------------------------------------------------------------
90
- STAGE A: Test + SPEC COMPLIANCE review
91
- ---------------------------------------------------------------
92
- → Light: main session executes exact Evidence commands, spec checklist,
93
- artifact checks, and reachability checks; spawn 0 subagents.
94
- → Standard: main session executes exact Evidence commands and spec checklist;
95
- defer one combined auditor to the ship point.
96
- → Deep / --parallel: run the documented per-task sequence `inspector → implementer → test-runner → code-auditor` in the
97
- task worktree, then preserve its documented merge/integration gates.
98
-
99
- Test result and review result use the review enum only: PASS | FAIL | BLOCKED.
100
- PASS proceeds. FAIL returns actionable findings to implementer. BLOCKED means
101
- execution proof, permissions, environment, or a user-owned decision is missing:
102
- stop immediately and do not blind-retry.
103
-
104
- Standard specific-task ship point:
105
- → run exactly one combined code-auditor review after Stage A PASS.
106
- Standard full-spec ship point:
107
- → run exactly one combined code-auditor review after the final task and
108
- Final Integration Scout over the cumulative feature diff.
109
-
110
- CASE 1 — PRECHECK_FAIL OR Automated FAIL OR required command missing OR Evidence FAIL / UNVERIFIED OR Reachability FAIL:
111
- - For FAIL: increment retry_count; return to implementation while retry_count < 3.
112
- - For BLOCKED: stop without retry; record blocker and await resolution.
113
- - If retry_count >= 3: COLLAPSE and ask for user intervention.
114
-
115
- CASE 2 — Test PASS + Evidence PASS + spec checklist PASS:
116
- → Proceed to the ship-point review for Standard, or the Deep Stage B review.
117
-
118
- STAGE B:
119
- ---------------------------------------------------------------
120
- CODE QUALITY REVIEW (only after spec compliance passes)
121
- ---------------------------------------------------------------
122
- Standard uses the combined auditor described above; Deep retains the existing
123
- Stage B quality review chain inside each worktree.
124
- → PASS = no Critical, no High, at most one Medium; proceed to sync.
125
- → FAIL = findings mapped to task/surface; fix affected scope and rerun only
126
- affected evidence plus this combined review.
127
- → BLOCKED = missing proof/permission/environment/user decision; stop, no blind retry.
114
+ ⚡ Step 4 Flash Gate: tests skipped by --flash; preflight=<pass|skipped>; evidence=FLASH_UNVERIFIED
128
115
  ```
129
116
 
130
- ## Critical Issue Definitions
117
+ Do not report `Test PASS`, `Evidence PASS`, `Auto-Approved`, or
118
+ `production-ready`. Flash never sets `done`, unblocks dependents, or promotes
119
+ from a marker. Trusted sync-finalize alone may consume a fresh canonical PASS
120
+ receipt and derive promotion.
131
121
 
132
- - **Security:** XSS vulnerabilities, SQL injection, leaked env tokens/secrets.
133
- - **Performance:** Bottlenecks, O(n^3) algorithms, unbounded loops over DB calls.
134
- - **Architecture:** Breaking MVC boundaries, cross-module coupling, convention violations.
135
- - **Principles:** YAGNI violations, KISS violations, DRY violations (excessive code duplication).
136
- - **Evidence / Done-Criteria Drift:** Missing required artifacts, placeholder-only wiring, missing entrypoints, unproven completion criteria, or runtime contract mismatches.
137
- - **Reachability Failure:** Orphan components/services/hooks/routes/workers/commands/providers/reducers, unmounted UI, unregistered routes, uncalled data loaders, unused providers, disconnected actions, or any runtime-facing artifact that cannot be reached from the declared entrypoint/caller.
138
- - **Scope Drift:** Scoped acceptance criteria omitted, behavior added outside `scope_lock`, or a task marked complete while part of its approved requirement remains unwired.
139
- - **Overscope Delivery Drift:** Implementing later-task deliverables or editing out-of-scope files without direct justification for the active task packet.
140
- - **Contract Substitution Drift:** Replacing a named framework/auth/transport/datastore/runtime boundary with a custom simplification without a spec amendment.
141
- - **Cross-Service Reality Failure:** Claiming end-to-end behavior across web/api/worker/extension boundaries while state only exists in local process memory or placeholder adapters.
122
+ ## Closeout and docs impact
142
123
 
143
- ## Terminal Log Format
124
+ After the test receipt and review verdict are both available, the closeout owner
125
+ uses the policy adapter and synchronizes state. A review-only pass cannot close
126
+ missing execution proof. Evaluate docs impact from the actual behavior change:
144
127
 
145
- Must log the Quality Gate result to the terminal for user visibility:
128
+ - `none`: record no docs edit and stop;
129
+ - `minor` or `major`: update only affected existing docs through the normal docs
130
+ workflow.
146
131
 
147
- - **Quick Pass:** `✓ Step 4 Quality Gate: Test PASS + Evidence PASS + Spec PASS + Review PASS (no Critical, no High, at most one Medium) - Auto-Approved`
148
- - **Hard-Won Pass:** `✓ Step 4 Quality Gate: Failed 2 rounds → Test PASS + Evidence PASS + Spec PASS + Review PASS (no Critical, no High, at most one Medium)`
149
- - **Preflight Fail:** `[x] Step 4 Quality Gate: PRECHECK_FAIL → compile/typecheck/build failed before tests mattered`
150
- - **Fix Needed:** `[~] Step 4 Quality Gate: Tests/spec/evidence failed → returned to implementer`
151
- - **Awaiting Rescue:** `[!] Step 4 Quality Gate: Failed 3 rounds! Awaiting user intervention...`
132
+ Do not run a docs checkpoint merely because a task completed. Do not refresh the
133
+ whole repository for a local change.
152
134
 
153
- ## Working directory (parallel mode)
135
+ ## Review threshold
154
136
 
155
- When `hapo:develop` runs in Parallel Wave Mode (`references/parallel-waves.md`), every Stage A and Stage B command for a task executes **with that task's worktree as the working directory**. Gate evidence recorded from the worktree run feeds the task's verification receipt. Thresholds, retry counter, and the COLLAPSE protocol are identical to sequential mode. A COLLAPSE of one task does not cancel other in-flight tasks of the wave.
137
+ `PASS` requires no Critical or High correctness/security/spec finding and no
138
+ blocking Medium finding. `PASS_WITH_WARNINGS` may carry documented non-blocking
139
+ findings. Finding count never selects review depth or overrides missing proof.
140
+ Any missing proof, unresolved obligation, scope drift, contract substitution, or
141
+ reachability failure remains unfinished regardless of review severity.
156
142
 
157
- ## Post-merge integration check (per wave)
143
+ ### Reachability Failure
158
144
 
159
- After the orchestrator cherry-picks the last gate-passed task of a wave: run the project build **or** the affected test subset (never the full suite mid-flight — it runs once at develop completion). While this check fails, the next wave MUST NOT start.
145
+ An unmounted UI, unregistered route, uncalled service/loader, disconnected
146
+ worker/command/provider/reducer, missing artifact consumer, or other orphaned
147
+ runtime-facing output is a review failure.
@@ -1,46 +1,51 @@
1
- # Subagent Invocation Patterns
1
+ # Capability dispatch patterns
2
2
 
3
- Standard prompt templates for delegating work to subagents within the develop workflow.
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.
4
7
 
5
- ## Agent Tool Pattern
6
- Use the current Claude Code `Agent` tool for subagent invocation. In older runtimes, the same shape may appear as legacy `Task`.
7
- ```
8
- Agent(subagent_type="[agent-name]", prompt="[task description]", description="[short title]")
9
- ```
8
+ ## Dispatch contract
10
9
 
11
- ## Codebase Inspection Phase
12
- ```
13
- Agent(subagent_type="inspector", prompt="Scan and identify all files related to [feature-name] in the current codebase.", description="Scout [feature-name]")
14
- ```
10
+ Every dispatch prompt includes:
15
11
 
16
- ## Code Implementation Phase
17
- ```
18
- Agent(subagent_type="implementer", prompt="Implement the sub-tasks from [tasks-directory] based on the specification in [spec.json]", description="Code Feature [feature]")
19
- ```
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.
20
18
 
21
- ## UI Implementation Phase
22
- ```
23
- Agent(subagent_type="ui-ux-designer", prompt="Implement the frontend code for [feature] following ./docs/design-guidelines.md", description="Code UI [feature]")
24
- ```
19
+ Use a capability request such as:
25
20
 
26
- ## Code Review Phase
27
- ```
28
- Agent(subagent_type="code-auditor", prompt="Review all recently written code. Check for security holes, performance issues, and adherence to YAGNI/KISS/DRY. Return a verdict (PASS = no Critical, no High, at most one Medium), severity-classified findings, and concrete suggestions.", description="Review [phase]")
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>")
29
28
  ```
30
29
 
31
- ## Test Execution Phase
32
- ```
33
- Agent(subagent_type="test-runner",
34
- prompt="Run tests for recently implemented code. Apply blast-radius scoping
35
- unless --full is requested. Return structured verdict with Status, Results,
36
- Coverage, Failures, and Action.",
37
- description="Test [feature]")
38
- ```
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.
39
32
 
40
- ## Parallel Quality Gate (Step 4)
41
- Spawn both simultaneously — do NOT wait for one before starting the other:
42
- ```
43
- Agent(subagent_type="test-runner", prompt="...", description="Test [feature]")
44
- Agent(subagent_type="code-auditor", prompt="...", description="Review [feature]")
45
- ```
46
- Wait for both results → apply quality-gate.md combine logic.
33
+ ## Independence and ownership
34
+
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.
40
+
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.
45
+
46
+ ## Safe fallback
47
+
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.