opencode-swarm-plugin 0.12.28 → 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
@@ -204,6 +204,7 @@ skills_use(name="swarm-coordination") # Load swarm workflow
204
204
  | `mcp-tool-authoring` | mcp, tools | Building MCP tools - schema definition, context passing, error handling |
205
205
  | `skill-creator` | meta, skills | Guide for creating effective skills |
206
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 |
207
208
 
208
209
  ### Skill Locations
209
210
 
@@ -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.28",
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",