claude-raid 0.1.7 → 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 -24
- package/src/init.js +6 -10
- package/src/merge-settings.js +0 -15
- package/src/remove.js +18 -16
- package/src/ui.js +1 -1
- package/src/update.js +28 -13
- package/template/.claude/agents/archer.md +10 -20
- package/template/.claude/agents/rogue.md +11 -21
- package/template/.claude/agents/warrior.md +8 -19
- package/template/.claude/agents/wizard.md +14 -247
- 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 +21 -3
- package/template/.claude/hooks/validate-commit.sh +7 -74
- package/template/.claude/hooks/validate-dungeon.sh +30 -11
- package/template/.claude/hooks/validate-no-placeholders.sh +3 -3
- package/template/.claude/hooks/validate-write-gate.sh +45 -63
- package/template/.claude/{raid-rules.md → party-rules.md} +38 -13
- package/template/.claude/skills/raid-browser-chrome/SKILL.md +1 -1
- package/template/.claude/skills/{raid-design → raid-canonical-design}/SKILL.md +52 -16
- package/template/.claude/skills/{raid-implementation → raid-canonical-implementation}/SKILL.md +41 -14
- package/template/.claude/skills/{raid-implementation-plan → raid-canonical-implementation-plan}/SKILL.md +49 -17
- 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 +78 -17
- 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 -20
- package/template/.claude/hooks/raid-task-completed.sh +0 -42
- package/template/.claude/hooks/validate-bash-writes.sh +0 -157
- package/template/.claude/skills/raid-browser-playwright/SKILL.md +0 -163
- package/template/.claude/skills/raid-finishing/SKILL.md +0 -140
- package/template/.claude/skills/raid-git-worktrees/SKILL.md +0 -96
- package/template/.claude/skills/raid-protocol/SKILL.md +0 -337
|
@@ -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. |
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
---
|
|
2
|
-
name: raid-review
|
|
3
|
-
description: "Phase
|
|
2
|
+
name: raid-canonical-review
|
|
3
|
+
description: "Phase 5 of Canonical Quest (optional). Two subphases: Pinning (find issues) and Fixing (resolve them). Black Card system for breaking changes. Wizard asks human before entering."
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
# Raid Review — Phase
|
|
6
|
+
# Raid Review — Phase 5 (Optional)
|
|
7
7
|
|
|
8
|
-
Three reviewers, three angles, zero mercy.
|
|
8
|
+
Three reviewers, three angles, zero mercy. Pinning then fixing. Black cards for the unfixable.
|
|
9
9
|
|
|
10
10
|
<HARD-GATE>
|
|
11
|
-
|
|
11
|
+
This phase is OPTIONAL — the Wizard asks the human before entering. All assigned agents review the ENTIRE implementation independently, then attack each other's findings. Use `raid-verification` before any completion claims. No subagents.
|
|
12
12
|
</HARD-GATE>
|
|
13
13
|
|
|
14
14
|
## Mode Behavior
|
|
@@ -21,7 +21,7 @@ Do NOT declare work complete without Phase 4 (except Scout mode). All assigned a
|
|
|
21
21
|
|
|
22
22
|
```dot
|
|
23
23
|
digraph review {
|
|
24
|
-
"Wizard reads design doc, plan, Phase
|
|
24
|
+
"Wizard reads design doc, plan, Phase 4 implementation log" -> "Wizard opens review board";
|
|
25
25
|
"Wizard opens Dungeon + dispatches" -> "Agents review independently";
|
|
26
26
|
"Agents review independently" -> "Agents fight over findings directly";
|
|
27
27
|
"Agents fight over findings directly" -> "Agents challenge missing findings";
|
|
@@ -32,14 +32,14 @@ digraph review {
|
|
|
32
32
|
"Assign fixes" -> "Fix + verify + challengers re-attack";
|
|
33
33
|
"Fix + verify + challengers re-attack" -> "Wizard closes: categorizes surviving issues";
|
|
34
34
|
"Critical or Important?" -> "Wizard final ruling" [label="no"];
|
|
35
|
-
"Wizard final ruling" -> "
|
|
35
|
+
"Wizard final ruling" -> "Commit + invoke raid-wrap-up" [shape=doublecircle];
|
|
36
36
|
}
|
|
37
37
|
```
|
|
38
38
|
|
|
39
39
|
## Wizard Checklist
|
|
40
40
|
|
|
41
|
-
1. **Prepare** — gather git range, design doc, plan doc, read
|
|
42
|
-
2. **Open the
|
|
41
|
+
1. **Prepare** — gather git range, design doc, plan doc, read `{questDir}/phase-4-implementation.md`
|
|
42
|
+
2. **Open the review board** — create `{questDir}/phase-5-review.md`
|
|
43
43
|
3. **Dispatch** — all agents review independently, then interact directly
|
|
44
44
|
4. **Observe the fight** — agents challenge findings and missing findings directly
|
|
45
45
|
5. **Close** — categorize surviving issues by severity from Dungeon
|
|
@@ -48,15 +48,15 @@ digraph review {
|
|
|
48
48
|
8. **Rule on fixes** — Critical and Important must be fixed (code AND browser)
|
|
49
49
|
9. **Verify fixes** — targeted re-attack after fixes (use `raid-verification`)
|
|
50
50
|
10. **Final ruling** — approved or rejected
|
|
51
|
-
11. **
|
|
52
|
-
12. **Transition** — invoke `raid-
|
|
51
|
+
11. **Commit** — `fix(quest-{slug}): phase 5 review — {N} findings resolved`
|
|
52
|
+
12. **Transition** — invoke `raid-wrap-up`
|
|
53
53
|
|
|
54
54
|
## Opening the Dungeon
|
|
55
55
|
|
|
56
|
-
Create
|
|
56
|
+
Create `{questDir}/phase-5-review.md`:
|
|
57
57
|
|
|
58
58
|
```markdown
|
|
59
|
-
#
|
|
59
|
+
# Phase 5: Review
|
|
60
60
|
## Quest: Full adversarial review of <feature> implementation
|
|
61
61
|
## Mode: <Full Raid | Skirmish>
|
|
62
62
|
|
|
@@ -97,6 +97,30 @@ Create `.claude/raid-dungeon.md`:
|
|
|
97
97
|
|
|
98
98
|
**Production:** Performance OK? External calls have timeouts? No secrets in code?
|
|
99
99
|
|
|
100
|
+
## Verification Protocol for Findings
|
|
101
|
+
|
|
102
|
+
Before acting on ANY finding (yours or a teammate's):
|
|
103
|
+
1. **READ:** Complete the finding without reacting
|
|
104
|
+
2. **VERIFY:** Check against codebase reality — read the actual code at the referenced location
|
|
105
|
+
3. **EVALUATE:** Is this technically sound for THIS codebase? Does fixing it break something else?
|
|
106
|
+
4. **RESPOND:** Technical evidence or reasoned pushback
|
|
107
|
+
|
|
108
|
+
## No Performative Agreement
|
|
109
|
+
|
|
110
|
+
NEVER respond with "You're absolutely right!" or "Great point!" or "Good catch!"
|
|
111
|
+
Instead: state the technical finding, show evidence, or push back.
|
|
112
|
+
Actions speak. Fix and show — don't compliment.
|
|
113
|
+
|
|
114
|
+
If a finding IS correct: `"Fixed. [Brief description of what changed]."` or just fix it silently.
|
|
115
|
+
|
|
116
|
+
## YAGNI Check on Findings
|
|
117
|
+
|
|
118
|
+
Before implementing a "professional improvement" suggestion:
|
|
119
|
+
- Grep codebase for actual usage of the component
|
|
120
|
+
- If unused: suggest removing (YAGNI) — `"This endpoint isn't called. Remove it?"`
|
|
121
|
+
- If used: implement properly
|
|
122
|
+
- Don't gold-plate during review
|
|
123
|
+
|
|
100
124
|
## The Fight — Agents Challenge Each Other
|
|
101
125
|
|
|
102
126
|
After independent reviews, agents fight DIRECTLY over findings AND missing findings:
|
|
@@ -141,9 +165,45 @@ After code review findings are pinned, the Wizard announces browser inspection.
|
|
|
141
165
|
|
|
142
166
|
**Browser bugs block merge the same way code bugs do.**
|
|
143
167
|
|
|
168
|
+
## Black Card System
|
|
169
|
+
|
|
170
|
+
If any agent finds something that fundamentally breaks the architecture — a change so deep it invalidates the implementation — they play a `BLACKCARD:`:
|
|
171
|
+
|
|
172
|
+
```
|
|
173
|
+
BLACKCARD: [description of breaking concern]
|
|
174
|
+
Evidence: [file paths, scenarios, why this is unfixable within current design]
|
|
175
|
+
Impact: [what breaks, how deep the damage goes]
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
**Black Card flow:**
|
|
179
|
+
1. Agent plays `BLACKCARD:` → other agents independently verify
|
|
180
|
+
2. If 2+ agents agree it's a black card → Wizard escalates to human
|
|
181
|
+
3. Wizard presents to human with full context (digested, not raw):
|
|
182
|
+
- What the black card is
|
|
183
|
+
- Why it's unfixable in current design
|
|
184
|
+
- Options:
|
|
185
|
+
a) **Rollback** — Go back to PRD or Design phase (creates `phase-2-design-v2.md`)
|
|
186
|
+
b) **Accept** — Live with the limitation, document it, continue
|
|
187
|
+
4. Human decides → Wizard acts accordingly
|
|
188
|
+
|
|
189
|
+
**Black cards are RARE.** Most issues are Critical or Important, not black cards. A black card means "the foundation is wrong" — not "there's a bug."
|
|
190
|
+
|
|
191
|
+
## Fix Implementation Order
|
|
192
|
+
|
|
193
|
+
When the Wizard assigns fixes during the Fixing subphase, prioritize in this order within each severity level:
|
|
194
|
+
1. **Blocking issues** — crashes, security holes, data loss
|
|
195
|
+
2. **Simple fixes** — typos, imports, naming inconsistencies
|
|
196
|
+
3. **Complex fixes** — refactoring, logic changes, architectural adjustments
|
|
197
|
+
|
|
198
|
+
Test each fix individually. Verify no regressions before moving to the next fix.
|
|
199
|
+
|
|
200
|
+
## Unclear Finding Protocol
|
|
201
|
+
|
|
202
|
+
If ANY finding is unclear — unclear what the problem is, unclear how to reproduce, unclear what the fix should be — **STOP**. Clarify ALL unclear items before implementing ANY fixes. Partial understanding leads to wrong implementation.
|
|
203
|
+
|
|
144
204
|
## Closing the Phase
|
|
145
205
|
|
|
146
|
-
The Wizard closes when agents have exhausted their findings and the
|
|
206
|
+
The Wizard closes when agents have exhausted their findings and the review board has all issues classified:
|
|
147
207
|
|
|
148
208
|
**RULING: APPROVED FOR MERGE** — all Critical/Important fixed, tests pass, requirements met.
|
|
149
209
|
|
|
@@ -165,8 +225,9 @@ The Wizard closes when agents have exhausted their findings and the Dungeon has
|
|
|
165
225
|
|
|
166
226
|
When the RULING is APPROVED FOR MERGE:
|
|
167
227
|
|
|
168
|
-
1.
|
|
169
|
-
2.
|
|
170
|
-
3. **
|
|
228
|
+
1. Update `.claude/raid-session` phase to `"wrap-up"`
|
|
229
|
+
2. **Commit**: `fix(quest-{slug}): phase 5 review — {N} findings resolved`
|
|
230
|
+
3. **Send phase report to human**: findings count, fixes applied, any black cards
|
|
231
|
+
4. **Load the `raid-wrap-up` skill now and begin Phase 6.**
|
|
171
232
|
|
|
172
233
|
Do not wait. Do not ask. The next action after approving for merge is loading the next skill.
|
|
@@ -60,8 +60,19 @@ digraph debugging {
|
|
|
60
60
|
1. **Read error messages carefully** — stack traces, line numbers, error codes. Don't skip past them. The answer is often in the first error.
|
|
61
61
|
2. **Reproduce consistently** — exact steps, every time. If not reproducible, gather more data — don't guess. An unreproducible bug is not understood.
|
|
62
62
|
3. **Check recent changes** — `git diff`, recent commits, new dependencies, config changes. What changed since it last worked?
|
|
63
|
-
4. **Gather evidence at boundaries** — in multi-component systems,
|
|
64
|
-
|
|
63
|
+
4. **Gather evidence at boundaries** — in multi-component systems, add diagnostic instrumentation:
|
|
64
|
+
```
|
|
65
|
+
For EACH component boundary:
|
|
66
|
+
- Log what data enters the component
|
|
67
|
+
- Log what data exits the component
|
|
68
|
+
- Verify environment/config propagation
|
|
69
|
+
- Check state at each layer
|
|
70
|
+
Run ONCE to gather evidence showing WHERE it breaks.
|
|
71
|
+
THEN investigate that specific component.
|
|
72
|
+
```
|
|
73
|
+
Example: API → Service → Database → Response. Log at each boundary. The layer where input looks right but output looks wrong is your target.
|
|
74
|
+
|
|
75
|
+
5. **Trace data flow backward** — where does the bad value appear? What function produced it? What called that function with what input? Keep tracing backward until you find the SOURCE. Fix at SOURCE, not at symptom.
|
|
65
76
|
|
|
66
77
|
### Phase 2: Pattern Analysis
|
|
67
78
|
|
|
@@ -72,9 +83,10 @@ digraph debugging {
|
|
|
72
83
|
|
|
73
84
|
### Phase 3: Hypothesis and Testing
|
|
74
85
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
86
|
+
**Per-agent hypothesis discipline:**
|
|
87
|
+
1. **Form ONE specific hypothesis:** "I think X is the root cause because Y." Write it down. Be specific, not vague.
|
|
88
|
+
2. **Make the SMALLEST possible change** to test it. One variable at a time. Don't fix multiple things at once.
|
|
89
|
+
3. **Did it work?** → Phase 4. **Didn't work?** → Form a NEW hypothesis based on what you learned. Don't pile fixes on top of failed fixes. Don't just "try another thing" — the failed test gave you information. Use it.
|
|
78
90
|
|
|
79
91
|
### Phase 4: Fix Implementation
|
|
80
92
|
|
|
@@ -127,6 +139,13 @@ If 3 or more fix attempts fail, **STOP fixing and question architecture:**
|
|
|
127
139
|
|
|
128
140
|
This is not failure — it's the system working. Detecting architectural problems before sinking more time into symptom fixes.
|
|
129
141
|
|
|
142
|
+
**Pattern indicating architectural problem:**
|
|
143
|
+
- Each fix reveals new shared state or coupling in a different place
|
|
144
|
+
- Fixes require "massive refactoring" to implement
|
|
145
|
+
- Each fix creates new symptoms elsewhere
|
|
146
|
+
|
|
147
|
+
If within a Canonical Quest: consider playing a `BLACKCARD:` — this may be a design-level problem, not an implementation bug.
|
|
148
|
+
|
|
130
149
|
## Defense in Depth
|
|
131
150
|
|
|
132
151
|
After finding and fixing the root cause, add validation at multiple layers:
|
|
@@ -148,6 +167,12 @@ After finding and fixing the root cause, add validation at multiple layers:
|
|
|
148
167
|
| "The issue is simple, don't need process" | Simple issues have root causes too. Process is fast. |
|
|
149
168
|
| "Emergency, no time" | Systematic debugging is FASTER than thrashing. Always. |
|
|
150
169
|
| "Just try this first" | The first fix sets the pattern. Do it right. |
|
|
170
|
+
| "Pattern says X but I'll adapt" | Partial understanding guarantees bugs. Read it completely. |
|
|
171
|
+
| "I don't fully understand but this might work" | STOP. Return to Phase 1. |
|
|
172
|
+
| "Multiple changes at once saves time" | Can't isolate what worked. Causes new bugs. |
|
|
173
|
+
| "I'll write the test after confirming fix" | Untested fixes don't stick. Test first proves it. |
|
|
174
|
+
| "Skip investigation, the error message says it all" | Error messages describe symptoms, not root causes. |
|
|
175
|
+
| "Add multiple changes, run tests" | One variable at a time. Scientific method. |
|
|
151
176
|
|
|
152
177
|
## Escalation
|
|
153
178
|
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: raid-init
|
|
3
|
+
description: "Quest selection, greeting, session setup, and dungeon resume. Loaded by wizard at session start. Teaches the wizard how to greet the human, present quest choices, and begin the quest."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Raid Init — Quest Selection & Session Setup
|
|
7
|
+
|
|
8
|
+
The first skill loaded when the Wizard starts. Guides the greeting, quest selection, and session bootstrap.
|
|
9
|
+
|
|
10
|
+
<HARD-GATE>
|
|
11
|
+
Do NOT skip the greeting. Do NOT skip quest selection. Do NOT begin any phase without the human choosing a quest type and confirming the mode.
|
|
12
|
+
</HARD-GATE>
|
|
13
|
+
|
|
14
|
+
## Process Flow
|
|
15
|
+
|
|
16
|
+
```dot
|
|
17
|
+
digraph init {
|
|
18
|
+
"Read rules + raid.json" -> "Check for in-progress quests";
|
|
19
|
+
"Check for in-progress quests" -> "Offer to resume?" [shape=diamond];
|
|
20
|
+
"Offer to resume?" -> "Resume existing quest" [label="yes, human confirms"];
|
|
21
|
+
"Offer to resume?" -> "Greet the human" [label="no"];
|
|
22
|
+
"Greet the human" -> "Present quest menu";
|
|
23
|
+
"Present quest menu" -> "Canonical Quest?" [shape=diamond];
|
|
24
|
+
"Canonical Quest?" -> "Ask: PRD needed?" [label="A"];
|
|
25
|
+
"Canonical Quest?" -> "Coming soon message" [label="B/D/E/F"];
|
|
26
|
+
"Coming soon message" -> "Present quest menu";
|
|
27
|
+
"Ask: PRD needed?" -> "Human describes task";
|
|
28
|
+
"Human describes task" -> "Assess complexity + recommend mode";
|
|
29
|
+
"Assess complexity + recommend mode" -> "Human approves mode?";
|
|
30
|
+
"Human approves mode?" -> "Spawn team + create quest dir" [label="yes"];
|
|
31
|
+
"Human approves mode?" -> "Assess complexity + recommend mode" [label="override"];
|
|
32
|
+
"Spawn team + create quest dir" -> "Begin first phase" [shape=doublecircle];
|
|
33
|
+
}
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Step 1: Check for In-Progress Quests
|
|
37
|
+
|
|
38
|
+
Look in `.claude/dungeon/` for existing quest directories. If any exist:
|
|
39
|
+
|
|
40
|
+
> "I sense an unfinished quest in the dungeon: **{quest-slug}**. Shall we resume where we left off, or begin a new adventure?"
|
|
41
|
+
|
|
42
|
+
If the human wants to resume, read the raid-session file and continue from the current phase.
|
|
43
|
+
|
|
44
|
+
## Step 2: Greet the Human
|
|
45
|
+
|
|
46
|
+
```
|
|
47
|
+
Farewell brave Engineer, Welcome to the dungeon —
|
|
48
|
+
the raid is waiting for you.
|
|
49
|
+
Let's make the bards sing about the quest we are embracing today:
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
## Step 3: Present Quest Menu
|
|
53
|
+
|
|
54
|
+
```
|
|
55
|
+
Choose your quest:
|
|
56
|
+
|
|
57
|
+
A) Canonical Quest — Full 6-phase development cycle
|
|
58
|
+
(PRD, Design, Plan, Build, Review, Wrap Up)
|
|
59
|
+
|
|
60
|
+
B) Round Table — (Coming soon)
|
|
61
|
+
D) Map Exploration — (Coming soon)
|
|
62
|
+
E) Bug Hunting — (Coming soon)
|
|
63
|
+
F) Bard Bonfire — (Coming soon)
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
If the human selects B, D, E, or F:
|
|
67
|
+
> "That quest type is still being forged by the arcane smiths. Choose another path for now."
|
|
68
|
+
|
|
69
|
+
Loop back to the menu.
|
|
70
|
+
|
|
71
|
+
## Step 4: Canonical Quest Setup
|
|
72
|
+
|
|
73
|
+
### 4a. PRD Question
|
|
74
|
+
|
|
75
|
+
> "Do you carry a Product Requirements scroll, or shall we forge one together?"
|
|
76
|
+
|
|
77
|
+
- If PRD needed → first phase will be PRD (raid-canonical-prd)
|
|
78
|
+
- If PRD not needed → first phase will be Design (raid-canonical-design)
|
|
79
|
+
|
|
80
|
+
### 4b. Task Description
|
|
81
|
+
|
|
82
|
+
Ask the human to describe the task/feature they want to build. Listen carefully. Read 3 times internally.
|
|
83
|
+
|
|
84
|
+
### 4c. Mode Recommendation
|
|
85
|
+
|
|
86
|
+
Assess complexity and recommend a mode:
|
|
87
|
+
|
|
88
|
+
| Mode | When | Agents |
|
|
89
|
+
|------|------|--------|
|
|
90
|
+
| **Full Raid** | Large features, architectural changes, complex refactors | 3 (Warrior, Archer, Rogue) |
|
|
91
|
+
| **Skirmish** | Medium features, focused changes | 2 (pick most relevant) |
|
|
92
|
+
| **Scout** | Small fixes, minor additions | 1 (pick most relevant) |
|
|
93
|
+
|
|
94
|
+
Present recommendation. Wait for human to approve or override.
|
|
95
|
+
|
|
96
|
+
### 4d. Spawn Team & Setup
|
|
97
|
+
|
|
98
|
+
1. Update raid-session with:
|
|
99
|
+
- `questType`: `"canonical"`
|
|
100
|
+
- `questId`: slugified from task description (e.g., `"auth-redesign"`)
|
|
101
|
+
- `questDir`: `.claude/dungeon/{questId}`
|
|
102
|
+
- `phase`: `""` (will be set by first phase skill)
|
|
103
|
+
2. Create quest directory if not already created by hook:
|
|
104
|
+
```
|
|
105
|
+
mkdir -p {questDir}
|
|
106
|
+
```
|
|
107
|
+
3. Spawn team:
|
|
108
|
+
```
|
|
109
|
+
TeamCreate(team_name="raid-{mode}-{questId}")
|
|
110
|
+
Agent(subagent_type="warrior", team_name="raid-...", name="warrior")
|
|
111
|
+
Agent(subagent_type="archer", team_name="raid-...", name="archer") // Full Raid + Skirmish
|
|
112
|
+
Agent(subagent_type="rogue", team_name="raid-...", name="rogue") // Full Raid only
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
## Step 5: Begin First Phase
|
|
116
|
+
|
|
117
|
+
- If PRD needed → Load `raid-canonical-prd` skill, begin Phase 1
|
|
118
|
+
- If PRD skipped → Load `raid-canonical-design` skill, begin Phase 2
|
|
119
|
+
|
|
120
|
+
**Announce the quest to the party and the human:**
|
|
121
|
+
> "The quest begins: **{task description}**. Mode: **{mode}**. {agent count} brave souls answer the call."
|
|
122
|
+
|
|
123
|
+
## Red Flags
|
|
124
|
+
|
|
125
|
+
| Thought | Reality |
|
|
126
|
+
|---------|---------|
|
|
127
|
+
| "Skip the greeting, get to work" | The greeting sets the tone. It takes 5 seconds. Do it. |
|
|
128
|
+
| "The human knows what mode to use" | Recommend first. Let them override. That's the protocol. |
|
|
129
|
+
| "Let me start exploring the codebase" | You are the Wizard. You don't explore. You dispatch. |
|
|
130
|
+
| "I'll figure out the quest type later" | Quest type determines the phase flow. Choose now. |
|
|
@@ -106,7 +106,7 @@ Follow the same RED-GREEN-REFACTOR discipline but with Playwright:
|
|
|
106
106
|
4. **Verify GREEN:** Run FULL suite (unit + browser) → all green
|
|
107
107
|
5. **REFACTOR:** Clean up → re-run all
|
|
108
108
|
|
|
109
|
-
|
|
109
|
+
Invoke `raid-browser` for pre-flight and boot. Use the browser test patterns below for Playwright-specific guidance.
|
|
110
110
|
|
|
111
111
|
### "Tests pass" = Unit AND Browser Tests
|
|
112
112
|
|