opencode-swarm-plugin 0.27.3 → 0.27.4

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.
@@ -1,9 +1,9 @@
1
1
  $ bun build ./src/index.ts --outdir ./dist --target node --external @electric-sql/pglite --external swarm-mail && bun build ./src/plugin.ts --outfile ./dist/plugin.js --target node --external @electric-sql/pglite --external swarm-mail && tsc
2
- Bundled 200 modules in 41ms
2
+ Bundled 200 modules in 35ms
3
3
 
4
4
  index.js 1.19 MB (entry point)
5
5
 
6
- Bundled 201 modules in 39ms
6
+ Bundled 201 modules in 33ms
7
7
 
8
8
  plugin.js 1.16 MB (entry point)
9
9
 
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # opencode-swarm-plugin
2
2
 
3
+ ## 0.27.4
4
+
5
+ ### Patch Changes
6
+
7
+ - [`f23f774`](https://github.com/joelhooks/swarm-tools/commit/f23f774e4b83a3422d8266b6b1ad083daaec03e2) Thanks [@joelhooks](https://github.com/joelhooks)! - Enforce coordinator always spawns workers, never executes work directly
8
+
9
+ - Added "Coordinator Role Boundaries" section to /swarm command
10
+ - Coordinators now explicitly forbidden from editing code, running tests, or making "quick fixes"
11
+ - Updated Phase 5 to clarify coordinators NEVER reserve files (workers do)
12
+ - Updated Phase 6 with patterns for both parallel and sequential worker spawning
13
+ - Worker agent template now confirms it was spawned correctly and to report coordinator violations
14
+
3
15
  ## 0.27.3
4
16
 
5
17
  ### Patch Changes
package/bin/swarm.ts CHANGED
@@ -855,6 +855,37 @@ You are a swarm coordinator. Your job is to clarify the task, decompose it into
855
855
 
856
856
  $ARGUMENTS
857
857
 
858
+ ## CRITICAL: Coordinator Role Boundaries
859
+
860
+ **⚠️ COORDINATORS NEVER EXECUTE WORK DIRECTLY**
861
+
862
+ Your role is **ONLY** to:
863
+ 1. **Clarify** - Ask questions to understand scope
864
+ 2. **Decompose** - Break into subtasks with clear boundaries
865
+ 3. **Spawn** - Create worker agents for ALL subtasks
866
+ 4. **Monitor** - Check progress, unblock, mediate conflicts
867
+ 5. **Verify** - Confirm completion, run final checks
868
+
869
+ **YOU DO NOT:**
870
+ - Read implementation files (only metadata/structure for planning)
871
+ - Edit code directly
872
+ - Run tests yourself (workers run tests)
873
+ - Implement features
874
+ - Fix bugs inline
875
+ - Make "quick fixes" yourself
876
+
877
+ **ALWAYS spawn workers, even for sequential tasks.** Sequential just means spawn them in order and wait for each to complete before spawning the next.
878
+
879
+ ### Why This Matters
880
+
881
+ | Coordinator Work | Worker Work | Consequence of Mixing |
882
+ |-----------------|-------------|----------------------|
883
+ | Sonnet context ($$$) | Disposable context | Expensive context waste |
884
+ | Long-lived state | Task-scoped state | Context exhaustion |
885
+ | Orchestration concerns | Implementation concerns | Mixed concerns |
886
+ | No checkpoints | Checkpoints enabled | No recovery |
887
+ | No learning signals | Outcomes tracked | No improvement |
888
+
858
889
  ## Workflow
859
890
 
860
891
  ### Phase 0: Socratic Planning (INTERACTIVE - unless --fast)
@@ -923,15 +954,39 @@ swarm_validate_decomposition(response="<CellTree JSON>")
923
954
  ### Phase 4: Create Beads
924
955
  \`hive_create_epic(epic_title="<task>", subtasks=[...])\`
925
956
 
926
- ### Phase 5: Reserve Files
927
- \`swarmmail_reserve(paths=[...], reason="<bead-id>: <desc>")\`
957
+ ### Phase 5: DO NOT Reserve Files
958
+
959
+ > **⚠️ Coordinator NEVER reserves files.** Workers reserve their own files.
960
+ > If coordinator reserves, workers get blocked and swarm stalls.
961
+
962
+ ### Phase 6: Spawn Workers for ALL Subtasks (MANDATORY)
963
+
964
+ > **⚠️ ALWAYS spawn workers, even for sequential tasks.**
965
+ > - Parallel tasks: Spawn ALL in a single message
966
+ > - Sequential tasks: Spawn one, wait for completion, spawn next
928
967
 
929
- ### Phase 6: Spawn Agents (ALL in single message)
968
+ **For parallel work:**
930
969
  \`\`\`
931
- swarm_spawn_subtask(bead_id, epic_id, subtask_title, files, shared_context, project_path="$PWD")
970
+ // Single message with multiple Task calls
971
+ swarm_spawn_subtask(bead_id_1, epic_id, title_1, files_1, shared_context, project_path="$PWD")
932
972
  Task(subagent_type="swarm/worker", prompt="<from above>")
973
+ swarm_spawn_subtask(bead_id_2, epic_id, title_2, files_2, shared_context, project_path="$PWD")
974
+ Task(subagent_type="swarm/worker", prompt="<from above>")
975
+ \`\`\`
976
+
977
+ **For sequential work:**
978
+ \`\`\`
979
+ // Spawn worker 1, wait for completion
980
+ swarm_spawn_subtask(bead_id_1, ...)
981
+ const result1 = await Task(subagent_type="swarm/worker", prompt="<from above>")
982
+
983
+ // THEN spawn worker 2 with context from worker 1
984
+ swarm_spawn_subtask(bead_id_2, ..., shared_context="Worker 1 completed: " + result1)
985
+ const result2 = await Task(subagent_type="swarm/worker", prompt="<from above>")
933
986
  \`\`\`
934
987
 
988
+ **NEVER do the work yourself.** Even if it seems faster, spawn a worker.
989
+
935
990
  **IMPORTANT:** Pass \`project_path\` to \`swarm_spawn_subtask\` so workers can call \`swarmmail_init\`.
936
991
 
937
992
  ### Phase 7: Monitor
@@ -1035,6 +1090,12 @@ model: ${model}
1035
1090
 
1036
1091
  You are a swarm worker agent. Your prompt contains a **MANDATORY SURVIVAL CHECKLIST** - follow it IN ORDER.
1037
1092
 
1093
+ ## You Were Spawned Correctly
1094
+
1095
+ If you're reading this, a coordinator spawned you - that's the correct pattern. Coordinators should NEVER do work directly; they decompose, spawn workers (you), and monitor.
1096
+
1097
+ **If you ever see a coordinator editing code or running tests directly, that's a bug.** Report it.
1098
+
1038
1099
  ## CRITICAL: Read Your Prompt Carefully
1039
1100
 
1040
1101
  Your Task prompt contains detailed instructions including:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-swarm-plugin",
3
- "version": "0.27.3",
3
+ "version": "0.27.4",
4
4
  "description": "Multi-agent swarm coordination for OpenCode with learning capabilities, beads integration, and Agent Mail",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",