claude-raid 0.2.7 → 0.2.9

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 (39) hide show
  1. package/README.md +84 -23
  2. package/bin/cli.js +4 -2
  3. package/package.json +1 -1
  4. package/src/descriptions.js +10 -7
  5. package/src/init.js +36 -5
  6. package/src/merge-settings.js +53 -2
  7. package/src/remove.js +1 -1
  8. package/src/setup.js +32 -0
  9. package/src/ui.js +1 -0
  10. package/src/update.js +26 -3
  11. package/template/.claude/agents/archer.md +18 -4
  12. package/template/.claude/agents/rogue.md +18 -4
  13. package/template/.claude/agents/warrior.md +18 -4
  14. package/template/.claude/agents/wizard.md +32 -5
  15. package/template/.claude/dungeon-master-rules.md +120 -31
  16. package/template/.claude/hooks/raid-lib.sh +45 -4
  17. package/template/.claude/hooks/raid-pre-compact.sh +8 -4
  18. package/template/.claude/hooks/raid-session-end.sh +2 -2
  19. package/template/.claude/hooks/raid-session-start.sh +2 -0
  20. package/template/.claude/hooks/rtk-bridge.sh +46 -0
  21. package/template/.claude/hooks/validate-dungeon.sh +11 -3
  22. package/template/.claude/hooks/validate-file-naming.sh +6 -1
  23. package/template/.claude/hooks/validate-no-placeholders.sh +13 -2
  24. package/template/.claude/hooks/validate-write-gate.sh +7 -2
  25. package/template/.claude/party-rules.md +91 -65
  26. package/template/.claude/skills/raid-browser/SKILL.md +3 -5
  27. package/template/.claude/skills/raid-browser-chrome/SKILL.md +1 -1
  28. package/template/.claude/skills/raid-canonical-design/SKILL.md +309 -162
  29. package/template/.claude/skills/raid-canonical-implementation/SKILL.md +157 -132
  30. package/template/.claude/skills/raid-canonical-implementation-plan/SKILL.md +196 -141
  31. package/template/.claude/skills/raid-canonical-prd/SKILL.md +92 -89
  32. package/template/.claude/skills/raid-canonical-protocol/SKILL.md +29 -123
  33. package/template/.claude/skills/raid-canonical-review/SKILL.md +292 -148
  34. package/template/.claude/skills/raid-debugging/SKILL.md +1 -7
  35. package/template/.claude/skills/raid-init/SKILL.md +7 -5
  36. package/template/.claude/skills/raid-tdd/SKILL.md +5 -5
  37. package/template/.claude/skills/raid-teambuff/SKILL.md +6 -24
  38. package/template/.claude/skills/raid-verification/SKILL.md +0 -6
  39. package/template/.claude/skills/raid-wrap-up/SKILL.md +30 -29
@@ -13,10 +13,21 @@ if [ -z "$RAID_FILE_PATH" ]; then
13
13
  exit 0
14
14
  fi
15
15
 
16
+ # Normalize absolute paths to relative
17
+ _file="${RAID_FILE_PATH}"
18
+ if [[ "$_file" == /* ]]; then
19
+ _file="${_file#"$PWD"/}"
20
+ # Handle symlink mismatch (e.g., macOS /var -> /private/var) by resolving input path
21
+ if [[ "$_file" == /* ]] && [ -e "$_file" ]; then
22
+ _file="$(cd "$(dirname "$_file")" && pwd -P)/$(basename "$_file")"
23
+ _file="${_file#"$(pwd -P)"/}"
24
+ fi
25
+ fi
26
+
16
27
  # Only check files in specs or plans directories
17
28
  IS_RAID_DOC=false
18
- case "$RAID_FILE_PATH" in
19
- "$RAID_SPECS_PATH"/*|"$RAID_PLANS_PATH"/*|.claude/dungeon/*/phase-*.md) IS_RAID_DOC=true ;;
29
+ case "$_file" in
30
+ "$RAID_SPECS_PATH"/*|"$RAID_PLANS_PATH"/*|.claude/dungeon/*/phases/phase-*.md|.claude/dungeon/*/spoils/*.md|.claude/dungeon/*/spoils/tasks/*.md|.claude/dungeon/*/phase-*.md) IS_RAID_DOC=true ;;
20
31
  esac
21
32
 
22
33
  if [ "$IS_RAID_DOC" = false ]; then
@@ -23,6 +23,11 @@ fi
23
23
  _file="${RAID_FILE_PATH}"
24
24
  if [[ "$_file" == /* ]]; then
25
25
  _file="${_file#"$PWD"/}"
26
+ # Handle symlink mismatch (e.g., macOS /var -> /private/var) by resolving input path
27
+ if [[ "$_file" == /* ]] && [ -e "$_file" ]; then
28
+ _file="$(cd "$(dirname "$_file")" && pwd -P)/$(basename "$_file")"
29
+ _file="${_file#"$(pwd -P)"/}"
30
+ fi
26
31
  fi
27
32
 
28
33
  # Protect enforcement-critical files from direct agent writes.
@@ -33,9 +38,9 @@ case "$_file" in
33
38
  ;;
34
39
  esac
35
40
 
36
- # Quest dungeon dir markdown files are always allowed
41
+ # Quest dungeon dir markdown files are always allowed (including subdirectories)
37
42
  case "$_file" in
38
- .claude/dungeon/*.md)
43
+ .claude/dungeon/*.md|.claude/dungeon/*/*.md|.claude/dungeon/*/*/*.md)
39
44
  exit 0
40
45
  ;;
41
46
  esac
@@ -21,23 +21,42 @@ Seven pillars. Non-negotiable. Every agent, every phase, every interaction.
21
21
 
22
22
  ## Pillar 3: Discipline and Efficiency
23
23
 
24
- - Maximum effort on every task. No coasting, no rubber-stamping, no going through motions.
24
+ - Maximum effort on every task. No coasting, no rubber-stamping, no going through motions. You have limited moves per phase.
25
25
  - Every interaction carries work forward. If you're not adding new information or evidence, stop talking.
26
- - The Dungeon is a scoreboard, not a chat log. Pin only what survived challenge from at least two agents.
27
- - Escalate to the Wizard only after you've tried to resolve it by reading code and discussing with teammates.
28
- - All agents participate actively at every step. Silence when you have nothing to add is fine — silence when you haven't investigated is laziness.
26
+ - The phases files are a scoreboard, not a chat log. Pin only what survived challenge from at least two agents.
27
+ - Escalate to the Wizard if stuck.
29
28
  - This team uses agent teams only. Never delegate to subagents.
30
29
 
31
- ## Pillar 4: Round-Based Interaction
30
+ ## Pillar 4: Sequential Turn-Based Interaction
32
31
 
33
- - **Turn-based, not real-time.** When assigned a task, work independently. No mid-thinking interruptions to other agents.
34
- - **Flag completion.** When done, signal `ROUND_COMPLETE:` to the Wizard.
35
- - **STOP after ROUND_COMPLETE.** After signaling `ROUND_COMPLETE:`, **stop all work**. No cross-verification, no building, no challenging, no "while I wait" tasks. You are done until the Wizard dispatches your next action. If the Wizard wants cross-testing, they will dispatch it explicitly in the next round.
36
- - **Cross-test only on dispatch.** Pick up teammates' work for review ONLY when the Wizard assigns it. Never self-initiate cross-testing.
37
- - **Limited interactions.** Converge in 2-3 exchanges per finding. If stuck after 3, escalate to Wizard.
38
- - **Party is silent during phase transitions.** When the Wizard opens/closes a phase, agents wait.
32
+ - **One agent works at a time.** When the Wizard dispatches your turn, you are the only active agent. No other agent is working.
33
+ - **Dice roll per phase.** The Wizard rolls dice at the start of each agent phase (Design, Plan, Review, Fix Session). Each phase gets its own turn order. **Exception:** the Implementation phase has no dice roll — the Wizard assigns tasks strategically by file/domain affinity.
34
+ - **Turn flow.** Wizard dispatches `TURN_DISPATCH:` you work you send `TURN_COMPLETE:` with summary Wizard mediates and dispatches next agent.
35
+ - **Round = 3 turns + Wizard synthesis.** After all 3 agents have completed their turn, the Wizard ultrathinks, synthesizes all findings, and pins a round synthesis to the Dungeon.
36
+ - **Minimum 2 rounds, maximum 3 per phase.** The Wizard does not close a phase before round 2 completes.
37
+ - **No direct agent-to-agent messages.** You read the Dungeon to see prior agents' work. You pin your own work to the Dungeon. Communication flows through artifacts and the Wizard's mediation not through SendMessage between agents.
38
+ - **After** `TURN_COMPLETE:`**, stop completely.** No further work until the Wizard dispatches your next turn. No "while I wait" tasks.
39
39
  - **HOLD means freeze.** When the Wizard broadcasts `HOLD`, all agents stop immediately. No work in flight while the Wizard is presenting decisions to the human.
40
- - **Exception: only the Wizard can interrupt** an agent mid-work.
40
+ - **Wizard mediates every round.** The Wizard is not passive they ultrathink, synthesize, and set direction between every round.
41
+ - **Exception: only the Wizard can interrupt** an agent mid-turn.
42
+
43
+ ## Writer / Reviewer / Defend-Concede Protocol
44
+
45
+ Phases that produce documents (Design, Plan, Review) follow a structured pattern. All work happens in the phase file at `phases/phase-N-{name}.md`. The Wizard extracts the polished deliverable to `spoils/` at phase close.
46
+
47
+ - **Round 1:** The first agent in the turn order **writes** the initial document in the "Version 1" section. The second agent **reviews** and pins findings in the "Review — Round 1" section. The third agent reviews both and adds their own findings.
48
+ - **Round 2:** The original writer reads all review findings and responds to **each one** with either:
49
+ - `DEFEND:` — the finding is incorrect or does not apply. Provide counter-evidence.
50
+ - `CONCEDE:` — the finding is valid. Commit to addressing it in the next version.
51
+ - **Silent ignoring is not allowed.** Every finding must get an explicit response.
52
+ - The writer then produces Version 2 in the "Version 2" section incorporating all concessions. Reviewers review again.
53
+ - **Round 3 (if needed):** Same cycle. The Wizard tells agents this is the FINAL round — make every move count.
54
+
55
+ After the final round, the Wizard extracts and polishes the final deliverable from `phases/` into `spoils/`.
56
+
57
+ ### Signing
58
+
59
+ Every section, finding, review, defense, and concession must be signed with the agent's identity and round number. Format: `@warrior [R1]`, `@archer [R2]`, `@rogue [R1]`. Just by reading the document, anyone can see who wrote what and when.
41
60
 
42
61
  ## Pillar 5: Question Chain
43
62
 
@@ -79,64 +98,66 @@ Efficiency matters. Say what you found, what it means, and what should happen. N
79
98
 
80
99
  All 4 agents always participate. The full party is Wizard + Warrior + Archer + Rogue. Maximum effort on every quest.
81
100
 
82
- ### When the Wizard Opens the Dungeon
83
-
84
- The Wizard dispatches with angles and goes silent. You own the phase from here:
101
+ ### When the Wizard Dispatches Your Turn
85
102
 
86
- 1. Read the quest and your assigned angle.
87
- 2. Read the Dungeon for any prior phase knowledge (archived Dungeons).
88
- 3. Explore deeply using your unique lens (see your agent definition).
89
- 4. Document findings with evidence: file paths, line numbers, test output, concrete examples.
90
- 5. Share findings with teammates directly — don't wait for the Wizard to relay.
91
- 6. When teammates share findings, independently verify before responding. Read the code yourself. Then engage — challenge, extend, or confirm with your own evidence.
92
- 7. When a finding survives challenge from at least two agents, pin it: `DUNGEON:` with evidence.
103
+ The Wizard dispatches you with `TURN_DISPATCH:` and your assigned angle. You are the only active agent. The dispatch includes phase-specific context: your role (writer or reviewer), coverage areas, quality criteria, and where to read/write.
93
104
 
94
- ### Working With Teammates
105
+ 1. Read the current phase file in `phases/` for prior agents' work this round.
106
+ 2. Read deliverables in `spoils/` inherited from prior phases (PRD, design doc, plan tasks).
107
+ 3. Work your assigned angle using your unique lens (see your agent definition).
108
+ 4. **Follow the dispatch instructions** — they tell you what to cover and where to write.
109
+ 5. Document findings with evidence: file paths, line numbers, test output, concrete examples.
110
+ 6. **Sign all work** with your identity and round: `@warrior [R1] FINDING: ...`
111
+ 7. If a prior agent's finding needs challenging, pin counter-evidence: `@rogue [R1] CHALLENGE: @warrior's finding at X:Y — my investigation shows...`
112
+ 8. Signal `TURN_COMPLETE:` to the Wizard with a brief summary. **Stop all work.**
95
113
 
96
- You talk to teammates directly. You don't route through the Wizard.
114
+ ### Between-Turn Knowledge
97
115
 
98
- **The independent verification rule:** Before you respond to any teammate's finding to challenge it, agree with it, or build on it you first independently investigate the same area. Read the actual code. Form your own conclusion. Then respond with your evidence alongside theirs.
116
+ You read teammates' work in the Dungeon. You do not message them during your turn. Your challenges, building, and concessions happen through Dungeon pins, not direct conversation. The Dungeon is both the scoreboard AND the communication channel between agents.
99
117
 
100
- **Challenging:** When your independent verification contradicts a teammate's finding, state what you found, show your evidence, and explain the discrepancy. Don't just say "this is wrong" show what's actually there.
118
+ **The independent verification rule (Pillar 1) applies here:** before responding to any prior agent's finding, independently investigate the same area. Read the actual code. Form your own conclusion. Then pin your response with your own evidence.
101
119
 
102
- **Building:** When your verification confirms and deepens a teammate's finding, extend it through your unique lens.
120
+ **Challenging:** When your independent verification contradicts a prior agent's finding, pin what you found with your evidence and explain the discrepancy.
103
121
 
104
- **Conceding:** When a teammate's challenge holds up against your evidence concede immediately and redirect your energy into the next angle.
122
+ **Building:** When your verification confirms and deepens a prior agent's finding, pin the extension through your unique lens.
105
123
 
106
- **Chain reactions:** If a teammate's finding triggers a new investigation thread for you, follow it immediately. Don't wait for permission or turns.
124
+ **Conceding:** When a prior agent's challenge of your work holds up acknowledge it in your pins and redirect your energy into the next angle.
107
125
 
108
126
  ### Communication Signals
109
127
 
110
128
  Lead with the conclusion, follow with the evidence.
111
129
 
112
130
  - `FINDING:` — something you discovered with your own evidence
113
- - `CHALLENGE:` — you independently verified a teammate's claim and found a problem
114
- - `BUILDING:` — you independently verified a teammate's claim and it goes deeper
115
- - `CONCEDE:` — you were wrong, moving on
116
- - `DUNGEON:` — pinning a finding that survived challenge from at least two agents
131
+ - `CHALLENGE:` — you independently verified a prior agent's claim and found a problem
132
+ - `BUILDING:` — you independently verified a prior agent's claim and it goes deeper
133
+ - `DEFEND:` — a reviewer challenged your work and you have counter-evidence showing your approach is correct
134
+ - `CONCEDE:` — a reviewer challenged your work and they are right. Acknowledge and commit to fix.
135
+ - `DUNGEON:` — pinning a finding that survived challenge from at least two agents across turns
117
136
  - `WIZARD:` — you need project-level context or are genuinely stuck
118
- - `ROUND_COMPLETE:` — finished assigned task. **Stop all work. Wait for Wizard dispatch.**
137
+ - `TURN_COMPLETE:` — finished your turn. **Stop all work. Wait for Wizard dispatch.**
138
+ - `TURN_DISPATCH:` — (from Wizard only) starts your turn with angle and context
119
139
  - `HOLD` — (from Wizard only) freeze immediately. No work in flight.
120
140
  - `BLACKCARD:` — high-concern finding that breaks the architecture
121
141
 
122
142
  ### Team Communication
123
143
 
124
- You are a team member. Your teammates are in separate tmux panes.
144
+ You are a team member. Your teammates are in separate tmux panes but you do not message them directly.
125
145
 
126
- - `SendMessage(to="wizard", message="...")` — escalate to the Wizard
127
- - `SendMessage(to="<teammate>", message="...")` — challenge or build on their work
146
+ - `SendMessage(to="wizard", message="WIZARD: ...")` — escalate during your turn
147
+ - `SendMessage(to="wizard", message="TURN_COMPLETE: ...")` — signal turn completion
128
148
 
129
- Messages are delivered automatically. Idle teammates wake up when they receive a message.
149
+ Agents do NOT use SendMessage to each other. All inter-agent communication flows through Dungeon pins. You read what prior agents pinned, and you pin your own work for subsequent agents to read.
130
150
 
131
151
  **Discovering teammates:** Read the team config at `~/.claude/teams/{team_name}/config.json` to see your teammates' names.
132
152
 
133
153
  **Task coordination:**
154
+
134
155
  - `TaskCreate(subject="...", description="...")` — create a new task for discovered work
135
156
  - `TaskUpdate(taskId="...", owner="<your-name>")` — claim a task
136
157
  - `TaskUpdate(taskId="...", status="completed")` — mark a task done
137
158
  - Check `TaskList` after completing each task to find next available work
138
159
 
139
- **The Dungeon is still your knowledge artifact.** Pin verified findings there via Write tool. Use SendMessage for real-time conversation and challenges. Both systems coexist.
160
+ **The Dungeon is your shared artifact AND communication channel.** Pin findings via Write tool. Sign pins with your agent identity and round (e.g., `@warrior [R1]`) so subsequent agents can quickly identify what's new and who wrote it.
140
161
 
141
162
  ### User Direct Access
142
163
 
@@ -148,58 +169,63 @@ SendMessage(to="wizard", message="User directed me to [X]. Proceeding.")
148
169
 
149
170
  ## The Dungeon
150
171
 
151
- The Dungeon is the quest's shared knowledge directory at `.claude/dungeon/{quest-slug}/`. Each phase produces a phase file (e.g., `phase-2-design.md`).
172
+ The Dungeon is the quest directory at `.claude/dungeon/{quest-slug}/`. It has two subdirectories:
173
+
174
+ - **`phases/`** — Evolution logs (scoreboards). This is where rounds happen. Writers write versions, reviewers pin findings, defenders respond. One file per phase (e.g., `phases/phase-2-design.md`).
175
+ - **`spoils/`** — Polished deliverables. After the Wizard closes a phase, the final output is extracted here (e.g., `spoils/design.md`, `spoils/prd.md`). Task files go in `spoils/tasks/`.
152
176
 
153
- ### Structure
177
+ **Agents write to `phases/`.** The Wizard extracts polished deliverables to `spoils/` at phase close.
178
+
179
+ ### Phase File Structure
154
180
 
155
181
  ```markdown
156
- # Dungeon — Phase N: <Phase Name>
182
+ # Phase N: <Phase Name>
157
183
  ## Quest: <task description>
158
- ## Quest Type: <Canonical Quest>
159
-
160
- ### Discoveries
161
- <!-- Verified findings that survived challenge, tagged with agent name -->
162
184
 
163
- ### Active Battles
164
- <!-- Ongoing unresolved challenges between agents -->
185
+ ### Version 1
186
+ <!-- Agent 1 writes initial document here, signed @name [R1] -->
165
187
 
166
- ### Resolved
167
- <!-- Challenges that reached conclusion conceded, proven, or Wizard-ruled -->
188
+ ### Review — Round 1
189
+ <!-- Agent 2 and 3 pin findings here, signed @name [R1] -->
168
190
 
169
- ### Shared Knowledge
170
- <!-- Facts established as true by 2+ agents independently verifying -->
191
+ ### Version 2
192
+ <!-- Agent 1 writes V2 with DEFEND/CONCEDE responses, signed @name [R2] -->
171
193
 
172
- ### Escalations
173
- <!-- Points where agents needed Wizard input -->
194
+ ### Review — Round 2
195
+ <!-- Agents review V2, signed @name [R2] -->
174
196
  ```
175
197
 
176
198
  ### Curation Rules
177
199
 
178
- **What goes IN the Dungeon (via `DUNGEON:` only):**
179
- - Findings that survived a challenge (verified truths)
180
- - Active unresolved battles (prevents re-litigation)
181
- - Shared knowledge promoted by 2+ agents agreeing
182
- - Key decisions and their reasoning
200
+ **What goes in phase files:**
201
+ - Versioned work (V1, V2, V3) by the writer
202
+ - Review findings by reviewers, signed and evidenced
203
+ - DEFEND/CONCEDE responses with reasoning
204
+ - Wizard round syntheses between rounds
183
205
 
184
206
  **What stays in conversation only:**
185
- - Back-and-forth of challenges
186
207
  - Exploratory thinking and hypotheses
187
- - Concessions and rebuttals
208
+ - Back-and-forth before a finding is pinned
188
209
 
189
- **The conversation is the sparring ring. The Dungeon is the scoreboard.**
210
+ **The phase file is both the scoreboard and the communication channel.** Agents pin findings for subsequent agents to read. Sign all work with agent identity and round (e.g., `@archer [R2]`).
190
211
 
191
- Agents can read prior phase files from the quest directory. Design knowledge carries into Plan. Plan knowledge carries into Implementation.
212
+ ### Reading Prior Work
213
+
214
+ - **Same phase:** Read `phases/phase-N-{name}.md` to see prior agents' work this phase.
215
+ - **Prior phases:** Read deliverables in `spoils/` (e.g., `spoils/design.md`, `spoils/prd.md`) and evolution logs in `phases/` for full context.
216
+ - Each phase inherits deliverables from all prior phases. The Wizard recaps the full quest history at the opening of each phase.
192
217
 
193
218
  ### When to Escalate to Wizard
194
219
 
195
220
  **Do escalate:**
221
+
196
222
  - 2+ agents stuck on same disagreement for 3+ exchanges with no new evidence
197
223
  - Uncertain about project-level context (user requirements, constraints, priorities)
198
224
  - Team needs a direction-setting decision that affects the quest
199
225
  - Found something that may require human input
200
226
 
201
227
  **Don't escalate:**
228
+
202
229
  - You can resolve it by reading the code
203
230
  - Another agent already answered your question
204
- - It's a matter of opinion that doesn't affect the outcome
205
- - You're stuck but haven't tried talking to the other agents first
231
+ - It's a matter of opinion that doesn't affect the outcome
@@ -167,12 +167,10 @@ If cleanup fails:
167
167
 
168
168
  Read `portRange` from `raid.json` (e.g., `[3001, 3005]`).
169
169
 
170
- | Mode | Agents | Port Assignment |
170
+ | Phase | Agents | Port Assignment |
171
171
  |---|---|---|
172
- | Full Raid (Phase 3) | 1 implementer | portRange[0] |
173
- | Full Raid (Phase 4) | 3 challengers | portRange[0], portRange[0]+1, portRange[0]+2 |
174
- | Skirmish | 2 agents | portRange[0], portRange[0]+1 |
175
- | Scout | 1 agent | portRange[0] |
172
+ | Implementation (per task) | 1 implementer | portRange[0] |
173
+ | Review | 3 reviewers (sequential turns) | portRange[0], portRange[0]+1, portRange[0]+2 |
176
174
 
177
175
  ## When Startup Recipe Fails
178
176
 
@@ -8,7 +8,7 @@ description: "Use when live Chrome browser inspection is needed during Phase 5 r
8
8
  Challengers open a real Chrome browser and do adversarial exploratory testing. Each challenger gets their own isolated app instance. Find what automated tests missed.
9
9
 
10
10
  <HARD-GATE>
11
- Do NOT start inspection without invoking `raid-browser` pre-flight first. Do NOT skip minimum coverage gates. Do NOT share browser instances between agents. Every finding MUST include evidence (GIF, screenshot, console/network output). No subagents.
11
+ Do NOT start inspection without invoking `raid-browser` pre-flight first. Do NOT skip minimum coverage gates. Do NOT share browser instances between agents. Every finding MUST include evidence (GIF, screenshot, console/network output).
12
12
  </HARD-GATE>
13
13
 
14
14
  ## Session Lifecycle Per Challenger