claude-raid 0.1.7 → 0.2.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.
Files changed (40) hide show
  1. package/bin/cli.js +13 -1
  2. package/package.json +1 -1
  3. package/src/descriptions.js +26 -24
  4. package/src/init.js +6 -10
  5. package/src/merge-settings.js +0 -15
  6. package/src/remove.js +18 -16
  7. package/src/ui.js +1 -1
  8. package/src/update.js +28 -13
  9. package/template/.claude/agents/archer.md +10 -20
  10. package/template/.claude/agents/rogue.md +11 -21
  11. package/template/.claude/agents/warrior.md +8 -19
  12. package/template/.claude/agents/wizard.md +14 -247
  13. package/template/.claude/dungeon-master-rules.md +210 -0
  14. package/template/.claude/hooks/raid-lib.sh +29 -2
  15. package/template/.claude/hooks/raid-pre-compact.sh +12 -1
  16. package/template/.claude/hooks/raid-session-end.sh +23 -13
  17. package/template/.claude/hooks/raid-session-start.sh +21 -3
  18. package/template/.claude/hooks/validate-commit.sh +7 -74
  19. package/template/.claude/hooks/validate-dungeon.sh +30 -11
  20. package/template/.claude/hooks/validate-no-placeholders.sh +3 -3
  21. package/template/.claude/hooks/validate-write-gate.sh +45 -63
  22. package/template/.claude/{raid-rules.md → party-rules.md} +38 -13
  23. package/template/.claude/skills/raid-browser-chrome/SKILL.md +1 -1
  24. package/template/.claude/skills/{raid-design → raid-canonical-design}/SKILL.md +52 -16
  25. package/template/.claude/skills/{raid-implementation → raid-canonical-implementation}/SKILL.md +41 -14
  26. package/template/.claude/skills/{raid-implementation-plan → raid-canonical-implementation-plan}/SKILL.md +49 -17
  27. package/template/.claude/skills/raid-canonical-prd/SKILL.md +133 -0
  28. package/template/.claude/skills/raid-canonical-protocol/SKILL.md +211 -0
  29. package/template/.claude/skills/{raid-review → raid-canonical-review}/SKILL.md +78 -17
  30. package/template/.claude/skills/raid-debugging/SKILL.md +30 -5
  31. package/template/.claude/skills/raid-init/SKILL.md +130 -0
  32. package/template/.claude/skills/raid-tdd/SKILL.md +1 -1
  33. package/template/.claude/skills/raid-wrap-up/SKILL.md +184 -0
  34. package/template/.claude/hooks/raid-stop.sh +0 -20
  35. package/template/.claude/hooks/raid-task-completed.sh +0 -42
  36. package/template/.claude/hooks/validate-bash-writes.sh +0 -157
  37. package/template/.claude/skills/raid-browser-playwright/SKILL.md +0 -163
  38. package/template/.claude/skills/raid-finishing/SKILL.md +0 -140
  39. package/template/.claude/skills/raid-git-worktrees/SKILL.md +0 -96
  40. package/template/.claude/skills/raid-protocol/SKILL.md +0 -337
@@ -1,9 +1,9 @@
1
1
  ---
2
- name: raid-design
3
- description: "Phase 1 of Raid protocol. Wizard opens the Dungeon, agents explore freely from different angles, challenge and build on each other directly, and pin verified findings. Wizard closes when design is battle-tested."
2
+ name: raid-canonical-design
3
+ description: "Phase 2 of Canonical Quest. Agents explore design approaches from different angles based on PRD. Battle-tested design doc with mermaid diagrams. No code writing. Question chain: agents→wizard→human."
4
4
  ---
5
5
 
6
- # Raid Design — Phase 1
6
+ # Raid Design — Phase 2
7
7
 
8
8
  Turn ideas into battle-tested designs through agent-driven adversarial exploration.
9
9
 
@@ -11,6 +11,12 @@ Turn ideas into battle-tested designs through agent-driven adversarial explorati
11
11
  Do NOT write any code, scaffold any project, or take any implementation action until the Wizard has approved the design and it is committed to git. All assigned agents participate. Agents communicate via SendMessage — do not spawn subagents.
12
12
  </HARD-GATE>
13
13
 
14
+ ## Scope Check
15
+
16
+ Before asking detailed questions, assess scope. If the request describes multiple independent subsystems (e.g., "build a platform with chat, file storage, billing, and analytics"), flag this immediately. Don't spend rounds refining details of a project that needs decomposition first.
17
+
18
+ If too large for a single design: help the human decompose into sub-quests. Each sub-quest gets its own design → plan → implementation cycle. Design the first sub-quest through the normal flow.
19
+
14
20
  ## Mode Behavior
15
21
 
16
22
  - **Full Raid**: All 3 agents explore from different angles, fight directly, pin findings to Dungeon. Full design doc required.
@@ -41,7 +47,7 @@ digraph design {
41
47
  "Write design doc" -> "Adversarial spec review (agents attack directly)";
42
48
  "Adversarial spec review (agents attack directly)" -> "Spec self-review (fix inline)";
43
49
  "Spec self-review (fix inline)" -> "Human reviews written spec";
44
- "Human reviews written spec" -> "Commit + invoke raid-implementation-plan" [shape=doublecircle];
50
+ "Human reviews written spec" -> "Commit + invoke raid-canonical-implementation-plan" [shape=doublecircle];
45
51
  }
46
52
  ```
47
53
 
@@ -54,7 +60,7 @@ Complete in order:
54
60
  3. **Explore project context** — files, docs, recent commits, dependencies, conventions, patterns
55
61
  4. **Research dependencies** — API surface, versioning, compatibility, known issues. Read docs COMPLETELY.
56
62
  5. **Ask clarifying questions** — one at a time to the human, eliminate every ambiguity
57
- 6. **Open the Dungeon** — create `.claude/raid-dungeon.md` with Phase 1 header, quest, mode
63
+ 6. **Open the Dungeon** — create `{questDir}/phase-2-design.md` with Phase 2 header, quest, mode. Read PRD doc if it exists.
58
64
  7. **Dispatch with angles** — send each agent their angle via SendMessage, then go silent:
59
65
  ```
60
66
  SendMessage(to="warrior", message="DISPATCH: [quest]. Your angle: [X]...")
@@ -64,23 +70,35 @@ Complete in order:
64
70
  8. **Observe** — agents explore in their own panes, challenge each other via SendMessage, and pin findings to Dungeon. You receive messages automatically. Intervene only on protocol violations.
65
71
  9. **Close the phase** — when Dungeon has sufficient verified findings to form 2-3 approaches
66
72
  10. **Synthesize approaches** — propose 2-3 approaches from Dungeon evidence, with trade-offs and recommendation
67
- 11. **Present design** — in sections scaled to complexity, get human approval per section
68
- 12. **Write design doc** — save to specs path from `.claude/raid.json`
73
+ 11. **Present design section by section** — scale each section to its complexity (a few sentences if straightforward, up to 200-300 words if nuanced). Ask the human after each section: "Does this look right so far?" Be ready to revise before moving on. Cover: architecture, components, data flow, error handling, testing.
74
+ 12. **Write design doc** — save to `{questDir}/phase-2-design.md`. May also create `{questDir}/phase-2-diagrams.md` for mermaid charts.
69
75
  13. **Adversarial spec review** — agents attack the written spec directly, challenging each other
70
76
  14. **Spec self-review** — fix issues inline (see checklist below)
71
77
  15. **Human reviews written spec** — human approves before proceeding
72
- 16. **Commit** — `docs(design): <topic> specification`
73
- 17. **Archive Dungeon** — rename to `.claude/raid-dungeon-phase-1.md`
74
- 18. **Transition** — invoke `raid-implementation-plan`
78
+ 16. **Commit** — `docs(quest-{slug}): phase 2 design — {summary}`
79
+ 17. **Transition** — invoke `raid-canonical-implementation-plan`
75
80
 
76
81
  ## Opening the Dungeon
77
82
 
78
- Create `.claude/raid-dungeon.md`:
83
+ Create `{questDir}/phase-2-design.md` (where `{questDir}` is from raid-session):
79
84
 
80
85
  ```markdown
81
- # Dungeon — Phase 1: Design
86
+ # Phase 2: Design
82
87
  ## Quest: <task description from human>
83
88
  ## Mode: <Full Raid | Skirmish>
89
+ ## PRD: <link to phase-1-prd.md if it exists>
90
+
91
+ ### Architecture Overview
92
+
93
+ ### Data Flow
94
+
95
+ ### Component Design
96
+
97
+ ### API Contracts
98
+
99
+ ### Edge Cases & Error Handling
100
+
101
+ ### Trade-offs & Decisions
84
102
 
85
103
  ### Discoveries
86
104
 
@@ -93,6 +111,16 @@ Create `.claude/raid-dungeon.md`:
93
111
  ### Escalations
94
112
  ```
95
113
 
114
+ ## Question Chain
115
+
116
+ **Agents NEVER ask the human directly.** The question flow is:
117
+ 1. Agent discovers they need clarification → sends `WIZARD:` with the question
118
+ 2. Wizard reasons: can I answer this confidently from the PRD, codebase, or prior context?
119
+ 3. If yes → answer the agent directly via SendMessage
120
+ 4. If unsure → digest the question, formulate it clearly for the human, ask human
121
+ 5. Wizard passes human's answer back to agents with his own interpretation added
122
+ 6. Goal: minimize questions to human, batch related questions
123
+
96
124
  ## Dispatch Pattern
97
125
 
98
126
  Each agent gets the same objective but a different starting angle. After dispatch, the Wizard goes silent.
@@ -107,6 +135,13 @@ Each agent gets the same objective but a different starting angle. After dispatc
107
135
  >
108
136
  > **All**: Read the Dungeon. Build on each other's discoveries. Challenge everything. Pin only what survives. Escalate to me with `WIZARD:` only when genuinely stuck.
109
137
 
138
+ ## Design Principles
139
+
140
+ - **Isolation:** Break into units with one clear purpose, well-defined interfaces, testable independently. For each unit: what does it do, how do you use it, what does it depend on?
141
+ - **Encapsulation:** Can someone understand a unit without reading its internals? Can you change internals without breaking consumers? If not, the boundaries need work.
142
+ - **Size:** Smaller, well-bounded units are easier to reason about. When a file grows large, that's a signal it's doing too much.
143
+ - **Existing codebases:** Explore current structure first. Follow existing patterns. Only include targeted improvements where they serve the current goal — no unrelated refactoring.
144
+
110
145
  ## What Agents Must Cover
111
146
 
112
147
  Every agent addresses ALL of these from their assigned angle:
@@ -164,7 +199,7 @@ Fix issues inline.
164
199
 
165
200
  ## Design Document Structure
166
201
 
167
- Save to: specs path from `.claude/raid.json` (default: `docs/raid/specs/YYYY-MM-DD-<topic>-design.md`)
202
+ Save to: `{questDir}/phase-2-design.md`
168
203
 
169
204
  ```markdown
170
205
  # [Feature Name] Design Specification
@@ -216,8 +251,9 @@ If the team is stuck on a fundamental design choice after genuine direct debate:
216
251
 
217
252
  When the design is approved and committed:
218
253
 
219
- 1. Archive the Dungeon: rename `.claude/raid-dungeon.md` to `.claude/raid-dungeon-phase-1.md`
220
- 2. Update `.claude/raid-session` phase to `"plan"`
221
- 3. **Load the `raid-implementation-plan` skill now and begin Phase 2.**
254
+ 1. Update `.claude/raid-session` phase to `"plan"`
255
+ 2. **Commit:** `docs(quest-{slug}): phase 2 design — {summary}`
256
+ 3. **Send phase report to human:** summarize key design decisions, trade-offs resolved, what's next
257
+ 4. **Load the `raid-canonical-implementation-plan` skill now and begin Phase 3.**
222
258
 
223
259
  Do not wait. Do not ask. The next action after committing the design doc is loading the next skill.
@@ -1,9 +1,9 @@
1
1
  ---
2
- name: raid-implementation
3
- description: "Phase 3 of Raid protocol. Wizard assigns implementer and opens task Dungeon. Implementer builds with TDD. Challengers attack directly, building on each other's critiques. Wizard rotates and closes each task."
2
+ name: raid-canonical-implementation
3
+ description: "Phase 4 of Canonical Quest. Wizard assigns tasks to agents in batches (round-based). Agents build with TDD. Cross-testing after each task. Wizard orchestrates and closes when all tasks complete."
4
4
  ---
5
5
 
6
- # Raid Implementation — Phase 3
6
+ # Raid Implementation — Phase 4
7
7
 
8
8
  One builds, two attack — and the attackers attack each other's reviews too. Every implementation earns its approval through direct adversarial pressure.
9
9
 
@@ -23,7 +23,7 @@ TDD is enforced in ALL modes. This is an Iron Law.
23
23
 
24
24
  ```dot
25
25
  digraph implementation {
26
- "Wizard reads plan + Phase 2 Dungeon" -> "Create task tracking (TaskCreate)";
26
+ "Wizard reads plan + Phase 3 plan docs" -> "Create task tracking (TaskCreate)";
27
27
  "Create task tracking (TaskCreate)" -> "Wizard assigns task N (rotate implementer)";
28
28
  "Wizard assigns task N (rotate implementer)" -> "Wizard opens task Dungeon";
29
29
  "Wizard opens task Dungeon" -> "Implementer executes (TDD)";
@@ -43,15 +43,28 @@ digraph implementation {
43
43
  "All issues resolved?" -> "Wizard closes task: ruling" [label="yes"];
44
44
  "Wizard closes task: ruling" -> "More tasks?" [shape=diamond];
45
45
  "More tasks?" -> "Wizard assigns task N (rotate implementer)" [label="yes"];
46
- "More tasks?" -> "Archive Dungeon + invoke raid-review" [label="no", shape=doublecircle];
46
+ "More tasks?" -> "Archive Dungeon + invoke raid-canonical-review" [label="no", shape=doublecircle];
47
47
  }
48
48
  ```
49
49
 
50
+ ## Step 0: Critical Plan Review (before any implementation)
51
+
52
+ Each agent MUST review the plan independently before implementing:
53
+ - Are there concerns about feasibility or missing dependencies?
54
+ - Are any steps unclear or ambiguous?
55
+ - Does the plan match the design doc?
56
+ - Are the TDD steps complete with actual test code?
57
+
58
+ If concerns: raise via `WIZARD:` before starting. Fix the plan first. Never force through a flawed plan.
59
+
60
+ **Branch guard:** Never implement on main/master without explicit human consent. Create a feature branch first.
61
+
50
62
  ## Wizard Checklist
51
63
 
52
64
  1. **Read the plan** — extract all tasks, dependencies, ordering
53
- 2. **Read Phase 2 archived Dungeon** — carry forward context
54
- 3. **Set up worktree** — use `raid-git-worktrees` for isolation (optional)
65
+ 2. **Read Phase 3 plan docs** — carry forward context from `{questDir}/phase-3-plan.md` and task files
66
+ 3. **Dispatch plan review** — each agent reviews plan independently, raises concerns via WIZARD:
67
+ 4. **Resolve concerns** — fix plan issues before any implementation begins
55
68
  4. **Browser setup (if `browser.enabled` in raid.json)**:
56
69
  - Check if `browser.startup` exists — if null, invoke `raid-browser` startup discovery FIRST
57
70
  - Check if Playwright is installed — if not, first task becomes "scaffold Playwright"
@@ -64,7 +77,7 @@ digraph implementation {
64
77
  - Observe messages (auto-delivered) + Dungeon updates
65
78
  - Close with ruling via SendMessage to all agents
66
79
  7. **Track progress** — mark complete only after Wizard ruling per task
67
- 8. **After all tasks** — archive Dungeon, invoke `raid-review`
80
+ 8. **After all tasks** — archive Dungeon, invoke `raid-canonical-review`
68
81
 
69
82
  ## The Implementation Gauntlet (per task)
70
83
 
@@ -80,7 +93,7 @@ SendMessage(to="archer", message="Warrior is implementing Task N. Challenge when
80
93
  SendMessage(to="rogue", message="Warrior is implementing Task N. Challenge when they report done.")
81
94
  ```
82
95
 
83
- Phase 3 uses a single continuous Dungeon (`.claude/raid-dungeon.md`) across all tasks. The Wizard announces each task assignment via SendMessage.
96
+ Phase 4 uses `{questDir}/phase-4-implementation.md` as the implementation log. The Wizard announces each task assignment via SendMessage. Agents flag `ROUND_COMPLETE:` when done with their task.
84
97
 
85
98
  ### Step 2: Implementer Executes (TDD)
86
99
 
@@ -154,6 +167,17 @@ The Wizard closes when messages + Dungeon show all issues resolved and challenge
154
167
 
155
168
  **Never ignore an escalation.** If the implementer says it's stuck, something needs to change.
156
169
 
170
+ ## When to STOP Executing
171
+
172
+ STOP implementing immediately when:
173
+ - Missing dependency not covered in plan
174
+ - Test fails for unexpected reason (not the expected "right" failure)
175
+ - Instruction is ambiguous — two valid interpretations exist
176
+ - Verification fails repeatedly (2+ times on same step)
177
+ - Implementation diverges significantly from plan
178
+
179
+ **Ask via `WIZARD:` rather than guessing.** Don't force through blockers — they indicate plan gaps, not agent weakness. The Wizard escalates to the human if needed.
180
+
157
181
  ## Quality Gates Per Task
158
182
 
159
183
  - [ ] Tests written BEFORE implementation (TDD)
@@ -183,7 +207,7 @@ The Wizard closes when messages + Dungeon show all issues resolved and challenge
183
207
 
184
208
  - **3+ fix attempts on one task:** Question whether the task spec or design is wrong.
185
209
  - **Agent repeatedly blocked:** The plan may need revision.
186
- - **Tests can't be written:** The design may not be testable. Return to Phase 1.
210
+ - **Tests can't be written:** The design may not be testable. Return to Phase 2.
187
211
 
188
212
  ---
189
213
 
@@ -191,8 +215,11 @@ The Wizard closes when messages + Dungeon show all issues resolved and challenge
191
215
 
192
216
  When all tasks are approved and committed:
193
217
 
194
- 1. Archive the Dungeon: rename `.claude/raid-dungeon.md` to `.claude/raid-dungeon-phase-3.md`
195
- 2. Update `.claude/raid-session` phase to `"review"`
196
- 3. **Load the `raid-review` skill now and begin Phase 4.**
218
+ 1. Update `.claude/raid-session` phase to `"review"`
219
+ 2. **Commit**: `feat(quest-{slug}): phase 4 implementation — {summary}`
220
+ 3. **Send phase report to human**: what was built, test coverage, any concerns
221
+ 4. **Ask human**: "Shall we inspect the treasure? (Review phase) Or proceed directly to wrap-up?"
222
+ 5. If review → **Load `raid-canonical-review` skill and begin Phase 5**
223
+ 6. If skip → **Load `raid-wrap-up` skill and begin Phase 6**
197
224
 
198
- Do not wait. Do not ask. The next action after all implementation tasks pass is loading the next skill.
225
+ Do not wait. Do not ask twice. The next action after all tasks pass is the human's choice.
@@ -1,9 +1,9 @@
1
1
  ---
2
- name: raid-implementation-plan
3
- description: "Phase 2 of Raid protocol. Wizard opens the Dungeon, agents decompose the design into tasks through direct debate, test each other for compliance, and pin agreed tasks. Wizard closes when plan is battle-tested."
2
+ name: raid-canonical-implementation-plan
3
+ description: "Phase 3 of Canonical Quest. Agents decompose the design into tasks through round-based debate. No code writing. Output: task index + individual task files in quest directory."
4
4
  ---
5
5
 
6
- # Raid Implementation Plan — Phase 2
6
+ # Raid Implementation Plan — Phase 3
7
7
 
8
8
  Break the design into bite-sized, battle-tested tasks through agent-driven adversarial decomposition.
9
9
 
@@ -21,7 +21,7 @@ Do NOT start implementation until the plan is approved by the Wizard and committ
21
21
 
22
22
  ```dot
23
23
  digraph plan {
24
- "Wizard reads design doc + Phase 1 Dungeon" -> "Wizard opens Dungeon + dispatches";
24
+ "Wizard reads design doc + Phase 2 design doc" -> "Wizard opens Dungeon + dispatches";
25
25
  "Wizard opens Dungeon + dispatches" -> "Agents decompose independently";
26
26
  "Agents decompose independently" -> "Agents compare and fight directly";
27
27
  "Agents compare and fight directly" -> "Agents test compliance collaboratively";
@@ -34,32 +34,31 @@ digraph plan {
34
34
  "Write plan doc" -> "Adversarial plan review (agents attack directly)";
35
35
  "Adversarial plan review (agents attack directly)" -> "Self-review (6-point checklist)";
36
36
  "Self-review (6-point checklist)" -> "Wizard ruling + commit";
37
- "Wizard ruling + commit" -> "Archive Dungeon + invoke raid-implementation" [shape=doublecircle];
37
+ "Wizard ruling + commit" -> "Archive Dungeon + invoke raid-canonical-implementation" [shape=doublecircle];
38
38
  }
39
39
  ```
40
40
 
41
41
  ## Wizard Checklist
42
42
 
43
43
  1. **Read the approved design doc** — every requirement, every constraint
44
- 2. **Read the Phase 1 archived Dungeon** — carry forward verified knowledge
45
- 3. **Open the Dungeon** — create `.claude/raid-dungeon.md` with Phase 2 header
46
- 4. **Dispatch decomposition** — all agents decompose independently with different angles, then interact directly
44
+ 2. **Read the Phase 2 design doc** — carry forward verified knowledge from `{questDir}/phase-2-design.md`
45
+ 3. **Open the Dungeon** — create `{questDir}/phase-3-plan.md` with Phase 3 header
46
+ 4. **Dispatch decomposition** — all agents decompose independently with different angles, then interact directly (round-based)
47
47
  5. **Observe the fight** — agents test each other's plans, argue ordering, coverage, naming. Intervene only on triggers.
48
48
  6. **Close the phase** — when Dungeon has complete, verified task list
49
- 7. **Synthesize** — write plan doc from Dungeon evidence
49
+ 7. **Synthesize** — write plan doc from Dungeon evidence. Create individual task files: `{questDir}/phase-3-plan-task-NN.md`
50
50
  8. **Adversarial plan review** — agents attack the written plan directly
51
51
  9. **Self-review** — 6-point checklist (see below)
52
52
  10. **Wizard ruling** — final plan approval
53
- 11. **Commit** — `docs(plan): <feature> implementation plan`
54
- 12. **Archive Dungeon** — rename to `.claude/raid-dungeon-phase-2.md`
55
- 13. **Transition** — invoke `raid-implementation`
53
+ 11. **Commit** — `docs(quest-{slug}): phase 3 plan — {N} tasks, {summary}`
54
+ 12. **Transition** — invoke `raid-canonical-implementation` and begin Phase 4
56
55
 
57
56
  ## Opening the Dungeon
58
57
 
59
- Create `.claude/raid-dungeon.md`:
58
+ Create `{questDir}/phase-3-plan.md`:
60
59
 
61
60
  ```markdown
62
- # Dungeon — Phase 2: Plan
61
+ # Phase 3: Implementation Plan
63
62
  ## Quest: Decompose <design topic> into implementation tasks
64
63
  ## Mode: <Full Raid | Skirmish>
65
64
 
@@ -74,6 +73,38 @@ Create `.claude/raid-dungeon.md`:
74
73
  ### Escalations
75
74
  ```
76
75
 
76
+ ## File Structure Mapping
77
+
78
+ Before defining tasks, map ALL files to be created or modified:
79
+
80
+ ```markdown
81
+ ## File Map
82
+
83
+ | File | Action | Responsibility |
84
+ |------|--------|---------------|
85
+ | `src/auth/handler.ts` | Create | Token validation and refresh |
86
+ | `src/auth/types.ts` | Create | Auth types and interfaces |
87
+ | `tests/auth/handler.test.ts` | Create | Unit tests for handler |
88
+ | `src/middleware.ts` | Modify (L45-60) | Add auth middleware hook |
89
+ ```
90
+
91
+ - Each file should have one clear responsibility
92
+ - Files that change together should live together
93
+ - Follow existing codebase patterns — don't restructure unless it serves the current goal
94
+ - This map informs the task decomposition: each task should produce self-contained changes
95
+
96
+ ## Plan Document Header
97
+
98
+ Every plan MUST start with:
99
+
100
+ ```markdown
101
+ # [Feature Name] Implementation Plan
102
+
103
+ **Goal:** [One sentence describing what this builds]
104
+ **Architecture:** [2-3 sentences about approach]
105
+ **Tech Stack:** [Key technologies/libraries]
106
+ ```
107
+
77
108
  ## Dispatch for Decomposition
78
109
 
79
110
  **DISPATCH:**
@@ -187,8 +218,9 @@ Fix issues inline. If a spec requirement has no task, add the task.
187
218
 
188
219
  When the plan is approved and committed:
189
220
 
190
- 1. Archive the Dungeon: rename `.claude/raid-dungeon.md` to `.claude/raid-dungeon-phase-2.md`
191
- 2. Update `.claude/raid-session` phase to `"implementation"`
192
- 3. **Load the `raid-implementation` skill now and begin Phase 3.**
221
+ 1. Update `.claude/raid-session` phase to `"implementation"`
222
+ 2. **Commit**: `docs(quest-{slug}): phase 3 plan — {N} tasks, {summary}`
223
+ 3. **Send phase report to human**: task count, dependency graph, estimated scope
224
+ 4. **Load the `raid-canonical-implementation` skill now and begin Phase 4.**
193
225
 
194
226
  Do not wait. Do not ask. The next action after committing the plan doc is loading the next skill.
@@ -0,0 +1,133 @@
1
+ ---
2
+ name: raid-canonical-prd
3
+ description: "Phase 1 of Canonical Quest (optional). Agents research and explore to produce a complete PRD. No code writing. Wizard mediates human questions. Output: phase-1-prd.md in quest directory."
4
+ ---
5
+
6
+ # Raid PRD — Phase 1 (Optional)
7
+
8
+ Forge the Product Requirements Document through agent-driven research and human-mediated discovery.
9
+
10
+ <HARD-GATE>
11
+ Do NOT write any code. Do NOT modify any project files. Only markdown files in the quest dungeon directory are allowed. Agents communicate via SendMessage — do not spawn subagents.
12
+ </HARD-GATE>
13
+
14
+ ## Mode Behavior
15
+
16
+ - **Full Raid**: All 3 agents explore from different research angles, battle-test findings. Full PRD.
17
+ - **Skirmish**: 2 agents research and cross-test. Lighter PRD.
18
+ - **Scout**: Wizard drafts PRD alone from human input. Minimal research.
19
+
20
+ ## Process Flow
21
+
22
+ ```dot
23
+ digraph prd {
24
+ "Wizard updates phase to prd" -> "Create phase-1-prd.md with boilerplate";
25
+ "Create phase-1-prd.md with boilerplate" -> "Wizard digests human's task description";
26
+ "Wizard digests human's task description" -> "Dispatch party with research angles";
27
+ "Dispatch party with research angles" -> "Agents research independently (parallel)";
28
+ "Agents research independently (parallel)" -> "Agents flag ROUND_COMPLETE:";
29
+ "Agents flag ROUND_COMPLETE:" -> "Wizard dispatches cross-testing";
30
+ "Wizard dispatches cross-testing" -> "Agents battle-test findings";
31
+ "Agents battle-test findings" -> "Surviving findings pinned to dungeon";
32
+ "Surviving findings pinned to dungeon" -> "More research needed?" [shape=diamond];
33
+ "More research needed?" -> "Agents research independently (parallel)" [label="yes"];
34
+ "More research needed?" -> "Wizard wraps up PRD" [label="no"];
35
+ "Wizard wraps up PRD" -> "Send phase report to human";
36
+ "Send phase report to human" -> "Commit + transition to Design" [shape=doublecircle];
37
+ }
38
+ ```
39
+
40
+ ## Wizard Checklist
41
+
42
+ 1. **Update raid-session** — set phase to `"prd"`
43
+ 2. **Create phase file** — `{questDir}/phase-1-prd.md` with boilerplate sections
44
+ 3. **Digest the human's request** — understand intent, identify gaps, map the problem space
45
+ 4. **Dispatch party with research angles** via SendMessage:
46
+ - **@Warrior**: Explore the technical stack. What infrastructure exists? What APIs are available? What technical constraints apply? What precedents exist in the codebase?
47
+ - **@Archer**: Explore the patterns. How does this fit existing architecture? What conventions apply? What similar features exist? What naming and structure patterns should we follow?
48
+ - **@Rogue**: Explore the edge cases. What could go wrong? What assumptions are we making? What requirements are we missing? What will users actually do vs what we think they'll do?
49
+ 5. **Observe** — agents research in parallel. Go silent.
50
+ 6. **Mediate questions** — agents ask Wizard, Wizard reasons, Wizard asks human only if unsure
51
+ 7. **Dispatch cross-testing** — when agents flag ROUND_COMPLETE:, assign their findings to others
52
+ 8. **Close phase** — wrap up PRD, send report, commit
53
+
54
+ ## Phase File Template
55
+
56
+ Create `{questDir}/phase-1-prd.md`:
57
+
58
+ ```markdown
59
+ # Phase 1: PRD — Product Requirements Document
60
+ ## Quest: <task description>
61
+ ## Mode: <Full Raid | Skirmish | Scout>
62
+
63
+ ### Problem Statement
64
+
65
+ ### Goals & Non-Goals
66
+
67
+ #### Goals
68
+
69
+ #### Non-Goals
70
+
71
+ ### User Stories
72
+
73
+ ### Functional Requirements
74
+
75
+ ### Non-Functional Requirements
76
+
77
+ ### Business Logic
78
+
79
+ ### Constraints & Assumptions
80
+
81
+ ### Success Criteria
82
+
83
+ ### Open Questions
84
+
85
+ ### Discoveries
86
+
87
+ ### Shared Knowledge
88
+ ```
89
+
90
+ ## Research Angles
91
+
92
+ Agents should use all available tools to research:
93
+ - **MCP tools** — query context servers, fetch documentation
94
+ - **Web search** — find related patterns, prior art, library docs
95
+ - **Doc fetching** — read official docs for relevant technologies
96
+ - **Codebase analysis** — explore existing code, patterns, conventions
97
+ - **Skill discovery** — find relevant skills that may help
98
+
99
+ ## Question Chain
100
+
101
+ **Agents NEVER ask the human directly.** The flow is:
102
+
103
+ 1. Agent discovers a gap → sends `WIZARD:` with the question and context
104
+ 2. Wizard reasons: "Can I answer this from the PRD description, codebase, or prior knowledge?"
105
+ 3. If confident → answer the agent directly via SendMessage
106
+ 4. If unsure → digest the question into a clear, contextual question for the human
107
+ 5. Wizard asks the human one well-formulated question (not the raw agent question)
108
+ 6. Wizard receives answer → interprets, adds context → passes to party
109
+
110
+ **Goal:** Minimize questions to human. Batch related questions. The party should figure out as much as possible themselves.
111
+
112
+ ## Closing the Phase
113
+
114
+ When the PRD is complete (all sections filled, open questions resolved):
115
+
116
+ 1. **Wrap up the PRD document** — fill gaps, ensure coherence across sections
117
+ 2. **Send phase report to human**: "The PRD is forged. Here's what we established: [key points]"
118
+ 3. **Commit**: `docs(quest-{slug}): phase 1 PRD — {summary}`
119
+ 4. **Transition**: Load `raid-canonical-design` skill and begin Phase 2
120
+
121
+ ## Red Flags
122
+
123
+ | Thought | Reality |
124
+ |---------|---------|
125
+ | "The requirements are obvious, skip PRD" | If they were obvious, the human would have skipped this phase. |
126
+ | "Let me start coding to test an idea" | PRD phase. No code. Research and write. |
127
+ | "I'll ask the human every question" | Exhaust your own research first. Use MCP, docs, codebase. |
128
+ | "This PRD section doesn't apply" | Fill every section. Write "N/A — [reason]" if truly not applicable. |
129
+ | "Let me ask the human directly" | Route through the Wizard. Always. |
130
+
131
+ ## Phase Spoils
132
+
133
+ **Output**: `{questDir}/phase-1-prd.md` — Complete Product Requirements Document with all sections filled, open questions resolved, and discoveries from cross-testing documented.