@haposoft/cafekit 0.14.1 → 0.14.2
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/README.md +7 -3
- package/bin/__tests__/installer-safety.test.js +145 -0
- package/bin/install.js +9 -1
- package/bin/lib/backup.js +60 -16
- package/bin/lib/context.js +1 -1
- package/bin/phases/claude-runtime.js +57 -4
- package/bin/phases/post-install.js +39 -26
- package/bin/phases/select-platform.js +14 -9
- package/package.json +1 -1
- package/src/claude/CLAUDE.md +1 -1
- package/src/claude/agents/code-auditor.md +1 -1
- package/src/claude/agents/debugger.md +1 -0
- package/src/claude/agents/god-developer.md +10 -1
- package/src/claude/agents/inspector.md +1 -0
- package/src/claude/agents/spec-maker.md +1 -1
- package/src/claude/agents/test-runner.md +2 -2
- package/src/claude/hooks/__tests__/privacy-block.test.js +50 -10
- package/src/claude/hooks/__tests__/spec-gate.test.js +75 -1
- package/src/claude/hooks/__tests__/state.test.js +65 -0
- package/src/claude/hooks/docs-sync.cjs +15 -21
- package/src/claude/hooks/inspect-block.cjs +1 -1
- package/src/claude/hooks/lib/config.cjs +0 -5
- package/src/claude/hooks/privacy-block.cjs +39 -62
- package/src/claude/hooks/spec-gate.cjs +18 -7
- package/src/claude/hooks/spec-state.cjs +4 -0
- package/src/claude/hooks/state.cjs +13 -3
- package/src/claude/hooks/usage.cjs +6 -0
- package/src/claude/rules/orchestrator.md +2 -2
- package/src/claude/rules/skill-domain-routing.md +27 -86
- package/src/claude/rules/skill-workflow-routing.md +11 -82
- package/src/claude/rules/state-sync.md +1 -1
- package/src/claude/runtime.json +7 -7
- package/src/claude/scripts/validate-spec-output.cjs +6 -0
- package/src/claude/skills/code-review/references/spec-compliance-review.md +1 -1
- package/src/claude/skills/develop/SKILL.md +26 -5
- package/src/claude/skills/develop/references/parallel-waves.md +112 -0
- package/src/claude/skills/develop/references/quality-gate.md +10 -2
- package/src/claude/skills/hotfix/references/parallel-patterns.md +1 -1
- package/src/claude/skills/inspect/SKILL.md +42 -113
- package/src/claude/skills/inspect/references/internal-inspection.md +16 -135
- package/src/claude/skills/specs/SKILL.md +134 -386
- package/src/claude/skills/specs/rules/tasks-generation.md +1 -1
- package/src/claude/skills/specs/templates/task.md +3 -1
- package/src/claude/skills/sync/SKILL.md +2 -2
- package/src/claude/skills/sync/references/sync-protocols.md +4 -4
- package/src/claude/skills/test/SKILL.md +1 -1
- package/src/claude/status.cjs +9 -6
- package/src/opencode/plugins/docs-sync.ts +10 -16
- package/src/claude/archive-command/code/SKILL.md +0 -55
- package/src/claude/archive-command/code/references/execution-loop.md +0 -21
- package/src/claude/archive-command/code.md +0 -17
- package/src/claude/archive-command/docs.md +0 -609
- package/src/claude/archive-command/review/codebase/parallel.md +0 -76
- package/src/claude/archive-command/spec-design.md +0 -247
- package/src/claude/archive-command/spec-init.md +0 -120
- package/src/claude/archive-command/spec-requirements.md +0 -138
- package/src/claude/archive-command/spec-status.md +0 -98
- package/src/claude/archive-command/spec-tasks.md +0 -173
- package/src/claude/archive-command/spec-validate.md +0 -118
- package/src/claude/archive-command/test.md +0 -8
|
@@ -1,88 +1,29 @@
|
|
|
1
1
|
# Skill Domain Routing
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
User wants to...
|
|
31
|
-
├── answer questions from source code/docs/specs/config -> /hapo:question
|
|
32
|
-
├── find files, locate code, scan project structure -> /hapo:inspect
|
|
33
|
-
├── diagnose an error or failing check -> /hapo:debug
|
|
34
|
-
├── understand possible side effects -> /hapo:inspect
|
|
35
|
-
└── compare external approaches or best practices -> /hapo:research
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
Local source truth comes from `/hapo:inspect`; external/current knowledge comes from `/hapo:research`.
|
|
39
|
-
|
|
40
|
-
## Documentation
|
|
41
|
-
|
|
42
|
-
```text
|
|
43
|
-
User wants to...
|
|
44
|
-
├── ask/answer documentation questions from source -> /hapo:question
|
|
45
|
-
├── create missing project docs -> /hapo:docs --init
|
|
46
|
-
├── update docs after source changes -> /hapo:docs --update
|
|
47
|
-
├── summarize codebase quickly -> /hapo:docs --summarize
|
|
48
|
-
├── reconstruct as-is docs from legacy source code -> /hapo:docs --reconstruct <scope>
|
|
49
|
-
└── create a future feature spec -> /hapo:specs
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
Keep as-is reconstruction separate from future requirements. Reconstructed docs document current behavior; specs define requested changes.
|
|
53
|
-
|
|
54
|
-
## Testing And Browser
|
|
55
|
-
|
|
56
|
-
```text
|
|
57
|
-
User wants to...
|
|
58
|
-
├── run test suites, coverage, scoped verification -> /hapo:test
|
|
59
|
-
├── E2E/unit/integration/load/security/a11y strategy -> /hapo:web-testing
|
|
60
|
-
├── drive a browser with snapshots or Browserbase -> /hapo:agent-browser
|
|
61
|
-
└── Chrome DevTools/Puppeteer evidence -> /hapo:chrome-devtools
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
## Documents And Media
|
|
65
|
-
|
|
66
|
-
```text
|
|
67
|
-
User wants to...
|
|
68
|
-
├── PowerPoint/slides -> /hapo:pptx
|
|
69
|
-
├── Word documents -> /hapo:docx
|
|
70
|
-
├── PDFs -> /hapo:pdf
|
|
71
|
-
├── spreadsheets/CSV/XLSX -> /hapo:xlsx
|
|
72
|
-
└── image/audio/video/document multimodal analysis -> /hapo:ai-multimodal
|
|
73
|
-
```
|
|
74
|
-
|
|
75
|
-
## Git And Release
|
|
76
|
-
|
|
77
|
-
```text
|
|
78
|
-
User wants to...
|
|
79
|
-
├── commit, branch, tag, push, release prep -> /hapo:git
|
|
80
|
-
└── review before release -> /hapo:code-review
|
|
81
|
-
```
|
|
82
|
-
|
|
83
|
-
## Usage Notes
|
|
84
|
-
|
|
85
|
-
- Read the selected skill's `SKILL.md` before acting.
|
|
86
|
-
- Do not activate a skill only because one keyword appears. Use the whole user intent.
|
|
87
|
-
- If a task spans multiple domains, name the primary skill and mention the secondary skill in the plan.
|
|
88
|
-
- If no domain skill fits, use the core CafeKit workflow in `skill-workflow-routing.md`.
|
|
3
|
+
Advisory routing for installed domain skills (not an automatic hook). Read the selected skill's `SKILL.md` before acting.
|
|
4
|
+
|
|
5
|
+
| Domain / intent | Skill |
|
|
6
|
+
|---|---|
|
|
7
|
+
| answer questions from source code/docs/specs/config | `/hapo:question` |
|
|
8
|
+
| file discovery, structure, blast radius | `/hapo:inspect` |
|
|
9
|
+
| style / layout / design system | `/hapo:frontend-design` |
|
|
10
|
+
| React/TypeScript UI implementation | `/hapo:frontend-development` |
|
|
11
|
+
| React/Next performance / re-renders | `/hapo:react-best-practices` |
|
|
12
|
+
| deep UI/UX polish | `/hapo:ui-ux-pro-max` |
|
|
13
|
+
| API, service, auth, database | `/hapo:backend-development` |
|
|
14
|
+
| deploy / Docker / K8s / Cloudflare / CI | `/hapo:devops` |
|
|
15
|
+
| mobile (RN / Flutter / iOS / Android) | `/hapo:mobile-development` |
|
|
16
|
+
| docs init / update / summarize | `/hapo:docs --init` / `--update` / `--summarize` |
|
|
17
|
+
| as-is reconstruction from legacy code | `/hapo:docs --reconstruct <scope>` |
|
|
18
|
+
| future feature requirements | `/hapo:specs` |
|
|
19
|
+
| run suites / scoped verification | `/hapo:test` |
|
|
20
|
+
| E2E / load / a11y strategy | `/hapo:web-testing` |
|
|
21
|
+
| browser snapshots / Browserbase | `/hapo:agent-browser` |
|
|
22
|
+
| Chrome DevTools evidence | `/hapo:chrome-devtools` |
|
|
23
|
+
| diagnose error / CI failure | `/hapo:debug` |
|
|
24
|
+
| external best practices / tool compare | `/hapo:research` |
|
|
25
|
+
| pptx / docx / pdf / xlsx / multimodal | `/hapo:pptx` / `docx` / `pdf` / `xlsx` / `ai-multimodal` |
|
|
26
|
+
| commit / branch / release prep | `/hapo:git` |
|
|
27
|
+
| review before release | `/hapo:code-review` |
|
|
28
|
+
|
|
29
|
+
Pick one primary domain skill; name a secondary only when it changes execution. If none fit, use `skill-workflow-routing.md`.
|
|
@@ -4,92 +4,21 @@ Use this rule instead of automatic prompt routing. Read the user's intent, choos
|
|
|
4
4
|
|
|
5
5
|
Do not inject or force a skill when the user explicitly asks for a direct answer, a specific command, or a different workflow.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
Claude Code selects skills from frontmatter descriptions; trust it for clear intents.
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
/hapo:question -> /hapo:brainstorm -> /hapo:specs -> /hapo:develop -> /hapo:test -> /hapo:code-review -> /hapo:git
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
| User intent | Suggested start |
|
|
14
|
-
|---|---|
|
|
15
|
-
| ask about source code, docs, specs, config, dependencies, or external/current technical facts | `/hapo:question` |
|
|
16
|
-
| vague request, missing acceptance criteria, unclear scope, stakeholder questions | ask one clarification or use `/hapo:brainstorm` |
|
|
17
|
-
| unclear idea, possible approaches, scope tradeoffs | `/hapo:brainstorm` |
|
|
18
|
-
| create requirements, design, task breakdown, validate spec | `/hapo:specs` |
|
|
19
|
-
| implement an approved spec or a specific task file | `/hapo:develop` |
|
|
20
|
-
| run tests, QA, runtime verification | `/hapo:test` |
|
|
21
|
-
| review code quality, security, regressions, maintainability | `/hapo:code-review` |
|
|
22
|
-
| commit, tag, push, branch, release prep | `/hapo:git` |
|
|
23
|
-
|
|
24
|
-
## Bug And Incident Workflow
|
|
25
|
-
|
|
26
|
-
```text
|
|
27
|
-
/hapo:debug -> /hapo:hotfix -> /hapo:test -> /hapo:code-review
|
|
28
|
-
```
|
|
29
|
-
|
|
30
|
-
| User intent | Suggested start |
|
|
31
|
-
|---|---|
|
|
32
|
-
| diagnose why something fails, find root cause, inspect CI/logs | `/hapo:debug` |
|
|
33
|
-
| fix a known bug after diagnosis, urgent regression, production issue | `/hapo:hotfix` |
|
|
34
|
-
| verify the fix and affected behavior | `/hapo:test` |
|
|
35
|
-
| check side effects before closeout | `/hapo:code-review` |
|
|
36
|
-
|
|
37
|
-
`/hapo:debug` is diagnostic-only. Do not edit product code there. Use `/hapo:hotfix` when the user asks to fix.
|
|
38
|
-
|
|
39
|
-
## Existing System Documentation Workflow
|
|
40
|
-
|
|
41
|
-
```text
|
|
42
|
-
/hapo:inspect -> /hapo:docs --reconstruct -> human review -> /hapo:specs -> /hapo:develop
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
| User intent | Suggested start |
|
|
46
|
-
|---|---|
|
|
47
|
-
| understand source structure or locate implementation areas | `/hapo:inspect` |
|
|
48
|
-
| rebuild as-is docs/requirements from a legacy codebase | `/hapo:docs --reconstruct <scope>` |
|
|
49
|
-
| update normal project docs | `/hapo:docs --update` |
|
|
50
|
-
| initialize missing docs | `/hapo:docs --init` |
|
|
51
|
-
| summarize a codebase without full docs work | `/hapo:docs --summarize` |
|
|
52
|
-
|
|
53
|
-
Do not turn reconstructed docs directly into implementation. Human review must approve the as-is docs before `/hapo:specs` defines future changes.
|
|
54
|
-
|
|
55
|
-
## Research And Analysis Workflow
|
|
9
|
+
## Core chain
|
|
56
10
|
|
|
57
11
|
```text
|
|
58
|
-
/hapo:
|
|
12
|
+
/hapo:question -> /hapo:brainstorm -> /hapo:specs -> /hapo:develop -> /hapo:test -> /hapo:code-review -> /hapo:git
|
|
59
13
|
```
|
|
60
14
|
|
|
61
|
-
|
|
62
|
-
|---|---|
|
|
63
|
-
| file discovery, codebase structure, source scouting | `/hapo:inspect` |
|
|
64
|
-
| affected files, blast radius, dependency impact, side effects | `/hapo:inspect` |
|
|
65
|
-
| external best practices, tool comparison, technical investigation | `/hapo:research` |
|
|
66
|
-
|
|
67
|
-
Use `/hapo:research` for external knowledge. Use `/hapo:inspect` for local source truth.
|
|
68
|
-
|
|
69
|
-
## Delegation Workflow
|
|
70
|
-
|
|
71
|
-
| User intent | Suggested skill |
|
|
72
|
-
|---|---|
|
|
73
|
-
| assign/offload an implementation task to an external agent CLI (codex, grok) | `/hapo:delegate` |
|
|
74
|
-
|
|
75
|
-
Claude Code remains the orchestrator: it writes the task brief, dispatches, monitors, and independently verifies the returned work.
|
|
76
|
-
|
|
77
|
-
## Output Artifact Workflow
|
|
78
|
-
|
|
79
|
-
| User intent | Suggested skill |
|
|
80
|
-
|---|---|
|
|
81
|
-
| PowerPoint or slide deck creation/editing | `/hapo:pptx` |
|
|
82
|
-
| Word documents | `/hapo:docx` |
|
|
83
|
-
| PDF processing | `/hapo:pdf` |
|
|
84
|
-
| spreadsheets | `/hapo:xlsx` |
|
|
85
|
-
| screenshots, images, audio, video, OCR, multimodal understanding | `/hapo:ai-multimodal` |
|
|
15
|
+
Bug path: `/hapo:debug -> /hapo:hotfix` then test/review. As-is docs: `/hapo:inspect` → `/hapo:docs --reconstruct <scope>` → human review → specs → develop. Delegate implementation to an external agent CLI: `/hapo:delegate`.
|
|
86
16
|
|
|
87
|
-
##
|
|
17
|
+
## Ambiguous cases
|
|
88
18
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
-
|
|
92
|
-
-
|
|
93
|
-
-
|
|
94
|
-
-
|
|
95
|
-
- If the user asks to "fix" and root cause is unknown, start with `/hapo:debug` unless the issue is trivial and local.
|
|
19
|
+
| Ambiguity | Prefer | Not when |
|
|
20
|
+
|---|---|---|
|
|
21
|
+
| debug-vs-hotfix | `/hapo:debug` first when root cause unknown | Root cause is known / trivial local fix → `/hapo:hotfix` |
|
|
22
|
+
| question-vs-research | `/hapo:question` to ask about source code, docs, specs, config, dependencies, or project facts | External best-practice comparison / multi-source investigation → `/hapo:research` |
|
|
23
|
+
| question-vs-brainstorm | `/hapo:question` for factual answers with evidence | Vague idea, missing acceptance criteria, unclear scope, multi-approach tradeoffs → `/hapo:brainstorm` |
|
|
24
|
+
| specs-vs-brainstorm | `/hapo:specs` when intent and acceptance are concrete enough | Unclear idea / architecture choices still open → `/hapo:brainstorm` first |
|
|
@@ -28,4 +28,4 @@ Before returning control to the user or orchestrator, the agent **MUST**:
|
|
|
28
28
|
|
|
29
29
|
### Completion gate (Stop)
|
|
30
30
|
|
|
31
|
-
Marking a task `done` is now machine-gated on the **Stop** hook (`spec-gate.cjs`), not only reminded on each prompt. When a turn ends with *newly-done* tasks, the gate requires a verification receipt in each task markdown: `Status: done`,
|
|
31
|
+
Marking a task `done` is now machine-gated on the **Stop** hook (`spec-gate.cjs`), not only reminded on each prompt. When a turn ends with *newly-done* tasks, the gate requires a verification receipt in each task markdown: `Status: done`, `## Evidence` (legacy heading aliases still parse) with real proof (no `{{...}}` placeholders; at least one fenced command block or PASS/FAIL line), and a non-empty `task_registry[path].completed_at`. First adoption (no cache yet) seeds history without blocking. Escape hatch for humans: `"spec": { "completion_gate": false }` in `.claude/runtime.json` (missing key keeps the gate ON).
|
package/src/claude/runtime.json
CHANGED
|
@@ -13,21 +13,21 @@
|
|
|
13
13
|
},
|
|
14
14
|
"paths": {
|
|
15
15
|
"docs": "docs",
|
|
16
|
-
"specs": "specs"
|
|
16
|
+
"specs": "specs",
|
|
17
|
+
"plans": "plans"
|
|
17
18
|
},
|
|
18
19
|
"spec": {
|
|
19
20
|
"scaffold_guard": true,
|
|
20
|
-
"completion_gate": true
|
|
21
|
+
"completion_gate": true,
|
|
22
|
+
"tollgate": true
|
|
23
|
+
},
|
|
24
|
+
"develop": {
|
|
25
|
+
"parallel": true
|
|
21
26
|
},
|
|
22
27
|
"locale": {
|
|
23
28
|
"thinkingLanguage": null,
|
|
24
29
|
"responseLanguage": null
|
|
25
30
|
},
|
|
26
|
-
"skills": {
|
|
27
|
-
"research": {
|
|
28
|
-
"useGemini": true
|
|
29
|
-
}
|
|
30
|
-
},
|
|
31
31
|
"usage": {
|
|
32
32
|
"enabled": true
|
|
33
33
|
},
|
|
@@ -113,6 +113,7 @@ function validateTaskSections(taskPath, content, errors) {
|
|
|
113
113
|
hasHeading(content, 'Requirements') || /_Requirements:\s*[^_\n]+_/i.test(content);
|
|
114
114
|
const hasRelatedFiles = hasHeading(content, 'Related Files');
|
|
115
115
|
const hasCompletionCriteria = hasHeading(content, 'Completion Criteria');
|
|
116
|
+
// legacy heading aliases: read-compat only, no longer advertised
|
|
116
117
|
const hasEvidence =
|
|
117
118
|
hasHeading(content, 'Evidence') ||
|
|
118
119
|
hasHeading(content, 'Task Test Plan & Verification Evidence') ||
|
|
@@ -365,6 +366,11 @@ function validateSpec(specDir) {
|
|
|
365
366
|
const contractDefs = fs.existsSync(designPath)
|
|
366
367
|
? extractContractDefs(fs.readFileSync(designPath, 'utf8'))
|
|
367
368
|
: new Map();
|
|
369
|
+
if (taskFiles.length >= 5 && contractDefs.size === 0) {
|
|
370
|
+
warnings.push(
|
|
371
|
+
'design.md declares no contract blocks; specs spanning BE/FE must declare shared shapes (<!-- contract:NAME -->)',
|
|
372
|
+
);
|
|
373
|
+
}
|
|
368
374
|
for (const taskFile of taskFiles) {
|
|
369
375
|
const fullPath = path.join(specDir, taskFile);
|
|
370
376
|
const content = fs.readFileSync(fullPath, 'utf8');
|
|
@@ -24,7 +24,7 @@ Do not attempt a standard text-based review if the project includes Visual Specs
|
|
|
24
24
|
3. If NO (Markdown Spec only): Read the spec directly and extract:
|
|
25
25
|
- requirement bullets
|
|
26
26
|
- task `Completion Criteria`
|
|
27
|
-
- task
|
|
27
|
+
- task `## Evidence` (legacy heading aliases still parse)
|
|
28
28
|
- canonical contracts/invariants from `design.md`
|
|
29
29
|
Then verify the changed files against those concrete obligations.
|
|
30
30
|
|
|
@@ -5,7 +5,7 @@ user-invocable: true
|
|
|
5
5
|
when_to_use: "Invoke to implement specs and tasks end-to-end after scope is clear."
|
|
6
6
|
category: utilities
|
|
7
7
|
keywords: [implementation, specs, build, orchestration]
|
|
8
|
-
argument-hint: "[feature-name|specs-directory-path] [task-file] [--flash] [--no-notes]"
|
|
8
|
+
argument-hint: "[feature-name|specs-directory-path] [task-file] [--flash] [--parallel [N]] [--no-notes]"
|
|
9
9
|
metadata:
|
|
10
10
|
author: haposoft
|
|
11
11
|
version: "1.0.0"
|
|
@@ -48,6 +48,27 @@ Triggered by `/hapo:develop <feature>` or `/hapo:develop specs/<feature>`.
|
|
|
48
48
|
- STOP the overall run on the first blocked task, unresolved gate failure, or missing proof.
|
|
49
49
|
- In `--flash` mode, missing full test proof does not stop the loop; record `FLASH_UNVERIFIED` and continue to the next unblocked task.
|
|
50
50
|
|
|
51
|
+
### 2b. Parallel Wave Mode (opt-in)
|
|
52
|
+
Triggered by adding `--parallel [N]` to Full-Spec mode. Load `references/parallel-waves.md` and follow it exactly — it is the operating procedure (wave planning, dispatch, merge, cleanup).
|
|
53
|
+
|
|
54
|
+
Contracts: WAVE_CONFIG
|
|
55
|
+
|
|
56
|
+
<!-- contract:WAVE_CONFIG -->
|
|
57
|
+
```jsonc
|
|
58
|
+
// .claude/runtime.json — develop parallel toggle (missing key = allowed)
|
|
59
|
+
"develop": {
|
|
60
|
+
"parallel": true // false = --parallel refused, sequential run + notice
|
|
61
|
+
}
|
|
62
|
+
// Flag: /hapo:develop <feature> --parallel [N] (N = wave cap, 1..5, default 3)
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
- Preconditions first: if `runtime.json` sets `develop.parallel: false`, refuse `--parallel`, name the key, and run the sequential loop. If the work context is not a git repository or worktree isolation is unavailable, state the reason and fall back sequential (see parallel-waves.md §1).
|
|
66
|
+
- Waves are computed from `task_registry.dependencies` with the single-writer-per-file rule; wave cap = N (1..5, default 3).
|
|
67
|
+
- Dispatch one `god-developer` per wave task — worktree isolation, background, self-contained prompt per `rules/orchestrator.md`, plus the mandatory lines in parallel-waves.md §3 (commit mandate; never edit `spec.json`/`tasks/*.md`; never touch files outside the task's `Related Files`).
|
|
68
|
+
- Quality gate (Stage A+B, unchanged) runs inside each task's worktree BEFORE merge; merge = sequential `git cherry-pick` of agent commits with explicit worktree/branch cleanup (spike-verified — see parallel-waves.md §5); post-merge integration check gates the next wave.
|
|
69
|
+
- The orchestrator is the single writer of spec state: registry/task-md/receipts update after each cherry-pick, exactly as in sequential mode.
|
|
70
|
+
- Without `--parallel`, nothing in this section applies — the sequential Full-Spec loop below is unchanged.
|
|
71
|
+
|
|
51
72
|
### 3. Flash Mode
|
|
52
73
|
Triggered by adding `--flash` to either specific-task or full-spec mode.
|
|
53
74
|
|
|
@@ -76,7 +97,7 @@ DO NOT write implementation code until an approved spec exists.
|
|
|
76
97
|
|
|
77
98
|
<DEFINITION-OF-DONE>
|
|
78
99
|
A task is NOT done because code compiles or a placeholder renders.
|
|
79
|
-
A task is done only when the task file's Completion Criteria AND Evidence
|
|
100
|
+
A task is done only when the task file's Completion Criteria AND `## Evidence` (legacy heading aliases still parse) are satisfied with real execution proof.
|
|
80
101
|
`--flash` is the only exception: it records fast implementation closeout with `FLASH_UNVERIFIED`, not full Definition of Done.
|
|
81
102
|
</DEFINITION-OF-DONE>
|
|
82
103
|
|
|
@@ -95,7 +116,7 @@ You MUST implement all scoped behavior for the active task, MUST NOT add out-of-
|
|
|
95
116
|
| Thought (Excuse) | Reality (Rule) |
|
|
96
117
|
|-------------------|----------------|
|
|
97
118
|
| "No need to scout first" | Coding without knowing the architecture is blind. ALWAYS call the `inspector` agent to scan files. |
|
|
98
|
-
| "Review process is too tedious, let me just finish it myself" | The system needs an audit trail through agents. ALWAYS delegate via `
|
|
119
|
+
| "Review process is too tedious, let me just finish it myself" | The system needs an audit trail through agents. ALWAYS delegate via the `Agent` tool. |
|
|
99
120
|
|
|
100
121
|
## Absolute Workflow
|
|
101
122
|
|
|
@@ -132,7 +153,7 @@ flowchart TD
|
|
|
132
153
|
- Objective + Constraints
|
|
133
154
|
- Related Files
|
|
134
155
|
- Completion Criteria
|
|
135
|
-
-
|
|
156
|
+
- `## Evidence` (legacy heading aliases still parse)
|
|
136
157
|
- Exact executable verification commands named in the task
|
|
137
158
|
- Requirement IDs referenced by the task
|
|
138
159
|
- Named technologies, frameworks, protocols, and data stores that the task/spec explicitly requires
|
|
@@ -192,7 +213,7 @@ The moment you finish coding, DO NOT proceed further. Switch to `references/qual
|
|
|
192
213
|
If `--flash` is active, use **Step 4F: Flash Gate** instead of the full automatic review loop.
|
|
193
214
|
|
|
194
215
|
- Passing Step 4 requires ALL of the following:
|
|
195
|
-
1. Automated verification passes, including preflight compile/typecheck/build health and every exact command named in the task's
|
|
216
|
+
1. Automated verification passes, including preflight compile/typecheck/build health and every exact command named in the task's `## Evidence` (legacy heading aliases still parse)
|
|
196
217
|
2. Spec compliance review passes: every scoped requirement and active task criterion is implemented, with no extras and no omissions
|
|
197
218
|
3. Code quality review passes
|
|
198
219
|
4. Task evidence passes (artifacts/runtime surfaces/reachability/negative-path checks from the task file are proven)
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
# Parallel Waves — hapo:develop `--parallel` operating procedure
|
|
2
|
+
|
|
3
|
+
Normative protocol for executing independent spec tasks concurrently. Loaded by
|
|
4
|
+
`develop/SKILL.md` when Full-Spec mode runs with `--parallel [N]`. Verified against
|
|
5
|
+
live worktree-subagent behavior (spec `develop-parallel-wave`,
|
|
6
|
+
`reports/worktree-spike.md`, 2026-07-19).
|
|
7
|
+
|
|
8
|
+
## 1. Preconditions (check before anything else)
|
|
9
|
+
|
|
10
|
+
1. `.claude/runtime.json` → `develop.parallel` is not `false` (escape hatch; missing
|
|
11
|
+
key = allowed). If `false`: refuse `--parallel`, tell the user the hatch is active
|
|
12
|
+
and which key controls it, then run the standard sequential loop.
|
|
13
|
+
2. The work context is a git repository and worktree isolation is available.
|
|
14
|
+
Otherwise: state the reason ("not a git repo" / "isolation unavailable") and run
|
|
15
|
+
the standard **sequential fallback**.
|
|
16
|
+
3. `--parallel N`: **wave cap** = N clamped to 1..5; default 3. Never exceed 5 —
|
|
17
|
+
each subagent carries a ~200K context budget (orchestrator.md resource rule).
|
|
18
|
+
|
|
19
|
+
## 2. Wave planning (normative)
|
|
20
|
+
|
|
21
|
+
```
|
|
22
|
+
ready(t) = t.status == "pending" AND every dep in task_registry[t].dependencies
|
|
23
|
+
has status == "done"
|
|
24
|
+
candidates = ready tasks in task_registry order
|
|
25
|
+
wave = first ≤cap candidates, EXCLUDING any task that shares a Create or Modify
|
|
26
|
+
path (exact normalized string match over its Related Files table) with an
|
|
27
|
+
earlier task already in the wave — the excluded task returns to the pool
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
**Single writer per file per wave** is absolute. `Read` rows never conflict.
|
|
31
|
+
If the wave is empty but pending tasks remain, dependencies are unsatisfiable in
|
|
32
|
+
parallel — finish them with the sequential loop and say so.
|
|
33
|
+
|
|
34
|
+
### Worked example
|
|
35
|
+
|
|
36
|
+
Registry: A (deps: –), B (deps: –), C (deps: A), D (deps: – but shares
|
|
37
|
+
`src/api/users.ts` Modify with B). Cap 3.
|
|
38
|
+
|
|
39
|
+
- Wave 1 = A, B (D excluded: path collision with B; C excluded: dep on A)
|
|
40
|
+
- Wave 2 = C, D (A done unblocks C; B done releases D's path)
|
|
41
|
+
|
|
42
|
+
## 3. Dispatch (one god-developer per wave task)
|
|
43
|
+
|
|
44
|
+
Every dispatch uses worktree isolation + background execution and a
|
|
45
|
+
self-contained prompt per `rules/orchestrator.md` (task file content, design and
|
|
46
|
+
requirements excerpts, work-context/specs/docs paths, acceptance criteria) plus
|
|
47
|
+
these mandatory lines:
|
|
48
|
+
|
|
49
|
+
1. "You are in an isolated git worktree. Implement ONLY this task."
|
|
50
|
+
2. "Do NOT edit `spec.json` or any `tasks/*.md` — the orchestrator owns spec state."
|
|
51
|
+
3. "Do NOT touch files outside this task's `Related Files`."
|
|
52
|
+
4. "When done, `git add` your changes and `git commit -m \"task(<id>): <title>\"` —
|
|
53
|
+
an uncommitted worktree cannot be merged."
|
|
54
|
+
5. End with the standard `Status: DONE|CONCERNS|BLOCKED|NEEDS_INFO` block, plus
|
|
55
|
+
your worktree path, branch, and commit hash(es).
|
|
56
|
+
|
|
57
|
+
The Agent result returns `worktreePath` and `worktreeBranch` — record both per task.
|
|
58
|
+
|
|
59
|
+
## 4. Quality gate — inside the worktree, before merge
|
|
60
|
+
|
|
61
|
+
Run the unchanged Stage A + Stage B gate (`references/quality-gate.md`) per task
|
|
62
|
+
**with the task's worktree as working directory**. Gate evidence from that run
|
|
63
|
+
feeds the task receipt. 3 failed rounds → COLLAPSE protocol for that task only;
|
|
64
|
+
sibling tasks in the wave keep running.
|
|
65
|
+
|
|
66
|
+
## 5. Merge protocol (spike-verified — do not improvise)
|
|
67
|
+
|
|
68
|
+
⚠️ Spike finding: worktree branches are based on **`origin/<default-branch>`**
|
|
69
|
+
(`worktree.baseRef: "fresh"` default), NOT the session HEAD. On repos whose origin
|
|
70
|
+
default diverges, `git merge <agent-branch>` explodes into unrelated conflicts.
|
|
71
|
+
|
|
72
|
+
Therefore, for each gate-passed task, **sequentially** (one at a time, registry order):
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
git cherry-pick <agent-commit> # base-agnostic: applies only the agent's diff
|
|
76
|
+
# conflict? → git cherry-pick --abort
|
|
77
|
+
# → task_registry[task].status = "blocked", blocker = one-line conflict summary
|
|
78
|
+
# → continue with the next passed task
|
|
79
|
+
git worktree remove --force .claude/worktrees/agent-<id> # NOT auto-cleaned —
|
|
80
|
+
git branch -D worktree-agent-<id> # explicit cleanup, always
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
Cleanup runs for unchanged/failed worktrees too (spike: even a read-only run
|
|
84
|
+
leaves its worktree and branch behind). Optionally set `worktree.baseRef: "head"`
|
|
85
|
+
in settings; cherry-pick remains the recipe regardless.
|
|
86
|
+
|
|
87
|
+
## 6. Post-merge integration check (per wave)
|
|
88
|
+
|
|
89
|
+
After the wave's last cherry-pick: run the project build or the affected test
|
|
90
|
+
subset (never the full suite mid-flight — that runs once at develop completion).
|
|
91
|
+
Failure = fix before computing the next wave. This is the wave gate of
|
|
92
|
+
`quality-gate.md`.
|
|
93
|
+
|
|
94
|
+
## 7. State sync — orchestrator is the single writer
|
|
95
|
+
|
|
96
|
+
Only the orchestrator writes `spec.json` and task markdown, after each task's
|
|
97
|
+
cherry-pick: registry `status`/`completed_at`/`last_updated_at`, task-md `Status`,
|
|
98
|
+
checkbox ticks, and a verification receipt citing the worktree gate evidence plus
|
|
99
|
+
the post-merge check result. The Stop completion gate (`spec-gate.cjs`) applies
|
|
100
|
+
unchanged — a receipt-less done blocks the turn. After syncing the wave, recompute
|
|
101
|
+
§2 and continue until no pending tasks remain.
|
|
102
|
+
|
|
103
|
+
## 8. Failure summary
|
|
104
|
+
|
|
105
|
+
| Event | Action |
|
|
106
|
+
|---|---|
|
|
107
|
+
| Escape hatch on / not a git repo / no isolation | Sequential fallback + stated reason |
|
|
108
|
+
| Same-wave path collision | Defer the later task to next wave (§2) |
|
|
109
|
+
| Gate fails 3× for a task | COLLAPSE for that task; wave continues |
|
|
110
|
+
| Cherry-pick conflict | Abort pick; task `blocked` + conflict blocker; wave continues |
|
|
111
|
+
| Post-merge check fails | No next wave until fixed |
|
|
112
|
+
| Empty wave, tasks pending | Sequential loop for the remainder + notice |
|
|
@@ -12,7 +12,7 @@ Green tests are NOT enough. The gate requires four proofs:
|
|
|
12
12
|
|
|
13
13
|
## Automation Semantics
|
|
14
14
|
|
|
15
|
-
- If the task names exact commands in
|
|
15
|
+
- If the task names exact commands in `## Evidence` (legacy heading aliases still parse), those exact commands are mandatory and must run before any fallback repo defaults.
|
|
16
16
|
- Preflight compile/typecheck/build health is mandatory. If compile/typecheck/build fails before tests are meaningful, the gate result is `PRECHECK_FAIL`, not `NO_TESTS`.
|
|
17
17
|
- `NO_TESTS` is never an automatic PASS.
|
|
18
18
|
- `NO_TESTS` is acceptable only when the task does **not** require a dedicated test suite command and every other required automated command/evidence item passes.
|
|
@@ -55,7 +55,7 @@ Variable: retry_count = 0
|
|
|
55
55
|
|
|
56
56
|
Before START_LOOP:
|
|
57
57
|
- Read the active task file(s)
|
|
58
|
-
- Extract Related Files, Completion Criteria, Evidence (
|
|
58
|
+
- Extract Related Files, Completion Criteria, `## Evidence` (legacy heading aliases still parse)
|
|
59
59
|
- Extract the exact executable verification commands in declaration order
|
|
60
60
|
- Extract relevant design contracts/invariants for the touched area
|
|
61
61
|
- Extract scope_lock, requirement IDs, runtime entrypoints/callers, and reachability proof obligations
|
|
@@ -129,3 +129,11 @@ Must log the Quality Gate result to the terminal for user visibility:
|
|
|
129
129
|
- **Preflight Fail:** `[x] Step 4 Quality Gate: PRECHECK_FAIL → compile/typecheck/build failed before tests mattered`
|
|
130
130
|
- **Fix Needed:** `[~] Step 4 Quality Gate: Tests/spec/evidence failed → returned to god-developer`
|
|
131
131
|
- **Awaiting Rescue:** `[!] Step 4 Quality Gate: Failed 3 rounds! Awaiting user intervention...`
|
|
132
|
+
|
|
133
|
+
## Working directory (parallel mode)
|
|
134
|
+
|
|
135
|
+
When `hapo:develop` runs in Parallel Wave Mode (`references/parallel-waves.md`), every Stage A and Stage B command for a task executes **with that task's worktree as the working directory**. Gate evidence recorded from the worktree run feeds the task's verification receipt. Thresholds, retry counter, and the COLLAPSE protocol are identical to sequential mode. A COLLAPSE of one task does not cancel other in-flight tasks of the wave.
|
|
136
|
+
|
|
137
|
+
## Post-merge integration check (per wave)
|
|
138
|
+
|
|
139
|
+
After the orchestrator cherry-picks the last gate-passed task of a wave: run the project build **or** the affected test subset (never the full suite mid-flight — it runs once at develop completion). While this check fails, the next wave MUST NOT start.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Parallel Patterns & Task Coordination
|
|
2
2
|
|
|
3
|
-
How to effectively leverage multiple subagents and native
|
|
3
|
+
How to effectively leverage multiple subagents (the `Agent` tool) and native task tracking (`TaskCreate`/`TaskUpdate`) during fix workflows.
|
|
4
4
|
|
|
5
5
|
## When to Go Parallel
|
|
6
6
|
|