opencodekit 0.21.10 → 0.23.0

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 (213) hide show
  1. package/README.md +1 -1
  2. package/dist/index.js +4 -25
  3. package/dist/template/.opencode/.template-manifest.json +115 -188
  4. package/dist/template/.opencode/AGENTS.md +127 -484
  5. package/dist/template/.opencode/README.md +2 -2
  6. package/dist/template/.opencode/agent/build.md +158 -356
  7. package/dist/template/.opencode/agent/explore.md +0 -1
  8. package/dist/template/.opencode/agent/plan.md +7 -16
  9. package/dist/template/.opencode/agent/review.md +0 -1
  10. package/dist/template/.opencode/agent/scout.md +2 -3
  11. package/dist/template/.opencode/agent/vision.md +0 -1
  12. package/dist/template/.opencode/artifacts/.active +1 -0
  13. package/dist/template/.opencode/artifacts/example/plan.md +12 -0
  14. package/dist/template/.opencode/artifacts/example/progress.md +4 -0
  15. package/dist/template/.opencode/artifacts/example/research.md +4 -0
  16. package/dist/template/.opencode/artifacts/example/spec.md +16 -0
  17. package/dist/template/.opencode/artifacts/todo.md +5 -0
  18. package/dist/template/.opencode/artifacts/verify.log +4 -0
  19. package/dist/template/.opencode/command/clarify.md +46 -0
  20. package/dist/template/.opencode/command/commit.md +53 -0
  21. package/dist/template/.opencode/command/create.md +29 -71
  22. package/dist/template/.opencode/command/design.md +1 -2
  23. package/dist/template/.opencode/command/explore.md +3 -4
  24. package/dist/template/.opencode/command/fix.md +55 -0
  25. package/dist/template/.opencode/command/improve-architecture.md +55 -0
  26. package/dist/template/.opencode/command/init.md +86 -69
  27. package/dist/template/.opencode/command/plan.md +30 -60
  28. package/dist/template/.opencode/command/pr.md +10 -28
  29. package/dist/template/.opencode/command/refactor.md +65 -0
  30. package/dist/template/.opencode/command/research.md +7 -29
  31. package/dist/template/.opencode/command/review-codebase.md +6 -13
  32. package/dist/template/.opencode/command/ship.md +136 -78
  33. package/dist/template/.opencode/command/test.md +66 -0
  34. package/dist/template/.opencode/command/ui-review.md +2 -4
  35. package/dist/template/.opencode/command/verify.md +15 -23
  36. package/dist/template/.opencode/dcp.jsonc +96 -85
  37. package/dist/template/.opencode/memory/README.md +4 -6
  38. package/dist/template/.opencode/memory/_templates/adr.md +45 -0
  39. package/dist/template/.opencode/memory/_templates/prd.md +1 -1
  40. package/dist/template/.opencode/memory/_templates/roadmap.md +1 -1
  41. package/dist/template/.opencode/memory/_templates/state.md +1 -1
  42. package/dist/template/.opencode/memory/project/gotchas.md +4 -4
  43. package/dist/template/.opencode/memory/project/project.md +2 -2
  44. package/dist/template/.opencode/memory/project/roadmap.md +1 -1
  45. package/dist/template/.opencode/memory/project/state.md +2 -2
  46. package/dist/template/.opencode/memory/project/tech-stack.md +2 -2
  47. package/dist/template/.opencode/memory/session-context.md +1 -1
  48. package/dist/template/.opencode/opencode.json +14 -152
  49. package/dist/template/.opencode/plugin/README.md +2 -2
  50. package/dist/template/.opencode/plugin/guard.ts +62 -0
  51. package/dist/template/.opencode/plugin/{lib/memory-admin-tools.ts → memory/admin.ts} +4 -4
  52. package/dist/template/.opencode/plugin/{lib → memory}/capture.ts +1 -1
  53. package/dist/template/.opencode/plugin/{lib → memory}/compile.ts +2 -2
  54. package/dist/template/.opencode/plugin/{lib → memory}/context.ts +1 -1
  55. package/dist/template/.opencode/plugin/{lib → memory}/curator.ts +1 -1
  56. package/dist/template/.opencode/plugin/{lib → memory}/db/observations.ts +102 -3
  57. package/dist/template/.opencode/plugin/{lib → memory}/db/schema.ts +43 -1
  58. package/dist/template/.opencode/plugin/{lib → memory}/db/types.ts +22 -0
  59. package/dist/template/.opencode/plugin/{lib/memory-db.ts → memory/db.ts} +1 -1
  60. package/dist/template/.opencode/plugin/{lib → memory}/distill.ts +1 -1
  61. package/dist/template/.opencode/plugin/{lib/memory-helpers.ts → memory/helpers.ts} +5 -1
  62. package/dist/template/.opencode/plugin/{lib/memory-hooks.ts → memory/hooks.ts} +1 -1
  63. package/dist/template/.opencode/plugin/{lib → memory}/index-generator.ts +2 -2
  64. package/dist/template/.opencode/plugin/{lib → memory}/inject.ts +1 -1
  65. package/dist/template/.opencode/plugin/{lib → memory}/lint.ts +2 -2
  66. package/dist/template/.opencode/plugin/memory/tools.ts +322 -0
  67. package/dist/template/.opencode/plugin/{lib → memory}/validate.ts +2 -2
  68. package/dist/template/.opencode/plugin/memory.ts +7 -17
  69. package/dist/template/.opencode/plugin/srcwalk.ts +721 -0
  70. package/dist/template/.opencode/skill/agent-code-quality-gate/SKILL.md +98 -0
  71. package/dist/template/.opencode/skill/behavioral-kernel/SKILL.md +52 -0
  72. package/dist/template/.opencode/skill/brainstorming/SKILL.md +1 -1
  73. package/dist/template/.opencode/skill/browser-testing-with-devtools/SKILL.md +85 -0
  74. package/dist/template/.opencode/skill/code-cleanup/SKILL.md +114 -0
  75. package/dist/template/.opencode/skill/code-navigation/SKILL.md +142 -0
  76. package/dist/template/.opencode/skill/code-review-and-quality/SKILL.md +131 -0
  77. package/dist/template/.opencode/skill/context-engineering/SKILL.md +1 -1
  78. package/dist/template/.opencode/skill/debugging-and-error-recovery/SKILL.md +109 -0
  79. package/dist/template/.opencode/skill/deep-module-design/SKILL.md +207 -0
  80. package/dist/template/.opencode/skill/development-lifecycle/SKILL.md +26 -45
  81. package/dist/template/.opencode/skill/gemini-large-context/SKILL.md +4 -4
  82. package/dist/template/.opencode/skill/git-workflow-and-versioning/SKILL.md +77 -0
  83. package/dist/template/.opencode/skill/grill-me/SKILL.md +140 -0
  84. package/dist/template/.opencode/skill/memory-system/SKILL.md +9 -10
  85. package/dist/template/.opencode/skill/opensrc/references/example-workflow.md +1 -1
  86. package/dist/template/.opencode/skill/planning-and-task-breakdown/SKILL.md +116 -0
  87. package/dist/template/.opencode/skill/shipping-and-launch/SKILL.md +95 -0
  88. package/dist/template/.opencode/skill/source-driven-development/SKILL.md +103 -0
  89. package/dist/template/.opencode/skill/spec-driven-development/SKILL.md +121 -0
  90. package/dist/template/.opencode/skill/srcwalk/SKILL.md +161 -0
  91. package/dist/template/.opencode/skill/subagent-driven-development/SKILL.md +1 -1
  92. package/dist/template/.opencode/skill/ubiquitous-language/SKILL.md +184 -0
  93. package/dist/template/.opencode/skill/using-git-worktrees/SKILL.md +6 -6
  94. package/dist/template/.opencode/skill/verification-before-completion/SKILL.md +6 -6
  95. package/dist/template/.opencode/skill/verification-before-completion/references/VERIFICATION_PROTOCOL.md +5 -5
  96. package/package.json +76 -76
  97. package/dist/template/.opencode/AGENT_ALIGNMENT.md +0 -564
  98. package/dist/template/.opencode/agent/painter.md +0 -83
  99. package/dist/template/.opencode/command/compound.md +0 -240
  100. package/dist/template/.opencode/command/curate.md +0 -299
  101. package/dist/template/.opencode/command/handoff.md +0 -149
  102. package/dist/template/.opencode/command/health.md +0 -356
  103. package/dist/template/.opencode/command/init-context.md +0 -297
  104. package/dist/template/.opencode/command/init-user.md +0 -125
  105. package/dist/template/.opencode/command/iterate.md +0 -200
  106. package/dist/template/.opencode/command/lfg.md +0 -173
  107. package/dist/template/.opencode/command/resume.md +0 -78
  108. package/dist/template/.opencode/command/status.md +0 -126
  109. package/dist/template/.opencode/command/ui-slop-check.md +0 -169
  110. package/dist/template/.opencode/plans/1768385996691-silent-wizard.md +0 -247
  111. package/dist/template/.opencode/plans/1770006237537-mighty-otter.md +0 -418
  112. package/dist/template/.opencode/plans/1770006913647-glowing-forest.md +0 -170
  113. package/dist/template/.opencode/plans/1770013678126-witty-planet.md +0 -278
  114. package/dist/template/.opencode/plans/1770112267595-shiny-rocket.md +0 -258
  115. package/dist/template/.opencode/plans/swarm-protocol.md +0 -123
  116. package/dist/template/.opencode/plugin/lib/memory-tools.ts +0 -535
  117. package/dist/template/.opencode/skill/agent-evals/SKILL.md +0 -208
  118. package/dist/template/.opencode/skill/anti-ai-slop/SKILL.md +0 -76
  119. package/dist/template/.opencode/skill/augment-context-engine/SKILL.md +0 -122
  120. package/dist/template/.opencode/skill/augment-context-engine/mcp.json +0 -6
  121. package/dist/template/.opencode/skill/beads/SKILL.md +0 -182
  122. package/dist/template/.opencode/skill/beads/references/BEST_PRACTICES.md +0 -27
  123. package/dist/template/.opencode/skill/beads/references/BOUNDARIES.md +0 -219
  124. package/dist/template/.opencode/skill/beads/references/DEPENDENCIES.md +0 -124
  125. package/dist/template/.opencode/skill/beads/references/EXAMPLES.md +0 -45
  126. package/dist/template/.opencode/skill/beads/references/FILE_CLAIMING.md +0 -101
  127. package/dist/template/.opencode/skill/beads/references/GIT_SYNC.md +0 -25
  128. package/dist/template/.opencode/skill/beads/references/HIERARCHY.md +0 -71
  129. package/dist/template/.opencode/skill/beads/references/MULTI_AGENT.md +0 -40
  130. package/dist/template/.opencode/skill/beads/references/RESUMABILITY.md +0 -177
  131. package/dist/template/.opencode/skill/beads/references/SESSION_PROTOCOL.md +0 -61
  132. package/dist/template/.opencode/skill/beads/references/TASK_CREATION.md +0 -38
  133. package/dist/template/.opencode/skill/beads/references/TROUBLESHOOTING.md +0 -38
  134. package/dist/template/.opencode/skill/beads/references/WORKFLOWS.md +0 -226
  135. package/dist/template/.opencode/skill/brand-asset-protocol/SKILL.md +0 -222
  136. package/dist/template/.opencode/skill/code-search-patterns/SKILL.md +0 -224
  137. package/dist/template/.opencode/skill/code-simplification/SKILL.md +0 -211
  138. package/dist/template/.opencode/skill/context-condensation/SKILL.md +0 -149
  139. package/dist/template/.opencode/skill/context-initialization/SKILL.md +0 -69
  140. package/dist/template/.opencode/skill/context-management/SKILL.md +0 -390
  141. package/dist/template/.opencode/skill/deep-research/SKILL.md +0 -384
  142. package/dist/template/.opencode/skill/design-direction-advisor/SKILL.md +0 -139
  143. package/dist/template/.opencode/skill/dispatching-parallel-agents/SKILL.md +0 -191
  144. package/dist/template/.opencode/skill/executing-plans/SKILL.md +0 -247
  145. package/dist/template/.opencode/skill/figma-go/SKILL.md +0 -65
  146. package/dist/template/.opencode/skill/finishing-a-development-branch/SKILL.md +0 -357
  147. package/dist/template/.opencode/skill/full-output-enforcement/SKILL.md +0 -62
  148. package/dist/template/.opencode/skill/gh-address-comments/SKILL.md +0 -29
  149. package/dist/template/.opencode/skill/gh-address-comments/scripts/fetch_comments.py +0 -237
  150. package/dist/template/.opencode/skill/gh-fix-ci/SKILL.md +0 -38
  151. package/dist/template/.opencode/skill/gh-fix-ci/scripts/inspect_pr_checks.py +0 -509
  152. package/dist/template/.opencode/skill/hi-fi-prototype-html/SKILL.md +0 -253
  153. package/dist/template/.opencode/skill/html-deck-export/SKILL.md +0 -189
  154. package/dist/template/.opencode/skill/index-knowledge/SKILL.md +0 -413
  155. package/dist/template/.opencode/skill/memory-grounding/SKILL.md +0 -68
  156. package/dist/template/.opencode/skill/playwriter/SKILL.md +0 -158
  157. package/dist/template/.opencode/skill/portless/SKILL.md +0 -109
  158. package/dist/template/.opencode/skill/prd/SKILL.md +0 -146
  159. package/dist/template/.opencode/skill/prd-task/SKILL.md +0 -182
  160. package/dist/template/.opencode/skill/prd-task/references/prd-schema.json +0 -124
  161. package/dist/template/.opencode/skill/prompt-leverage/SKILL.md +0 -90
  162. package/dist/template/.opencode/skill/prompt-leverage/references/framework.md +0 -91
  163. package/dist/template/.opencode/skill/prompt-leverage/scripts/augment_prompt.py +0 -157
  164. package/dist/template/.opencode/skill/receiving-code-review/SKILL.md +0 -263
  165. package/dist/template/.opencode/skill/reconcile/SKILL.md +0 -183
  166. package/dist/template/.opencode/skill/reflection-checkpoints/SKILL.md +0 -183
  167. package/dist/template/.opencode/skill/requesting-code-review/SKILL.md +0 -443
  168. package/dist/template/.opencode/skill/requesting-code-review/references/specialist-profiles.md +0 -108
  169. package/dist/template/.opencode/skill/requesting-code-review/review.md +0 -160
  170. package/dist/template/.opencode/skill/rtk-command-compression/SKILL.md +0 -134
  171. package/dist/template/.opencode/skill/screenshot/SKILL.md +0 -48
  172. package/dist/template/.opencode/skill/screenshot/scripts/ensure_macos_permissions.sh +0 -54
  173. package/dist/template/.opencode/skill/screenshot/scripts/macos_display_info.swift +0 -22
  174. package/dist/template/.opencode/skill/screenshot/scripts/macos_permissions.swift +0 -40
  175. package/dist/template/.opencode/skill/screenshot/scripts/macos_window_info.swift +0 -126
  176. package/dist/template/.opencode/skill/screenshot/scripts/take_screenshot.ps1 +0 -163
  177. package/dist/template/.opencode/skill/screenshot/scripts/take_screenshot.py +0 -585
  178. package/dist/template/.opencode/skill/security-threat-model/SKILL.md +0 -36
  179. package/dist/template/.opencode/skill/security-threat-model/references/prompt-template.md +0 -255
  180. package/dist/template/.opencode/skill/security-threat-model/references/security-controls-and-assets.md +0 -32
  181. package/dist/template/.opencode/skill/sharing-skills/SKILL.md +0 -214
  182. package/dist/template/.opencode/skill/skill-creator/SKILL.md +0 -181
  183. package/dist/template/.opencode/skill/skill-installer/SKILL.md +0 -58
  184. package/dist/template/.opencode/skill/skill-installer/scripts/github_utils.py +0 -21
  185. package/dist/template/.opencode/skill/skill-installer/scripts/install-skill-from-github.py +0 -313
  186. package/dist/template/.opencode/skill/skill-installer/scripts/list-skills.py +0 -106
  187. package/dist/template/.opencode/skill/swarm-coordination/SKILL.md +0 -244
  188. package/dist/template/.opencode/skill/swarm-coordination/references/architecture.md +0 -39
  189. package/dist/template/.opencode/skill/swarm-coordination/references/delegation-worker-protocol.md +0 -145
  190. package/dist/template/.opencode/skill/swarm-coordination/references/dependency-graph.md +0 -50
  191. package/dist/template/.opencode/skill/swarm-coordination/references/drift-check.md +0 -90
  192. package/dist/template/.opencode/skill/swarm-coordination/references/integration-beads.md +0 -20
  193. package/dist/template/.opencode/skill/swarm-coordination/references/launch-flow.md +0 -186
  194. package/dist/template/.opencode/skill/swarm-coordination/references/reconciler.md +0 -172
  195. package/dist/template/.opencode/skill/swarm-coordination/references/tier-enforcement.md +0 -78
  196. package/dist/template/.opencode/skill/swarm-coordination/references/tmux-integration.md +0 -134
  197. package/dist/template/.opencode/skill/systematic-debugging/SKILL.md +0 -402
  198. package/dist/template/.opencode/skill/terse-output-mode/SKILL.md +0 -95
  199. package/dist/template/.opencode/skill/think-in-code/SKILL.md +0 -136
  200. package/dist/template/.opencode/skill/ux-quality-gates/SKILL.md +0 -137
  201. package/dist/template/.opencode/skill/v1-run/SKILL.md +0 -175
  202. package/dist/template/.opencode/skill/v1-run/mcp.json +0 -6
  203. package/dist/template/.opencode/skill/verification-gates/SKILL.md +0 -63
  204. package/dist/template/.opencode/skill/visual-analysis/SKILL.md +0 -154
  205. package/dist/template/.opencode/skill/web-design-guidelines/SKILL.md +0 -46
  206. package/dist/template/.opencode/skill/workspace-setup/SKILL.md +0 -76
  207. package/dist/template/.opencode/skill/writing-plans/SKILL.md +0 -320
  208. /package/dist/template/.opencode/plugin/{lib → memory}/compact.ts +0 -0
  209. /package/dist/template/.opencode/plugin/{lib → memory}/db/graph.ts +0 -0
  210. /package/dist/template/.opencode/plugin/{lib → memory}/db/maintenance.ts +0 -0
  211. /package/dist/template/.opencode/plugin/{lib → memory}/db/pipeline.ts +0 -0
  212. /package/dist/template/.opencode/plugin/{lib → memory}/notify.ts +0 -0
  213. /package/dist/template/.opencode/plugin/{lib → memory}/operation-log.ts +0 -0
@@ -1,244 +0,0 @@
1
- ---
2
- name: swarm-coordination
3
- description: >
4
- Use when implementing plans with multiple independent tasks that can run in parallel.
5
- Enables leader agents to spawn, coordinate, and monitor worker swarms using Kimi K2.5 PARL patterns.
6
- Covers task classification, anti-serial-collapse detection, delegation packets, progress tracking,
7
- and graceful shutdown patterns.
8
- version: "2.1.0"
9
- license: MIT
10
- tags: [agent-coordination, workflow]
11
- dependencies: [beads]
12
- ---
13
-
14
- # Swarm Coordination - Kimi K2.5 PARL Multi-Agent Execution
15
-
16
- > **Replaces** manual task-by-task execution of large plans — sequential bottleneck when tasks have no dependencies
17
-
18
- ## When to Use
19
-
20
- - Implementing plans with 3+ independent tasks that can run in parallel
21
- - You need structured coordination, monitoring, and delegation across many agents
22
-
23
- ## When NOT to Use
24
-
25
- - Single-task or tightly sequential work without parallelizable groups
26
- - Simple 1–2 file changes better handled by a single agent
27
-
28
- ## Overview
29
-
30
- **Swarm = Leader + Workers + Reconciler + Progress Tracking + Todo Persistence**
31
-
32
- - **Leader (build agent)**: Orchestrates the swarm - analyzes tasks, spawns workers, monitors progress, synthesizes results
33
- - **Workers (general/explore/review/plan agents)**: Execute independent tasks - read delegation, make changes, report progress
34
- - **Reconciler**: Watches for CI failures, detects broken builds, auto-spawns fix tasks - this is the self-healing mechanism
35
- - **Progress Tracker (swarm-progress.jsonl)**: Real-time progress updates with TUI visualization
36
- - **Todo Persistence (swarm-todos.json)**: Cross-session recovery for interrupted swarms
37
-
38
- **Key Tools**:
39
-
40
- | Tool | Purpose | When to Use |
41
- | ------- | -------------------------- | -------------------- |
42
- | `swarm` | Unified swarm coordination | All swarm operations |
43
-
44
- **swarm operations:**
45
-
46
- - `plan`: Task classification & dependency graph (before spawning workers)
47
- - `delegate`: Create delegation packets (assigning work to workers)
48
- - `monitor`: Progress tracking + TUI visualization (during swarm execution)
49
- - `sync`: Sync Beads ↔ OpenCode todos (session start, cross-session)
50
-
51
- **Key Distinction**:
52
-
53
- - **Swarm**: Parallel execution of independent tasks with dynamic allocation
54
- - **Beads**: Task tracking and dependency management across sessions
55
- - **Task tool**: Spawning individual subagents for research/execution
56
- - **swarm tool**: Unified operations for planning, monitoring, delegation, and sync
57
-
58
- **When to Use Swarm Coordination**:
59
-
60
- - "Does this plan have 3+ independent tasks?" → **YES** = Swarm
61
- - "Can multiple tasks run in parallel without conflicts?" → **YES** = Swarm
62
- - "Do I need to coordinate multiple agents?" → **YES** = Swarm
63
- - "Is this a single task or sequential dependency chain?" → **NO** = Single agent
64
-
65
- **Kimi K2.5 PARL Patterns**:
66
-
67
- - **Task Classification**: Auto-detect parallelization potential
68
- - **Anti-Serial-Collapse**: Prevent forced sequential execution
69
- - **Dynamic Allocation**: Conservative start, scale based on bottlenecks
70
- - **Progress Visualization**: Real-time TUI with beautiful markdown blocks
71
- - **Dependency Graphs**: DAG-based task scheduling with critical path analysis
72
-
73
- ## When to Use Swarm vs Single Agent
74
-
75
- | Scenario | Approach |
76
- | ----------------------------- | ------------ |
77
- | 1-2 file changes | Single agent |
78
- | Sequential dependencies | Single agent |
79
- | 3+ independent parallel tasks | Swarm |
80
- | Cross-domain work (FE/BE/DB) | Swarm |
81
- | Time-sensitive parallel work | Swarm |
82
-
83
- ## Quick Reference - Kimi K2.5 PARL Pattern
84
-
85
- ```
86
- SWARM LAUNCH (PARL):
87
- 0. SETUP: swarm({ operation: "sync", action: "push" })
88
- → Make Beads visible to subagents
89
- 1. ANALYZE: swarm({ operation: "plan", action: "analyze", task: userRequest, files: detectedFiles })
90
- → Get classification, phases, dependency_graph
91
- 2. CHECK: swarm({ operation: "plan", action: "check", ... })
92
- → Detect/prevent serial collapse
93
- 3. DELEGATE: swarm({ operation: "delegate", ... })
94
- → Create packets for each worker
95
- 4. SPAWN: Task({ subagent_type: "general" })
96
- → Launch workers using parallelizable_groups order
97
- 5. MONITOR: swarm({ operation: "monitor", action: "render_block" })
98
- → Real-time TUI progress
99
- 6. VERIFY: npm run typecheck && npm run lint && npm test
100
- 7. CLOSE: swarm({ operation: "sync", action: "pull" }) && br close <bead>
101
-
102
- WORKER EXECUTION:
103
- 1. Read delegation packet
104
- 2. Report START: swarm({ operation: "monitor", action: "progress_update", progress: 0, status: "working" })
105
- 3. Execute with constraints
106
- 4. Report PROGRESS (every 25%): swarm({ operation: "monitor", action: "progress_update", progress: 25/50/75 })
107
- 5. Run acceptance checks
108
- 6. Report DONE: swarm({ operation: "monitor", action: "progress_update", progress: 100, status: "completed" })
109
-
110
- COORDINATION:
111
- - Progress: .beads/swarm-progress.jsonl (via swarm monitor)
112
- - Delegation: .beads/artifacts/<id>/delegation.md (via swarm delegate)
113
- - Analysis: swarm tool for classification + dependency graphs
114
-
115
- RECOVERY:
116
- - Check: swarm({ operation: "monitor", action: "status" })
117
- - Use shared task lists: swarm({ operation: "sync", action: "create_shared" })
118
- - Continue with remaining workers
119
-
120
- SHUTDOWN:
121
- - All workers done → swarm({ operation: "monitor", action: "clear" })
122
- - Run full test suite
123
- - swarm({ operation: "sync", action: "pull" })
124
- - Close parent bead
125
- ```
126
-
127
- ## Tools Reference
128
-
129
- | Tool | Purpose | Key Operations |
130
- | --------- | -------------------------- | ------------------------------------- |
131
- | **swarm** | Unified swarm coordination | `plan`, `monitor`, `delegate`, `sync` |
132
-
133
- **swarm operations:**
134
-
135
- - `plan`: Task analysis + dependency DAG (actions: analyze, classify, check, allocate)
136
- - `delegate`: Create delegation packets
137
- - `monitor`: Progress tracking + visualization (actions: progress_update, render_block, status, clear)
138
- - `sync`: Beads ↔ OpenCode todos (actions: push, pull, create_shared, get_shared, update_shared, list_shared)
139
-
140
- ## Beads Integration
141
-
142
- ### Session Start: Load Beads into Todos
143
-
144
- Make Beads tasks visible to subagents:
145
-
146
- ```typescript
147
- // Push Beads to OpenCode todos
148
- const result = await swarm({
149
- operation: "sync",
150
- action: "push",
151
- filter: "open", // or "in_progress", "all"
152
- });
153
- ```
154
-
155
- ### Session End: Sync Back to Beads
156
-
157
- ```typescript
158
- // Pull completed todos back to Beads
159
- await swarm({ operation: "sync", action: "pull" });
160
-
161
- // Clear swarm state
162
- await swarm({
163
- operation: "monitor",
164
- action: "clear",
165
- team_name: "api-refactor-swarm",
166
- });
167
-
168
- // Sync and commit
169
- await bash("br sync --flush-only");
170
- await bash("git add .beads/ && git commit -m 'close swarm'");
171
- ```
172
-
173
- ### Cross-Session Handoff
174
-
175
- For work spanning multiple sessions, use shared task lists:
176
-
177
- ```typescript
178
- // Create shared list
179
- const list = await swarm({
180
- operation: "sync",
181
- action: "create_shared",
182
- name: "api-refactor-swarm",
183
- tasks: JSON.stringify([
184
- { id: "task-1", content: "Refactor auth", status: "pending", priority: "high" },
185
- ]),
186
- });
187
-
188
- // Resume in new session
189
- const shared = await swarm({
190
- operation: "sync",
191
- action: "get_shared",
192
- list_id: "api-refactor-swarm",
193
- });
194
- ```
195
-
196
- ### Data Locations
197
-
198
- | Data Type | Location | Persistence |
199
- | ----------------- | ----------------------------------------------- | ------------- |
200
- | Beads tasks | `.beads/issues/*.md` | Git-backed |
201
- | Swarm progress | `.beads/swarm-progress.jsonl` | Session |
202
- | Shared task lists | `~/.local/share/opencode/storage/shared-tasks/` | Cross-session |
203
- | OpenCode todos | `~/.local/share/opencode/storage/todo/` | Session |
204
-
205
- ## Rules
206
-
207
- 1. **Leader spawns, workers execute** - Clear role separation
208
- 2. **Delegation packets are contracts** - Workers follow them strictly
209
- 3. **Progress tracking for coordination** - All status via swarm monitor progress updates
210
- 4. **Non-overlapping assignments** - Ensure workers edit different files
211
- 5. **Acceptance checks required** - Workers verify before reporting done
212
- 6. **Persist periodically** - Enable cross-session recovery
213
- 7. **Use dependency graph** - Spawn workers in parallelizable_groups order
214
- 8. **Graceful shutdown** - Leader waits for all workers, syncs back to Beads
215
- 9. **Use tmux for visibility** - Enable visual monitoring when available
216
- 10. **Use reconciler at scale** - Required for 50+ agents, recommended for 10+
217
- 11. **Reconciler watches continuously** - Spawns fix tasks on detected failures
218
-
219
- ## Anti-Patterns
220
-
221
- | Anti-Pattern | Why It Fails | Instead |
222
- | ------------------------------------------------------- | ---------------------------------------------------------- | ----------------------------------------------------------------- |
223
- | Spawning agents for tasks with shared file dependencies | Workers block or overwrite each other, causing merge churn | Partition work by non-overlapping files/modules first |
224
- | Not tracking agent completion status | Leader loses visibility; work appears done when it is not | Require `monitor.progress_update` lifecycle (start/progress/done) |
225
- | Dispatching without pre-computed dependency graph | Tasks run out of order, causing rework and serial fallback | Run `swarm plan` first and dispatch by `parallelizable_groups` |
226
- | Using swarm for < 3 tasks (overhead not worth it) | Coordination overhead exceeds execution savings | Use a single agent or 2 direct `Task()` calls |
227
-
228
- ## References
229
-
230
- - `references/architecture.md` - Swarm architecture diagram
231
- - `references/reconciler.md` - Reconciler pattern, error analysis, and fix task spawning
232
- - `references/drift-check.md` - Drift checks after each wave and recovery protocol
233
- - `references/launch-flow.md` - PARL swarm launch flow with step-by-step code
234
- - `references/dependency-graph.md` - Dependency graph structures and usage
235
- - `references/delegation-worker-protocol.md` - Delegation packet structure, worker protocol, and error handling
236
- - `references/integration-beads.md` - Swarm integration workflow with Beads
237
- - `references/tmux-integration.md` - Tmux monitoring setup and commands
238
- - `references/tier-enforcement.md` - Tier enforcement (Longshot pattern)
239
-
240
- ## See Also
241
-
242
- - `agent-teams` — for coordinated multi-role collaboration beyond large plan execution
243
- - `dispatching-parallel-agents` — for lightweight parallel debugging of independent failures
244
- - `executing-plans` — for plan-driven execution when parallelism is moderate or bounded
@@ -1,39 +0,0 @@
1
- # Swarm Architecture
2
-
3
- ```
4
- ┌─────────────────────────────────────────────────────────────────┐
5
- │ BUILD AGENT (Leader) │
6
- │ - Parses plan into tasks │
7
- │ - Creates delegation packets │
8
- │ - Spawns worker agents via Task tool │
9
- │ - Monitors progress via swarm tool │
10
- │ - Synthesizes final results │
11
- └─────────────────────────────────────────────────────────────────┘
12
- │ │ │
13
- ▼ ▼ ▼
14
- ┌─────────────┐ ┌─────────────┐ ┌─────────────┐
15
- │ WORKER-1 │ │ WORKER-2 │ │ WORKER-3 │
16
- │ (general) │ │ (general) │ │ (general) │
17
- │ │ │ │ │ │
18
- │ - Read │ │ - Read │ │ - Read │
19
- │ delegation│ │ delegation│ │ delegation│
20
- │ - Execute │ │ - Execute │ │ - Execute │
21
- │ - Report │ │ - Report │ │ - Report │
22
- └─────────────┘ └─────────────┘ └─────────────┘
23
- │ │ │
24
- └────────────────────┼────────────────────┘
25
-
26
- ┌─────────────────┐
27
- │ RECONCILER │
28
- │ │
29
- │ - Watch CI │
30
- │ - Detect broken │
31
- │ - Spawn fixes │
32
- └─────────────────┘
33
-
34
-
35
- ┌─────────────────┐
36
- │ PROGRESS + │
37
- │ TODO PERSIST │
38
- └─────────────────┘
39
- ```
@@ -1,145 +0,0 @@
1
- # Delegation Packet Structure and Worker Protocol
2
-
3
- ## Delegation Packet Structure
4
-
5
- ```markdown
6
- # Delegation Packet
7
-
8
- - TASK: task-1 - Implement auth service
9
- - EXPECTED OUTCOME: Auth service with JWT tokens, tests pass
10
- - REQUIRED TOOLS:
11
- - read
12
- - grep
13
- - lsp
14
- - edit
15
- - bash
16
- - MUST DO:
17
- - LSP before edits
18
- - Run npm test after changes
19
- - Follow existing code patterns
20
- - MUST NOT DO:
21
- - No new dependencies
22
- - Don't edit config files
23
- - Don't modify shared utilities
24
- - ACCEPTANCE CHECKS:
25
- - typecheck: npm run typecheck
26
- - lint: npm run lint
27
- - test: npm test
28
- - CONTEXT:
29
- See .beads/artifacts/task-1/spec.md for requirements
30
- ```
31
-
32
- ## Worker Protocol (Updated with Progress Tracking)
33
-
34
- Workers follow this execution pattern:
35
-
36
- ### 1. Read Delegation
37
-
38
- ```typescript
39
- // First action: read the delegation packet
40
- read({ filePath: ".beads/artifacts/<task-id>/delegation.md" });
41
- ```
42
-
43
- ### 2. Announce Start with Progress
44
-
45
- ```typescript
46
- await swarm({
47
- operation: "monitor",
48
- operation: "progress_update",
49
- team_name: "plan-implementation",
50
- worker_id: "worker-1",
51
- phase: "explore", // or "generate", "reflect", etc.
52
- progress: 0,
53
- status: "working",
54
- file: "src/api/users.ts", // current file being worked on
55
- });
56
- ```
57
-
58
- ### 3. Execute Task with Progress Updates
59
-
60
- Follow the MUST DO constraints. Avoid MUST NOT DO items. Use required tools only.
61
-
62
- Report progress every 25%:
63
-
64
- ```typescript
65
- // At 25%, 50%, 75% completion
66
- await swarm({
67
- operation: "monitor",
68
- operation: "progress_update",
69
- team_name: "plan-implementation",
70
- worker_id: "worker-1",
71
- phase: "explore",
72
- progress: 25, // or 50, 75
73
- status: "working",
74
- file: "src/api/users.ts",
75
- });
76
- ```
77
-
78
- ### 4. Run Acceptance Checks
79
-
80
- ```bash
81
- # Run each check from the delegation packet
82
- npm run typecheck
83
- npm run lint
84
- npm test
85
- ```
86
-
87
- ### 5. Report Completion
88
-
89
- ```typescript
90
- // Mark as completed
91
- await swarm({
92
- operation: "monitor",
93
- operation: "progress_update",
94
- team_name: "plan-implementation",
95
- worker_id: "worker-1",
96
- phase: "explore",
97
- progress: 100,
98
- status: "completed",
99
- file: "src/api/users.ts",
100
- });
101
- ```
102
-
103
- ## Error Handling
104
-
105
- ### Worker Fails Acceptance Checks
106
-
107
- Workers report failures via progress updates with error status:
108
-
109
- ```typescript
110
- // Worker reports error via progress update
111
- await swarm({
112
- operation: "monitor",
113
- operation: "progress_update",
114
- team_name: "plan-implementation",
115
- worker_id: "worker-1",
116
- phase: "explore",
117
- progress: 75,
118
- status: "error",
119
- message: "typecheck failed: missing type for AuthToken",
120
- });
121
- ```
122
-
123
- ### Leader Response
124
-
125
- 1. Check worker status via `swarm({ operation: "monitor", operation: "status" })`
126
- 2. Review error details in progress entries
127
- 3. Decide: fix locally or reassign to new worker
128
-
129
- ### Worker Gets Blocked
130
-
131
- Workers should report blockers via progress updates:
132
-
133
- ```typescript
134
- // Worker reports blocker via progress update
135
- await swarm({
136
- operation: "monitor",
137
- operation: "progress_update",
138
- team_name: "plan-implementation",
139
- worker_id: "worker-2",
140
- phase: "explore",
141
- progress: 50,
142
- status: "blocked",
143
- message: "Need auth service types from worker-1",
144
- });
145
- ```
@@ -1,50 +0,0 @@
1
- # Dependency Graph Features
2
-
3
- The `swarm` tool's plan operation includes full dependency graph analysis:
4
-
5
- ## Structure
6
-
7
- ```typescript
8
- interface DependencyGraph {
9
- nodes: TaskNode[]; // Individual tasks
10
- edges: Edge[]; // Dependencies between tasks
11
- critical_path: string[]; // Longest dependency chain
12
- parallelizable_groups: string[][]; // Tasks that can run in parallel
13
- }
14
-
15
- interface TaskNode {
16
- id: string;
17
- content: string;
18
- phase: string;
19
- worker: string;
20
- status: "pending" | "in_progress" | "completed";
21
- priority: "high" | "medium" | "low";
22
- blockedBy: string[]; // Tasks this depends on
23
- blocks: string[]; // Tasks that depend on this
24
- assignedFiles: string[]; // Files assigned to this task
25
- }
26
- ```
27
-
28
- ## Usage
29
-
30
- ```typescript
31
- const analysis = await swarm({
32
- operation: "plan",
33
- operation: "analyze",
34
- task: "Refactor API layer",
35
- files: "src/api/users.ts,src/api/posts.ts,src/api/auth.ts",
36
- });
37
-
38
- const plan = JSON.parse(analysis);
39
-
40
- // Critical path shows the longest dependency chain
41
- // Focus attention here for optimal completion time
42
- console.log(`Critical path: ${plan.dependency_graph.critical_path.join(" → ")}`);
43
-
44
- // Parallelizable groups show which tasks can run simultaneously
45
- // Each group must complete before starting the next
46
- for (let i = 0; i < plan.dependency_graph.parallelizable_groups.length; i++) {
47
- const group = plan.dependency_graph.parallelizable_groups[i];
48
- console.log(`Wave ${i + 1}: ${group.join(", ")} (${group.length} parallel tasks)`);
49
- }
50
- ```
@@ -1,90 +0,0 @@
1
- # Drift Check After Each Wave
2
-
3
- After every wave completes and before starting the next, run a **drift check** to verify the codebase has not deviated from the intended state. Accumulated drift between waves is the primary cause of cascading failures in large swarms.
4
-
5
- **Drift** = any difference between actual codebase state and the plan's expected state at a wave boundary.
6
-
7
- ## What to Check
8
-
9
- | Check | Command | Passing Condition |
10
- | ----------------- | -------------------------------------------------- | ------------------------------ |
11
- | Build gates | `npm run typecheck && npm run lint` | Zero errors |
12
- | Unexpected files | `git diff --name-only HEAD` | Only planned files modified |
13
- | Missing artifacts | Verify expected files exist | All declared outputs present |
14
- | Scope adherence | Compare `git status` vs wave's declared file scope | No out-of-scope files modified |
15
-
16
- ## Drift Check Protocol
17
-
18
- Run after every wave, before spawning the next:
19
-
20
- ```typescript
21
- async function driftCheckAfterWave(wave: Wave, expectedFiles: string[]) {
22
- console.log(`\n=== DRIFT CHECK: Wave ${wave.number} ===`);
23
-
24
- // 1. Build gates must pass
25
- const gates = await bash("npm run typecheck && npm run lint");
26
- if (!gates.success) {
27
- throw new Error(`Wave ${wave.number} drift: build gates failed\n${gates.output}`);
28
- }
29
-
30
- // 2. Detect unexpected file modifications
31
- const changedFiles = await bash("git diff --name-only HEAD");
32
- const actualFiles = changedFiles.output.trim().split("\n").filter(Boolean);
33
- const unexpected = actualFiles.filter((f) => !expectedFiles.includes(f));
34
-
35
- if (unexpected.length > 0) {
36
- console.warn(`⚠️ Unexpected files modified in wave ${wave.number}:`);
37
- unexpected.forEach((f) => console.warn(` - ${f}`));
38
- }
39
-
40
- // 3. Verify declared artifacts exist
41
- for (const artifact of wave.expectedArtifacts ?? []) {
42
- const exists = await bash(`test -f ${artifact} && echo "ok" || echo "missing"`);
43
- if (exists.output.trim() === "missing") {
44
- throw new Error(`Wave ${wave.number} drift: expected artifact missing: ${artifact}`);
45
- }
46
- }
47
-
48
- console.log(`✓ Drift check passed: Wave ${wave.number}`);
49
- }
50
- ```
51
-
52
- ## Integration in Wave Execution
53
-
54
- Call drift check between every wave:
55
-
56
- ```typescript
57
- for (let i = 0; i < waves.length; i++) {
58
- const wave = waves[i];
59
- const reconciler = runReconciler(teamName, "npm run typecheck && npm run lint");
60
-
61
- await Promise.all(wave.tasks.map((task) => spawnWorker(task, teamName)));
62
- await reconciler;
63
-
64
- // MANDATORY: Drift check before next wave
65
- await driftCheckAfterWave(
66
- wave,
67
- wave.tasks.flatMap((t) => t.assignedFiles),
68
- );
69
-
70
- console.log(`✓ Wave ${i + 1}/${waves.length} complete and verified`);
71
- }
72
- ```
73
-
74
- ## Drift Response Protocol
75
-
76
- | Drift Type | Severity | Action |
77
- | ------------------------ | -------- | ------------------------------------------------ |
78
- | Build gate failure | Critical | Stop swarm, run reconciler, fix before next wave |
79
- | Unexpected file modified | Warning | Review change, revert if out of scope |
80
- | Missing artifact | Critical | Re-run failed worker task, verify output |
81
- | Scope creep | Warning | Escalate to user if >3 unexpected files changed |
82
-
83
- ## When Drift Is Unrecoverable
84
-
85
- If drift check fails twice in a row on the same wave:
86
-
87
- 1. **Stop the swarm** - don't start next wave
88
- 2. **Report to user**: exact drift details, failing gate output, list of unexpected files
89
- 3. **Rollback option**: use `git reset --hard <wave-N-start-tag>` (see `executing-plans` skill)
90
- 4. **Never paper over drift** - proceeding with known drift compounds into cascading failure
@@ -1,20 +0,0 @@
1
- # Integration with Beads
2
-
3
- Swarm works on top of Beads:
4
-
5
- 1. **Session start**: `swarm sync push` to make tasks visible
6
- 2. **Leader claims parent** bead
7
- 3. **Workers claim child** beads (via delegation packets)
8
- 4. **Progress tracked** via `swarm monitor progress_update`
9
- 5. **Completion syncs** back via `swarm sync pull`
10
- 6. **Close parent** bead with `br close`
11
-
12
- ```typescript
13
- // Full integration workflow
14
- await swarm({ operation: "sync", action: "push" }); // Make Beads visible
15
- // ... spawn swarm ...
16
- await swarm({ operation: "monitor", action: "render_block", team_name: "..." }); // Monitor progress
17
- // ... monitor completion ...
18
- await swarm({ operation: "sync", action: "pull" }); // Sync completed back
19
- await bash("br close parent-task --reason 'Swarm completed'");
20
- ```