opencode-swarm-plugin 0.15.0 → 0.16.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.
@@ -27,6 +27,49 @@ Swarm Mail is embedded (no external server needed) and provides:
27
27
 
28
28
  ## Workflow
29
29
 
30
+ ### 0. Task Clarity Check (BEFORE ANYTHING ELSE)
31
+
32
+ **Before decomposing, ask yourself: Is this task clear enough to parallelize?**
33
+
34
+ **Vague Task Signals:**
35
+
36
+ - No specific files or components mentioned
37
+ - Vague verbs: "improve", "fix", "update", "make better"
38
+ - Large scope without constraints: "refactor the codebase"
39
+ - Missing success criteria: "add auth" (what kind? OAuth? JWT? Session?)
40
+ - Ambiguous boundaries: "handle errors" (which errors? where?)
41
+
42
+ **If task is vague, ASK QUESTIONS FIRST:**
43
+
44
+ ```
45
+ The task "<task>" needs clarification before I can decompose it effectively.
46
+
47
+ 1. [Specific question about scope/files/approach]
48
+
49
+ Options:
50
+ a) [Option A with trade-off]
51
+ b) [Option B with trade-off]
52
+ c) [Option C with trade-off]
53
+
54
+ Which approach, or should I explore something else?
55
+ ```
56
+
57
+ **Rules for clarifying questions:**
58
+
59
+ - ONE question at a time (don't overwhelm)
60
+ - Offer 2-3 concrete options when possible
61
+ - Lead with your recommendation and why
62
+ - Wait for answer before next question
63
+
64
+ **Clear Task Signals (proceed to decompose):**
65
+
66
+ - Specific files or directories mentioned
67
+ - Concrete action verbs: "add X to Y", "migrate A to B", "extract C from D"
68
+ - Defined scope: "the auth module", "API routes in /api/v2"
69
+ - Measurable outcome: "tests pass", "type errors fixed", "endpoint returns X"
70
+
71
+ **When in doubt, ask.** A 30-second clarification beats a 30-minute wrong decomposition.
72
+
30
73
  ### 1. Initialize Swarm Mail (FIRST)
31
74
 
32
75
  ```bash
@@ -63,6 +63,53 @@ Swarm Mail is embedded (no external server needed) and provides:
63
63
 
64
64
  **Heuristic:** If you can describe the task in one sentence without "and", don't swarm.
65
65
 
66
+ ## Task Clarity Check (BEFORE Decomposing)
67
+
68
+ **Before decomposing, ask: Is this task clear enough to parallelize?**
69
+
70
+ ### Vague Task Signals (ASK QUESTIONS FIRST)
71
+
72
+ | Signal | Example | Problem |
73
+ | ------------------------ | ------------------------------ | -------------------------------- |
74
+ | No files mentioned | "improve performance" | Where? Which files? |
75
+ | Vague verbs | "fix", "update", "make better" | What specifically? |
76
+ | Large undefined scope | "refactor the codebase" | Which parts? What pattern? |
77
+ | Missing success criteria | "add auth" | OAuth? JWT? Session? What flows? |
78
+ | Ambiguous boundaries | "handle errors" | Which errors? Where? How? |
79
+
80
+ ### How to Clarify
81
+
82
+ ```markdown
83
+ The task "<task>" needs clarification before I can decompose it.
84
+
85
+ **Question:** [Specific question about scope/files/approach]
86
+
87
+ Options:
88
+ a) [Option A] - [trade-off]
89
+ b) [Option B] - [trade-off]
90
+ c) [Option C] - [trade-off]
91
+
92
+ I'd recommend (a) because [reason]. Which approach?
93
+ ```
94
+
95
+ **Rules:**
96
+
97
+ - ONE question at a time (don't overwhelm)
98
+ - Offer 2-3 concrete options when possible
99
+ - Lead with your recommendation and why
100
+ - Wait for answer before asking next question
101
+
102
+ ### Clear Task Signals (PROCEED to decompose)
103
+
104
+ | Signal | Example | Why it's clear |
105
+ | ------------------ | ------------------------------ | ---------------- |
106
+ | Specific files | "update src/auth/\*.ts" | Scope defined |
107
+ | Concrete verbs | "migrate from X to Y" | Action defined |
108
+ | Defined scope | "the payment module" | Boundaries clear |
109
+ | Measurable outcome | "tests pass", "no type errors" | Success criteria |
110
+
111
+ **When in doubt, ask.** A 30-second clarification beats a 30-minute wrong decomposition.
112
+
66
113
  ## Coordinator Workflow
67
114
 
68
115
  ### Phase 1: Initialize Swarm Mail (FIRST)
@@ -309,16 +356,17 @@ One blocker affects multiple subtasks.
309
356
 
310
357
  ## Anti-Patterns
311
358
 
312
- | Anti-Pattern | Symptom | Fix |
313
- | ------------------------ | ------------------------------------------ | ------------------------------------ |
314
- | **Mega-Coordinator** | Coordinator editing files | Coordinator only orchestrates |
315
- | **Silent Swarm** | No communication, late conflicts | Require updates, check inbox |
316
- | **Over-Decomposed** | 10 subtasks for 20 lines | 2-5 subtasks max |
317
- | **Under-Specified** | "Implement backend" | Clear goal, files, criteria |
318
- | **Inline Planning** ⚠️ | Context pollution, exhaustion on long runs | Delegate planning to subagent |
319
- | **Heavy File Reading** | Coordinator reading 10+ files | Subagent reads, returns summary only |
320
- | **Deep CASS Drilling** | Multiple cass_search calls inline | Subagent searches, summarizes |
321
- | **Manual Decomposition** | Hand-crafting subtasks without validation | Use swarm_plan_prompt + validation |
359
+ | Anti-Pattern | Symptom | Fix |
360
+ | --------------------------- | ------------------------------------------ | ------------------------------------ |
361
+ | **Decomposing Vague Tasks** | Wrong subtasks, wasted agent cycles | Ask clarifying questions FIRST |
362
+ | **Mega-Coordinator** | Coordinator editing files | Coordinator only orchestrates |
363
+ | **Silent Swarm** | No communication, late conflicts | Require updates, check inbox |
364
+ | **Over-Decomposed** | 10 subtasks for 20 lines | 2-5 subtasks max |
365
+ | **Under-Specified** | "Implement backend" | Clear goal, files, criteria |
366
+ | **Inline Planning** ⚠️ | Context pollution, exhaustion on long runs | Delegate planning to subagent |
367
+ | **Heavy File Reading** | Coordinator reading 10+ files | Subagent reads, returns summary only |
368
+ | **Deep CASS Drilling** | Multiple cass_search calls inline | Subagent searches, summarizes |
369
+ | **Manual Decomposition** | Hand-crafting subtasks without validation | Use swarm_plan_prompt + validation |
322
370
 
323
371
  ## Shared Context Template
324
372
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-swarm-plugin",
3
- "version": "0.15.0",
3
+ "version": "0.16.0",
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",
package/src/index.ts CHANGED
@@ -38,6 +38,7 @@ import { structuredTools } from "./structured";
38
38
  import { swarmTools } from "./swarm";
39
39
  import { repoCrawlTools } from "./repo-crawl";
40
40
  import { skillsTools, setSkillsProjectDirectory } from "./skills";
41
+ import { mandateTools } from "./mandates";
41
42
 
42
43
  /**
43
44
  * OpenCode Swarm Plugin
@@ -50,6 +51,7 @@ import { skillsTools, setSkillsProjectDirectory } from "./skills";
50
51
  * - swarm:* - Swarm orchestration and task decomposition
51
52
  * - repo-crawl:* - GitHub API tools for repository research
52
53
  * - skills:* - Agent skills discovery, activation, and execution
54
+ * - mandate:* - Agent voting system for collaborative knowledge curation
53
55
  *
54
56
  * @param input - Plugin context from OpenCode
55
57
  * @returns Plugin hooks including tools, events, and tool execution hooks
@@ -132,6 +134,7 @@ export const SwarmPlugin: Plugin = async (
132
134
  * - agent-mail:init, agent-mail:send, agent-mail:reserve, etc. (legacy MCP)
133
135
  * - swarm-mail:init, swarm-mail:send, swarm-mail:reserve, etc. (embedded)
134
136
  * - repo-crawl:readme, repo-crawl:structure, etc.
137
+ * - mandate:file, mandate:vote, mandate:query, etc.
135
138
  */
136
139
  tool: {
137
140
  ...beadsTools,
@@ -140,6 +143,7 @@ export const SwarmPlugin: Plugin = async (
140
143
  ...swarmTools,
141
144
  ...repoCrawlTools,
142
145
  ...skillsTools,
146
+ ...mandateTools,
143
147
  },
144
148
 
145
149
  /**
@@ -361,6 +365,7 @@ export const allTools = {
361
365
  ...swarmTools,
362
366
  ...repoCrawlTools,
363
367
  ...skillsTools,
368
+ ...mandateTools,
364
369
  } as const;
365
370
 
366
371
  /**
@@ -473,3 +478,76 @@ export {
473
478
  type SkillMetadata,
474
479
  type SkillRef,
475
480
  } from "./skills";
481
+
482
+ /**
483
+ * Re-export mandates module
484
+ *
485
+ * Agent voting system for collaborative knowledge curation.
486
+ *
487
+ * Includes:
488
+ * - mandateTools - All mandate tools (file, vote, query, list, stats)
489
+ * - MandateError - Error class
490
+ *
491
+ * Features:
492
+ * - Submit ideas, tips, lore, snippets, and feature requests
493
+ * - Vote on entries (upvote/downvote) with 90-day decay
494
+ * - Semantic search for relevant mandates
495
+ * - Status transitions based on consensus (candidate → established → mandate)
496
+ * - Persistent storage with semantic-memory
497
+ *
498
+ * Types:
499
+ * - MandateEntry, Vote, MandateScore - Core data types
500
+ * - MandateStatus, MandateContentType - Enum types
501
+ */
502
+ export { mandateTools, MandateError } from "./mandates";
503
+
504
+ /**
505
+ * Re-export mandate-storage module
506
+ *
507
+ * Includes:
508
+ * - createMandateStorage - Factory function
509
+ * - getMandateStorage, setMandateStorage, resetMandateStorage - Global instance management
510
+ * - updateMandateStatus, updateAllMandateStatuses - Status update helpers
511
+ * - InMemoryMandateStorage, SemanticMemoryMandateStorage - Storage implementations
512
+ *
513
+ * Types:
514
+ * - MandateStorage - Unified storage interface
515
+ * - MandateStorageConfig, MandateStorageBackend, MandateStorageCollections - Configuration types
516
+ */
517
+ export {
518
+ createMandateStorage,
519
+ getMandateStorage,
520
+ setMandateStorage,
521
+ resetMandateStorage,
522
+ updateMandateStatus,
523
+ updateAllMandateStatuses,
524
+ InMemoryMandateStorage,
525
+ SemanticMemoryMandateStorage,
526
+ DEFAULT_MANDATE_STORAGE_CONFIG,
527
+ type MandateStorage,
528
+ type MandateStorageConfig,
529
+ type MandateStorageBackend,
530
+ type MandateStorageCollections,
531
+ } from "./mandate-storage";
532
+
533
+ /**
534
+ * Re-export mandate-promotion module
535
+ *
536
+ * Includes:
537
+ * - evaluatePromotion - Evaluate status transitions
538
+ * - shouldPromote - Determine new status based on score
539
+ * - formatPromotionResult - Format promotion result for display
540
+ * - evaluateBatchPromotions, getStatusChanges, groupByTransition - Batch helpers
541
+ *
542
+ * Types:
543
+ * - PromotionResult - Promotion evaluation result
544
+ */
545
+ export {
546
+ evaluatePromotion,
547
+ shouldPromote,
548
+ formatPromotionResult,
549
+ evaluateBatchPromotions,
550
+ getStatusChanges,
551
+ groupByTransition,
552
+ type PromotionResult,
553
+ } from "./mandate-promotion";