opencode-mad 1.0.0 → 1.0.2
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/mad-analyste.md +7 -109
- package/agents/mad-architecte.md +15 -92
- package/agents/mad-developer.md +13 -39
- package/agents/mad-fixer.md +7 -18
- package/agents/mad-merger.md +7 -18
- package/agents/mad-planner.md +76 -90
- package/agents/mad-reviewer.md +14 -57
- package/agents/mad-security.md +66 -351
- package/agents/mad-tester.md +11 -57
- package/agents/orchestrator.md +7 -15
- package/package.json +1 -1
- package/plugins/mad-plugin.ts +165 -656
- package/skills/mad-workflow/SKILL.md +79 -205
|
@@ -12,146 +12,63 @@ metadata:
|
|
|
12
12
|
|
|
13
13
|
MAD (Multi-Agent Dev) enables parallel software development by decomposing tasks into independent subtasks, each running in isolated git worktrees with dedicated specialized agents.
|
|
14
14
|
|
|
15
|
-
## Architecture
|
|
15
|
+
## Architecture
|
|
16
|
+
|
|
17
|
+
```
|
|
18
|
+
USER REQUEST → ORCHESTRATOR → ANALYSTE → ARCHITECTE → Plan
|
|
19
|
+
↓
|
|
20
|
+
┌───────────────┼───────────────┐
|
|
21
|
+
↓ ↓ ↓
|
|
22
|
+
DEVELOPER 1 DEVELOPER 2 DEVELOPER 3
|
|
23
|
+
(worktree) (worktree) (worktree)
|
|
24
|
+
↓ ↓ ↓
|
|
25
|
+
└───────────────┼───────────────┘
|
|
26
|
+
↓
|
|
27
|
+
TESTER / REVIEWER / SECURITY
|
|
28
|
+
↓
|
|
29
|
+
MERGER / FIXER (if needed)
|
|
30
|
+
↓
|
|
31
|
+
FINAL CHECK → PUSH
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Specialized Agents
|
|
35
|
+
|
|
36
|
+
| Agent | Role |
|
|
37
|
+
|-------|------|
|
|
38
|
+
| **mad-analyste** | Understands codebase, finds patterns |
|
|
39
|
+
| **mad-architecte** | Creates task breakdown, file ownership |
|
|
40
|
+
| **mad-developer** | Writes code in isolated worktrees |
|
|
41
|
+
| **mad-tester** | Runs tests, verifies functionality |
|
|
42
|
+
| **mad-reviewer** | Checks quality, best practices |
|
|
43
|
+
| **mad-security** | Audits for vulnerabilities |
|
|
44
|
+
| **mad-fixer** | Fixes errors, test failures |
|
|
45
|
+
| **mad-merger** | Resolves git merge conflicts |
|
|
46
|
+
|
|
47
|
+
## Signal Files
|
|
48
|
+
|
|
49
|
+
- `.agent-task`: Task description
|
|
50
|
+
- `.agent-done`: Completion marker
|
|
51
|
+
- `.agent-blocked`: Block marker
|
|
52
|
+
- `.agent-error`: Error details
|
|
16
53
|
|
|
17
|
-
|
|
18
|
-
USER REQUEST
|
|
19
|
-
|
|
|
20
|
-
v
|
|
21
|
-
+-------------------+
|
|
22
|
-
| ORCHESTRATOR | <- Coordinator (never codes)
|
|
23
|
-
+-------------------+
|
|
24
|
-
|
|
|
25
|
-
+-------------------+-------------------+
|
|
26
|
-
| |
|
|
27
|
-
v v
|
|
28
|
-
+-------------+ +-------------+
|
|
29
|
-
| ANALYSTE | -- analysis report --> | ARCHITECTE |
|
|
30
|
-
+-------------+ +-------------+
|
|
31
|
-
|
|
|
32
|
-
v
|
|
33
|
-
Development Plan
|
|
34
|
-
|
|
|
35
|
-
+-------------------+-------------------+
|
|
36
|
-
| | |
|
|
37
|
-
v v v
|
|
38
|
-
+-----------+ +-----------+ +-----------+
|
|
39
|
-
| DEVELOPER | | DEVELOPER | | DEVELOPER |
|
|
40
|
-
| worktree1 | | worktree2 | | worktree3 |
|
|
41
|
-
+-----------+ +-----------+ +-----------+
|
|
42
|
-
| | |
|
|
43
|
-
+-------------------+-------------------+
|
|
44
|
-
|
|
|
45
|
-
+-----------------------------+-----------------------------+
|
|
46
|
-
| | |
|
|
47
|
-
v v v
|
|
48
|
-
+----------+ +----------+ +----------+
|
|
49
|
-
| TESTER | | REVIEWER | | SECURITY |
|
|
50
|
-
+----------+ +----------+ +----------+
|
|
51
|
-
| | |
|
|
52
|
-
+-----------------------------+-----------------------------+
|
|
53
|
-
|
|
|
54
|
-
v
|
|
55
|
-
+----------+
|
|
56
|
-
| MERGER | (if conflicts)
|
|
57
|
-
+----------+
|
|
58
|
-
|
|
|
59
|
-
v
|
|
60
|
-
+----------+
|
|
61
|
-
| FIXER | (if issues)
|
|
62
|
-
+----------+
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
## Core Concepts
|
|
66
|
-
|
|
67
|
-
### Worktrees
|
|
68
|
-
Git worktrees provide isolated working directories, each on its own branch. This allows multiple tasks to be developed simultaneously without conflicts.
|
|
69
|
-
|
|
70
|
-
### Specialized Agents
|
|
71
|
-
|
|
72
|
-
| Agent | Role | Responsibility |
|
|
73
|
-
|-------|------|----------------|
|
|
74
|
-
| **mad-analyste** | Analysis | Understands codebase, finds relevant code, identifies patterns |
|
|
75
|
-
| **mad-architecte** | Planning | Creates task breakdown, file ownership, API contracts |
|
|
76
|
-
| **mad-developer** | Implementation | Writes code in isolated worktrees |
|
|
77
|
-
| **mad-tester** | Testing | Runs tests, verifies functionality |
|
|
78
|
-
| **mad-reviewer** | Code Review | Checks quality, patterns, best practices |
|
|
79
|
-
| **mad-security** | Security | Audits for vulnerabilities, injection risks |
|
|
80
|
-
| **mad-fixer** | Bug Fixing | Fixes errors, test failures, review issues |
|
|
81
|
-
| **mad-merger** | Conflicts | Resolves git merge conflicts |
|
|
54
|
+
## Workflow Phases
|
|
82
55
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
56
|
+
1. **Analysis**: Analyste understands codebase
|
|
57
|
+
2. **Planning**: Architecte creates plan with file ownership
|
|
58
|
+
3. **Approval**: User validates plan ("GO")
|
|
59
|
+
4. **Development**: Parallel developer spawning
|
|
60
|
+
5. **QA**: Testers, Reviewers, Security in parallel
|
|
61
|
+
6. **Resolution**: Fixer/Merger if issues
|
|
62
|
+
7. **Finalization**: Merge, final check, push, cleanup
|
|
88
63
|
|
|
89
|
-
##
|
|
64
|
+
## CRITICAL: Parallel Execution
|
|
90
65
|
|
|
91
|
-
|
|
92
|
-
The Orchestrator spawns an Analyste to understand the codebase:
|
|
93
|
-
- Project structure and technologies
|
|
94
|
-
- Relevant existing code
|
|
95
|
-
- Dependencies and patterns
|
|
96
|
-
- Potential impact areas
|
|
97
|
-
|
|
98
|
-
### Phase 2: Planning
|
|
99
|
-
The Orchestrator spawns an Architecte to create the plan:
|
|
100
|
-
- Task breakdown with clear boundaries
|
|
101
|
-
- File ownership (CRITICAL: no overlaps!)
|
|
102
|
-
- API contracts between components
|
|
103
|
-
- Merge order recommendation
|
|
104
|
-
|
|
105
|
-
### Phase 3: User Approval
|
|
106
|
-
The Orchestrator presents the plan and waits for "GO".
|
|
107
|
-
|
|
108
|
-
### Phase 4: Development
|
|
109
|
-
The Orchestrator:
|
|
110
|
-
1. Creates worktrees with `mad_worktree_create`
|
|
111
|
-
2. Registers permissions with `mad_register_agent`
|
|
112
|
-
3. Spawns Developers in parallel
|
|
113
|
-
|
|
114
|
-
### Phase 5: Quality Assurance
|
|
115
|
-
The Orchestrator spawns in parallel:
|
|
116
|
-
- Testers (run tests)
|
|
117
|
-
- Reviewers (check code quality)
|
|
118
|
-
- Security (audit vulnerabilities)
|
|
119
|
-
|
|
120
|
-
### Phase 6: Resolution
|
|
121
|
-
If issues found:
|
|
122
|
-
- Spawn Fixer for bugs/review issues
|
|
123
|
-
- Spawn Merger for conflicts
|
|
124
|
-
|
|
125
|
-
### Phase 7: Finalization
|
|
126
|
-
- Merge all branches
|
|
127
|
-
- Run `mad_final_check`
|
|
128
|
-
- Push with `mad_push_and_watch`
|
|
129
|
-
- Cleanup worktrees
|
|
130
|
-
|
|
131
|
-
## CRITICAL: Parallel Execution is MANDATORY
|
|
132
|
-
|
|
133
|
-
The entire purpose of MAD is to run tasks IN PARALLEL.
|
|
134
|
-
|
|
135
|
-
### WRONG - Sequential (defeats the purpose)
|
|
136
|
-
```
|
|
137
|
-
Message 1: mad_worktree_create(branch: "feat-a", ...)
|
|
138
|
-
Message 2: mad_worktree_create(branch: "feat-b", ...)
|
|
139
|
-
Message 3: Task(subagent_type: "mad-developer", ...) for feat-a
|
|
140
|
-
Message 4: Task(subagent_type: "mad-developer", ...) for feat-b
|
|
141
|
-
```
|
|
66
|
+
**The entire purpose of MAD is to run tasks IN PARALLEL.**
|
|
142
67
|
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
mad_worktree_create(branch: "feat-b", ...)
|
|
148
|
-
mad_worktree_create(branch: "feat-c", ...)
|
|
149
|
-
|
|
150
|
-
Single Message containing:
|
|
151
|
-
Task(subagent_type: "mad-developer", ...) for feat-a
|
|
152
|
-
Task(subagent_type: "mad-developer", ...) for feat-b
|
|
153
|
-
Task(subagent_type: "mad-developer", ...) for feat-c
|
|
154
|
-
```
|
|
68
|
+
All independent operations MUST be in a single message:
|
|
69
|
+
- Create all worktrees together
|
|
70
|
+
- Spawn all developers together
|
|
71
|
+
- Run all QA agents together
|
|
155
72
|
|
|
156
73
|
If you're not parallelizing, you're not using MAD correctly!
|
|
157
74
|
|
|
@@ -159,19 +76,30 @@ If you're not parallelizing, you're not using MAD correctly!
|
|
|
159
76
|
|
|
160
77
|
Each task MUST have exclusive ownership. Two agents must NEVER modify the same file.
|
|
161
78
|
|
|
162
|
-
**Good:**
|
|
163
79
|
```
|
|
164
80
|
Task 1: OWNS /backend/**
|
|
165
81
|
Task 2: OWNS /frontend/**
|
|
166
82
|
Task 3: OWNS /package.json, /README.md
|
|
167
83
|
```
|
|
168
84
|
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
85
|
+
## Silence Protocol
|
|
86
|
+
|
|
87
|
+
**CRITICAL: Subagents MUST NOT output verbose commentary.**
|
|
88
|
+
|
|
89
|
+
### Rules for Subagents:
|
|
90
|
+
1. **No status updates** - Don't say "I'm now going to..."
|
|
91
|
+
2. **No explanations** - Don't explain what you're doing
|
|
92
|
+
3. **No summaries** - Don't summarize at the end
|
|
93
|
+
4. **Actions only** - Just execute tools and complete the task
|
|
94
|
+
5. **Signal via tools** - Use `mad_done` or `mad_blocked` to communicate
|
|
95
|
+
|
|
96
|
+
### Why?
|
|
97
|
+
- Reduces token usage dramatically
|
|
98
|
+
- Speeds up execution
|
|
99
|
+
- Orchestrator monitors via `mad_status`, not agent output
|
|
100
|
+
|
|
101
|
+
### Orchestrator Exception:
|
|
102
|
+
The orchestrator MAY output status to keep the user informed, but should remain concise.
|
|
175
103
|
|
|
176
104
|
## Available Tools
|
|
177
105
|
|
|
@@ -181,74 +109,20 @@ Task 2: "Create signup page"
|
|
|
181
109
|
| `mad_status` | Dashboard of all worktrees |
|
|
182
110
|
| `mad_visualize` | ASCII art visualization |
|
|
183
111
|
| `mad_test` | Run tests on worktree |
|
|
184
|
-
| `mad_merge` | Merge completed branch |
|
|
112
|
+
| `mad_merge` | Merge completed branch (uses --no-ff) |
|
|
185
113
|
| `mad_cleanup` | Remove worktree |
|
|
186
114
|
| `mad_done` | Mark task complete |
|
|
187
115
|
| `mad_blocked` | Mark task blocked |
|
|
188
116
|
| `mad_read_task` | Read task description |
|
|
189
117
|
| `mad_register_agent` | Register agent permissions |
|
|
190
|
-
| `mad_final_check` | Run global build/lint
|
|
191
|
-
| `mad_push_and_watch` | Push
|
|
192
|
-
|
|
193
|
-
> **Note:** `mad_merge` automatically uses `--no-ff` to preserve history. If you ever need to merge manually, always use `git merge --no-ff`.
|
|
194
|
-
|
|
195
|
-
## Example Session
|
|
196
|
-
|
|
197
|
-
Request: "Add user authentication with login, signup, and password reset"
|
|
198
|
-
|
|
199
|
-
### 1. Analysis Phase
|
|
200
|
-
```
|
|
201
|
-
Task(subagent_type: "mad-analyste", ...)
|
|
202
|
-
-> Returns: "Project uses Express + React, auth should go in /backend/auth/** and /frontend/auth/**"
|
|
203
|
-
```
|
|
204
|
-
|
|
205
|
-
### 2. Planning Phase
|
|
206
|
-
```
|
|
207
|
-
Task(subagent_type: "mad-architecte", ...)
|
|
208
|
-
-> Returns plan with 3 tasks:
|
|
209
|
-
- feat-auth-backend: OWNS /backend/auth/**
|
|
210
|
-
- feat-auth-frontend: OWNS /frontend/auth/**
|
|
211
|
-
- feat-auth-config: OWNS /config/auth.js
|
|
212
|
-
```
|
|
213
|
-
|
|
214
|
-
### 3. Development Phase
|
|
215
|
-
```
|
|
216
|
-
mad_worktree_create(branch: "feat-auth-backend", ...)
|
|
217
|
-
mad_worktree_create(branch: "feat-auth-frontend", ...)
|
|
218
|
-
mad_worktree_create(branch: "feat-auth-config", ...)
|
|
219
|
-
|
|
220
|
-
mad_register_agent(sessionID: "...", agentType: "developer", allowedPaths: ["/backend/auth/**"], ...)
|
|
221
|
-
Task(subagent_type: "mad-developer", ...) for backend
|
|
222
|
-
Task(subagent_type: "mad-developer", ...) for frontend
|
|
223
|
-
Task(subagent_type: "mad-developer", ...) for config
|
|
224
|
-
```
|
|
225
|
-
|
|
226
|
-
### 4. Quality Phase
|
|
227
|
-
```
|
|
228
|
-
Task(subagent_type: "mad-tester", ...) for each worktree
|
|
229
|
-
Task(subagent_type: "mad-reviewer", ...) for each worktree
|
|
230
|
-
Task(subagent_type: "mad-security", ...) for each worktree
|
|
231
|
-
```
|
|
232
|
-
|
|
233
|
-
### 5. Finalization
|
|
234
|
-
```
|
|
235
|
-
mad_merge(worktree: "feat-auth-config")
|
|
236
|
-
mad_merge(worktree: "feat-auth-backend")
|
|
237
|
-
mad_merge(worktree: "feat-auth-frontend")
|
|
238
|
-
mad_final_check()
|
|
239
|
-
mad_push_and_watch()
|
|
240
|
-
mad_cleanup(worktree: "feat-auth-backend")
|
|
241
|
-
mad_cleanup(worktree: "feat-auth-frontend")
|
|
242
|
-
mad_cleanup(worktree: "feat-auth-config")
|
|
243
|
-
```
|
|
118
|
+
| `mad_final_check` | Run global build/lint |
|
|
119
|
+
| `mad_push_and_watch` | Push and watch CI |
|
|
244
120
|
|
|
245
121
|
## Best Practices
|
|
246
122
|
|
|
247
|
-
1. **Delegate everything** - Orchestrator
|
|
248
|
-
2. **Keep subtasks focused** -
|
|
249
|
-
3. **Name branches clearly** - `feat/`, `fix/`, `refactor/`
|
|
250
|
-
4. **Test before merge** - Always run
|
|
251
|
-
5. **
|
|
252
|
-
6. **
|
|
253
|
-
7. **Always use `--no-ff` for merges** - Preserves feature history and enables easy reverts
|
|
254
|
-
8. **Register permissions** - Use `mad_register_agent` before spawning developers
|
|
123
|
+
1. **Delegate everything** - Orchestrator never codes
|
|
124
|
+
2. **Keep subtasks focused** - Completable in one session
|
|
125
|
+
3. **Name branches clearly** - `feat/`, `fix/`, `refactor/`
|
|
126
|
+
4. **Test before merge** - Always run QA first
|
|
127
|
+
5. **Merge sequentially** - Avoid conflict cascades
|
|
128
|
+
6. **Register permissions** - Before spawning developers
|