opencode-swarm-plugin 0.44.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.
Files changed (205) hide show
  1. package/bin/swarm.serve.test.ts +6 -4
  2. package/bin/swarm.ts +16 -10
  3. package/dist/compaction-prompt-scoring.js +139 -0
  4. package/dist/eval-capture.js +12811 -0
  5. package/dist/hive.d.ts.map +1 -1
  6. package/dist/index.js +7644 -62599
  7. package/dist/plugin.js +23766 -78721
  8. package/dist/swarm-orchestrate.d.ts.map +1 -1
  9. package/dist/swarm-prompts.d.ts.map +1 -1
  10. package/dist/swarm-review.d.ts.map +1 -1
  11. package/package.json +17 -5
  12. package/.changeset/swarm-insights-data-layer.md +0 -63
  13. package/.hive/analysis/eval-failure-analysis-2025-12-25.md +0 -331
  14. package/.hive/analysis/session-data-quality-audit.md +0 -320
  15. package/.hive/eval-results.json +0 -483
  16. package/.hive/issues.jsonl +0 -138
  17. package/.hive/memories.jsonl +0 -729
  18. package/.opencode/eval-history.jsonl +0 -327
  19. package/.turbo/turbo-build.log +0 -9
  20. package/CHANGELOG.md +0 -2286
  21. package/SCORER-ANALYSIS.md +0 -598
  22. package/docs/analysis/subagent-coordination-patterns.md +0 -902
  23. package/docs/analysis-socratic-planner-pattern.md +0 -504
  24. package/docs/planning/ADR-001-monorepo-structure.md +0 -171
  25. package/docs/planning/ADR-002-package-extraction.md +0 -393
  26. package/docs/planning/ADR-003-performance-improvements.md +0 -451
  27. package/docs/planning/ADR-004-message-queue-features.md +0 -187
  28. package/docs/planning/ADR-005-devtools-observability.md +0 -202
  29. package/docs/planning/ADR-007-swarm-enhancements-worktree-review.md +0 -168
  30. package/docs/planning/ADR-008-worker-handoff-protocol.md +0 -293
  31. package/docs/planning/ADR-009-oh-my-opencode-patterns.md +0 -353
  32. package/docs/planning/ADR-010-cass-inhousing.md +0 -1215
  33. package/docs/planning/ROADMAP.md +0 -368
  34. package/docs/semantic-memory-cli-syntax.md +0 -123
  35. package/docs/swarm-mail-architecture.md +0 -1147
  36. package/docs/testing/context-recovery-test.md +0 -470
  37. package/evals/ARCHITECTURE.md +0 -1189
  38. package/evals/README.md +0 -768
  39. package/evals/compaction-prompt.eval.ts +0 -149
  40. package/evals/compaction-resumption.eval.ts +0 -289
  41. package/evals/coordinator-behavior.eval.ts +0 -307
  42. package/evals/coordinator-session.eval.ts +0 -154
  43. package/evals/evalite.config.ts.bak +0 -15
  44. package/evals/example.eval.ts +0 -31
  45. package/evals/fixtures/cass-baseline.ts +0 -217
  46. package/evals/fixtures/compaction-cases.ts +0 -350
  47. package/evals/fixtures/compaction-prompt-cases.ts +0 -311
  48. package/evals/fixtures/coordinator-sessions.ts +0 -328
  49. package/evals/fixtures/decomposition-cases.ts +0 -105
  50. package/evals/lib/compaction-loader.test.ts +0 -248
  51. package/evals/lib/compaction-loader.ts +0 -320
  52. package/evals/lib/data-loader.evalite-test.ts +0 -289
  53. package/evals/lib/data-loader.test.ts +0 -345
  54. package/evals/lib/data-loader.ts +0 -281
  55. package/evals/lib/llm.ts +0 -115
  56. package/evals/scorers/compaction-prompt-scorers.ts +0 -145
  57. package/evals/scorers/compaction-scorers.ts +0 -305
  58. package/evals/scorers/coordinator-discipline.evalite-test.ts +0 -539
  59. package/evals/scorers/coordinator-discipline.ts +0 -325
  60. package/evals/scorers/index.test.ts +0 -146
  61. package/evals/scorers/index.ts +0 -328
  62. package/evals/scorers/outcome-scorers.evalite-test.ts +0 -27
  63. package/evals/scorers/outcome-scorers.ts +0 -349
  64. package/evals/swarm-decomposition.eval.ts +0 -121
  65. package/examples/commands/swarm.md +0 -745
  66. package/examples/plugin-wrapper-template.ts +0 -2515
  67. package/examples/skills/hive-workflow/SKILL.md +0 -212
  68. package/examples/skills/skill-creator/SKILL.md +0 -223
  69. package/examples/skills/swarm-coordination/SKILL.md +0 -292
  70. package/global-skills/cli-builder/SKILL.md +0 -344
  71. package/global-skills/cli-builder/references/advanced-patterns.md +0 -244
  72. package/global-skills/learning-systems/SKILL.md +0 -644
  73. package/global-skills/skill-creator/LICENSE.txt +0 -202
  74. package/global-skills/skill-creator/SKILL.md +0 -352
  75. package/global-skills/skill-creator/references/output-patterns.md +0 -82
  76. package/global-skills/skill-creator/references/workflows.md +0 -28
  77. package/global-skills/swarm-coordination/SKILL.md +0 -995
  78. package/global-skills/swarm-coordination/references/coordinator-patterns.md +0 -235
  79. package/global-skills/swarm-coordination/references/strategies.md +0 -138
  80. package/global-skills/system-design/SKILL.md +0 -213
  81. package/global-skills/testing-patterns/SKILL.md +0 -430
  82. package/global-skills/testing-patterns/references/dependency-breaking-catalog.md +0 -586
  83. package/opencode-swarm-plugin-0.30.7.tgz +0 -0
  84. package/opencode-swarm-plugin-0.31.0.tgz +0 -0
  85. package/scripts/cleanup-test-memories.ts +0 -346
  86. package/scripts/init-skill.ts +0 -222
  87. package/scripts/migrate-unknown-sessions.ts +0 -349
  88. package/scripts/validate-skill.ts +0 -204
  89. package/src/agent-mail.ts +0 -1724
  90. package/src/anti-patterns.test.ts +0 -1167
  91. package/src/anti-patterns.ts +0 -448
  92. package/src/compaction-capture.integration.test.ts +0 -257
  93. package/src/compaction-hook.test.ts +0 -838
  94. package/src/compaction-hook.ts +0 -1204
  95. package/src/compaction-observability.integration.test.ts +0 -139
  96. package/src/compaction-observability.test.ts +0 -187
  97. package/src/compaction-observability.ts +0 -324
  98. package/src/compaction-prompt-scorers.test.ts +0 -475
  99. package/src/compaction-prompt-scoring.ts +0 -300
  100. package/src/contributor-tools.test.ts +0 -133
  101. package/src/contributor-tools.ts +0 -201
  102. package/src/dashboard.test.ts +0 -611
  103. package/src/dashboard.ts +0 -462
  104. package/src/error-enrichment.test.ts +0 -403
  105. package/src/error-enrichment.ts +0 -219
  106. package/src/eval-capture.test.ts +0 -1015
  107. package/src/eval-capture.ts +0 -929
  108. package/src/eval-gates.test.ts +0 -306
  109. package/src/eval-gates.ts +0 -218
  110. package/src/eval-history.test.ts +0 -508
  111. package/src/eval-history.ts +0 -214
  112. package/src/eval-learning.test.ts +0 -378
  113. package/src/eval-learning.ts +0 -360
  114. package/src/eval-runner.test.ts +0 -223
  115. package/src/eval-runner.ts +0 -402
  116. package/src/export-tools.test.ts +0 -476
  117. package/src/export-tools.ts +0 -257
  118. package/src/hive.integration.test.ts +0 -2241
  119. package/src/hive.ts +0 -1628
  120. package/src/index.ts +0 -940
  121. package/src/learning.integration.test.ts +0 -1815
  122. package/src/learning.ts +0 -1079
  123. package/src/logger.test.ts +0 -189
  124. package/src/logger.ts +0 -135
  125. package/src/mandate-promotion.test.ts +0 -473
  126. package/src/mandate-promotion.ts +0 -239
  127. package/src/mandate-storage.integration.test.ts +0 -601
  128. package/src/mandate-storage.test.ts +0 -578
  129. package/src/mandate-storage.ts +0 -794
  130. package/src/mandates.ts +0 -540
  131. package/src/memory-tools.test.ts +0 -195
  132. package/src/memory-tools.ts +0 -344
  133. package/src/memory.integration.test.ts +0 -334
  134. package/src/memory.test.ts +0 -158
  135. package/src/memory.ts +0 -527
  136. package/src/model-selection.test.ts +0 -188
  137. package/src/model-selection.ts +0 -68
  138. package/src/observability-tools.test.ts +0 -359
  139. package/src/observability-tools.ts +0 -871
  140. package/src/output-guardrails.test.ts +0 -438
  141. package/src/output-guardrails.ts +0 -381
  142. package/src/pattern-maturity.test.ts +0 -1160
  143. package/src/pattern-maturity.ts +0 -525
  144. package/src/planning-guardrails.test.ts +0 -491
  145. package/src/planning-guardrails.ts +0 -438
  146. package/src/plugin.ts +0 -23
  147. package/src/post-compaction-tracker.test.ts +0 -251
  148. package/src/post-compaction-tracker.ts +0 -237
  149. package/src/query-tools.test.ts +0 -636
  150. package/src/query-tools.ts +0 -324
  151. package/src/rate-limiter.integration.test.ts +0 -466
  152. package/src/rate-limiter.ts +0 -774
  153. package/src/replay-tools.test.ts +0 -496
  154. package/src/replay-tools.ts +0 -240
  155. package/src/repo-crawl.integration.test.ts +0 -441
  156. package/src/repo-crawl.ts +0 -610
  157. package/src/schemas/cell-events.test.ts +0 -347
  158. package/src/schemas/cell-events.ts +0 -807
  159. package/src/schemas/cell.ts +0 -257
  160. package/src/schemas/evaluation.ts +0 -166
  161. package/src/schemas/index.test.ts +0 -199
  162. package/src/schemas/index.ts +0 -286
  163. package/src/schemas/mandate.ts +0 -232
  164. package/src/schemas/swarm-context.ts +0 -115
  165. package/src/schemas/task.ts +0 -161
  166. package/src/schemas/worker-handoff.test.ts +0 -302
  167. package/src/schemas/worker-handoff.ts +0 -131
  168. package/src/sessions/agent-discovery.test.ts +0 -137
  169. package/src/sessions/agent-discovery.ts +0 -112
  170. package/src/sessions/index.ts +0 -15
  171. package/src/skills.integration.test.ts +0 -1192
  172. package/src/skills.test.ts +0 -643
  173. package/src/skills.ts +0 -1549
  174. package/src/storage.integration.test.ts +0 -341
  175. package/src/storage.ts +0 -884
  176. package/src/structured.integration.test.ts +0 -817
  177. package/src/structured.test.ts +0 -1046
  178. package/src/structured.ts +0 -762
  179. package/src/swarm-decompose.test.ts +0 -188
  180. package/src/swarm-decompose.ts +0 -1302
  181. package/src/swarm-deferred.integration.test.ts +0 -157
  182. package/src/swarm-deferred.test.ts +0 -38
  183. package/src/swarm-insights.test.ts +0 -214
  184. package/src/swarm-insights.ts +0 -459
  185. package/src/swarm-mail.integration.test.ts +0 -970
  186. package/src/swarm-mail.ts +0 -739
  187. package/src/swarm-orchestrate.integration.test.ts +0 -282
  188. package/src/swarm-orchestrate.test.ts +0 -548
  189. package/src/swarm-orchestrate.ts +0 -3084
  190. package/src/swarm-prompts.test.ts +0 -1270
  191. package/src/swarm-prompts.ts +0 -2077
  192. package/src/swarm-research.integration.test.ts +0 -701
  193. package/src/swarm-research.test.ts +0 -698
  194. package/src/swarm-research.ts +0 -472
  195. package/src/swarm-review.integration.test.ts +0 -285
  196. package/src/swarm-review.test.ts +0 -879
  197. package/src/swarm-review.ts +0 -709
  198. package/src/swarm-strategies.ts +0 -407
  199. package/src/swarm-worktree.test.ts +0 -501
  200. package/src/swarm-worktree.ts +0 -575
  201. package/src/swarm.integration.test.ts +0 -2377
  202. package/src/swarm.ts +0 -38
  203. package/src/tool-adapter.integration.test.ts +0 -1221
  204. package/src/tool-availability.ts +0 -461
  205. package/tsconfig.json +0 -28
@@ -1,504 +0,0 @@
1
- # Socratic Planner Pattern Analysis
2
-
3
- **Analysis Date:** 2025-12-13
4
- **Source:** obra/superpowers repo
5
- **Cell:** opencode-swarm-plugin-v737h.1
6
-
7
- ## Executive Summary
8
-
9
- The Socratic Planner is a two-phase workflow that transforms rough ideas into executable implementation plans through:
10
-
11
- 1. **Brainstorming** - Collaborative refinement using Socratic questioning
12
- 2. **Writing Plans** - Detailed task breakdown for engineers with zero context
13
-
14
- The pattern emphasizes **incremental validation**, **extreme granularity**, and **context-free execution**. It's designed to prevent premature commitment while ensuring execution clarity.
15
-
16
- ---
17
-
18
- ## Core Principles
19
-
20
- ### Brainstorming Phase
21
-
22
- 1. **One Question at a Time** - Never overwhelm with multiple questions in a single message. If a topic needs exploration, break it into sequential questions.
23
-
24
- 2. **Multiple Choice Preferred** - Easier for users to answer than open-ended when possible, but open-ended is fine when necessary.
25
-
26
- 3. **Project Context First** - Always check current state (files, docs, recent commits) before asking questions.
27
-
28
- 4. **Focus on Understanding** - Extract purpose, constraints, and success criteria before proposing solutions.
29
-
30
- 5. **Explore 2-3 Alternatives** - Always propose multiple approaches with trade-offs. Lead with your recommendation and explain why.
31
-
32
- 6. **Incremental Validation (200-300 Words)** - Present design in digestible sections, validate each section before continuing. Cover: architecture, components, data flow, error handling, testing.
33
-
34
- 7. **YAGNI Ruthlessly** - Remove unnecessary features from all designs. Don't build what you don't need.
35
-
36
- 8. **Be Flexible** - Go back and clarify when something doesn't make sense. The process is iterative.
37
-
38
- ### Writing Plans Phase
39
-
40
- 9. **Bite-Sized Tasks (2-5 Minutes Each)** - Each step is ONE action:
41
- - "Write the failing test" (step)
42
- - "Run it to make sure it fails" (step)
43
- - "Implement minimal code to pass" (step)
44
- - "Run tests to verify" (step)
45
- - "Commit" (step)
46
-
47
- 10. **Zero Context Assumption** - Write for a "junior engineer with poor taste, no judgment, no project context." Assume they're skilled but know nothing about your toolset or problem domain.
48
-
49
- 11. **Exact File Paths Always** - Never say "create a file" - say `exact/path/to/file.py`. Include line numbers for modifications: `existing.py:123-145`.
50
-
51
- 12. **Complete Code in Plans** - Don't say "add validation" - show the exact code to write.
52
-
53
- 13. **DRY, YAGNI, TDD** - Enforce these principles in every task. Test-first, minimal implementation, no duplication.
54
-
55
- 14. **Exact Commands with Expected Output** - Don't say "run tests" - say `pytest tests/path/test.py::test_name -v` and specify what "PASS" looks like.
56
-
57
- 15. **Frequent Commits** - Every task ends with a commit. Small, atomic changes.
58
-
59
- ---
60
-
61
- ## Anti-Patterns to Avoid
62
-
63
- ### Brainstorming Anti-Patterns
64
-
65
- ❌ **Multiple Questions per Message** - Overwhelms user, creates decision paralysis
66
- ✅ **One question, wait for answer, next question**
67
-
68
- ❌ **Proposing One Solution** - Forces user down a single path
69
- ✅ **2-3 alternatives with trade-offs, recommend one with reasoning**
70
-
71
- ❌ **Presenting Entire Design at Once** - User can't validate incrementally
72
- ✅ **200-300 word sections, check after each**
73
-
74
- ❌ **Building for Future Needs** - YAGNI violation
75
- ✅ **Ruthlessly strip unnecessary features**
76
-
77
- ❌ **Starting Questions Before Context** - Asking blind questions
78
- ✅ **Check files/docs/commits first, then ask informed questions**
79
-
80
- ### Writing Plans Anti-Patterns
81
-
82
- ❌ **Large Tasks** - "Build the auth system" (30+ minutes)
83
- ✅ **Bite-sized steps: "Write failing test for login" (2-5 min)**
84
-
85
- ❌ **Assuming Context** - "Update the auth flow" (which file?)
86
- ✅ **`src/auth/login.py:45-67` - exact path and lines**
87
-
88
- ❌ **Vague Instructions** - "Add error handling"
89
- ✅ **Complete try-catch block with specific exceptions**
90
-
91
- ❌ **Skipping Test Failures** - "Write test and implementation"
92
- ✅ **Step 1: Write test. Step 2: Run to verify FAIL. Step 3: Implement.**
93
-
94
- ❌ **Batch Commits** - "Commit all the auth changes"
95
- ✅ **Commit after each passing test**
96
-
97
- ❌ **Trusting Engineer's Taste** - "Style as appropriate"
98
- ✅ **Exact code, exact format, zero judgment calls**
99
-
100
- ---
101
-
102
- ## Implementation Details
103
-
104
- ### Brainstorming Workflow
105
-
106
- ```markdown
107
- Phase 1: Understanding the Idea
108
- ├─ Check project state (files, docs, commits)
109
- ├─ Ask questions one at a time
110
- ├─ Prefer multiple choice when possible
111
- └─ Focus: purpose, constraints, success criteria
112
-
113
- Phase 2: Exploring Approaches
114
- ├─ Propose 2-3 different approaches
115
- ├─ Present trade-offs for each
116
- ├─ Lead with recommendation + reasoning
117
- └─ Wait for user decision
118
-
119
- Phase 3: Presenting the Design
120
- ├─ Break into 200-300 word sections
121
- ├─ Ask "Does this look right so far?" after each
122
- ├─ Cover: architecture, components, data flow, errors, testing
123
- └─ Be ready to backtrack and clarify
124
-
125
- Phase 4: Documentation
126
- ├─ Save to: docs/plans/YYYY-MM-DD-<topic>-design.md
127
- ├─ Use elements-of-style:writing-clearly-and-concisely (if available)
128
- └─ Commit the design document
129
-
130
- Phase 5: Implementation Setup (if continuing)
131
- ├─ Ask: "Ready to set up for implementation?"
132
- ├─ Use superpowers:using-git-worktrees (create isolated workspace)
133
- └─ Use superpowers:writing-plans (create detailed plan)
134
- ```
135
-
136
- ### Writing Plans Workflow
137
-
138
- ```markdown
139
- Setup
140
- ├─ Run in dedicated worktree (created by brainstorming)
141
- └─ Announce: "I'm using the writing-plans skill..."
142
-
143
- Plan Structure
144
- ├─ Header (REQUIRED format - see below)
145
- ├─ Task 1: [Component Name]
146
- │ ├─ Files: (Create/Modify/Test with exact paths)
147
- │ ├─ Step 1: Write failing test (with code)
148
- │ ├─ Step 2: Run test, verify FAIL (exact command + expected output)
149
- │ ├─ Step 3: Write minimal implementation (with code)
150
- │ ├─ Step 4: Run test, verify PASS (exact command)
151
- │ └─ Step 5: Commit (exact git commands)
152
- ├─ Task 2: [Component Name]
153
- │ └─ (same structure)
154
- └─ ...
155
-
156
- Save
157
- └─ docs/plans/YYYY-MM-DD-<feature-name>.md
158
-
159
- Handoff
160
- ├─ Offer execution choice:
161
- │ ├─ Option 1: Subagent-Driven (this session)
162
- │ │ └─ Use superpowers:subagent-driven-development
163
- │ └─ Option 2: Parallel Session (separate)
164
- │ └─ Use superpowers:executing-plans
165
- ```
166
-
167
- ### Required Plan Header Format
168
-
169
- Every plan MUST start with this exact header:
170
-
171
- ```markdown
172
- # [Feature Name] Implementation Plan
173
-
174
- > **For Claude:** REQUIRED SUB-SKILL: Use superpowers:executing-plans to implement this plan task-by-task.
175
-
176
- **Goal:** [One sentence describing what this builds]
177
-
178
- **Architecture:** [2-3 sentences about approach]
179
-
180
- **Tech Stack:** [Key technologies/libraries]
181
-
182
- ---
183
- ```
184
-
185
- ### Task Structure Template
186
-
187
- ````markdown
188
- ### Task N: [Component Name]
189
-
190
- **Files:**
191
-
192
- - Create: `exact/path/to/file.py`
193
- - Modify: `exact/path/to/existing.py:123-145`
194
- - Test: `tests/exact/path/to/test.py`
195
-
196
- **Step 1: Write the failing test**
197
-
198
- ```python
199
- def test_specific_behavior():
200
- result = function(input)
201
- assert result == expected
202
- ```
203
- ````
204
-
205
- **Step 2: Run test to verify it fails**
206
-
207
- Run: `pytest tests/path/test.py::test_name -v`
208
- Expected: FAIL with "function not defined"
209
-
210
- **Step 3: Write minimal implementation**
211
-
212
- ```python
213
- def function(input):
214
- return expected
215
- ```
216
-
217
- **Step 4: Run test to verify it passes**
218
-
219
- Run: `pytest tests/path/test.py::test_name -v`
220
- Expected: PASS
221
-
222
- **Step 5: Commit**
223
-
224
- ```bash
225
- git add tests/path/test.py src/path/file.py
226
- git commit -m "feat: add specific feature"
227
- ```
228
-
229
- ```
230
-
231
- ---
232
-
233
- ## How the Two Skills Integrate
234
-
235
- ### Skill Handoff Flow
236
-
237
- ```
238
-
239
- User: "I want to build X"
240
-
241
- [Brainstorming Skill]
242
- ├─ Understand idea (Socratic questions)
243
- ├─ Explore approaches (2-3 alternatives)
244
- ├─ Present design (200-300 word sections)
245
- └─ Save design doc (docs/plans/YYYY-MM-DD-X-design.md)
246
-
247
- "Ready to set up for implementation?"
248
-
249
- [Using Git Worktrees Skill]
250
- └─ Create isolated workspace
251
-
252
- [Writing Plans Skill]
253
- ├─ Break design into bite-sized tasks
254
- ├─ Exact paths, complete code, exact commands
255
- └─ Save plan (docs/plans/YYYY-MM-DD-X.md)
256
-
257
- "Two execution options: Subagent-Driven or Parallel Session?"
258
-
259
- ┌─────────────────────┬─────────────────────┐
260
- │ Subagent-Driven │ Parallel Session │
261
- │ (same session) │ (separate session) │
262
- ├─────────────────────┼─────────────────────┤
263
- │ [Subagent-Driven- │ [Executing-Plans │
264
- │ Development] │ Skill] │
265
- │ ├─ Fresh subagent │ ├─ Load plan │
266
- │ │ per task │ ├─ Review critically│
267
- │ ├─ Code review │ ├─ Execute in │
268
- │ │ after each │ │ batches (3 tasks)│
269
- │ └─ Fast iteration │ ├─ Report for review│
270
- │ │ └─ Continue batches │
271
- └─────────────────────┴─────────────────────┘
272
-
273
- [Finishing-a-Development-Branch Skill]
274
- └─ Verify tests, present merge options
275
-
276
- ```
277
-
278
- ### Context Preservation Strategy
279
-
280
- The two-phase split serves a critical purpose:
281
-
282
- 1. **Brainstorming keeps context lean** - 200-300 word validation checkpoints prevent bloat
283
- 2. **Plans are context-free** - Engineer doesn't need the brainstorming conversation
284
- 3. **Plans are reusable** - Can be executed by different agents in different sessions
285
- 4. **Incremental validation prevents rework** - Catch design issues before implementation
286
-
287
- ### When NOT to Use This Pattern
288
-
289
- From the brainstorming skill description:
290
-
291
- > "Don't use during clear 'mechanical' processes"
292
-
293
- Skip brainstorming when:
294
- - Task is purely mechanical (updating dependencies, formatting code)
295
- - Requirements are completely clear and unambiguous
296
- - No design decisions needed (just execution)
297
-
298
- ---
299
-
300
- ## Key Quotes Worth Preserving
301
-
302
- ### On Task Granularity
303
-
304
- > "Assume they are a skilled developer, but know almost nothing about our toolset or problem domain. Assume they don't know good test design very well."
305
-
306
- > "Each step is one action (2-5 minutes): 'Write the failing test' - step. 'Run it to make sure it fails' - step."
307
-
308
- ### On Context Assumptions
309
-
310
- > "Write comprehensive implementation plans assuming the engineer has zero context for our codebase and questionable taste."
311
-
312
- > "Document everything they need to know: which files to touch for each task, code, testing, docs they might need to check, how to test it."
313
-
314
- ### On Incremental Validation
315
-
316
- > "Break it into sections of 200-300 words. Ask after each section whether it looks right so far."
317
-
318
- > "Be ready to go back and clarify if something doesn't make sense."
319
-
320
- ### On Question Design
321
-
322
- > "Ask questions one at a time to refine the idea. Prefer multiple choice questions when possible, but open-ended is fine too."
323
-
324
- > "Only one question per message - if a topic needs more exploration, break it into multiple questions."
325
-
326
- ### On Alternative Exploration
327
-
328
- > "Propose 2-3 different approaches with trade-offs. Present options conversationally with your recommendation and reasoning. Lead with your recommended option and explain why."
329
-
330
- ### On Specificity in Plans
331
-
332
- > "Exact file paths always. Complete code in plan (not 'add validation'). Exact commands with expected output."
333
-
334
- ---
335
-
336
- ## Execution Handoff Options
337
-
338
- After plan creation, the pattern offers two execution modes:
339
-
340
- ### Option 1: Subagent-Driven Development (Same Session)
341
-
342
- **Characteristics:**
343
- - Stay in current session
344
- - Fresh subagent per task (no context pollution)
345
- - Code review after each task (catch issues early)
346
- - Faster iteration (no human-in-loop between tasks)
347
-
348
- **When to use:**
349
- - Tasks are mostly independent
350
- - Want continuous progress with quality gates
351
- - Need fast iteration
352
-
353
- **Process:**
354
- 1. Load plan, create TodoWrite
355
- 2. For each task:
356
- - Dispatch implementation subagent
357
- - Dispatch code-reviewer subagent
358
- - Fix issues from review
359
- - Mark complete
360
- 3. Final review of entire implementation
361
- 4. Use finishing-a-development-branch skill
362
-
363
- ### Option 2: Executing Plans (Parallel Session)
364
-
365
- **Characteristics:**
366
- - Open new session in worktree
367
- - Batch execution (default: 3 tasks per batch)
368
- - Human review between batches
369
- - Architect oversight at checkpoints
370
-
371
- **When to use:**
372
- - Need to review plan first
373
- - Tasks are tightly coupled
374
- - Want explicit approval between batches
375
-
376
- **Process:**
377
- 1. Load plan, review critically
378
- 2. Execute batch (3 tasks)
379
- 3. Report for feedback
380
- 4. Apply changes if needed
381
- 5. Continue next batch
382
- 6. Use finishing-a-development-branch skill
383
-
384
- ---
385
-
386
- ## Integration with Other Skills
387
-
388
- ### Required Skills (Hard Dependencies)
389
-
390
- **Brainstorming uses:**
391
- - `elements-of-style:writing-clearly-and-concisely` (if available) - for design docs
392
- - `superpowers:using-git-worktrees` (REQUIRED) - create isolated workspace
393
- - `superpowers:writing-plans` (REQUIRED) - create implementation plan
394
-
395
- **Writing Plans uses:**
396
- - Referenced skills with `@syntax` - embedded in plan steps
397
-
398
- **Execution skills use:**
399
- - `superpowers:finishing-a-development-branch` (REQUIRED) - both execution paths
400
-
401
- **Subagent-Driven Development uses:**
402
- - `superpowers:requesting-code-review` (REQUIRED) - review template
403
- - `superpowers:test-driven-development` - subagents follow TDD
404
-
405
- ### Optional Skills
406
-
407
- Plans can reference any skill using `@skill-name` syntax. The engineer executing the plan will load and use those skills as needed.
408
-
409
- ---
410
-
411
- ## Pattern Maturity Assessment
412
-
413
- **Evidence for "Proven" status:**
414
-
415
- 1. **Clear success criteria** - Bite-sized tasks (2-5 min) are measurable
416
- 2. **Incremental validation** - 200-300 word sections prevent big-bang failures
417
- 3. **Context-free execution** - Plans work across agents/sessions
418
- 4. **Quality gates** - Code review after each task (subagent-driven) or batch (parallel)
419
- 5. **TDD enforcement** - Every task follows red-green-refactor
420
-
421
- **Potential weaknesses:**
422
-
423
- 1. **Context switch cost** - Two-phase approach requires handoff overhead
424
- 2. **Over-specification** - "Zero context" assumption may create verbose plans
425
- 3. **Execution rigidity** - 2-5 minute granularity may not fit all domains
426
-
427
- **Overall:** This is a **proven pattern** for transforming ideas into implementation. The incremental validation and extreme task granularity prevent the most common failure modes (premature commitment, vague requirements, context loss).
428
-
429
- ---
430
-
431
- ## Comparison with OpenCode Swarm
432
-
433
- ### Similarities
434
-
435
- - Both break work into small, parallelizable tasks
436
- - Both use file reservations to prevent conflicts
437
- - Both emphasize quality gates (UBS scan, code review)
438
- - Both support parallel execution
439
-
440
- ### Differences
441
-
442
- | Aspect | Socratic Planner | OpenCode Swarm |
443
- |--------|------------------|----------------|
444
- | **Decomposition** | Manual (Socratic questions) | Automated (LLM + CASS) |
445
- | **Task size** | 2-5 minutes (extreme granularity) | Varies (file/feature/risk-based) |
446
- | **Context assumption** | Zero context | Shared context via Agent Mail |
447
- | **Execution** | Sequential with reviews | Parallel with coordination |
448
- | **Learning** | Implicit (through review) | Explicit (outcome tracking) |
449
- | **Best for** | Novel features, design-heavy | Known patterns, scale work |
450
-
451
- ### Integration Opportunities
452
-
453
- 1. **Use Socratic for decomposition** - Replace swarm_decompose with brainstorming skill for complex features
454
- 2. **Use swarm for execution** - Execute writing-plans output via swarm workers instead of subagent-driven
455
- 3. **Hybrid approach** - Brainstorm → writing-plans → swarm_spawn_subtask (combine best of both)
456
-
457
- ---
458
-
459
- ## Recommendations
460
-
461
- ### For OpenCode Swarm Plugin
462
-
463
- 1. **Add brainstorming mode to swarm_decompose** - Offer interactive Socratic questioning for complex tasks
464
- 2. **Enforce 2-5 minute task granularity** - Add validation in swarm_validate_decomposition
465
- 3. **Steal "zero context" principle** - Worker prompts should assume no codebase knowledge
466
- 4. **Add incremental validation** - Option to validate decomposition in chunks (not all-at-once)
467
-
468
- ### For Skills Library
469
-
470
- 1. **Port brainstorming skill** - Generalize for OpenCode (remove superpowers-specific refs)
471
- 2. **Port writing-plans skill** - Adapt for OpenCode execution model
472
- 3. **Create hybrid skill** - Combine Socratic decomposition with swarm execution
473
-
474
- ### For Learning System
475
-
476
- Track these metrics from Socratic-style decompositions:
477
- - **Question count to understanding** - How many questions before design phase?
478
- - **Section validation failures** - Which sections needed rework?
479
- - **Task size drift** - Are tasks staying in 2-5 min range?
480
- - **Context assumptions** - Did engineer have to guess? (signals under-specification)
481
-
482
- ---
483
-
484
- ## Appendix: File Locations
485
-
486
- **Analyzed files:**
487
- - `skills/brainstorming/SKILL.md`
488
- - `skills/writing-plans/SKILL.md`
489
- - `skills/executing-plans/SKILL.md`
490
- - `skills/subagent-driven-development/SKILL.md`
491
- - `skills/using-git-worktrees/SKILL.md`
492
- - `commands/brainstorm.md`
493
- - `commands/write-plan.md`
494
-
495
- **Related skills not analyzed (referenced but not deep-dived):**
496
- - `skills/elements-of-style/writing-clearly-and-concisely/SKILL.md`
497
- - `skills/finishing-a-development-branch/SKILL.md`
498
- - `skills/requesting-code-review/code-reviewer.md`
499
- - `skills/test-driven-development/SKILL.md`
500
-
501
- ---
502
-
503
- **End of Analysis**
504
- ```
@@ -1,171 +0,0 @@
1
- # ADR-001: Monorepo Structure with Turborepo and Bun
2
-
3
- ## Status
4
-
5
- Proposed
6
-
7
- ## Context
8
-
9
- The opencode-swarm-plugin is currently a single-package TypeScript project. We need to extract the Swarm Mail actor-model primitives into a standalone package that can be:
10
-
11
- 1. Published independently to npm for use in other projects
12
- 2. Maintained with proper versioning and changelogs
13
- 3. Developed alongside the OpenCode plugin without tight coupling
14
- 4. Tested and built independently
15
-
16
- Research into modern monorepo solutions shows Turborepo + Bun provides:
17
-
18
- - Full compatibility (package-manager agnostic)
19
- - High-performance caching and incremental builds
20
- - Proven at scale (Vercel, PGLite's 9-package monorepo)
21
- - Excellent TypeScript support
22
- - Changesets integration for publishing
23
-
24
- Alternative considered: pnpm workspaces alone (rejected due to lack of task orchestration and caching).
25
-
26
- ## Decision
27
-
28
- Adopt a Turborepo + Bun monorepo structure with:
29
-
30
- ```
31
- opencode-swarm-plugin/
32
- ├── packages/
33
- │ └── swarm-mail/ # ~3K lines - Actor-model primitives
34
- │ ├── src/
35
- │ │ ├── streams/ # Event sourcing, projections, store
36
- │ │ ├── agent-mail.ts # High-level API
37
- │ │ └── index.ts
38
- │ ├── package.json # Independent versioning, published as "swarm-mail"
39
- │ └── tsconfig.json
40
- ├── src/ # opencode-swarm-plugin source (stays at root)
41
- │ ├── beads.ts
42
- │ ├── swarm-*.ts
43
- │ └── plugin.ts
44
- ├── apps/
45
- │ └── devtools/ # Future: SvelteKit DevTools UI
46
- ├── turbo.json # Task pipeline definitions
47
- ├── package.json # Root = opencode-swarm-plugin, depends on swarm-mail
48
- └── .changeset/ # Publishing workflow
49
- ```
50
-
51
- **Package naming:**
52
-
53
- - `swarm-mail` - Standalone actor-model library (npm: `swarm-mail`)
54
- - `opencode-swarm-plugin` - OpenCode integration (npm: `opencode-swarm-plugin`, depends on swarm-mail)
55
-
56
- Note: `swarm-mail` is intentionally agnostic of OpenCode - it's a general-purpose actor-model library that can be used in any TypeScript project.
57
-
58
- **Workspace dependencies:**
59
-
60
- ```json
61
- {
62
- "dependencies": {
63
- "swarm-mail": "workspace:*"
64
- }
65
- }
66
- ```
67
-
68
- **Task pipeline (turbo.json):**
69
-
70
- ```json
71
- {
72
- "pipeline": {
73
- "build": {
74
- "dependsOn": ["^build"],
75
- "outputs": ["dist/**"]
76
- },
77
- "test": {
78
- "dependsOn": ["^build"]
79
- },
80
- "typecheck": {
81
- "dependsOn": ["^build"]
82
- }
83
- }
84
- }
85
- ```
86
-
87
- **Publishing workflow:**
88
-
89
- - Changesets for version management
90
- - Independent versioning per package
91
- - Automated changelog generation
92
- - CI/CD integration for npm publish
93
-
94
- ## Consequences
95
-
96
- ### Easier
97
-
98
- - **Independent publishing** - `swarm-mail` can be used in any TypeScript project
99
- - **Clear boundaries** - Separation forces clean API design
100
- - **Parallel development** - Teams can work on packages independently
101
- - **Incremental builds** - Turborepo caches unchanged packages
102
- - **Type safety** - TypeScript project references ensure compile order
103
- - **Versioning** - Changesets tracks breaking changes per package
104
-
105
- ### More Difficult
106
-
107
- - **Initial migration** - ~2-3 days to restructure existing code
108
- - **Breaking changes** - Extracting swarm-mail may reveal tight coupling
109
- - **Circular dependencies** - Must carefully design package boundaries
110
- - **Version conflicts** - Workspace deps must align across packages
111
- - **Build complexity** - More moving parts (mitigated by Turborepo automation)
112
- - **Learning curve** - Team must learn Turborepo conventions
113
-
114
- ### Risks & Mitigations
115
-
116
- | Risk | Impact | Mitigation |
117
- | ---------------------------------- | ------ | ------------------------------------------------ |
118
- | Breaking changes during extraction | High | Feature branch, comprehensive test suite |
119
- | Circular dependencies | High | Use dependency-cruiser to detect cycles |
120
- | Version conflicts | Medium | Pin shared deps in root package.json |
121
- | Build failures in CI | Medium | Turborepo remote caching, isolated test runs |
122
- | Overcomplicated structure | Low | Start with 2 packages, add more only when needed |
123
-
124
- ## Implementation Notes
125
-
126
- ### Phase 1: Initial Setup (Day 1)
127
-
128
- 1. Install Turborepo and configure turbo.json
129
- 2. Create packages/@swarm/mail and packages/@swarm/plugin directories
130
- 3. Set up workspace dependencies in root package.json
131
- 4. Configure TypeScript project references
132
-
133
- ### Phase 2: Extract swarm-mail (Day 2-3)
134
-
135
- 1. Move src/streams/\* to packages/swarm-mail/src/streams/
136
- 2. Move agent-mail.ts, swarm-mail.ts to swarm-mail
137
- 3. Update imports in opencode-swarm-plugin to use swarm-mail
138
- 4. Run typecheck and fix breaking changes
139
- 5. Migrate integration tests
140
-
141
- ### Phase 3: CI/CD (Day 4)
142
-
143
- 1. Update GitHub Actions to use `turbo run build test`
144
- 2. Configure Changesets for publishing
145
- 3. Add pre-commit hooks for type checking
146
- 4. Document publishing workflow in CONTRIBUTING.md
147
-
148
- ### Phase 4: Documentation (Day 5)
149
-
150
- 1. Write swarm-mail README with API examples
151
- 2. Create migration guide for existing users
152
- 3. Add inline JSDoc comments for public API
153
- 4. Generate TypeDoc API reference
154
-
155
- ### Success Criteria
156
-
157
- - [ ] `bun run build` builds both packages in correct order
158
- - [ ] `bun run test` passes all tests in isolation
159
- - [ ] opencode-swarm-plugin can import from swarm-mail without errors
160
- - [ ] Changesets generates valid changelog entries
161
- - [ ] CI builds complete in <2 minutes (with caching)
162
- - [ ] Published swarm-mail package works in standalone project
163
-
164
- ### Reference Implementation
165
-
166
- PGLite monorepo structure: https://github.com/electric-sql/pglite
167
-
168
- - 9 packages with scoped naming (@electric-sql/\*)
169
- - workspace:\* dependencies
170
- - Changesets publishing workflow
171
- - Independent versioning per package