opencode-swarm-plugin 0.12.27 → 0.12.29

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.
package/README.md CHANGED
@@ -197,20 +197,14 @@ skills_use(name="swarm-coordination") # Load swarm workflow
197
197
 
198
198
  ### Bundled Skills
199
199
 
200
- | Skill | Tags | Description |
201
- | ---------------------------- | -------------------- | ------------------------------------------------------------------------------------ |
202
- | `agent-patterns` | ai, agents, patterns | AI agent design patterns - capability whiteboards, architecture evolution, evals |
203
- | `cli-builder` | cli, typescript, bun | Building TypeScript CLIs with Bun - argument parsing, subcommands, output formatting |
204
- | `code-review` | review, quality | Code review patterns - systematic checklists, feedback patterns |
205
- | `debugging` | debugging, errors | Systematic debugging - root cause analysis, error resolution |
206
- | `learning-systems` | learning, feedback | Implicit feedback scoring, confidence decay, anti-pattern detection |
207
- | `mcp-tool-authoring` | mcp, tools | Building MCP tools - schema definition, context passing, error handling |
208
- | `resilience-patterns` | errors, recovery | Error recovery, retry strategies, graceful degradation |
209
- | `skill-creator` | meta, skills | Guide for creating effective skills |
210
- | `swarm-coordination` | swarm, multi-agent | Multi-agent coordination patterns for swarm workflows |
211
- | `tacit-knowledge-extraction` | knowledge, patterns | Extracting tacit knowledge into pattern languages |
212
- | `testing-strategies` | testing, vitest | Testing async/swarm operations, mocking patterns |
213
- | `zod-validation` | zod, typescript | Schema validation patterns with Zod |
200
+ | Skill | Tags | Description |
201
+ | -------------------- | -------------------- | ------------------------------------------------------------------------------------ |
202
+ | `cli-builder` | cli, typescript, bun | Building TypeScript CLIs with Bun - argument parsing, subcommands, output formatting |
203
+ | `learning-systems` | learning, feedback | Implicit feedback scoring, confidence decay, anti-pattern detection |
204
+ | `mcp-tool-authoring` | mcp, tools | Building MCP tools - schema definition, context passing, error handling |
205
+ | `skill-creator` | meta, skills | Guide for creating effective skills |
206
+ | `swarm-coordination` | swarm, multi-agent | Multi-agent coordination patterns for swarm workflows |
207
+ | `system-design` | design, architecture | Building reusable systems - deep modules, complexity management, design red flags |
214
208
 
215
209
  ### Skill Locations
216
210
 
package/bin/swarm.ts CHANGED
@@ -1084,17 +1084,17 @@ async function setup() {
1084
1084
  const s = p.spinner();
1085
1085
  s.start("Updating AGENTS.md...");
1086
1086
 
1087
- const agentsPrompt = `You are updating the user's AGENTS.md file to add skill awareness.
1087
+ const agentsPrompt = `You are updating the user's AGENTS.md file to add swarm plugin awareness.
1088
1088
 
1089
1089
  ## Task
1090
- Read ${agentsPath} and add a Skills section if one doesn't exist. If a skills section exists, update it.
1090
+ Read ${agentsPath} and add sections for Skills, CASS, and Semantic Memory if they don't exist. Update existing sections if present.
1091
1091
 
1092
1092
  ## What to Add
1093
1093
 
1094
- 1. **Tool Preferences** - If there's a tool_preferences or similar section, add skills tools:
1095
- - skills_list - discover available skills
1096
- - skills_use - load skill for context injection
1097
- - skills_read - read full skill content
1094
+ 1. **Tool Preferences** - If there's a tool_preferences section, add these tools:
1095
+ - skills_list, skills_use, skills_read - knowledge injection
1096
+ - cass_search, cass_view, cass_expand - search past agent sessions
1097
+ - semantic-memory_find, semantic-memory_store - persistent learning
1098
1098
 
1099
1099
  2. **Skills Section** - Add this (adapt style to match the file):
1100
1100
 
@@ -1110,17 +1110,65 @@ Skills are reusable knowledge packages. Load them on-demand for specialized task
1110
1110
  **Usage:**
1111
1111
  \`\`\`
1112
1112
  skills_list() # See available skills
1113
- skills_use(name="debugging") # Load a skill
1114
- skills_use(name="code-review", context="reviewing auth") # With context
1113
+ skills_use(name="swarm-coordination") # Load a skill
1114
+ skills_use(name="cli-builder", context="building a new CLI") # With context
1115
1115
  \`\`\`
1116
1116
 
1117
- **Bundled Skills:** agent-patterns, cli-builder, code-review, debugging, learning-systems, mcp-tool-authoring, resilience-patterns, skill-creator, swarm-coordination, tacit-knowledge-extraction, testing-strategies, zod-validation
1117
+ **Bundled Skills:** cli-builder, learning-systems, mcp-tool-authoring, skill-creator, swarm-coordination
1118
+
1119
+ 3. **CASS Section** - Add this:
1120
+
1121
+ ### CASS (Cross-Agent Session Search)
1122
+
1123
+ Search across ALL your AI coding agent histories before solving problems from scratch.
1124
+
1125
+ **When to Use:**
1126
+ - BEFORE implementing anything - check if any agent solved it before
1127
+ - When debugging - "what did I try last time this error happened?"
1128
+ - When learning patterns - "how did Cursor handle this API?"
1129
+
1130
+ **Usage:**
1131
+ \`\`\`
1132
+ cass_search(query="authentication token refresh", limit=5) # Search all agents
1133
+ cass_search(query="useEffect cleanup", agent="claude", days=7) # Filter by agent/time
1134
+ cass_view(path="/path/from/search", line=42) # View specific result
1135
+ cass_expand(path="/path", line=42, context=10) # Expand context around match
1136
+ \`\`\`
1137
+
1138
+ **Pro tip:** Query CASS at the START of complex tasks. Past solutions save time.
1139
+
1140
+ 4. **Semantic Memory Section** - Add this:
1141
+
1142
+ ### Semantic Memory (Persistent Learning)
1143
+
1144
+ Store and retrieve learnings across sessions. Memories persist and are searchable.
1145
+
1146
+ **When to Use:**
1147
+ - After solving a tricky problem - store the solution
1148
+ - After making architectural decisions - store the reasoning
1149
+ - Before starting work - search for relevant past learnings
1150
+ - When you discover project-specific patterns
1151
+
1152
+ **Usage:**
1153
+ \`\`\`
1154
+ # Store a learning
1155
+ semantic-memory_store(information="OAuth refresh tokens need 5min buffer before expiry", metadata="auth, tokens")
1156
+
1157
+ # Search for relevant memories
1158
+ semantic-memory_find(query="token refresh", limit=5)
1159
+
1160
+ # Validate a memory is still accurate (resets decay timer)
1161
+ semantic-memory_validate(id="mem_123")
1162
+ \`\`\`
1163
+
1164
+ **Pro tip:** Store the WHY, not just the WHAT. Future you needs context.
1118
1165
 
1119
1166
  ## Rules
1120
1167
  - Preserve existing content and style
1121
- - Don't duplicate - update if skills section exists
1122
- - Keep tone consistent
1123
- - Place near tool preferences or as logical new section
1168
+ - Don't duplicate - update existing sections if present
1169
+ - Keep tone consistent with the rest of the file
1170
+ - Place sections in logical order (Skills, CASS, Semantic Memory)
1171
+ - If there's a tool_preferences section, add the tools there too
1124
1172
 
1125
1173
  Edit the file now.`;
1126
1174
 
@@ -1641,61 +1689,63 @@ async function agents() {
1641
1689
  const s = p.spinner();
1642
1690
  s.start("Updating AGENTS.md with skill awareness...");
1643
1691
 
1644
- const prompt = `You are updating the user's AGENTS.md file to add skill awareness.
1692
+ const prompt = `You are updating the user's AGENTS.md file to add swarm plugin awareness.
1645
1693
 
1646
1694
  ## Task
1647
- Read ~/.config/opencode/AGENTS.md and add a Skills section if one doesn't exist.
1695
+ Read ~/.config/opencode/AGENTS.md and add sections for Skills, CASS, and Semantic Memory if they don't exist.
1648
1696
 
1649
1697
  ## What to Add
1650
- Add a section about using skills. Include:
1651
1698
 
1652
- 1. **Tool Preferences Update** - Add skills_* tools to the tool priority list:
1653
- - skills_list - discover available skills
1654
- - skills_use - load skill for context injection
1655
- - skills_read - read full skill content
1699
+ 1. **Tool Preferences** - Add these tools to any tool_preferences section:
1700
+ - skills_list, skills_use, skills_read - knowledge injection
1701
+ - cass_search, cass_view, cass_expand - search past agent sessions
1702
+ - semantic-memory_find, semantic-memory_store - persistent learning
1656
1703
 
1657
- 2. **Skills Section** - Add this section (adapt to match the file's style):
1704
+ 2. **Skills Section**:
1658
1705
 
1659
1706
  ### Skills (Knowledge Injection)
1660
1707
 
1661
- Skills are reusable knowledge packages. Load them on-demand for specialized tasks.
1708
+ Skills are reusable knowledge packages. Load on-demand for specialized tasks.
1662
1709
 
1663
- **When to Use Skills:**
1664
- - Before starting unfamiliar work - check if a skill exists
1665
- - When you need domain-specific patterns
1666
- - For complex workflows that benefit from guidance
1710
+ **When to Use:** Before unfamiliar work, when you need domain patterns, for complex workflows.
1667
1711
 
1668
- **Available Skills** (run \`skills_list()\` to see current list):
1669
- - agent-patterns: AI agent design patterns
1670
- - cli-builder: TypeScript CLI patterns
1671
- - code-review: Review checklists
1672
- - debugging: Root cause analysis
1673
- - learning-systems: Feedback scoring, pattern maturity
1674
- - mcp-tool-authoring: Building MCP tools
1675
- - resilience-patterns: Error recovery, retries
1676
- - skill-creator: Creating new skills
1677
- - swarm-coordination: Multi-agent workflows
1678
- - tacit-knowledge-extraction: Pattern mining
1679
- - testing-strategies: Vitest patterns
1680
- - zod-validation: Schema validation
1681
-
1682
- **Usage Pattern:**
1683
1712
  \`\`\`
1684
- # Check what's available
1685
- skills_list()
1713
+ skills_list() # See available skills
1714
+ skills_use(name="swarm-coordination") # Load a skill
1715
+ \`\`\`
1716
+
1717
+ **Bundled:** cli-builder, learning-systems, mcp-tool-authoring, skill-creator, swarm-coordination
1718
+
1719
+ 3. **CASS Section**:
1720
+
1721
+ ### CASS (Cross-Agent Session Search)
1722
+
1723
+ Search ALL your AI coding agent histories before solving from scratch.
1686
1724
 
1687
- # Load a skill before starting work
1688
- skills_use(name="debugging")
1725
+ **When to Use:** BEFORE implementing - check if solved before. When debugging - what worked last time?
1689
1726
 
1690
- # Load with context
1691
- skills_use(name="code-review", context="reviewing auth changes")
1727
+ \`\`\`
1728
+ cass_search(query="auth token refresh", limit=5) # Search all agents
1729
+ cass_view(path="/path/from/search", line=42) # View result
1730
+ \`\`\`
1731
+
1732
+ 4. **Semantic Memory Section**:
1733
+
1734
+ ### Semantic Memory (Persistent Learning)
1735
+
1736
+ Store and retrieve learnings across sessions.
1737
+
1738
+ **When to Use:** After solving tricky problems, after architectural decisions, before starting work.
1739
+
1740
+ \`\`\`
1741
+ semantic-memory_store(information="OAuth needs 5min buffer", metadata="auth")
1742
+ semantic-memory_find(query="token refresh", limit=5)
1692
1743
  \`\`\`
1693
1744
 
1694
1745
  ## Rules
1695
- - Preserve the existing content and style
1696
- - Add the skills section in a logical place (near tool preferences or as a new section)
1697
- - Don't duplicate if a skills section already exists - update it instead
1698
- - Keep the tone consistent with the rest of the file
1746
+ - Preserve existing content and style
1747
+ - Don't duplicate - update if sections exist
1748
+ - Keep tone consistent
1699
1749
 
1700
1750
  Edit the file now.`;
1701
1751
 
@@ -0,0 +1,213 @@
1
+ ---
2
+ name: system-design
3
+ description: Principles for building reusable coding systems. Use when designing modules, APIs, CLIs, or any code meant to be used by others. Based on "A Philosophy of Software Design" by John Ousterhout. Covers deep modules, complexity management, and design red flags.
4
+ tags:
5
+ - design
6
+ - architecture
7
+ - modules
8
+ - complexity
9
+ ---
10
+
11
+ # System Design
12
+
13
+ Principles for building reusable, maintainable coding systems. From "A Philosophy of Software Design" by John Ousterhout.
14
+
15
+ ## Core Principle: Fight Complexity
16
+
17
+ Complexity is the root cause of most software problems. It accumulates incrementally—each shortcut adds a little, until the system becomes unmaintainable.
18
+
19
+ **Complexity defined:** Anything that makes software hard to understand or modify.
20
+
21
+ **Symptoms:**
22
+
23
+ - Change amplification: simple change requires many modifications
24
+ - Cognitive load: how much you need to know to make a change
25
+ - Unknown unknowns: not obvious what needs to change
26
+
27
+ ## Deep Modules
28
+
29
+ The most important design principle: **make modules deep**.
30
+
31
+ ```
32
+ ┌─────────────────────────────┐
33
+ │ Simple Interface │ ← Small surface area
34
+ ├─────────────────────────────┤
35
+ │ │
36
+ │ │
37
+ │ Deep Implementation │ ← Lots of functionality
38
+ │ │
39
+ │ │
40
+ └─────────────────────────────┘
41
+ ```
42
+
43
+ **Deep module:** Simple interface, lots of functionality hidden behind it.
44
+
45
+ **Shallow module:** Complex interface relative to functionality provided. Red flag.
46
+
47
+ ### Examples
48
+
49
+ **Deep:** Unix file I/O - just 5 calls (open, read, write, lseek, close) hide enormous complexity (buffering, caching, device drivers, permissions, journaling).
50
+
51
+ **Shallow:** Java's file reading requires BufferedReader wrapping FileReader wrapping FileInputStream. Interface complexity matches implementation complexity.
52
+
53
+ ### Apply This
54
+
55
+ - Prefer fewer methods that do more over many small methods
56
+ - Hide implementation details aggressively
57
+ - A module's interface should be much simpler than its implementation
58
+ - If interface is as complex as implementation, reconsider the abstraction
59
+
60
+ ## Strategic vs Tactical Programming
61
+
62
+ **Tactical:** Get it working now. Each task adds small complexities. Debt accumulates.
63
+
64
+ **Strategic:** Invest time in good design. Slower initially, faster long-term.
65
+
66
+ ```
67
+ Progress
68
+
69
+ │ Strategic ────────────────→
70
+ │ /
71
+ │ /
72
+ │ / Tactical ─────────→
73
+ │ / ↘ (slows down)
74
+ │ /
75
+ └──┴─────────────────────────────────→ Time
76
+ ```
77
+
78
+ **Rule of thumb:** Spend 10-20% of development time on design improvements.
79
+
80
+ ### Working Code Isn't Enough
81
+
82
+ "Working code" is not the goal. The goal is a great design that also works. If you're satisfied with "it works," you're programming tactically.
83
+
84
+ ## Information Hiding
85
+
86
+ Each module should encapsulate knowledge that other modules don't need.
87
+
88
+ **Information leakage (red flag):** Same knowledge appears in multiple places. If one changes, all must change.
89
+
90
+ **Temporal decomposition (red flag):** Splitting code based on when things happen rather than what information they use. Often causes leakage.
91
+
92
+ ### Apply This
93
+
94
+ - Ask: "What knowledge does this module encapsulate?"
95
+ - If the answer is "not much," the module is probably shallow
96
+ - Group code by what it knows, not when it runs
97
+ - Private by default; expose only what's necessary
98
+
99
+ ## Define Errors Out of Existence
100
+
101
+ Exceptions add complexity. The best way to handle them: design so they can't happen.
102
+
103
+ **Instead of:**
104
+
105
+ ```typescript
106
+ function deleteFile(path: string): void {
107
+ if (!exists(path)) throw new FileNotFoundError();
108
+ // delete...
109
+ }
110
+ ```
111
+
112
+ **Do:**
113
+
114
+ ```typescript
115
+ function deleteFile(path: string): void {
116
+ // Just delete. If it doesn't exist, goal is achieved.
117
+ // No error to handle.
118
+ }
119
+ ```
120
+
121
+ ### Apply This
122
+
123
+ - Redefine semantics so errors become non-issues
124
+ - Handle edge cases internally rather than exposing them
125
+ - Fewer exceptions = simpler interface = deeper module
126
+ - Ask: "Can I change the definition so this isn't an error?"
127
+
128
+ ## General-Purpose Modules
129
+
130
+ Somewhat general-purpose modules are deeper than special-purpose ones.
131
+
132
+ **Not too general:** Don't build a framework when you need a function.
133
+
134
+ **Not too specific:** Don't hardcode assumptions that limit reuse.
135
+
136
+ **Sweet spot:** Solve today's problem in a way that naturally handles tomorrow's.
137
+
138
+ ### Questions to Ask
139
+
140
+ 1. What is the simplest interface that covers all current needs?
141
+ 2. How many situations will this method be used in?
142
+ 3. Is this API easy to use for my current needs?
143
+
144
+ ## Pull Complexity Downward
145
+
146
+ When complexity is unavoidable, put it in the implementation, not the interface.
147
+
148
+ **Bad:** Expose complexity to all callers.
149
+ **Good:** Handle complexity once, internally.
150
+
151
+ It's more important for a module to have a simple interface than a simple implementation.
152
+
153
+ ### Example
154
+
155
+ Configuration: Instead of requiring callers to configure everything, provide sensible defaults. Handle the complexity of choosing defaults internally.
156
+
157
+ ## Design Twice
158
+
159
+ Before implementing, consider at least two different designs. Compare them.
160
+
161
+ **Benefits:**
162
+
163
+ - Reveals assumptions you didn't know you were making
164
+ - Often the second design is better
165
+ - Even if first design wins, you understand why
166
+
167
+ **Don't skip this:** "I can't think of another approach" usually means you haven't tried hard enough.
168
+
169
+ ## Red Flags Summary
170
+
171
+ | Red Flag | Symptom |
172
+ | ----------------------- | ------------------------------------------------ |
173
+ | Shallow module | Interface complexity ≈ implementation complexity |
174
+ | Information leakage | Same knowledge in multiple modules |
175
+ | Temporal decomposition | Code split by time, not information |
176
+ | Overexposure | Too many methods/params in interface |
177
+ | Pass-through methods | Method does little except call another |
178
+ | Repetition | Same code pattern appears multiple times |
179
+ | Special-general mixture | General-purpose code mixed with special-purpose |
180
+ | Conjoined methods | Can't understand one without reading another |
181
+ | Comment repeats code | Comment says what code obviously does |
182
+ | Vague name | Name doesn't convey much information |
183
+
184
+ ## Applying to CLI/Tool Design
185
+
186
+ When building CLIs, plugins, or tools:
187
+
188
+ 1. **Deep commands:** Few commands that do a lot, not many shallow ones
189
+ 2. **Sensible defaults:** Work without configuration for common cases
190
+ 3. **Progressive disclosure:** Simple usage first, advanced options available
191
+ 4. **Consistent interface:** Same patterns across all commands
192
+ 5. **Error elimination:** Design so common mistakes are impossible
193
+
194
+ ### Example: Good CLI Design
195
+
196
+ ```bash
197
+ # Deep: one command handles the common case well
198
+ swarm setup
199
+
200
+ # Not shallow: doesn't require 10 flags for basic usage
201
+ # Sensible defaults: picks reasonable models
202
+ # Progressive: advanced users can customize later
203
+ ```
204
+
205
+ ## Key Takeaways
206
+
207
+ 1. **Complexity is the enemy.** Every design decision should reduce it.
208
+ 2. **Deep modules win.** Simple interface, rich functionality.
209
+ 3. **Hide information.** Each module owns specific knowledge.
210
+ 4. **Define errors away.** Change semantics to eliminate edge cases.
211
+ 5. **Design twice.** Always consider alternatives.
212
+ 6. **Strategic > tactical.** Invest in design, not just working code.
213
+ 7. **Pull complexity down.** Implementation absorbs complexity, interface stays simple.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-swarm-plugin",
3
- "version": "0.12.27",
3
+ "version": "0.12.29",
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",