@haposoft/cafekit 0.7.24 → 0.7.25
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/package.json +1 -1
- package/src/claude/agents/god-developer.md +1 -1
- package/src/claude/agents/spec-maker.md +14 -7
- package/src/claude/hooks/spec-state.cjs +21 -2
- package/src/claude/rules/manage-docs.md +5 -5
- package/src/claude/rules/state-sync.md +7 -6
- package/src/claude/skills/develop/SKILL.md +8 -1
- package/src/claude/skills/specs/SKILL.md +33 -6
- package/src/claude/skills/specs/references/review.md +31 -2
- package/src/claude/skills/specs/references/task-hydration.md +14 -12
- package/src/claude/skills/specs/rules/tasks-generation.md +4 -0
- package/src/claude/skills/specs/templates/design.md +2 -1
- package/src/claude/skills/specs/templates/init.json +3 -1
- package/src/claude/skills/sync/SKILL.md +11 -10
- package/src/claude/skills/sync/references/sync-protocols.md +33 -13
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@haposoft/cafekit",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.25",
|
|
4
4
|
"description": "Claude Code-first spec-driven workflow for AI coding assistants. Bundles CafeKit hapo: skills, runtime hooks, agents, and installer scaffolding.",
|
|
5
5
|
"author": "Haposoft <nghialt@haposoft.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -35,7 +35,7 @@ Any logic gaps must be clarified BEFORE typing, not discovered after bugs ship.
|
|
|
35
35
|
### 1. Read & Understand Input
|
|
36
36
|
|
|
37
37
|
When activated, you will receive one of two input types:
|
|
38
|
-
- **Task file list** (`tasks/task-01-*.md`, `task-
|
|
38
|
+
- **Task file list** (`tasks/task-R0-01-*.md`, `task-R1-01-*.md`...) with `spec.json`.
|
|
39
39
|
- **Direct description** from the main agent or `hapo:develop` skill.
|
|
40
40
|
*(Always proactively leverage domain-specific best practices by invoking `hapo:frontend-development`, `hapo:backend-development`, `hapo:mobile-development`, or `hapo:react-best-practices` depending on the current task).*
|
|
41
41
|
|
|
@@ -85,6 +85,7 @@ Before writing `design.md`, select a discovery mode and record the reason:
|
|
|
85
85
|
- For light mode: Load `{{SKILLS_DIR}}/specs/rules/design-discovery-light.md`
|
|
86
86
|
- Include Mermaid diagrams for multi-step or cross-boundary flows
|
|
87
87
|
- For auth/session, transport/entrypoint, persistence/schema, generated-artifact, or runtime-sensitive work: fill the `Canonical Contracts & Invariants` section and keep those decisions stable across all task files.
|
|
88
|
+
- For privacy/delete-data work: the design MUST choose one canonical deletion policy and express it verbatim in `Canonical Contracts & Invariants` before tasks are generated.
|
|
88
89
|
- Record `discovery_mode` and `discovery_reason` in `spec.json.design_context`
|
|
89
90
|
|
|
90
91
|
### Requirements Traceability (MANDATORY)
|
|
@@ -107,6 +108,7 @@ Before writing `design.md`, select a discovery mode and record the reason:
|
|
|
107
108
|
- Apply `(P)` parallel markers when applicable (load `{{SKILLS_DIR}}/specs/rules/tasks-parallel-analysis.md`)
|
|
108
109
|
- Every task MUST include `Verification & Evidence` with exact commands, artifacts/runtime surfaces, and negative-path checks.
|
|
109
110
|
- Completion criteria MUST be objective enough that a downstream quality gate can prove them without guesswork.
|
|
111
|
+
- Validation decisions that affect implementation MUST be written into implementation-facing sections (`Objective`, `Constraints`, `Implementation Steps`, `Completion Criteria`, `Verification & Evidence`) rather than only `Risk Assessment`.
|
|
110
112
|
|
|
111
113
|
### Sub-Task Detail Requirements (MANDATORY)
|
|
112
114
|
Each task file MUST contain granular sub-tasks with the following structure:
|
|
@@ -137,17 +139,22 @@ Task(subagent_type="researcher", prompt="Research [feature topic]")
|
|
|
137
139
|
|
|
138
140
|
## Pre-Completion Checklist
|
|
139
141
|
|
|
140
|
-
Before finalizing any specification, assert
|
|
142
|
+
Before finalizing any specification, assert every point in the `Pre-Finalization Checklist` defined in `SKILL.md`. Do not exit or declare completion until verifiable.
|
|
141
143
|
|
|
142
144
|
### Finalization Audit (MANDATORY)
|
|
143
145
|
|
|
144
146
|
Before marking the spec ready:
|
|
145
147
|
1. Re-scan `tasks/` and write `spec.json.task_files` from the real filesystem (sorted, relative paths)
|
|
146
|
-
2.
|
|
147
|
-
3. Fail if any
|
|
148
|
-
4.
|
|
149
|
-
5.
|
|
150
|
-
6.
|
|
148
|
+
2. Build or refresh `spec.json.task_registry` from the same filesystem scan. Each registry entry MUST include `id`, `title`, `status`, `dependencies` (relative task paths), `blocker`, `started_at`, `completed_at`, and `last_updated_at`
|
|
149
|
+
3. Fail if any on-disk task file is missing from `task_files`
|
|
150
|
+
4. Fail if any path in `task_files` does not exist
|
|
151
|
+
5. Fail if any on-disk task file is missing from `task_registry` or any registry path does not exist
|
|
152
|
+
6. Infer `design_context.validation_recommended = true` for auth, privacy, delete-data, migration, schema-change, browser-extension-permission, external-provider, or 5+ task file specs
|
|
153
|
+
7. If the spec scope switched away from Claude/Anthropic, fail if `requirements.md`, `design.md`, or `tasks/*.md` still contain stale provider strings like `Claude API`, `Haiku`, or `haiku_reachable`. `research.md` may mention old providers only as historical comparison.
|
|
154
|
+
8. For delete/privacy specs, fail if requirements/design/tasks mix multiple deletion policies (for example `email_hash` in one place and `deleted-<uuid>` in another) without one canonical design decision.
|
|
155
|
+
9. If `validation_recommended = true` and validation has not completed (or the user did not explicitly accept risk), keep `ready_for_implementation = false`
|
|
156
|
+
10. Reject task files that use legacy non-numeric mappings like `NFR-1`
|
|
157
|
+
11. If validation decisions were accepted, fail unless they are reflected in implementation-facing sections of affected artifacts and `spec.json.updated_at` / review timestamps reflect the reviewed state
|
|
151
158
|
|
|
152
159
|
## Execution Workflow Summary
|
|
153
160
|
|
|
@@ -175,7 +182,7 @@ specs/<feature>/
|
|
|
175
182
|
|
|
176
183
|
### 4. Handoff
|
|
177
184
|
- Update `spec.json` with `"status": "in_progress"` and `"current_phase": "develop"`
|
|
178
|
-
- Ensure `task_files`
|
|
185
|
+
- Ensure `task_files` + `task_registry` are synchronized and `ready_for_implementation` reflects the finalization audit outcome
|
|
179
186
|
- Report the spec directory path to the orchestrator
|
|
180
187
|
- DO NOT begin implementation yourself
|
|
181
188
|
|
|
@@ -63,17 +63,36 @@ try {
|
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
const phase = activeSpec.current_phase || activeSpec.phase || 'unknown';
|
|
66
|
-
|
|
66
|
+
const taskRegistry = activeSpec.task_registry || {};
|
|
67
|
+
const taskEntries = Object.entries(taskRegistry);
|
|
68
|
+
const taskCounts = taskEntries.reduce((acc, [, task]) => {
|
|
69
|
+
const status = task?.status || 'pending';
|
|
70
|
+
acc[status] = (acc[status] || 0) + 1;
|
|
71
|
+
return acc;
|
|
72
|
+
}, {});
|
|
73
|
+
const taskStatusByPath = new Map(taskEntries.map(([taskPath, task]) => [taskPath, task?.status || 'pending']));
|
|
74
|
+
const nextUnblocked = taskEntries.find(([, task]) => {
|
|
75
|
+
const status = task?.status || 'pending';
|
|
76
|
+
const deps = Array.isArray(task?.dependencies) ? task.dependencies : [];
|
|
77
|
+
return status === 'pending' && deps.every((dep) => taskStatusByPath.get(dep) === 'done');
|
|
78
|
+
});
|
|
79
|
+
|
|
67
80
|
// Format the output
|
|
68
81
|
const lines = [];
|
|
69
82
|
lines.push('');
|
|
70
83
|
lines.push('### 🔴 URGENT SYSTEM TOLLGATE (STATE SYNC) 🔴');
|
|
71
84
|
lines.push(`- **Active Feature:** \`${featureName}\``);
|
|
72
85
|
lines.push(`- **Current Phase:** \`${phase}\``);
|
|
86
|
+
if (taskEntries.length > 0) {
|
|
87
|
+
lines.push(`- **Task Registry:** \`${taskEntries.length} total | ${(taskCounts.done || 0)} done | ${(taskCounts.in_progress || 0)} in_progress | ${(taskCounts.blocked || 0)} blocked | ${(taskCounts.pending || 0)} pending\``);
|
|
88
|
+
if (nextUnblocked) {
|
|
89
|
+
lines.push(`- **Next Unblocked Task:** \`${nextUnblocked[0]}\``);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
73
92
|
lines.push('');
|
|
74
93
|
lines.push(`> BẮT BUỘC (MANDATORY): Nếu bạn vừa hoàn thành một bước, bạn KHÔNG ĐƯỢC báo cáo "Đã xong" ngay.`);
|
|
75
94
|
lines.push(`> Bạn PHẢI sử dụng công cụ Edit để cập nhật trạng thái vật lý sau khi đã có bằng chứng verify thật (build/test/runtime/artifact), không phải chỉ vì code đã viết xong.`);
|
|
76
|
-
lines.push(`> 1. Sửa file \`spec.json\` (status, phase/current_phase, timestamps, \`task_files\`, validation state nếu có thay đổi).`);
|
|
95
|
+
lines.push(`> 1. Sửa file \`spec.json\` (status, phase/current_phase, timestamps, \`task_files\`, \`task_registry\`, validation state nếu có thay đổi).`);
|
|
77
96
|
lines.push(`> 2. Chỉ khi verify xong mới sửa file \`tasks/task-*.md\` (status + tick '[x]' các sub-task và completion criteria liên quan).`);
|
|
78
97
|
lines.push(`> 3. NẾU VỪA HOÀN THÀNH 1 TASK CÓ SỬA SOURCE CODE, BẮT BUỘC cập nhật ngay tài liệu trong \`docs/\` (\`system-architecture.md\` hoặc Changelog) cho đồng bộ.`);
|
|
79
98
|
lines.push(`> CẤM VI PHẠM LUẬT TOLLGATE NÀY NHẰM ĐẢM BẢO TÍNH ĐỒNG BỘ CỦA HỆ THỐNG.`);
|
|
@@ -67,8 +67,8 @@ specs/
|
|
|
67
67
|
├── spec.json # System state machine & global status
|
|
68
68
|
├── design.md # Architecture, requirements, and data flows
|
|
69
69
|
└── tasks/
|
|
70
|
-
├── task-01-setup.md
|
|
71
|
-
└── task-
|
|
70
|
+
├── task-R0-01-setup.md # Actionable granular steps for development
|
|
71
|
+
└── task-R1-01-api.md # Next requirement-driven task
|
|
72
72
|
```
|
|
73
73
|
|
|
74
74
|
### The State Machine (`spec.json`)
|
|
@@ -81,11 +81,11 @@ This blueprint covers:
|
|
|
81
81
|
- **Data Flow:** Mandatory Mermaid Data Flow Diagram detailing state transitions, DB interactions, and API payloads.
|
|
82
82
|
- **Risk Assessment:** Pre-identified failure points and mitigations.
|
|
83
83
|
|
|
84
|
-
### Execution Checklists (`tasks/task-
|
|
85
|
-
Work is decomposed into
|
|
84
|
+
### Execution Checklists (`tasks/task-R*.md`)
|
|
85
|
+
Work is decomposed into requirement-driven markdown task files.
|
|
86
86
|
Each task file contains:
|
|
87
87
|
- **Prerequisites:** Blockers that must clear before this stage begins. (Task N+1 cannot start without Task N defining its payload).
|
|
88
88
|
- **Execution Checklist:** Granular `[ ]` markdown items for agents to toggle `[x]` as they implement code.
|
|
89
89
|
- **Success Criteria:** Strict definition of "Done".
|
|
90
90
|
|
|
91
|
-
Comply with the overarching rules in `./rules/ai-dev-rules.md`.
|
|
91
|
+
Comply with the overarching rules in `./rules/ai-dev-rules.md`.
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
## Single Source of Truth
|
|
4
4
|
|
|
5
5
|
In any Spec-driven workflow (`hapo:specs`), the state of the project is physically persisted in **two layers**:
|
|
6
|
-
1. **Machine Layer (`spec.json`)**: Tracks phase, status, and
|
|
6
|
+
1. **Machine Layer (`spec.json`)**: Tracks phase, status, overall completion, and per-task machine state via `task_registry`.
|
|
7
7
|
2. **Human Layer (`tasks/task-*.md`)**: Checkboxes indicating granular execution progress.
|
|
8
8
|
|
|
9
9
|
## The Sync-back Rule (Mandatory)
|
|
@@ -12,15 +12,16 @@ Whenever an agent finishes a task or blocks due to an issue, it **MUST NOT** sim
|
|
|
12
12
|
Before returning control to the user or orchestrator, the agent **MUST**:
|
|
13
13
|
|
|
14
14
|
### On Success:
|
|
15
|
-
1. Update `spec.json`: Modify `current_phase` if moving forward, ensure `status` accurately reflects progress,
|
|
16
|
-
2. Edit `task-
|
|
15
|
+
1. Update `spec.json`: Modify `current_phase` if moving forward, ensure `status` accurately reflects progress, keep `task_files` synchronized with the real files on disk, and update the corresponding `task_registry` entry (`status`, `blocker`, `started_at`, `completed_at`, `last_updated_at`).
|
|
16
|
+
2. Edit `task-R*.md`: Change `Status` only after real verification has passed (build/test/runtime/artifact). Then check `[x]` the sub-task boxes and relevant completion criteria.
|
|
17
17
|
3. Call `TaskUpdate` if Claude Tasks are active, setting the status to "completed" only after the physical files were updated.
|
|
18
18
|
|
|
19
19
|
### On Block/Failure (>3 retries):
|
|
20
20
|
1. Update `spec.json`: Set `"status": "blocked"` and fill out the `"blocker"` string with the root cause.
|
|
21
|
-
2.
|
|
22
|
-
3.
|
|
21
|
+
2. Update the corresponding `task_registry` entry to `blocked`, persist the blocker reason, and stamp `last_updated_at`.
|
|
22
|
+
3. Edit `task-R*.md`: Change `Status: pending` (or `in_progress`) to `Status: blocked` with a note.
|
|
23
|
+
4. Alert the orchestrator or user via `AskUserQuestion` or explicit warning.
|
|
23
24
|
|
|
24
25
|
**Canonical state values:** New specs MUST use `status: "in_progress"` for active work. Legacy `in-progress` may be read for compatibility, but must not be emitted in new files.
|
|
25
26
|
|
|
26
|
-
**Golden Rule:** If the current phase changes, or a task completes, the agent must update the physical files. Never mark a task completed before there is execution proof. The context is intentionally NOT persisted in the chat to save tokens. An injected Hook (`spec-state.cjs`) constantly enforces and validates this state.
|
|
27
|
+
**Golden Rule:** If the current phase changes, or a task completes, the agent must update the physical files. Never mark a task completed before there is execution proof, and never let `task_registry` disagree with the matching markdown task file. The context is intentionally NOT persisted in the chat to save tokens. An injected Hook (`spec-state.cjs`) constantly enforces and validates this state.
|
|
@@ -52,6 +52,7 @@ flowchart TD
|
|
|
52
52
|
### Step 1: Initialize & Load Spec
|
|
53
53
|
- Identify input: Open `specs/<feature-name>/spec.json`.
|
|
54
54
|
- Check `ready_for_implementation` status. If not ready, notify user.
|
|
55
|
+
- 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.
|
|
55
56
|
- **Task Scoping (CRITICAL):**
|
|
56
57
|
- If the user specifies a particular task file (e.g., `task-R0-02...md`), load **ONLY** that specific file into working memory.
|
|
57
58
|
- If no specific task is mentioned, list and load all Markdown files in `specs/<feature-name>/tasks/*.md`.
|
|
@@ -63,6 +64,7 @@ flowchart TD
|
|
|
63
64
|
- Requirement IDs referenced by the task
|
|
64
65
|
- Relevant `Canonical Contracts & Invariants` from `design.md`
|
|
65
66
|
- If the task file is missing actionable completion or verification detail, STOP and route back to spec correction. Do not guess.
|
|
67
|
+
- Before coding, set the active task(s) to `in_progress` in both markdown and `spec.json.task_registry`, or route through `/hapo:sync` if the runtime expects the sync protocol.
|
|
66
68
|
|
|
67
69
|
### Step 2: Scout (Codebase Inspection)
|
|
68
70
|
- **Mandatory:** Call agent `Task(subagent_type="inspect", ...)` to scan the overall codebase structure (e.g., where components live, where utils are). Avoid wandering into forbidden zones.
|
|
@@ -87,8 +89,13 @@ The moment you finish coding, DO NOT proceed further. Switch to `references/qual
|
|
|
87
89
|
- Only escalate to the user after 3 consecutive failed review rounds.
|
|
88
90
|
|
|
89
91
|
### Step 5: State Sync + Incremental Docs Sync
|
|
90
|
-
- Only after Step 4 passes may you mark task checkboxes completed and sync `spec.json` progress/timestamps.
|
|
92
|
+
- Only after Step 4 passes may you mark task checkboxes completed and sync `spec.json` progress/timestamps/task_registry.
|
|
91
93
|
- If verification is partial or blocked by environment, keep the task in `pending` or `in_progress` and record the blocker instead of pretending completion.
|
|
94
|
+
- A completed task MUST leave behind:
|
|
95
|
+
- markdown `**Status:** done`
|
|
96
|
+
- `spec.json.task_registry[path].status = "done"`
|
|
97
|
+
- `completed_at` + `last_updated_at`
|
|
98
|
+
- synchronized top-level `updated_at`
|
|
92
99
|
- After passing the Quality Gate, evaluate if any actual codebase modifications occurred (e.g., check pending files via git status).
|
|
93
100
|
- If files were created or modified: Trigger `docs-keeper` automatically to execute `repomix` and update the global `/docs/` and project logs.
|
|
94
101
|
- **CWD Protocol (CRITICAL):** When spawning `docs-keeper`, you MUST ensure the agent's Current Working Directory (CWD context) is explicitly set to the **Workspace Root**, NOT the inner package directory you were just coding in. Otherwise, `docs-keeper` will search for the root `docs/` folder in the wrong place and crash.
|
|
@@ -44,6 +44,7 @@ Analyze → Dependency Scan → Complexity Assessment → Init → Requirements
|
|
|
44
44
|
- Canonical active status string is `in_progress`. Legacy `in-progress` may be READ for compatibility but MUST NOT be generated in new specs.
|
|
45
45
|
- `current_phase` is required for live work and must track the active phase (`init`, `requirements`, `design`, `tasks`, `develop`, `test`, `review`).
|
|
46
46
|
- `task_files` in `spec.json` MUST exactly match the real files under `tasks/` after Step 7.
|
|
47
|
+
- `task_registry` in `spec.json` MUST exist once task files are generated and MUST contain one entry per task file, keyed by relative path.
|
|
47
48
|
- `ready_for_implementation` is a hard gate, not a convenience flag. Never set it before the finalization audit passes.
|
|
48
49
|
|
|
49
50
|
### Output Criteria
|
|
@@ -132,7 +133,7 @@ flowchart TD
|
|
|
132
133
|
P --> Q["Step 6: Design — pick discovery mode"]
|
|
133
134
|
Q --> R["Write design.md"]
|
|
134
135
|
R --> S["Step 7: Tasks — split into individual files"]
|
|
135
|
-
S --> T["Create tasks/task-
|
|
136
|
+
S --> T["Create tasks/task-R*.md + task_registry"]
|
|
136
137
|
T --> U["Step 8: Hydrate Claude Tasks if >= 3 task files"]
|
|
137
138
|
U --> V{Review?}
|
|
138
139
|
V -->|Yes| W["Run review — auto-pick red team or validation"]
|
|
@@ -218,6 +219,15 @@ Load: `references/scope-inquiry.md`
|
|
|
218
219
|
- Load `rules/tasks-parallel-analysis.md` for parallel markers (default: enabled)
|
|
219
220
|
- Each task file follows template `templates/task.md`
|
|
220
221
|
- Each task file MUST include `Completion Criteria` and `Verification & Evidence` sections detailed enough that a downstream quality gate can prove the task is truly done.
|
|
222
|
+
- Build `spec.json.task_registry` alongside `task_files`. For each task file, register at minimum:
|
|
223
|
+
- `id`
|
|
224
|
+
- `title`
|
|
225
|
+
- `status` (`pending` by default)
|
|
226
|
+
- `dependencies` (relative task paths, not prose labels)
|
|
227
|
+
- `blocker`
|
|
228
|
+
- `started_at`
|
|
229
|
+
- `completed_at`
|
|
230
|
+
- `last_updated_at`
|
|
221
231
|
- Update `spec.json` phase + task metadata
|
|
222
232
|
|
|
223
233
|
#### Requirement-Driven Task Grouping (MANDATORY)
|
|
@@ -237,7 +247,7 @@ tasks/
|
|
|
237
247
|
├── task-R1-02-gap-marker-detector.md
|
|
238
248
|
├── task-R1-03-chunk-api-endpoint.md
|
|
239
249
|
├── task-R2-01-summarize-orchestrator.md
|
|
240
|
-
├── task-R2-02-
|
|
250
|
+
├── task-R2-02-provider-integration.md
|
|
241
251
|
├── task-R3-01-consent-onboarding.md
|
|
242
252
|
...
|
|
243
253
|
```
|
|
@@ -291,13 +301,24 @@ Load: `references/review.md` + `rules/design-review.md`
|
|
|
291
301
|
- When both run: Red Team ALWAYS before Validate (red team may change the spec)
|
|
292
302
|
- **PROHIBITION:** The system MUST NOT skip Red Team because of a prior code-auditor review. Code review ≠ Spec review.
|
|
293
303
|
- **PROHIBITION:** The system MUST NOT create `.ts`, `.js`, `.py` or any implementation files during validation. Spec-only outputs.
|
|
304
|
+
- **Reconciliation Rule:** `validation.status = "completed"` is forbidden until all accepted findings and validation decisions are physically propagated into `requirements.md`, `design.md`, `tasks/*.md`, and `spec.json` where applicable.
|
|
294
305
|
|
|
295
306
|
### Step 9.5: Finalization Audit (MANDATORY)
|
|
296
307
|
- Re-scan the `tasks/` directory and rebuild `spec.json.task_files` from the real filesystem (sorted, relative paths)
|
|
308
|
+
- Rebuild `spec.json.task_registry` from the real filesystem if it is missing, stale, or missing keys. Preserve task status fields when the path still matches.
|
|
297
309
|
- FAIL if any task file exists on disk but is missing from `task_files`
|
|
298
310
|
- FAIL if any path in `task_files` does not exist on disk
|
|
311
|
+
- FAIL if any task file exists on disk but is missing from `task_registry`
|
|
312
|
+
- FAIL if any path in `task_registry` does not exist on disk
|
|
299
313
|
- FAIL if any requirement or NFR mapping uses non-numeric labels (`NFR-1`, `SEC-1`, etc.)
|
|
300
314
|
- FAIL if a task lacks `Completion Criteria` or `Verification & Evidence`
|
|
315
|
+
- FAIL if accepted validation decisions exist in reports but are not reflected in the implementation-facing sections of affected artifacts (`Objective`, `Constraints`, `Implementation Steps`, `Completion Criteria`, `Verification & Evidence`, canonical contracts, or requirements text).
|
|
316
|
+
- FAIL if the spec scope/provider was switched away from Anthropic/Claude but `requirements.md`, `design.md`, or `tasks/*.md` still contain stale provider-specific strings such as `Claude API`, `Haiku`, or `haiku_reachable`. `research.md` is the only allowed place for historical cost comparisons.
|
|
317
|
+
- FAIL if privacy/delete-data work lacks a single canonical deletion policy. The design MUST explicitly choose either:
|
|
318
|
+
1. hard-delete with no re-registration lock, or
|
|
319
|
+
2. privacy-preserving re-registration lock using a non-raw identifier (for example `email_hash` / `email_fingerprint`) with a retention period.
|
|
320
|
+
Tasks and requirements must reuse the same policy verbatim; mixed policies are invalid.
|
|
321
|
+
- FAIL if `validation.status = "completed"` but `timestamps.validation_done` / `timestamps.review_done`, `updated_at`, and report metadata are not synchronized with the final reviewed state.
|
|
301
322
|
- If `validation_recommended = true` and `validation.status` is not `completed` (or an explicit accepted-risk state recorded by the user), `ready_for_implementation` MUST remain `false`
|
|
302
323
|
- Only after this audit passes may the system mark `progress.tasks = "done"` and `ready_for_implementation = true`
|
|
303
324
|
|
|
@@ -329,7 +350,8 @@ When user calls `hapo:specs`, system checks `specs/`:
|
|
|
329
350
|
| `init` done | "Next: write requirements" |
|
|
330
351
|
| `requirements` done | "Next: architectural design" |
|
|
331
352
|
| `design` done | "Next: break into tasks" |
|
|
332
|
-
| `tasks` done | "Next: `/hapo:
|
|
353
|
+
| `tasks` done + validation recommended but incomplete | "Next: `/hapo:specs --validate <feature>`" |
|
|
354
|
+
| `tasks` done + ready_for_implementation = true | "Next: `/hapo:develop <feature>`" |
|
|
333
355
|
| Spec is `blocked` | "Warning: spec `X` is blocking this spec" |
|
|
334
356
|
|
|
335
357
|
**State persistence:** Update `spec.json` `phase` field on each transition. `spec.json` is the single source of truth.
|
|
@@ -338,7 +360,7 @@ When user calls `hapo:specs`, system checks `specs/`:
|
|
|
338
360
|
|
|
339
361
|
**Canonical status vocabulary:** Use `in_progress`, `blocked`, `done`, and `archived`. New specs MUST NOT emit `in-progress`.
|
|
340
362
|
|
|
341
|
-
**Timestamps:** Each `timestamps.*_done` field MUST use the **actual current time** (ISO 8601 with timezone) when that specific phase completes. Do NOT reuse the `init` timestamp for later phases. If running the full pipeline end-to-end, capture a fresh timestamp at each phase transition.
|
|
363
|
+
**Timestamps:** Each `timestamps.*_done` field MUST use the **actual current time** (ISO 8601 with timezone) when that specific phase completes. This includes `review_done` and `validation_done` after review/validate workflows. Do NOT reuse the `init` timestamp for later phases. If running the full pipeline end-to-end, capture a fresh timestamp at each phase transition.
|
|
342
364
|
|
|
343
365
|
**Approvals (auto-approval behavior):**
|
|
344
366
|
- When running the **full pipeline end-to-end** (init → tasks in one session): set `approvals.{phase}.generated = true` AND `approvals.{phase}.approved = true` for each completed phase before proceeding to the next.
|
|
@@ -346,6 +368,8 @@ When user calls `hapo:specs`, system checks `specs/`:
|
|
|
346
368
|
|
|
347
369
|
**Task inventory:** `task_files` MUST be present and MUST list every real task file exactly once using relative paths like `tasks/task-R1-01-example.md`.
|
|
348
370
|
|
|
371
|
+
**Task machine-state:** `task_registry` MUST be present after Step 7. Each key is a relative task path, and each value MUST contain `id`, `title`, `status`, `dependencies`, `blocker`, `started_at`, `completed_at`, and `last_updated_at`.
|
|
372
|
+
|
|
349
373
|
**Validation recommendation:** `design_context.validation_recommended` MUST be `true` for auth, privacy, delete-data, migration, schema-change, browser-extension-permission, external-provider, or 5+ task file specs.
|
|
350
374
|
|
|
351
375
|
**`ready_for_implementation`:** This field MUST only be set to `true` when ALL of the following conditions are met:
|
|
@@ -354,7 +378,8 @@ When user calls `hapo:specs`, system checks `specs/`:
|
|
|
354
378
|
3. `approvals.tasks.approved = true`
|
|
355
379
|
4. `progress.tasks = "done"`
|
|
356
380
|
5. `task_files` matches the real filesystem
|
|
357
|
-
6.
|
|
381
|
+
6. `task_registry` matches the real filesystem and does not omit any task file
|
|
382
|
+
7. If `design_context.validation_recommended = true`, `validation.status = "completed"` (or another explicit user-accepted risk state that is recorded)
|
|
358
383
|
|
|
359
384
|
If any approval is `false`, `ready_for_implementation` MUST remain `false`.
|
|
360
385
|
|
|
@@ -363,7 +388,7 @@ If any approval is `false`, `ready_for_implementation` MUST remain `false`.
|
|
|
363
388
|
```
|
|
364
389
|
specs/
|
|
365
390
|
└── <feature-name>/
|
|
366
|
-
├── spec.json # Metadata, state, scope_lock, dependencies
|
|
391
|
+
├── spec.json # Metadata, state, scope_lock, dependencies, task_registry
|
|
367
392
|
├── requirements.md # Technical requirements (EARS format)
|
|
368
393
|
├── research.md # Research notes
|
|
369
394
|
├── design.md # Architectural design
|
|
@@ -427,7 +452,9 @@ Before finalizing any specification, assert all the following:
|
|
|
427
452
|
- [ ] **Risk matrix filled**: likelihood × impact, with mitigation for High items
|
|
428
453
|
- [ ] **Test strategy defined**: what gets unit tested, integration tested, e2e validated
|
|
429
454
|
- [ ] **task_files inventory synced**: no missing or orphaned task references
|
|
455
|
+
- [ ] **task_registry synced**: every task file has exactly one machine-state entry with valid status + dependencies
|
|
430
456
|
- [ ] **Validation gate consistent**: validation_recommended and validation.status agree with spec risk
|
|
457
|
+
- [ ] **Provider wording clean**: no stale vendor/provider strings outside allowed research context
|
|
431
458
|
- [ ] **spec.json fully updated**: phase, current_phase, progress, timestamps, approvals, design_context
|
|
432
459
|
|
|
433
460
|
## When TO Use
|
|
@@ -40,6 +40,9 @@ These rules override any self-reasoning or optimization the system may attempt:
|
|
|
40
40
|
2. **No implementation code files.** This workflow produces ONLY `.md` files. If a finding requires a new shared module or config file, describe it inside the relevant `task-*.md` file. Do NOT create `.ts`, `.js`, `.py`, or any source code file.
|
|
41
41
|
3. **Findings must use the exact format** defined in Part A Step 5 below. No shortened or custom formats.
|
|
42
42
|
4. **Apply YAGNI to fixes.** When user says "configure later" or "decide later", add a single note to the task file. Do NOT generate multiple concrete implementations (e.g., 4 provider files when user only asked for abstraction).
|
|
43
|
+
5. **No false completion.** You MUST NOT set `validation.status = "completed"` or `ready_for_implementation = true` until a reconciliation audit proves the accepted findings and validation decisions are reflected in the physical spec artifacts.
|
|
44
|
+
6. **Provider drift is a real defect.** If the scope changed away from Claude/Anthropic, stale strings like `Claude API`, `Haiku`, or `haiku_reachable` in `requirements.md`, `design.md`, or `tasks/*.md` are validation failures. `research.md` may mention them only as historical comparison.
|
|
45
|
+
7. **Implementation-facing propagation is mandatory.** A decision that affects implementation is NOT considered applied if it only appears in `Risk Assessment`, `validate-log.md`, or `red-team-report.md`. It must update at least one of: `requirements.md`, `Canonical Contracts & Invariants`, `Objective`, `Constraints`, `Implementation Steps`, `Completion Criteria`, or `Verification & Evidence`.
|
|
43
46
|
|
|
44
47
|
---
|
|
45
48
|
|
|
@@ -110,6 +113,7 @@ If "Review each one": For each finding, ask: "Apply" | "Reject" | "Modify sugges
|
|
|
110
113
|
#### Step 8: Apply to Spec
|
|
111
114
|
- Edit design.md / task files directly for accepted findings
|
|
112
115
|
- Create `reports/red-team-report.md` documenting the full review session
|
|
116
|
+
- Mark a finding as `Applied To = ...` only after the physical file really contains the change
|
|
113
117
|
|
|
114
118
|
### Finding Output Format
|
|
115
119
|
|
|
@@ -141,7 +145,7 @@ If "Review each one": For each finding, ask: "Apply" | "Reject" | "Modify sugges
|
|
|
141
145
|
|
|
142
146
|
## Part B: Validation Interview
|
|
143
147
|
|
|
144
|
-
###
|
|
148
|
+
### 8-Step Workflow
|
|
145
149
|
|
|
146
150
|
#### Step 1: Read Spec
|
|
147
151
|
- `requirements.md` — technical requirements
|
|
@@ -211,6 +215,31 @@ Save to `reports/validate-log.md`:
|
|
|
211
215
|
| Risk | Task files (Risk Assessment section) |
|
|
212
216
|
| Unknown | `design.md` (add new subsection) |
|
|
213
217
|
|
|
218
|
+
**Additional propagation rules:**
|
|
219
|
+
- If the decision changes implementation behavior, update an implementation-facing section, not only `Risk Assessment`.
|
|
220
|
+
- If the decision changes scope or provider choice, scan `requirements.md`, `design.md`, and `tasks/*.md` for stale wording and normalize it.
|
|
221
|
+
- If the decision changes deletion/privacy behavior, update `Canonical Contracts & Invariants` first, then tasks that inherit that contract.
|
|
222
|
+
|
|
223
|
+
#### Step 7: Reconciliation Audit (MANDATORY)
|
|
224
|
+
Before declaring validation complete:
|
|
225
|
+
1. Re-read `spec.json`, `requirements.md`, `design.md`, and all `tasks/task-*.md`
|
|
226
|
+
2. Verify every accepted red-team finding and every validation action item is reflected in the correct physical file(s)
|
|
227
|
+
3. Fail the audit if:
|
|
228
|
+
- a report says "applied" but the file still contains the old text
|
|
229
|
+
- stale provider strings remain after a provider change
|
|
230
|
+
- delete-data/privacy artifacts mix multiple canonical policies
|
|
231
|
+
- `spec.json.updated_at`, `timestamps.review_done`, or `timestamps.validation_done` do not reflect the final reviewed state
|
|
232
|
+
4. Only after the audit passes may you:
|
|
233
|
+
- set `spec.json.validation.status = "completed"`
|
|
234
|
+
- set `spec.json.timestamps.validation_done`
|
|
235
|
+
- set `spec.json.timestamps.review_done`
|
|
236
|
+
- set `spec.json.ready_for_implementation = true` when all other gates are satisfied
|
|
237
|
+
|
|
238
|
+
#### Step 8: Final Status Write-Back
|
|
239
|
+
- Update `spec.json.updated_at` to the reconciliation time
|
|
240
|
+
- Ensure `red-team-report.md` and `validate-log.md` do not contradict `spec.json`
|
|
241
|
+
- If reconciliation fails, keep `validation.status` as `not-run` or `in_progress` and list blockers explicitly
|
|
242
|
+
|
|
214
243
|
---
|
|
215
244
|
|
|
216
245
|
## Combined Output
|
|
@@ -225,5 +254,5 @@ Validate: {Q} questions asked, {D} decisions confirmed
|
|
|
225
254
|
|
|
226
255
|
Files modified: {list}
|
|
227
256
|
|
|
228
|
-
📌 Next step: /hapo:develop <feature>
|
|
257
|
+
📌 Next step: /hapo:develop <feature> (ONLY if reconciliation audit passed)
|
|
229
258
|
```
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
## Purpose
|
|
4
4
|
|
|
5
|
-
Convert task files (persistent storage) into Claude Tasks (session-scoped only), enabling real-time progress tracking and automatic unblocking when predecessor tasks complete.
|
|
5
|
+
Convert task files (persistent storage) into Claude Tasks (session-scoped only), enabling real-time progress tracking and automatic unblocking when predecessor tasks complete. `spec.json.task_registry` is the machine-state bridge between markdown task files and session-scoped Claude Tasks.
|
|
6
6
|
|
|
7
7
|
## When to Run
|
|
8
8
|
|
|
@@ -37,23 +37,24 @@ Convert task files (persistent storage) into Claude Tasks (session-scoped only),
|
|
|
37
37
|
|
|
38
38
|
| Field | Description | Example |
|
|
39
39
|
|---|---|---|
|
|
40
|
-
| `taskNumber` | Task sequence number | `
|
|
40
|
+
| `taskNumber` | Task sequence number | `R0-02` |
|
|
41
41
|
| `priority` | Priority level | `P1`, `P2`, `P3` |
|
|
42
42
|
| `effort` | Time estimate | `2h` |
|
|
43
43
|
| `specDir` | Spec directory path | `specs/mobile-app/` |
|
|
44
|
-
| `taskFile` | Task file name | `task-
|
|
44
|
+
| `taskFile` | Task file name | `task-R0-02-extension-shell.md` |
|
|
45
45
|
|
|
46
46
|
## Hydration Workflow
|
|
47
47
|
|
|
48
|
-
1. Read all `tasks/task
|
|
49
|
-
2.
|
|
48
|
+
1. Read all `tasks/task-R*.md` files → filter incomplete tasks
|
|
49
|
+
2. Load `spec.json.task_registry` and prefer its task status/dependencies when present
|
|
50
|
+
3. Create `TaskCreate` for each major task, attach `addBlockedBy` per dependency chain:
|
|
50
51
|
```
|
|
51
|
-
Task 01 (no blockers) ← start here
|
|
52
|
-
Task 02 (addBlockedBy: [task-01-id])
|
|
53
|
-
Task
|
|
52
|
+
Task R0-01 (no blockers) ← start here
|
|
53
|
+
Task R0-02 (addBlockedBy: [task-R0-01-id])
|
|
54
|
+
Task R1-01 (addBlockedBy: [task-R0-02-id])
|
|
54
55
|
```
|
|
55
|
-
|
|
56
|
-
|
|
56
|
+
4. Create additional `TaskCreate` for high-risk steps within tasks (if any)
|
|
57
|
+
5. Verify: no dependency cycles, all tasks have complete metadata, and every hydrated task has a corresponding `task_registry` entry
|
|
57
58
|
|
|
58
59
|
## Fallback
|
|
59
60
|
|
|
@@ -78,8 +79,9 @@ Convert task files (persistent storage) into Claude Tasks (session-scoped only),
|
|
|
78
79
|
### Sync-back (after code completes)
|
|
79
80
|
1. `TaskUpdate` marks tasks as completed
|
|
80
81
|
2. Update `[ ]` → `[x]` in task files
|
|
81
|
-
3. Update `spec.json
|
|
82
|
-
4.
|
|
82
|
+
3. Update `spec.json.task_registry[path].status`, timestamps, blocker, and last_updated_at
|
|
83
|
+
4. Update `spec.json` progress for the corresponding phase
|
|
84
|
+
5. Git commit captures the state transition
|
|
83
85
|
|
|
84
86
|
## Quality Checks
|
|
85
87
|
|
|
@@ -33,6 +33,7 @@ Detail bullets must include:
|
|
|
33
33
|
- Respect architecture boundaries defined in design.md (Architecture Pattern & Boundary Map)
|
|
34
34
|
- Honor interface contracts documented in design.md
|
|
35
35
|
- Translate completion criteria into concrete proof (commands, artifacts, routes, manifests, schema objects, UI states)
|
|
36
|
+
- Reuse canonical contracts from `design.md` verbatim; never invent alternate auth/provider/deletion policies in task prose
|
|
36
37
|
- Use major task summaries sparingly—omit detail bullets if the work is fully captured by child tasks.
|
|
37
38
|
|
|
38
39
|
**End with integration tasks** to wire everything together.
|
|
@@ -113,6 +114,7 @@ Every task file MUST contain the Risk Assessment table, even if no risks are ide
|
|
|
113
114
|
- `_Requirements: X.X, Y.Y_` listing **only numeric requirement IDs** (comma-separated). Never append descriptive text, parentheses, translations, or free-form labels.
|
|
114
115
|
- For cross-cutting requirements, list every relevant requirement ID. All requirements MUST have numeric IDs in requirements.md. If an ID is missing, stop and correct requirements.md before generating tasks.
|
|
115
116
|
- Reference components/interfaces from design.md when helpful (e.g., `_Contracts: AuthService API`)
|
|
117
|
+
- If a validation interview or red-team finding changes implementation behavior, update the sub-task itself. Do NOT hide the decision only inside `Risk Assessment`.
|
|
116
118
|
|
|
117
119
|
### 5. Code-Only Focus
|
|
118
120
|
|
|
@@ -148,6 +150,8 @@ Rules:
|
|
|
148
150
|
- If the task wires entrypoints (popup, content script, route, worker, CLI command), name the exact runtime surface that must exist after implementation.
|
|
149
151
|
- If verification depends on environment or manual setup, document the blocker explicitly instead of implying success.
|
|
150
152
|
- Build success alone is NEVER enough evidence for a completed task.
|
|
153
|
+
- For provider-sensitive work, use provider-neutral wording unless the scope lock explicitly names a vendor.
|
|
154
|
+
- For delete-data/privacy work, task text MUST match the single deletion/retention policy chosen in `design.md`. Mixed policies are invalid.
|
|
151
155
|
|
|
152
156
|
## Task Hierarchy Rules
|
|
153
157
|
|
|
@@ -74,9 +74,10 @@ Capture only the contracts whose inconsistency would break downstream implementa
|
|
|
74
74
|
| Auth / session | | | |
|
|
75
75
|
| Transport / entrypoints | | | |
|
|
76
76
|
| Data / persistence | | | |
|
|
77
|
+
| Deletion / retention policy | | | |
|
|
77
78
|
| Generated artifacts / runtime outputs | | | |
|
|
78
79
|
|
|
79
|
-
> Task files must reuse the same contract wording. If implementation later needs a different contract, update this section first before generating or editing tasks.
|
|
80
|
+
> Task files must reuse the same contract wording. If the feature touches delete-data or privacy retention, explicitly decide whether re-registration is blocked and how that lock works without keeping raw PII. If implementation later needs a different contract, update this section first before generating or editing tasks.
|
|
80
81
|
|
|
81
82
|
## System Flows
|
|
82
83
|
|
|
@@ -34,6 +34,7 @@
|
|
|
34
34
|
"blocks": []
|
|
35
35
|
},
|
|
36
36
|
"task_files": [],
|
|
37
|
+
"task_registry": {},
|
|
37
38
|
"blocker": null,
|
|
38
39
|
"progress": {
|
|
39
40
|
"init": "done",
|
|
@@ -53,7 +54,8 @@
|
|
|
53
54
|
"tasks_done": null,
|
|
54
55
|
"code_done": null,
|
|
55
56
|
"test_done": null,
|
|
56
|
-
"review_done": null
|
|
57
|
+
"review_done": null,
|
|
58
|
+
"validation_done": null
|
|
57
59
|
},
|
|
58
60
|
"design_context": {
|
|
59
61
|
"discovery_mode": null,
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: hapo:sync
|
|
3
|
-
description: "Dumb-proof status tracker and file synchronizer. Updates spec.json and tasks/*.md without breaking structural schemas. Includes Auto-Audit."
|
|
3
|
+
description: "Dumb-proof status tracker and file synchronizer. Updates spec.json, task_registry, and tasks/*.md without breaking structural schemas. Includes Auto-Audit."
|
|
4
4
|
version: 1.0.0
|
|
5
|
-
argument-hint: "<feature_name> <task_id> <status> [blocker] | phase <feature_name> <next_phase> | audit <feature_name>"
|
|
5
|
+
argument-hint: "<feature_name> <task_id|task-file> <status> [blocker] | phase <feature_name> <next_phase> | audit <feature_name>"
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
# Sync (State Tracking Protocol)
|
|
9
9
|
|
|
10
|
-
This skill safely bridges the gap between active development state and physical documentation files (`spec.json`
|
|
10
|
+
This skill safely bridges the gap between active development state and physical documentation files (`spec.json` + `task_registry` + `tasks/task-R*.md`). Instead of relying on risky raw AI edits, this skill executes precise contextual replacements.
|
|
11
11
|
|
|
12
12
|
## Supported Commands
|
|
13
13
|
|
|
14
14
|
### 1. Task Synchronization
|
|
15
15
|
Update a specific task's status and automatically check its relevant sub-checkboxes.
|
|
16
16
|
|
|
17
|
-
**Usage:** `/hapo:sync <feature_name> <task_id> <status> ["optional blocker msg"]`
|
|
18
|
-
- Example 1: `/hapo:sync auth
|
|
19
|
-
- Example 2: `/hapo:sync payment task-03 blocked "API Endpoint Down"`
|
|
17
|
+
**Usage:** `/hapo:sync <feature_name> <task_id|task-file> <status> ["optional blocker msg"]`
|
|
18
|
+
- Example 1: `/hapo:sync auth R0-02 done`
|
|
19
|
+
- Example 2: `/hapo:sync payment task-R1-03-chunks-api.md blocked "API Endpoint Down"`
|
|
20
20
|
|
|
21
21
|
### 2. Phase Advancement
|
|
22
22
|
Advance the entire project to the next logical phase.
|
|
@@ -25,16 +25,17 @@ Advance the entire project to the next logical phase.
|
|
|
25
25
|
- Example: `/hapo:sync phase shopping_cart test`
|
|
26
26
|
|
|
27
27
|
### 3. State Audit
|
|
28
|
-
Scans the `spec.json` against all physical `task-
|
|
28
|
+
Scans the `spec.json` against all physical `task-R*.md` files to detect mismatches between `task_files`, `task_registry`, and markdown task headers, then repairs them.
|
|
29
29
|
|
|
30
30
|
**Usage:** `/hapo:sync audit <feature_name>`
|
|
31
31
|
- Example: `/hapo:sync audit auth`
|
|
32
32
|
|
|
33
33
|
## Directives
|
|
34
34
|
|
|
35
|
-
1. **Precision Edits:** Never overwrite the entire `spec.json` string.
|
|
36
|
-
2. **
|
|
37
|
-
3. **
|
|
35
|
+
1. **Precision Edits:** Never overwrite the entire `spec.json` string blindly. Update only the required keys, while keeping JSON valid.
|
|
36
|
+
2. **Machine + Human Sync:** Every task status update MUST modify both `spec.json.task_registry[...]` and the matching markdown task file header/status section.
|
|
37
|
+
3. **Markdown Integrity:** When marking a task `done`, only then turn `[ ]` into `[x]` inside `## Implementation Steps` and relevant `Completion Criteria` / `Verification & Evidence` checkboxes that have actual proof.
|
|
38
|
+
4. **Task Completion Hook:** When `hapo:sync` marks the final pending task as `done`, it should automatically prompt the user if they'd like to advance the phase.
|
|
38
39
|
|
|
39
40
|
## References
|
|
40
41
|
Read `references/sync-protocols.md` for exact Search/Replace regex patterns and JSON schema expectations before acting on the files.
|
|
@@ -2,34 +2,54 @@
|
|
|
2
2
|
|
|
3
3
|
The following guidelines dictate exactly how `hapo:sync` should interact with files to prevent data corruption.
|
|
4
4
|
|
|
5
|
+
**Canonical task status vocabulary:** `pending`, `in_progress`, `blocked`, `done`
|
|
6
|
+
|
|
5
7
|
## 1. Updating `spec.json`
|
|
6
8
|
|
|
7
9
|
When requested to update a phase or change task configuration, `spec.json` must maintain its strict schema (defined in `hapo:specs/templates/init.json`).
|
|
8
10
|
|
|
9
|
-
* **JSON Modification Rule:** Do not output whole files. Instead, load the JSON structure, apply the update to `status`, `current_phase`, `blocker` (if any), and overwrite the file cleanly.
|
|
10
|
-
* **
|
|
11
|
+
* **JSON Modification Rule:** Do not output whole files. Instead, load the JSON structure, apply the update to `status`, `current_phase`, `blocker` (if any), `task_files`, and the relevant `task_registry` entry, then overwrite the file cleanly.
|
|
12
|
+
* **Task Registry Rule:** Resolve the incoming task reference to a single relative path in `task_registry`. Accept either:
|
|
13
|
+
- compact task ID like `R0-02`
|
|
14
|
+
- full filename like `task-R0-02-extension-shell.md`
|
|
15
|
+
- full relative path like `tasks/task-R0-02-extension-shell.md`
|
|
16
|
+
* **Status Update:** If a task changes to `blocked`, the matching `task_registry[path].status` must become `"blocked"`, `task_registry[path].blocker` must record the reason, and `spec.json.status` / `spec.json.blocker` must reflect the top-level block if work is globally blocked.
|
|
17
|
+
* **Timestamp Rule:** Update `task_registry[path].started_at`, `completed_at`, and `last_updated_at` consistently with the new state. Also refresh `spec.json.updated_at`.
|
|
11
18
|
|
|
12
19
|
## 2. Updating `tasks/task-**.md`
|
|
13
20
|
|
|
14
|
-
The structure of `tasks/task.md` relies heavily on exact keyword markers. Follow these surgical
|
|
21
|
+
The structure of `tasks/task.md` relies heavily on exact keyword markers. Follow these surgical protocols against `tasks/task-R*.md`:
|
|
15
22
|
|
|
16
23
|
### A. Completing a Task
|
|
17
|
-
When `/hapo:sync <feature> <task-id>
|
|
18
|
-
1. Find: `**
|
|
19
|
-
2. Replace with: `**
|
|
20
|
-
3. Locate block: `##
|
|
21
|
-
4. Convert
|
|
24
|
+
When `/hapo:sync <feature> <task-id> done`:
|
|
25
|
+
1. Find: `**Status:** pending` (or `in_progress` / `blocked`).
|
|
26
|
+
2. Replace with: `**Status:** done`.
|
|
27
|
+
3. Locate block: `## Implementation Steps`.
|
|
28
|
+
4. Convert `- [ ]` into `- [x]` strictly within that section.
|
|
29
|
+
5. Update relevant checkboxes in `## Completion Criteria` and `## Verification & Evidence` only when the caller provides or the file already contains real proof.
|
|
22
30
|
|
|
23
31
|
### B. Blocking a Task
|
|
24
32
|
When `/hapo:sync <feature> <task-id> blocked "API error"`:
|
|
25
|
-
1. Find: `**
|
|
26
|
-
2. Replace with: `**
|
|
27
|
-
3. Ensure that an entry under `##
|
|
33
|
+
1. Find: `**Status:** <anything>`.
|
|
34
|
+
2. Replace with: `**Status:** blocked`.
|
|
35
|
+
3. Ensure that an entry under `## Blocker Log` exists recording the explicit reason (e.g. `API error`) and timestamp.
|
|
36
|
+
|
|
37
|
+
### C. Starting / Resuming a Task
|
|
38
|
+
When `/hapo:sync <feature> <task-id> in_progress`:
|
|
39
|
+
1. Find: `**Status:** pending` (or `blocked`).
|
|
40
|
+
2. Replace with: `**Status:** in_progress`.
|
|
41
|
+
3. Do NOT pre-check completion boxes.
|
|
42
|
+
4. Stamp `task_registry[path].started_at` if missing and refresh `last_updated_at`.
|
|
28
43
|
|
|
29
44
|
## 3. Audit Protocol
|
|
30
45
|
|
|
31
46
|
When `/hapo:sync audit <feature>` is activated:
|
|
32
47
|
1. **Load Truth:** Read `specs/<feature>/spec.json`.
|
|
33
48
|
2. **Scan Directory:** Loop through `specs/<feature>/tasks/`.
|
|
34
|
-
3. **Compare Constraints:**
|
|
35
|
-
4. **
|
|
49
|
+
3. **Compare Constraints:** Rebuild `task_files` from disk, ensure every file exists in `task_registry`, and compare markdown `**Status:**` headers against `task_registry[path].status`.
|
|
50
|
+
4. **Reconciliation Rules:**
|
|
51
|
+
- Missing registry entry → create it
|
|
52
|
+
- Missing disk file referenced in registry → remove or flag it
|
|
53
|
+
- Markdown says `done` but registry not done → registry wins only if evidence already exists; otherwise downgrade markdown or flag conflict
|
|
54
|
+
- Registry says `done` but markdown still pending → update markdown only if evidence exists
|
|
55
|
+
5. **Correction Alert:** Output a brief markdown alert detailing mismatches fixed and any unresolved conflicts requiring manual review.
|