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,86 @@
1
+ ---
2
+ name: learn-second-opinion
3
+ description: Multi-perspective analysis via CSV wave pipeline. Review mode spawns 3 parallel persona agents (pragmatist, purist, strategist), then synthesis agent merges verdicts. Also supports challenge and consult modes. Persists findings to lessons.jsonl.
4
+ argument-hint: "[-y|--yes] [-c|--concurrency 3] [--continue] \"<target> [--mode review|challenge|consult]\""
5
+ allowed-tools: spawn_agents_on_csv, Read, Write, Edit, Bash, Glob, Grep, AskUserQuestion
6
+ ---
7
+
8
+ <purpose>
9
+ Structured second-opinion for code, decisions, or plans. Three modes:
10
+ - **review** (default): 3 parallel persona agents independently assess target via spawn_agents_on_csv
11
+ - **challenge**: single adversarial agent via spawn_agents_on_csv (1 worker)
12
+ - **consult**: interactive Q&A (no CSV wave — direct orchestration)
13
+
14
+ Findings persist to `lessons.jsonl`. Decoupled from phase lifecycle.
15
+ </purpose>
16
+
17
+ <context>
18
+ $ARGUMENTS — target and optional flags.
19
+
20
+ **Target resolution (auto-detected):**
21
+ - File path → analyze file content
22
+ - Wiki ID (`type-slug`) → fetch via `maestro wiki get`
23
+ - `HEAD` / `staged` → analyze git diff
24
+ - Phase number → analyze phase plan
25
+
26
+ **Flags:**
27
+ - `--mode review` — 3-persona parallel review (default)
28
+ - `--mode challenge` — Adversarial single-agent analysis
29
+ - `--mode consult` — Interactive Q&A session
30
+
31
+ **Output**: `.workflow/learning/opinion-{slug}-{date}.md`
32
+ </context>
33
+
34
+ <execution>
35
+
36
+ ### Phase 1: Resolve Target + Load Context
37
+ Resolve target to content. Load specs, wiki search, prior lessons for context brief.
38
+
39
+ ### Phase 2: Execute Mode
40
+
41
+ #### Review Mode (spawn_agents_on_csv)
42
+
43
+ | id | persona | focus | grading |
44
+ |----|---------|-------|---------|
45
+ | 1 | pragmatist | Simplicity, YAGNI, maintenance cost, readability | complexity score, abstraction depth |
46
+ | 2 | purist | Correctness, type safety, edge cases, error handling | error paths, type completeness |
47
+ | 3 | strategist | Scalability, extensibility, architecture alignment | coupling, cohesion |
48
+ | 4 | synthesis | Merge verdicts → agreements, disagreements, top 3 recommendations | combined verdict |
49
+
50
+ Wave 1: 3 persona agents in parallel. Wave 2: synthesis agent with wave 1 findings as prev_context.
51
+
52
+ Each persona returns: `{ persona, verdict: approve|concern|reject, confidence, findings: [{severity, description, location, suggestion}], summary }`
53
+
54
+ #### Challenge Mode
55
+ Single agent via spawn_agents_on_csv (1 worker). Adversarial analysis with forcing questions:
56
+ - "What assumption would invalidate this entire approach?"
57
+ - "What's the simplest thing that breaks this?"
58
+ - "What's the implicit contract that isn't enforced?"
59
+
60
+ #### Consult Mode
61
+ Interactive loop via AskUserQuestion. Agent studies target, answers questions with code references. Compile Q&A into report on exit.
62
+
63
+ ### Phase 3: Persist
64
+ 1. Write `opinion-{slug}-{date}.md` with per-persona findings + synthesis
65
+ 2. Append non-trivial findings to `lessons.jsonl` (source: "second-opinion")
66
+ 3. Display summary with verdict and next steps
67
+
68
+ **Next steps:** `/manage-issue create`, `/learn-decompose <path>`, `/learn-follow <path>`
69
+ </execution>
70
+
71
+ <error_codes>
72
+ | Code | Severity | Condition | Recovery |
73
+ |------|----------|-----------|----------|
74
+ | E001 | error | Target not resolvable | Verify path/ID |
75
+ | E002 | error | Unknown --mode value | Use: review, challenge, consult |
76
+ | W001 | warning | Persona agent failed — partial perspectives | Proceed with available agents |
77
+ | W003 | warning | Git diff empty for HEAD/staged | Use file path instead |
78
+ </error_codes>
79
+
80
+ <success_criteria>
81
+ - [ ] Target resolved and context loaded
82
+ - [ ] Mode executed: review (3 parallel agents), challenge (adversarial), or consult (interactive)
83
+ - [ ] Synthesis produced with agreements, disagreements, verdict
84
+ - [ ] Report written to `opinion-{slug}-{date}.md`
85
+ - [ ] Non-trivial findings appended to `lessons.jsonl`
86
+ </success_criteria>
@@ -0,0 +1,300 @@
1
+ ---
2
+ name: maestro-amend
3
+ description: Collect deficiency signals from workflow artifacts, sessions, and user reports, then generate overlays to amend workflow commands
4
+ argument-hint: "[description] [--from-verify <dir>] [--from-review <dir>] [--from-session <id>] [--from-issues ISS-xxx,...] [--scan] [--dry-run]"
5
+ allowed-tools:
6
+ - Read
7
+ - Write
8
+ - Bash
9
+ - Glob
10
+ - Grep
11
+ - AskUserQuestion
12
+ ---
13
+ <purpose>
14
+ Signal-driven overlay generator — collects workflow deficiency signals from heterogeneous sources (verification gaps, review findings, debug sessions, open issues, user feedback), diagnoses which commands need amendment, and batch-generates targeted overlays to fix them.
15
+
16
+ Differs from `/maestro-overlay` which takes a single explicit intent. This command **discovers** what needs amending by analyzing workflow artifacts, then proposes and applies overlay fixes automatically.
17
+
18
+ **Mechanism**: All amendments use the overlay system (`~/.maestro/overlays/*.json`) — non-invasive, idempotent, survives reinstall.
19
+ </purpose>
20
+
21
+ <required_reading>
22
+ @~/.maestro/workflows/overlays.md
23
+ @~/.maestro/cli-tools.json
24
+ </required_reading>
25
+
26
+ <context>
27
+ $ARGUMENTS — optional description and/or source flags.
28
+
29
+ ### Signal Sources
30
+
31
+ | Flag | Source | What it collects |
32
+ |------|--------|------------------|
33
+ | `--from-verify <dir>` | `verification.json` | Workflow gaps exposed by verify failures |
34
+ | `--from-review <dir>` | `review.json` | Process deficiencies from code review |
35
+ | `--from-session <id>` | Session artifacts | Problems encountered during workflow execution |
36
+ | `--from-issues ISS-xxx,...` | `issues.jsonl` | Issues that trace to command deficiency |
37
+ | `--scan` | Auto-scan `.workflow/` | Discover all workflow-related signals |
38
+ | _(positional text)_ | User description | Direct observation of command deficiency |
39
+
40
+ Multiple sources combinable. No flags and no description → interactive mode.
41
+
42
+ ### Control Flags
43
+
44
+ | Flag | Description |
45
+ |------|-------------|
46
+ | `--dry-run` | Generate overlay JSON, show preview, don't install |
47
+ | `-y` | Skip confirmations |
48
+
49
+ ### Signal-to-Overlay Classification
50
+
51
+ A signal becomes an overlay candidate when it identifies a **workflow command deficiency** — a missing step, missing precondition, absent reading, or gap in success criteria. Signals about code bugs (not command gaps) are out of scope; suggest `/maestro-quick` or `/maestro-plan --gaps` for those.
52
+
53
+ ### CLI Targeting
54
+
55
+ Overlays support the `cli` field to target different workflow systems:
56
+ - `"cli": "claude"` (default) → patches `.claude/commands/{name}.md`
57
+ - `"cli": "codex"` → patches `.codex/skills/{name}/SKILL.md`
58
+ - `"cli": "both"` → patches both paths
59
+
60
+ When diagnosing signals, determine which CLI's workflow is affected and set the `cli` field accordingly.
61
+
62
+ ### Output
63
+ - Overlay files: `~/.maestro/overlays/amend-{slug}.json`
64
+ - Optional docs: `~/.maestro/overlays/docs/amend-{slug}.md`
65
+ </context>
66
+
67
+ <execution>
68
+ ### 1. Collect signals
69
+
70
+ Parse $ARGUMENTS for source flags and description text.
71
+
72
+ **If no sources and no description** → interactive mode:
73
+ Scan `.workflow/` for recent artifacts containing workflow-level signals:
74
+
75
+ ```
76
+ candidates = []
77
+
78
+ # Verification: workflow gaps (not code bugs)
79
+ for each verification.json in .workflow/scratch/*-verify-*/
80
+ extract must_have_failures, anti_pattern items
81
+ filter for items whose fix_direction points at a command gap
82
+ (e.g., "missing pre-check step", "no reading for X", "success criteria incomplete")
83
+
84
+ # Review: process findings
85
+ for each review.json in .workflow/scratch/*-review-*/
86
+ extract findings tagged as "process" or "workflow"
87
+
88
+ # Debug sessions: root causes tracing to command omission
89
+ for each understanding.md in .workflow/scratch/*-debug-*/
90
+ extract root causes where cause_type mentions workflow/command
91
+
92
+ # Open issues: workflow-tagged
93
+ issues = read .workflow/issues/issues.jsonl
94
+ | filter status == "open" AND tags include "workflow" or "command"
95
+
96
+ # Execution summaries: deviations
97
+ for each summary in .workflow/scratch/*-plan-*/.summaries/
98
+ extract plan deviations that suggest a missing command step
99
+ ```
100
+
101
+ Display scan results and use AskUserQuestion (multiSelect) to let user pick sources. Also allow user to add a freeform description.
102
+
103
+ **If source flags** → extract signals from each specified source.
104
+
105
+ **If only description** → user's text is the sole signal. Parse for:
106
+ - Which command(s) are affected
107
+ - What's missing or broken in the command flow
108
+ - What the expected behavior should be
109
+
110
+ ### 2. Diagnose: map signals to command patches
111
+
112
+ For each signal, determine:
113
+
114
+ ```
115
+ {
116
+ signal_id: "SIG-001",
117
+ source: "verify:scratch/20260426-verify-M1/",
118
+ description: "maestro-execute skipped pre-flight when no test suite exists",
119
+ target_command: "maestro-execute",
120
+ target_section: "execution",
121
+ patch_mode: "append",
122
+ fix_direction: "Add fallback verification when no test suite detected",
123
+ severity: "medium"
124
+ }
125
+ ```
126
+
127
+ **Diagnosis heuristics:**
128
+
129
+ | Signal pattern | Target section | Mode |
130
+ |---------------|----------------|------|
131
+ | Missing pre-check / gate | `execution` | `prepend` |
132
+ | Missing post-step / verification | `execution` | `append` |
133
+ | Missing reading / context | `required_reading` or `deferred_reading` | `append` |
134
+ | Incomplete success criteria | `success_criteria` | `append` |
135
+ | Missing error handling | `error_codes` | `append` |
136
+ | Scope/context gap | `context` | `append` |
137
+ | Entirely new concern | _(new section)_ | `new-section` |
138
+
139
+ If target command is ambiguous, read the pristine source from `$PKG_ROOT/.claude/commands/<name>.md` (preferred) or `~/.claude/commands/<name>.md` to confirm the right section.
140
+
141
+ ### 3. Group and plan overlays
142
+
143
+ Group signals by target command. Signals hitting the same command **and** same section merge into one patch. Different sections on the same command stay as separate patches in one overlay.
144
+
145
+ Decide overlay granularity:
146
+ - **Single-concern** (1–2 signals on same command) → one overlay per command: `patch-{command}-{slug}.json`
147
+ - **Multi-concern** (3+ signals across commands) → one umbrella overlay: `amend-{slug}.json`
148
+
149
+ For each planned overlay, read the target command's pristine source to:
150
+ - Verify the section exists
151
+ - Check for existing overlays (via `<!-- maestro-overlay:` markers)
152
+ - Confirm the injection point makes sense
153
+
154
+ ### 4. Preview injection points
155
+
156
+ For each target command, render a section map with injection points (same format as `/maestro-overlay`):
157
+
158
+ ```
159
+ === maestro-execute.md (1 existing overlay) ===
160
+
161
+ <purpose>
162
+ <required_reading>
163
+ ├─ [existing] require-spec-before-plan #0
164
+ <context>
165
+ <execution>
166
+ ├─ [existing] require-spec-before-plan #1 "Pre-check: Load Spec"
167
+ ├─ [existing] cli-verify-after-execute #0 "CLI Verification"
168
+ >>> NEW: prepend — SIG-001 "Fallback verify when no tests"
169
+ >>> NEW: append — SIG-003 "Issue sync retry on failure"
170
+ <error_codes>
171
+ <success_criteria>
172
+ >>> NEW: append — SIG-002 "Verify issue status updated"
173
+
174
+ === maestro-plan.md (0 existing overlays) ===
175
+
176
+ <purpose>
177
+ <required_reading>
178
+ <context>
179
+ >>> NEW: append — SIG-004 "Load prior patch history"
180
+ <execution>
181
+ <success_criteria>
182
+ ```
183
+
184
+ Use AskUserQuestion to confirm:
185
+ - **"Apply all"** — proceed with all patches
186
+ - **"Select patches"** — per-signal confirmation
187
+ - **"Edit"** — modify a specific signal's target/section before proceeding
188
+ - **"Cancel"** — abort
189
+
190
+ ### 5. Draft overlay JSON
191
+
192
+ For each overlay, build the JSON following the overlay schema:
193
+
194
+ ```json
195
+ {
196
+ "name": "amend-execute-verify-fallback",
197
+ "description": "Add fallback verification and issue sync retry to maestro-execute [from: AMEND-20260426]",
198
+ "targets": ["maestro-execute"],
199
+ "cli": "claude",
200
+ "priority": 60,
201
+ "enabled": true,
202
+ "patches": [
203
+ {
204
+ "section": "execution",
205
+ "mode": "prepend",
206
+ "content": "## Fallback Verification (patch: SIG-001)\n\nIf no test suite exists for the affected module, run a structural verification instead:\n..."
207
+ },
208
+ {
209
+ "section": "execution",
210
+ "mode": "append",
211
+ "content": "## Issue Sync Retry (patch: SIG-003)\n\nIf issue status sync fails, retry once before logging as warning:\n..."
212
+ },
213
+ {
214
+ "section": "success_criteria",
215
+ "mode": "append",
216
+ "content": "- [ ] Issue statuses confirmed synced after execution (patch: SIG-002)"
217
+ }
218
+ ]
219
+ }
220
+ ```
221
+
222
+ **Content rules:**
223
+ - Heading includes `(patch: SIG-NNN)` for traceability
224
+ - Content is concise — fix the gap, nothing more
225
+ - `@~/.maestro/overlays/docs/` references for anything longer than 10 lines
226
+ - If supplementary doc needed, write it to `~/.maestro/overlays/docs/amend-{slug}.md` first
227
+
228
+ Write overlay JSON to `~/.maestro/overlays/amend-{slug}.json`.
229
+
230
+ If `--dry-run`, show the JSON and section map preview, then stop.
231
+
232
+ ### 6. Install overlays
233
+
234
+ For each generated overlay:
235
+
236
+ ```bash
237
+ maestro overlay add ~/.maestro/overlays/amend-{slug}.json
238
+ ```
239
+
240
+ On validation failure, fix the JSON and retry (max 2 attempts).
241
+
242
+ ### 7. Report
243
+
244
+ ```
245
+ === AMEND OVERLAYS INSTALLED ===
246
+ Session: AMEND-20260426
247
+ Signals: 5 collected, 4 applied, 1 skipped (code bug, not command gap)
248
+ Overlays: 2 created
249
+
250
+ amend-execute-verify-fallback
251
+ Targets: maestro-execute (3 patches: exec prepend, exec append, criteria append)
252
+ Path: ~/.maestro/overlays/amend-execute-verify-fallback.json
253
+ Source: SIG-001, SIG-002, SIG-003
254
+
255
+ amend-plan-context-history
256
+ Targets: maestro-plan (1 patch: context append)
257
+ Path: ~/.maestro/overlays/amend-plan-context-history.json
258
+ Source: SIG-004
259
+
260
+ Skipped:
261
+ SIG-005 "Missing null check in auth.ts" → code bug, use /maestro-quick
262
+
263
+ Re-apply: maestro overlay apply
264
+ Remove: maestro overlay remove amend-execute-verify-fallback
265
+ Inspect: maestro overlay list
266
+ ```
267
+
268
+ ### Post-patch routing
269
+
270
+ Use AskUserQuestion:
271
+ - **"Test commands"** — run affected commands to verify patches work
272
+ - **"View overlays"** — `maestro overlay list`
273
+ - **"Continue"** — done
274
+ </execution>
275
+
276
+ <error_codes>
277
+ | Code | Severity | Condition | Recovery |
278
+ |------|----------|-----------|----------|
279
+ | E001 | error | No signals found from any source | Verify artifact paths, or provide description |
280
+ | E002 | error | Source artifact not found | Check path exists |
281
+ | E003 | error | No signals map to command deficiencies (all are code bugs) | Use `/maestro-quick` or `/maestro-plan --gaps` instead |
282
+ | E004 | error | Overlay validation failed after 2 retries | Review generated JSON manually |
283
+ | W001 | warning | Some signals skipped (code bugs, not command gaps) | Route to appropriate fix command |
284
+ | W002 | warning | Target command has many existing overlays (≥3) | Consider consolidating overlays |
285
+ | W003 | warning | Scan found no recent workflow artifacts | Check `.workflow/` or provide explicit source |
286
+ </error_codes>
287
+
288
+ <success_criteria>
289
+ - [ ] Signal sources resolved and signals collected
290
+ - [ ] Each signal classified: command deficiency vs. code bug (only command deficiencies proceed)
291
+ - [ ] Signals mapped to target command + section + mode
292
+ - [ ] Pristine command sources read to verify sections and check existing overlays
293
+ - [ ] Section map with injection points shown and confirmed by user
294
+ - [ ] Overlay JSON written to `~/.maestro/overlays/amend-{slug}.json`
295
+ - [ ] Supplementary docs written to `~/.maestro/overlays/docs/` if needed
296
+ - [ ] `maestro overlay add` exited successfully for each overlay
297
+ - [ ] Target command files contain `<!-- maestro-overlay:amend-{slug}#N hash=... -->` markers
298
+ - [ ] Report shown with overlay details, source traceability, and skipped signals
299
+ - [ ] Skipped code-bug signals routed to appropriate alternative command
300
+ </success_criteria>