@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.
- package/bin/__tests__/codex-hooks.test.js +355 -12
- package/bin/__tests__/codex-native.test.js +1 -1
- package/bin/__tests__/develop-contract.test.js +1374 -78
- package/bin/__tests__/installer-safety.test.js +43 -29
- package/bin/__tests__/opencode-spec-gate.test.js +791 -0
- package/bin/__tests__/package-inventory.test.js +157 -0
- package/bin/__tests__/validator-grounding.test.js +707 -2
- package/package.json +1 -1
- package/src/claude/agents/code-auditor.md +8 -1
- package/src/claude/agents/spec-maker.md +107 -200
- package/src/claude/hooks/__tests__/completion-authority.test.js +720 -0
- package/src/claude/hooks/__tests__/spec-gate.test.js +511 -38
- package/src/claude/hooks/completion-authority-check.cjs +307 -0
- package/src/claude/hooks/completion-authority-state.cjs +525 -0
- package/src/claude/hooks/completion-authority.cjs +148 -0
- package/src/claude/hooks/session.cjs +33 -19
- package/src/claude/hooks/spec-gate.cjs +173 -61
- package/src/claude/hooks/spec-state.cjs +104 -45
- package/src/claude/migration-manifest.json +6 -1
- package/src/claude/scripts/provenance.cjs +315 -0
- package/src/claude/scripts/spec-resolver.cjs +450 -0
- package/src/claude/scripts/spec-scaffold.cjs +716 -41
- package/src/claude/scripts/validate-spec-output.cjs +355 -53
- package/src/claude/scripts/workflow-policy.cjs +1529 -162
- package/src/claude/settings/settings.json +8 -0
- package/src/claude/skills/backend-development/references/backend-security.md +52 -0
- package/src/claude/skills/code-review/SKILL.md +85 -66
- package/src/claude/skills/develop/SKILL.md +153 -285
- package/src/claude/skills/develop/references/quality-gate.md +112 -124
- package/src/claude/skills/develop/references/subagent-patterns.md +42 -37
- package/src/claude/skills/specs/SKILL.md +170 -381
- package/src/claude/skills/specs/rules/task-scoring-rubric.md +45 -46
- package/src/claude/skills/specs/rules/tasks-generation.md +49 -20
- package/src/claude/skills/specs/templates/spec-state.json +23 -2
- package/src/claude/skills/specs/templates/task.md +20 -0
- package/src/claude/skills/sync/SKILL.md +15 -8
- package/src/claude/skills/sync/references/sync-protocols.md +4 -4
- package/src/claude/skills/test/SKILL.md +141 -167
- package/src/codex/hooks/completion-authority-check.cjs +260 -0
- package/src/codex/hooks/completion-authority-state.cjs +525 -0
- package/src/codex/hooks/completion-authority.cjs +100 -0
- package/src/codex/hooks/lib/hook-context.cjs +42 -2
- package/src/codex/hooks/lib/spec-receipt.cjs +76 -43
- package/src/codex/hooks/lib/spec-utils.cjs +53 -27
- package/src/codex/hooks/session.cjs +2 -0
- package/src/codex/hooks/spec-gate.cjs +132 -20
- package/src/codex/hooks/spec-state.cjs +56 -10
- package/src/codex/hooks.json +10 -0
- 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,8 +1,8 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: hapo:specs
|
|
3
|
-
description: "
|
|
3
|
+
description: "Route a request into the smallest evidence-backed CafeKit specification that its lane requires."
|
|
4
4
|
user-invocable: true
|
|
5
|
-
when_to_use: "
|
|
5
|
+
when_to_use: "Use when a request needs a durable specification or a lane decision before implementation."
|
|
6
6
|
category: utilities
|
|
7
7
|
keywords: [specs, requirements, design, tasks]
|
|
8
8
|
argument-hint: "[<feature-description>] [--auto] | --status | --validate <feature> | --archive"
|
|
@@ -10,418 +10,207 @@ metadata:
|
|
|
10
10
|
author: haposoft
|
|
11
11
|
version: "2.0.0"
|
|
12
12
|
---
|
|
13
|
-
# Specs
|
|
13
|
+
# Specs — routing and handoff contract
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
This file is the small control plane for specification work. It owns routing,
|
|
16
|
+
phase boundaries, stop conditions, lane obligations, and the implementation
|
|
17
|
+
handoff. Load the detailed rules only when the selected phase needs them; do
|
|
18
|
+
not preload every template, rubric, diagram rule, or discovery manual.
|
|
16
19
|
|
|
17
|
-
##
|
|
20
|
+
## Core contract
|
|
18
21
|
|
|
19
|
-
|
|
22
|
+
The normal route is:
|
|
20
23
|
|
|
21
|
-
|
|
24
|
+
`Route → Requirements → Design → [task bundle when required] → Validate → Handoff`
|
|
22
25
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
- **YAGNI** — Don't add functionality until it's actually needed
|
|
27
|
-
- **KISS** — Prefer simple solutions over complex ones
|
|
28
|
-
- **DRY** — Don't repeat existing code/logic
|
|
29
|
-
- **Be honest, direct, to the point, concise.**
|
|
30
|
-
|
|
31
|
-
### Phase Separation Rules
|
|
32
|
-
- Each phase (Init → Requirements → Design → Tasks) must complete before the next begins
|
|
33
|
-
- No skipping — don't write design without requirements
|
|
34
|
-
- Exception: simple tasks may merge requirements + design into one step
|
|
35
|
-
- A `/hapo:specs <feature-description>` run defaults to **Interactive State Discovery**: it asks the Creation Mode (Auto / Stop after Design / Step by step) before running. `--auto` runs the full pipeline end-to-end without asking. Either way, phases never skip — each completes before the next begins, and Init is never a stop point.
|
|
36
|
-
|
|
37
|
-
### Scope Rules
|
|
38
|
-
- Respect `scope_lock` absolutely once user has confirmed
|
|
39
|
-
- Never silently expand or shrink scope
|
|
40
|
-
- If scope change needed → ask user, record reason in `spec.json`
|
|
41
|
-
|
|
42
|
-
### State & Integrity Rules
|
|
43
|
-
- Canonical active status: `in_progress` (legacy `in-progress` may be READ only; never emit it).
|
|
44
|
-
- `current_phase` must track the active phase (`init` … `review`).
|
|
45
|
-
- Deterministic validator enforces the structural rules — see Step 8.5.
|
|
46
|
-
- `ready_for_implementation` is a hard gate — never set it before the finalization audit passes.
|
|
47
|
-
- Non-trivial specs MUST have an evidence trail in `research.md` before finalizing requirements/design/tasks.
|
|
48
|
-
|
|
49
|
-
### Language & Canonical Rules
|
|
50
|
-
- **English is the canonical language for every spec artifact** — write them in English regardless of the session's response language.
|
|
51
|
-
- Non-English `language` setting MAY add a **reference-only translation mirror** under `i18n/<lang>/`. See `references/translation-mirror.md`.
|
|
52
|
-
|
|
53
|
-
### Output Criteria
|
|
54
|
-
- Never implement code — only create spec documents
|
|
55
|
-
- Return file paths and a brief summary
|
|
56
|
-
- Spec files must be self-contained; insert code samples when needed to clarify flow
|
|
57
|
-
- Comply with `./docs/development-rules.md` if it exists
|
|
26
|
+
Each phase must finish before the next begins. A simple request may stop before
|
|
27
|
+
spec creation; a bounded Standard request may finish without tasks. Init is
|
|
28
|
+
never a stop point. Never implement code from this skill.
|
|
58
29
|
|
|
59
30
|
### Hard Output Contract
|
|
60
|
-
For a normal `/hapo:specs <feature-description>` run, the persistent spec artifacts MUST use this shape:
|
|
61
31
|
|
|
62
|
-
```
|
|
63
|
-
specs/<feature>/
|
|
64
|
-
├── spec.json
|
|
65
|
-
├── requirements.md
|
|
66
|
-
├── research.md
|
|
67
|
-
├── design.md
|
|
68
|
-
├── tasks/
|
|
69
|
-
│ ├── task-R0-01-<slug>.md
|
|
70
|
-
│ ├── task-R1-01-<slug>.md
|
|
71
|
-
│ └── ...
|
|
72
|
-
└── reports/
|
|
73
|
-
└── <optional-review-or-research-report>.md
|
|
74
|
-
```
|
|
75
|
-
|
|
76
|
-
Forbidden generated artifacts:
|
|
77
32
|
- Do NOT create `specs/<feature>/init.json`.
|
|
78
|
-
- Do NOT create `specs/<feature>/spec-state.json`.
|
|
79
33
|
- Do NOT create `specs/<feature>/hydration.md`.
|
|
80
|
-
-
|
|
81
|
-
- The template file name is never the output file name. `templates/spec-state.json` is only the schema source for generated `spec.json`.
|
|
82
|
-
- Before marking a spec ready, run the deterministic validator:
|
|
83
|
-
- `node .claude/scripts/validate-spec-output.cjs specs/<feature>`
|
|
84
|
-
- Any validator failure blocks `ready_for_implementation = true`.
|
|
85
|
-
- Deterministic validator enforces the structural rules — see Step 8.5.
|
|
34
|
+
- Task filenames are never shorthand such as `tasks/task-R0-1.md`.
|
|
86
35
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
36
|
+
The persisted `spec.json.workflow_policy` snapshot is the only new lane-policy
|
|
37
|
+
authority. It is written once, validated strictly, and never reclassified by a
|
|
38
|
+
later prose field. The `execution_tier` value (`Light | Standard | Deep`) is a
|
|
39
|
+
legacy read adapter only: `Light → Direct`, `Standard → Standard`, `Deep →
|
|
40
|
+
Critical`. It never creates policy or controls workflow.
|
|
90
41
|
|
|
91
|
-
## Lane
|
|
42
|
+
## Lane gate
|
|
92
43
|
|
|
93
|
-
Classify
|
|
44
|
+
Classify at the runtime boundary before creating spec state or asking for
|
|
45
|
+
approval:
|
|
94
46
|
|
|
95
47
|
```bash
|
|
96
48
|
node .claude/scripts/workflow-policy.cjs --classify-lane --task-json '<task JSON>' --json
|
|
97
|
-
# Downgrade from Critical requires explicit user authorization — model-supplied lane cannot bypass risk signals
|
|
98
|
-
node .claude/scripts/workflow-policy.cjs --classify-lane --task-json '{"riskSignals":{"auth":true},"override":"Direct","userAuthorized":true}' --json
|
|
99
|
-
```
|
|
100
|
-
|
|
101
|
-
- **Direct** — clear, isolated, reversible, low-risk work. May skip spec files, registry/state, and subagents. Still run targeted verification, diff self-check, and evidence proportional to blast radius. No spec/state/registry ceremony required.
|
|
102
|
-
- **Standard** — default lane. Create one bounded spec artifact (`requirements.md` + `design.md` in the current layout), keep one canonical receipt, and run exactly one combined `code-auditor` review at feature ship point (not per-task).
|
|
103
|
-
- **Critical** — destructive/irreversible, auth/payment/privacy/data, schema/migration, public contract, cross-runtime coupling, outcome-changing ambiguity, or difficult rollback. Require strict spec/state/evidence; delegation is risk-driven (inspector/test-runner/code-auditor enabled only when risk lens requires), not a fixed four-agent chain.
|
|
104
|
-
|
|
105
|
-
Explicit `override` is allowed in either direction but is enforced at the runtime boundary. A model-supplied lane or downgrade must not bypass risk signals. Downgrading from Critical requires explicit user-originated authorization (`userAuthorized:true` or `origin:user`) and must surface the trade-off (reduced review/evidence coverage). Agent validation or --auto never fabricates `user_approved`; `generated`, `agent_validated`, and `user_approved` are independent booleans per `schema_version: "2.0"`.
|
|
106
|
-
|
|
107
|
-
## Default Behavior
|
|
108
|
-
|
|
109
|
-
> **This section is the entry/dispatch layer ONLY.** It decides *which part of the pipeline to run and where to stop*. It does NOT change any pipeline step, the validator, templates, or rules.
|
|
110
|
-
|
|
111
|
-
`hapo:specs` exposes exactly **four flags**: `--auto`, `--validate`, `--status`, `--archive`. Everything else is resolved by **Interactive State Discovery**. Bare `status` / `archive` / `resume` are silent back-compat aliases.
|
|
112
|
-
|
|
113
|
-
### Dispatch order
|
|
114
|
-
|
|
115
|
-
1. `--status` (or bare `status`) → run the status report (see **Subcommands**), then stop.
|
|
116
|
-
2. `--validate <feature>` → jump to **Step 8** (the `--validate` rules below are unchanged).
|
|
117
|
-
3. `--archive` (or bare `archive`) → run the archive workflow, then stop.
|
|
118
|
-
4. `--auto` → **non-interactive run**. If the argument matches an unfinished spec → resume it from `current_phase` and finish to Tasks. Otherwise create new and run the full pipeline (Step 1→10) end-to-end. Either way: auto-approve and skip the Creation Mode question; if a new description is missing, ask only for it; the hard safety gates still apply.
|
|
119
|
-
5. Otherwise (`/hapo:specs` or `/hapo:specs "<description>"`) → **Interactive State Discovery**.
|
|
120
|
-
|
|
121
|
-
### Interactive State Discovery (no-flag path)
|
|
122
|
-
|
|
123
|
-
1. **Detect state** — unfinished specs (`in_progress` / not ready) + git-branch match → `Continue <A> · Continue <B> · Create new`; else create-new.
|
|
124
|
-
2. **Create-new** — ask description if missing. Too short → 1-2 questions. Unclear architecture/acceptance/scope/multi-approach → `/hapo:brainstorm`. Simple → "spec may not be needed?". Complex → deep research + 3 scope Qs. Non-trivial → Step 5 Evidence Gate.
|
|
125
|
-
3. **Creation Mode Gate** — see below. Non-English → also offer **Translation Mirror**.
|
|
126
|
-
4. **Continue** unfinished → resume from `current_phase` with remaining stop points.
|
|
127
|
-
5. **Run** chosen scope; early stop → Step 9b; sync per `state-sync.md`.
|
|
128
|
-
|
|
129
|
-
### Creation Mode Gate
|
|
130
|
-
|
|
131
|
-
Shown once on the no-flag create path. Selects the **stop point only**. Approval schema is versioned (`schema_version: "2.0"`): each phase has `generated`, `agent_validated`, `user_approved` as independent booleans. `ready` requires all three true. Legacy `approved` field is rejected — `--auto` or agent validation never fabricates `user_approved`.
|
|
132
|
-
|
|
133
|
-
| Option | Runs | Stops after | Approvals (v2) |
|
|
134
|
-
|---|---|---|---|
|
|
135
|
-
| **Auto (→ Tasks)** | Step 1→10 end-to-end | full (ready gate) | each phase `generated=true` + `agent_validated=true`; `user_approved` stays false until explicit user approval (`--auto` does NOT auto-set `user_approved`). Ready requires `generated && agent_validated && user_approved`. |
|
|
136
|
-
| **Stop after Design** | Step 1→6 | `design` (before Step 7) | requirements + design `generated=true` + `agent_validated=true`; `user_approved=true` only after explicit user approval; later phases ungenerated; `ready_for_implementation=false` |
|
|
137
|
-
| **Step by step** | one phase at a time | after each phase | per phase `generated=true`, `agent_validated` per agent check, `user_approved=false` until user explicitly approves |
|
|
138
|
-
|
|
139
|
-
`--auto` = Auto without the gate. Early stops leave `ready_for_implementation=false` and emit Step 9b. Resume via `/hapo:specs` Interactive State Discovery. If legacy `approved` field is present, fail closed with migration guidance: replace `approved` with `agent_validated` + `user_approved` per `spec-state.json` template.
|
|
140
|
-
|
|
141
|
-
### Translation Mirror (optional reference copy)
|
|
142
|
-
|
|
143
|
-
Load `references/translation-mirror.md`. Canonical = English. Non-English interactive run may set `spec.json.translation` and regenerate `i18n/<code>/` after Steps 5–7 writes. `--auto` create skips the prompt unless already enabled. Mirror is reference-only (never validated / never SoT / ignored by develop).
|
|
144
|
-
|
|
145
|
-
### When called WITH `--validate` argument
|
|
146
|
-
|
|
147
|
-
System IMMEDIATELY jumps to **Step 8: Validation Review**.
|
|
148
|
-
The system MUST NOT execute Steps 1-7. Instead, load `references/review.md` and follow it **step-by-step**.
|
|
149
|
-
|
|
150
|
-
#### `--validate` Guardrails (NON-NEGOTIABLE)
|
|
151
|
-
|
|
152
|
-
1. **Red Team cannot be skipped by the system.** If auto-decision says "Red Team + Validate", you MUST run Red Team. A previous `code-auditor` review does NOT count — code-auditor reviews source code, NOT specifications. Only the USER can downgrade to "Validate only" by explicitly saying so.
|
|
153
|
-
2. **MUST use the 4 Personas** defined in `review.md` Part A Step 3 (Security Adversary, Failure Mode Analyst, Assumption Destroyer, Scope & Complexity Critic). Generic observations without persona attribution are REJECTED.
|
|
154
|
-
3. **MUST use the Finding Format** defined in `review.md` Part A (Severity, Location, Flaw, Failure scenario, Evidence, Suggested fix, Disposition, Rationale). Shortened or custom formats are REJECTED.
|
|
155
|
-
4. **MUST create `reports/red-team-report.md`** when Red Team runs (review.md Part A Step 8).
|
|
156
|
-
5. **MUST NOT create implementation code files** (`.ts`, `.js`, `.py`, etc.). The validate workflow produces ONLY markdown spec documents and reports. If a fix requires a new shared module, describe it in the relevant task file instead of creating the actual code file.
|
|
157
|
-
6. **MUST NOT over-engineer fixes.** Apply YAGNI — if user says "configure later", add an abstraction note to the task, do NOT generate 4 concrete provider implementations.
|
|
158
|
-
7. **MUST follow auto-decision table exactly.** Count task files + scan for keywords → pick mode. No self-justification to override the table result.
|
|
159
|
-
8. **MUST run deterministic validator.** Before reporting validation PASS, run `node .claude/scripts/validate-spec-output.cjs specs/<feature>`. If it exits non-zero, validation is FAIL/BLOCKED, `ready_for_implementation` remains `false`, and output MUST NOT suggest `/hapo:develop`.
|
|
160
|
-
|
|
161
|
-
## Workflow Diagram
|
|
162
|
-
|
|
163
|
-
```mermaid
|
|
164
|
-
flowchart TD
|
|
165
|
-
A["Call /hapo:specs"] --> B{Flag?}
|
|
166
|
-
B -->|"--status"| ST["Status report → stop"]
|
|
167
|
-
B -->|"--archive"| AR["Archive workflow → stop"]
|
|
168
|
-
B -->|"--validate"| W
|
|
169
|
-
B -->|"--auto"| D["Step 1: Analyze description"]
|
|
170
|
-
B -->|none| DISC["Interactive State Discovery"]
|
|
171
|
-
DISC --> DISC1{Unfinished spec?}
|
|
172
|
-
DISC1 -->|Continue| RES["Read current_phase → resume remaining phases"]
|
|
173
|
-
DISC1 -->|New| D
|
|
174
|
-
RES --> CM
|
|
175
|
-
D --> DB{"Needs pre-spec brainstorm?"}
|
|
176
|
-
DB -->|Yes| DB2["Stop: run /hapo:brainstorm with same idea"]
|
|
177
|
-
DB -->|No| E{Clear enough?}
|
|
178
|
-
E -->|No| F["Ask user 1-2 clarifying questions"]
|
|
179
|
-
F --> D
|
|
180
|
-
E -->|Yes| G["Step 2: Scan specs/ for related specs"]
|
|
181
|
-
G --> H["Step 3: 5-Dimension Assessment"]
|
|
182
|
-
H --> H1{Risk level?}
|
|
183
|
-
H1 -->|Chaotic| HX["Exit → redirect to hapo:hotfix"]
|
|
184
|
-
H1 -->|Complex| H2["Include spike/prototype tasks"]
|
|
185
|
-
H1 -->|Clear/Complicated| H3{Need scope inquiry?}
|
|
186
|
-
H2 --> H3
|
|
187
|
-
H3 -->|Yes| J["Present 5D summary → user picks Expand/Hold/Reduce"]
|
|
188
|
-
H3 -->|No| K["Keep default scope"]
|
|
189
|
-
J --> L["Step 4: Init — create specs/<feature>/"]
|
|
190
|
-
K --> L
|
|
191
|
-
L --> M["Step 5A: Evidence Gate — scout + research"]
|
|
192
|
-
M --> N{Evidence sufficient?}
|
|
193
|
-
N -->|No| O["Ask user / run targeted scout / external research"]
|
|
194
|
-
O --> M
|
|
195
|
-
N -->|Yes| P["Step 5B: Requirements — write EARS"]
|
|
196
|
-
P --> Q["Step 6: Design — pick discovery mode"]
|
|
197
|
-
Q --> R["Write design.md"]
|
|
198
|
-
R --> CM{"Creation Mode?"}
|
|
199
|
-
CM -->|"Stop after Design"| STOP["Paused at design → emit Paused Block"]
|
|
200
|
-
CM -->|"Auto / Step by step"| S["Step 7: Tasks — split into individual files"]
|
|
201
|
-
S --> T["Create tasks/task-R*.md + task_registry"]
|
|
202
|
-
T --> V{Review?}
|
|
203
|
-
V -->|Yes| W["Run review — auto-pick red team or validation"]
|
|
204
|
-
V -->|No| X["Update spec.json → DONE"]
|
|
205
|
-
W --> X
|
|
206
|
-
X --> Y["MANDATORY: Output Context Reminder + next command"]
|
|
207
|
-
```
|
|
208
|
-
|
|
209
|
-
**This diagram is the authoritative workflow.** If text below conflicts with the diagram, follow the diagram.
|
|
210
|
-
|
|
211
|
-
## Detailed Workflow
|
|
212
|
-
|
|
213
|
-
### Step 1: Analyze Description
|
|
214
|
-
- Load `references/ask-user-question-gates.md` before asking; do not ask what repo evidence or current docs can answer.
|
|
215
|
-
- Route to `hapo:brainstorm` before creating files when acceptance criteria are not concrete, scope is unknown, 2-3 viable architectures lack a winner, the feature spans 3+ subsystems, or the user wants to explore/compare/debate.
|
|
216
|
-
- **Multimodal & Document Auto-Ingestion (MANDATORY):** media → `hapo:ai-multimodal`; `.pdf` → `hapo:pdf`; `.docx` → `hapo:docx`; `.pptx` → `hapo:pptx`; `.xlsx`/`.csv` → `hapo:xlsx`. Append findings as the enriched description.
|
|
217
|
-
- Description < 20 words or lacks concrete nouns → 1-2 clarifying questions. Too simple → warn a spec may not be needed.
|
|
218
|
-
|
|
219
|
-
### Step 2: Cross-Spec Dependency Scan
|
|
220
|
-
Load: `references/cross-spec-dependency.md` — scan incomplete specs; compare overlapping files/deps; update `spec.json` bidirectionally if related.
|
|
221
|
-
|
|
222
|
-
### Step 3: Complexity Assessment & Scope Inquiry
|
|
223
|
-
Load: `references/scope-inquiry.md` (+ `references/ask-user-question-gates.md` for scope/evidence/contract/architecture decisions).
|
|
224
|
-
- 5 dimensions: Semantic Intent, Implementation Hypothesis, Gap Sizing, Risk/Cynefin, Blast Radius
|
|
225
|
-
- **Chaotic** → `hapo:hotfix`; **Complex** → spike/prototype tasks; **Critical Path** → rollback + test coverage
|
|
226
|
-
- Smell: >8 files / >2 new classes / >12 tasks → challenge; **>15 tasks → sibling specs**
|
|
227
|
-
- User: Expand / Hold / Reduce. Skip if trivial (< 20 words, 1 file, "just do it")
|
|
228
|
-
|
|
229
|
-
#### Execution Tier (auto-scale — after 5-Dimension assessment) — legacy metadata
|
|
230
|
-
Record in `spec.json.design_context.execution_tier` for backward compatibility. Tier is metadata only; **lane controls ceremony and delegation** (Direct/Standard/Critical). Light/Standard/Deep mappings are preserved for compatibility but lane policy is authoritative.
|
|
231
|
-
|
|
232
|
-
| Tier (legacy) | Trigger | Research | Discovery | Red-Team | Always runs |
|
|
233
|
-
|---|---|---|---|---|---|
|
|
234
|
-
| **Light** | Clear + Isolated + ≤2 tasks | skip (rationale) | minimal | Validate-only | scope_lock, EARS, **Layer 1+2** |
|
|
235
|
-
| **Standard** | default / 3-4 tasks | targeted | light | per Step 8 | all of the above |
|
|
236
|
-
| **Deep** | Complex/Critical / security-migration / 5+ tasks | full | full | Red-Team → Validate | all of the above |
|
|
237
|
-
|
|
238
|
-
Grounding + validator + scope_lock never skip. Auth/payment/migration/schema/privacy force Deep (legacy) and Critical (lane). Tier remains backward-compatible execution metadata; lane controls ceremony and delegation.
|
|
239
|
-
|
|
240
|
-
### Step 4: Init
|
|
241
|
-
- Check duplicate slugs; create `specs/<feature-name>/`
|
|
242
|
-
- Create `spec.json` from `templates/spec-state.json` (output name MUST be `spec.json`, never the template filename)
|
|
243
|
-
- Create empty `requirements.md` from `templates/requirements-init.md`
|
|
244
|
-
- Init `scope_lock`: `source`, `in_scope`, `out_of_scope`, `expansion_policy: requires-user-approval`
|
|
245
|
-
- Step 4 only initializes; Creation Mode / `--auto` decides how far — Init is never a stop point.
|
|
246
|
-
|
|
247
|
-
### Step 5: Evidence Gate, Requirements & Research
|
|
248
|
-
- Stop if init incomplete or requirements exist (unless regenerate). Respect `scope_lock`.
|
|
249
|
-
- Load `references/research-strategy.md` + `references/codebase-analysis.md`
|
|
250
|
-
- **Scout mandatory** when changing existing behavior, touching API/CLI/export/schema/auth/config/hook/runtime contracts, lacking paths, invalidating tests, resuming old specs, or crossing package boundaries.
|
|
251
|
-
- **External research mandatory** for third-party APIs/libs/policies/AI/security/auth/payment/privacy/standards, or "best/optimal/latest/recommended".
|
|
252
|
-
- **Skip only** for trivial one-file/docs/isolated new files or user-provided report — record rationale in `research.md`.
|
|
253
|
-
- Scout is targeted (not full-repo). External prefers official/primary sources with links + date.
|
|
254
|
-
- Write `research.md` first with Evidence Summary: scout result, external or skip rationale, selected decision, rejected alternatives, gaps, task/test implications.
|
|
255
|
-
- Unresolved architecture / acceptance / multi-approach → `/hapo:brainstorm`, don't force a spec.
|
|
256
|
-
- EARS requirements (`rules/ears-format.md`) with literal IDs `R{N}.{M}` (not bare `1. 2. 3.`) so Layer 1 sub-criterion coverage works via `_Requirements: 1.1_`.
|
|
257
|
-
- Feasibility vs `research.md`; unique numeric IDs; quality = Singular, Unambiguous, Testable + NFRs. Template `templates/research.md`. Update phase + timestamps.
|
|
258
|
-
|
|
259
|
-
### Step 6: Design
|
|
260
|
-
- Stop if requirements incomplete. Discovery: `minimal` / `light` (default) / `full`.
|
|
261
|
-
- Load `rules/design-principles.md`, `rules/phase-decision-matrix.md` (implementation slices, clusters, foundation, spike needs, integration/verification gates), `references/ask-user-question-gates.md` when needed, and `rules/design-discovery-[mode].md`.
|
|
262
|
-
- Record research findings; write `design.md` from `templates/design.md`. Decisions MUST trace to `research.md` evidence.
|
|
263
|
-
- Diagrams only for multi-step/cross-boundary flows. Auth/session/transport/persistence/artifact/runtime work MUST fill `Canonical Contracts & Invariants`; tasks inherit verbatim.
|
|
264
|
-
- Any spec whose tasks span both backend and frontend surfaces MUST declare shared data shapes as named contract blocks. Declare each as `<!-- contract:NAME -->` followed by a fenced block — per `templates/design.md`. Tasks that produce/consume it add `Contracts: NAME` and copy the block verbatim; the validator then hard-fails on cross-layer drift.
|
|
265
|
-
- Update phase, timestamps, discovery mode.
|
|
266
|
-
|
|
267
|
-
### Step 7: Task Breakdown
|
|
268
|
-
- Stop if `requirements.md` or `design.md` missing. Respect `scope_lock`.
|
|
269
|
-
- Load `rules/tasks-generation.md`, `rules/phase-decision-matrix.md` (implementation slice/task cluster, not `phase-XX.md`), `rules/task-scoring-rubric.md` (priority, split/merge, spike needs, deps, parallel, evidence depth), and `references/ask-user-question-gates.md` if scoring expands scope.
|
|
270
|
-
- **Scaffold is mandatory — raw `Write` to a task file is blocked.** PreToolUse `task-scaffold-guard.cjs` rejects `Write` to `specs/<feature>/tasks/task-*.md`. Path: scaffold → Edit:
|
|
271
|
-
`node .claude/scripts/spec-scaffold.cjs <feature> --tasks "R0-01-slug,R1-01-slug,..." --tasks-only`
|
|
272
|
-
Creates stubs from `templates/task.md`, merges `task_files` + `task_registry` (no overwrite of filled tasks). **Edit-fill** all `{{...}}` (`Edit`/`MultiEdit` ok; `Write` not). Fails open if scaffold missing; disable via `"spec": { "scaffold_guard": false }`.
|
|
273
|
-
- Leave NO `{{...}}` unfilled. Related Files/tests inherit scout paths — Layer 2 grounds them at Step 8.5; phantom paths hard-fail.
|
|
274
|
-
- Each task MUST include `Completion Criteria` and `## Evidence` (legacy heading aliases still parse). Choose proof type by surface (unit / component / E2E / visual / a11y / smoke / regression / perf-security when required).
|
|
275
|
-
- Preserve `scope_lock`; deferrals = named later tasks. UI/runtime specs need a final reachability task naming a real entrypoint.
|
|
276
|
-
- Register each task: `id`, `title`, `status` (`pending`), `dependencies` (relative paths), `blocker`, `started_at`, `completed_at`, `last_updated_at`.
|
|
277
|
-
|
|
278
|
-
#### Requirement-Covered Task Grouping (MANDATORY)
|
|
279
|
-
**Naming:** `tasks/task-R{N}-{SEQ}-<slug>.md` — R0 foundation, R1+ feature; SEQ two-digit; kebab slug.
|
|
280
|
-
Example: `task-R0-01-database-schema-foundation.md`, `task-R1-01-captions-observer.md`.
|
|
281
|
-
|
|
282
|
-
Split by dependency chain (schema → service → API → UI → integration). Tasks may cover multiple IDs; IDs may span tasks. Not all under R0. Every requirement ID must appear in some task's `## Requirements`. Blast-radius breakages → explicit fix tasks. Cross-req deps via `Dependencies:`.
|
|
283
|
-
|
|
284
|
-
#### Task File Quality Requirements (MANDATORY)
|
|
285
|
-
Self-contained and implementation-ready. Structure: **Context**, **Constraints**, **Steps**, **Requirements**, **Related Files**, **Completion Criteria**, **Evidence**, **Risk Assessment**.
|
|
286
|
-
|
|
287
|
-
**Template fidelity is mandatory:** preserve the task template headings exactly. Do NOT rename `## Context` to `## Objective`, do NOT replace `## Completion Criteria` with prose, do NOT remove `## Related Files`, `## Constraints`, or `## Risk Assessment`, and do NOT collapse `## Evidence` into generic QA scenarios. Compact wording is fine; missing sections are invalid.
|
|
288
|
-
|
|
289
|
-
Parallel: append `(P)` when no data/file/approval deps. **FORBIDDEN:** vague checkboxes without exact files/requirements/evidence.
|
|
290
|
-
|
|
291
|
-
#### Definition of a Complete Task (DoCT) — the quality bar
|
|
292
|
-
|
|
293
|
-
| DoCT element | Enforced by |
|
|
294
|
-
|---|---|
|
|
295
|
-
| **Related Files** name exact real paths (Create/Modify/Delete) | Layer 2 grounding (`spec-ground.cjs`) — phantom path fails |
|
|
296
|
-
| **Contract** (API/DB/event shape) stated concretely | Layer 1 contract-drift check (`<!-- contract:NAME -->`) |
|
|
297
|
-
| **Acceptance** measurable (no "fast/nice/safe" without a threshold) | EARS rule + reviewer judgment |
|
|
298
|
-
| **Evidence** uses commands that exist in the project (`package.json`) | Author + grounding spirit; never invent test commands |
|
|
299
|
-
| **Reachability** names a real entrypoint/caller | `Runtime reachability verification` (Layer 1 presence) + judgment |
|
|
300
|
-
| **Requirements mapping** present (`_Requirements: x.y_`) | Layer 1 coverage check |
|
|
301
|
-
| **FE fidelity** — if a visual reference is provided, task carries concrete values + `match <reference>` constraint | `tasks-generation.md` Frontend Fidelity Rule + reviewer/visual check |
|
|
302
|
-
|
|
303
|
-
Unfilled `{{...}}` fails DoCT. Layer 1+2 are the floor; reviewer judgment covers the rest.
|
|
304
|
-
|
|
305
|
-
### Step 8: Validation Review (Optional)
|
|
306
|
-
Load: `references/review.md` + `rules/design-review.md` + `references/ask-user-question-gates.md` before applying findings that change scope/contracts/tasks.
|
|
307
|
-
- Auto-depth: **< 3 tasks, no security** → Validate only; **≥ 5 OR security/migration** → Red Team then Validate; user request → respect
|
|
308
|
-
- `validation_recommended = true` for auth/session/privacy/deletion/migration/schema/AI-provider/extension-permissions or 5+ tasks
|
|
309
|
-
- Red Team always before Validate when both run. MUST NOT skip Red Team for code-auditor reviews. MUST NOT create implementation files.
|
|
310
|
-
- `validation.status = "completed"` only after findings propagated into requirements/design/tasks/spec.json.
|
|
311
|
-
- **Deterministic Gate (2 layers):** `validate-spec-output.cjs` + `spec-ground.cjs` after fixes. Either script failing overrides any LLM checklist result and blocks `ready_for_implementation = true`.
|
|
312
|
-
|
|
313
|
-
### Step 8.5: Finalization Audit (MANDATORY)
|
|
314
|
-
- Rebuild `task_files` + `task_registry` from real `tasks/` (sorted; preserve status when path matches).
|
|
315
|
-
- **Layer 1 — Structural:** `node .claude/scripts/validate-spec-output.cjs specs/<feature>` — non-zero = block.
|
|
316
|
-
- **Layer 2 — Grounding (MANDATORY):** `node .claude/scripts/spec-ground.cjs specs/<feature> [--root <work-context>]` — non-zero = block. Verifies every Modify/Delete/Read Related Files path exists or is Created earlier. Layer 1 pass + Layer 2 fail = NOT ready.
|
|
317
|
-
|
|
318
|
-
**Validator-enforced (do not re-check by hand — a clean exit clears all of these):** task_files/task_registry synced to disk; task naming `tasks/task-R{N}-{SEQ}-<slug>.md`; no forbidden artifacts; research.md Evidence Summary present; every requirement **and sub-criterion** covered by a task; each task keeps the full template (Context, Constraints, Steps, Related Files, Completion Criteria, Evidence, Risk Assessment) plus Runtime reachability; numeric requirement IDs only; validation_recommended vs validation.status; timestamps not reused from init; ready_for_implementation blocked while any error exists.
|
|
319
|
-
|
|
320
|
-
**Grounding-enforced:** every Modify/Delete/Read Related Files path exists or is Created earlier. Phantom paths hard-fail.
|
|
321
|
-
|
|
322
|
-
**Judgment-only audit:**
|
|
323
|
-
- FAIL: multi-output UI/runtime spec without final integration/reachability task.
|
|
324
|
-
- FAIL: accepted review decisions not reflected in Context/Steps/Requirements/Completion Criteria/Evidence/contracts.
|
|
325
|
-
- FAIL: stale Claude/Haiku strings outside `research.md` after provider switch.
|
|
326
|
-
- FAIL: privacy/delete-data without one canonical policy (hard-delete, or hash-based re-reg lock + retention) reused verbatim by tasks.
|
|
327
|
-
- FAIL: `validation.status=completed` without synced `validation_done`/`review_done`/`updated_at`/report metadata.
|
|
328
|
-
- `validation_recommended` without completed validation (or recorded risk acceptance) → keep `ready_for_implementation=false`.
|
|
329
|
-
- `translation.enabled` → re-sync `i18n/<code>/` after final write (mirror never blocks ready).
|
|
330
|
-
- Only after audit passes: `progress.tasks = "done"` and `ready_for_implementation = true`.
|
|
331
|
-
|
|
332
|
-
### Step 9: Completion — Context Reminder (MANDATORY)
|
|
333
|
-
Output a short summary, then this block EXACTLY (no awkward translations — keep professional):
|
|
334
|
-
|
|
335
|
-
**Command integrity:** The implementation handoff command is always `/hapo:develop <feature>`. Never suggest `/work`, `/code`, or any non-CafeKit alias as the next step for this workflow.
|
|
336
|
-
|
|
337
|
-
```
|
|
338
|
-
✅ Spec complete: specs/<feature>/
|
|
339
|
-
📌 Next step — run:
|
|
340
|
-
/hapo:develop <feature>
|
|
341
|
-
|
|
342
|
-
💡 Tip: Run /clear or start a new chat session before implementing to reduce planning context carryover.
|
|
343
49
|
```
|
|
344
50
|
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
51
|
+
- **Direct**: clear, isolated, reversible, low-risk work. Do not create a spec,
|
|
52
|
+
state, registry, task bundle, or research artifact. Run targeted verification
|
|
53
|
+
and retain proportional evidence.
|
|
54
|
+
- **Standard bounded**: create exactly `spec.json`, `requirements.md`, `design.md`, and one `feature-receipt.md`. Do not require
|
|
55
|
+
`tasks/`, `task_registry`, `reports/`, or `research.md` for a small scope.
|
|
56
|
+
- **Critical**: destructive/irreversible, auth/payment/privacy/data,
|
|
57
|
+
migration/schema, public contract, cross-runtime, difficult rollback, or
|
|
58
|
+
other persisted high-risk obligations. Add only the required durable task
|
|
59
|
+
state, registry/DAG, research, and independent audit surfaces.
|
|
60
|
+
|
|
61
|
+
Risk signals may escalate a lane but never downgrade it. A downgrade without a
|
|
62
|
+
trusted runtime-issued receipt is blocked; boolean approval fields are not
|
|
63
|
+
authorization. `--auto` never writes `user_approved: true`.
|
|
64
|
+
|
|
65
|
+
Task scoring is optional advisory input when a required task bundle needs help
|
|
66
|
+
with decomposition. It cannot choose a lane, make a task bundle mandatory, or
|
|
67
|
+
gate readiness. Cynefin is advisory for discovery/spikes only; it never adds
|
|
68
|
+
ceremony by itself.
|
|
69
|
+
|
|
70
|
+
## Dispatch and flags
|
|
71
|
+
|
|
72
|
+
Supported flags are `--auto`, `--validate`, `--status`, and `--archive`; bare
|
|
73
|
+
`status`, `archive`, and `resume` remain compatibility aliases.
|
|
74
|
+
|
|
75
|
+
1. `--status` reports state and stops.
|
|
76
|
+
2. `--validate <feature>` jumps to validation and stops on any validator error.
|
|
77
|
+
3. `--archive` runs archival rules and stops.
|
|
78
|
+
4. `--auto` generates lane-required artifacts, validates them, then pauses for
|
|
79
|
+
explicit user approval; it is always `paused` and `not-ready` at that point.
|
|
80
|
+
5. A description enters the lane-appropriate route. If no description exists,
|
|
81
|
+
ask only the minimum user-owned question needed to continue.
|
|
82
|
+
|
|
83
|
+
Before selecting a new Standard/Critical spec, inspect only the relevant active
|
|
84
|
+
state and branch match. Multiple active candidates are an ambiguity stop, not a
|
|
85
|
+
reason to pick the first directory. Direct work does not perform registry
|
|
86
|
+
discovery as ceremony.
|
|
87
|
+
|
|
88
|
+
## Phase contract
|
|
89
|
+
|
|
90
|
+
### Route and scope
|
|
91
|
+
|
|
92
|
+
Use repository evidence for facts. Ask the user only for scope, architecture,
|
|
93
|
+
acceptance, or risk decisions that evidence cannot settle. If the idea is
|
|
94
|
+
unclear or competing designs remain, stop and route to `hapo:brainstorm`.
|
|
95
|
+
Load `references/ask-user-question-gates.md` only when a user-owned decision is
|
|
96
|
+
actually needed. Multimodal/document references load their domain reference
|
|
97
|
+
only when the request contains that input.
|
|
98
|
+
|
|
99
|
+
### Requirements
|
|
100
|
+
|
|
101
|
+
Create numeric, testable requirements only for Standard/Critical work. Load
|
|
102
|
+
`rules/ears-format.md` when writing EARS acceptance criteria; it is not part of
|
|
103
|
+
the routing context. Run targeted codebase discovery when behavior, contracts,
|
|
104
|
+
paths, tests, package boundaries, or runtime surfaces are uncertain.
|
|
105
|
+
|
|
106
|
+
External research is required only when `needsResearchGrounding` or an
|
|
107
|
+
applicable persisted risk obligation says so. Otherwise record the bounded skip
|
|
108
|
+
implicitly through the selected artifact profile and do not create `research.md`.
|
|
109
|
+
|
|
110
|
+
### Design
|
|
111
|
+
|
|
112
|
+
Write `design.md` only after requirements are sufficient. Load the design
|
|
113
|
+
template/principles and `rules/phase-decision-matrix.md`. For discovery, load
|
|
114
|
+
`rules/design-discovery-light.md` for bounded work or
|
|
115
|
+
`rules/design-discovery-full.md` for complex, security-sensitive, or externally
|
|
116
|
+
uncertain work; load only the selected mode.
|
|
117
|
+
Use diagrams only for multi-step or cross-boundary
|
|
118
|
+
flows. Auth, transport, persistence, generated artifacts, runtime boundaries,
|
|
119
|
+
and deletion policy require canonical contracts and invariants.
|
|
120
|
+
|
|
121
|
+
### Task bundle (conditional)
|
|
122
|
+
|
|
123
|
+
Create tasks only when the persisted lane obligations require durable task
|
|
124
|
+
execution, traceability, or a separate task proof path. When tasks are needed,
|
|
125
|
+
load `rules/tasks-generation.md`. Load `rules/task-scoring-rubric.md` only if
|
|
126
|
+
scoring helps resolve a real split/merge or dependency question. The task
|
|
127
|
+
template and filename/registry rules are lazy inputs, not core ceremony.
|
|
128
|
+
|
|
129
|
+
Every generated task still needs exact scope, requirement mapping, completion
|
|
130
|
+
criteria, executable evidence, and runtime reachability where applicable.
|
|
131
|
+
Do not add an R0 task, integration task, spike, `(P)` marker, or DAG edge unless
|
|
132
|
+
there is a real dependency or proof boundary. Cynefin may explain a spike
|
|
133
|
+
recommendation but does not mandate one.
|
|
134
|
+
|
|
135
|
+
### Validation and finalization
|
|
136
|
+
|
|
137
|
+
Load `references/review.md` and detailed design/task rules only for an explicit
|
|
138
|
+
validation request or when the persisted policy marks validation required.
|
|
139
|
+
Always run the deterministic validator before readiness:
|
|
348
140
|
|
|
349
|
-
```
|
|
350
|
-
|
|
351
|
-
📌 Continue — run /hapo:specs and choose "Continue <feature>"
|
|
352
|
-
(or /hapo:specs <feature> --auto to finish straight to Tasks)
|
|
141
|
+
```bash
|
|
142
|
+
node .claude/scripts/validate-spec-output.cjs specs/<feature>
|
|
353
143
|
```
|
|
354
144
|
|
|
355
|
-
|
|
145
|
+
**MUST run deterministic validator.** A non-zero result overrides any LLM checklist result;
|
|
146
|
+
output MUST NOT suggest `/hapo:develop` and must keep
|
|
147
|
+
`ready_for_implementation = false`. For a task-bearing policy, also rebuild the
|
|
148
|
+
real task inventory/registry and run grounding when that validator requires it.
|
|
356
149
|
|
|
357
|
-
##
|
|
150
|
+
## Stop conditions
|
|
358
151
|
|
|
359
|
-
|
|
360
|
-
|---|---|
|
|
361
|
-
| `in_progress` or branch match | Continue vs Create new |
|
|
362
|
-
| Nothing found | Create new → Creation Mode Gate |
|
|
363
|
-
| `init` / `requirements` / `design` done | write requirements / design / break into tasks |
|
|
364
|
-
| tasks done, validation incomplete | `/hapo:specs --validate <feature>` |
|
|
365
|
-
| ready_for_implementation = true | `/hapo:develop <feature>` |
|
|
366
|
-
| `blocked` | warn which spec blocks |
|
|
367
|
-
|
|
368
|
-
`spec.json` is the single source of truth — sync phase on each transition.
|
|
369
|
-
|
|
370
|
-
### spec.json Update Rules (MANDATORY)
|
|
371
|
-
|
|
372
|
-
| Field | Rule |
|
|
373
|
-
|---|---|
|
|
374
|
-
| `schema_version` | Must be `"2.0"`; approvals use `generated` + `agent_validated` + `user_approved` per phase. Legacy `approved` field is rejected — fail closed with migration guidance. |
|
|
375
|
-
| Status | `in_progress` / `blocked` / `done` / `archived` only (never emit `in-progress`) |
|
|
376
|
-
| Timestamps | Each `timestamps.*_done` = actual ISO 8601 time at that phase; never reuse init |
|
|
377
|
-
| Approvals (Auto / full pipeline) | `generated=true` + `agent_validated=true`; `user_approved` stays false until explicit user approval (`--auto` never fabricates `user_approved`). Ready requires all three true per phase. |
|
|
378
|
-
| Approvals (Stop after Design) | phases that ran: `generated=true` + `agent_validated=true`; `user_approved=true` only after explicit user approval; later phases ungenerated; `ready_for_implementation=false` |
|
|
379
|
-
| Approvals (Step by step) | `generated=true`, `agent_validated` per agent check, `user_approved=false` until user explicitly approves |
|
|
380
|
-
| `task_files` / `task_registry` | Exact match to disk after Step 7; registry keys = relative paths with full registry fields |
|
|
381
|
-
| `validation_recommended` | `true` for auth/privacy/delete/migration/schema/extension/provider or 5+ tasks |
|
|
382
|
-
| `translation` | optional mirror metadata; never affects ready gate |
|
|
383
|
-
| `ready_for_implementation` | `true` only when requirements+design+tasks each have `generated && agent_validated && user_approved`, `progress.tasks=done`, inventories match disk, and validation completed when recommended |
|
|
152
|
+
Stop and report `BLOCKED` or `FAIL` when any of these holds:
|
|
384
153
|
|
|
385
|
-
|
|
154
|
+
- lane classification or a required trusted downgrade receipt is unavailable;
|
|
155
|
+
- scope/architecture/acceptance is unresolved and needs the user;
|
|
156
|
+
- an active-spec choice is ambiguous;
|
|
157
|
+
- a required artifact, approval, task mapping, contract, or evidence is missing;
|
|
158
|
+
- a validator, grounding check, or required research obligation fails;
|
|
159
|
+
- a path, dependency, or runtime entrypoint cannot be grounded;
|
|
160
|
+
- execution is blocked by permissions or environment.
|
|
386
161
|
|
|
387
|
-
|
|
162
|
+
Never turn a placeholder, empty result, or model claim into independent evidence;
|
|
163
|
+
an `Audit: PASS` marker is not evidence. State the exact missing proof and leave
|
|
164
|
+
the lifecycle unfinished.
|
|
388
165
|
|
|
389
|
-
|
|
390
|
-
|---|---|---|
|
|
391
|
-
| `/hapo:specs --status` | View status of all specs (alias: `status`) | — |
|
|
392
|
-
| `/hapo:specs --validate <feature>` | Validate spec (auto: red team + validate based on complexity) | `references/review.md` |
|
|
393
|
-
| `/hapo:specs --archive` | Archive completed specs + write journal (alias: `archive`) | `references/archive-workflow.md` |
|
|
394
|
-
| `/hapo:specs --auto [<desc>]` | Non-interactive: create (or resume) and run end-to-end to Tasks | — |
|
|
395
|
-
| `/hapo:specs [<desc>]` | Interactive State Discovery (continue unfinished, or create + Creation Mode Gate). Alias `resume` accepted. | — |
|
|
166
|
+
## Lifecycle and handoff
|
|
396
167
|
|
|
397
|
-
|
|
168
|
+
`spec-ready` is pre-implementation. Set `ready_for_implementation = true` only
|
|
169
|
+
after lane artifacts, explicit user approval, deterministic spec validation, and
|
|
170
|
+
grounded requirement/task mappings and contracts are complete. Execution-evidence
|
|
171
|
+
and independent-audit slots remain honestly `PENDING` when applicable; neither a
|
|
172
|
+
canonical execution receipt nor an independent closeout audit is required yet.
|
|
398
173
|
|
|
399
|
-
|
|
400
|
-
|
|
174
|
+
After implementation, feature/task closeout is a separate gate: the test owner
|
|
175
|
+
must provide one canonical execution receipt and every required independent audit.
|
|
176
|
+
Critical work requires a real independent audit when `needsIndependentAudit` is
|
|
177
|
+
persisted. Review consumes proof and never creates or claims it; `Audit: PASS` is
|
|
178
|
+
not evidence.
|
|
401
179
|
|
|
402
|
-
|
|
403
|
-
|
|
180
|
+
The shared verdict adapter keeps the workflow surface to
|
|
181
|
+
`PASS | PASS_WITH_WARNINGS | FAIL | BLOCKED`; adapters must not invent a second
|
|
182
|
+
completion enum. Warnings never erase missing proof; closeout remains unfinished
|
|
183
|
+
until its post-implementation receipt and applicable audit obligations are met.
|
|
404
184
|
|
|
405
|
-
|
|
406
|
-
- Match codebase patterns; comply with `./docs/development-rules.md`, `./docs/code-standards.md`
|
|
185
|
+
On successful completion, return paths and evidence, then:
|
|
407
186
|
|
|
408
|
-
|
|
409
|
-
|
|
187
|
+
**Command integrity:** The implementation handoff command is always
|
|
188
|
+
`/hapo:develop <feature>`. Never suggest `/work`, `/code`, or another alias.
|
|
410
189
|
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
## When TO Use / NOT
|
|
417
|
-
|
|
418
|
-
✅ Complex features, pre-code docs, team review, audit trail
|
|
419
|
-
❌ Simple bugfixes, < 1 hour changes, emergency hotfixes
|
|
190
|
+
```text
|
|
191
|
+
✅ Spec complete: specs/<feature>/
|
|
192
|
+
📌 Next step — run:
|
|
193
|
+
/hapo:develop <feature>
|
|
420
194
|
|
|
421
|
-
|
|
195
|
+
💡 Tip: Run /clear or start a new chat session before implementing to reduce planning context carryover.
|
|
196
|
+
```
|
|
422
197
|
|
|
423
|
-
|
|
198
|
+
For `--auto` or an early phase stop, use a paused block instead; keep
|
|
199
|
+
`ready_for_implementation=false` and tell the user to resume with
|
|
200
|
+
`/hapo:specs`.
|
|
424
201
|
|
|
425
|
-
|
|
202
|
+
## Lazy references
|
|
426
203
|
|
|
427
|
-
|
|
204
|
+
| Need | Load only then |
|
|
205
|
+
|---|---|
|
|
206
|
+
| user-owned questions | `references/ask-user-question-gates.md` |
|
|
207
|
+
| EARS syntax | `rules/ears-format.md` |
|
|
208
|
+
| design choices | `rules/design-principles.md`, phase matrix, selected discovery rule |
|
|
209
|
+
| task decomposition | `rules/tasks-generation.md`, optional scoring rubric, task template |
|
|
210
|
+
| validation | `references/review.md`, design review rules, validators |
|
|
211
|
+
| archive/translation/research | the matching reference only when enabled by scope/policy |
|
|
212
|
+
|
|
213
|
+
`spec.json` remains the source of truth for status, timestamps, approvals,
|
|
214
|
+
`scope_lock`, and the single `workflow_policy` snapshot. Do not emit
|
|
215
|
+
`init.json`, `spec-state.json`, `hydration.md`, shorthand task filenames, or
|
|
216
|
+
unregistered artifacts.
|