maestro-flow-one 0.1.0

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.
Files changed (106) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +173 -0
  3. package/bin/maestro-flow.js +730 -0
  4. package/claude/maestro-flow/SKILL.md +239 -0
  5. package/claude/maestro-flow/chains/templates.json +256 -0
  6. package/claude/maestro-flow/commands/learn/decompose.md +176 -0
  7. package/claude/maestro-flow/commands/learn/follow.md +167 -0
  8. package/claude/maestro-flow/commands/learn/investigate.md +221 -0
  9. package/claude/maestro-flow/commands/learn/retro.md +303 -0
  10. package/claude/maestro-flow/commands/learn/second-opinion.md +167 -0
  11. package/claude/maestro-flow/commands/lifecycle/amend.md +300 -0
  12. package/claude/maestro-flow/commands/lifecycle/analyze.md +126 -0
  13. package/claude/maestro-flow/commands/lifecycle/brainstorm.md +100 -0
  14. package/claude/maestro-flow/commands/lifecycle/composer.md +354 -0
  15. package/claude/maestro-flow/commands/lifecycle/execute.md +114 -0
  16. package/claude/maestro-flow/commands/lifecycle/fork.md +86 -0
  17. package/claude/maestro-flow/commands/lifecycle/init.md +78 -0
  18. package/claude/maestro-flow/commands/lifecycle/learn.md +140 -0
  19. package/claude/maestro-flow/commands/lifecycle/link-coordinate.md +71 -0
  20. package/claude/maestro-flow/commands/lifecycle/merge.md +61 -0
  21. package/claude/maestro-flow/commands/lifecycle/overlay.md +178 -0
  22. package/claude/maestro-flow/commands/lifecycle/plan.md +138 -0
  23. package/claude/maestro-flow/commands/lifecycle/player.md +404 -0
  24. package/claude/maestro-flow/commands/lifecycle/quick.md +56 -0
  25. package/claude/maestro-flow/commands/lifecycle/roadmap.md +164 -0
  26. package/claude/maestro-flow/commands/lifecycle/ui-design.md +93 -0
  27. package/claude/maestro-flow/commands/lifecycle/update.md +176 -0
  28. package/claude/maestro-flow/commands/lifecycle/verify.md +90 -0
  29. package/claude/maestro-flow/commands/manage/codebase-rebuild.md +75 -0
  30. package/claude/maestro-flow/commands/manage/codebase-refresh.md +57 -0
  31. package/claude/maestro-flow/commands/manage/harvest.md +94 -0
  32. package/claude/maestro-flow/commands/manage/issue-discover.md +77 -0
  33. package/claude/maestro-flow/commands/manage/issue.md +73 -0
  34. package/claude/maestro-flow/commands/manage/knowhow-capture.md +193 -0
  35. package/claude/maestro-flow/commands/manage/knowhow.md +77 -0
  36. package/claude/maestro-flow/commands/manage/learn.md +67 -0
  37. package/claude/maestro-flow/commands/manage/status.md +51 -0
  38. package/claude/maestro-flow/commands/manage/wiki.md +62 -0
  39. package/claude/maestro-flow/commands/milestone/audit.md +68 -0
  40. package/claude/maestro-flow/commands/milestone/complete.md +75 -0
  41. package/claude/maestro-flow/commands/milestone/release.md +96 -0
  42. package/claude/maestro-flow/commands/quality/auto-test.md +124 -0
  43. package/claude/maestro-flow/commands/quality/debug.md +115 -0
  44. package/claude/maestro-flow/commands/quality/refactor.md +55 -0
  45. package/claude/maestro-flow/commands/quality/retrospective.md +78 -0
  46. package/claude/maestro-flow/commands/quality/review.md +108 -0
  47. package/claude/maestro-flow/commands/quality/sync.md +51 -0
  48. package/claude/maestro-flow/commands/quality/test.md +103 -0
  49. package/claude/maestro-flow/commands/spec/add.md +49 -0
  50. package/claude/maestro-flow/commands/spec/load.md +51 -0
  51. package/claude/maestro-flow/commands/spec/remove.md +51 -0
  52. package/claude/maestro-flow/commands/spec/setup.md +51 -0
  53. package/claude/maestro-flow/commands/wiki/connect.md +62 -0
  54. package/claude/maestro-flow/commands/wiki/digest.md +69 -0
  55. package/codex/maestro-flow/SKILL.md +505 -0
  56. package/codex/maestro-flow/chains/templates.json +256 -0
  57. package/codex/maestro-flow/commands/learn/decompose.md +113 -0
  58. package/codex/maestro-flow/commands/learn/follow.md +83 -0
  59. package/codex/maestro-flow/commands/learn/investigate.md +83 -0
  60. package/codex/maestro-flow/commands/learn/retro.md +83 -0
  61. package/codex/maestro-flow/commands/learn/second-opinion.md +86 -0
  62. package/codex/maestro-flow/commands/lifecycle/amend.md +300 -0
  63. package/codex/maestro-flow/commands/lifecycle/analyze.md +483 -0
  64. package/codex/maestro-flow/commands/lifecycle/brainstorm.md +397 -0
  65. package/codex/maestro-flow/commands/lifecycle/composer.md +213 -0
  66. package/codex/maestro-flow/commands/lifecycle/execute.md +318 -0
  67. package/codex/maestro-flow/commands/lifecycle/fork.md +98 -0
  68. package/codex/maestro-flow/commands/lifecycle/init.md +134 -0
  69. package/codex/maestro-flow/commands/lifecycle/learn.md +80 -0
  70. package/codex/maestro-flow/commands/lifecycle/link-coordinate.md +257 -0
  71. package/codex/maestro-flow/commands/lifecycle/merge.md +69 -0
  72. package/codex/maestro-flow/commands/lifecycle/overlay.md +119 -0
  73. package/codex/maestro-flow/commands/lifecycle/plan.md +460 -0
  74. package/codex/maestro-flow/commands/lifecycle/player.md +323 -0
  75. package/codex/maestro-flow/commands/lifecycle/quick.md +124 -0
  76. package/codex/maestro-flow/commands/lifecycle/roadmap.md +468 -0
  77. package/codex/maestro-flow/commands/lifecycle/ui-design.md +135 -0
  78. package/codex/maestro-flow/commands/lifecycle/update.md +176 -0
  79. package/codex/maestro-flow/commands/lifecycle/verify.md +468 -0
  80. package/codex/maestro-flow/commands/manage/codebase-rebuild.md +347 -0
  81. package/codex/maestro-flow/commands/manage/codebase-refresh.md +66 -0
  82. package/codex/maestro-flow/commands/manage/harvest.md +91 -0
  83. package/codex/maestro-flow/commands/manage/issue-discover.md +431 -0
  84. package/codex/maestro-flow/commands/manage/issue.md +75 -0
  85. package/codex/maestro-flow/commands/manage/knowhow-capture.md +110 -0
  86. package/codex/maestro-flow/commands/manage/knowhow.md +95 -0
  87. package/codex/maestro-flow/commands/manage/learn.md +137 -0
  88. package/codex/maestro-flow/commands/manage/status.md +76 -0
  89. package/codex/maestro-flow/commands/manage/wiki.md +55 -0
  90. package/codex/maestro-flow/commands/milestone/audit.md +87 -0
  91. package/codex/maestro-flow/commands/milestone/complete.md +91 -0
  92. package/codex/maestro-flow/commands/milestone/release.md +70 -0
  93. package/codex/maestro-flow/commands/quality/auto-test.md +547 -0
  94. package/codex/maestro-flow/commands/quality/debug.md +334 -0
  95. package/codex/maestro-flow/commands/quality/refactor.md +151 -0
  96. package/codex/maestro-flow/commands/quality/retrospective.md +292 -0
  97. package/codex/maestro-flow/commands/quality/review.md +364 -0
  98. package/codex/maestro-flow/commands/quality/sync.md +111 -0
  99. package/codex/maestro-flow/commands/quality/test.md +498 -0
  100. package/codex/maestro-flow/commands/spec/add.md +101 -0
  101. package/codex/maestro-flow/commands/spec/load.md +77 -0
  102. package/codex/maestro-flow/commands/spec/remove.md +69 -0
  103. package/codex/maestro-flow/commands/spec/setup.md +75 -0
  104. package/codex/maestro-flow/commands/wiki/connect.md +73 -0
  105. package/codex/maestro-flow/commands/wiki/digest.md +87 -0
  106. package/package.json +24 -0
@@ -0,0 +1,323 @@
1
+ ---
2
+ name: maestro-player
3
+ description: Workflow template player — load JSON template, bind variables, execute DAG nodes wave-by-wave via spawn_agents_on_csv, persist state at checkpoints, support resume. Coordinator assembles skill_call from template nodes — never executes skills directly.
4
+ argument-hint: "<template-slug|path> [--context key=value...] [-c [session-id]] [--list] [--dry-run]"
5
+ allowed-tools: spawn_agents_on_csv, Read, Write, Edit, Bash, Glob, Grep, AskUserQuestion
6
+ ---
7
+
8
+ <purpose>
9
+ Wave-based template executor using `spawn_agents_on_csv`. Loads a workflow template
10
+ (produced by maestro-composer), binds context variables, converts DAG nodes into
11
+ CSV waves via topological sort, executes wave-by-wave with barrier/non-barrier grouping.
12
+
13
+ Aligned with maestro codex coordinator pattern:
14
+ - ALL skill execution via `spawn_agents_on_csv` — coordinator never executes directly
15
+ - Barrier nodes (checkpoints + artifact-producing skills) execute solo
16
+ - Non-barrier nodes grouped into parallel waves
17
+ - Session state at `.workflow/.maestro/{session-id}/`
18
+ - Resume from last completed wave via `-c`
19
+
20
+ ```
21
+ Load Template → Bind Variables → Build Wave CSV → spawn → read results →
22
+ (barrier: read artifacts, update context) → next wave → report
23
+ ```
24
+ </purpose>
25
+
26
+ <invariants>
27
+ 1. **ALL skills via spawn_agents_on_csv**: Every node execution goes through spawn. Coordinator NEVER directly executes any skill.
28
+ 2. **Coordinator = prompt assembler only**: Load template → resolve refs → build CSV → spawn → read results → assemble next CSV.
29
+ 3. **Barrier = solo wave**: Checkpoint nodes and artifact-producing skills execute alone (wave size = 1).
30
+ 4. **Non-barriers can parallel**: Consecutive non-barrier nodes grouped into one wave.
31
+ 5. **Wave-by-wave**: Never start wave N+1 before wave N results are read and analyzed.
32
+ 6. **Coordinator owns context**: Sub-agents never read prior results — coordinator assembles full `skill_call` with resolved args.
33
+ 7. **Resume from wave**: `-c` finds last completed wave, resumes from next pending step.
34
+ </invariants>
35
+
36
+ <context>
37
+ $ARGUMENTS — template slug/path, or flags.
38
+
39
+ **Flags:**
40
+ - `--context key=value` — Bind context variables (repeatable)
41
+ - `-c` / `--continue [session-id]` — Resume paused/interrupted session
42
+ - `--list` — List available templates
43
+ - `--dry-run` — Show wave plan without executing
44
+
45
+ **Entry routing:**
46
+
47
+ | Detection | Condition | Handler |
48
+ |-----------|-----------|---------|
49
+ | List | `--list` | handleList |
50
+ | Resume | `-c [session-id]` | Phase 0: Resume |
51
+ | Dry run | `--dry-run` | Phase 1 + 2, print plan, exit |
52
+ | Normal | Template slug/path | Phase 1 |
53
+ | No args | Empty | handleList + AskUserQuestion |
54
+
55
+ **Session tracking (aligned with maestro codex):**
56
+
57
+ | Constant | Value |
58
+ |----------|-------|
59
+ | Session prefix | `MCP` (Maestro Composer Player) |
60
+ | Session dir | `.workflow/.maestro/MCP-<YYYYMMDD>-<HHmmss>/` |
61
+ | State file | `state.json` |
62
+ | Wave CSV | `wave-{N}.csv` |
63
+ | Wave results | `wave-{N}-results.csv` |
64
+ | Template dir | `~/.maestro/templates/workflows/` |
65
+ | Template index | `~/.maestro/templates/workflows/index.json` |
66
+
67
+ **Barrier nodes** (solo wave, coordinator reads artifacts after):
68
+
69
+ | Node type | Artifacts to Read | Context Updates |
70
+ |-----------|------------------|-----------------|
71
+ | `checkpoint` | — (state save only) | `last_checkpoint` |
72
+ | `maestro-plan` | `plan.json`, `.task/TASK-*.json` | `plan_dir`, `task_count` |
73
+ | `maestro-execute` | `results.csv` | `exec_status`, `completed_tasks` |
74
+ | `maestro-analyze` | `context.md` | `analysis_dir`, `gaps`, `phase` |
75
+ | `maestro-brainstorm` | `.brainstorming/` | `brainstorm_dir` |
76
+ | `maestro-roadmap` | `specs/` | `spec_session_id` |
77
+
78
+ All other skill nodes are **non-barrier** (groupable into parallel waves).
79
+
80
+ **state.json schema:**
81
+
82
+ ```json
83
+ {
84
+ "id": "MCP-<YYYYMMDD>-<HHmmss>",
85
+ "intent": "<template_name> with context",
86
+ "chain": "<template_id>",
87
+ "template_path": "~/.maestro/templates/workflows/<slug>.json",
88
+ "template_name": "<name>",
89
+ "auto_yes": false,
90
+ "status": "in_progress | paused | completed | aborted",
91
+ "started_at": "<ISO>",
92
+ "context": {
93
+ "goal": "...", "scope": "...",
94
+ "phase": null, "plan_dir": null, "analysis_dir": null,
95
+ "last_checkpoint": null
96
+ },
97
+ "waves": [],
98
+ "steps": [
99
+ {
100
+ "step_n": 1, "node_id": "N-001",
101
+ "skill": "<executor>", "args": "<args_template>",
102
+ "type": "skill | cli | checkpoint",
103
+ "is_barrier": true,
104
+ "status": "pending | completed | failed | skipped",
105
+ "wave_n": null, "findings": null, "artifacts": null
106
+ }
107
+ ]
108
+ }
109
+ ```
110
+ </context>
111
+
112
+ <execution>
113
+
114
+ ### handleList
115
+
116
+ Scan `~/.maestro/templates/workflows/index.json`. Display:
117
+ ```
118
+ Available workflow templates:
119
+ feature-tdd-review [feature, complex] 3 work nodes, 2 checkpoints
120
+ quick-bugfix [bugfix, simple] 2 work nodes, 1 checkpoint
121
+
122
+ Run: $maestro-player <slug> --context goal="..."
123
+ ```
124
+
125
+ If not found: "No templates. Create with $maestro-composer"
126
+
127
+ ---
128
+
129
+ ### Phase 0: Resume
130
+
131
+ **Trigger**: `-c [session-id]`
132
+
133
+ Load session state by explicit ID or most recent `MCP-*/state.json` with `status = "in_progress" | "paused"`. Error E005 if none found. Resume from next pending step after last completed wave → jump to Phase 3.
134
+
135
+ ---
136
+
137
+ ### Phase 1: Load & Bind
138
+
139
+ 1. **Resolve template**: absolute path → as-is, slug → lookup in `~/.maestro/templates/workflows/index.json`, partial → confirm, not found → show `--list`
140
+ 2. **Parse** `--context key=value` pairs into `bound_context`
141
+ 3. **Load and validate** template JSON
142
+ 4. **Collect missing** required variables via AskUserQuestion
143
+ 5. **Bind** `{variable_name}` in all `args_template` strings. Leave `{N-xxx.field}` and `{prev_*}` unresolved (runtime Phase 3)
144
+ 6. If `--dry-run`: print wave plan and exit
145
+
146
+ ---
147
+
148
+ ### Phase 2: Init Session & Build Wave Plan
149
+
150
+ 1. Generate session ID: `MCP-<YYYYMMDD>-<HHmmss>`
151
+ 2. Topological sort (Kahn's algorithm) on template nodes + edges
152
+ 3. Classify barrier vs non-barrier: barriers = checkpoint nodes + `maestro-analyze`, `maestro-plan`, `maestro-brainstorm`, `maestro-roadmap`, `maestro-execute`
153
+ 4. Group into waves: barrier nodes → solo wave, non-barrier nodes → accumulate into parallel wave
154
+ 5. Build steps array from waves, write `state.json`
155
+
156
+ **Step 2.6** — Display start banner:
157
+ ```
158
+ ============================================================
159
+ MAESTRO PLAYER
160
+ ============================================================
161
+ Template: <template.name>
162
+ Session: <session_id>
163
+ Context: goal="<value>"
164
+
165
+ Wave Plan:
166
+ [W1] N-001 maestro-plan "{goal}" [BARRIER]
167
+ [W2] N-002 maestro-execute {phase} [BARRIER]
168
+ [W3] N-003 quality-test {phase}
169
+ N-004 quality-review {phase}
170
+ ============================================================
171
+ ```
172
+
173
+ **`--dry-run`**: Display above and exit.
174
+
175
+ ---
176
+
177
+ ### Phase 3: Wave Execution Loop
178
+
179
+ Loop while any step has `status === 'pending'`:
180
+
181
+ **3a. Resolve runtime references** in each step's args:
182
+ - `{key}` → lookup from `context[key]`
183
+ - `{N-xxx.field}` → lookup from completed step with matching `node_id`
184
+ - `{prev_field}` → lookup from most recently completed non-checkpoint step
185
+
186
+ **3b. Handle checkpoint nodes** (no CSV spawn needed):
187
+ - Save checkpoint snapshot to `checkpoints/{node_id}.json` (session state + context)
188
+ - Update `context.last_checkpoint`, mark completed
189
+ - If `auto_continue === false`: prompt user (Continue / Pause / Abort)
190
+
191
+ **3c. Build wave CSV** for skill nodes:
192
+ Write `wave-{N}.csv` with columns `id,skill_call,topic`. Each row: resolved `$${step.skill} ${args}`.
193
+
194
+ **3d. Spawn agents**:
195
+
196
+ ```javascript
197
+ spawn_agents_on_csv({
198
+ csv_path: `${sessionDir}/wave-${waveNum}.csv`,
199
+ id_column: "id",
200
+ instruction: PLAYER_INSTRUCTION,
201
+ max_workers: waveSteps.length,
202
+ max_runtime_seconds: 3600,
203
+ output_csv_path: `${sessionDir}/wave-${waveNum}-results.csv`,
204
+ output_schema: RESULT_SCHEMA
205
+ })
206
+ ```
207
+
208
+ **3e. Read results**: Map each result row back to its step — update status, findings, artifacts, wave_n.
209
+
210
+ **3f. Barrier analysis**: If barrier wave, read artifacts and update context (see barrier node table in `<context>`).
211
+
212
+ **3g. Persist + abort check**: Append wave record to `state.waves[]`, persist `state.json`. If any result failed → set `state.status = 'aborted'`, mark remaining steps as skipped.
213
+
214
+ ### Sub-Agent Instruction Template
215
+
216
+ ```
217
+ 你是 CSV job 子 agent。
218
+
219
+ 先原样执行这一段技能调用:
220
+ {skill_call}
221
+
222
+ 然后基于结果完成这一行任务说明:
223
+ {topic}
224
+
225
+ 限制:
226
+ - 不要修改 .workflow/.maestro/ 下的 state 文件
227
+ - skill 内部有自己的 session 管理,按 skill SKILL.md 执行即可
228
+
229
+ 最后必须调用 `report_agent_job_result`,返回 JSON:
230
+ {"status":"completed|failed","skill_call":"{skill_call}","summary":"一句话结果","artifacts":"产物路径或空字符串","error":"失败原因或空字符串"}
231
+ ```
232
+
233
+ ### Result Schema
234
+
235
+ ```javascript
236
+ const RESULT_SCHEMA = {
237
+ type: "object",
238
+ properties: {
239
+ status: { type: "string", enum: ["completed", "failed"] },
240
+ skill_call: { type: "string" },
241
+ summary: { type: "string" },
242
+ artifacts: { type: "string" },
243
+ error: { type: "string" }
244
+ },
245
+ required: ["status", "skill_call", "summary", "artifacts", "error"]
246
+ };
247
+ ```
248
+
249
+ ---
250
+
251
+ ### Phase 4: Completion Report
252
+
253
+ ```
254
+ ============================================================
255
+ MAESTRO PLAYER SESSION COMPLETE
256
+ ============================================================
257
+ Session: <session_id>
258
+ Template: <template_name> (<template_id>)
259
+ Waves: <N> executed
260
+ Steps: <completed>/<total>
261
+ Context: goal="<value>"
262
+
263
+ WAVE RESULTS:
264
+ [W1] $maestro-plan "{goal}" → ✓ plan created
265
+ [W2] $maestro-execute {phase} → ✓ 12/12 tasks
266
+ [W3] $quality-test {phase} → ✓ all tests pass
267
+ $quality-review {phase} → ✓ no issues
268
+
269
+ State: .workflow/.maestro/<session_id>/state.json
270
+ Resume: $maestro-player -c
271
+ ============================================================
272
+ ```
273
+
274
+ Update `state.status = "completed"`, write final `state.json`.
275
+ </execution>
276
+
277
+ <csv_schema>
278
+ ### wave-{N}.csv (Per-Wave Input)
279
+
280
+ ```csv
281
+ id,skill_call,topic
282
+ "1","$maestro-plan \"implement user auth\"","Template \"feature-plan-test\" step 1/5"
283
+ ```
284
+
285
+ | Column | Description |
286
+ |--------|-------------|
287
+ | `id` | Step number (string) |
288
+ | `skill_call` | Full skill invocation with resolved context args |
289
+ | `topic` | Brief description for the agent |
290
+
291
+ ### wave-{N}-results.csv (Per-Wave Output)
292
+
293
+ Written by `spawn_agents_on_csv`. Contains result per agent.
294
+ </csv_schema>
295
+
296
+ <error_codes>
297
+ | Code | Severity | Condition | Recovery |
298
+ |------|----------|-----------|----------|
299
+ | E001 | error | Template not found | Show --list, suggest closest match |
300
+ | E002 | error | Template JSON invalid | Point to file for fix |
301
+ | E003 | error | Required variable missing, user declined | Cannot proceed |
302
+ | E004 | error | DAG cycle in template | Suggest $maestro-composer --edit |
303
+ | E005 | error | Resume session not found | List sessions |
304
+ | E006 | error | Wave timeout | Mark failed, abort chain |
305
+ | E007 | error | Barrier artifact not found | Retry wave once, then abort |
306
+ | W001 | warning | Runtime reference resolved to empty | Log, continue |
307
+ | W002 | warning | Barrier artifact partial | Continue with available context |
308
+ </error_codes>
309
+
310
+ <success_criteria>
311
+ - [ ] Template loaded from `~/.maestro/templates/workflows/` and validated
312
+ - [ ] All required context variables bound
313
+ - [ ] Session dir at `.workflow/.maestro/MCP-*/` with `state.json`
314
+ - [ ] DAG nodes converted to waves (barrier=solo, non-barrier=parallel)
315
+ - [ ] Every skill invocation goes through `spawn_agents_on_csv` — none in coordinator
316
+ - [ ] Checkpoint nodes handled inline (state save, optional user pause)
317
+ - [ ] Barrier artifacts read and context updated before next wave
318
+ - [ ] Runtime references ({N-xxx.field}, {prev_*}) resolved before each wave CSV
319
+ - [ ] Failed step → remaining marked skipped → abort reported
320
+ - [ ] `--dry-run` shows wave plan with [BARRIER] markers, no execution
321
+ - [ ] `-c` resumes from last completed wave
322
+ - [ ] Completion report with per-wave status
323
+ </success_criteria>
@@ -0,0 +1,124 @@
1
+ ---
2
+ name: maestro-quick
3
+ description: Fast-track single task execution with workflow guarantees — analyze, plan, execute in one pass
4
+ argument-hint: "\"task description\" [--discuss] [--full]"
5
+ allowed-tools: Read, Write, Edit, Bash, Glob, Grep, Agent, AskUserQuestion
6
+ ---
7
+
8
+ <purpose>
9
+ Shortened pipeline for well-understood tasks. Creates a scratch directory, runs quick analysis, generates a plan, executes tasks, and optionally verifies results. Single agent, sequential flow — no CSV waves needed.
10
+
11
+ **Pipeline**: `[discuss] → analyze-q → plan → execute → [verify]`
12
+
13
+ Quick tasks default to minimal interaction. `--discuss` adds a decision extraction step. `--full` adds plan-checking and post-execution verification.
14
+ </purpose>
15
+
16
+ <context>
17
+
18
+ ```bash
19
+ $maestro-quick "add rate limiting to /api/auth endpoints"
20
+ $maestro-quick "refactor user service to use repository pattern" --discuss
21
+ $maestro-quick "fix memory leak in WebSocket handler" --full
22
+ $maestro-quick "add dark mode toggle to settings page" --discuss --full
23
+ ```
24
+
25
+ **Flags**:
26
+ - `--discuss`: Decision extraction before planning (Locked/Free/Deferred classification)
27
+ - `--full`: Enable plan-checking (max 2 iterations) and post-execution verification
28
+
29
+ **Output**: `.workflow/scratch/{slug}/` with plan.json, execution results, optional verification
30
+
31
+ </context>
32
+
33
+ <invariants>
34
+ 1. **Speed over ceremony** — minimal overhead, get to implementation fast
35
+ 2. **Follow existing patterns** — grep for 3+ similar implementations before writing new code
36
+ 3. **Atomic commits** — one commit per quick task, descriptive message
37
+ 4. **Scratch isolation** — all metadata stays in .workflow/scratch/{slug}/
38
+ 5. **Works without init** — quick tasks function even without full .workflow/ setup
39
+ </invariants>
40
+
41
+ <execution>
42
+
43
+ ### Step 1: Parse Arguments
44
+
45
+ Extract from arguments:
46
+ - `--discuss` flag
47
+ - `--full` flag
48
+ - Remaining text as task description (required — E001 if empty)
49
+
50
+ ### Step 2: Load Project Context
51
+
52
+ Read `.workflow/state.json` and `.workflow/project.md` if they exist. If `.workflow/` does not exist, create minimal scratch structure anyway (quick works without full init).
53
+
54
+ ### Step 3: Create Scratch Directory
55
+
56
+ Generate slug from task description (lowercase, hyphens, max 40 chars). Create `.workflow/scratch/{slug}/`. Write `config.json` with: `task`, `flags` (discuss, full), `created_at` (ISO), `status` ("active").
57
+
58
+ ### Step 4: Discussion Phase (if --discuss)
59
+
60
+ **Only when `--discuss` is set.**
61
+
62
+ Analyze the task for gray areas and ambiguities:
63
+ 1. Identify decision points in the task
64
+ 2. Classify each as: **Locked** (clear from context), **Free** (implementation choice), **Deferred** (need user input)
65
+ 3. For Deferred items: ask user for decisions
66
+ 4. Write `context.md` to scratch directory with all decisions
67
+
68
+ ### Step 5: Quick Analysis
69
+
70
+ Rapid codebase exploration focused on the task:
71
+ 1. Search for related files using Grep/Glob
72
+ 2. Identify existing patterns to follow
73
+ 3. Map dependencies and integration points
74
+ 4. Write analysis findings to `context.md` (append if --discuss created it)
75
+
76
+ ### Step 6: Generate Plan
77
+
78
+ Create `plan.json` in scratch directory:
79
+ - Decompose task into subtasks (typically 1-5 for quick tasks)
80
+ - Each task has: id, title, description, scope, convergence_criteria, files
81
+ - Assign single wave (sequential execution)
82
+
83
+ **If `--full`**: Present plan for review, allow up to 2 revision iterations.
84
+
85
+ ### Step 7: Execute Tasks
86
+
87
+ For each task in plan.json (sequential):
88
+ 1. Read task definition
89
+ 2. Implement changes following existing patterns
90
+ 3. Run any specified verification commands
91
+ 4. Write task summary with files_modified, status
92
+
93
+ Update plan.json task statuses as completed.
94
+
95
+ ### Step 8: Verification (if --full)
96
+
97
+ **Only when `--full` is set.** Run convergence criteria checks for each task via grep/test commands. If gaps found (W001): attempt single fix iteration, then report remaining gaps.
98
+
99
+ ### Step 9: Commit and Report
100
+
101
+ Commit all changes: `git add -A && git commit -m "quick: {slug} - {short description}"`. Update `.workflow/state.json` scratch task entry (if state.json exists).
102
+
103
+ Display report: task description, scratch path, status (completed/completed-with-gaps), tasks completed/total, files modified count. If `--full`: include verification result (PASS/GAPS).
104
+
105
+ </execution>
106
+
107
+ <error_codes>
108
+
109
+ | Code | Severity | Description | Recovery |
110
+ |------|----------|-------------|----------|
111
+ | E001 | error | Task description required | Ask user for description |
112
+ | E002 | error | Scratch directory creation failed | Check permissions |
113
+ | W001 | warning | Verification found minor gaps | Report gaps, continue |
114
+
115
+ </error_codes>
116
+
117
+ <success_criteria>
118
+ - [ ] Scratch directory created with config.json
119
+ - [ ] Analysis completed and context.md written
120
+ - [ ] Plan generated with subtasks
121
+ - [ ] All tasks executed and statuses updated
122
+ - [ ] Changes committed with descriptive message
123
+ - [ ] Completion report displayed
124
+ </success_criteria>