claude-raid 0.1.6 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/cli.js +13 -1
- package/package.json +1 -1
- package/src/descriptions.js +26 -25
- package/src/init.js +6 -10
- package/src/merge-settings.js +1 -22
- package/src/remove.js +18 -16
- package/src/ui.js +1 -1
- package/src/update.js +28 -13
- package/template/.claude/agents/archer.md +14 -109
- package/template/.claude/agents/rogue.md +15 -110
- package/template/.claude/agents/warrior.md +12 -108
- package/template/.claude/agents/wizard.md +15 -235
- package/template/.claude/dungeon-master-rules.md +210 -0
- package/template/.claude/hooks/raid-lib.sh +29 -2
- package/template/.claude/hooks/raid-pre-compact.sh +12 -1
- package/template/.claude/hooks/raid-session-end.sh +23 -13
- package/template/.claude/hooks/raid-session-start.sh +28 -16
- package/template/.claude/hooks/validate-commit.sh +15 -74
- package/template/.claude/hooks/validate-dungeon.sh +47 -13
- package/template/.claude/hooks/validate-file-naming.sh +6 -2
- package/template/.claude/hooks/validate-no-placeholders.sh +3 -3
- package/template/.claude/hooks/validate-write-gate.sh +47 -36
- package/template/.claude/party-rules.md +202 -0
- package/template/.claude/skills/raid-browser-chrome/SKILL.md +1 -1
- package/template/.claude/skills/{raid-design → raid-canonical-design}/SKILL.md +60 -14
- package/template/.claude/skills/{raid-implementation → raid-canonical-implementation}/SKILL.md +48 -11
- package/template/.claude/skills/{raid-implementation-plan → raid-canonical-implementation-plan}/SKILL.md +57 -15
- package/template/.claude/skills/raid-canonical-prd/SKILL.md +133 -0
- package/template/.claude/skills/raid-canonical-protocol/SKILL.md +211 -0
- package/template/.claude/skills/{raid-review → raid-canonical-review}/SKILL.md +86 -15
- package/template/.claude/skills/raid-debugging/SKILL.md +30 -5
- package/template/.claude/skills/raid-init/SKILL.md +130 -0
- package/template/.claude/skills/raid-tdd/SKILL.md +1 -1
- package/template/.claude/skills/raid-wrap-up/SKILL.md +184 -0
- package/template/.claude/hooks/raid-stop.sh +0 -68
- package/template/.claude/hooks/raid-task-completed.sh +0 -37
- package/template/.claude/hooks/raid-teammate-idle.sh +0 -28
- package/template/.claude/raid-rules.md +0 -30
- package/template/.claude/skills/raid-browser-playwright/SKILL.md +0 -163
- package/template/.claude/skills/raid-finishing/SKILL.md +0 -131
- package/template/.claude/skills/raid-git-worktrees/SKILL.md +0 -96
- package/template/.claude/skills/raid-protocol/SKILL.md +0 -335
package/template/.claude/skills/{raid-implementation → raid-canonical-implementation}/SKILL.md
RENAMED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
---
|
|
2
|
-
name: raid-implementation
|
|
3
|
-
description: "Phase
|
|
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
|
|
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
|
|
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
|
|
54
|
-
3. **
|
|
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
|
|
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,6 +207,19 @@ 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
|
|
210
|
+
- **Tests can't be written:** The design may not be testable. Return to Phase 2.
|
|
211
|
+
|
|
212
|
+
---
|
|
213
|
+
|
|
214
|
+
## Phase Transition
|
|
215
|
+
|
|
216
|
+
When all tasks are approved and committed:
|
|
217
|
+
|
|
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**
|
|
187
224
|
|
|
188
|
-
|
|
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
|
+
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
|
|
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
|
|
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
|
|
45
|
-
3. **Open the Dungeon** — create
|
|
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(
|
|
54
|
-
12. **
|
|
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
|
|
58
|
+
Create `{questDir}/phase-3-plan.md`:
|
|
60
59
|
|
|
61
60
|
```markdown
|
|
62
|
-
#
|
|
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:**
|
|
@@ -181,4 +212,15 @@ Fix issues inline. If a spec requirement has no task, add the task.
|
|
|
181
212
|
| "Tests can be added later" | TDD means tests are in the plan. No test = no task. |
|
|
182
213
|
| "The naming will be consistent enough" | Check it explicitly. Naming drift is the #1 source of bugs. |
|
|
183
214
|
|
|
184
|
-
|
|
215
|
+
---
|
|
216
|
+
|
|
217
|
+
## Phase Transition
|
|
218
|
+
|
|
219
|
+
When the plan is approved and committed:
|
|
220
|
+
|
|
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.**
|
|
225
|
+
|
|
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.
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: raid-canonical-protocol
|
|
3
|
+
description: "Canonical Quest protocol. Establishes the 6-phase workflow (PRD, Design, Plan, Implementation, Review, Wrap Up), round-based interaction, Dungeon lifecycle, quest types, communication signals, and phase transition gates."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Canonical Quest Protocol
|
|
7
|
+
|
|
8
|
+
The canonical workflow for full-cycle development. Every feature, refactor, or system built through the Raid follows this sequence.
|
|
9
|
+
|
|
10
|
+
<HARD-GATE>
|
|
11
|
+
Do NOT skip phases. Do NOT let a single agent work unchallenged (except Scout mode). Do NOT proceed without a Wizard ruling. Agents communicate via SendMessage — do not spawn subagents.
|
|
12
|
+
</HARD-GATE>
|
|
13
|
+
|
|
14
|
+
## Session Lifecycle
|
|
15
|
+
|
|
16
|
+
```dot
|
|
17
|
+
digraph session {
|
|
18
|
+
"Wizard starts" -> "Load raid-init";
|
|
19
|
+
"Load raid-init" -> "Greet human + quest selection";
|
|
20
|
+
"Greet human + quest selection" -> "Canonical Quest selected";
|
|
21
|
+
"Canonical Quest selected" -> "PRD needed?";
|
|
22
|
+
"PRD needed?" -> "Phase 1: PRD (raid-canonical-prd)" [label="yes"];
|
|
23
|
+
"PRD needed?" -> "Phase 2: Design (raid-canonical-design)" [label="no"];
|
|
24
|
+
"Phase 1: PRD (raid-canonical-prd)" -> "Phase 2: Design (raid-canonical-design)";
|
|
25
|
+
"Phase 2: Design (raid-canonical-design)" -> "Phase 3: Plan (raid-canonical-implementation-plan)";
|
|
26
|
+
"Phase 3: Plan (raid-canonical-implementation-plan)" -> "Phase 4: Implementation (raid-canonical-implementation)";
|
|
27
|
+
"Phase 4: Implementation (raid-canonical-implementation)" -> "Review wanted?";
|
|
28
|
+
"Review wanted?" -> "Phase 5: Review (raid-canonical-review)" [label="yes"];
|
|
29
|
+
"Review wanted?" -> "Phase 6: Wrap Up (raid-wrap-up)" [label="no"];
|
|
30
|
+
"Phase 5: Review (raid-canonical-review)" -> "Phase 6: Wrap Up (raid-wrap-up)";
|
|
31
|
+
"Phase 6: Wrap Up (raid-wrap-up)" -> "Archive to vault + session end";
|
|
32
|
+
}
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Team
|
|
36
|
+
|
|
37
|
+
| Agent | Role | Color |
|
|
38
|
+
|-------|------|-------|
|
|
39
|
+
| **Wizard** (Dungeon Master) | Opens phases, observes, digests, rules. NEVER implements. | Purple |
|
|
40
|
+
| **Warrior** | Stress-tests to destruction, edge cases, load testing | Red |
|
|
41
|
+
| **Archer** | Pattern-seeker, traces ripple effects, naming drift | Green |
|
|
42
|
+
| **Rogue** | Adversarial assumption-destroyer, attack scenarios | Orange |
|
|
43
|
+
|
|
44
|
+
## Modes
|
|
45
|
+
|
|
46
|
+
| Aspect | Full Raid | Skirmish | Scout |
|
|
47
|
+
|--------|-----------|----------|-------|
|
|
48
|
+
| Agents | 3 | 2 | 1 |
|
|
49
|
+
| PRD phase | Full | Lightweight | Skip |
|
|
50
|
+
| Design | Full adversarial | Lightweight | Inline |
|
|
51
|
+
| Plan | Full adversarial | Combined with design | Inline |
|
|
52
|
+
| Implementation | 1 builds, 2 cross-test | 1 builds, 1 cross-tests | 1 builds, Wizard reviews |
|
|
53
|
+
| Review | 3 independent + fighting | 1 review + Wizard | Wizard only |
|
|
54
|
+
| TDD | **Enforced** | **Enforced** | **Enforced** |
|
|
55
|
+
|
|
56
|
+
## Round-Based Interaction
|
|
57
|
+
|
|
58
|
+
Think turn-based RPG, not real-time:
|
|
59
|
+
|
|
60
|
+
```
|
|
61
|
+
ROUND START → Wizard dispatches tasks/angles
|
|
62
|
+
↓
|
|
63
|
+
PARALLEL WORK → Each agent works independently
|
|
64
|
+
↓
|
|
65
|
+
FLAG COMPLETION → Agent signals ROUND_COMPLETE: to Wizard
|
|
66
|
+
↓
|
|
67
|
+
CROSS-TESTING → Wizard assigns completed work for review
|
|
68
|
+
↓
|
|
69
|
+
REACTIONS → Agents test, challenge, build
|
|
70
|
+
↓
|
|
71
|
+
RESOLUTION → Findings pinned to dungeon or conceded
|
|
72
|
+
↓
|
|
73
|
+
ROUND END → Wizard assesses: next round or phase close
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
**Rules:**
|
|
77
|
+
- No mid-thinking interruptions between agents (only Wizard can interrupt)
|
|
78
|
+
- Each message must carry evidence + conclusion (no shallow exchanges)
|
|
79
|
+
- Converge in 2-3 exchanges per finding; escalate to Wizard after 3
|
|
80
|
+
- Party is silent during phase transitions
|
|
81
|
+
|
|
82
|
+
## Question Chain
|
|
83
|
+
|
|
84
|
+
Agents → Wizard → Human. Agents NEVER ask the human directly.
|
|
85
|
+
|
|
86
|
+
1. Agent discovers gap → sends `WIZARD:` with question
|
|
87
|
+
2. Wizard reasons: can I answer from PRD, codebase, context?
|
|
88
|
+
3. If confident → answers agent directly
|
|
89
|
+
4. If unsure → digests question, asks human one clear question
|
|
90
|
+
5. Wizard passes answer back with interpretation
|
|
91
|
+
|
|
92
|
+
## Phase Transition Gates
|
|
93
|
+
|
|
94
|
+
| From | To | Gate | Commit Format |
|
|
95
|
+
|------|----|------|---------------|
|
|
96
|
+
| PRD | Design | PRD approved by Wizard | `docs(quest-{slug}): phase 1 PRD` |
|
|
97
|
+
| Design | Plan | Design doc approved, committed | `docs(quest-{slug}): phase 2 design` |
|
|
98
|
+
| Plan | Implementation | Plan approved, committed | `docs(quest-{slug}): phase 3 plan` |
|
|
99
|
+
| Implementation | Review | All tasks done, tests pass | `feat(quest-{slug}): phase 4 implementation` |
|
|
100
|
+
| Review | Wrap Up | Wizard ruling: approved | `fix(quest-{slug}): phase 5 review` |
|
|
101
|
+
|
|
102
|
+
**Wizard commits at EVERY phase transition.** No exceptions.
|
|
103
|
+
|
|
104
|
+
## Phase Spoils
|
|
105
|
+
|
|
106
|
+
Every phase MUST produce at least one detailed markdown artifact:
|
|
107
|
+
|
|
108
|
+
| Phase | Output File |
|
|
109
|
+
|-------|-------------|
|
|
110
|
+
| PRD | `{questDir}/phase-1-prd.md` |
|
|
111
|
+
| Design | `{questDir}/phase-2-design.md` |
|
|
112
|
+
| Plan | `{questDir}/phase-3-plan.md` + task files |
|
|
113
|
+
| Implementation | `{questDir}/phase-4-implementation.md` |
|
|
114
|
+
| Review | `{questDir}/phase-5-review.md` |
|
|
115
|
+
| Wrap Up | `{questDir}/phase-6-wrap-up.md` |
|
|
116
|
+
|
|
117
|
+
## Communication Signals
|
|
118
|
+
|
|
119
|
+
| Signal | Who | Meaning | Goes to Dungeon? |
|
|
120
|
+
|--------|-----|---------|-----------------|
|
|
121
|
+
| `DISPATCH:` | Wizard | Opening a phase, assigning angles | No |
|
|
122
|
+
| `ROUND_COMPLETE:` | Any agent | Finished assigned task | No |
|
|
123
|
+
| `FINDING:` | Any agent | Discovery with own evidence | No |
|
|
124
|
+
| `CHALLENGE:` | Any agent | Independently verified, found problem | No |
|
|
125
|
+
| `BUILDING:` | Any agent | Independently verified, goes deeper | No |
|
|
126
|
+
| `DUNGEON:` | Any agent | Pinning finding verified by 2+ agents | **Yes** |
|
|
127
|
+
| `BLACKCARD:` | Any agent | High-concern finding blocking progress | **Yes** |
|
|
128
|
+
| `WIZARD:` | Any agent | Escalation — needs Wizard input | Yes (escalation) |
|
|
129
|
+
| `CONCEDE:` | Any agent | Proven wrong, moving on | No |
|
|
130
|
+
| `RULING:` | Wizard | Binding decision, phase close | Archived |
|
|
131
|
+
| `REDIRECT:` | Wizard | Course correction, one sentence | No |
|
|
132
|
+
|
|
133
|
+
## Black Card System
|
|
134
|
+
|
|
135
|
+
A `BLACKCARD:` is a finding that fundamentally breaks the architecture — unfixable within current design.
|
|
136
|
+
|
|
137
|
+
**Flow:** Agent plays → 2+ agents verify → Wizard escalates to human → Options: (a) rollback to earlier phase, (b) accept limitation.
|
|
138
|
+
|
|
139
|
+
Black cards are RARE. Most issues are Critical or Important, not black cards.
|
|
140
|
+
|
|
141
|
+
## The Dungeon
|
|
142
|
+
|
|
143
|
+
Quest directory at `.claude/dungeon/{quest-slug}/`. Each phase produces a file.
|
|
144
|
+
|
|
145
|
+
| Event | Action | Who |
|
|
146
|
+
|-------|--------|-----|
|
|
147
|
+
| Quest starts | Create quest directory | Hook |
|
|
148
|
+
| Phase opens | Create `{questDir}/phase-N-{name}.md` with boilerplate | Wizard |
|
|
149
|
+
| During phase | Pin findings via `DUNGEON:` | Agents |
|
|
150
|
+
| Phase closes | Wrap up doc, commit | Wizard |
|
|
151
|
+
| Quest ends | Move to `.claude/vault/{quest-slug}/` | Wizard |
|
|
152
|
+
|
|
153
|
+
**The Dungeon is a scoreboard, not a chat log.** Only verified findings, resolved battles, shared knowledge.
|
|
154
|
+
|
|
155
|
+
## Wizard Behavior
|
|
156
|
+
|
|
157
|
+
- **90% thinking / 10% talking** — thinks 5x before speaking
|
|
158
|
+
- **NEVER implements** — dispatches, observes, digests, rules
|
|
159
|
+
- **Opens and closes every phase** — creates phase file, dispatches, then goes silent
|
|
160
|
+
- **Phase reports** — at every close, summarizes for human: what was done, what's next
|
|
161
|
+
- **Question gatekeeper** — digests before passing in either direction
|
|
162
|
+
- **Commits at every transition** — with quest name + phase + summary
|
|
163
|
+
|
|
164
|
+
## Configuration
|
|
165
|
+
|
|
166
|
+
Read `.claude/raid.json` for project settings:
|
|
167
|
+
|
|
168
|
+
| Key | Default | Purpose |
|
|
169
|
+
|-----|---------|---------|
|
|
170
|
+
| `project.testCommand` | (none) | Command to run tests |
|
|
171
|
+
| `project.packageManager` | (auto) | Package manager |
|
|
172
|
+
| `raid.defaultMode` | `full` | Default mode |
|
|
173
|
+
| `raid.agentEffort` | `medium` | Agent effort level (Wizard always max) |
|
|
174
|
+
| `raid.vault.path` | `.claude/vault` | Vault location |
|
|
175
|
+
| `browser.enabled` | `false` | Browser testing active |
|
|
176
|
+
|
|
177
|
+
## Browser Testing
|
|
178
|
+
|
|
179
|
+
When `browser.enabled` is `true`:
|
|
180
|
+
- **Phase 4 (Implementation):** Browser-facing code uses TDD with Playwright via `raid-tdd`. Challengers verify on isolated ports.
|
|
181
|
+
- **Phase 5 (Review):** Live adversarial Chrome inspection via `raid-browser-chrome`. Each agent on separate port.
|
|
182
|
+
- Invoke `raid-browser` for startup discovery and pre-flight.
|
|
183
|
+
|
|
184
|
+
## Skills Reference
|
|
185
|
+
|
|
186
|
+
| Skill | Phase | Purpose |
|
|
187
|
+
|-------|-------|---------|
|
|
188
|
+
| `raid-init` | Pre-phase | Quest selection, greeting, session setup |
|
|
189
|
+
| `raid-canonical-protocol` | Start | This doc — session lifecycle, rules, reference |
|
|
190
|
+
| `raid-canonical-prd` | 1 | PRD creation (optional) |
|
|
191
|
+
| `raid-canonical-design` | 2 | Adversarial design exploration |
|
|
192
|
+
| `raid-canonical-implementation-plan` | 3 | Task decomposition |
|
|
193
|
+
| `raid-canonical-implementation` | 4 | TDD implementation with cross-testing |
|
|
194
|
+
| `raid-canonical-review` | 5 | Pinning + fixing + black cards (optional) |
|
|
195
|
+
| `raid-wrap-up` | 6 | Storyboard, PR, vault archival |
|
|
196
|
+
| `raid-tdd` | Any | RED-GREEN-REFACTOR enforcement |
|
|
197
|
+
| `raid-verification` | Any | Evidence-before-claims gate |
|
|
198
|
+
| `raid-debugging` | Any | Root-cause investigation |
|
|
199
|
+
| `raid-browser` | 4, 5 | Browser orchestration |
|
|
200
|
+
| `raid-browser-chrome` | 5 | Live Chrome inspection |
|
|
201
|
+
|
|
202
|
+
## Red Flags
|
|
203
|
+
|
|
204
|
+
| Thought | Reality |
|
|
205
|
+
|---------|---------|
|
|
206
|
+
| "This phase is obvious, skip it" | Obvious phases hide assumptions. |
|
|
207
|
+
| "The agents agree, no need for cross-testing" | Agreement without challenge is groupthink. |
|
|
208
|
+
| "TDD would slow us down" | TDD is an Iron Law. No exceptions. |
|
|
209
|
+
| "Let me ask the human directly" | Route through the Wizard. Always. |
|
|
210
|
+
| "Let me just post everything to the Dungeon" | Pin only what survived challenge. |
|
|
211
|
+
| "I'll wait for the Wizard to tell me what to do" | Self-organize within the round. |
|