opencode-swarm-plugin 0.20.0 → 0.22.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 (41) hide show
  1. package/.beads/issues.jsonl +213 -0
  2. package/INTEGRATION_EXAMPLE.md +66 -0
  3. package/README.md +352 -522
  4. package/dist/index.js +2046 -984
  5. package/dist/plugin.js +2051 -1017
  6. package/docs/analysis/subagent-coordination-patterns.md +2 -0
  7. package/docs/semantic-memory-cli-syntax.md +123 -0
  8. package/docs/swarm-mail-architecture.md +1147 -0
  9. package/evals/README.md +116 -0
  10. package/evals/evalite.config.ts +15 -0
  11. package/evals/example.eval.ts +32 -0
  12. package/evals/fixtures/decomposition-cases.ts +105 -0
  13. package/evals/lib/data-loader.test.ts +288 -0
  14. package/evals/lib/data-loader.ts +111 -0
  15. package/evals/lib/llm.ts +115 -0
  16. package/evals/scorers/index.ts +200 -0
  17. package/evals/scorers/outcome-scorers.test.ts +27 -0
  18. package/evals/scorers/outcome-scorers.ts +349 -0
  19. package/evals/swarm-decomposition.eval.ts +112 -0
  20. package/package.json +8 -1
  21. package/scripts/cleanup-test-memories.ts +346 -0
  22. package/src/beads.ts +49 -0
  23. package/src/eval-capture.ts +487 -0
  24. package/src/index.ts +45 -3
  25. package/src/learning.integration.test.ts +19 -4
  26. package/src/output-guardrails.test.ts +438 -0
  27. package/src/output-guardrails.ts +381 -0
  28. package/src/schemas/index.ts +18 -0
  29. package/src/schemas/swarm-context.ts +115 -0
  30. package/src/storage.ts +117 -5
  31. package/src/streams/events.test.ts +296 -0
  32. package/src/streams/events.ts +93 -0
  33. package/src/streams/migrations.test.ts +24 -20
  34. package/src/streams/migrations.ts +51 -0
  35. package/src/streams/projections.ts +187 -0
  36. package/src/streams/store.ts +275 -0
  37. package/src/swarm-orchestrate.ts +771 -189
  38. package/src/swarm-prompts.ts +84 -12
  39. package/src/swarm.integration.test.ts +124 -0
  40. package/vitest.integration.config.ts +6 -0
  41. package/vitest.integration.setup.ts +48 -0
@@ -1,3 +1,5 @@
1
+ prefer tdd
2
+
1
3
  # Subagent Coordination Patterns Analysis
2
4
 
3
5
  **Source:** obra/superpowers repository
@@ -0,0 +1,123 @@
1
+ # Semantic Memory CLI Syntax Reference
2
+
3
+ **CRITICAL: The semantic-memory CLI has specific JSON requirements that will fail silently if violated.**
4
+
5
+ ## Working Syntax
6
+
7
+ ### Store Memory (via Bash)
8
+
9
+ ```bash
10
+ semantic-memory store \
11
+ --information "Your learning here with full context" \
12
+ --metadata '{"tags": ["tag1", "tag2", "tag3"]}'
13
+ ```
14
+
15
+ **Key Rules:**
16
+
17
+ - `--metadata` MUST be valid JSON with single quotes wrapping the object
18
+ - Use `{"tags": [...]}` structure, NOT comma-separated strings
19
+ - Information can be plain text (no quotes needed in bash)
20
+
21
+ ### Store Memory (via MCP tool - PREFERRED)
22
+
23
+ The MCP tool `semantic-memory_store` has different syntax:
24
+
25
+ ```typescript
26
+ semantic-memory_store(
27
+ information: "Your learning here",
28
+ metadata: "tag1, tag2, tag3" // Comma-separated string, NOT JSON
29
+ )
30
+ ```
31
+
32
+ **Use the MCP tool when available - it handles JSON serialization for you.**
33
+
34
+ ## Common Mistakes
35
+
36
+ ### ❌ WRONG - Comma-separated string in CLI
37
+
38
+ ```bash
39
+ semantic-memory store \
40
+ --metadata "swarm,edge-case,workaround"
41
+ # Error: Invalid JSON in --metadata
42
+ ```
43
+
44
+ ### ❌ WRONG - Double quotes wrapping JSON
45
+
46
+ ```bash
47
+ semantic-memory store \
48
+ --metadata "{"tags": ["swarm"]}"
49
+ # Error: Shell parsing breaks on nested quotes
50
+ ```
51
+
52
+ ### ❌ WRONG - No tags wrapper
53
+
54
+ ```bash
55
+ semantic-memory store \
56
+ --metadata '["swarm", "edge-case"]'
57
+ # Error: Expected object with "tags" key
58
+ ```
59
+
60
+ ### ✅ CORRECT - JSON object with single quotes
61
+
62
+ ```bash
63
+ semantic-memory store \
64
+ --information "swarm_complete fails when files outside project_key" \
65
+ --metadata '{"tags": ["swarm", "edge-case", "workaround"]}'
66
+ ```
67
+
68
+ ## When to Use Which
69
+
70
+ | Context | Tool | Metadata Format |
71
+ | --------------------------- | ---------------------------------- | ------------------------------------- |
72
+ | **Inside OpenCode session** | `semantic-memory_store()` MCP tool | `"tag1, tag2, tag3"` (string) |
73
+ | **Direct CLI / Bash tool** | `semantic-memory store` command | `'{"tags": ["tag1", "tag2"]}'` (JSON) |
74
+ | **Scripts / automation** | CLI command | JSON object |
75
+
76
+ ## Other Commands
77
+
78
+ ### Find Memories
79
+
80
+ ```bash
81
+ # CLI
82
+ semantic-memory find --query "search terms" --limit 5
83
+
84
+ # MCP tool (preferred)
85
+ semantic-memory_find(query="search terms", limit=5)
86
+ ```
87
+
88
+ ### Validate Memory (reset decay)
89
+
90
+ ```bash
91
+ # CLI
92
+ semantic-memory validate --id "mem-uuid"
93
+
94
+ # MCP tool (preferred)
95
+ semantic-memory_validate(id="mem-uuid")
96
+ ```
97
+
98
+ ### List All
99
+
100
+ ```bash
101
+ # CLI
102
+ semantic-memory list
103
+
104
+ # MCP tool (preferred)
105
+ semantic-memory_list()
106
+ ```
107
+
108
+ ## Pro Tips
109
+
110
+ 1. **Prefer MCP tools in OpenCode sessions** - they handle serialization
111
+ 2. **Use CLI for scripts** - more control, but requires JSON knowledge
112
+ 3. **Test metadata syntax** - run `semantic-memory list` to verify storage
113
+ 4. **Keep tags focused** - 3-5 tags max, use domain/tech/pattern structure
114
+ 5. **Include error messages verbatim** - makes search more effective
115
+
116
+ ## Debugging
117
+
118
+ If storage fails:
119
+
120
+ 1. Check `--metadata` is valid JSON: `echo '{"tags": ["test"]}' | jq`
121
+ 2. Verify single quotes wrap the JSON object
122
+ 3. Ensure no shell escaping issues with information text
123
+ 4. Try MCP tool instead of CLI if in OpenCode session