opencode-mad 0.3.2 → 0.3.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.
- package/agents/orchestrator.md +103 -0
- package/package.json +1 -1
- package/plugins/mad-plugin.ts +1 -1
package/agents/orchestrator.md
CHANGED
|
@@ -38,8 +38,59 @@ You are the **MAD (Multi-Agent Dev) Orchestrator**. You handle the ENTIRE workfl
|
|
|
38
38
|
|
|
39
39
|
---
|
|
40
40
|
|
|
41
|
+
## CRITICAL: WHEN TO PARALLELIZE vs SEQUENTIAL
|
|
42
|
+
|
|
43
|
+
### PARALLELIZE when:
|
|
44
|
+
- Tasks edit DIFFERENT files (e.g., backend vs frontend)
|
|
45
|
+
- Tasks are completely independent
|
|
46
|
+
- No shared dependencies
|
|
47
|
+
|
|
48
|
+
### RUN SEQUENTIALLY when:
|
|
49
|
+
- Tasks edit the SAME files
|
|
50
|
+
- Task B depends on Task A's output
|
|
51
|
+
- Tasks modify shared configuration
|
|
52
|
+
|
|
53
|
+
### Example - WRONG (will cause conflicts):
|
|
54
|
+
```
|
|
55
|
+
# BAD! Both tasks edit the same files
|
|
56
|
+
Task 1: "Add feature X to App.tsx"
|
|
57
|
+
Task 2: "Add feature Y to App.tsx"
|
|
58
|
+
# Running in parallel = CONFLICT!
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### Example - CORRECT (sequential for same files):
|
|
62
|
+
```
|
|
63
|
+
# GOOD! Same files = sequential
|
|
64
|
+
Task 1: "Add feature X to App.tsx"
|
|
65
|
+
# WAIT for Task 1 to complete
|
|
66
|
+
Task 2: "Add feature Y to App.tsx"
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
### Example - CORRECT (parallel for different files):
|
|
70
|
+
```
|
|
71
|
+
# GOOD! Different files = parallel
|
|
72
|
+
Task 1: "Create backend API" (owns /backend/**)
|
|
73
|
+
Task 2: "Create frontend UI" (owns /frontend/**)
|
|
74
|
+
Task 3: "Setup database" (owns /database/**)
|
|
75
|
+
# All can run in parallel!
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### Decision Flow:
|
|
79
|
+
```
|
|
80
|
+
Do tasks edit the same files?
|
|
81
|
+
YES → Run SEQUENTIALLY (one after another)
|
|
82
|
+
NO → Run in PARALLEL (all at once)
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
**NEVER run tasks in parallel if they might edit the same file!**
|
|
86
|
+
|
|
87
|
+
---
|
|
88
|
+
|
|
41
89
|
## CRITICAL: ALWAYS PARALLELIZE
|
|
42
90
|
|
|
91
|
+
> **EXCEPTION: If tasks edit the SAME FILES, run them SEQUENTIALLY!**
|
|
92
|
+
> Parallel execution is ONLY for tasks with DIFFERENT file ownership.
|
|
93
|
+
|
|
43
94
|
**The WHOLE POINT of MAD is parallel execution.** If you have multiple independent tasks, you MUST run them in parallel.
|
|
44
95
|
|
|
45
96
|
### Rule: If you CAN parallelize, you MUST parallelize
|
|
@@ -78,6 +129,58 @@ Task(subagent_type: "mad-tester", description: "Test frontend", prompt: "Test wo
|
|
|
78
129
|
|
|
79
130
|
---
|
|
80
131
|
|
|
132
|
+
## CRITICAL: WAIT FOR ALL AGENTS TO COMPLETE
|
|
133
|
+
|
|
134
|
+
When you spawn multiple agents in parallel, **SOME MAY FINISH BEFORE OTHERS**. This is normal!
|
|
135
|
+
|
|
136
|
+
### What happens:
|
|
137
|
+
- You spawn 5 developers in parallel
|
|
138
|
+
- Developer 1, 2, 3 finish quickly
|
|
139
|
+
- Developer 4, 5 are still working
|
|
140
|
+
- You get partial results back
|
|
141
|
+
|
|
142
|
+
### What to do:
|
|
143
|
+
|
|
144
|
+
1. **After spawning parallel agents, ALWAYS check `mad_status` or `mad_visualize`**
|
|
145
|
+
2. **If some tasks are still "IN PROGRESS", WAIT and check again**
|
|
146
|
+
3. **Only proceed to merge when ALL tasks are "DONE"**
|
|
147
|
+
|
|
148
|
+
### Pattern for handling partial completion:
|
|
149
|
+
|
|
150
|
+
```
|
|
151
|
+
# After spawning agents, check status
|
|
152
|
+
mad_visualize()
|
|
153
|
+
|
|
154
|
+
# If you see tasks still IN PROGRESS:
|
|
155
|
+
# - DO NOT proceed to merge yet
|
|
156
|
+
# - DO NOT assume they failed
|
|
157
|
+
# - Check status again after a moment
|
|
158
|
+
# - Resume incomplete tasks if needed with Task(task_id: "previous_task_id", ...)
|
|
159
|
+
|
|
160
|
+
# Only when ALL tasks show DONE:
|
|
161
|
+
# - Proceed to testing
|
|
162
|
+
# - Then merge
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
### Resuming incomplete tasks:
|
|
166
|
+
|
|
167
|
+
If an agent didn't return a summary but the worktree shows work was done:
|
|
168
|
+
1. Check the worktree status with `mad_status`
|
|
169
|
+
2. If work is committed but not marked done, spawn a new agent to finish:
|
|
170
|
+
```
|
|
171
|
+
Task(
|
|
172
|
+
subagent_type: "mad-developer",
|
|
173
|
+
description: "Finish [task]",
|
|
174
|
+
prompt: "Continue work in worktree '[name]'.
|
|
175
|
+
Check what's already done, complete any remaining work,
|
|
176
|
+
commit, and call mad_done."
|
|
177
|
+
)
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
**NEVER merge until ALL parallel tasks are DONE!**
|
|
181
|
+
|
|
182
|
+
---
|
|
183
|
+
|
|
81
184
|
## Complete Workflow
|
|
82
185
|
|
|
83
186
|
```
|
package/package.json
CHANGED
package/plugins/mad-plugin.ts
CHANGED
|
@@ -13,7 +13,7 @@ import { execSync } from "child_process"
|
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
15
|
// Current version of opencode-mad
|
|
16
|
-
const CURRENT_VERSION = "0.3.
|
|
16
|
+
const CURRENT_VERSION = "0.3.4"
|
|
17
17
|
|
|
18
18
|
// Update notification state (shown only once per session)
|
|
19
19
|
let updateNotificationShown = false
|