maestro-flow 0.3.48 → 0.3.49
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/.claude/agents/impeccable-agent.md +99 -0
- package/.claude/commands/maestro-analyze.md +2 -2
- package/.claude/commands/maestro-brainstorm.md +116 -112
- package/.claude/commands/maestro-composer.md +5 -0
- package/.claude/commands/maestro-impeccable.md +46 -9
- package/.claude/commands/maestro-merge.md +3 -0
- package/.claude/commands/maestro-roadmap.md +5 -1
- package/.claude/commands/maestro-ui-craft.md +56 -4
- package/.claude/commands/maestro.md +1 -1
- package/.claude/commands/manage-issue-discover.md +4 -0
- package/.claude/commands/quality-refactor.md +3 -0
- package/.claude/skills/maestro-help/index/catalog.json +1 -1
- package/.claude/skills/maestro-help/phases/01-parse-intent.md +1 -1
- package/.claude/skills/maestro-impeccable/SKILL.md +3 -1
- package/.codex/skills/maestro/SKILL.md +3 -3
- package/.codex/skills/maestro-brainstorm/SKILL.md +19 -2
- package/.codex/skills/maestro-composer/SKILL.md +5 -0
- package/.codex/skills/maestro-help/catalog.json +1 -1
- package/.codex/skills/maestro-impeccable/SKILL.md +24 -5
- package/.codex/skills/maestro-merge/SKILL.md +3 -0
- package/.codex/skills/maestro-milestone-audit/SKILL.md +64 -7
- package/.codex/skills/maestro-quick/SKILL.md +1 -1
- package/.codex/skills/maestro-roadmap/SKILL.md +1 -1
- package/.codex/skills/maestro-tools-execute/SKILL.md +1 -1
- package/.codex/skills/maestro-tools-register/SKILL.md +1 -1
- package/.codex/skills/maestro-ui-craft/SKILL.md +51 -6
- package/.codex/skills/quality-refactor/SKILL.md +114 -22
- package/chains/_intent-map.json +1 -1
- package/chains/singles/ui-design.json +4 -4
- package/chains/{ui-design-driven.json → ui-craft-build.json} +8 -8
- package/dashboard/dist-server/dashboard/src/server/coordinator/chain-map.js +3 -3
- package/dashboard/dist-server/dashboard/src/server/coordinator/chain-map.js.map +1 -1
- package/dist/src/commands/delegate.d.ts.map +1 -1
- package/dist/src/commands/delegate.js +12 -7
- package/dist/src/commands/delegate.js.map +1 -1
- package/dist/src/commands/impeccable.d.ts +2 -1
- package/dist/src/commands/impeccable.d.ts.map +1 -1
- package/dist/src/commands/impeccable.js +80 -1
- package/dist/src/commands/impeccable.js.map +1 -1
- package/package.json +1 -1
- package/templates/planning-roles/ui-designer.md +86 -99
- package/templates/workflows/specs/node-catalog.md +1 -1
- package/workflows/brainstorm.md +26 -0
- package/workflows/cli-tools-usage.md +9 -26
- package/workflows/delegate-usage.md +301 -343
- package/workflows/impeccable/design.md +462 -0
- package/workflows/impeccable/explore.md +157 -0
- package/workflows/impeccable/shape.md +4 -0
- package/workflows/impeccable/ui-search/__pycache__/core.cpython-313.pyc +0 -0
- package/workflows/impeccable/ui-search/__pycache__/design_system.cpython-313.pyc +0 -0
- package/workflows/impeccable/ui-search/core.py +262 -0
- package/workflows/impeccable/ui-search/data/app-interface.csv +31 -0
- package/workflows/impeccable/ui-search/data/charts.csv +26 -0
- package/workflows/impeccable/ui-search/data/colors.csv +162 -0
- package/workflows/impeccable/ui-search/data/design.csv +1776 -0
- package/workflows/impeccable/ui-search/data/draft.csv +1779 -0
- package/workflows/impeccable/ui-search/data/google-fonts.csv +1924 -0
- package/workflows/impeccable/ui-search/data/icons.csv +106 -0
- package/workflows/impeccable/ui-search/data/landing.csv +35 -0
- package/workflows/impeccable/ui-search/data/products.csv +162 -0
- package/workflows/impeccable/ui-search/data/react-performance.csv +45 -0
- package/workflows/impeccable/ui-search/data/stacks/angular.csv +51 -0
- package/workflows/impeccable/ui-search/data/stacks/astro.csv +54 -0
- package/workflows/impeccable/ui-search/data/stacks/flutter.csv +53 -0
- package/workflows/impeccable/ui-search/data/stacks/html-tailwind.csv +56 -0
- package/workflows/impeccable/ui-search/data/stacks/jetpack-compose.csv +53 -0
- package/workflows/impeccable/ui-search/data/stacks/laravel.csv +51 -0
- package/workflows/impeccable/ui-search/data/stacks/nextjs.csv +53 -0
- package/workflows/impeccable/ui-search/data/stacks/nuxt-ui.csv +51 -0
- package/workflows/impeccable/ui-search/data/stacks/nuxtjs.csv +59 -0
- package/workflows/impeccable/ui-search/data/stacks/react-native.csv +52 -0
- package/workflows/impeccable/ui-search/data/stacks/react.csv +54 -0
- package/workflows/impeccable/ui-search/data/stacks/shadcn.csv +61 -0
- package/workflows/impeccable/ui-search/data/stacks/svelte.csv +54 -0
- package/workflows/impeccable/ui-search/data/stacks/swiftui.csv +51 -0
- package/workflows/impeccable/ui-search/data/stacks/threejs.csv +54 -0
- package/workflows/impeccable/ui-search/data/stacks/vue.csv +50 -0
- package/workflows/impeccable/ui-search/data/styles.csv +85 -0
- package/workflows/impeccable/ui-search/data/typography.csv +74 -0
- package/workflows/impeccable/ui-search/data/ui-reasoning.csv +162 -0
- package/workflows/impeccable/ui-search/data/ux-guidelines.csv +100 -0
- package/workflows/impeccable/ui-search/design_system.py +1148 -0
- package/workflows/impeccable/ui-search/prototype-template.html +511 -0
- package/workflows/impeccable/ui-search/render-prototype.js +208 -0
- package/workflows/impeccable/ui-search/search.py +114 -0
- package/workflows/maestro-chain-execute.md +2 -2
- package/workflows/maestro.codex.md +3 -3
- package/workflows/maestro.md +5 -5
- package/workflows/plan.md +1 -1
- package/workflows/ui-design.md +1 -1
- package/workflows/ui-style.md +1 -1
- package/.claude/commands/maestro-ui-design.md +0 -104
- package/.codex/skills/maestro-ui-design/SKILL.md +0 -242
|
@@ -1,343 +1,301 @@
|
|
|
1
|
-
# Delegate Execution Specification
|
|
2
|
-
|
|
3
|
-
<purpose>
|
|
4
|
-
Unified reference for `maestro delegate` — synchronous task delegation with broker-managed lifecycle, message injection, and MCP notifications.
|
|
5
|
-
</purpose>
|
|
6
|
-
|
|
7
|
-
**References**: `~/.maestro/cli-tools.json` (tool config), `~/.maestro/templates/cli/` (protocol + prompt templates)
|
|
8
|
-
|
|
9
|
-
---
|
|
10
|
-
|
|
11
|
-
## 1. Quick Reference
|
|
12
|
-
|
|
13
|
-
<context>
|
|
14
|
-
|
|
15
|
-
### Command Syntax
|
|
16
|
-
|
|
17
|
-
```bash
|
|
18
|
-
maestro delegate "<PROMPT>" [options]
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
### Options
|
|
22
|
-
|
|
23
|
-
| Option | Description | Default |
|
|
24
|
-
|--------|-------------|---------|
|
|
25
|
-
| `--to <tool>` | Explicit tool: gemini, qwen, codex, claude, opencode | First enabled in config |
|
|
26
|
-
| `--role <role>` | Capability role: analyze, explore, review, implement, plan, brainstorm, research | — (resolves via config) |
|
|
27
|
-
| `--mode <mode>` | `analysis` (read-only) or `write` (create/modify/delete) | `analysis` |
|
|
28
|
-
| `--model <model>` | Model override | Tool's `primaryModel` |
|
|
29
|
-
| `--cd <dir>` | Working directory | Current directory |
|
|
30
|
-
| `--rule <template>` | Load protocol + prompt template | — (optional) |
|
|
31
|
-
| `--id <id>` | Execution ID | Auto: `{prefix}-{HHmmss}-{rand4}` |
|
|
32
|
-
| `--resume [id]` | Resume previous session (last if no id) | — |
|
|
33
|
-
| `--includeDirs <dirs>` | Additional directories (comma-separated) | — |
|
|
34
|
-
| `--backend <type>` | Adapter backend: `direct` or `terminal` (tmux/wezterm) | `direct` |
|
|
35
|
-
|
|
36
|
-
### Tool Resolution Priority
|
|
37
|
-
|
|
38
|
-
1. `--to <tool>` — explicit tool selection (backward compat, highest priority)
|
|
39
|
-
2. `--role <role>` — capability-based auto-selection via config
|
|
40
|
-
3. No flag — first enabled tool in config
|
|
41
|
-
|
|
42
|
-
### Role-Based Tool Selection
|
|
43
|
-
|
|
44
|
-
Roles map to tools via `cli-tools.json` configuration:
|
|
45
|
-
- User-defined roles in `roles` section override built-in defaults
|
|
46
|
-
- Workspace `.maestro/cli-tools.json` overrides global `~/.maestro/cli-tools.json`
|
|
47
|
-
- Built-in roles: `analyze`, `explore`, `review`, `implement`, `plan`, `brainstorm`, `research`
|
|
48
|
-
|
|
49
|
-
### Mode Definition (Authoritative)
|
|
50
|
-
|
|
51
|
-
| Mode | Permission | Auto-Invoke Safe | Use For |
|
|
52
|
-
|------|-----------|------------------|---------|
|
|
53
|
-
| `analysis` | Read-only | Yes | Review, exploration, diagnosis, architecture analysis |
|
|
54
|
-
| `write` | Create/Modify/Delete | No — requires explicit intent | Implementation, bug fixes, refactoring |
|
|
55
|
-
|
|
56
|
-
> `--mode` is the **authoritative** permission control. The `MODE:` field inside prompt text is a hint for the agent — both should be consistent, but `--mode` governs actual behavior.
|
|
57
|
-
</context>
|
|
58
|
-
|
|
59
|
-
---
|
|
60
|
-
|
|
61
|
-
## 2. Configuration
|
|
62
|
-
|
|
63
|
-
<context>
|
|
64
|
-
|
|
65
|
-
### Config File: `~/.maestro/cli-tools.json`
|
|
66
|
-
|
|
67
|
-
| Field | Description |
|
|
68
|
-
|-------|-------------|
|
|
69
|
-
| `enabled` | Tool availability |
|
|
70
|
-
| `primaryModel` | Default model |
|
|
71
|
-
| `secondaryModel` | Fallback model |
|
|
72
|
-
| `tags` | Capability tags (for caller-side routing) |
|
|
73
|
-
| `type` | `builtin` / `cli-wrapper` / `api-endpoint` |
|
|
74
|
-
|
|
75
|
-
> `api-endpoint` tools support **analysis only** — no file write capability.
|
|
76
|
-
|
|
77
|
-
### Tool Selection
|
|
78
|
-
|
|
79
|
-
1. Explicit `--to` specified → use it (validate enabled)
|
|
80
|
-
2. No `--to` → first enabled tool in config order
|
|
81
|
-
|
|
82
|
-
### Fallback Chain
|
|
83
|
-
|
|
84
|
-
Primary model fails → `secondaryModel` → next enabled tool → first enabled (default).
|
|
85
|
-
|
|
86
|
-
### MCP Server Startup
|
|
87
|
-
|
|
88
|
-
```bash
|
|
89
|
-
# Claude Code — load Maestro as development MCP server
|
|
90
|
-
claude --dangerously-load-development-channels server:maestro --dangerously-skip-permissions
|
|
91
|
-
```
|
|
92
|
-
|
|
93
|
-
With MCP connected, all delegate tools are available programmatically.
|
|
94
|
-
</context>
|
|
95
|
-
|
|
96
|
-
---
|
|
97
|
-
|
|
98
|
-
## 3. Prompt Construction
|
|
99
|
-
|
|
100
|
-
<context>
|
|
101
|
-
|
|
102
|
-
### Assembly Order
|
|
103
|
-
|
|
104
|
-
`maestro delegate` builds the final prompt as:
|
|
105
|
-
|
|
106
|
-
1. **Mode protocol** — `~/.maestro/templates/cli/protocols/{mode}-protocol.md`
|
|
107
|
-
2. **User prompt** — the positional `"<PROMPT>"` value
|
|
108
|
-
3. **Rule template** — `~/.maestro/templates/cli/prompts/{rule}.txt` (if `--rule` specified)
|
|
109
|
-
|
|
110
|
-
### Prompt Template (6 Fields)
|
|
111
|
-
|
|
112
|
-
```
|
|
113
|
-
PURPOSE: [goal] + [why] + [success criteria]
|
|
114
|
-
TASK: [step 1] | [step 2] | [step 3]
|
|
115
|
-
MODE: analysis|write
|
|
116
|
-
CONTEXT: @[file patterns] | Memory: [prior work context]
|
|
117
|
-
EXPECTED: [output format] + [quality criteria]
|
|
118
|
-
CONSTRAINTS: [scope limits] | [special requirements]
|
|
119
|
-
```
|
|
120
|
-
|
|
121
|
-
- **PURPOSE**: What + Why + Success. Not "Analyze code" but "Identify auth vulnerabilities; success = OWASP Top 10 covered"
|
|
122
|
-
- **TASK**: Specific verbs. Not "Review code" but "Scan for SQL injection | Check XSS | Verify CSRF"
|
|
123
|
-
- **MODE**: Must match `--mode` flag
|
|
124
|
-
- **CONTEXT**: File scope + memory from prior work
|
|
125
|
-
- **EXPECTED**: Deliverable format, not just "Report"
|
|
126
|
-
- **CONSTRAINTS**: Task-specific limits (vs `--rule` which loads generic templates)
|
|
127
|
-
|
|
128
|
-
### CONTEXT: File Patterns + Directory
|
|
129
|
-
|
|
130
|
-
- `@**/*` — all files in working directory (default)
|
|
131
|
-
- `@src/**/*.ts` — scoped pattern
|
|
132
|
-
- `@../shared/**/*` — sibling directory (**requires `--includeDirs`**)
|
|
133
|
-
|
|
134
|
-
**Rule**: If CONTEXT uses `@../dir/**/*`, must add `--includeDirs ../dir`.
|
|
135
|
-
|
|
136
|
-
```bash
|
|
137
|
-
maestro delegate "CONTEXT: @**/* @../shared/**/*" --to gemini --mode analysis \
|
|
138
|
-
--cd "src/auth" --includeDirs "../shared"
|
|
139
|
-
```
|
|
140
|
-
|
|
141
|
-
### CONTEXT: Memory
|
|
142
|
-
|
|
143
|
-
Include when building on previous work:
|
|
144
|
-
|
|
145
|
-
```
|
|
146
|
-
Memory: Building on auth refactoring (commit abc123), implementing refresh tokens
|
|
147
|
-
Memory: Integration with auth module, using shared error patterns
|
|
148
|
-
```
|
|
149
|
-
|
|
150
|
-
### --rule Templates
|
|
151
|
-
|
|
152
|
-
**Universal**: `universal-rigorous-style`, `universal-creative-style`
|
|
153
|
-
|
|
154
|
-
**Analysis**: `analysis-trace-code-execution`, `analysis-diagnose-bug-root-cause`, `analysis-analyze-code-patterns`, `analysis-analyze-technical-document`, `analysis-review-architecture`, `analysis-review-code-quality`, `analysis-analyze-performance`, `analysis-assess-security-risks`
|
|
155
|
-
|
|
156
|
-
**Planning**: `planning-plan-architecture-design`, `planning-breakdown-task-steps`, `planning-design-component-spec`, `planning-plan-migration-strategy`
|
|
157
|
-
|
|
158
|
-
**Development**: `development-implement-feature`, `development-refactor-codebase`, `development-generate-tests`, `development-implement-component-ui`, `development-debug-runtime-issues`
|
|
159
|
-
|
|
160
|
-
### Complete Example
|
|
161
|
-
|
|
162
|
-
```bash
|
|
163
|
-
maestro delegate "PURPOSE: Identify OWASP Top 10 vulnerabilities in auth module; success = all critical/high documented with remediation
|
|
164
|
-
TASK: Scan for injection flaws | Check auth bypass vectors | Evaluate session management | Assess data exposure
|
|
165
|
-
MODE: analysis
|
|
166
|
-
CONTEXT: @src/auth/**/* @src/middleware/auth.ts | Memory: Using bcrypt + JWT
|
|
167
|
-
EXPECTED: Severity matrix, file:line references, remediation snippets, priority ranking
|
|
168
|
-
CONSTRAINTS: Focus on authentication | Ignore test files
|
|
169
|
-
" --to gemini --mode analysis --rule analysis-assess-security-risks --cd "src/auth"
|
|
170
|
-
```
|
|
171
|
-
</context>
|
|
172
|
-
|
|
173
|
-
---
|
|
174
|
-
|
|
175
|
-
## 4. Execution
|
|
176
|
-
|
|
177
|
-
<execution>
|
|
178
|
-
|
|
179
|
-
### Calling Convention
|
|
180
|
-
|
|
181
|
-
`maestro delegate` runs synchronously
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
```
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
maestro delegate "
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
maestro delegate "
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
|
251
|
-
|
|
252
|
-
|
|
|
253
|
-
|
|
|
254
|
-
|
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
- Use `--role` for capability-based tool selection; fallback chain is config-driven
|
|
303
|
-
- Rule suggestions are guidelines — choose the best fit
|
|
304
|
-
- Use `inject` for supplementary context mid-execution; `after_complete` for chained multi-step tasks
|
|
305
|
-
</execution>
|
|
306
|
-
|
|
307
|
-
---
|
|
308
|
-
|
|
309
|
-
## 6. Workflows
|
|
310
|
-
|
|
311
|
-
<execution>
|
|
312
|
-
|
|
313
|
-
### Basic Usage
|
|
314
|
-
|
|
315
|
-
```
|
|
316
|
-
Bash({
|
|
317
|
-
command: 'maestro delegate "analyze auth module" --to gemini',
|
|
318
|
-
run_in_background: true
|
|
319
|
-
})
|
|
320
|
-
// → STOP, wait for callback
|
|
321
|
-
// → on callback: maestro delegate output <id>
|
|
322
|
-
```
|
|
323
|
-
|
|
324
|
-
### Inject Supplementary Context
|
|
325
|
-
|
|
326
|
-
```bash
|
|
327
|
-
maestro delegate message gem-143022-a7f2 "Also check src/utils/sanitize.ts"
|
|
328
|
-
# → accepted: true, delivery: inject
|
|
329
|
-
```
|
|
330
|
-
|
|
331
|
-
### Chain: Analyze → Fix
|
|
332
|
-
|
|
333
|
-
```
|
|
334
|
-
Bash({
|
|
335
|
-
command: 'maestro delegate "find SQL injection vulnerabilities" --to gemini',
|
|
336
|
-
run_in_background: true
|
|
337
|
-
})
|
|
338
|
-
// → STOP, wait for callback
|
|
339
|
-
// → on callback: chain next step
|
|
340
|
-
maestro delegate message gem-143022-a7f2 "Fix all critical vulnerabilities" --delivery after_complete
|
|
341
|
-
// → queued, relaunches after analysis completes
|
|
342
|
-
```
|
|
343
|
-
</execution>
|
|
1
|
+
# Delegate Execution Specification
|
|
2
|
+
|
|
3
|
+
<purpose>
|
|
4
|
+
Unified reference for `maestro delegate` — synchronous task delegation with broker-managed lifecycle, message injection, and MCP notifications.
|
|
5
|
+
</purpose>
|
|
6
|
+
|
|
7
|
+
**References**: `~/.maestro/cli-tools.json` (tool config), `~/.maestro/templates/cli/` (protocol + prompt templates)
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## 1. Quick Reference
|
|
12
|
+
|
|
13
|
+
<context>
|
|
14
|
+
|
|
15
|
+
### Command Syntax
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
maestro delegate "<PROMPT>" [options]
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
### Options
|
|
22
|
+
|
|
23
|
+
| Option | Description | Default |
|
|
24
|
+
|--------|-------------|---------|
|
|
25
|
+
| `--to <tool>` | Explicit tool: gemini, qwen, codex, claude, opencode | First enabled in config |
|
|
26
|
+
| `--role <role>` | Capability role: analyze, explore, review, implement, plan, brainstorm, research | — (resolves via config) |
|
|
27
|
+
| `--mode <mode>` | `analysis` (read-only) or `write` (create/modify/delete) | `analysis` |
|
|
28
|
+
| `--model <model>` | Model override | Tool's `primaryModel` |
|
|
29
|
+
| `--cd <dir>` | Working directory | Current directory |
|
|
30
|
+
| `--rule <template>` | Load protocol + prompt template | — (optional) |
|
|
31
|
+
| `--id <id>` | Execution ID | Auto: `{prefix}-{HHmmss}-{rand4}` |
|
|
32
|
+
| `--resume [id]` | Resume previous session (last if no id) | — |
|
|
33
|
+
| `--includeDirs <dirs>` | Additional directories (comma-separated) | — |
|
|
34
|
+
| `--backend <type>` | Adapter backend: `direct` or `terminal` (tmux/wezterm) | `direct` |
|
|
35
|
+
|
|
36
|
+
### Tool Resolution Priority
|
|
37
|
+
|
|
38
|
+
1. `--to <tool>` — explicit tool selection (backward compat, highest priority)
|
|
39
|
+
2. `--role <role>` — capability-based auto-selection via config
|
|
40
|
+
3. No flag — first enabled tool in config
|
|
41
|
+
|
|
42
|
+
### Role-Based Tool Selection
|
|
43
|
+
|
|
44
|
+
Roles map to tools via `cli-tools.json` configuration:
|
|
45
|
+
- User-defined roles in `roles` section override built-in defaults
|
|
46
|
+
- Workspace `.maestro/cli-tools.json` overrides global `~/.maestro/cli-tools.json`
|
|
47
|
+
- Built-in roles: `analyze`, `explore`, `review`, `implement`, `plan`, `brainstorm`, `research`
|
|
48
|
+
|
|
49
|
+
### Mode Definition (Authoritative)
|
|
50
|
+
|
|
51
|
+
| Mode | Permission | Auto-Invoke Safe | Use For |
|
|
52
|
+
|------|-----------|------------------|---------|
|
|
53
|
+
| `analysis` | Read-only | Yes | Review, exploration, diagnosis, architecture analysis |
|
|
54
|
+
| `write` | Create/Modify/Delete | No — requires explicit intent | Implementation, bug fixes, refactoring |
|
|
55
|
+
|
|
56
|
+
> `--mode` is the **authoritative** permission control. The `MODE:` field inside prompt text is a hint for the agent — both should be consistent, but `--mode` governs actual behavior.
|
|
57
|
+
</context>
|
|
58
|
+
|
|
59
|
+
---
|
|
60
|
+
|
|
61
|
+
## 2. Configuration
|
|
62
|
+
|
|
63
|
+
<context>
|
|
64
|
+
|
|
65
|
+
### Config File: `~/.maestro/cli-tools.json`
|
|
66
|
+
|
|
67
|
+
| Field | Description |
|
|
68
|
+
|-------|-------------|
|
|
69
|
+
| `enabled` | Tool availability |
|
|
70
|
+
| `primaryModel` | Default model |
|
|
71
|
+
| `secondaryModel` | Fallback model |
|
|
72
|
+
| `tags` | Capability tags (for caller-side routing) |
|
|
73
|
+
| `type` | `builtin` / `cli-wrapper` / `api-endpoint` |
|
|
74
|
+
|
|
75
|
+
> `api-endpoint` tools support **analysis only** — no file write capability.
|
|
76
|
+
|
|
77
|
+
### Tool Selection
|
|
78
|
+
|
|
79
|
+
1. Explicit `--to` specified → use it (validate enabled)
|
|
80
|
+
2. No `--to` → first enabled tool in config order
|
|
81
|
+
|
|
82
|
+
### Fallback Chain
|
|
83
|
+
|
|
84
|
+
Primary model fails → `secondaryModel` → next enabled tool → first enabled (default).
|
|
85
|
+
|
|
86
|
+
### MCP Server Startup
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
# Claude Code — load Maestro as development MCP server
|
|
90
|
+
claude --dangerously-load-development-channels server:maestro --dangerously-skip-permissions
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
With MCP connected, all delegate tools are available programmatically.
|
|
94
|
+
</context>
|
|
95
|
+
|
|
96
|
+
---
|
|
97
|
+
|
|
98
|
+
## 3. Prompt Construction
|
|
99
|
+
|
|
100
|
+
<context>
|
|
101
|
+
|
|
102
|
+
### Assembly Order
|
|
103
|
+
|
|
104
|
+
`maestro delegate` builds the final prompt as:
|
|
105
|
+
|
|
106
|
+
1. **Mode protocol** — `~/.maestro/templates/cli/protocols/{mode}-protocol.md`
|
|
107
|
+
2. **User prompt** — the positional `"<PROMPT>"` value
|
|
108
|
+
3. **Rule template** — `~/.maestro/templates/cli/prompts/{rule}.txt` (if `--rule` specified)
|
|
109
|
+
|
|
110
|
+
### Prompt Template (6 Fields)
|
|
111
|
+
|
|
112
|
+
```
|
|
113
|
+
PURPOSE: [goal] + [why] + [success criteria]
|
|
114
|
+
TASK: [step 1] | [step 2] | [step 3]
|
|
115
|
+
MODE: analysis|write
|
|
116
|
+
CONTEXT: @[file patterns] | Memory: [prior work context]
|
|
117
|
+
EXPECTED: [output format] + [quality criteria]
|
|
118
|
+
CONSTRAINTS: [scope limits] | [special requirements]
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
- **PURPOSE**: What + Why + Success. Not "Analyze code" but "Identify auth vulnerabilities; success = OWASP Top 10 covered"
|
|
122
|
+
- **TASK**: Specific verbs. Not "Review code" but "Scan for SQL injection | Check XSS | Verify CSRF"
|
|
123
|
+
- **MODE**: Must match `--mode` flag
|
|
124
|
+
- **CONTEXT**: File scope + memory from prior work
|
|
125
|
+
- **EXPECTED**: Deliverable format, not just "Report"
|
|
126
|
+
- **CONSTRAINTS**: Task-specific limits (vs `--rule` which loads generic templates)
|
|
127
|
+
|
|
128
|
+
### CONTEXT: File Patterns + Directory
|
|
129
|
+
|
|
130
|
+
- `@**/*` — all files in working directory (default)
|
|
131
|
+
- `@src/**/*.ts` — scoped pattern
|
|
132
|
+
- `@../shared/**/*` — sibling directory (**requires `--includeDirs`**)
|
|
133
|
+
|
|
134
|
+
**Rule**: If CONTEXT uses `@../dir/**/*`, must add `--includeDirs ../dir`.
|
|
135
|
+
|
|
136
|
+
```bash
|
|
137
|
+
maestro delegate "CONTEXT: @**/* @../shared/**/*" --to gemini --mode analysis \
|
|
138
|
+
--cd "src/auth" --includeDirs "../shared"
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
### CONTEXT: Memory
|
|
142
|
+
|
|
143
|
+
Include when building on previous work:
|
|
144
|
+
|
|
145
|
+
```
|
|
146
|
+
Memory: Building on auth refactoring (commit abc123), implementing refresh tokens
|
|
147
|
+
Memory: Integration with auth module, using shared error patterns
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
### --rule Templates
|
|
151
|
+
|
|
152
|
+
**Universal**: `universal-rigorous-style`, `universal-creative-style`
|
|
153
|
+
|
|
154
|
+
**Analysis**: `analysis-trace-code-execution`, `analysis-diagnose-bug-root-cause`, `analysis-analyze-code-patterns`, `analysis-analyze-technical-document`, `analysis-review-architecture`, `analysis-review-code-quality`, `analysis-analyze-performance`, `analysis-assess-security-risks`
|
|
155
|
+
|
|
156
|
+
**Planning**: `planning-plan-architecture-design`, `planning-breakdown-task-steps`, `planning-design-component-spec`, `planning-plan-migration-strategy`
|
|
157
|
+
|
|
158
|
+
**Development**: `development-implement-feature`, `development-refactor-codebase`, `development-generate-tests`, `development-implement-component-ui`, `development-debug-runtime-issues`
|
|
159
|
+
|
|
160
|
+
### Complete Example
|
|
161
|
+
|
|
162
|
+
```bash
|
|
163
|
+
maestro delegate "PURPOSE: Identify OWASP Top 10 vulnerabilities in auth module; success = all critical/high documented with remediation
|
|
164
|
+
TASK: Scan for injection flaws | Check auth bypass vectors | Evaluate session management | Assess data exposure
|
|
165
|
+
MODE: analysis
|
|
166
|
+
CONTEXT: @src/auth/**/* @src/middleware/auth.ts | Memory: Using bcrypt + JWT
|
|
167
|
+
EXPECTED: Severity matrix, file:line references, remediation snippets, priority ranking
|
|
168
|
+
CONSTRAINTS: Focus on authentication | Ignore test files
|
|
169
|
+
" --to gemini --mode analysis --rule analysis-assess-security-risks --cd "src/auth"
|
|
170
|
+
```
|
|
171
|
+
</context>
|
|
172
|
+
|
|
173
|
+
---
|
|
174
|
+
|
|
175
|
+
## 4. Execution
|
|
176
|
+
|
|
177
|
+
<execution>
|
|
178
|
+
|
|
179
|
+
### Calling Convention
|
|
180
|
+
|
|
181
|
+
`maestro delegate` runs synchronously. Status summary and output are **auto-appended** on completion — no manual `output` or `status` commands needed.
|
|
182
|
+
|
|
183
|
+
**Always** use `run_in_background: true` and **end your response immediately**:
|
|
184
|
+
|
|
185
|
+
```
|
|
186
|
+
Bash({ command: "maestro delegate \"...\" --to gemini --mode analysis", run_in_background: true })
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
When the background callback arrives, the result is already included:
|
|
190
|
+
```
|
|
191
|
+
[MAESTRO_EXEC_ID=gem-143022-a7f2] ← at start
|
|
192
|
+
[DELEGATE COMPLETED] gem-143022-a7f2 gemini/analysis ← status, on completion
|
|
193
|
+
--- Output ---
|
|
194
|
+
<actual output content> ← output, on completion
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
**Rules:**
|
|
198
|
+
- NEVER use foreground Bash for delegate calls
|
|
199
|
+
- NEVER output text or tool calls after the `run_in_background` Bash call
|
|
200
|
+
- When the callback arrives, output is already included — directly use it
|
|
201
|
+
|
|
202
|
+
### Execution ID
|
|
203
|
+
|
|
204
|
+
ID prefix: gemini→`gem`, qwen→`qwn`, codex→`cdx`, claude→`cld`, opencode→`opc`
|
|
205
|
+
|
|
206
|
+
```bash
|
|
207
|
+
maestro delegate "<PROMPT>" --to gemini --mode analysis # auto-ID: gem-143022-a7f2
|
|
208
|
+
maestro delegate "<PROMPT>" --to gemini --mode write --id my-task-1 # custom ID
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
### Session Resume
|
|
212
|
+
|
|
213
|
+
```bash
|
|
214
|
+
maestro delegate "<PROMPT>" --to gemini --resume # last session
|
|
215
|
+
maestro delegate "<PROMPT>" --to gemini --mode write --resume <id> # specific
|
|
216
|
+
maestro delegate "<PROMPT>" --to gemini --resume <id1>,<id2> # merge multiple
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
Resume auto-assembles previous conversation context. Warning emitted when context exceeds 32KB.
|
|
220
|
+
|
|
221
|
+
### Job Lifecycle
|
|
222
|
+
|
|
223
|
+
```
|
|
224
|
+
queued → running → completed
|
|
225
|
+
→ failed
|
|
226
|
+
→ cancelled
|
|
227
|
+
↗
|
|
228
|
+
input_required
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
### Message Delivery
|
|
232
|
+
|
|
233
|
+
| Mode | Behavior | Use For |
|
|
234
|
+
|------|----------|---------|
|
|
235
|
+
| `inject` | Routes to running worker stdin; non-interactive adapters auto cancel + relaunch | Supplementary context, course correction |
|
|
236
|
+
| `after_complete` | Queues message; relaunches delegate with queued message on completion | Chained tasks, post-processing |
|
|
237
|
+
|
|
238
|
+
</execution>
|
|
239
|
+
|
|
240
|
+
---
|
|
241
|
+
|
|
242
|
+
## 5. Auto-Invoke Triggers
|
|
243
|
+
|
|
244
|
+
<execution>
|
|
245
|
+
|
|
246
|
+
Proactively invoke `maestro delegate` when these conditions are met — no user confirmation needed for `analysis` mode:
|
|
247
|
+
|
|
248
|
+
| Trigger | Suggested Rule |
|
|
249
|
+
|---------|---------------|
|
|
250
|
+
| Self-repair fails (1+ attempts) | `analysis-diagnose-bug-root-cause` |
|
|
251
|
+
| Ambiguous requirements | `planning-breakdown-task-steps` |
|
|
252
|
+
| Architecture decisions needed | `planning-plan-architecture-design` |
|
|
253
|
+
| Pattern uncertainty | `analysis-analyze-code-patterns` |
|
|
254
|
+
| Critical/security code paths | `analysis-assess-security-risks` |
|
|
255
|
+
|
|
256
|
+
### Principles
|
|
257
|
+
|
|
258
|
+
- Default `--mode analysis` (safe, read-only)
|
|
259
|
+
- Always `Bash(run_in_background: true)` — stop immediately, wait for callback
|
|
260
|
+
- Use `--role` for capability-based tool selection; fallback chain is config-driven
|
|
261
|
+
- Rule suggestions are guidelines — choose the best fit
|
|
262
|
+
- Use `inject` for supplementary context mid-execution; `after_complete` for chained multi-step tasks
|
|
263
|
+
</execution>
|
|
264
|
+
|
|
265
|
+
---
|
|
266
|
+
|
|
267
|
+
## 6. Workflows
|
|
268
|
+
|
|
269
|
+
<execution>
|
|
270
|
+
|
|
271
|
+
### Basic Usage
|
|
272
|
+
|
|
273
|
+
```
|
|
274
|
+
Bash({
|
|
275
|
+
command: 'maestro delegate "analyze auth module" --to gemini',
|
|
276
|
+
run_in_background: true
|
|
277
|
+
})
|
|
278
|
+
// → STOP, wait for callback
|
|
279
|
+
// → callback includes status + output automatically
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
### Inject Supplementary Context
|
|
283
|
+
|
|
284
|
+
```bash
|
|
285
|
+
maestro delegate message gem-143022-a7f2 "Also check src/utils/sanitize.ts"
|
|
286
|
+
# → accepted: true, delivery: inject
|
|
287
|
+
```
|
|
288
|
+
|
|
289
|
+
### Chain: Analyze → Fix
|
|
290
|
+
|
|
291
|
+
```
|
|
292
|
+
Bash({
|
|
293
|
+
command: 'maestro delegate "find SQL injection vulnerabilities" --to gemini',
|
|
294
|
+
run_in_background: true
|
|
295
|
+
})
|
|
296
|
+
// → STOP, wait for callback
|
|
297
|
+
// → on callback: chain next step
|
|
298
|
+
maestro delegate message gem-143022-a7f2 "Fix all critical vulnerabilities" --delivery after_complete
|
|
299
|
+
// → queued, relaunches after analysis completes
|
|
300
|
+
```
|
|
301
|
+
</execution>
|