opencode-swarm-plugin 0.43.0 → 0.44.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/cass.characterization.test.ts +422 -0
- package/bin/swarm.serve.test.ts +6 -4
- package/bin/swarm.test.ts +68 -0
- package/bin/swarm.ts +81 -8
- package/dist/compaction-prompt-scoring.js +139 -0
- package/dist/contributor-tools.d.ts +42 -0
- package/dist/contributor-tools.d.ts.map +1 -0
- package/dist/eval-capture.js +12811 -0
- package/dist/hive.d.ts.map +1 -1
- package/dist/index.d.ts +12 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7728 -62590
- package/dist/plugin.js +23833 -78695
- package/dist/sessions/agent-discovery.d.ts +59 -0
- package/dist/sessions/agent-discovery.d.ts.map +1 -0
- package/dist/sessions/index.d.ts +10 -0
- package/dist/sessions/index.d.ts.map +1 -0
- package/dist/swarm-orchestrate.d.ts.map +1 -1
- package/dist/swarm-prompts.d.ts.map +1 -1
- package/dist/swarm-review.d.ts.map +1 -1
- package/package.json +17 -5
- package/.changeset/swarm-insights-data-layer.md +0 -63
- package/.hive/analysis/eval-failure-analysis-2025-12-25.md +0 -331
- package/.hive/analysis/session-data-quality-audit.md +0 -320
- package/.hive/eval-results.json +0 -483
- package/.hive/issues.jsonl +0 -138
- package/.hive/memories.jsonl +0 -729
- package/.opencode/eval-history.jsonl +0 -327
- package/.turbo/turbo-build.log +0 -9
- package/CHANGELOG.md +0 -2255
- package/SCORER-ANALYSIS.md +0 -598
- package/docs/analysis/subagent-coordination-patterns.md +0 -902
- package/docs/analysis-socratic-planner-pattern.md +0 -504
- package/docs/planning/ADR-001-monorepo-structure.md +0 -171
- package/docs/planning/ADR-002-package-extraction.md +0 -393
- package/docs/planning/ADR-003-performance-improvements.md +0 -451
- package/docs/planning/ADR-004-message-queue-features.md +0 -187
- package/docs/planning/ADR-005-devtools-observability.md +0 -202
- package/docs/planning/ADR-007-swarm-enhancements-worktree-review.md +0 -168
- package/docs/planning/ADR-008-worker-handoff-protocol.md +0 -293
- package/docs/planning/ADR-009-oh-my-opencode-patterns.md +0 -353
- package/docs/planning/ROADMAP.md +0 -368
- package/docs/semantic-memory-cli-syntax.md +0 -123
- package/docs/swarm-mail-architecture.md +0 -1147
- package/docs/testing/context-recovery-test.md +0 -470
- package/evals/ARCHITECTURE.md +0 -1189
- package/evals/README.md +0 -768
- package/evals/compaction-prompt.eval.ts +0 -149
- package/evals/compaction-resumption.eval.ts +0 -289
- package/evals/coordinator-behavior.eval.ts +0 -307
- package/evals/coordinator-session.eval.ts +0 -154
- package/evals/evalite.config.ts.bak +0 -15
- package/evals/example.eval.ts +0 -31
- package/evals/fixtures/compaction-cases.ts +0 -350
- package/evals/fixtures/compaction-prompt-cases.ts +0 -311
- package/evals/fixtures/coordinator-sessions.ts +0 -328
- package/evals/fixtures/decomposition-cases.ts +0 -105
- package/evals/lib/compaction-loader.test.ts +0 -248
- package/evals/lib/compaction-loader.ts +0 -320
- package/evals/lib/data-loader.evalite-test.ts +0 -289
- package/evals/lib/data-loader.test.ts +0 -345
- package/evals/lib/data-loader.ts +0 -281
- package/evals/lib/llm.ts +0 -115
- package/evals/scorers/compaction-prompt-scorers.ts +0 -145
- package/evals/scorers/compaction-scorers.ts +0 -305
- package/evals/scorers/coordinator-discipline.evalite-test.ts +0 -539
- package/evals/scorers/coordinator-discipline.ts +0 -325
- package/evals/scorers/index.test.ts +0 -146
- package/evals/scorers/index.ts +0 -328
- package/evals/scorers/outcome-scorers.evalite-test.ts +0 -27
- package/evals/scorers/outcome-scorers.ts +0 -349
- package/evals/swarm-decomposition.eval.ts +0 -121
- package/examples/commands/swarm.md +0 -745
- package/examples/plugin-wrapper-template.ts +0 -2426
- package/examples/skills/hive-workflow/SKILL.md +0 -212
- package/examples/skills/skill-creator/SKILL.md +0 -223
- package/examples/skills/swarm-coordination/SKILL.md +0 -292
- package/global-skills/cli-builder/SKILL.md +0 -344
- package/global-skills/cli-builder/references/advanced-patterns.md +0 -244
- package/global-skills/learning-systems/SKILL.md +0 -644
- package/global-skills/skill-creator/LICENSE.txt +0 -202
- package/global-skills/skill-creator/SKILL.md +0 -352
- package/global-skills/skill-creator/references/output-patterns.md +0 -82
- package/global-skills/skill-creator/references/workflows.md +0 -28
- package/global-skills/swarm-coordination/SKILL.md +0 -995
- package/global-skills/swarm-coordination/references/coordinator-patterns.md +0 -235
- package/global-skills/swarm-coordination/references/strategies.md +0 -138
- package/global-skills/system-design/SKILL.md +0 -213
- package/global-skills/testing-patterns/SKILL.md +0 -430
- package/global-skills/testing-patterns/references/dependency-breaking-catalog.md +0 -586
- package/opencode-swarm-plugin-0.30.7.tgz +0 -0
- package/opencode-swarm-plugin-0.31.0.tgz +0 -0
- package/scripts/cleanup-test-memories.ts +0 -346
- package/scripts/init-skill.ts +0 -222
- package/scripts/migrate-unknown-sessions.ts +0 -349
- package/scripts/validate-skill.ts +0 -204
- package/src/agent-mail.ts +0 -1724
- package/src/anti-patterns.test.ts +0 -1167
- package/src/anti-patterns.ts +0 -448
- package/src/compaction-capture.integration.test.ts +0 -257
- package/src/compaction-hook.test.ts +0 -838
- package/src/compaction-hook.ts +0 -1204
- package/src/compaction-observability.integration.test.ts +0 -139
- package/src/compaction-observability.test.ts +0 -187
- package/src/compaction-observability.ts +0 -324
- package/src/compaction-prompt-scorers.test.ts +0 -475
- package/src/compaction-prompt-scoring.ts +0 -300
- package/src/dashboard.test.ts +0 -611
- package/src/dashboard.ts +0 -462
- package/src/error-enrichment.test.ts +0 -403
- package/src/error-enrichment.ts +0 -219
- package/src/eval-capture.test.ts +0 -1015
- package/src/eval-capture.ts +0 -929
- package/src/eval-gates.test.ts +0 -306
- package/src/eval-gates.ts +0 -218
- package/src/eval-history.test.ts +0 -508
- package/src/eval-history.ts +0 -214
- package/src/eval-learning.test.ts +0 -378
- package/src/eval-learning.ts +0 -360
- package/src/eval-runner.test.ts +0 -223
- package/src/eval-runner.ts +0 -402
- package/src/export-tools.test.ts +0 -476
- package/src/export-tools.ts +0 -257
- package/src/hive.integration.test.ts +0 -2241
- package/src/hive.ts +0 -1628
- package/src/index.ts +0 -935
- package/src/learning.integration.test.ts +0 -1815
- package/src/learning.ts +0 -1079
- package/src/logger.test.ts +0 -189
- package/src/logger.ts +0 -135
- package/src/mandate-promotion.test.ts +0 -473
- package/src/mandate-promotion.ts +0 -239
- package/src/mandate-storage.integration.test.ts +0 -601
- package/src/mandate-storage.test.ts +0 -578
- package/src/mandate-storage.ts +0 -794
- package/src/mandates.ts +0 -540
- package/src/memory-tools.test.ts +0 -195
- package/src/memory-tools.ts +0 -344
- package/src/memory.integration.test.ts +0 -334
- package/src/memory.test.ts +0 -158
- package/src/memory.ts +0 -527
- package/src/model-selection.test.ts +0 -188
- package/src/model-selection.ts +0 -68
- package/src/observability-tools.test.ts +0 -359
- package/src/observability-tools.ts +0 -871
- package/src/output-guardrails.test.ts +0 -438
- package/src/output-guardrails.ts +0 -381
- package/src/pattern-maturity.test.ts +0 -1160
- package/src/pattern-maturity.ts +0 -525
- package/src/planning-guardrails.test.ts +0 -491
- package/src/planning-guardrails.ts +0 -438
- package/src/plugin.ts +0 -23
- package/src/post-compaction-tracker.test.ts +0 -251
- package/src/post-compaction-tracker.ts +0 -237
- package/src/query-tools.test.ts +0 -636
- package/src/query-tools.ts +0 -324
- package/src/rate-limiter.integration.test.ts +0 -466
- package/src/rate-limiter.ts +0 -774
- package/src/replay-tools.test.ts +0 -496
- package/src/replay-tools.ts +0 -240
- package/src/repo-crawl.integration.test.ts +0 -441
- package/src/repo-crawl.ts +0 -610
- package/src/schemas/cell-events.test.ts +0 -347
- package/src/schemas/cell-events.ts +0 -807
- package/src/schemas/cell.ts +0 -257
- package/src/schemas/evaluation.ts +0 -166
- package/src/schemas/index.test.ts +0 -199
- package/src/schemas/index.ts +0 -286
- package/src/schemas/mandate.ts +0 -232
- package/src/schemas/swarm-context.ts +0 -115
- package/src/schemas/task.ts +0 -161
- package/src/schemas/worker-handoff.test.ts +0 -302
- package/src/schemas/worker-handoff.ts +0 -131
- package/src/skills.integration.test.ts +0 -1192
- package/src/skills.test.ts +0 -643
- package/src/skills.ts +0 -1549
- package/src/storage.integration.test.ts +0 -341
- package/src/storage.ts +0 -884
- package/src/structured.integration.test.ts +0 -817
- package/src/structured.test.ts +0 -1046
- package/src/structured.ts +0 -762
- package/src/swarm-decompose.test.ts +0 -188
- package/src/swarm-decompose.ts +0 -1302
- package/src/swarm-deferred.integration.test.ts +0 -157
- package/src/swarm-deferred.test.ts +0 -38
- package/src/swarm-insights.test.ts +0 -214
- package/src/swarm-insights.ts +0 -459
- package/src/swarm-mail.integration.test.ts +0 -970
- package/src/swarm-mail.ts +0 -739
- package/src/swarm-orchestrate.integration.test.ts +0 -282
- package/src/swarm-orchestrate.test.ts +0 -548
- package/src/swarm-orchestrate.ts +0 -3084
- package/src/swarm-prompts.test.ts +0 -1270
- package/src/swarm-prompts.ts +0 -2077
- package/src/swarm-research.integration.test.ts +0 -701
- package/src/swarm-research.test.ts +0 -698
- package/src/swarm-research.ts +0 -472
- package/src/swarm-review.integration.test.ts +0 -285
- package/src/swarm-review.test.ts +0 -879
- package/src/swarm-review.ts +0 -709
- package/src/swarm-strategies.ts +0 -407
- package/src/swarm-worktree.test.ts +0 -501
- package/src/swarm-worktree.ts +0 -575
- package/src/swarm.integration.test.ts +0 -2377
- package/src/swarm.ts +0 -38
- package/src/tool-adapter.integration.test.ts +0 -1221
- package/src/tool-availability.ts +0 -461
- package/tsconfig.json +0 -28
|
@@ -1,902 +0,0 @@
|
|
|
1
|
-
prefer tdd
|
|
2
|
-
|
|
3
|
-
# Subagent Coordination Patterns Analysis
|
|
4
|
-
|
|
5
|
-
**Source:** obra/superpowers repository
|
|
6
|
-
**Files Analyzed:**
|
|
7
|
-
|
|
8
|
-
- skills/subagent-driven-development/SKILL.md
|
|
9
|
-
- skills/dispatching-parallel-agents/SKILL.md
|
|
10
|
-
- skills/requesting-code-review/SKILL.md
|
|
11
|
-
- skills/requesting-code-review/code-reviewer.md
|
|
12
|
-
|
|
13
|
-
---
|
|
14
|
-
|
|
15
|
-
## 1. Core Principles
|
|
16
|
-
|
|
17
|
-
1. **Fresh Subagent Per Task** - No context pollution. Each agent starts clean, reads requirements, executes, reports back.
|
|
18
|
-
|
|
19
|
-
2. **Review Between Tasks** - Code review after EACH task catches issues before they compound. Cheaper than debugging later.
|
|
20
|
-
|
|
21
|
-
3. **Focused Agent Prompts** - One clear problem domain per agent. Self-contained context. Specific about expected output.
|
|
22
|
-
|
|
23
|
-
4. **Parallelize Independent Work** - 3+ independent failures/tasks = dispatch concurrent agents. No shared state = parallel safe.
|
|
24
|
-
|
|
25
|
-
5. **Same Session Execution** - Subagent-driven development stays in current session (vs executing-plans which spawns parallel session).
|
|
26
|
-
|
|
27
|
-
6. **Quality Gates Over Speed** - More subagent invocations cost tokens, but catching issues early is cheaper than debugging cascading failures.
|
|
28
|
-
|
|
29
|
-
7. **Never Skip Review** - Even "simple" tasks get reviewed. Critical issues block progress. Important issues fixed before next task.
|
|
30
|
-
|
|
31
|
-
8. **Explicit Severity Tiers** - Critical (must fix), Important (should fix), Minor (nice to have). Not everything is critical.
|
|
32
|
-
|
|
33
|
-
---
|
|
34
|
-
|
|
35
|
-
## 2. When to Use Each Pattern
|
|
36
|
-
|
|
37
|
-
### Subagent-Driven Development
|
|
38
|
-
|
|
39
|
-
**Use when:**
|
|
40
|
-
|
|
41
|
-
- Staying in current session (no context switch)
|
|
42
|
-
- Tasks are mostly independent
|
|
43
|
-
- Want continuous progress with quality gates
|
|
44
|
-
- Have a plan ready to execute
|
|
45
|
-
|
|
46
|
-
**Don't use when:**
|
|
47
|
-
|
|
48
|
-
- Need to review plan first → use `executing-plans`
|
|
49
|
-
- Tasks are tightly coupled → manual execution better
|
|
50
|
-
- Plan needs revision → brainstorm first
|
|
51
|
-
|
|
52
|
-
**Decision tree:**
|
|
53
|
-
|
|
54
|
-
```
|
|
55
|
-
Have implementation plan?
|
|
56
|
-
├─ Yes → Tasks independent?
|
|
57
|
-
│ ├─ Yes → Stay in session?
|
|
58
|
-
│ │ ├─ Yes → Subagent-Driven Development ✓
|
|
59
|
-
│ │ └─ No → Executing Plans (parallel session)
|
|
60
|
-
│ └─ No → Manual execution (tight coupling)
|
|
61
|
-
└─ No → Write plan first
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
---
|
|
65
|
-
|
|
66
|
-
### Dispatching Parallel Agents
|
|
67
|
-
|
|
68
|
-
**Use when:**
|
|
69
|
-
|
|
70
|
-
- 3+ test files failing with different root causes
|
|
71
|
-
- Multiple subsystems broken independently
|
|
72
|
-
- Each problem can be understood without context from others
|
|
73
|
-
- No shared state between investigations
|
|
74
|
-
|
|
75
|
-
**Don't use when:**
|
|
76
|
-
|
|
77
|
-
- Failures are related (fix one might fix others)
|
|
78
|
-
- Need to understand full system state
|
|
79
|
-
- Agents would interfere with each other (shared state, editing same files)
|
|
80
|
-
- Exploratory debugging (don't know what's broken yet)
|
|
81
|
-
|
|
82
|
-
**Decision tree:**
|
|
83
|
-
|
|
84
|
-
```
|
|
85
|
-
Multiple failures?
|
|
86
|
-
├─ Yes → Are they independent?
|
|
87
|
-
│ ├─ Yes → Can work in parallel?
|
|
88
|
-
│ │ ├─ Yes → 3+ failures?
|
|
89
|
-
│ │ │ ├─ Yes → Parallel Dispatch ✓
|
|
90
|
-
│ │ │ └─ No → Sequential agents
|
|
91
|
-
│ │ └─ No (shared state) → Sequential agents
|
|
92
|
-
│ └─ No (related) → Single agent investigates all
|
|
93
|
-
└─ No → Single investigation
|
|
94
|
-
```
|
|
95
|
-
|
|
96
|
-
**Heuristics:**
|
|
97
|
-
|
|
98
|
-
- Different test files = likely independent
|
|
99
|
-
- Different subsystems = likely independent
|
|
100
|
-
- Same error across files = likely related
|
|
101
|
-
- Cascading failures = investigate root cause first
|
|
102
|
-
|
|
103
|
-
---
|
|
104
|
-
|
|
105
|
-
### Requesting Code Review
|
|
106
|
-
|
|
107
|
-
**Mandatory:**
|
|
108
|
-
|
|
109
|
-
- After each task in subagent-driven development
|
|
110
|
-
- After completing major feature
|
|
111
|
-
- Before merge to main
|
|
112
|
-
|
|
113
|
-
**Optional but valuable:**
|
|
114
|
-
|
|
115
|
-
- When stuck (fresh perspective)
|
|
116
|
-
- Before refactoring (baseline check)
|
|
117
|
-
- After fixing complex bug
|
|
118
|
-
|
|
119
|
-
**Never skip because:**
|
|
120
|
-
|
|
121
|
-
- "It's simple" (simple tasks can have subtle issues)
|
|
122
|
-
- "I'm confident" (review finds blind spots)
|
|
123
|
-
- "Time pressure" (unfixed bugs cost more time later)
|
|
124
|
-
|
|
125
|
-
---
|
|
126
|
-
|
|
127
|
-
## 3. Agent Prompt Best Practices
|
|
128
|
-
|
|
129
|
-
### Anatomy of a Good Prompt
|
|
130
|
-
|
|
131
|
-
**1. Focused** - One clear problem domain
|
|
132
|
-
|
|
133
|
-
```markdown
|
|
134
|
-
❌ "Fix all the tests"
|
|
135
|
-
✓ "Fix agent-tool-abort.test.ts"
|
|
136
|
-
```
|
|
137
|
-
|
|
138
|
-
**2. Self-contained** - All context needed
|
|
139
|
-
|
|
140
|
-
```markdown
|
|
141
|
-
❌ "Fix the race condition"
|
|
142
|
-
✓ "Fix the 3 failing tests in src/agents/agent-tool-abort.test.ts:
|
|
143
|
-
|
|
144
|
-
1. 'should abort tool with partial output capture' - expects 'interrupted at' in message
|
|
145
|
-
2. 'should handle mixed completed and aborted tools' - fast tool aborted instead of completed
|
|
146
|
-
3. 'should properly track pendingToolCount' - expects 3 results but gets 0"
|
|
147
|
-
```
|
|
148
|
-
|
|
149
|
-
**3. Specific about output** - What should agent return?
|
|
150
|
-
|
|
151
|
-
```markdown
|
|
152
|
-
❌ "Fix it"
|
|
153
|
-
✓ "Return: Summary of root cause and what you fixed"
|
|
154
|
-
```
|
|
155
|
-
|
|
156
|
-
**4. Constraints** - Prevent scope creep
|
|
157
|
-
|
|
158
|
-
```markdown
|
|
159
|
-
✓ "Do NOT just increase timeouts - find the real issue"
|
|
160
|
-
✓ "Do NOT change production code - fix tests only"
|
|
161
|
-
✓ "Don't refactor - minimal changes to make tests pass"
|
|
162
|
-
```
|
|
163
|
-
|
|
164
|
-
---
|
|
165
|
-
|
|
166
|
-
### Implementation Subagent Template
|
|
167
|
-
|
|
168
|
-
```markdown
|
|
169
|
-
You are implementing Task N from [plan-file].
|
|
170
|
-
|
|
171
|
-
Read that task carefully. Your job is to:
|
|
172
|
-
|
|
173
|
-
1. Implement exactly what the task specifies
|
|
174
|
-
2. Write tests (following TDD if task says to)
|
|
175
|
-
3. Verify implementation works
|
|
176
|
-
4. Commit your work
|
|
177
|
-
5. Report back
|
|
178
|
-
|
|
179
|
-
Work from: [directory]
|
|
180
|
-
|
|
181
|
-
Report: What you implemented, what you tested, test results, files changed, any issues
|
|
182
|
-
```
|
|
183
|
-
|
|
184
|
-
**Key elements:**
|
|
185
|
-
|
|
186
|
-
- References plan file for context
|
|
187
|
-
- Explicit steps to follow
|
|
188
|
-
- Specific output format
|
|
189
|
-
- Working directory specified
|
|
190
|
-
|
|
191
|
-
---
|
|
192
|
-
|
|
193
|
-
### Parallel Investigation Template
|
|
194
|
-
|
|
195
|
-
```markdown
|
|
196
|
-
Fix the 3 failing tests in src/agents/agent-tool-abort.test.ts:
|
|
197
|
-
|
|
198
|
-
1. "should abort tool with partial output capture" - expects 'interrupted at' in message
|
|
199
|
-
2. "should handle mixed completed and aborted tools" - fast tool aborted instead of completed
|
|
200
|
-
3. "should properly track pendingToolCount" - expects 3 results but gets 0
|
|
201
|
-
|
|
202
|
-
These are timing/race condition issues. Your task:
|
|
203
|
-
|
|
204
|
-
1. Read the test file and understand what each test verifies
|
|
205
|
-
2. Identify root cause - timing issues or actual bugs?
|
|
206
|
-
3. Fix by:
|
|
207
|
-
- Replacing arbitrary timeouts with event-based waiting
|
|
208
|
-
- Fixing bugs in abort implementation if found
|
|
209
|
-
- Adjusting test expectations if testing changed behavior
|
|
210
|
-
|
|
211
|
-
Do NOT just increase timeouts - find the real issue.
|
|
212
|
-
|
|
213
|
-
Return: Summary of what you found and what you fixed.
|
|
214
|
-
```
|
|
215
|
-
|
|
216
|
-
**Key elements:**
|
|
217
|
-
|
|
218
|
-
- Paste error messages and test names (full context)
|
|
219
|
-
- Hypothesis about root cause
|
|
220
|
-
- Clear fixing strategy
|
|
221
|
-
- Anti-pattern constraint ("Do NOT just increase timeouts")
|
|
222
|
-
- Expected return format
|
|
223
|
-
|
|
224
|
-
---
|
|
225
|
-
|
|
226
|
-
### Fix Subagent Template
|
|
227
|
-
|
|
228
|
-
```markdown
|
|
229
|
-
Fix issues from code review: [list issues]
|
|
230
|
-
|
|
231
|
-
Context: [what was just implemented]
|
|
232
|
-
|
|
233
|
-
Issues to fix:
|
|
234
|
-
|
|
235
|
-
1. [Issue from reviewer with file:line reference]
|
|
236
|
-
2. [Issue from reviewer with file:line reference]
|
|
237
|
-
|
|
238
|
-
Fix these issues and commit. Report what you changed.
|
|
239
|
-
```
|
|
240
|
-
|
|
241
|
-
**Key elements:**
|
|
242
|
-
|
|
243
|
-
- Specific issues from code review
|
|
244
|
-
- Context of original implementation
|
|
245
|
-
- Clear success criteria
|
|
246
|
-
|
|
247
|
-
---
|
|
248
|
-
|
|
249
|
-
## 4. Code Review Template Structure
|
|
250
|
-
|
|
251
|
-
### Dispatcher Side (Requesting Review)
|
|
252
|
-
|
|
253
|
-
**1. Get git SHAs:**
|
|
254
|
-
|
|
255
|
-
```bash
|
|
256
|
-
BASE_SHA=$(git rev-parse HEAD~1) # or origin/main
|
|
257
|
-
HEAD_SHA=$(git rev-parse HEAD)
|
|
258
|
-
```
|
|
259
|
-
|
|
260
|
-
**2. Fill template placeholders:**
|
|
261
|
-
|
|
262
|
-
- `{WHAT_WAS_IMPLEMENTED}` - What you just built
|
|
263
|
-
- `{PLAN_OR_REQUIREMENTS}` - What it should do (reference plan file/section)
|
|
264
|
-
- `{BASE_SHA}` - Starting commit
|
|
265
|
-
- `{HEAD_SHA}` - Ending commit
|
|
266
|
-
- `{DESCRIPTION}` - Brief summary
|
|
267
|
-
|
|
268
|
-
**3. Dispatch superpowers:code-reviewer subagent** with filled template
|
|
269
|
-
|
|
270
|
-
---
|
|
271
|
-
|
|
272
|
-
### Code Reviewer Side (Template Output)
|
|
273
|
-
|
|
274
|
-
#### Strengths
|
|
275
|
-
|
|
276
|
-
[What's well done? Be specific with file:line references]
|
|
277
|
-
|
|
278
|
-
Example:
|
|
279
|
-
|
|
280
|
-
```
|
|
281
|
-
- Clean database schema with proper migrations (db.ts:15-42)
|
|
282
|
-
- Comprehensive test coverage (18 tests, all edge cases)
|
|
283
|
-
- Good error handling with fallbacks (summarizer.ts:85-92)
|
|
284
|
-
```
|
|
285
|
-
|
|
286
|
-
---
|
|
287
|
-
|
|
288
|
-
#### Issues
|
|
289
|
-
|
|
290
|
-
##### Critical (Must Fix)
|
|
291
|
-
|
|
292
|
-
[Bugs, security issues, data loss risks, broken functionality]
|
|
293
|
-
|
|
294
|
-
##### Important (Should Fix)
|
|
295
|
-
|
|
296
|
-
[Architecture problems, missing features, poor error handling, test gaps]
|
|
297
|
-
|
|
298
|
-
##### Minor (Nice to Have)
|
|
299
|
-
|
|
300
|
-
[Code style, optimization opportunities, documentation improvements]
|
|
301
|
-
|
|
302
|
-
**For each issue:**
|
|
303
|
-
|
|
304
|
-
- File:line reference
|
|
305
|
-
- What's wrong
|
|
306
|
-
- Why it matters
|
|
307
|
-
- How to fix (if not obvious)
|
|
308
|
-
|
|
309
|
-
Example:
|
|
310
|
-
|
|
311
|
-
```
|
|
312
|
-
#### Important
|
|
313
|
-
1. **Missing help text in CLI wrapper**
|
|
314
|
-
- File: index-conversations:1-31
|
|
315
|
-
- Issue: No --help flag, users won't discover --concurrency
|
|
316
|
-
- Fix: Add --help case with usage examples
|
|
317
|
-
|
|
318
|
-
2. **Date validation missing**
|
|
319
|
-
- File: search.ts:25-27
|
|
320
|
-
- Issue: Invalid dates silently return no results
|
|
321
|
-
- Fix: Validate ISO format, throw error with example
|
|
322
|
-
```
|
|
323
|
-
|
|
324
|
-
---
|
|
325
|
-
|
|
326
|
-
#### Recommendations
|
|
327
|
-
|
|
328
|
-
[Improvements for code quality, architecture, or process]
|
|
329
|
-
|
|
330
|
-
---
|
|
331
|
-
|
|
332
|
-
#### Assessment
|
|
333
|
-
|
|
334
|
-
**Ready to merge?** [Yes/No/With fixes]
|
|
335
|
-
|
|
336
|
-
**Reasoning:** [Technical assessment in 1-2 sentences]
|
|
337
|
-
|
|
338
|
-
Example:
|
|
339
|
-
|
|
340
|
-
```
|
|
341
|
-
**Ready to merge: With fixes**
|
|
342
|
-
|
|
343
|
-
**Reasoning:** Core implementation is solid with good architecture and tests.
|
|
344
|
-
Important issues (help text, date validation) are easily fixed and don't affect
|
|
345
|
-
core functionality.
|
|
346
|
-
```
|
|
347
|
-
|
|
348
|
-
---
|
|
349
|
-
|
|
350
|
-
### Review Checklist (Reviewer Uses This)
|
|
351
|
-
|
|
352
|
-
**Code Quality:**
|
|
353
|
-
|
|
354
|
-
- Clean separation of concerns?
|
|
355
|
-
- Proper error handling?
|
|
356
|
-
- Type safety (if applicable)?
|
|
357
|
-
- DRY principle followed?
|
|
358
|
-
- Edge cases handled?
|
|
359
|
-
|
|
360
|
-
**Architecture:**
|
|
361
|
-
|
|
362
|
-
- Sound design decisions?
|
|
363
|
-
- Scalability considerations?
|
|
364
|
-
- Performance implications?
|
|
365
|
-
- Security concerns?
|
|
366
|
-
|
|
367
|
-
**Testing:**
|
|
368
|
-
|
|
369
|
-
- Tests actually test logic (not mocks)?
|
|
370
|
-
- Edge cases covered?
|
|
371
|
-
- Integration tests where needed?
|
|
372
|
-
- All tests passing?
|
|
373
|
-
|
|
374
|
-
**Requirements:**
|
|
375
|
-
|
|
376
|
-
- All plan requirements met?
|
|
377
|
-
- Implementation matches spec?
|
|
378
|
-
- No scope creep?
|
|
379
|
-
- Breaking changes documented?
|
|
380
|
-
|
|
381
|
-
**Production Readiness:**
|
|
382
|
-
|
|
383
|
-
- Migration strategy (if schema changes)?
|
|
384
|
-
- Backward compatibility considered?
|
|
385
|
-
- Documentation complete?
|
|
386
|
-
- No obvious bugs?
|
|
387
|
-
|
|
388
|
-
---
|
|
389
|
-
|
|
390
|
-
## 5. Anti-Patterns and Red Flags
|
|
391
|
-
|
|
392
|
-
### Subagent-Driven Development
|
|
393
|
-
|
|
394
|
-
**Never:**
|
|
395
|
-
|
|
396
|
-
- ❌ Skip code review between tasks
|
|
397
|
-
- ❌ Proceed with unfixed Critical issues
|
|
398
|
-
- ❌ Dispatch multiple implementation subagents in parallel (conflicts)
|
|
399
|
-
- ❌ Implement without reading plan task
|
|
400
|
-
- ❌ Try to fix subagent failures manually (context pollution)
|
|
401
|
-
|
|
402
|
-
**If subagent fails task:**
|
|
403
|
-
|
|
404
|
-
- ✓ Dispatch fix subagent with specific instructions
|
|
405
|
-
- ✓ Don't try to fix manually (context pollution)
|
|
406
|
-
|
|
407
|
-
---
|
|
408
|
-
|
|
409
|
-
### Dispatching Parallel Agents
|
|
410
|
-
|
|
411
|
-
**Common mistakes:**
|
|
412
|
-
|
|
413
|
-
❌ **Too broad:** "Fix all the tests"
|
|
414
|
-
✓ **Specific:** "Fix agent-tool-abort.test.ts"
|
|
415
|
-
|
|
416
|
-
❌ **No context:** "Fix the race condition"
|
|
417
|
-
✓ **Context:** Paste error messages and test names
|
|
418
|
-
|
|
419
|
-
❌ **No constraints:** Agent might refactor everything
|
|
420
|
-
✓ **Constraints:** "Do NOT change production code" or "Fix tests only"
|
|
421
|
-
|
|
422
|
-
❌ **Vague output:** "Fix it"
|
|
423
|
-
✓ **Specific:** "Return summary of root cause and changes"
|
|
424
|
-
|
|
425
|
-
**When NOT to parallelize:**
|
|
426
|
-
|
|
427
|
-
- Related failures (fix one might fix others)
|
|
428
|
-
- Need full context (understanding requires seeing entire system)
|
|
429
|
-
- Exploratory debugging (don't know what's broken yet)
|
|
430
|
-
- Shared state (agents would interfere)
|
|
431
|
-
|
|
432
|
-
---
|
|
433
|
-
|
|
434
|
-
### Requesting Code Review
|
|
435
|
-
|
|
436
|
-
**Never:**
|
|
437
|
-
|
|
438
|
-
- ❌ Skip review because "it's simple"
|
|
439
|
-
- ❌ Ignore Critical issues
|
|
440
|
-
- ❌ Proceed with unfixed Important issues
|
|
441
|
-
- ❌ Argue with valid technical feedback
|
|
442
|
-
|
|
443
|
-
**If reviewer wrong:**
|
|
444
|
-
|
|
445
|
-
- ✓ Push back with technical reasoning
|
|
446
|
-
- ✓ Show code/tests that prove it works
|
|
447
|
-
- ✓ Request clarification
|
|
448
|
-
|
|
449
|
-
---
|
|
450
|
-
|
|
451
|
-
### Code Reviewer Anti-Patterns
|
|
452
|
-
|
|
453
|
-
**DO:**
|
|
454
|
-
|
|
455
|
-
- ✓ Categorize by actual severity (not everything is Critical)
|
|
456
|
-
- ✓ Be specific (file:line, not vague)
|
|
457
|
-
- ✓ Explain WHY issues matter
|
|
458
|
-
- ✓ Acknowledge strengths
|
|
459
|
-
- ✓ Give clear verdict
|
|
460
|
-
|
|
461
|
-
**DON'T:**
|
|
462
|
-
|
|
463
|
-
- ❌ Say "looks good" without checking
|
|
464
|
-
- ❌ Mark nitpicks as Critical
|
|
465
|
-
- ❌ Give feedback on code you didn't review
|
|
466
|
-
- ❌ Be vague ("improve error handling")
|
|
467
|
-
- ❌ Avoid giving a clear verdict
|
|
468
|
-
|
|
469
|
-
---
|
|
470
|
-
|
|
471
|
-
## 6. Integration Between Patterns
|
|
472
|
-
|
|
473
|
-
### Subagent-Driven Development Workflow
|
|
474
|
-
|
|
475
|
-
```
|
|
476
|
-
1. Load Plan
|
|
477
|
-
└─ Read plan file, create TodoWrite with all tasks
|
|
478
|
-
|
|
479
|
-
2. For Each Task:
|
|
480
|
-
├─ Dispatch implementation subagent
|
|
481
|
-
│ └─ Fresh context, follows TDD, commits work
|
|
482
|
-
│
|
|
483
|
-
├─ Get git SHAs (before task, after task)
|
|
484
|
-
│
|
|
485
|
-
├─ Dispatch code-reviewer subagent
|
|
486
|
-
│ └─ Reviews against plan requirements
|
|
487
|
-
│
|
|
488
|
-
├─ Act on review feedback
|
|
489
|
-
│ ├─ Critical issues → Fix immediately
|
|
490
|
-
│ ├─ Important issues → Dispatch fix subagent
|
|
491
|
-
│ └─ Minor issues → Note for later
|
|
492
|
-
│
|
|
493
|
-
└─ Mark task complete in TodoWrite
|
|
494
|
-
|
|
495
|
-
3. After All Tasks:
|
|
496
|
-
├─ Dispatch final code-reviewer
|
|
497
|
-
│ └─ Reviews entire implementation
|
|
498
|
-
│
|
|
499
|
-
└─ Use finishing-a-development-branch skill
|
|
500
|
-
└─ Verify tests, present options, execute choice
|
|
501
|
-
```
|
|
502
|
-
|
|
503
|
-
---
|
|
504
|
-
|
|
505
|
-
### Parallel Investigation Workflow
|
|
506
|
-
|
|
507
|
-
```
|
|
508
|
-
1. Multiple Failures Detected
|
|
509
|
-
└─ Identify independent problem domains
|
|
510
|
-
|
|
511
|
-
2. Group by Domain
|
|
512
|
-
├─ File A tests: Tool approval flow
|
|
513
|
-
├─ File B tests: Batch completion behavior
|
|
514
|
-
└─ File C tests: Abort functionality
|
|
515
|
-
|
|
516
|
-
3. Dispatch Parallel Agents
|
|
517
|
-
├─ Agent 1: Fix File A (focused scope, specific errors)
|
|
518
|
-
├─ Agent 2: Fix File B (focused scope, specific errors)
|
|
519
|
-
└─ Agent 3: Fix File C (focused scope, specific errors)
|
|
520
|
-
|
|
521
|
-
4. Review and Integrate
|
|
522
|
-
├─ Read each summary
|
|
523
|
-
├─ Verify fixes don't conflict
|
|
524
|
-
├─ Run full test suite
|
|
525
|
-
└─ Integrate all changes
|
|
526
|
-
```
|
|
527
|
-
|
|
528
|
-
---
|
|
529
|
-
|
|
530
|
-
### Acting on Code Review Feedback
|
|
531
|
-
|
|
532
|
-
**Severity Tiers:**
|
|
533
|
-
|
|
534
|
-
**Critical (Must Fix):**
|
|
535
|
-
|
|
536
|
-
- Bugs, security issues, data loss risks, broken functionality
|
|
537
|
-
- **Action:** Fix immediately, re-review, don't proceed without fixing
|
|
538
|
-
|
|
539
|
-
**Important (Should Fix):**
|
|
540
|
-
|
|
541
|
-
- Architecture problems, missing features, poor error handling, test gaps
|
|
542
|
-
- **Action:** Dispatch fix subagent before next task
|
|
543
|
-
|
|
544
|
-
**Minor (Nice to Have):**
|
|
545
|
-
|
|
546
|
-
- Code style, optimization opportunities, documentation improvements
|
|
547
|
-
- **Action:** Note for later, don't block on these
|
|
548
|
-
|
|
549
|
-
**Example flow:**
|
|
550
|
-
|
|
551
|
-
```
|
|
552
|
-
Reviewer returns:
|
|
553
|
-
Critical: None
|
|
554
|
-
Important: Missing progress indicators, Date validation missing
|
|
555
|
-
Minor: Magic number (100) for reporting interval
|
|
556
|
-
|
|
557
|
-
Action:
|
|
558
|
-
1. Dispatch fix subagent: "Fix Important issues from review: [list]"
|
|
559
|
-
2. Fix subagent commits changes
|
|
560
|
-
3. (Optional) Quick re-review if fixes were complex
|
|
561
|
-
4. Mark task complete, proceed to next task
|
|
562
|
-
5. Note Minor issues for future cleanup
|
|
563
|
-
```
|
|
564
|
-
|
|
565
|
-
---
|
|
566
|
-
|
|
567
|
-
## 7. Required Workflow Skills
|
|
568
|
-
|
|
569
|
-
### Subagent-Driven Development Dependencies
|
|
570
|
-
|
|
571
|
-
**REQUIRED:**
|
|
572
|
-
|
|
573
|
-
- `writing-plans` - Creates the plan that this skill executes
|
|
574
|
-
- `requesting-code-review` - Review after each task
|
|
575
|
-
- `finishing-a-development-branch` - Complete development after all tasks
|
|
576
|
-
|
|
577
|
-
**Subagents must use:**
|
|
578
|
-
|
|
579
|
-
- `test-driven-development` - Subagents follow TDD for each task
|
|
580
|
-
|
|
581
|
-
**Alternative workflow:**
|
|
582
|
-
|
|
583
|
-
- `executing-plans` - Use for parallel session instead of same-session execution
|
|
584
|
-
|
|
585
|
-
---
|
|
586
|
-
|
|
587
|
-
## 8. Real-World Examples
|
|
588
|
-
|
|
589
|
-
### Parallel Investigation (from Session 2025-10-03)
|
|
590
|
-
|
|
591
|
-
**Scenario:** 6 test failures across 3 files after major refactoring
|
|
592
|
-
|
|
593
|
-
**Failures:**
|
|
594
|
-
|
|
595
|
-
- agent-tool-abort.test.ts: 3 failures (timing issues)
|
|
596
|
-
- batch-completion-behavior.test.ts: 2 failures (tools not executing)
|
|
597
|
-
- tool-approval-race-conditions.test.ts: 1 failure (execution count = 0)
|
|
598
|
-
|
|
599
|
-
**Decision:** Independent domains - abort logic separate from batch completion separate from race conditions
|
|
600
|
-
|
|
601
|
-
**Dispatch:**
|
|
602
|
-
|
|
603
|
-
```
|
|
604
|
-
Agent 1 → Fix agent-tool-abort.test.ts
|
|
605
|
-
Agent 2 → Fix batch-completion-behavior.test.ts
|
|
606
|
-
Agent 3 → Fix tool-approval-race-conditions.test.ts
|
|
607
|
-
```
|
|
608
|
-
|
|
609
|
-
**Results:**
|
|
610
|
-
|
|
611
|
-
- Agent 1: Replaced timeouts with event-based waiting
|
|
612
|
-
- Agent 2: Fixed event structure bug (threadId in wrong place)
|
|
613
|
-
- Agent 3: Added wait for async tool execution to complete
|
|
614
|
-
|
|
615
|
-
**Integration:** All fixes independent, no conflicts, full suite green
|
|
616
|
-
|
|
617
|
-
**Time saved:** 3 problems solved in parallel vs sequentially
|
|
618
|
-
|
|
619
|
-
---
|
|
620
|
-
|
|
621
|
-
### Subagent-Driven Development Example
|
|
622
|
-
|
|
623
|
-
```
|
|
624
|
-
Coordinator: I'm using Subagent-Driven Development to execute this plan.
|
|
625
|
-
|
|
626
|
-
[Load plan, create TodoWrite]
|
|
627
|
-
|
|
628
|
-
Task 1: Hook installation script
|
|
629
|
-
|
|
630
|
-
[Dispatch implementation subagent]
|
|
631
|
-
Subagent: Implemented install-hook with tests, 5/5 passing
|
|
632
|
-
|
|
633
|
-
[Get git SHAs, dispatch code-reviewer]
|
|
634
|
-
Reviewer: Strengths: Good test coverage. Issues: None. Ready.
|
|
635
|
-
|
|
636
|
-
[Mark Task 1 complete]
|
|
637
|
-
|
|
638
|
-
Task 2: Recovery modes
|
|
639
|
-
|
|
640
|
-
[Dispatch implementation subagent]
|
|
641
|
-
Subagent: Added verify/repair, 8/8 tests passing
|
|
642
|
-
|
|
643
|
-
[Dispatch code-reviewer]
|
|
644
|
-
Reviewer: Strengths: Solid. Issues (Important): Missing progress reporting
|
|
645
|
-
|
|
646
|
-
[Dispatch fix subagent]
|
|
647
|
-
Fix subagent: Added progress every 100 conversations
|
|
648
|
-
|
|
649
|
-
[Verify fix, mark Task 2 complete]
|
|
650
|
-
|
|
651
|
-
...
|
|
652
|
-
|
|
653
|
-
[After all tasks]
|
|
654
|
-
[Dispatch final code-reviewer]
|
|
655
|
-
Final reviewer: All requirements met, ready to merge
|
|
656
|
-
|
|
657
|
-
Done!
|
|
658
|
-
```
|
|
659
|
-
|
|
660
|
-
---
|
|
661
|
-
|
|
662
|
-
## 9. Key Quotes Worth Preserving
|
|
663
|
-
|
|
664
|
-
> **"Fresh subagent per task + review between tasks = high quality, fast iteration"**
|
|
665
|
-
> — subagent-driven-development/SKILL.md
|
|
666
|
-
|
|
667
|
-
> **"Dispatch one agent per independent problem domain. Let them work concurrently."**
|
|
668
|
-
> — dispatching-parallel-agents/SKILL.md
|
|
669
|
-
|
|
670
|
-
> **"Review early, review often."**
|
|
671
|
-
> — requesting-code-review/SKILL.md
|
|
672
|
-
|
|
673
|
-
> **"More subagent invocations cost tokens, but catching issues early is cheaper than debugging later."**
|
|
674
|
-
> — subagent-driven-development/SKILL.md (paraphrased from "Cost" section)
|
|
675
|
-
|
|
676
|
-
> **"Do NOT just increase timeouts - find the real issue."**
|
|
677
|
-
> — dispatching-parallel-agents/SKILL.md (example prompt constraint)
|
|
678
|
-
|
|
679
|
-
> **"Categorize by actual severity (not everything is Critical)"**
|
|
680
|
-
> — code-reviewer.md
|
|
681
|
-
|
|
682
|
-
> **"Be specific (file:line, not vague)"**
|
|
683
|
-
> — code-reviewer.md
|
|
684
|
-
|
|
685
|
-
> **"If subagent fails task: Dispatch fix subagent with specific instructions. Don't try to fix manually (context pollution)."**
|
|
686
|
-
> — subagent-driven-development/SKILL.md
|
|
687
|
-
|
|
688
|
-
---
|
|
689
|
-
|
|
690
|
-
## 10. Advantages Summary
|
|
691
|
-
|
|
692
|
-
### Subagent-Driven Development
|
|
693
|
-
|
|
694
|
-
**vs. Manual execution:**
|
|
695
|
-
|
|
696
|
-
- Subagents follow TDD naturally
|
|
697
|
-
- Fresh context per task (no confusion)
|
|
698
|
-
- Parallel-safe (subagents don't interfere)
|
|
699
|
-
|
|
700
|
-
**vs. Executing Plans:**
|
|
701
|
-
|
|
702
|
-
- Same session (no handoff)
|
|
703
|
-
- Continuous progress (no waiting)
|
|
704
|
-
- Review checkpoints automatic
|
|
705
|
-
|
|
706
|
-
**Cost tradeoff:**
|
|
707
|
-
|
|
708
|
-
- More subagent invocations
|
|
709
|
-
- But catches issues early (cheaper than debugging later)
|
|
710
|
-
|
|
711
|
-
---
|
|
712
|
-
|
|
713
|
-
### Dispatching Parallel Agents
|
|
714
|
-
|
|
715
|
-
**Benefits:**
|
|
716
|
-
|
|
717
|
-
1. **Parallelization** - Multiple investigations happen simultaneously
|
|
718
|
-
2. **Focus** - Each agent has narrow scope, less context to track
|
|
719
|
-
3. **Independence** - Agents don't interfere with each other
|
|
720
|
-
4. **Speed** - 3 problems solved in time of 1
|
|
721
|
-
|
|
722
|
-
**Verification after agents return:**
|
|
723
|
-
|
|
724
|
-
1. Review each summary - Understand what changed
|
|
725
|
-
2. Check for conflicts - Did agents edit same code?
|
|
726
|
-
3. Run full suite - Verify all fixes work together
|
|
727
|
-
4. Spot check - Agents can make systematic errors
|
|
728
|
-
|
|
729
|
-
---
|
|
730
|
-
|
|
731
|
-
### Requesting Code Review
|
|
732
|
-
|
|
733
|
-
**Benefits:**
|
|
734
|
-
|
|
735
|
-
- Catches issues before they compound
|
|
736
|
-
- Fresh perspective on implementation
|
|
737
|
-
- Validates against requirements
|
|
738
|
-
- Explicit severity tiers guide priority
|
|
739
|
-
- Clear verdict (Yes/No/With fixes)
|
|
740
|
-
|
|
741
|
-
**Integration:**
|
|
742
|
-
|
|
743
|
-
- Subagent-Driven Development: Review after EACH task
|
|
744
|
-
- Executing Plans: Review after each batch (3 tasks)
|
|
745
|
-
- Ad-Hoc Development: Review before merge, when stuck
|
|
746
|
-
|
|
747
|
-
---
|
|
748
|
-
|
|
749
|
-
## 11. Decision Tree: Which Pattern to Use?
|
|
750
|
-
|
|
751
|
-
```
|
|
752
|
-
What are you doing?
|
|
753
|
-
├─ Executing implementation plan?
|
|
754
|
-
│ ├─ Yes → Subagent-Driven Development
|
|
755
|
-
│ │ ├─ Fresh subagent per task
|
|
756
|
-
│ │ ├─ Code review after each task
|
|
757
|
-
│ │ └─ Same session, continuous progress
|
|
758
|
-
│ │
|
|
759
|
-
│ └─ No → Continue...
|
|
760
|
-
│
|
|
761
|
-
├─ Multiple independent failures?
|
|
762
|
-
│ ├─ Yes (3+) → Dispatching Parallel Agents
|
|
763
|
-
│ │ ├─ One agent per problem domain
|
|
764
|
-
│ │ ├─ Focused prompts with constraints
|
|
765
|
-
│ │ └─ Review and integrate results
|
|
766
|
-
│ │
|
|
767
|
-
│ └─ No → Continue...
|
|
768
|
-
│
|
|
769
|
-
└─ Completed task/feature?
|
|
770
|
-
└─ Yes → Requesting Code Review
|
|
771
|
-
├─ Get git SHAs
|
|
772
|
-
├─ Dispatch code-reviewer subagent
|
|
773
|
-
├─ Fix Critical/Important issues
|
|
774
|
-
└─ Proceed or merge
|
|
775
|
-
```
|
|
776
|
-
|
|
777
|
-
---
|
|
778
|
-
|
|
779
|
-
## 12. Prompt Templates Quick Reference
|
|
780
|
-
|
|
781
|
-
### Implementation Subagent
|
|
782
|
-
|
|
783
|
-
```
|
|
784
|
-
You are implementing Task N from [plan-file].
|
|
785
|
-
Read that task carefully. Your job is to:
|
|
786
|
-
1. Implement exactly what the task specifies
|
|
787
|
-
2. Write tests (following TDD if task says to)
|
|
788
|
-
3. Verify implementation works
|
|
789
|
-
4. Commit your work
|
|
790
|
-
5. Report back
|
|
791
|
-
|
|
792
|
-
Work from: [directory]
|
|
793
|
-
Report: What you implemented, what you tested, test results, files changed, any issues
|
|
794
|
-
```
|
|
795
|
-
|
|
796
|
-
### Parallel Investigation Subagent
|
|
797
|
-
|
|
798
|
-
```
|
|
799
|
-
Fix the 3 failing tests in [test-file]:
|
|
800
|
-
[Paste test names and error messages]
|
|
801
|
-
|
|
802
|
-
Your task:
|
|
803
|
-
1. Read the test file and understand what each test verifies
|
|
804
|
-
2. Identify root cause
|
|
805
|
-
3. Fix by: [strategy]
|
|
806
|
-
|
|
807
|
-
Do NOT [anti-pattern constraint]
|
|
808
|
-
Return: Summary of what you found and what you fixed.
|
|
809
|
-
```
|
|
810
|
-
|
|
811
|
-
### Fix Subagent
|
|
812
|
-
|
|
813
|
-
```
|
|
814
|
-
Fix issues from code review: [list issues]
|
|
815
|
-
Context: [what was just implemented]
|
|
816
|
-
Issues to fix:
|
|
817
|
-
1. [Issue with file:line]
|
|
818
|
-
2. [Issue with file:line]
|
|
819
|
-
|
|
820
|
-
Fix these issues and commit. Report what you changed.
|
|
821
|
-
```
|
|
822
|
-
|
|
823
|
-
### Code Reviewer Subagent
|
|
824
|
-
|
|
825
|
-
```
|
|
826
|
-
Review {WHAT_WAS_IMPLEMENTED}
|
|
827
|
-
Compare against {PLAN_OR_REQUIREMENTS}
|
|
828
|
-
Git range: {BASE_SHA}..{HEAD_SHA}
|
|
829
|
-
|
|
830
|
-
Output:
|
|
831
|
-
- Strengths (specific, with file:line)
|
|
832
|
-
- Issues (Critical/Important/Minor with file:line, why, how to fix)
|
|
833
|
-
- Recommendations
|
|
834
|
-
- Assessment (Ready to merge? Yes/No/With fixes + reasoning)
|
|
835
|
-
```
|
|
836
|
-
|
|
837
|
-
---
|
|
838
|
-
|
|
839
|
-
## 13. Context Pollution Prevention
|
|
840
|
-
|
|
841
|
-
**Problem:** Coordinator tries to fix subagent failures manually, polluting context with failed attempts.
|
|
842
|
-
|
|
843
|
-
**Solution:** Always dispatch fix subagent instead.
|
|
844
|
-
|
|
845
|
-
**Pattern:**
|
|
846
|
-
|
|
847
|
-
```
|
|
848
|
-
Subagent fails task → Review failure report → Dispatch fix subagent with:
|
|
849
|
-
- What failed
|
|
850
|
-
- Why it failed (from report)
|
|
851
|
-
- Specific fix instructions
|
|
852
|
-
- Constraints to prevent same failure
|
|
853
|
-
```
|
|
854
|
-
|
|
855
|
-
**Why it works:**
|
|
856
|
-
|
|
857
|
-
- Fix subagent has fresh context
|
|
858
|
-
- Coordinator maintains high-level coordination role
|
|
859
|
-
- No accumulated debugging cruft in coordinator context
|
|
860
|
-
- Parallel-safe (fix subagent doesn't interfere with other work)
|
|
861
|
-
|
|
862
|
-
---
|
|
863
|
-
|
|
864
|
-
## 14. File Reservation (Not in Source Docs)
|
|
865
|
-
|
|
866
|
-
**Note:** The analyzed skills don't mention file reservation, but this is a common coordination primitive for multi-agent systems.
|
|
867
|
-
|
|
868
|
-
**When it would apply:**
|
|
869
|
-
|
|
870
|
-
- Parallel agents editing potentially overlapping files
|
|
871
|
-
- Prevention of merge conflicts
|
|
872
|
-
- Coordination of shared state mutations
|
|
873
|
-
|
|
874
|
-
**Integration point:**
|
|
875
|
-
|
|
876
|
-
- Would fit in "Dispatching Parallel Agents" when agents might touch overlapping code
|
|
877
|
-
- Verification step: "Check for conflicts - Did agents edit same code?"
|
|
878
|
-
|
|
879
|
-
**For opencode-swarm-plugin:** Agent Mail has file reservation (`agentmail_reserve`, `agentmail_release`). This pattern could enhance parallel dispatch safety.
|
|
880
|
-
|
|
881
|
-
---
|
|
882
|
-
|
|
883
|
-
## END ANALYSIS
|
|
884
|
-
|
|
885
|
-
**Key takeaways for opencode-swarm-plugin:**
|
|
886
|
-
|
|
887
|
-
1. **Adopt fresh subagent per task** - Prevents context pollution, enables TDD naturally
|
|
888
|
-
2. **Mandatory code review between tasks** - Catches issues early, explicit severity tiers
|
|
889
|
-
3. **Parallelize at 3+ independent failures** - Clear heuristic for when to dispatch concurrent agents
|
|
890
|
-
4. **Focused agent prompts** - Self-contained, specific output, constraints prevent scope creep
|
|
891
|
-
5. **Never skip review because "it's simple"** - Simple tasks can have subtle issues
|
|
892
|
-
6. **Fix subagents instead of manual fixes** - Preserves coordinator context clarity
|
|
893
|
-
7. **Explicit severity tiers guide priority** - Critical blocks, Important before next task, Minor noted
|
|
894
|
-
8. **Same session vs parallel session** - Subagent-driven stays in session, executing-plans spawns parallel
|
|
895
|
-
|
|
896
|
-
**Patterns to integrate:**
|
|
897
|
-
|
|
898
|
-
- ✓ Fresh subagent per task (already in swarm worker pattern)
|
|
899
|
-
- ✓ Code review after each task (add to swarm_complete?)
|
|
900
|
-
- ✓ Parallel dispatch at 3+ failures (add to debug-plus command)
|
|
901
|
-
- ✓ Severity-based issue triage (integrate with UBS scan results)
|
|
902
|
-
- ✓ Fix subagent pattern (add to swarm toolkit)
|