maestro-flow 0.3.37 → 0.3.39

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 (186) hide show
  1. package/.claude/agents/workflow-analyzer.md +2 -0
  2. package/.claude/agents/workflow-debugger.md +2 -0
  3. package/.claude/agents/workflow-executor.md +2 -0
  4. package/.claude/agents/workflow-integration-checker.md +1 -0
  5. package/.claude/agents/workflow-nyquist-auditor.md +1 -0
  6. package/.claude/agents/workflow-planner.md +2 -0
  7. package/.claude/agents/workflow-reviewer.md +2 -0
  8. package/.claude/agents/workflow-verifier.md +2 -0
  9. package/.claude/commands/learn-decompose.md +176 -176
  10. package/.claude/commands/learn-follow.md +167 -167
  11. package/.claude/commands/learn-investigate.md +221 -221
  12. package/.claude/commands/learn-retro.md +303 -303
  13. package/.claude/commands/learn-second-opinion.md +167 -167
  14. package/.claude/commands/maestro-amend.md +300 -300
  15. package/.claude/commands/maestro-analyze.md +126 -126
  16. package/.claude/commands/maestro-brainstorm.md +100 -100
  17. package/.claude/commands/maestro-composer.md +354 -354
  18. package/.claude/commands/maestro-execute.md +120 -114
  19. package/.claude/commands/maestro-fork.md +86 -86
  20. package/.claude/commands/maestro-init.md +78 -78
  21. package/.claude/commands/maestro-learn.md +140 -140
  22. package/.claude/commands/maestro-link-coordinate.md +1 -1
  23. package/.claude/commands/maestro-merge.md +61 -61
  24. package/.claude/commands/maestro-milestone-release.md +96 -96
  25. package/.claude/commands/maestro-overlay.md +178 -178
  26. package/.claude/commands/maestro-plan.md +150 -138
  27. package/.claude/commands/maestro-player.md +404 -404
  28. package/.claude/commands/maestro-quick.md +56 -56
  29. package/.claude/commands/maestro-ralph-execute.md +7 -18
  30. package/.claude/commands/maestro-ralph.md +9 -3
  31. package/.claude/commands/maestro-roadmap.md +1 -1
  32. package/.claude/commands/maestro-ui-design.md +93 -93
  33. package/.claude/commands/maestro-update.md +176 -176
  34. package/.claude/commands/maestro-verify.md +96 -90
  35. package/.claude/commands/maestro.md +121 -121
  36. package/.claude/commands/manage-codebase-rebuild.md +75 -75
  37. package/.claude/commands/manage-codebase-refresh.md +57 -57
  38. package/.claude/commands/manage-harvest.md +94 -94
  39. package/.claude/commands/manage-issue-discover.md +77 -77
  40. package/.claude/commands/manage-issue.md +73 -73
  41. package/.claude/commands/manage-knowhow-capture.md +193 -193
  42. package/.claude/commands/manage-knowhow.md +77 -77
  43. package/.claude/commands/manage-learn.md +67 -67
  44. package/.claude/commands/manage-status.md +51 -51
  45. package/.claude/commands/manage-wiki.md +62 -62
  46. package/.claude/commands/quality-auto-test.md +1 -1
  47. package/.claude/commands/quality-debug.md +121 -115
  48. package/.claude/commands/quality-refactor.md +55 -55
  49. package/.claude/commands/quality-retrospective.md +78 -78
  50. package/.claude/commands/quality-review.md +114 -108
  51. package/.claude/commands/quality-sync.md +51 -51
  52. package/.claude/commands/quality-test.md +103 -103
  53. package/.claude/commands/spec-add.md +49 -49
  54. package/.claude/commands/spec-load.md +51 -51
  55. package/.claude/commands/spec-remove.md +51 -51
  56. package/.claude/commands/spec-setup.md +51 -51
  57. package/.claude/commands/wiki-connect.md +62 -62
  58. package/.claude/commands/wiki-digest.md +69 -69
  59. package/.codex/skills/learn-decompose/SKILL.md +113 -113
  60. package/.codex/skills/learn-follow/SKILL.md +1 -1
  61. package/.codex/skills/learn-investigate/SKILL.md +83 -83
  62. package/.codex/skills/learn-retro/SKILL.md +83 -83
  63. package/.codex/skills/learn-second-opinion/SKILL.md +86 -86
  64. package/.codex/skills/maestro/SKILL.md +304 -304
  65. package/.codex/skills/maestro-analyze/SKILL.md +9 -8
  66. package/.codex/skills/maestro-brainstorm/SKILL.md +442 -397
  67. package/.codex/skills/maestro-composer/SKILL.md +213 -213
  68. package/.codex/skills/maestro-execute/SKILL.md +346 -318
  69. package/.codex/skills/maestro-fork/SKILL.md +56 -2
  70. package/.codex/skills/maestro-init/SKILL.md +40 -16
  71. package/.codex/skills/maestro-learn/SKILL.md +80 -80
  72. package/.codex/skills/maestro-link-coordinate/SKILL.md +257 -257
  73. package/.codex/skills/maestro-merge/SKILL.md +1 -1
  74. package/.codex/skills/maestro-milestone-audit/SKILL.md +1 -1
  75. package/.codex/skills/maestro-milestone-complete/SKILL.md +40 -9
  76. package/.codex/skills/maestro-milestone-release/SKILL.md +70 -70
  77. package/.codex/skills/maestro-overlay/SKILL.md +1 -1
  78. package/.codex/skills/maestro-plan/SKILL.md +19 -4
  79. package/.codex/skills/maestro-player/SKILL.md +323 -323
  80. package/.codex/skills/maestro-quick/SKILL.md +1 -1
  81. package/.codex/skills/maestro-ralph/SKILL.md +681 -578
  82. package/.codex/skills/maestro-roadmap/SKILL.md +518 -468
  83. package/.codex/skills/maestro-ui-design/SKILL.md +109 -12
  84. package/.codex/skills/maestro-verify/SKILL.md +27 -9
  85. package/.codex/skills/manage-codebase-rebuild/SKILL.md +3 -2
  86. package/.codex/skills/manage-codebase-refresh/SKILL.md +1 -1
  87. package/.codex/skills/manage-harvest/SKILL.md +91 -91
  88. package/.codex/skills/manage-issue/SKILL.md +19 -6
  89. package/.codex/skills/manage-issue-discover/SKILL.md +1 -1
  90. package/.codex/skills/manage-knowhow/SKILL.md +95 -95
  91. package/.codex/skills/manage-knowhow-capture/SKILL.md +110 -110
  92. package/.codex/skills/manage-learn/SKILL.md +1 -1
  93. package/.codex/skills/manage-status/SKILL.md +1 -1
  94. package/.codex/skills/manage-wiki/SKILL.md +55 -55
  95. package/.codex/skills/quality-auto-test/SKILL.md +547 -547
  96. package/.codex/skills/quality-debug/SKILL.md +339 -334
  97. package/.codex/skills/quality-refactor/SKILL.md +1 -1
  98. package/.codex/skills/quality-retrospective/SKILL.md +292 -292
  99. package/.codex/skills/quality-review/SKILL.md +365 -364
  100. package/.codex/skills/quality-sync/SKILL.md +1 -1
  101. package/.codex/skills/quality-test/SKILL.md +498 -498
  102. package/.codex/skills/spec-add/SKILL.md +101 -101
  103. package/.codex/skills/spec-load/SKILL.md +77 -77
  104. package/.codex/skills/spec-map/SKILL.md +1 -1
  105. package/.codex/skills/spec-remove/SKILL.md +69 -69
  106. package/.codex/skills/spec-setup/SKILL.md +1 -1
  107. package/.codex/skills/team-coordinate/SKILL.md +2 -1
  108. package/.codex/skills/team-executor/SKILL.md +116 -115
  109. package/.codex/skills/team-lifecycle-v4/SKILL.md +2 -1
  110. package/.codex/skills/team-lifecycle-v4/instructions/agent-instruction.md +14 -6
  111. package/.codex/skills/team-lifecycle-v4/roles/analyst/role.md +16 -4
  112. package/.codex/skills/team-lifecycle-v4/roles/executor/commands/implement.md +7 -1
  113. package/.codex/skills/team-lifecycle-v4/roles/planner/role.md +16 -4
  114. package/.codex/skills/team-lifecycle-v4/roles/writer/role.md +8 -2
  115. package/.codex/skills/team-quality-assurance/SKILL.md +2 -1
  116. package/.codex/skills/team-quality-assurance/roles/scout/role.md +9 -2
  117. package/.codex/skills/team-review/SKILL.md +2 -1
  118. package/.codex/skills/team-review/roles/reviewer/role.md +10 -1
  119. package/.codex/skills/team-review/roles/scanner/role.md +10 -1
  120. package/.codex/skills/team-tech-debt/SKILL.md +144 -143
  121. package/.codex/skills/team-tech-debt/roles/executor/role.md +9 -5
  122. package/.codex/skills/team-tech-debt/roles/scanner/role.md +10 -0
  123. package/.codex/skills/team-tech-debt/roles/validator/role.md +8 -2
  124. package/.codex/skills/team-testing/SKILL.md +2 -1
  125. package/.codex/skills/team-testing/roles/executor/role.md +8 -2
  126. package/.codex/skills/team-testing/roles/generator/role.md +8 -2
  127. package/.codex/skills/wiki-connect/SKILL.md +73 -73
  128. package/.codex/skills/wiki-digest/SKILL.md +87 -87
  129. package/README.md +6 -0
  130. package/README.zh-CN.md +6 -0
  131. package/dashboard/dist-server/dashboard/src/server/agents/claude-code-adapter.js +4 -0
  132. package/dashboard/dist-server/dashboard/src/server/agents/claude-code-adapter.js.map +1 -1
  133. package/dashboard/dist-server/dashboard/src/server/agents/codex-cli-adapter.js +118 -7
  134. package/dashboard/dist-server/dashboard/src/server/agents/codex-cli-adapter.js.map +1 -1
  135. package/dashboard/dist-server/shared/agent-types.d.ts +2 -0
  136. package/dashboard/dist-server/src/agents/cli-agent-runner.d.ts +2 -0
  137. package/dashboard/dist-server/src/agents/cli-agent-runner.js +4 -0
  138. package/dashboard/dist-server/src/agents/cli-agent-runner.js.map +1 -1
  139. package/dashboard/dist-server/src/commands/delegate.d.ts +2 -0
  140. package/dashboard/dist-server/src/commands/delegate.js +18 -0
  141. package/dashboard/dist-server/src/commands/delegate.js.map +1 -1
  142. package/dashboard/dist-server/src/config/cli-tools-config.d.ts +6 -0
  143. package/dashboard/dist-server/src/config/cli-tools-config.js +2 -0
  144. package/dashboard/dist-server/src/config/cli-tools-config.js.map +1 -1
  145. package/dist/shared/agent-types.d.ts +2 -0
  146. package/dist/shared/agent-types.d.ts.map +1 -1
  147. package/dist/src/agents/cli-agent-runner.d.ts +2 -0
  148. package/dist/src/agents/cli-agent-runner.d.ts.map +1 -1
  149. package/dist/src/agents/cli-agent-runner.js +4 -0
  150. package/dist/src/agents/cli-agent-runner.js.map +1 -1
  151. package/dist/src/commands/config.d.ts.map +1 -1
  152. package/dist/src/commands/config.js +29 -1
  153. package/dist/src/commands/config.js.map +1 -1
  154. package/dist/src/commands/delegate.d.ts +2 -0
  155. package/dist/src/commands/delegate.d.ts.map +1 -1
  156. package/dist/src/commands/delegate.js +18 -0
  157. package/dist/src/commands/delegate.js.map +1 -1
  158. package/dist/src/commands/launcher.d.ts.map +1 -1
  159. package/dist/src/commands/launcher.js +27 -4
  160. package/dist/src/commands/launcher.js.map +1 -1
  161. package/dist/src/config/cli-tools-config.d.ts +6 -0
  162. package/dist/src/config/cli-tools-config.d.ts.map +1 -1
  163. package/dist/src/config/cli-tools-config.js +2 -0
  164. package/dist/src/config/cli-tools-config.js.map +1 -1
  165. package/dist/src/core/overlay/applier.d.ts.map +1 -1
  166. package/dist/src/core/overlay/applier.js +65 -5
  167. package/dist/src/core/overlay/applier.js.map +1 -1
  168. package/dist/src/core/overlay/loader.d.ts.map +1 -1
  169. package/dist/src/core/overlay/loader.js +9 -4
  170. package/dist/src/core/overlay/loader.js.map +1 -1
  171. package/dist/src/core/overlay/types.d.ts +2 -0
  172. package/dist/src/core/overlay/types.d.ts.map +1 -1
  173. package/dist/src/core/overlay/types.js +2 -0
  174. package/dist/src/core/overlay/types.js.map +1 -1
  175. package/dist/src/tui/tools-ui/ToolsDashboard.d.ts.map +1 -1
  176. package/dist/src/tui/tools-ui/ToolsDashboard.js +1 -1
  177. package/dist/src/tui/tools-ui/ToolsDashboard.js.map +1 -1
  178. package/dist/src/tui/tools-ui/ToolsOverview.d.ts.map +1 -1
  179. package/dist/src/tui/tools-ui/ToolsOverview.js +51 -4
  180. package/dist/src/tui/tools-ui/ToolsOverview.js.map +1 -1
  181. package/package.json +1 -1
  182. package/shared/agent-types.ts +2 -0
  183. package/workflows/delegate-protocol.codex.md +65 -0
  184. package/workflows/issue-analyze.md +2 -3
  185. package/workflows/issue-gaps-analyze.codex.md +260 -0
  186. package/workflows/issue-gaps-analyze.md +214 -0
@@ -1,300 +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>
1
+ ---
2
+ name: maestro-amend
3
+ description: Generate overlays to fix workflow command deficiencies
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>