claude-raid 0.1.0

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 (31) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +345 -0
  3. package/bin/cli.js +34 -0
  4. package/package.json +37 -0
  5. package/src/detect-project.js +112 -0
  6. package/src/doctor.js +201 -0
  7. package/src/init.js +138 -0
  8. package/src/merge-settings.js +119 -0
  9. package/src/remove.js +92 -0
  10. package/src/update.js +110 -0
  11. package/template/.claude/agents/archer.md +115 -0
  12. package/template/.claude/agents/rogue.md +116 -0
  13. package/template/.claude/agents/warrior.md +114 -0
  14. package/template/.claude/agents/wizard.md +206 -0
  15. package/template/.claude/hooks/validate-commit-message.sh +78 -0
  16. package/template/.claude/hooks/validate-file-naming.sh +73 -0
  17. package/template/.claude/hooks/validate-no-placeholders.sh +67 -0
  18. package/template/.claude/hooks/validate-phase-gate.sh +60 -0
  19. package/template/.claude/hooks/validate-tests-pass.sh +43 -0
  20. package/template/.claude/hooks/validate-verification.sh +70 -0
  21. package/template/.claude/raid-rules.md +21 -0
  22. package/template/.claude/skills/raid-debugging/SKILL.md +159 -0
  23. package/template/.claude/skills/raid-design/SKILL.md +208 -0
  24. package/template/.claude/skills/raid-finishing/SKILL.md +123 -0
  25. package/template/.claude/skills/raid-git-worktrees/SKILL.md +96 -0
  26. package/template/.claude/skills/raid-implementation/SKILL.md +155 -0
  27. package/template/.claude/skills/raid-implementation-plan/SKILL.md +173 -0
  28. package/template/.claude/skills/raid-protocol/SKILL.md +288 -0
  29. package/template/.claude/skills/raid-review/SKILL.md +133 -0
  30. package/template/.claude/skills/raid-tdd/SKILL.md +147 -0
  31. package/template/.claude/skills/raid-verification/SKILL.md +113 -0
@@ -0,0 +1,173 @@
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."
4
+ ---
5
+
6
+ # Raid Implementation Plan — Phase 2
7
+
8
+ Break the design into bite-sized, battle-tested tasks through agent-driven adversarial decomposition.
9
+
10
+ <HARD-GATE>
11
+ Do NOT start implementation until the plan is approved by the Wizard and committed to git. All assigned agents participate in plan creation AND review. No subagents.
12
+ </HARD-GATE>
13
+
14
+ ## Mode Behavior
15
+
16
+ - **Full Raid**: All 3 agents decompose independently, then fight over the plan directly. Full plan doc.
17
+ - **Skirmish**: 2 agents. Plan is combined with the design doc into one lightweight document.
18
+ - **Scout**: Skip this skill. Wizard creates inline tasks directly.
19
+
20
+ ## Process Flow
21
+
22
+ ```dot
23
+ digraph plan {
24
+ "Wizard reads design doc + Phase 1 Dungeon" -> "Wizard opens Dungeon + dispatches";
25
+ "Wizard opens Dungeon + dispatches" -> "Agents decompose independently";
26
+ "Agents decompose independently" -> "Agents compare and fight directly";
27
+ "Agents compare and fight directly" -> "Agents test compliance collaboratively";
28
+ "Agents test compliance collaboratively" -> "Agents pin agreed tasks to Dungeon";
29
+ "Agents pin agreed tasks to Dungeon" -> "All requirements covered?" [shape=diamond];
30
+ "All requirements covered?" -> "Agents identify and fix gaps" [label="no"];
31
+ "Agents identify and fix gaps" -> "Agents test compliance collaboratively";
32
+ "All requirements covered?" -> "Wizard closes: synthesizes plan from Dungeon" [label="yes"];
33
+ "Wizard closes: synthesizes plan from Dungeon" -> "Write plan doc";
34
+ "Write plan doc" -> "Adversarial plan review (agents attack directly)";
35
+ "Adversarial plan review (agents attack directly)" -> "Self-review (6-point checklist)";
36
+ "Self-review (6-point checklist)" -> "Wizard ruling + commit";
37
+ "Wizard ruling + commit" -> "Archive Dungeon + invoke raid-implementation" [shape=doublecircle];
38
+ }
39
+ ```
40
+
41
+ ## Wizard Checklist
42
+
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
47
+ 5. **Observe the fight** — agents test each other's plans, argue ordering, coverage, naming. Intervene only on triggers.
48
+ 6. **Close the phase** — when Dungeon has complete, verified task list
49
+ 7. **Synthesize** — write plan doc from Dungeon evidence
50
+ 8. **Adversarial plan review** — agents attack the written plan directly
51
+ 9. **Self-review** — 6-point checklist (see below)
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`
56
+
57
+ ## Opening the Dungeon
58
+
59
+ Create `.claude/raid-dungeon.md`:
60
+
61
+ ```markdown
62
+ # Dungeon — Phase 2: Plan
63
+ ## Quest: Decompose <design topic> into implementation tasks
64
+ ## Mode: <Full Raid | Skirmish>
65
+
66
+ ### Discoveries
67
+
68
+ ### Active Battles
69
+
70
+ ### Resolved
71
+
72
+ ### Shared Knowledge
73
+
74
+ ### Escalations
75
+ ```
76
+
77
+ ## Dispatch for Decomposition
78
+
79
+ **📡 DISPATCH:**
80
+
81
+ > **@Warrior**: Decompose into tasks. Focus on structural ordering — what MUST be built first? Hard dependencies? Critical path? Include tests for every task. Challenge @Archer and @Rogue's decompositions directly. Pin agreed tasks to Dungeon.
82
+ >
83
+ > **@Archer**: Decompose into tasks. Focus on completeness and consistency — does every requirement have a task? Are interfaces well-defined across tasks? Are naming patterns and file structure consistent with the codebase? Challenge @Warrior and @Rogue directly. Pin agreed tasks to Dungeon.
84
+ >
85
+ > **@Rogue**: Decompose into tasks. Focus on hidden complexity — which tasks are deceptively hard? Where will the implementer guess wrong? Which tests miss the failure path? Challenge @Warrior and @Archer directly. Pin agreed tasks to Dungeon.
86
+ >
87
+ > **All**: Read the Phase 1 archived Dungeon for design knowledge. Interact directly. Build on each other's decompositions. Pin agreed tasks with `📌 DUNGEON:`. Escalate to me with `🆘 WIZARD:` only when genuinely stuck.
88
+
89
+ ## Collaborative Compliance Testing (Agent-Driven)
90
+
91
+ After independent decomposition, agents fight directly over the plan:
92
+
93
+ 1. **Compare decompositions** — address each other by name, argue where they agree (high confidence) and disagree (needs resolution)
94
+ 2. **Test compliance with design** — every requirement verified against the plan. Line by line. No gaps. Agents cross-check each other.
95
+ 3. **Test naming consistency** — agents challenge each other's naming choices against codebase patterns
96
+ 4. **Test file system consistency** — file paths follow project structure, module organization clean
97
+ 5. **Test coverage** — agents challenge whether tests cover failure paths, not just happy paths
98
+ 6. **Test ordering** — agents argue dependency order, build-won't-break guarantees
99
+ 7. **Learn from disagreements** — resolutions often reveal a better approach. Pin lessons to Dungeon.
100
+
101
+ **Agents do this DIRECTLY with each other. The Wizard observes and intervenes only on triggers.**
102
+
103
+ ## Task Granularity
104
+
105
+ **Each step is one action (2-5 minutes):**
106
+ - "Write the failing test" — step
107
+ - "Run it to verify it fails" — step
108
+ - "Implement minimal code to pass" — step
109
+ - "Run tests to verify pass" — step
110
+ - "Commit" — step
111
+
112
+ ## Task Structure
113
+
114
+ ````markdown
115
+ ### Task N: [Component Name]
116
+
117
+ **Files:**
118
+ - Create: `exact/path/to/file.ext`
119
+ - Modify: `exact/path/to/existing.ext`
120
+ - Test: `tests/exact/path/to/test.ext`
121
+
122
+ **Acceptance Criteria:**
123
+ - [ ] [Specific, verifiable criterion]
124
+ - [ ] All tests pass
125
+ - [ ] No regressions
126
+ - [ ] Naming follows established patterns
127
+
128
+ **Steps:**
129
+ - [ ] Step 1: Write the failing test
130
+ - [ ] Step 2: Run test, verify it fails for the right reason
131
+ - [ ] Step 3: Write minimal implementation
132
+ - [ ] Step 4: Run test, verify it passes + full suite passes
133
+ - [ ] Step 5: Commit with descriptive message
134
+ ````
135
+
136
+ ## No Placeholders — Ever
137
+
138
+ These are plan failures. Never write:
139
+ - "TBD", "TODO", "implement later", "fill in details"
140
+ - "Add appropriate error handling" (specify WHAT error handling)
141
+ - "Write tests for the above" (without actual test code)
142
+ - "Similar to Task N" (repeat the code — the implementer may read tasks out of order)
143
+ - "Handle edge cases" (specify WHICH edge cases)
144
+ - Steps that describe what to do without showing how
145
+ - References to undefined types, functions, or methods
146
+
147
+ **Violating the letter of the "no placeholders" rule is violating its spirit.**
148
+
149
+ ## Self-Review (6-Point Checklist)
150
+
151
+ After writing the complete plan:
152
+
153
+ 1. **Spec coverage:** Skim each requirement in the design doc. Point to the task that implements it. List any gaps.
154
+ 2. **Placeholder scan:** Search for TBD, TODO, vague descriptions, missing code. Fix them.
155
+ 3. **Type/name consistency:** Do types, method signatures, property names match across ALL tasks?
156
+ 4. **File structure consistency:** Do all file paths follow the project's conventions?
157
+ 5. **Test quality:** Does every task have tests? Do tests cover failure paths?
158
+ 6. **Ordering:** Can each task be built and committed independently without breaking the build?
159
+
160
+ Fix issues inline. If a spec requirement has no task, add the task.
161
+
162
+ ## Red Flags
163
+
164
+ | Thought | Reality |
165
+ |---------|---------|
166
+ | "The plan is obvious from the design" | Plans expose complexity that specs hide. Decompose anyway. |
167
+ | "We can figure out the details during implementation" | Details in implementation = placeholders in the plan. |
168
+ | "I'll wait for the Wizard to synthesize" | You own the phase. Debate with teammates directly. |
169
+ | "These tasks are similar enough to batch" | Each task must be independently buildable and testable. |
170
+ | "Tests can be added later" | TDD means tests are in the plan. No test = no task. |
171
+ | "The naming will be consistent enough" | Check it explicitly. Naming drift is the #1 source of bugs. |
172
+
173
+ **Terminal state:** ⚡ WIZARD RULING: Plan approved. Commit. Archive Dungeon. Invoke `raid-implementation`.
@@ -0,0 +1,288 @@
1
+ ---
2
+ name: raid-protocol
3
+ description: "MUST use at the start of any Raid session. Establishes the 4-phase adversarial workflow, Dungeon lifecycle, team rules, modes, direct interaction protocols, and reference tables. Agents self-organize within phases. Wizard opens and closes."
4
+ ---
5
+
6
+ # Raid Protocol — Adversarial Multi-Agent Development
7
+
8
+ The canonical workflow for all Raid operations. Every feature, bugfix, refactor follows this sequence.
9
+
10
+ <HARD-GATE>
11
+ Do NOT skip phases. Do NOT let a single agent work unchallenged (except in Scout mode). Do NOT proceed without a Wizard ruling. No subagents — agent teams only.
12
+ </HARD-GATE>
13
+
14
+ ## Session Lifecycle
15
+
16
+ ```dot
17
+ digraph session {
18
+ "Wizard starts" -> "Read raid-rules.md + raid.json";
19
+ "Read raid-rules.md + raid.json" -> "Create .claude/raid-session";
20
+ "Create .claude/raid-session" -> "Assess task complexity";
21
+ "Assess task complexity" -> "Recommend mode";
22
+ "Recommend mode" -> "Human confirms mode?";
23
+ "Human confirms mode?" -> "Begin Phase 1" [label="yes"];
24
+ "Human confirms mode?" -> "Recommend mode" [label="override"];
25
+ "Begin Phase 1" -> "Phase 1: Design (raid-design)";
26
+ "Phase 1: Design (raid-design)" -> "Phase 2: Plan (raid-implementation-plan)";
27
+ "Phase 2: Plan (raid-implementation-plan)" -> "Phase 3: Implementation (raid-implementation)";
28
+ "Phase 3: Implementation (raid-implementation)" -> "Phase 4: Review (raid-review)";
29
+ "Phase 4: Review (raid-review)" -> "Finishing (raid-finishing)";
30
+ "Finishing (raid-finishing)" -> "Clean up Dungeon files";
31
+ "Clean up Dungeon files" -> "Remove .claude/raid-session";
32
+ "Remove .claude/raid-session" -> "Session complete" [shape=doublecircle];
33
+ }
34
+ ```
35
+
36
+ **On session start:** Create `.claude/raid-session` to activate workflow hooks.
37
+ **On session end:** Remove `.claude/raid-session`, remove `.claude/raid-dungeon.md` and all `.claude/raid-dungeon-phase-*.md` files.
38
+
39
+ Hooks that enforce workflow discipline (phase-gate, test-pass, verification) only fire when `.claude/raid-session` exists.
40
+
41
+ ## Team
42
+
43
+ | Agent | Role | Color |
44
+ |-------|------|-------|
45
+ | **Wizard** (Dungeon Master) | Opens phases, observes, intervenes when necessary, closes with ruling | Purple |
46
+ | **Warrior** | Aggressive explorer, stress-tests to destruction, builds on team findings | Red |
47
+ | **Archer** | Precise pattern-seeker, finds hidden connections and drift, traces ripple effects | Green |
48
+ | **Rogue** | Adversarial assumption-destroyer, constructs attack scenarios, weaponizes findings | Orange |
49
+
50
+ ## Team Rules
51
+
52
+ Read and follow `.claude/raid-rules.md`. Non-negotiable. 17 rules including Dungeon discipline, direct engagement, wise escalation, and evidence-backed roasts.
53
+
54
+ ## Configuration
55
+
56
+ Read `.claude/raid.json` for project-specific settings. If absent, use sensible defaults:
57
+
58
+ | Key | Default | Purpose |
59
+ |-----|---------|---------|
60
+ | `project.testCommand` | (none) | Command to run tests |
61
+ | `project.lintCommand` | (none) | Command to run linting |
62
+ | `project.buildCommand` | (none) | Command to build |
63
+ | `paths.specs` | `docs/raid/specs` | Where design docs go |
64
+ | `paths.plans` | `docs/raid/plans` | Where plans go |
65
+ | `paths.worktrees` | `.worktrees` | Where worktrees go |
66
+ | `conventions.fileNaming` | `none` | Naming convention |
67
+ | `conventions.commits` | `conventional` | Commit format |
68
+ | `raid.defaultMode` | `full` | Default mode |
69
+
70
+ ## Modes
71
+
72
+ Three modes that scale effort to task complexity.
73
+
74
+ | Aspect | Full Raid | Skirmish | Scout |
75
+ |--------|-----------|----------|-------|
76
+ | Agents active | 3 | 2 | 1 |
77
+ | Design phase | Full adversarial | Lightweight | Skip (inline) |
78
+ | Plan phase | Full adversarial | Merged with design | Skip (inline) |
79
+ | Implementation | 1 builds, 2 attack | 1 builds, 1 attacks | 1 builds, Wizard reviews |
80
+ | Review phase | 3 independent reviews | 1 review + Wizard | Wizard review only |
81
+ | TDD | **Enforced** | **Enforced** | **Enforced** |
82
+ | Verification | Triple | Double | Single + Wizard |
83
+ | Design doc | Required | Optional (brief) | Not required |
84
+ | Plan doc | Required | Combined with design | Not required |
85
+ | Dungeon | Full (all sections) | Lightweight | Wizard notes only |
86
+
87
+ **Mode selection:** User specifies, or Wizard recommends based on task complexity.
88
+ **Escalation:** Wizard may escalate (Scout->Skirmish->Full) with human approval.
89
+ **De-escalation:** Only with human approval.
90
+
91
+ **TDD is non-negotiable in ALL modes.** This is an Iron Law, not a preference.
92
+
93
+ ## The Dungeon — Shared Knowledge Artifact
94
+
95
+ The Dungeon (`.claude/raid-dungeon.md`) is the team's shared knowledge board. It persists within a phase and gets archived when the phase closes.
96
+
97
+ ### Dungeon Structure
98
+
99
+ ```markdown
100
+ # Dungeon — Phase N: <Phase Name>
101
+ ## Quest: <task description>
102
+ ## Mode: <Full Raid | Skirmish | Scout>
103
+
104
+ ### Discoveries
105
+ <!-- Verified findings that survived challenge, tagged with agent name -->
106
+
107
+ ### Active Battles
108
+ <!-- Ongoing unresolved challenges between agents -->
109
+
110
+ ### Resolved
111
+ <!-- Challenges that reached conclusion — conceded, proven, or Wizard-ruled -->
112
+
113
+ ### Shared Knowledge
114
+ <!-- Facts established as true by 2+ agents agreeing or surviving challenge -->
115
+
116
+ ### Escalations
117
+ <!-- Points where agents pulled the Wizard in -->
118
+ ```
119
+
120
+ ### Dungeon Lifecycle
121
+
122
+ | Event | Action | Who |
123
+ |-------|--------|-----|
124
+ | Phase opens | Create `.claude/raid-dungeon.md` with header | Wizard |
125
+ | During phase | Read and write via `📌 DUNGEON:` signal | Agents |
126
+ | Phase closes | Rename to `.claude/raid-dungeon-phase-N.md` | Wizard |
127
+ | Next phase opens | Create fresh `.claude/raid-dungeon.md` | Wizard |
128
+ | Session ends | Remove all Dungeon files | Wizard |
129
+
130
+ ### Dungeon Curation Rules
131
+
132
+ **What goes IN the Dungeon (via `📌 DUNGEON:` only):**
133
+ - Findings that survived a challenge (verified truths)
134
+ - Active unresolved battles (prevents re-litigation)
135
+ - Shared knowledge promoted by 2+ agents agreeing
136
+ - Key decisions and their reasoning
137
+ - Escalation points and Wizard responses
138
+
139
+ **What stays in conversation only:**
140
+ - Back-and-forth of challenges and roasts
141
+ - Exploratory thinking and hypotheses
142
+ - Concessions and rebuttals
143
+ - Anything that didn't produce a durable insight
144
+
145
+ **The conversation is the sparring ring. The Dungeon is the scoreboard.**
146
+
147
+ ### Referencing Prior Phases
148
+
149
+ Agents can read archived Dungeons from prior phases. Design knowledge carries into Plan. Plan knowledge carries into Implementation. This is how context survives phase transitions.
150
+
151
+ ## The Phase Pattern
152
+
153
+ Every phase follows the open/close bookend model:
154
+
155
+ ```dot
156
+ digraph phase_pattern {
157
+ "Wizard opens (quest + angles + Dungeon)" -> "Agents self-organize";
158
+ "Agents self-organize" -> "Agents explore, challenge, roast, build";
159
+ "Agents explore, challenge, roast, build" -> "Agents pin findings to Dungeon";
160
+ "Agents pin findings to Dungeon" -> "Intervention needed?" [shape=diamond];
161
+ "Intervention needed?" -> "Wizard intervenes (minimum force)" [label="yes"];
162
+ "Wizard intervenes (minimum force)" -> "Agents resume";
163
+ "Agents resume" -> "Agents explore, challenge, roast, build";
164
+ "Intervention needed?" -> "Phase objective met?" [label="no"];
165
+ "Phase objective met?" -> "Agents explore, challenge, roast, build" [label="no, continue"];
166
+ "Phase objective met?" -> "Wizard closes (ruling + archive Dungeon)" [label="yes"];
167
+ "Wizard closes (ruling + archive Dungeon)" -> "Next phase" [shape=doublecircle];
168
+ }
169
+ ```
170
+
171
+ ### Phase Transition Gates
172
+
173
+ | From | To | Gate |
174
+ |------|-----|------|
175
+ | Design | Plan | Design doc approved by Wizard ruling, committed |
176
+ | Plan | Implementation | Plan approved by Wizard ruling, committed |
177
+ | Implementation | Review | All tasks complete, all tests passing, committed |
178
+ | Review | Finishing | Wizard ruling: approved for merge |
179
+
180
+ **Violating the letter of these gates is violating the spirit of the process.**
181
+
182
+ ## Interaction Protocols
183
+
184
+ ### Communication Signals Reference
185
+
186
+ | Signal | Who | Meaning | Goes to Dungeon? |
187
+ |--------|-----|---------|------------------|
188
+ | `📡 DISPATCH:` | Wizard | Opening a phase, assigning angles | No (phase opening) |
189
+ | `⚡ WIZARD OBSERVES:` | Wizard | Brief course correction, hint, nudge | No |
190
+ | `⚡ WIZARD INTERVENES:` | Wizard | Stops action, something wrong | No |
191
+ | `⚡ WIZARD RULING:` | Wizard | Phase over, binding decision | Ruling archived with Dungeon |
192
+ | `@Name, ...` | Any agent | Direct address to specific agent | No |
193
+ | `🔍 FINDING:` | Warrior | Discovery with evidence | Only after surviving challenge |
194
+ | `🎯 FINDING:` | Archer | Discovery with evidence | Only after surviving challenge |
195
+ | `💀 FINDING:` | Rogue | Discovery with attack scenario | Only after surviving challenge |
196
+ | `⚔️ CHALLENGE:` | Warrior | Direct challenge | No |
197
+ | `🏹 CHALLENGE:` | Archer | Direct challenge | No |
198
+ | `🗡️ CHALLENGE:` | Rogue | Direct challenge | No |
199
+ | `🔥 ROAST:` | Any agent | Pointed critique with evidence | No |
200
+ | `🔗 BUILDING ON @Name:` | Any agent | Extending another's work | Result goes to Dungeon if verified |
201
+ | `📌 DUNGEON:` | Any agent | Pinning verified finding | Yes — this is the write gate |
202
+ | `🆘 WIZARD:` | Any agent | Escalation — needs Wizard input | Yes (as escalation point) |
203
+ | `✅ CONCEDE:` | Any agent | Admitting wrong, moving on | No |
204
+
205
+ ### Direct Interaction Rules
206
+
207
+ - **Evidence required.** All challenges, roasts, and findings must carry proof — file paths, line numbers, concrete scenarios. "This is wrong" without evidence is laziness.
208
+ - **Build explicitly.** `🔗 BUILDING ON @Name:` forces credit and continuity. Don't restart from scratch when someone found something useful.
209
+ - **Concede instantly.** When proven wrong, concede. Then find a new angle. No ego.
210
+ - **Pin deliberately.** `📌 DUNGEON:` is the quality gate. Only verified, challenged findings get pinned. Other agents can challenge whether a pin belongs.
211
+ - **Escalate wisely.** `🆘 WIZARD:` when genuinely stuck, split on fundamentals, or need project-level context. Not when lazy.
212
+
213
+ ### When to Escalate to Wizard
214
+
215
+ **Do escalate:**
216
+ - 2+ agents stuck on same disagreement for 3+ exchanges with no new evidence
217
+ - Uncertain about project-level context (user requirements, constraints, priorities)
218
+ - Team needs a direction-setting decision that affects the quest
219
+ - Found something that may require human input
220
+
221
+ **Don't escalate:**
222
+ - You can resolve it by reading the code
223
+ - Another agent already answered your question
224
+ - It's a matter of opinion that doesn't affect the outcome
225
+ - You're stuck but haven't tried talking to the other agents first
226
+
227
+ ## When the Wizard Intervenes
228
+
229
+ The Wizard observes 90%, acts 10%. Intervention triggers:
230
+
231
+ | Signal | Action |
232
+ |--------|--------|
233
+ | Same arguments 3+ rounds, no new evidence | `⚡ WIZARD INTERVENES:` Break the loop. Rule or redirect. |
234
+ | Agents drifting from objective | `⚡ WIZARD OBSERVES:` Redirect with clarity. |
235
+ | Agents stuck, no progress (deadlock) | `⚡ WIZARD INTERVENES:` Rule with rationale. Binding. |
236
+ | Shallow work, rubber-stamping (laziness) | `⚡ WIZARD INTERVENES:` Call out and demand genuine challenge. |
237
+ | Defending past evidence (ego) | `⚡ WIZARD OBSERVES:` Evidence or concede. |
238
+ | Wrong finding in Dungeon (misinformation) | `⚡ WIZARD INTERVENES:` Remove and correct. |
239
+ | Agent escalation (`🆘 WIZARD:`) | Answer or redirect as appropriate. |
240
+ | All agents converged | `⚡ WIZARD RULING:` Synthesize and close. |
241
+
242
+ ## Red Flags — Thoughts That Signal Violations
243
+
244
+ | Thought | Reality |
245
+ |---------|---------|
246
+ | "This phase is obvious, let's skip it" | Obvious phases are where assumptions hide. |
247
+ | "The agents agree, no need for cross-testing" | Agreement without challenge is groupthink. |
248
+ | "Let's just fix this quickly, no need for design" | Quick fixes without design become tech debt. |
249
+ | "TDD would slow us down on this one" | TDD is an Iron Law. No exceptions. |
250
+ | "One agent can handle this alone" | Scout mode exists. Use it. Don't bypass modes. |
251
+ | "We already know what to build" | Knowing and verifying are different things. |
252
+ | "The Wizard should mediate this" | Agents resolve directly. Wizard observes. |
253
+ | "Let me just post everything to the Dungeon" | Dungeon is a scoreboard, not a log. Pin only verified findings. |
254
+ | "I'll wait for the Wizard to tell me what to do next" | You own the phase. Self-organize. |
255
+
256
+ ## Skills Reference
257
+
258
+ | Skill | Phase | Purpose |
259
+ |-------|-------|---------|
260
+ | `raid-protocol` | Start | Session lifecycle, Dungeon lifecycle, modes, rules, reference |
261
+ | `raid-design` | 1 | Adversarial design with agent-driven exploration |
262
+ | `raid-implementation-plan` | 2 | Collaborative plan with direct cross-testing |
263
+ | `raid-implementation` | 3 | Agent-driven implementation with rotation |
264
+ | `raid-review` | 4 | Adversarial full review with Dungeon-tracked issues |
265
+ | `raid-finishing` | End | Completeness debate + merge options |
266
+ | `raid-tdd` | 3 | TDD with collaborative test quality review |
267
+ | `raid-debugging` | Any | Competing hypothesis with direct debate |
268
+ | `raid-verification` | Any | Evidence before completion claims |
269
+ | `raid-git-worktrees` | 3 | Isolated workspace setup |
270
+
271
+ ## Hooks Reference
272
+
273
+ | Hook | Event | Active | Purpose |
274
+ |------|-------|--------|---------|
275
+ | `validate-file-naming.sh` | PostToolUse (Write/Edit) | Always | Enforce naming conventions |
276
+ | `validate-commit-message.sh` | PreToolUse (Bash) | Always | Conventional commits |
277
+ | `validate-tests-pass.sh` | PreToolUse (Bash) | Raid session only | Tests before commits |
278
+ | `validate-phase-gate.sh` | PreToolUse (Write) | Raid session only | Design doc before code |
279
+ | `validate-no-placeholders.sh` | PostToolUse (Write/Edit) | Always | No TBD/TODO in specs/plans |
280
+ | `validate-verification.sh` | PreToolUse (Bash) | Raid session only | Test evidence before completion |
281
+
282
+ ## Commit Convention
283
+
284
+ All commits follow: `type(scope): description`
285
+
286
+ Types: `feat`, `fix`, `docs`, `style`, `refactor`, `perf`, `test`, `build`, `ci`, `chore`, `revert`
287
+
288
+ Phase transitions: `docs(design): <topic>`, `docs(plan): <topic>`, `feat(scope): <what>`, `fix(scope): <what>`
@@ -0,0 +1,133 @@
1
+ ---
2
+ name: raid-review
3
+ description: "Phase 4 of Raid protocol. Wizard opens the Dungeon, agents review independently then fight directly over findings and missing findings. Issues pinned by severity. Wizard closes when all Critical/Important fixed."
4
+ ---
5
+
6
+ # Raid Review — Phase 4
7
+
8
+ Three reviewers, three angles, zero mercy. They fight each other, not just the code.
9
+
10
+ <HARD-GATE>
11
+ Do NOT declare work complete without Phase 4 (except Scout mode). All assigned agents review the ENTIRE implementation independently, then attack each other's findings. Use `raid-verification` before any completion claims. No subagents.
12
+ </HARD-GATE>
13
+
14
+ ## Mode Behavior
15
+
16
+ - **Full Raid**: 3 independent reviews, then agents fight directly over findings. All severity levels enforced.
17
+ - **Skirmish**: 1 agent reviews + Wizard. Cross-testing between reviewer and Wizard.
18
+ - **Scout**: Wizard reviews alone. Checks against requirements and runs tests.
19
+
20
+ ## Process Flow
21
+
22
+ ```dot
23
+ digraph review {
24
+ "Wizard reads design doc, plan, Phase 3 Dungeon" -> "Wizard opens Dungeon + dispatches";
25
+ "Wizard opens Dungeon + dispatches" -> "Agents review independently";
26
+ "Agents review independently" -> "Agents fight over findings directly";
27
+ "Agents fight over findings directly" -> "Agents challenge missing findings";
28
+ "Agents challenge missing findings" -> "Agents pin severity-classified issues to Dungeon";
29
+ "Agents pin severity-classified issues to Dungeon" -> "Wizard closes: categorizes surviving issues";
30
+ "Wizard closes: categorizes surviving issues" -> "Critical or Important?" [shape=diamond];
31
+ "Critical or Important?" -> "Assign fixes" [label="yes"];
32
+ "Assign fixes" -> "Fix + verify + challengers re-attack";
33
+ "Fix + verify + challengers re-attack" -> "Wizard closes: categorizes surviving issues";
34
+ "Critical or Important?" -> "Wizard final ruling" [label="no"];
35
+ "Wizard final ruling" -> "Archive Dungeon + invoke raid-finishing" [shape=doublecircle];
36
+ }
37
+ ```
38
+
39
+ ## Wizard Checklist
40
+
41
+ 1. **Prepare** — gather git range, design doc, plan doc, read Phase 3 Dungeon
42
+ 2. **Open the Dungeon** — create `.claude/raid-dungeon.md` with Phase 4 header
43
+ 3. **Dispatch** — all agents review independently, then interact directly
44
+ 4. **Observe the fight** — agents challenge findings and missing findings directly
45
+ 5. **Close** — categorize surviving issues by severity from Dungeon
46
+ 6. **Rule on fixes** — Critical and Important must be fixed
47
+ 7. **Verify fixes** — targeted re-attack after fixes (use `raid-verification`)
48
+ 8. **Final ruling** — approved or rejected
49
+ 9. **Archive Dungeon** — rename to `.claude/raid-dungeon-phase-4.md`
50
+ 10. **Transition** — invoke `raid-finishing`
51
+
52
+ ## Opening the Dungeon
53
+
54
+ Create `.claude/raid-dungeon.md`:
55
+
56
+ ```markdown
57
+ # Dungeon — Phase 4: Review
58
+ ## Quest: Full adversarial review of <feature> implementation
59
+ ## Mode: <Full Raid | Skirmish>
60
+
61
+ ### Discoveries
62
+
63
+ ### Active Battles
64
+
65
+ ### Resolved
66
+
67
+ ### Shared Knowledge
68
+
69
+ ### Escalations
70
+ ```
71
+
72
+ ## Dispatch
73
+
74
+ **📡 DISPATCH:**
75
+
76
+ > **@Warrior**: Review full implementation. Run every test. Check error handling at every boundary. Verify all requirements from design doc. Find the bugs that crash in production. Then fight @Archer and @Rogue over their findings.
77
+ >
78
+ > **@Archer**: Review full implementation. Does it match the design doc exactly? Patterns consistent? Interfaces correct? Types sound? Naming conventions followed? File structure clean? Find the bugs that silently produce wrong results. Then fight @Warrior and @Rogue.
79
+ >
80
+ > **@Rogue**: Review full implementation. Think like an attacker. What inputs break it? What timing causes races? What happens when dependencies fail? Find the bugs nobody else will find. Then fight @Warrior and @Archer.
81
+ >
82
+ > **All**: Review independently first, then fight directly. Challenge each other's findings AND each other's blind spots. Pin severity-classified issues to Dungeon with `📌 DUNGEON:`. Reference the Phase 3 Dungeon for context.
83
+
84
+ ## Review Checklist — Each Agent
85
+
86
+ **Requirements:** Every design doc requirement implemented? No extras (YAGNI)? Nothing misinterpreted?
87
+
88
+ **Code Quality:** Clean separation? Error handling at every boundary? DRY? Clear names?
89
+
90
+ **Testing:** Every function tested? Edge cases? Failure paths? All passing?
91
+
92
+ **Architecture:** Design decisions implemented correctly? Interfaces match spec? No drift?
93
+
94
+ **Naming & Structure:** Consistent naming? File system follows conventions? Modules clean?
95
+
96
+ **Production:** Performance OK? External calls have timeouts? No secrets in code?
97
+
98
+ ## The Fight — Agents Challenge Each Other
99
+
100
+ After independent reviews, agents fight DIRECTLY over findings AND missing findings:
101
+
102
+ - `⚔️ CHALLENGE: @Archer, you gave the auth module a pass but didn't check the session rotation path — review it now.`
103
+ - `🔗 BUILDING ON @Warrior: Your finding about the missing error handler — the impact is worse than you stated because...`
104
+ - `🔥 ROAST: @Rogue, your "Critical" severity on the naming inconsistency is overblown — here's why it's actually Minor...`
105
+ - `📌 DUNGEON: [Critical] handler.js:23 — missing input validation allows injection. Verified by @Warrior and @Rogue.`
106
+
107
+ **Agents classify severity when pinning to Dungeon:**
108
+
109
+ | Severity | Definition | Action |
110
+ |----------|------------|--------|
111
+ | **Critical** | Bugs, security holes, data loss, crashes | Must fix. No exceptions. |
112
+ | **Important** | Missing features, poor error handling, test gaps, naming inconsistencies | Must fix. |
113
+ | **Minor** | Style, docs, optimization | Note for future. |
114
+
115
+ ## Closing the Phase
116
+
117
+ The Wizard closes when agents have exhausted their findings and the Dungeon has all issues classified:
118
+
119
+ **⚡ WIZARD RULING: APPROVED FOR MERGE** — all Critical/Important fixed, tests pass, requirements met.
120
+
121
+ **⚡ WIZARD RULING: REJECTED** — specify what must change and which phase to return to.
122
+
123
+ ## Red Flags
124
+
125
+ | Thought | Reality |
126
+ |---------|---------|
127
+ | "The implementation looks fine, no issues" | Every review finds at least one issue. Look harder. |
128
+ | "I'll report my findings to the Wizard" | Report to the other agents directly. Fight over them. |
129
+ | "This is a Minor issue" (when it causes wrong behavior) | Wrong results = Important or Critical. |
130
+ | "The tests pass, so it works" | Tests prove what they test. What DON'T they test? |
131
+ | "Let's skip re-review of the fixes" | Fixes introduce new bugs. Always re-attack. |
132
+
133
+ **Terminal state:** Archive Dungeon. Invoke `raid-finishing`.