@haposoft/cafekit 0.16.0-rc.2 → 0.16.0-rc.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/__tests__/codex-hooks.test.js +794 -21
- package/bin/__tests__/codex-native.test.js +228 -7
- package/bin/__tests__/develop-contract.test.js +1838 -112
- package/bin/__tests__/installer-safety.test.js +82 -29
- package/bin/__tests__/opencode-spec-gate.test.js +799 -0
- package/bin/__tests__/package-inventory.test.js +841 -10
- package/bin/__tests__/specs-v2-execution-closeout.test.js +421 -0
- package/bin/__tests__/specs-v2-policy-and-scaffold.test.js +601 -0
- package/bin/__tests__/specs-v2-validator-grounder-contract.test.js +952 -0
- package/bin/__tests__/test-runtime-dependency-closure.cjs +182 -0
- package/bin/__tests__/validator-grounding.test.js +2469 -71
- package/bin/lib/managed-writer.js +12 -3
- package/bin/phases/codex-runtime.js +17 -1
- package/package.json +1 -1
- package/src/claude/CLAUDE.md +6 -0
- package/src/claude/agents/code-auditor.md +20 -0
- package/src/claude/agents/spec-maker.md +153 -202
- package/src/claude/hooks/__tests__/completion-authority.test.js +953 -0
- package/src/claude/hooks/__tests__/privacy-block.test.js +172 -0
- package/src/claude/hooks/__tests__/semantic-review-authority.test.js +257 -0
- package/src/claude/hooks/__tests__/spec-gate.test.js +604 -56
- package/src/claude/hooks/completion-authority-check.cjs +56 -0
- package/src/claude/hooks/completion-authority-state.cjs +527 -0
- package/src/claude/hooks/completion-authority.cjs +154 -0
- package/src/claude/hooks/docs-sync.cjs +5 -2
- package/src/claude/hooks/lib/privacy-command-analysis.cjs +393 -0
- package/src/claude/hooks/lib/runtime-path-safety.cjs +119 -0
- package/src/claude/hooks/privacy-block.cjs +77 -30
- package/src/claude/hooks/semantic-review-authority.cjs +152 -0
- package/src/claude/hooks/session.cjs +33 -19
- package/src/claude/hooks/spec-gate.cjs +181 -139
- package/src/claude/hooks/spec-state.cjs +112 -47
- package/src/claude/migration-manifest.json +15 -2
- package/src/claude/rules/state-sync.md +52 -21
- package/src/claude/rules/workflow.md +17 -9
- package/src/claude/scripts/provenance.cjs +315 -0
- package/src/claude/scripts/spec-final-state.cjs +244 -0
- package/src/claude/scripts/spec-ground.cjs +535 -173
- package/src/claude/scripts/spec-readiness.cjs +118 -0
- package/src/claude/scripts/spec-receipt.cjs +162 -0
- package/src/claude/scripts/spec-resolver.cjs +501 -0
- package/src/claude/scripts/spec-scaffold.cjs +1945 -55
- package/src/claude/scripts/spec-semantic-model.cjs +396 -0
- package/src/claude/scripts/validate-spec-output.cjs +3204 -262
- package/src/claude/scripts/workflow-policy.cjs +1888 -203
- package/src/claude/settings/settings.json +12 -0
- package/src/claude/skills/code-review/SKILL.md +94 -66
- package/src/claude/skills/code-review/references/spec-compliance-review.md +10 -2
- package/src/claude/skills/code-review/references/verification-gate.md +13 -0
- package/src/claude/skills/develop/SKILL.md +138 -283
- package/src/claude/skills/develop/references/parallel-waves.md +9 -6
- package/src/claude/skills/develop/references/quality-gate.md +123 -148
- package/src/claude/skills/develop/references/subagent-patterns.md +42 -37
- package/src/claude/skills/specs/SKILL.md +192 -397
- package/src/claude/skills/specs/references/ask-user-question-gates.md +27 -18
- package/src/claude/skills/specs/references/cross-spec-dependency.md +8 -4
- package/src/claude/skills/specs/references/research-strategy.md +4 -1
- package/src/claude/skills/specs/references/review.md +200 -260
- package/src/claude/skills/specs/references/scope-inquiry.md +18 -5
- package/src/claude/skills/specs/rules/design-discovery-full.md +33 -81
- package/src/claude/skills/specs/rules/design-discovery-light.md +21 -42
- package/src/claude/skills/specs/rules/design-principles.md +136 -180
- package/src/claude/skills/specs/rules/design-review.md +42 -97
- package/src/claude/skills/specs/rules/ears-format.md +42 -50
- package/src/claude/skills/specs/rules/phase-decision-matrix.md +42 -41
- package/src/claude/skills/specs/rules/task-scoring-rubric.md +46 -46
- package/src/claude/skills/specs/rules/tasks-generation.md +189 -271
- package/src/claude/skills/specs/templates/design.md +49 -263
- package/src/claude/skills/specs/templates/requirements.md +26 -36
- package/src/claude/skills/specs/templates/research.md +9 -98
- package/src/claude/skills/specs/templates/spec-state.json +26 -67
- package/src/claude/skills/specs/templates/task.md +30 -82
- package/src/claude/skills/sync/SKILL.md +45 -15
- package/src/claude/skills/sync/references/sync-protocols.md +34 -16
- package/src/claude/skills/test/SKILL.md +151 -167
- package/src/codex/AGENTS.md +6 -0
- package/src/codex/hooks/completion-authority-check.cjs +63 -0
- package/src/codex/hooks/completion-authority-state.cjs +527 -0
- package/src/codex/hooks/completion-authority.cjs +106 -0
- package/src/codex/hooks/lib/hook-context.cjs +58 -4
- package/src/codex/hooks/lib/privacy-command-analysis.cjs +3 -0
- package/src/codex/hooks/lib/privacy-state.cjs +38 -16
- package/src/codex/hooks/lib/runtime-path-safety.cjs +3 -0
- package/src/codex/hooks/lib/spec-receipt.cjs +86 -115
- package/src/codex/hooks/lib/spec-utils.cjs +104 -27
- package/src/codex/hooks/privacy-approval.cjs +1 -1
- package/src/codex/hooks/privacy-block.cjs +67 -11
- package/src/codex/hooks/semantic-review-authority.cjs +130 -0
- package/src/codex/hooks/session.cjs +2 -0
- package/src/codex/hooks/spec-gate.cjs +151 -24
- package/src/codex/hooks/spec-state.cjs +65 -12
- package/src/codex/hooks/state.cjs +2 -0
- package/src/codex/hooks.json +16 -1
- package/src/codex/rules/state-sync.md +47 -27
- package/src/common/AGENTS.md +1 -1
- package/src/opencode/AGENTS.md +4 -2
- package/src/opencode/plugins/spec-gate.ts +296 -122
- package/src/opencode/plugins/spec-state.ts +183 -116
|
@@ -1,53 +1,44 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: hapo:develop
|
|
3
|
-
description: "
|
|
3
|
+
description: "Implement an explicitly invoked ready or low-risk change with policy-proportional evidence and one closeout owner."
|
|
4
4
|
user-invocable: true
|
|
5
|
-
when_to_use: "
|
|
5
|
+
when_to_use: "Use to implement a ready spec, a specific task, or a Direct low-risk change."
|
|
6
6
|
category: utilities
|
|
7
|
-
keywords: [implementation, specs,
|
|
8
|
-
argument-hint: "[feature-name|specs-directory-path] [task-file] [--flash] [--parallel [N]] [--
|
|
7
|
+
keywords: [implementation, specs, verification]
|
|
8
|
+
argument-hint: "[feature-name|specs-directory-path] [task-file] [--flash] [--parallel [N]] [--notes]"
|
|
9
9
|
metadata:
|
|
10
10
|
author: haposoft
|
|
11
11
|
version: "1.0.0"
|
|
12
12
|
---
|
|
13
|
-
# Develop —
|
|
13
|
+
# Develop — implementation and closeout contract
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
Implement the requested scope, then close it with one canonical execution owner.
|
|
16
|
+
For a durable spec, `spec.json` is machine authority and Markdown is a human
|
|
17
|
+
projection. The v2.1 policy snapshot persists minimum input; lane, label,
|
|
18
|
+
artifact profile, and ceremony are derived views. The executable policy source
|
|
19
|
+
is `src/claude/scripts/workflow-policy.cjs` (installed as
|
|
20
|
+
`.claude/scripts/workflow-policy.cjs`).
|
|
16
21
|
|
|
17
|
-
|
|
22
|
+
## Usage and pre-state guard
|
|
18
23
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
/hapo:develop <feature
|
|
25
|
-
/hapo:develop
|
|
26
|
-
/hapo:develop <feature name> <specific-task-file.md>
|
|
27
|
-
/hapo:develop <feature name> --flash
|
|
28
|
-
/hapo:develop <feature name> <specific-task-file.md> --flash
|
|
29
|
-
/hapo:develop <feature name> --no-notes
|
|
24
|
+
```text
|
|
25
|
+
/hapo:develop <feature>
|
|
26
|
+
/hapo:develop specs/<feature>
|
|
27
|
+
/hapo:develop <feature> <specific-task-file.md>
|
|
28
|
+
/hapo:develop <feature> --flash
|
|
29
|
+
/hapo:develop <feature> --parallel [N]
|
|
30
|
+
/hapo:develop <feature> --notes
|
|
30
31
|
```
|
|
31
32
|
|
|
32
|
-
|
|
33
|
+
`--notes` is opt-in. Without it, do not create or update `implementation-notes.html`; there is no notes opt-out flag. When requested, load `references/implementation-notes-template.html` and record concrete decisions, gaps, scope-escape exceptions, risks, and verification caveats.
|
|
33
34
|
|
|
34
|
-
|
|
35
|
-
|---|---|---|---|---|
|
|
36
|
-
| default (specific-task / full-spec) | per tier | full (Step 4) | verified | |
|
|
37
|
-
| `--flash` | per tier | Flash Gate (4F) | `FLASH_UNVERIFIED` | |
|
|
38
|
-
| `--parallel` | inspector per task (Critical) | full, inside each worktree | verified | implies Critical lane (legacy Deep) |
|
|
39
|
-
| `--flash --parallel` | **flash+parallel fail-fast — no execution** | | | reject before state/worktree changes |
|
|
40
|
-
| `--no-notes` | — | — | — | composable with all modes |
|
|
41
|
-
|
|
42
|
-
## Argument validation
|
|
43
|
-
|
|
44
|
-
Run policy pre-state guard before loading spec files or mutating state. For the incompatible flag pair, the command must exit nonzero and write no state, receipt, worktree, subagent, or commit:
|
|
35
|
+
Run the policy pre-state guard before loading a spec or mutating state. The incompatible pair must exit `2` and create no state, receipt, worktree, subagent, or commit: this is the `flash+parallel fail-fast` gate.
|
|
45
36
|
|
|
46
37
|
```bash
|
|
47
38
|
node .claude/scripts/workflow-policy.cjs --flash --parallel --json
|
|
48
39
|
```
|
|
49
40
|
|
|
50
|
-
Expected
|
|
41
|
+
Expected message:
|
|
51
42
|
|
|
52
43
|
```text
|
|
53
44
|
Unsupported flags: --flash and --parallel are incompatible.
|
|
@@ -55,278 +46,142 @@ Remediation: run `/hapo:develop <feature> --flash` or `/hapo:develop <feature> -
|
|
|
55
46
|
No spec state, task receipt, worktree, subagent, or commit was created.
|
|
56
47
|
```
|
|
57
48
|
|
|
58
|
-
|
|
49
|
+
## Policy authority
|
|
59
50
|
|
|
51
|
+
For durable specs, persisted `workflow_policy` authority is the v2.1 minimum.
|
|
52
|
+
Canonical authoring supplies `planning_depth`, `assurance_level`,
|
|
53
|
+
`classified_minimum`, and normalized `risks`; lane and ceremony remain derived
|
|
54
|
+
views.
|
|
60
55
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
Run lane classification at the runtime boundary before loading spec files or mutating state. Decisions are executable, not advisory prose:
|
|
56
|
+
Classify before spec/state mutation:
|
|
64
57
|
|
|
65
58
|
```bash
|
|
66
59
|
node .claude/scripts/workflow-policy.cjs --classify-lane --task-json '<task JSON>' --json
|
|
67
|
-
# Downgrade requires explicit user authorization - model-supplied downgrade is blocked
|
|
68
|
-
node .claude/scripts/workflow-policy.cjs --classify-lane --task-json '{"riskSignals":{"auth":true},"override":"Direct","userAuthorized":true}' --json
|
|
69
60
|
```
|
|
70
61
|
|
|
71
|
-
- **Direct
|
|
72
|
-
- **Standard
|
|
73
|
-
- **Critical
|
|
62
|
+
- **Direct**: clear, isolated, reversible, low-risk. Skip spec/state/registry ceremony and run targeted verification with proportional evidence.
|
|
63
|
+
- **Standard**: use the bounded spec profile and focused inspection. A small feature needs no task registry/bundle and closes once at the feature boundary.
|
|
64
|
+
- **Critical**: derived Strict view. Add durable task state, research, or review
|
|
65
|
+
only when actual topology, uncertainty, or assurance requires it.
|
|
74
66
|
|
|
75
|
-
|
|
67
|
+
Risk can raise the classified minimum. Reclassify before persistence. After
|
|
68
|
+
persistence, a per-feature baseline is monotonic and no downgrade is supported
|
|
69
|
+
until a trusted issuer exists; the baseline applies only to that feature.
|
|
70
|
+
Legacy approval fields and caller booleans have zero authority.
|
|
76
71
|
|
|
77
|
-
|
|
72
|
+
Develop starts only from the user's explicit Develop invocation. Technical
|
|
73
|
+
`ready_for_implementation` never dispatches Develop, and Specs must never
|
|
74
|
+
auto-chain into this workflow.
|
|
78
75
|
|
|
79
|
-
|
|
80
|
-
Triggered by `/hapo:develop <feature> <task-file>`.
|
|
76
|
+
`execution_tier` (`Light | Standard | Deep`) is a read-only legacy adapter (`Direct | Standard | Critical`). It cannot emit policy, create obligations, select a workflow, or override the lane. Do not branch on it for new behavior.
|
|
81
77
|
|
|
82
|
-
|
|
83
|
-
- Implement only that task packet.
|
|
84
|
-
- STOP immediately after the task is verified and synchronized, or flash-synchronized when `--flash` is active.
|
|
85
|
-
- Never auto-chain into the next task.
|
|
78
|
+
## Modes
|
|
86
79
|
|
|
87
|
-
###
|
|
88
|
-
Triggered by `/hapo:develop <feature>` or `/hapo:develop specs/<feature>`.
|
|
80
|
+
### Specific task
|
|
89
81
|
|
|
90
|
-
-
|
|
91
|
-
- Select the next `pending` + unblocked task only.
|
|
92
|
-
- Run the full implementation cycle for that single task.
|
|
93
|
-
- Sync state.
|
|
94
|
-
- Recompute the queue and continue.
|
|
95
|
-
- STOP the overall run on the first blocked task, unresolved gate failure, or missing proof.
|
|
96
|
-
- In `--flash` mode, missing full test proof stores the task as `status: "in_progress"` with receipt `FLASH_UNVERIFIED` and blocker `awaiting /hapo:test <feature>`. It does not unblock dependencies or mark the task done.
|
|
82
|
+
Load exactly one task packet, implement only its scope, run its evidence, and stop after synchronization. Specific-task mode never selects or chains into another pending task.
|
|
97
83
|
|
|
98
|
-
###
|
|
99
|
-
Triggered by adding `--parallel [N]` to Full-Spec mode. Load `references/parallel-waves.md` and follow it exactly — it is the operating procedure (wave planning, dispatch, merge, cleanup).
|
|
84
|
+
### Full feature
|
|
100
85
|
|
|
101
|
-
|
|
86
|
+
For a task-bearing policy, resolve one unblocked task at a time, complete its cycle, synchronize, and recompute the queue. A bounded Standard feature without tasks runs one feature-level cycle. Stop on the first unresolved block or missing proof; run final integration only after all pending tasks finish.
|
|
102
87
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
88
|
+
### Parallel (opt-in)
|
|
89
|
+
|
|
90
|
+
Load `references/parallel-waves.md` only with `--parallel`. It may use isolated worktrees and a bounded wave, but lane obligations, single-writer rules, immutable provenance, and final integration remain in force. Otherwise process one unblocked task at a time.
|
|
91
|
+
|
|
92
|
+
### 3. Flash Mode (`--flash`)
|
|
93
|
+
Flash is an explicit speed trade-off, not a completion shortcut:
|
|
94
|
+
|
|
95
|
+
- skip dedicated test suites, full task evidence execution, and extended manual
|
|
96
|
+
checks;
|
|
97
|
+
- run only a cheap available syntax/typecheck/compile preflight;
|
|
98
|
+
- never weaken or delete tests;
|
|
99
|
+
- synchronize only as `in_progress` with `FLASH_UNVERIFIED`,
|
|
100
|
+
`dependencyBlocked: true`, `unblocks: false`, and blocker
|
|
101
|
+
`awaiting /hapo:test <feature>`;
|
|
102
|
+
- never claim `Test PASS`, `Evidence PASS`, `Auto-Approved`, or
|
|
103
|
+
`production-ready`.
|
|
104
|
+
|
|
105
|
+
Only trusted sync-finalize may promote a current `FLASH_UNVERIFIED` task with explicit `--verdict PASS` and canonical proof; caller promotion fields are ignored/rejected, and marker-only proof never promotes. Stored state remains `in_progress`/`FLASH_UNVERIFIED`, dependency-blocked with a concrete blocker, omits promotion fields, and binds proof to expected Base/Head anchors.
|
|
106
|
+
## Workflow
|
|
107
|
+
`Classify lane → load lane artifacts → scout obligations → implement current
|
|
108
|
+
scope → one closeout owner → test receipt → review → docs-impact sync.`
|
|
109
|
+
|
|
110
|
+
### Step 1 — Load and scope
|
|
111
|
+
|
|
112
|
+
- Direct does not create a spec, state, registry, task bundle, or notes file.
|
|
113
|
+
- Standard requires its bounded validated artifacts, but not a
|
|
114
|
+
registry when the scope is small and no task obligation is persisted.
|
|
115
|
+
- Critical requires only the artifacts named by its snapshot obligations.
|
|
116
|
+
- For task-bearing work, load one requested task or one unblocked task and
|
|
117
|
+
extract the exact seven v2.1 sections: `Outcome`, `Scope`, `Anchors and Ownership`,
|
|
118
|
+
`Changes`, `Acceptance`, `Dependencies`, and `Verification Plan`.
|
|
119
|
+
Use typed `coordination.boundaries` for ownership/DAG/proof/parallel authority.
|
|
120
|
+
- Before implementation, transition `pending` to `in_progress` in task Markdown `**Status:**` and `spec.json.task_registry[path]` with synchronized timestamps. Never write execution proof into the task plan.
|
|
121
|
+
- A spec-ready execution-evidence or independent-audit slot may be `PENDING`
|
|
122
|
+
before implementation; pending is not proof and cannot close the feature.
|
|
123
|
+
|
|
124
|
+
### Step 2 — Scout
|
|
111
125
|
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
-
|
|
123
|
-
- Still load the approved spec, scout every task, obey scope, and implement real code.
|
|
124
|
-
- Skip dedicated test suites, E2E/browser/manual QA loops, full task evidence execution, and code-review retry loops.
|
|
125
|
-
- Run only cheap preflight checks when available and fast: syntax, typecheck, or build commands that do not require installing dependencies or starting external services.
|
|
126
|
-
- Never weaken, delete, or rewrite tests to avoid running them.
|
|
127
|
-
- Sync the implementation as `status: "in_progress"` with receipt `FLASH_UNVERIFIED`, blocker `awaiting /hapo:test <feature>`, and no dependency unblocking. Do not claim task or feature completion.
|
|
128
|
-
- Final output MUST recommend `/hapo:test <feature>` before merge, release, or publish.
|
|
129
|
-
|
|
130
|
-
### 4. Implementation Notes
|
|
131
|
-
Implementation notes apply to Standard/Critical modes by default; Direct stays artifact-free unless user explicitly requests a receipt. Disable notes with `--no-notes`.
|
|
132
|
-
|
|
133
|
-
- **Standard/Critical**: maintain `specs/<feature-name>/implementation-notes.html`.
|
|
134
|
-
- **Standard/Critical**: use `references/implementation-notes-template.html` when the file does not exist.
|
|
135
|
-
- Keep the file self-contained: inline CSS, no JS, no external fonts, no network assets.
|
|
136
|
-
- Style notes as readable Claude Code-like blocks: compact cards, left accent bars, category badges, monospace file paths, and a task timeline.
|
|
137
|
-
- Record decisions and caveats while implementing, not only at the end.
|
|
138
|
-
- Do not use notes to justify scope changes that alter the approved contract. If the contract changes, stop and route back to `/hapo:specs update`.
|
|
139
|
-
|
|
140
|
-
## Delegation policy (single source for this skill)
|
|
141
|
-
|
|
142
|
-
Implement in the main session by default. Do not spawn a subagent because a step
|
|
143
|
-
mentions an agent name — spawn only per this table:
|
|
144
|
-
|
|
145
|
-
| Lane | Delegation (risk-driven) | Quality gate |
|
|
146
|
-
|---|---|---|
|
|
147
|
-
| Direct | None | Main-session targeted verification and diff self-check |
|
|
148
|
-
| Standard | Exactly one combined `code-auditor` at feature ship point (not per-task) | Feature-level ship point |
|
|
149
|
-
| Critical | Risk-driven: `inspector` when discovery needed, `test-runner` when code changes, `code-auditor` at feature closeout (not fixed four-agent per task) | Strict evidence gate |
|
|
150
|
-
|
|
151
|
-
Legacy `execution_tier` (`Light | Standard | Deep`) is retained only as backward-compatible metadata (tier = Light → Direct, Standard → Standard, Deep → Critical). When both exist, lane policy controls ceremony/delegation and tier is metadata only. Do not treat tier as authoritative.
|
|
152
|
-
|
|
153
|
-
<LANE-GATE>
|
|
154
|
-
Do not write implementation code until lane classification runs at the runtime boundary.
|
|
155
|
-
- **Direct** may bypass spec/state/registry and full task ceremony only when classifier confirms clear, isolated, reversible, low-risk work; targeted verification and evidence remain mandatory.
|
|
156
|
-
- **Standard** requires one bounded approved spec artifact (`requirements.md` + `design.md` in current layout) and canonical receipt before implementation; exactly one feature-level closeout review.
|
|
157
|
-
- **Critical** requires approved lane-appropriate spec/state plus strict evidence before implementation; delegation is risk-driven, not a fixed chain.
|
|
158
|
-
Never treat a Direct override as automatic low risk; preserve its warning, risk signals, and user authorization requirement. Model-supplied downgrades without user authorization are blocked.
|
|
159
|
-
</LANE-GATE>
|
|
160
|
-
|
|
161
|
-
<DEFINITION-OF-DONE>
|
|
162
|
-
A task is NOT done because code compiles or a placeholder renders.
|
|
163
|
-
A task is done only when the task file's Completion Criteria AND `## Evidence` (legacy heading aliases still parse) are satisfied with real execution proof.
|
|
164
|
-
`--flash` is the only exception: it records fast implementation closeout with `FLASH_UNVERIFIED`, not full Definition of Done.
|
|
165
|
-
</DEFINITION-OF-DONE>
|
|
166
|
-
|
|
167
|
-
<CONTRACT-FIDELITY>
|
|
168
|
-
If the spec/task explicitly names a framework, auth system, datastore, transport path, or runtime boundary, that named choice is contractual.
|
|
169
|
-
You MUST NOT silently replace it with a simpler custom substitute ("for MVP", "placeholder", "temporary auth", "in-memory until later") unless the spec itself is updated first.
|
|
170
|
-
</CONTRACT-FIDELITY>
|
|
126
|
+
Scout depth follows assurance, risk, and blast radius. Identify real
|
|
127
|
+
entrypoints/callers, integration points, dependents, reachability risks, and
|
|
128
|
+
safe scope. File count is not review depth; stop if a runtime entrypoint cannot
|
|
129
|
+
be grounded.
|
|
130
|
+
|
|
131
|
+
### Step 3 — Implement
|
|
132
|
+
|
|
133
|
+
Implement only the scoped behavior and named contracts. Do not silently replace
|
|
134
|
+
frameworks, auth, transport, storage, or runtime boundaries. Do not mark a
|
|
135
|
+
runtime-facing file complete while it is orphaned, unmounted, unregistered, or
|
|
136
|
+
uncalled. A specific-task request ends after that task; no automatic chain.
|
|
171
137
|
|
|
172
138
|
<SCOPE-FIDELITY>
|
|
173
|
-
The
|
|
174
|
-
|
|
139
|
+
The `scope_lock`, requirements, design contracts, and active task are
|
|
140
|
+
the implementation contract. Scope escape requires a concrete reachability or
|
|
141
|
+
compile reason and must not deliver a later task early.
|
|
175
142
|
</SCOPE-FIDELITY>
|
|
176
143
|
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
```mermaid
|
|
180
|
-
flowchart TD
|
|
181
|
-
A["/hapo:develop \u003cfeature\u003e"] --> L[Classify lane]
|
|
182
|
-
L -->|Direct| D[Step 3: Implement (targeted or lane-scoped)]
|
|
183
|
-
L -->|Standard/Critical| B[Step 1: Load lane spec/state]
|
|
184
|
-
B -->|Missing or not approved| Z[Stop: Run lane-appropriate /hapo:specs]
|
|
185
|
-
B -->|Ready| C[Step 2: Task-Aware Scout (per lane policy)]
|
|
186
|
-
C --> D
|
|
187
|
-
D --> E{Flash Mode?}
|
|
188
|
-
E -->|No| Q[Step 4: Quality Gate: Test + Spec Review + Code Review + Evidence]
|
|
189
|
-
E -->|Yes| R[Step 4F: Flash Gate: Minimal Preflight + Scope Sanity]
|
|
190
|
-
Q -->|Fail| D
|
|
191
|
-
Q -->|Pass| F[Step 5: State Sync + Incremental Docs Sync]
|
|
192
|
-
R -->|Syntax/compile fail| D
|
|
193
|
-
R -->|Flash closeout| F
|
|
194
|
-
F --> H{More tasks?}
|
|
195
|
-
H -->|Yes| B
|
|
196
|
-
H -->|No| G[Final Integration Scout + Report Completion]
|
|
197
|
-
```
|
|
144
|
+
### Step 4 — Closeout owner
|
|
198
145
|
|
|
199
|
-
|
|
200
|
-
- **Direct**: after classifier confirms low-risk reversible work, skip spec/state/registry initialization and continue with targeted implementation/evidence.
|
|
201
|
-
- **Standard/Critical**: identify input and open the lane-appropriate `spec.json` plus bounded spec artifacts; require approved state before implementation.
|
|
202
|
-
- Check `ready_for_implementation` only for Standard/Critical specs. If not ready, notify user.
|
|
203
|
-
- **Standard/Critical only**: load `task_registry` and verify it matches the requested task file(s). If registry is missing or stale, route to `/hapo:sync audit <feature>` before coding.
|
|
204
|
-
- **Standard/Critical only**: unless `--no-notes` is present, initialize or update `specs/<feature-name>/implementation-notes.html`:
|
|
205
|
-
- If missing, create it from `references/implementation-notes-template.html`.
|
|
206
|
-
- Replace template placeholders for feature name, spec path, creation timestamp, and current mode.
|
|
207
|
-
- If present, preserve existing note cards and update the summary/timeline/status fields.
|
|
208
|
-
- **Direct** does not create or update spec implementation notes unless user explicitly asks for a receipt.
|
|
209
|
-
- **Standard/Critical only**: load exactly one task packet for specific-task mode, or resolve one unblocked task from `task_registry` for full-spec mode.
|
|
210
|
-
- **Standard/Critical only**: extract Objective + Constraints, Related Files, Completion Criteria, Evidence commands, requirement IDs, named technologies, and canonical contracts before coding.
|
|
211
|
-
- If a Standard/Critical task file lacks actionable completion or verification detail, stop and route back to spec correction. Direct does not use this packet gate.
|
|
212
|
-
- **Standard/Critical only**: set the active task to `in_progress` in markdown and `spec.json.task_registry` before coding. Direct has no registry mutation.
|
|
213
|
-
|
|
214
|
-
### Step 2: Scout (Codebase Inspection)
|
|
215
|
-
- **Scout per Delegation policy** — Critical may delegate to `inspector` when risk lens requires discovery; Direct/Standard scout in the main session with the same required outputs (legacy Light/Standard/Deep tier is metadata only):
|
|
216
|
-
- The scout prompt MUST include:
|
|
217
|
-
- Active task file path and extracted task packet
|
|
218
|
-
- Requirement IDs and `scope_lock`
|
|
219
|
-
- Relevant `design.md` contracts/invariants
|
|
220
|
-
- Prior completed task outputs from `spec.json.task_registry`
|
|
221
|
-
- Related Files from the active task
|
|
222
|
-
- The scout MUST report:
|
|
223
|
-
- Real runtime entrypoints/callers affected by the task (`App.tsx`, routes, CLI command, worker registration, manifest, API consumer, etc.)
|
|
224
|
-
- Existing integration points and adjacent code patterns to follow
|
|
225
|
-
- Prior task outputs this task must consume or preserve
|
|
226
|
-
- Blast-radius touchpoints and dependent files that can regress
|
|
227
|
-
- Reachability risks: orphan components, unmounted UI, unregistered routes, uncalled services/loaders, unused providers, disconnected reducers/actions
|
|
228
|
-
- Exact files likely safe to modify and any files outside `Related Files` that require a justified scope escape
|
|
229
|
-
- If the inspector cannot identify the entrypoint/caller for a runtime-facing task, STOP and route back to spec correction or ask the user. Do not guess.
|
|
230
|
-
|
|
231
|
-
### Step 3: Implement Code
|
|
232
|
-
- Act as the `implementer` per the Delegation policy (default: the main session), executing tasks specified in the loaded Markdown file(s) sequentially.
|
|
233
|
-
- **Important:** You may create and modify files directly, but must faithfully follow the design from the Spec.
|
|
234
|
-
- You MUST use the Step 2 scout report as implementation context. If code reality contradicts the task packet, stop and reconcile the spec before coding.
|
|
235
|
-
- **Standard/Critical only**: unless `--no-notes` is present, append a note card to `implementation-notes.html` whenever any of these occurs:
|
|
236
|
-
- `decision`: a necessary implementation choice not specified by the spec
|
|
237
|
-
- `spec-gap`: missing or ambiguous spec detail discovered during implementation
|
|
238
|
-
- `codebase-reality`: existing code requires a different integration path than the task implied
|
|
239
|
-
- `tradeoff`: a conscious simplicity, performance, UX, or maintainability tradeoff
|
|
240
|
-
- `scope-escape`: a file or behavior outside Related Files must be touched for reachability/compile/integration
|
|
241
|
-
- `risk`: known residual risk, edge case, or deferred follow-up
|
|
242
|
-
- `verification`: command result, skipped check, manual proof, or evidence caveat
|
|
243
|
-
- Progress tracking: Temporarily change `[ ]` to `[/]` in Spec files while coding is in progress. Do NOT mark `[x]` before Step 4 passes.
|
|
244
|
-
- **Task Boundary Protocol (CRITICAL):**
|
|
245
|
-
- Default editable scope is `Related Files` from the task packet.
|
|
246
|
-
- You may additionally touch direct test files plus minimal support files required to make the current task executable (shared types, exports, config glue, generated migration wiring).
|
|
247
|
-
- If you must edit a file outside this scope, explicitly treat it as a `scope escape` and justify why it is required for the current task.
|
|
248
|
-
- If the out-of-scope change would deliver functionality clearly assigned to a later task, STOP instead of implementing it early.
|
|
249
|
-
- **Hard Stop Protocol:** If you were asked to implement a specific task file, you MUST STOP completely after that task is verified. DO NOT auto-chain or jump to "Next Task" simply because you see it in the spec. Wait for the user's next command.
|
|
250
|
-
- **Full-Spec Loop Protocol:** If you were asked to implement the whole feature, you MUST still work one task at a time. Finish Step 4 and Step 5 for the current task before selecting the next unblocked task from `task_registry`.
|
|
251
|
-
- **Test Integrity Protocol:** You MUST NOT delete, replace, or reduce the scope of existing test cases to make tests pass. If a test fails, you must fix the **implementation code** or fix the **test setup/mock**, NOT remove the assertion. Reducing test count or weakening assertions (e.g., removing `toHaveBeenCalledWith` and replacing with `toEqual(expect.any(...))`) is a Critical violation.
|
|
252
|
-
- **Contract Integrity Protocol:** If implementation appears to require changing auth/session, transport, persistence, entrypoint wiring, or generated artifact behavior beyond what `design.md` states, STOP and route back to spec correction instead of inventing a new contract in code.
|
|
253
|
-
- **Named Technology Rule:** If the task/spec explicitly requires a named dependency or runtime choice (for example Better Auth, Hono, Next.js proxy routes, Redis, Drizzle, S3), you MUST implement that choice or stop. Do not swap it for a custom/in-memory/local substitute and still call the task complete.
|
|
254
|
-
- **Cross-Service Reality Rule:** If a task spans multiple processes or runtimes (web ↔ API, worker ↔ DB, extension ↔ backend), you MUST prove the integration uses shared real state or a real contract boundary. Process-local placeholders on both sides do not count as completion.
|
|
255
|
-
- **Placeholder Completion Rule:** You MAY scaffold future files only when the active task truly needs them to compile, but placeholder route handlers, in-memory stores, or fake adapters MUST NOT be used as evidence that the current task's behavior works end-to-end.
|
|
256
|
-
- **Reachability Rule:** Runtime-facing work is incomplete until it is reachable from the real entrypoint/caller named in the task evidence or Step 2 scout report. Creating a component/service/route/provider/reducer without importing, mounting, registering, or invoking it is not implementation.
|
|
257
|
-
- **Prior Output Consumption Rule:** If this task depends on previous task outputs, verify those outputs are consumed through real code paths. If a prior output is unused and this task is responsible for wiring it, wire it now; if a later task owns the wiring, keep the current task pending unless that deferral is named in the active task evidence.
|
|
258
|
-
|
|
259
|
-
### Step 4: Self-Healing (Quality Gate Auto-Fix)
|
|
260
|
-
The moment you finish coding, DO NOT proceed further. Switch to `references/quality-gate.md` and run the automatic review loop.
|
|
261
|
-
**Mantra:** Scope/spec compliance first, code quality second. All feedback from code-auditor must be addressed thoroughly: PASS requires no Critical findings, no High findings, and at most one Medium.
|
|
262
|
-
|
|
263
|
-
If `--flash` is active, use **Step 4F: Flash Gate** instead of the full automatic review loop.
|
|
264
|
-
|
|
265
|
-
- Passing Step 4 requires ALL of the following:
|
|
266
|
-
1. Automated verification passes, including preflight compile/typecheck/build health and every exact command named in the task's `## Evidence` (legacy heading aliases still parse)
|
|
267
|
-
2. Spec compliance review passes: every scoped requirement and active task criterion is implemented, with no extras and no omissions
|
|
268
|
-
3. Code quality review passes
|
|
269
|
-
4. Task evidence passes (artifacts/runtime surfaces/reachability/negative-path checks from the task file are proven)
|
|
270
|
-
- Violating any Step 3 rule = FAIL.
|
|
271
|
-
- `PRECHECK_FAIL` outranks `NO_TESTS`. If compile/typecheck/build fails, the task is FAIL even when no test suite exists yet.
|
|
272
|
-
- If build/test passes but task evidence is missing, the task is still FAIL.
|
|
273
|
-
- Only escalate to the user after 3 consecutive failed review rounds.
|
|
274
|
-
|
|
275
|
-
### Step 4F: Flash Gate (`--flash` only)
|
|
276
|
-
Flash mode is an explicit speed trade-off requested by the user.
|
|
277
|
-
|
|
278
|
-
- Skip:
|
|
279
|
-
- dedicated test commands from task Evidence
|
|
280
|
-
- full test-runner delegation
|
|
281
|
-
- E2E/browser/manual QA loops
|
|
282
|
-
- full code-auditor retry loop
|
|
283
|
-
- screenshot, accessibility, performance, and visual verification unless the active task is purely visual and can be checked cheaply
|
|
284
|
-
- Still perform:
|
|
285
|
-
- task-aware scout from Step 2
|
|
286
|
-
- active task scope sanity check against Completion Criteria
|
|
287
|
-
- reachability sanity check for runtime-facing files: imported, mounted, registered, routed, or invoked where applicable
|
|
288
|
-
- cheap compile/syntax/typecheck/build command when it is already available and expected to run quickly
|
|
289
|
-
- If the cheap preflight fails, return to Step 3 and fix before syncing.
|
|
290
|
-
- If no cheap preflight exists or it would require slow setup/external services, record `Preflight: skipped in --flash mode`.
|
|
291
|
-
- Flash output MUST log: `⚡ Step 4 Flash Gate: tests skipped by --flash; preflight=<pass|skipped>; evidence=FLASH_UNVERIFIED`.
|
|
292
|
-
- Flash output MUST NOT say `Test PASS`, `Evidence PASS`, `Auto-Approved`, or `production-ready`.
|
|
293
|
-
|
|
294
|
-
### Step 5: State Sync + Task-Level Docs Sync
|
|
295
|
-
- Only after Step 4 passes may you mark task checkboxes completed and sync `spec.json` progress/timestamps/task_registry.
|
|
296
|
-
- In `--flash`, Step 4F may record implementation closeout only as `status: "in_progress"` with `FLASH_UNVERIFIED` and blocker `awaiting /hapo:test <feature>`; it never syncs `done` or unblocks dependencies.
|
|
297
|
-
- If verification is partial or blocked by environment, keep the task in `pending` or `in_progress` and record the blocker instead of pretending completion.
|
|
298
|
-
- A completed task MUST leave behind:
|
|
299
|
-
- markdown `**Status:** done`
|
|
300
|
-
- `spec.json.task_registry[path].status = "done"`
|
|
301
|
-
- `completed_at` + `last_updated_at`
|
|
302
|
-
- synchronized top-level `updated_at`
|
|
303
|
-
- a human-readable verification receipt inside the task's `Evidence` section showing which commands ran, their outcomes, and what proof was observed
|
|
304
|
-
- In `--flash`, the receipt MUST include `Mode: --flash`, `Tests: skipped by user request`, `Evidence: FLASH_UNVERIFIED`, `Status: in_progress`, `Blocker: awaiting /hapo:test <feature>`, and `Next verification: /hapo:test <feature>`.
|
|
305
|
-
- Verification receipts with `PRECHECK_FAIL`, `FAIL`, `UNVERIFIED`, or an explicit note that the implementation intentionally simplified a named contract MUST NOT be synchronized as `done`.
|
|
306
|
-
- Exception: `FLASH_UNVERIFIED` is allowed only when `--flash` is explicitly present. It records fast implementation completion, not full verification completion.
|
|
307
|
-
- Unless `--no-notes` is present, update `implementation-notes.html` before reporting the task:
|
|
308
|
-
- Mark the task block as `done`, `blocked`, or `flash_unverified`.
|
|
309
|
-
- Add a `verification` note with exact commands run or `Tests skipped by --flash`.
|
|
310
|
-
- If no implementation note was needed for the task, add a compact `decision` note: `No spec gaps, tradeoffs, scope escapes, or deferred risks recorded for this task.`
|
|
311
|
-
- Add `Next verification: /hapo:test <feature>` when any evidence is skipped, partial, or `FLASH_UNVERIFIED`.
|
|
312
|
-
- After syncing the active task, run a **Task Closeout Docs Checkpoint**
|
|
313
|
-
- Task Closeout Docs Checkpoint:
|
|
314
|
-
- Evaluate `Docs impact: none | minor | major` based on real behavior changes from the just-completed task
|
|
315
|
-
- If `none`: record that explicitly in the completion report and stop
|
|
316
|
-
- If `minor` or `major`: trigger `docs-keeper` to surgically update affected existing docs under `./docs`
|
|
317
|
-
- Default to **lightweight docs sync**: update only the docs touched by this task and its verified behavior; do NOT run `repomix` unless `docs-keeper` truly cannot verify the required architecture/context from the code, spec, and current docs
|
|
318
|
-
- **CWD Protocol (CRITICAL):** When spawning `docs-keeper`, set its Current Working Directory (CWD context) to the **Workspace Root**, not the inner package directory.
|
|
319
|
-
- Task-level docs sync happens after every verified completed task, but actual edits still depend on `Docs impact`.
|
|
320
|
-
- In **Specific-Task Mode**, STOP after sync and report the result.
|
|
321
|
-
- In **Full-Spec Mode**, only after sync may you re-read `task_registry`, pick the next unblocked pending task, and repeat from Step 1 for that task.
|
|
322
|
-
- When no pending tasks remain, run a **Final Integration Scout** before reporting completion:
|
|
323
|
-
- Trace runtime entrypoints from `main`/route/CLI/worker/manifest/API consumer through the scoped feature surfaces.
|
|
324
|
-
- Compare reachable behavior against `scope_lock`, `requirements.md`, `design.md`, and all task Completion Criteria.
|
|
325
|
-
- FAIL completion if any scoped surface is missing, any created runtime-facing artifact is orphaned, or spec progress/registry says done while evidence is missing.
|
|
326
|
-
- Only then set top-level progress to `code_done` / next phase.
|
|
146
|
+
The controller assigns exactly one closeout owner for the current task or feature. It invokes testing once, then review once when required; no phase re-runs either as a hidden gate.
|
|
327
147
|
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
- `
|
|
332
|
-
|
|
148
|
+
- For task-bearing work, the test owner executes the Verification Plan and writes the canonical execution receipt to `receipts/<task-basename>.md` only after real execution.
|
|
149
|
+
- The review owner evaluates correctness, security, and spec compliance; it
|
|
150
|
+
consumes existing proof but never creates or claims execution proof.
|
|
151
|
+
- Review depth follows `assurance_level`, risk, and blast radius. Lane is only
|
|
152
|
+
a derived view, and depth does not follow the
|
|
153
|
+
number of files changed.
|
|
154
|
+
- Finding count never selects review depth or overrides missing execution proof.
|
|
155
|
+
- Use the shared adapter surface: `PASS | PASS_WITH_WARNINGS | FAIL | BLOCKED`.
|
|
156
|
+
Warnings do not waive missing proof; `FAIL` is remediable and `BLOCKED` stops.
|
|
157
|
+
|
|
158
|
+
Load `references/quality-gate.md` for the exact closeout contract. It has no
|
|
159
|
+
fixed Light/Standard/Deep agent sequence.
|
|
160
|
+
|
|
161
|
+
### Step 5 — Sync and docs checkpoint
|
|
162
|
+
|
|
163
|
+
Only a canonical receipt with task identity/path, exact command/result, expected versus observed behavior, bound provenance, applicable negative/reachability proof, and required artifact hashes can close a task. Prefer `receipts/<task-basename>.md`; legacy task `## Evidence` is read-compatible, but conflicting proof identities fail closed. Missing, pending, marker-only, or contradictory evidence stays unfinished. Critical audits need distinct session IDs, expected Base/Head binding, concrete evidence, and literal `verdict: "PASS"`; `Audit: PASS` is not evidence.
|
|
164
|
+
After verification, synchronize status/timestamps/task state. Then evaluate
|
|
165
|
+
actual docs impact:
|
|
166
|
+
|
|
167
|
+
- `none`: record it and stop;
|
|
168
|
+
- `minor`/`major`: update only affected existing docs through the normal docs
|
|
169
|
+
workflow, with no broad refresh.
|
|
170
|
+
|
|
171
|
+
Do not run a docs checkpoint merely because a task finished.
|
|
172
|
+
|
|
173
|
+
## Definition of done and handoff
|
|
174
|
+
|
|
175
|
+
Done requires active criteria, all required evidence, reachable runtime behavior,
|
|
176
|
+
a receipt bound to expected Base/Head, and every lane obligation. Only literal
|
|
177
|
+
`PASS` can complete; `PASS_WITH_WARNINGS` remains unfinished.
|
|
178
|
+
`--flash` records only `FLASH_UNVERIFIED` and never done.
|
|
179
|
+
|
|
180
|
+
For a full feature, after the last task run the **Final Integration Scout** for runtime-facing surfaces and compare reachability/scope before completion. The same test owner creates `feature-receipt.md` exactly once from final integration proof. Task-bearing closeout requires every task receipt plus that feature receipt; taskless Compact/Full creates only the feature receipt at closeout. Its earlier absence is normal. A specific task stops after synchronization and creates no feature receipt unless it also completes the full integration boundary.
|
|
181
|
+
|
|
182
|
+
## Attached references
|
|
183
|
+
|
|
184
|
+
- `references/quality-gate.md` — closeout ownership, verdict normalization, and
|
|
185
|
+
evidence checks.
|
|
186
|
+
- `references/parallel-waves.md` — opt-in worktree waves.
|
|
187
|
+
- `references/implementation-notes-template.html` — loaded only with `--notes`.
|
|
@@ -86,7 +86,8 @@ these mandatory lines:
|
|
|
86
86
|
|
|
87
87
|
1. "You are in an isolated git worktree. Implement ONLY this task."
|
|
88
88
|
2. "Do NOT edit `spec.json` or any `tasks/*.md` — the orchestrator owns spec state."
|
|
89
|
-
3. "
|
|
89
|
+
3. "Write only exact targets granted by this task's `Anchors and Ownership`
|
|
90
|
+
table and typed ownership/parallel boundaries."
|
|
90
91
|
4. "When done, `git add` your changes and `git commit -m \"task(<id>): <title>\"` —
|
|
91
92
|
an uncommitted worktree cannot be merged."
|
|
92
93
|
5. End with the standard `Status: DONE|CONCERNS|BLOCKED|NEEDS_INFO` block, plus
|
|
@@ -150,14 +151,15 @@ cherry-pick remains the recipe regardless.
|
|
|
150
151
|
## 6. Post-merge integration check (per wave)
|
|
151
152
|
|
|
152
153
|
After the wave's last cherry-pick, run an affected integration command derived
|
|
153
|
-
from the task's
|
|
154
|
+
from the task's `Verification Plan` and repository contract (build or affected test
|
|
154
155
|
subset; never the full suite mid-flight). Record command, `base_sha`, `head_sha`,
|
|
155
156
|
range, and result in the wave receipt. Failure blocks the next wave.
|
|
156
157
|
|
|
157
158
|
After the final wave, run an explicit feature/full integration command derived
|
|
158
|
-
from the repository contract — for example the feature's exact
|
|
159
|
+
from the repository contract — for example the feature's exact verification suite
|
|
159
160
|
or the repository's documented full test/build command. A final scout is not a
|
|
160
|
-
substitute.
|
|
161
|
+
substitute. On PASS, the test owner creates `feature-receipt.md` once; task
|
|
162
|
+
receipts alone cannot close the feature. Classify every failure before acting as exactly one of:
|
|
161
163
|
|
|
162
164
|
- `baseline` — reproduces from the recorded destination `base_sha`;
|
|
163
165
|
- `environment` — tool, dependency, permission, or service unavailable;
|
|
@@ -172,8 +174,9 @@ sequential fallback according to the task contract.
|
|
|
172
174
|
|
|
173
175
|
Only the orchestrator writes `spec.json` and task markdown, after each task's
|
|
174
176
|
cherry-pick: registry `status`/`completed_at`/`last_updated_at`, task-md `Status`,
|
|
175
|
-
checkbox ticks, and a
|
|
176
|
-
the post-merge check result.
|
|
177
|
+
checkbox ticks, and a canonical `receipts/<task-basename>.md` citing the
|
|
178
|
+
worktree gate evidence plus the post-merge check result. Never append execution
|
|
179
|
+
proof to task Markdown. The Stop completion gate (`spec-gate.cjs`) applies
|
|
177
180
|
unchanged — a receipt-less done blocks the turn. After syncing the wave, recompute
|
|
178
181
|
§2 and continue until no pending tasks remain.
|
|
179
182
|
|