claude-raid 0.1.7 → 0.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/bin/cli.js +13 -1
  2. package/package.json +1 -1
  3. package/src/descriptions.js +26 -24
  4. package/src/init.js +6 -10
  5. package/src/merge-settings.js +0 -15
  6. package/src/remove.js +18 -16
  7. package/src/ui.js +1 -1
  8. package/src/update.js +28 -13
  9. package/template/.claude/agents/archer.md +10 -20
  10. package/template/.claude/agents/rogue.md +11 -21
  11. package/template/.claude/agents/warrior.md +8 -19
  12. package/template/.claude/agents/wizard.md +14 -247
  13. package/template/.claude/dungeon-master-rules.md +210 -0
  14. package/template/.claude/hooks/raid-lib.sh +29 -2
  15. package/template/.claude/hooks/raid-pre-compact.sh +12 -1
  16. package/template/.claude/hooks/raid-session-end.sh +23 -13
  17. package/template/.claude/hooks/raid-session-start.sh +21 -3
  18. package/template/.claude/hooks/validate-commit.sh +7 -74
  19. package/template/.claude/hooks/validate-dungeon.sh +30 -11
  20. package/template/.claude/hooks/validate-no-placeholders.sh +3 -3
  21. package/template/.claude/hooks/validate-write-gate.sh +45 -63
  22. package/template/.claude/{raid-rules.md → party-rules.md} +38 -13
  23. package/template/.claude/skills/raid-browser-chrome/SKILL.md +1 -1
  24. package/template/.claude/skills/{raid-design → raid-canonical-design}/SKILL.md +52 -16
  25. package/template/.claude/skills/{raid-implementation → raid-canonical-implementation}/SKILL.md +41 -14
  26. package/template/.claude/skills/{raid-implementation-plan → raid-canonical-implementation-plan}/SKILL.md +49 -17
  27. package/template/.claude/skills/raid-canonical-prd/SKILL.md +133 -0
  28. package/template/.claude/skills/raid-canonical-protocol/SKILL.md +211 -0
  29. package/template/.claude/skills/{raid-review → raid-canonical-review}/SKILL.md +78 -17
  30. package/template/.claude/skills/raid-debugging/SKILL.md +30 -5
  31. package/template/.claude/skills/raid-init/SKILL.md +130 -0
  32. package/template/.claude/skills/raid-tdd/SKILL.md +1 -1
  33. package/template/.claude/skills/raid-wrap-up/SKILL.md +184 -0
  34. package/template/.claude/hooks/raid-stop.sh +0 -20
  35. package/template/.claude/hooks/raid-task-completed.sh +0 -42
  36. package/template/.claude/hooks/validate-bash-writes.sh +0 -157
  37. package/template/.claude/skills/raid-browser-playwright/SKILL.md +0 -163
  38. package/template/.claude/skills/raid-finishing/SKILL.md +0 -140
  39. package/template/.claude/skills/raid-git-worktrees/SKILL.md +0 -96
  40. package/template/.claude/skills/raid-protocol/SKILL.md +0 -337
@@ -1,140 +0,0 @@
1
- ---
2
- name: raid-finishing
3
- description: "Use after Phase 4 review is approved. Agents debate completeness directly, fighting over what's truly done. Wizard closes with verdict, presents merge options, cleans up Dungeon files and session."
4
- ---
5
-
6
- # Raid Finishing — Complete the Development Branch
7
-
8
- Agents debate completeness directly. Verify. Present options. Execute. Clean up.
9
-
10
- **Violating the letter of this process is violating its spirit.**
11
-
12
- ## Mode Behavior
13
-
14
- - **Full Raid**: All 3 agents debate completeness directly. Full verification.
15
- - **Skirmish**: 1 agent + Wizard verify completeness.
16
- - **Scout**: Wizard verifies alone.
17
-
18
- ## Process Flow
19
-
20
- ```dot
21
- digraph finishing {
22
- "Wizard opens final debate" -> "Agents argue directly: truly done?";
23
- "Agents argue directly: truly done?" -> "Any agent says incomplete?" [shape=diamond];
24
- "Any agent says incomplete?" -> "Agent presents evidence, others attack" [label="yes"];
25
- "Agent presents evidence, others attack" -> "Wizard rules" [shape=diamond];
26
- "Wizard rules" -> "Return to Phase 3 or 4" [label="incomplete"];
27
- "Wizard rules" -> "Verify all tests pass (fresh run)" [label="complete"];
28
- "Any agent says incomplete?" -> "Verify all tests pass (fresh run)" [label="no, all agree"];
29
- "Verify all tests pass (fresh run)" -> "Tests pass?" [shape=diamond];
30
- "Tests pass?" -> "Fix first. Do not present options." [label="no"];
31
- "Fix first. Do not present options." -> "Verify all tests pass (fresh run)";
32
- "Tests pass?" -> "Present 4 options" [label="yes"];
33
- "Present 4 options" -> "Execute choice";
34
- "Execute choice" -> "Clean up: Dungeon files + worktree + raid-session";
35
- "Clean up: Dungeon files + worktree + raid-session" -> "Done" [shape=doublecircle];
36
- }
37
- ```
38
-
39
- ## Wizard Checklist
40
-
41
- 1. **Open final debate** — dispatch agents to argue completeness directly
42
- 2. **Observe the fight** — agents challenge each other on what's done vs. missing
43
- 3. **Wizard rules on completeness** — only proceed if ruling is "complete"
44
- 4. **Verify all tests pass** — full suite, fresh run
45
- 5. **Present options** — exactly 4 choices
46
- 6. **Execute choice** — merge, PR, keep, or discard
47
- 7. **Clean up** — remove all Dungeon files (`.claude/raid-dungeon.md`, `.claude/raid-dungeon-phase-*.md`), worktree if applicable, remove `.claude/raid-session`
48
-
49
- ## Step 1: The Completeness Debate
50
-
51
- **DISPATCH:**
52
-
53
- > **@Warrior**: Review the implementation against the plan. Is every task completed? Every acceptance criterion met? Every test passing? Is anything half-done? Fight @Archer and @Rogue directly on their assessments.
54
- >
55
- > **@Archer**: Review the implementation against the design doc. Is every requirement covered? Naming patterns consistent throughout? File structure clean? Did we introduce inconsistencies with the rest of the codebase? Fight @Warrior and @Rogue directly.
56
- >
57
- > **@Rogue**: Review from the adversarial angle. What did we miss? What edge case is untested? What requirement was subtly misinterpreted? What will break in the first week of production? Fight @Warrior and @Archer directly.
58
- >
59
- > **All**: Reference ALL archived Dungeons (Phase 1-4) for full context. Debate directly. If you believe the work is incomplete, present evidence. Others challenge your claim. Pin conclusions to conversation (no Dungeon for finishing — this is the final debate).
60
-
61
- **The agents must fight over this.** If any agent believes the work is incomplete, they present evidence. The other two challenge that claim directly.
62
-
63
- RULING: [Complete — proceed | Incomplete — return to Phase 3/4 with specific issues]
64
-
65
- ## Step 2: Final Verification
66
-
67
- ```
68
- BEFORE presenting options:
69
- 1. IDENTIFY: test command from .claude/raid.json
70
- 2. RUN: Execute the FULL test suite (fresh, complete)
71
- 3. READ: Full output, check exit code, count failures
72
- 4. VERIFY: Zero failures?
73
- If NO → STOP. Fix first. Do not present options.
74
- If YES → Proceed with evidence.
75
- ```
76
-
77
- ### Browser Verification (when `browser.enabled` in raid.json)
78
-
79
- Additional final checks:
80
- - Full Playwright test suite passes headlessly
81
- - Verify no leaked processes from prior browser sessions
82
- - Verify all ports in `browser.portRange` are free (`lsof -i :PORT`)
83
- - Agents debate: "Are browser tests sufficient for this feature's coverage?"
84
-
85
- ## Step 3: Present Options
86
-
87
- ```
88
- RULING: Implementation complete and verified.
89
-
90
- Tests: [N] passing, 0 failures (evidence: [command output])
91
-
92
- Options:
93
- 1. Merge back to [base-branch] locally
94
- 2. Push and create a Pull Request
95
- 3. Keep the branch as-is (handle later)
96
- 4. Discard this work
97
-
98
- Which option?
99
- ```
100
-
101
- ## Step 4: Execute
102
-
103
- | Option | Actions |
104
- |--------|---------|
105
- | **1. Merge** | Checkout base -> pull -> merge -> run tests on merged result -> delete branch -> clean up |
106
- | **2. PR** | Push with -u -> create PR via gh -> clean up |
107
- | **3. Keep** | Report branch location. Done. |
108
- | **4. Discard** | Require typed "discard" confirmation -> delete branch (force) -> clean up |
109
-
110
- ## Step 5: Clean Up
111
-
112
- Remove ALL Dungeon artifacts:
113
- - `.claude/raid-dungeon.md` (if exists)
114
- - `.claude/raid-dungeon-phase-1.md`
115
- - `.claude/raid-dungeon-phase-2.md`
116
- - `.claude/raid-dungeon-phase-3.md`
117
- - `.claude/raid-dungeon-phase-4.md`
118
- - `.claude/raid-session`
119
- - Worktree (if applicable)
120
-
121
- ## Red Flags
122
-
123
- | Thought | Reality |
124
- |---------|---------|
125
- | "Tests passed earlier, no need to re-run" | Verification Iron Law. Fresh run or no claim. |
126
- | "The completeness debate is a formality" | It's where missed requirements surface. Take it seriously. |
127
- | "Let me report to the Wizard whether it's complete" | Debate with the other agents directly. |
128
- | "Merge without testing the merged result" | Merges introduce conflicts. Always test after merge. |
129
- | "Leave the Dungeon files, they might be useful" | Clean up. Session artifacts don't belong in the repo. |
130
-
131
- ---
132
-
133
- ## Session Complete
134
-
135
- When the chosen option is executed:
136
-
137
- 1. Remove all Dungeon files (`.claude/raid-dungeon*.md`)
138
- 2. Remove `.claude/raid-session`
139
- 3. Send shutdown to all teammates
140
- 4. **Session is over. No further skills to load.**
@@ -1,96 +0,0 @@
1
- ---
2
- name: raid-git-worktrees
3
- description: "Use when starting Raid implementation that needs isolation. Creates isolated git worktree with safety verification and clean test baseline."
4
- ---
5
-
6
- # Raid Git Worktrees — Isolated Workspaces
7
-
8
- Systematic directory selection + safety verification = reliable isolation.
9
-
10
- ## Process Flow
11
-
12
- ```dot
13
- digraph worktree {
14
- "Check worktree path from raid.json" -> "Directory exists?";
15
- "Directory exists?" -> "Verify gitignored" [label="yes"];
16
- "Directory exists?" -> "Create directory" [label="no"];
17
- "Create directory" -> "Add to .gitignore + commit";
18
- "Add to .gitignore + commit" -> "Verify gitignored";
19
- "Verify gitignored" -> "Ignored?" [shape=diamond];
20
- "Ignored?" -> "Create worktree" [label="yes"];
21
- "Ignored?" -> "Add to .gitignore + commit" [label="no"];
22
- "Create worktree" -> "Install dependencies";
23
- "Install dependencies" -> "Run baseline tests";
24
- "Run baseline tests" -> "Tests pass?" [shape=diamond];
25
- "Tests pass?" -> "Report ready" [label="yes", shape=doublecircle];
26
- "Tests pass?" -> "Report failures, ask user" [label="no"];
27
- }
28
- ```
29
-
30
- ## Directory Selection Priority
31
-
32
- 1. Check worktrees path from `.claude/raid.json` (default: `.worktrees/`) -> use it (verify ignored)
33
- 2. Check CLAUDE.md for preference -> use it
34
- 3. Ask the user
35
-
36
- ## Safety Verification
37
-
38
- ```bash
39
- # MUST verify directory is gitignored before creating worktree
40
- git check-ignore -q [worktrees-path] 2>/dev/null
41
- ```
42
-
43
- If NOT ignored: add to `.gitignore`, commit immediately, then proceed. Fix broken things immediately — don't leave unignored worktree directories.
44
-
45
- ## Creation
46
-
47
- ```bash
48
- WORKTREE_PATH=$(jq -r '.paths.worktrees // ".worktrees"' .claude/raid.json)
49
- git worktree add "$WORKTREE_PATH/$BRANCH_NAME" -b "$BRANCH_NAME"
50
- cd "$WORKTREE_PATH/$BRANCH_NAME"
51
-
52
- # Auto-detect and install deps
53
- [ -f package.json ] && npm install
54
- [ -f Cargo.toml ] && cargo build
55
- [ -f requirements.txt ] && pip install -r requirements.txt
56
- [ -f pyproject.toml ] && poetry install
57
- [ -f go.mod ] && go mod download
58
-
59
- # Verify clean baseline
60
- TEST_CMD=$(jq -r '.project.testCommand // empty' .claude/raid.json)
61
- [ -n "$TEST_CMD" ] && eval "$TEST_CMD"
62
- ```
63
-
64
- ## Report
65
-
66
- ```
67
- Worktree ready at [path]
68
- Branch: [branch-name]
69
- Tests: [N] passing, 0 failures
70
- Ready for Raid implementation
71
-
72
- Note: Dungeon files (.claude/raid-dungeon*.md) are session artifacts
73
- and will be cleaned up by raid-finishing. No gitignore needed.
74
- ```
75
-
76
- ## Quick Reference
77
-
78
- | Situation | Action |
79
- |-----------|--------|
80
- | `.worktrees/` exists | Use it (verify ignored) |
81
- | `worktrees/` exists | Use it (verify ignored) |
82
- | Both exist | Use `.worktrees/` |
83
- | Neither exists | Check raid.json -> CLAUDE.md -> ask user |
84
- | Directory not ignored | Add to .gitignore + commit first |
85
- | Tests fail during baseline | Report failures + ask user before proceeding |
86
- | No test command configured | Warn, proceed without baseline |
87
-
88
- ## Red Flags
89
-
90
- | Thought | Reality |
91
- |---------|---------|
92
- | "I'll add it to .gitignore later" | Fix it now. Worktree dirs must never be committed. |
93
- | "Baseline tests don't matter" | Failing baseline = you'll waste time debugging pre-existing failures. |
94
- | "Skip dependency install, it'll be fine" | Missing deps = mysterious failures during implementation. |
95
-
96
- **Never** create a worktree without verifying it's gitignored. **Never** skip baseline test verification. **Never** proceed with failing baseline tests without asking.
@@ -1,337 +0,0 @@
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. Agents communicate via SendMessage — do not spawn subagents.
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?" -> "Create team + spawn agents" [label="yes"];
24
- "Create team + spawn agents" -> "Begin Phase 1";
25
- "Human confirms mode?" -> "Recommend mode" [label="override"];
26
- "Begin Phase 1" -> "Phase 1: Design (raid-design)";
27
- "Phase 1: Design (raid-design)" -> "Phase 2: Plan (raid-implementation-plan)";
28
- "Phase 2: Plan (raid-implementation-plan)" -> "Phase 3: Implementation (raid-implementation)";
29
- "Phase 3: Implementation (raid-implementation)" -> "Phase 4: Review (raid-review)";
30
- "Phase 4: Review (raid-review)" -> "Finishing (raid-finishing)";
31
- "Finishing (raid-finishing)" -> "Clean up Dungeon files";
32
- "Clean up Dungeon files" -> "Remove .claude/raid-session";
33
- "Remove .claude/raid-session" -> "Session complete" [shape=doublecircle];
34
- }
35
- ```
36
-
37
- **On session start:** Create `.claude/raid-session` to activate workflow hooks. After mode approval, create team with `TeamCreate` and spawn agents — each gets their own tmux pane.
38
- **On session end:** Send shutdown to teammates, remove `.claude/raid-session`, remove all Dungeon files.
39
-
40
- Hooks that enforce workflow discipline (phase-gate, test-pass, verification) only fire when `.claude/raid-session` exists.
41
-
42
- ## Team
43
-
44
- | Agent | Role | Color |
45
- |-------|------|-------|
46
- | **Wizard** (Dungeon Master) | Opens phases, observes, intervenes when necessary, closes with ruling | Purple |
47
- | **Warrior** | Aggressive explorer, stress-tests to destruction, builds on team findings | Red |
48
- | **Archer** | Precise pattern-seeker, finds hidden connections and drift, traces ripple effects | Green |
49
- | **Rogue** | Adversarial assumption-destroyer, constructs attack scenarios, weaponizes findings | Orange |
50
-
51
- ## Team Spawning
52
-
53
- After mode approval, the Wizard creates the team and spawns agents:
54
-
55
- ```
56
- TeamCreate(team_name="raid-{mode}-{slug}")
57
- Agent(subagent_type="warrior", team_name="raid-...", name="warrior")
58
- Agent(subagent_type="archer", team_name="raid-...", name="archer") # Full Raid + Skirmish
59
- Agent(subagent_type="rogue", team_name="raid-...", name="rogue") # Full Raid only
60
- ```
61
-
62
- Each agent gets its own tmux pane. Agents stay alive for the entire session — they go idle between turns and wake up when they receive a message.
63
-
64
- **Communication:**
65
- - `SendMessage(to="warrior", message="...")` — direct message
66
- - Agents message each other directly: `SendMessage(to="archer", ...)`
67
- - The Dungeon is still the shared knowledge artifact for durable findings
68
- - The task list (`TaskCreate`/`TaskUpdate`) handles work coordination
69
-
70
- **User access:** The user can click into any agent's tmux pane and interact directly. User instructions override all agents.
71
-
72
- ## Team Rules
73
-
74
- Read and follow `.claude/raid-rules.md`. Non-negotiable. 17 rules including Dungeon discipline, direct engagement, wise escalation, and evidence-backed roasts.
75
-
76
- ## Configuration
77
-
78
- Read `.claude/raid.json` for project-specific settings. If absent, use sensible defaults:
79
-
80
- | Key | Default | Purpose |
81
- |-----|---------|---------|
82
- | `project.testCommand` | (none) | Command to run tests |
83
- | `project.lintCommand` | (none) | Command to run linting |
84
- | `project.buildCommand` | (none) | Command to build |
85
- | `project.packageManager` | (auto-detected) | Package manager (npm, pnpm, yarn, bun, uv, poetry) |
86
- | `project.runCommand` | (auto-detected) | Run command prefix (e.g., `pnpm`, `npm run`) |
87
- | `project.execCommand` | (auto-detected) | Exec command prefix (e.g., `pnpm dlx`, `npx`) |
88
- | `paths.specs` | `docs/raid/specs` | Where design docs go |
89
- | `paths.plans` | `docs/raid/plans` | Where plans go |
90
- | `paths.worktrees` | `.worktrees` | Where worktrees go |
91
- | `conventions.fileNaming` | `none` | Naming convention |
92
- | `conventions.commits` | `conventional` | Commit format |
93
- | `raid.defaultMode` | `full` | Default mode |
94
- | `browser.enabled` | `false` | Whether browser testing is active |
95
- | `browser.framework` | (auto-detected) | Detected framework (next, vite, angular, etc.) |
96
- | `browser.devCommand` | (auto-detected) | Dev server command |
97
- | `browser.baseUrl` | (auto-detected) | Base URL for browser tests |
98
- | `browser.portRange` | `[3001, 3005]` | Port range for isolated agent instances |
99
- | `browser.playwrightConfig` | `playwright.config.ts` | Playwright config path |
100
- | `browser.auth` | `null` | Auth config (discovered by agents) |
101
- | `browser.startup` | `null` | Startup recipe (discovered by agents) |
102
-
103
- ## Browser Testing
104
-
105
- When `browser.enabled` is `true` in `raid.json`, browser testing integrates into the existing workflow:
106
-
107
- - **Phase 3 (Implementation):** Browser-facing code uses TDD with Playwright — write `.spec.ts` files as part of RED-GREEN-REFACTOR. Use `raid-browser-playwright`. Challengers boot their own app instances to verify tests independently.
108
- - **Phase 4 (Review):** After code review, challengers do live adversarial inspection in Chrome — each on their own isolated port. Use `raid-browser-chrome`. Warrior stress-tests, Archer checks visual consistency, Rogue probes security.
109
- - **Startup discovery:** First time browser testing runs, an agent investigates how to boot the app (dev server, databases, edge workers, env vars) and writes the recipe to `raid.json`. Use `raid-browser`.
110
- - **Pre-flight:** Before every browser session, agents must state exactly what they're testing (hard gate) and check auth requirements.
111
- - **Cleanup iron law:** Every boot has a matching cleanup. Leaked processes are never acceptable.
112
-
113
- Browser testing is **not a separate workflow** — it extends existing phases. If `browser.enabled` is `false` or absent, all browser-related behavior is skipped.
114
-
115
- ## Modes
116
-
117
- Three modes that scale effort to task complexity.
118
-
119
- | Aspect | Full Raid | Skirmish | Scout |
120
- |--------|-----------|----------|-------|
121
- | Agents active | 3 | 2 | 1 |
122
- | Design phase | Full adversarial | Lightweight | Skip (inline) |
123
- | Plan phase | Full adversarial | Merged with design | Skip (inline) |
124
- | Implementation | 1 builds, 2 attack | 1 builds, 1 attacks | 1 builds, Wizard reviews |
125
- | Review phase | 3 independent reviews | 1 review + Wizard | Wizard review only |
126
- | TDD | **Enforced** | **Enforced** | **Enforced** |
127
- | Verification | Triple | Double | Single + Wizard |
128
- | Design doc | Required | Optional (brief) | Not required |
129
- | Plan doc | Required | Combined with design | Not required |
130
- | Dungeon | Full (all sections) | Lightweight | Wizard notes only |
131
-
132
- **Mode selection:** User specifies, or Wizard recommends based on task complexity.
133
- **Escalation:** Wizard may escalate (Scout->Skirmish->Full) with human approval.
134
- **De-escalation:** Only with human approval.
135
-
136
- **TDD is non-negotiable in ALL modes.** This is an Iron Law, not a preference.
137
-
138
- ## The Dungeon — Shared Knowledge Artifact
139
-
140
- 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.
141
-
142
- ### Dungeon Structure
143
-
144
- ```markdown
145
- # Dungeon — Phase N: <Phase Name>
146
- ## Quest: <task description>
147
- ## Mode: <Full Raid | Skirmish | Scout>
148
-
149
- ### Discoveries
150
- <!-- Verified findings that survived challenge, tagged with agent name -->
151
-
152
- ### Active Battles
153
- <!-- Ongoing unresolved challenges between agents -->
154
-
155
- ### Resolved
156
- <!-- Challenges that reached conclusion — conceded, proven, or Wizard-ruled -->
157
-
158
- ### Shared Knowledge
159
- <!-- Facts established as true by 2+ agents agreeing or surviving challenge -->
160
-
161
- ### Escalations
162
- <!-- Points where agents pulled the Wizard in -->
163
- ```
164
-
165
- ### Dungeon Lifecycle
166
-
167
- | Event | Action | Who |
168
- |-------|--------|-----|
169
- | Phase opens | Create `.claude/raid-dungeon.md` with header | Wizard |
170
- | During phase | Read and write via `DUNGEON:` signal | Agents |
171
- | Phase closes | Rename to `.claude/raid-dungeon-phase-N.md` | Wizard |
172
- | Next phase opens | Create fresh `.claude/raid-dungeon.md` | Wizard |
173
- | Session ends | Remove all Dungeon files | Wizard |
174
-
175
- ### Dungeon Curation Rules
176
-
177
- **What goes IN the Dungeon (via `DUNGEON:` only):**
178
- - Findings that survived a challenge (verified truths)
179
- - Active unresolved battles (prevents re-litigation)
180
- - Shared knowledge promoted by 2+ agents agreeing
181
- - Key decisions and their reasoning
182
- - Escalation points and Wizard responses
183
-
184
- **Verification requirement:** Pinned entries (`DUNGEON:`) must reference at least 2 agents who independently verified the finding. The hook enforces this as a format check — but the requirement is substantive, not cosmetic. Pinning a finding with agent names who did not actually verify it is a protocol violation. The Wizard will remove fraudulent pins and redirect the offending agent.
185
-
186
- **What stays in conversation only:**
187
- - Back-and-forth of challenges and roasts
188
- - Exploratory thinking and hypotheses
189
- - Concessions and rebuttals
190
- - Anything that didn't produce a durable insight
191
-
192
- **The conversation is the sparring ring. The Dungeon is the scoreboard.**
193
-
194
- ### Referencing Prior Phases
195
-
196
- 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.
197
-
198
- ## The Phase Pattern
199
-
200
- Every phase follows the open/close bookend model:
201
-
202
- ```dot
203
- digraph phase_pattern {
204
- "Wizard opens (quest + angles + Dungeon via SendMessage)" -> "Agents self-organize in own panes";
205
- "Agents self-organize" -> "Agents explore, challenge, roast, build";
206
- "Agents explore, challenge, roast, build" -> "Agents pin findings to Dungeon";
207
- "Agents pin findings to Dungeon" -> "Intervention needed?" [shape=diamond];
208
- "Intervention needed?" -> "Wizard intervenes (minimum force)" [label="yes"];
209
- "Wizard intervenes (minimum force)" -> "Agents resume";
210
- "Agents resume" -> "Agents explore, challenge, roast, build";
211
- "Intervention needed?" -> "Phase objective met?" [label="no"];
212
- "Phase objective met?" -> "Agents explore, challenge, roast, build" [label="no, continue"];
213
- "Phase objective met?" -> "Wizard closes (ruling + archive Dungeon)" [label="yes"];
214
- "Wizard closes (ruling + archive Dungeon)" -> "Next phase" [shape=doublecircle];
215
- }
216
- ```
217
-
218
- ### Phase Transition Gates
219
-
220
- | From | To | Gate |
221
- |------|-----|------|
222
- | Design | Plan | Design doc approved by Wizard ruling, committed |
223
- | Plan | Implementation | Plan approved by Wizard ruling, committed |
224
- | Implementation | Review | All tasks complete, all tests passing, committed |
225
- | Review | Finishing | Wizard ruling: approved for merge |
226
-
227
- **Violating the letter of these gates is violating the spirit of the process.**
228
-
229
- ## Interaction Protocols
230
-
231
- ### Communication Signals Reference
232
-
233
- | Signal | Who | Meaning | Goes to Dungeon? |
234
- |--------|-----|---------|------------------|
235
- | `DISPATCH:` | Wizard | Opening a phase via SendMessage, assigning angles | No (phase opening) |
236
- | `REDIRECT:` | Wizard | Brief course correction — one sentence, then silence | No |
237
- | `RULING:` | Wizard | Phase over, binding decision | Ruling archived with Dungeon |
238
- | `@Name, ...` | Any agent | Direct address to specific agent | No |
239
- | `FINDING:` | Any agent | Discovery with own evidence | No |
240
- | `CHALLENGE:` | Any agent | Independently verified a claim, found a problem | No |
241
- | `BUILDING:` | Any agent | Independently verified a claim, found it goes deeper | Result goes to Dungeon if verified |
242
- | `DUNGEON:` | Any agent | Pinning finding verified by 2+ agents | Yes — this is the write gate |
243
- | `WIZARD:` | Any agent | Escalation — needs Wizard input | Yes (as escalation point) |
244
- | `CONCEDE:` | Any agent | Proven wrong, moving on | No |
245
-
246
- ### Direct Interaction Rules
247
-
248
- - **Evidence required.** All challenges, roasts, and findings must carry proof — file paths, line numbers, concrete scenarios. "This is wrong" without evidence is laziness.
249
- - **Build explicitly.** `BUILDING:` forces credit and continuity. Don't restart from scratch when someone found something useful.
250
- - **Concede instantly.** When proven wrong, concede. Then find a new angle. No ego.
251
- - **Pin deliberately.** `DUNGEON:` is the quality gate. Only verified, challenged findings get pinned. Other agents can challenge whether a pin belongs.
252
- - **Escalate wisely.** `WIZARD:` when genuinely stuck, split on fundamentals, or need project-level context. Not when lazy.
253
-
254
- ### When to Escalate to Wizard
255
-
256
- **Do escalate:**
257
- - 2+ agents stuck on same disagreement for 3+ exchanges with no new evidence
258
- - Uncertain about project-level context (user requirements, constraints, priorities)
259
- - Team needs a direction-setting decision that affects the quest
260
- - Found something that may require human input
261
-
262
- **Don't escalate:**
263
- - You can resolve it by reading the code
264
- - Another agent already answered your question
265
- - It's a matter of opinion that doesn't affect the outcome
266
- - You're stuck but haven't tried talking to the other agents first
267
-
268
- ## When the Wizard Intervenes
269
-
270
- The Wizard observes 90%, acts 10%. Intervention triggers:
271
-
272
- | Signal | Action |
273
- |--------|--------|
274
- | Same arguments 3+ rounds, no new evidence | `REDIRECT:` Break the loop. Or `RULING:` if unresolvable. |
275
- | Agents drifting from objective | `REDIRECT:` One sentence back on track. |
276
- | Agents stuck, no progress (deadlock) | `RULING:` Decide with rationale. Binding. |
277
- | Shallow work, rubber-stamping (laziness) | `REDIRECT:` Demand genuine independent verification. |
278
- | Skipped verification (responded without own evidence) | `REDIRECT:` "Verify first, then respond." |
279
- | Premature convergence (agreed without challenging) | `REDIRECT:` "Challenge before agreeing." |
280
- | Defending past evidence (ego) | `REDIRECT:` Evidence or concede. |
281
- | Wrong finding in Dungeon (misinformation) | `REDIRECT:` Remove and correct. |
282
- | Agent escalation (`WIZARD:`) | Answer or redirect as appropriate. |
283
- | All agents converged with genuine verification | `RULING:` Synthesize and close. |
284
-
285
- ## Red Flags — Thoughts That Signal Violations
286
-
287
- | Thought | Reality |
288
- |---------|---------|
289
- | "This phase is obvious, let's skip it" | Obvious phases are where assumptions hide. |
290
- | "The agents agree, no need for cross-testing" | Agreement without challenge is groupthink. |
291
- | "Let's just fix this quickly, no need for design" | Quick fixes without design become tech debt. |
292
- | "TDD would slow us down on this one" | TDD is an Iron Law. No exceptions. |
293
- | "One agent can handle this alone" | Scout mode exists. Use it. Don't bypass modes. |
294
- | "We already know what to build" | Knowing and verifying are different things. |
295
- | "The Wizard should mediate this" | Agents resolve directly. Wizard observes. |
296
- | "Let me just post everything to the Dungeon" | Dungeon is a scoreboard, not a log. Pin only verified findings. |
297
- | "I'll wait for the Wizard to tell me what to do next" | You own the phase. Self-organize. |
298
-
299
- ## Skills Reference
300
-
301
- | Skill | Phase | Purpose |
302
- |-------|-------|---------|
303
- | `raid-protocol` | Start | Session lifecycle, Dungeon lifecycle, modes, rules, reference |
304
- | `raid-design` | 1 | Adversarial design with agent-driven exploration |
305
- | `raid-implementation-plan` | 2 | Collaborative plan with direct cross-testing |
306
- | `raid-implementation` | 3 | Agent-driven implementation with rotation |
307
- | `raid-review` | 4 | Adversarial full review with Dungeon-tracked issues |
308
- | `raid-finishing` | End | Completeness debate + merge options |
309
- | `raid-tdd` | 3 | TDD with collaborative test quality review |
310
- | `raid-debugging` | Any | Competing hypothesis with direct debate |
311
- | `raid-verification` | Any | Evidence before completion claims |
312
- | `raid-git-worktrees` | 3 | Isolated workspace setup |
313
- | `raid-browser` | 3, 4 | Browser orchestration: startup discovery, boot/cleanup, pre-flight |
314
- | `raid-browser-playwright` | 3 | Automated browser TDD with Playwright MCP |
315
- | `raid-browser-chrome` | 4 | Live adversarial Chrome inspection |
316
-
317
- ## Hooks Reference
318
-
319
- All hooks source `raid-lib.sh` for shared session/config parsing.
320
-
321
- | Hook | Event | Active | Purpose |
322
- |------|-------|--------|---------|
323
- | `validate-commit.sh` | PreToolUse (Bash) | Always (format), Raid session (tests/verification) | Conventional commits + tests pass + verification evidence |
324
- | `validate-write-gate.sh` | PreToolUse (Write/Edit) | Raid session only | Phase-aware write gate (design doc before code) |
325
- | `validate-file-naming.sh` | PostToolUse (Write/Edit) | Always | Enforce naming conventions |
326
- | `validate-no-placeholders.sh` | PostToolUse (Write/Edit) | Always | No TBD/TODO in specs/plans |
327
- | `validate-dungeon.sh` | PostToolUse (Write/Edit) | Raid session only | Dungeon discipline enforcement |
328
- | `validate-browser-cleanup.sh` | PostToolUse (Bash) | Raid session + browser enabled | Warn if browser ports still occupied |
329
- | `validate-browser-tests-exist.sh` | PreToolUse (Bash) | Raid session + browser enabled | Warn if browser-facing code has no Playwright tests |
330
-
331
- ## Commit Convention
332
-
333
- All commits follow: `type(scope): description`
334
-
335
- Types: `feat`, `fix`, `docs`, `style`, `refactor`, `perf`, `test`, `build`, `ci`, `chore`, `revert`
336
-
337
- Phase transitions: `docs(design): <topic>`, `docs(plan): <topic>`, `feat(scope): <what>`, `fix(scope): <what>`