claude-raid 0.1.6 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/bin/cli.js +13 -1
  2. package/package.json +1 -1
  3. package/src/descriptions.js +26 -25
  4. package/src/init.js +6 -10
  5. package/src/merge-settings.js +1 -22
  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 +14 -109
  10. package/template/.claude/agents/rogue.md +15 -110
  11. package/template/.claude/agents/warrior.md +12 -108
  12. package/template/.claude/agents/wizard.md +15 -235
  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 +28 -16
  18. package/template/.claude/hooks/validate-commit.sh +15 -74
  19. package/template/.claude/hooks/validate-dungeon.sh +47 -13
  20. package/template/.claude/hooks/validate-file-naming.sh +6 -2
  21. package/template/.claude/hooks/validate-no-placeholders.sh +3 -3
  22. package/template/.claude/hooks/validate-write-gate.sh +47 -36
  23. package/template/.claude/party-rules.md +202 -0
  24. package/template/.claude/skills/raid-browser-chrome/SKILL.md +1 -1
  25. package/template/.claude/skills/{raid-design → raid-canonical-design}/SKILL.md +60 -14
  26. package/template/.claude/skills/{raid-implementation → raid-canonical-implementation}/SKILL.md +48 -11
  27. package/template/.claude/skills/{raid-implementation-plan → raid-canonical-implementation-plan}/SKILL.md +57 -15
  28. package/template/.claude/skills/raid-canonical-prd/SKILL.md +133 -0
  29. package/template/.claude/skills/raid-canonical-protocol/SKILL.md +211 -0
  30. package/template/.claude/skills/{raid-review → raid-canonical-review}/SKILL.md +86 -15
  31. package/template/.claude/skills/raid-debugging/SKILL.md +30 -5
  32. package/template/.claude/skills/raid-init/SKILL.md +130 -0
  33. package/template/.claude/skills/raid-tdd/SKILL.md +1 -1
  34. package/template/.claude/skills/raid-wrap-up/SKILL.md +184 -0
  35. package/template/.claude/hooks/raid-stop.sh +0 -68
  36. package/template/.claude/hooks/raid-task-completed.sh +0 -37
  37. package/template/.claude/hooks/raid-teammate-idle.sh +0 -28
  38. package/template/.claude/raid-rules.md +0 -30
  39. package/template/.claude/skills/raid-browser-playwright/SKILL.md +0 -163
  40. package/template/.claude/skills/raid-finishing/SKILL.md +0 -131
  41. package/template/.claude/skills/raid-git-worktrees/SKILL.md +0 -96
  42. package/template/.claude/skills/raid-protocol/SKILL.md +0 -335
@@ -1,335 +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
- **What stays in conversation only:**
185
- - Back-and-forth of challenges and roasts
186
- - Exploratory thinking and hypotheses
187
- - Concessions and rebuttals
188
- - Anything that didn't produce a durable insight
189
-
190
- **The conversation is the sparring ring. The Dungeon is the scoreboard.**
191
-
192
- ### Referencing Prior Phases
193
-
194
- 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.
195
-
196
- ## The Phase Pattern
197
-
198
- Every phase follows the open/close bookend model:
199
-
200
- ```dot
201
- digraph phase_pattern {
202
- "Wizard opens (quest + angles + Dungeon via SendMessage)" -> "Agents self-organize in own panes";
203
- "Agents self-organize" -> "Agents explore, challenge, roast, build";
204
- "Agents explore, challenge, roast, build" -> "Agents pin findings to Dungeon";
205
- "Agents pin findings to Dungeon" -> "Intervention needed?" [shape=diamond];
206
- "Intervention needed?" -> "Wizard intervenes (minimum force)" [label="yes"];
207
- "Wizard intervenes (minimum force)" -> "Agents resume";
208
- "Agents resume" -> "Agents explore, challenge, roast, build";
209
- "Intervention needed?" -> "Phase objective met?" [label="no"];
210
- "Phase objective met?" -> "Agents explore, challenge, roast, build" [label="no, continue"];
211
- "Phase objective met?" -> "Wizard closes (ruling + archive Dungeon)" [label="yes"];
212
- "Wizard closes (ruling + archive Dungeon)" -> "Next phase" [shape=doublecircle];
213
- }
214
- ```
215
-
216
- ### Phase Transition Gates
217
-
218
- | From | To | Gate |
219
- |------|-----|------|
220
- | Design | Plan | Design doc approved by Wizard ruling, committed |
221
- | Plan | Implementation | Plan approved by Wizard ruling, committed |
222
- | Implementation | Review | All tasks complete, all tests passing, committed |
223
- | Review | Finishing | Wizard ruling: approved for merge |
224
-
225
- **Violating the letter of these gates is violating the spirit of the process.**
226
-
227
- ## Interaction Protocols
228
-
229
- ### Communication Signals Reference
230
-
231
- | Signal | Who | Meaning | Goes to Dungeon? |
232
- |--------|-----|---------|------------------|
233
- | `DISPATCH:` | Wizard | Opening a phase via SendMessage, assigning angles | No (phase opening) |
234
- | `REDIRECT:` | Wizard | Brief course correction — one sentence, then silence | No |
235
- | `RULING:` | Wizard | Phase over, binding decision | Ruling archived with Dungeon |
236
- | `@Name, ...` | Any agent | Direct address to specific agent | No |
237
- | `FINDING:` | Any agent | Discovery with own evidence | No |
238
- | `CHALLENGE:` | Any agent | Independently verified a claim, found a problem | No |
239
- | `BUILDING:` | Any agent | Independently verified a claim, found it goes deeper | Result goes to Dungeon if verified |
240
- | `DUNGEON:` | Any agent | Pinning finding verified by 2+ agents | Yes — this is the write gate |
241
- | `WIZARD:` | Any agent | Escalation — needs Wizard input | Yes (as escalation point) |
242
- | `CONCEDE:` | Any agent | Proven wrong, moving on | No |
243
-
244
- ### Direct Interaction Rules
245
-
246
- - **Evidence required.** All challenges, roasts, and findings must carry proof — file paths, line numbers, concrete scenarios. "This is wrong" without evidence is laziness.
247
- - **Build explicitly.** `BUILDING:` forces credit and continuity. Don't restart from scratch when someone found something useful.
248
- - **Concede instantly.** When proven wrong, concede. Then find a new angle. No ego.
249
- - **Pin deliberately.** `DUNGEON:` is the quality gate. Only verified, challenged findings get pinned. Other agents can challenge whether a pin belongs.
250
- - **Escalate wisely.** `WIZARD:` when genuinely stuck, split on fundamentals, or need project-level context. Not when lazy.
251
-
252
- ### When to Escalate to Wizard
253
-
254
- **Do escalate:**
255
- - 2+ agents stuck on same disagreement for 3+ exchanges with no new evidence
256
- - Uncertain about project-level context (user requirements, constraints, priorities)
257
- - Team needs a direction-setting decision that affects the quest
258
- - Found something that may require human input
259
-
260
- **Don't escalate:**
261
- - You can resolve it by reading the code
262
- - Another agent already answered your question
263
- - It's a matter of opinion that doesn't affect the outcome
264
- - You're stuck but haven't tried talking to the other agents first
265
-
266
- ## When the Wizard Intervenes
267
-
268
- The Wizard observes 90%, acts 10%. Intervention triggers:
269
-
270
- | Signal | Action |
271
- |--------|--------|
272
- | Same arguments 3+ rounds, no new evidence | `REDIRECT:` Break the loop. Or `RULING:` if unresolvable. |
273
- | Agents drifting from objective | `REDIRECT:` One sentence back on track. |
274
- | Agents stuck, no progress (deadlock) | `RULING:` Decide with rationale. Binding. |
275
- | Shallow work, rubber-stamping (laziness) | `REDIRECT:` Demand genuine independent verification. |
276
- | Skipped verification (responded without own evidence) | `REDIRECT:` "Verify first, then respond." |
277
- | Premature convergence (agreed without challenging) | `REDIRECT:` "Challenge before agreeing." |
278
- | Defending past evidence (ego) | `REDIRECT:` Evidence or concede. |
279
- | Wrong finding in Dungeon (misinformation) | `REDIRECT:` Remove and correct. |
280
- | Agent escalation (`WIZARD:`) | Answer or redirect as appropriate. |
281
- | All agents converged with genuine verification | `RULING:` Synthesize and close. |
282
-
283
- ## Red Flags — Thoughts That Signal Violations
284
-
285
- | Thought | Reality |
286
- |---------|---------|
287
- | "This phase is obvious, let's skip it" | Obvious phases are where assumptions hide. |
288
- | "The agents agree, no need for cross-testing" | Agreement without challenge is groupthink. |
289
- | "Let's just fix this quickly, no need for design" | Quick fixes without design become tech debt. |
290
- | "TDD would slow us down on this one" | TDD is an Iron Law. No exceptions. |
291
- | "One agent can handle this alone" | Scout mode exists. Use it. Don't bypass modes. |
292
- | "We already know what to build" | Knowing and verifying are different things. |
293
- | "The Wizard should mediate this" | Agents resolve directly. Wizard observes. |
294
- | "Let me just post everything to the Dungeon" | Dungeon is a scoreboard, not a log. Pin only verified findings. |
295
- | "I'll wait for the Wizard to tell me what to do next" | You own the phase. Self-organize. |
296
-
297
- ## Skills Reference
298
-
299
- | Skill | Phase | Purpose |
300
- |-------|-------|---------|
301
- | `raid-protocol` | Start | Session lifecycle, Dungeon lifecycle, modes, rules, reference |
302
- | `raid-design` | 1 | Adversarial design with agent-driven exploration |
303
- | `raid-implementation-plan` | 2 | Collaborative plan with direct cross-testing |
304
- | `raid-implementation` | 3 | Agent-driven implementation with rotation |
305
- | `raid-review` | 4 | Adversarial full review with Dungeon-tracked issues |
306
- | `raid-finishing` | End | Completeness debate + merge options |
307
- | `raid-tdd` | 3 | TDD with collaborative test quality review |
308
- | `raid-debugging` | Any | Competing hypothesis with direct debate |
309
- | `raid-verification` | Any | Evidence before completion claims |
310
- | `raid-git-worktrees` | 3 | Isolated workspace setup |
311
- | `raid-browser` | 3, 4 | Browser orchestration: startup discovery, boot/cleanup, pre-flight |
312
- | `raid-browser-playwright` | 3 | Automated browser TDD with Playwright MCP |
313
- | `raid-browser-chrome` | 4 | Live adversarial Chrome inspection |
314
-
315
- ## Hooks Reference
316
-
317
- All hooks source `raid-lib.sh` for shared session/config parsing.
318
-
319
- | Hook | Event | Active | Purpose |
320
- |------|-------|--------|---------|
321
- | `validate-commit.sh` | PreToolUse (Bash) | Always (format), Raid session (tests/verification) | Conventional commits + tests pass + verification evidence |
322
- | `validate-write-gate.sh` | PreToolUse (Write/Edit) | Raid session only | Phase-aware write gate (design doc before code) |
323
- | `validate-file-naming.sh` | PostToolUse (Write/Edit) | Always | Enforce naming conventions |
324
- | `validate-no-placeholders.sh` | PostToolUse (Write/Edit) | Always | No TBD/TODO in specs/plans |
325
- | `validate-dungeon.sh` | PostToolUse (Write/Edit) | Raid session only | Dungeon discipline enforcement |
326
- | `validate-browser-cleanup.sh` | PostToolUse (Bash) | Raid session + browser enabled | Warn if browser ports still occupied |
327
- | `validate-browser-tests-exist.sh` | PreToolUse (Bash) | Raid session + browser enabled | Warn if browser-facing code has no Playwright tests |
328
-
329
- ## Commit Convention
330
-
331
- All commits follow: `type(scope): description`
332
-
333
- Types: `feat`, `fix`, `docs`, `style`, `refactor`, `perf`, `test`, `build`, `ci`, `chore`, `revert`
334
-
335
- Phase transitions: `docs(design): <topic>`, `docs(plan): <topic>`, `feat(scope): <what>`, `fix(scope): <what>`