maestro-flow 0.5.37 → 0.5.38

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 (152) hide show
  1. package/.agents/skills/maestro/SKILL.md +11 -5
  2. package/.agents/skills/maestro-ralph/SKILL.md +80 -12
  3. package/.agents/skills/maestro-ralph-execute/SKILL.md +17 -6
  4. package/.agents/skills/manage-drift-realign/SKILL.md +153 -0
  5. package/.agy/skills/maestro/SKILL.md +11 -5
  6. package/.agy/skills/maestro-ralph/SKILL.md +80 -12
  7. package/.agy/skills/maestro-ralph-execute/SKILL.md +17 -6
  8. package/.agy/skills/manage-drift-realign/SKILL.md +153 -0
  9. package/.claude/commands/maestro-ralph-execute.md +17 -6
  10. package/.claude/commands/maestro-ralph.md +80 -12
  11. package/.claude/commands/maestro.md +11 -5
  12. package/.claude/commands/manage-drift-realign.md +151 -0
  13. package/.codex/skills/maestro/SKILL.md +16 -8
  14. package/.codex/skills/maestro-ralph/SKILL.md +138 -11
  15. package/.codex/skills/maestro-ralph-execute/SKILL.md +17 -6
  16. package/.codex/skills/manage-drift-realign/SKILL.md +471 -0
  17. package/README.md +25 -8
  18. package/README.zh-CN.md +6 -6
  19. package/dashboard/dist-server/src/commands/install-backend.d.ts +10 -0
  20. package/dashboard/dist-server/src/commands/install-backend.js +69 -0
  21. package/dashboard/dist-server/src/commands/install-backend.js.map +1 -1
  22. package/dashboard/dist-server/src/core/component-defs.d.ts +11 -0
  23. package/dashboard/dist-server/src/core/component-defs.js +34 -2
  24. package/dashboard/dist-server/src/core/component-defs.js.map +1 -1
  25. package/dist/src/cli.js +3 -2
  26. package/dist/src/cli.js.map +1 -1
  27. package/dist/src/commands/install-backend.d.ts +10 -0
  28. package/dist/src/commands/install-backend.d.ts.map +1 -1
  29. package/dist/src/commands/install-backend.js +69 -0
  30. package/dist/src/commands/install-backend.js.map +1 -1
  31. package/dist/src/commands/install.js +1 -0
  32. package/dist/src/commands/install.js.map +1 -1
  33. package/dist/src/commands/ralph.d.ts.map +1 -1
  34. package/dist/src/commands/ralph.js +8 -0
  35. package/dist/src/commands/ralph.js.map +1 -1
  36. package/dist/src/commands/timeline.d.ts +14 -0
  37. package/dist/src/commands/timeline.d.ts.map +1 -0
  38. package/dist/src/commands/timeline.js +377 -0
  39. package/dist/src/commands/timeline.js.map +1 -0
  40. package/dist/src/core/component-defs.d.ts +11 -0
  41. package/dist/src/core/component-defs.d.ts.map +1 -1
  42. package/dist/src/core/component-defs.js +34 -2
  43. package/dist/src/core/component-defs.js.map +1 -1
  44. package/dist/src/core/install-executor.d.ts.map +1 -1
  45. package/dist/src/core/install-executor.js +11 -1
  46. package/dist/src/core/install-executor.js.map +1 -1
  47. package/dist/src/core/install-profile.d.ts.map +1 -1
  48. package/dist/src/core/install-profile.js +52 -17
  49. package/dist/src/core/install-profile.js.map +1 -1
  50. package/dist/src/i18n/locales/en.d.ts.map +1 -1
  51. package/dist/src/i18n/locales/en.js +4 -1
  52. package/dist/src/i18n/locales/en.js.map +1 -1
  53. package/dist/src/i18n/locales/zh.d.ts.map +1 -1
  54. package/dist/src/i18n/locales/zh.js +4 -1
  55. package/dist/src/i18n/locales/zh.js.map +1 -1
  56. package/dist/src/i18n/types.d.ts +3 -0
  57. package/dist/src/i18n/types.d.ts.map +1 -1
  58. package/dist/src/ralph/cmd-complete.d.ts +4 -0
  59. package/dist/src/ralph/cmd-complete.d.ts.map +1 -1
  60. package/dist/src/ralph/cmd-complete.js +8 -0
  61. package/dist/src/ralph/cmd-complete.js.map +1 -1
  62. package/dist/src/ralph/cmd-next.js +58 -8
  63. package/dist/src/ralph/cmd-next.js.map +1 -1
  64. package/dist/src/ralph/status-schema.d.ts +29 -2
  65. package/dist/src/ralph/status-schema.d.ts.map +1 -1
  66. package/dist/src/ralph/status-schema.js +1 -1
  67. package/dist/src/tui/install-ui/ComponentGrid.d.ts.map +1 -1
  68. package/dist/src/tui/install-ui/ComponentGrid.js +71 -38
  69. package/dist/src/tui/install-ui/ComponentGrid.js.map +1 -1
  70. package/dist/src/tui/install-ui/ComponentGrid.logic.d.ts +12 -3
  71. package/dist/src/tui/install-ui/ComponentGrid.logic.d.ts.map +1 -1
  72. package/dist/src/tui/install-ui/ComponentGrid.logic.js +21 -4
  73. package/dist/src/tui/install-ui/ComponentGrid.logic.js.map +1 -1
  74. package/dist/src/tui/install-ui/CyberItem.d.ts +3 -1
  75. package/dist/src/tui/install-ui/CyberItem.d.ts.map +1 -1
  76. package/dist/src/tui/install-ui/CyberItem.js +6 -5
  77. package/dist/src/tui/install-ui/CyberItem.js.map +1 -1
  78. package/dist/src/tui/install-ui/GroupedHub.d.ts +9 -0
  79. package/dist/src/tui/install-ui/GroupedHub.d.ts.map +1 -1
  80. package/dist/src/tui/install-ui/GroupedHub.js +54 -47
  81. package/dist/src/tui/install-ui/GroupedHub.js.map +1 -1
  82. package/dist/src/tui/install-ui/InstallConfirm.js +1 -1
  83. package/dist/src/tui/install-ui/InstallConfirm.js.map +1 -1
  84. package/dist/src/tui/install-ui/InstallFlow.d.ts.map +1 -1
  85. package/dist/src/tui/install-ui/InstallFlow.js +54 -5
  86. package/dist/src/tui/install-ui/InstallFlow.js.map +1 -1
  87. package/dist/src/tui/install-ui/types.d.ts +1 -0
  88. package/dist/src/tui/install-ui/types.d.ts.map +1 -1
  89. package/dist/src/tui/install-ui/types.js.map +1 -1
  90. package/dist/src/tui/install-ui/useInstallFlowState.d.ts +8 -2
  91. package/dist/src/tui/install-ui/useInstallFlowState.d.ts.map +1 -1
  92. package/dist/src/tui/install-ui/useInstallFlowState.js +145 -15
  93. package/dist/src/tui/install-ui/useInstallFlowState.js.map +1 -1
  94. package/dist/src/utils/update-notices.js +12 -0
  95. package/dist/src/utils/update-notices.js.map +1 -1
  96. package/package.json +1 -1
  97. package/workflows/agy-instructions.md +127 -88
  98. package/workflows/analyze.md +2 -2
  99. package/workflows/auto-test.md +7 -1
  100. package/workflows/blueprint.md +22 -19
  101. package/workflows/brainstorm.md +11 -3
  102. package/workflows/business-test.md +4 -0
  103. package/workflows/codebase-rebuild.md +8 -1
  104. package/workflows/codebase-refresh.md +7 -1
  105. package/workflows/codex-instructions.md +1 -1
  106. package/workflows/debug.md +5 -2
  107. package/workflows/domain-add.md +6 -0
  108. package/workflows/drift-realign.md +396 -0
  109. package/workflows/execute.md +5 -4
  110. package/workflows/explore-usage.md +2 -2
  111. package/workflows/finish-work.md +6 -6
  112. package/workflows/fork.md +2 -2
  113. package/workflows/grill.md +6 -5
  114. package/workflows/harvest.md +2 -2
  115. package/workflows/impeccable.md +3 -2
  116. package/workflows/init.md +7 -7
  117. package/workflows/integration-test.md +1 -0
  118. package/workflows/issue-gaps-analyze.codex.md +2 -0
  119. package/workflows/issue-gaps-analyze.md +4 -4
  120. package/workflows/issue-plan.md +1 -1
  121. package/workflows/knowhow.md +7 -1
  122. package/workflows/knowledge-audit.md +1 -1
  123. package/workflows/maestro-super.md +2 -2
  124. package/workflows/maestro.md +3 -3
  125. package/workflows/map.md +2 -2
  126. package/workflows/milestone-audit.md +1 -1
  127. package/workflows/milestone-complete.md +1 -1
  128. package/workflows/plan.md +7 -6
  129. package/workflows/quick.md +8 -6
  130. package/workflows/ralph-amend-goal.md +177 -0
  131. package/workflows/refactor.md +2 -0
  132. package/workflows/retrospective.md +7 -3
  133. package/workflows/review.md +6 -4
  134. package/workflows/roadmap-common.md +3 -3
  135. package/workflows/roadmap.md +8 -5
  136. package/workflows/spec-generate.md +23 -18
  137. package/workflows/specs-load.md +1 -1
  138. package/workflows/specs-setup.md +2 -0
  139. package/workflows/sync.md +4 -2
  140. package/workflows/test-gen.md +1 -1
  141. package/workflows/test.md +1 -1
  142. package/workflows/ui-codify-extract.md +1 -0
  143. package/workflows/ui-codify-knowhow.md +1 -1
  144. package/workflows/ui-codify-package.md +1 -1
  145. package/workflows/ui-codify.md +9 -7
  146. package/workflows/ui-design.md +9 -7
  147. package/workflows/ui-style.md +6 -4
  148. package/workflows/verify.md +4 -4
  149. package/workflows/wiki-connect.md +2 -0
  150. package/workflows/wiki-digest.md +5 -3
  151. package/workflows/wiki-manage.md +4 -0
  152. package/workflows/maestro.codex.md +0 -365
@@ -1,365 +0,0 @@
1
- # Workflow: Maestro (Codex Edition)
2
-
3
- ---
4
-
5
- ## Step 1: Parse Arguments
6
-
7
- Extract from `$ARGUMENTS`:
8
- - Flags: `-y`/`--yes` (AUTO_YES), `-c`/`--continue` (RESUME), `--dry-run`, `--chain <name>`
9
- - `intent` = remaining text after flag removal
10
-
11
- **Resume mode**: If RESUME, load latest `.workflow/.maestro/maestro-*/status.json`, set `current_step` to first pending step, jump to **Step 6**.
12
-
13
- ---
14
-
15
- ## Step 2: Read Project State
16
-
17
- Read `.workflow/state.json` if present. Derive `projectState`:
18
- - `current_phase`: first in-progress execute artifact, else first phase without completed execute
19
- - Fields: `phase_slug`, `phase_status` (pending|exploring|planning|executing|verifying|testing|completed|blocked), `phase_artifacts`, `execution` (tasks_completed/total), `verification_status`, `review_verdict`, `uat_status`, `phases_total/completed`, `has_blockers`, `accumulated_context`
20
-
21
- If not initialized and no intent → Error E001.
22
-
23
- ---
24
-
25
- ## Step 3: Classify Intent & Select Chain
26
-
27
- ### 3a: Exact-match keywords (fast path)
28
-
29
- If `forceChain` is set → validate against chainMap and jump to **3c**.
30
-
31
- Exact-match keywords: `continue`/`next`/`go`/`继续`/`下一步` → `state_continue`; `status`/`状态`/`dashboard` → `status`. If matched, skip to **3c**.
32
-
33
- ### 3a-2: Structured intent extraction (LLM-native)
34
-
35
- Instead of regex, extract a structured intent tuple using LLM semantic understanding:
36
-
37
- ```json
38
- {
39
- "action": "<create|fix|analyze|plan|execute|review|test|debug|refactor|explore|manage|transition|continue|sync|learn|retrospect>",
40
- "object": "<feature|bug|issue|code|test|spec|phase|milestone|doc|performance|security|ui|memory|codebase|config>",
41
- "scope": "<module/file/area or null>",
42
- "issue_id": "<ISS-XXXXXXXX-NNN if mentioned, else null>",
43
- "phase_ref": "<integer if mentioned, else null>",
44
- "urgency": "<low|normal|high>"
45
- }
46
- ```
47
-
48
- **Key disambiguation**: "问题"/"issue"/"problem" as something broken → `object: "bug"` (routes to debug). As a tracked item (with ISS-ID or management context) → `object: "issue"` (routes to issue management). When ambiguous, prefer `"bug"`.
49
-
50
- ### 3a-3: Route via action × object matrix
51
-
52
- Route via `action × object` matrix. If `issue_id` present → issue pipeline directly.
53
-
54
- | action | object-specific overrides | default |
55
- |--------|--------------------------|---------|
56
- | fix | bug/code/perf/security→debug, issue→issue | debug |
57
- | create | feature→quick, issue→issue, test→test_gen, spec→spec_generate, ui→ui_design, config→init | quick |
58
- | analyze | bug/code→analyze, issue→issue_analyze, codebase→spec_map | analyze |
59
- | explore | issue→issue_discover, feature/ui→brainstorm/ui_design | brainstorm |
60
- | plan | issue→issue_plan, spec→spec_generate | plan |
61
- | execute | issue→issue_execute | execute |
62
- | manage | issue→issue, milestone→milestone_audit, phase→phase_transition, memory/doc/codebase→memory/sync/codebase_refresh | status |
63
- | transition | phase→phase_transition, milestone→milestone_complete | phase_transition |
64
- | review, test, debug, refactor, continue, sync, learn, retrospect, release, amend, compose | — | self-named |
65
-
66
- **Clarity scoring**: 3 = action+object+scope, 2 = action+object, 1 = action only, 0 = empty.
67
- If `clarity < 2` and not `AUTO_YES`: request user input (max 2 rounds).
68
-
69
- ### 3b: State-based routing (when `taskType === 'state_continue'`)
70
-
71
- Returns `{ chain, argsOverride? }`. Steps resolved from `chainMap[chain]`.
72
-
73
- | Condition | Chain |
74
- |-----------|-------|
75
- | Not initialized | `init` |
76
- | No phases, no roadmap, has accumulated_context | `next-milestone` (with deferred/decisions context) |
77
- | No phases | `brainstorm-driven` |
78
- | pending + has context | `plan` |
79
- | pending, no context | `analyze` |
80
- | exploring/planning + has plan | `execute` |
81
- | exploring/planning, no plan | `plan` |
82
- | executing, all tasks done | `review` |
83
- | executing, tasks remain | `execute` |
84
- | exec completed + no review | `review` |
85
- | exec completed + review BLOCK | `review-fix` |
86
- | exec completed + UAT pending | `test` |
87
- | exec completed + UAT passed | `milestone-close` |
88
- | exec completed + UAT failed | `debug` |
89
- | testing, UAT passed | `milestone-close` |
90
- | testing, UAT not passed | `debug` |
91
- | completed | `milestone-close` |
92
- | blocked | `debug` |
93
- | fallback | `status` |
94
-
95
- ### 3c: Intent-based chain map
96
-
97
- ```javascript
98
- const chainMap = {
99
- // ── Single-step ──────────────────────────────────────────────────────────
100
- 'status': [{ cmd: 'manage-status' }],
101
- 'init': [{ cmd: 'maestro-init' }],
102
- 'analyze': [{ cmd: 'maestro-analyze', args: '{phase}' }],
103
- 'ui_design': [{ cmd: 'maestro-impeccable', args: '"{phase}" --chain build' }],
104
- 'plan': [{ cmd: 'maestro-plan', args: '{phase}' }],
105
- 'execute': [{ cmd: 'maestro-execute', args: '{phase}' }],
106
- 'test_gen': [{ cmd: 'quality-auto-test', args: '{phase}' }],
107
- 'auto_test': [{ cmd: 'quality-auto-test', args: '{phase}' }],
108
- 'test': [{ cmd: 'quality-test', args: '{phase}' }],
109
- 'debug': [{ cmd: 'quality-debug', args: '"{description}"' }],
110
- 'integration_test': [{ cmd: 'quality-auto-test', args: '{phase}' }],
111
- 'refactor': [{ cmd: 'quality-refactor', args: '"{description}"' }],
112
- 'review': [{ cmd: 'quality-review', args: '{phase}' }],
113
- 'retrospective': [{ cmd: 'quality-retrospective', args: '{phase}' }],
114
- 'learn': [{ cmd: 'manage-learn', args: '"{description}"' }],
115
- 'sync': [{ cmd: 'quality-sync' }],
116
- 'phase_transition': [{ cmd: 'maestro-milestone-audit' }, { cmd: 'maestro-milestone-complete' }],
117
- 'milestone_audit': [{ cmd: 'maestro-milestone-audit' }],
118
- 'milestone_complete': [{ cmd: 'maestro-milestone-complete' }],
119
- 'codebase_rebuild': [{ cmd: 'manage-codebase-rebuild' }],
120
- 'codebase_refresh': [{ cmd: 'manage-codebase-refresh' }],
121
- 'spec_setup': [{ cmd: 'spec-setup' }],
122
- 'spec_add': [{ cmd: 'spec-add', args: '"{description}"' }],
123
- 'spec_load': [{ cmd: 'spec-load' }],
124
- 'spec_map': [{ cmd: 'manage-codebase-rebuild' }],
125
- 'knowhow_capture': [{ cmd: 'manage-knowhow-capture', args: '"{description}"' }],
126
- 'knowhow': [{ cmd: 'manage-knowhow', args: '"{description}"' }],
127
- 'issue': [{ cmd: 'manage-issue', args: '"{description}"' }],
128
- 'issue_discover': [{ cmd: 'manage-issue-discover', args: '"{description}"' }],
129
- 'issue_analyze': [{ cmd: 'maestro-analyze', args: '--gaps "{description}"' }],
130
- 'issue_plan': [{ cmd: 'maestro-plan', args: '--gaps' }],
131
- 'issue_execute': [{ cmd: 'maestro-execute', args: '' }],
132
- 'quick': [{ cmd: 'maestro-quick', args: '"{description}"' }],
133
- // ── Multi-step chains ────────────────────────────────────────────────────
134
- 'spec-driven': [
135
- { cmd: 'maestro-init' },
136
- { cmd: 'maestro-roadmap', args: '--mode full "{description}"' },
137
- { cmd: 'maestro-plan', args: '{phase}' },
138
- { cmd: 'maestro-execute', args: '{phase}' }
139
- ],
140
- 'brainstorm-driven': [
141
- { cmd: 'maestro-brainstorm', args: '"{description}"' },
142
- { cmd: 'maestro-plan', args: '{phase}' },
143
- { cmd: 'maestro-execute', args: '{phase}' }
144
- ],
145
- 'impeccable-build': [
146
- { cmd: 'maestro-impeccable', args: '"{phase}" --chain build' },
147
- { cmd: 'maestro-plan', args: '{phase}' },
148
- { cmd: 'maestro-execute', args: '{phase}' }
149
- ],
150
- 'full-lifecycle': [
151
- { cmd: 'maestro-plan', args: '{phase}' },
152
- { cmd: 'maestro-execute', args: '{phase}' },
153
- { cmd: 'quality-review', args: '{phase}' },
154
- { cmd: 'quality-test', args: '{phase}' },
155
- { cmd: 'maestro-milestone-audit' },
156
- { cmd: 'maestro-milestone-complete' }
157
- ],
158
- 'quality-loop': [
159
- { cmd: 'quality-review', args: '{phase}' },
160
- { cmd: 'quality-test', args: '{phase}' },
161
- { cmd: 'quality-debug', args: '--from-uat {phase}' },
162
- { cmd: 'maestro-plan', args: '{phase} --gaps' },
163
- { cmd: 'maestro-execute', args: '{phase}' }
164
- ],
165
- 'milestone-close': [
166
- { cmd: 'maestro-milestone-audit' },
167
- { cmd: 'maestro-milestone-complete' }
168
- ],
169
- 'roadmap-driven': [
170
- { cmd: 'maestro-init' },
171
- { cmd: 'maestro-roadmap', args: '"{description}"' },
172
- { cmd: 'maestro-plan', args: '{phase}' },
173
- { cmd: 'maestro-execute', args: '{phase}' }
174
- ],
175
- 'next-milestone': [
176
- { cmd: 'maestro-roadmap', args: '"{description}"' },
177
- { cmd: 'maestro-plan', args: '{phase}' },
178
- { cmd: 'maestro-execute', args: '{phase}' }
179
- ],
180
- 'analyze-plan-execute': [
181
- { cmd: 'maestro-analyze', args: '"{description}" -q' },
182
- { cmd: 'maestro-plan', args: '--dir {scratch_dir}' },
183
- { cmd: 'maestro-execute', args: '--dir {scratch_dir}' }
184
- ],
185
-
186
- // ── SKILL.md simplified aliases (--chain <name> shortcuts) ───────────────
187
- 'feature': [
188
- { cmd: 'maestro-plan', args: '{phase}' },
189
- { cmd: 'maestro-execute', args: '{phase}' }
190
- ],
191
- 'quality-fix': [
192
- { cmd: 'maestro-analyze', args: '--gaps "{description}"' },
193
- { cmd: 'maestro-plan', args: '--gaps' },
194
- { cmd: 'maestro-execute', args: '' }
195
- ],
196
- 'deploy': [
197
- { cmd: 'maestro-execute', args: '{phase}' },
198
- { cmd: 'maestro-milestone-release' }
199
- ],
200
-
201
- // ── Issue lifecycle chains (with quality gates) ────────────────────────────
202
- 'issue-full': [
203
- { cmd: 'maestro-analyze', args: '--gaps {issue_id}' },
204
- { cmd: 'maestro-plan', args: '--gaps' },
205
- { cmd: 'maestro-execute', args: '' },
206
- { cmd: 'quality-review', args: '{phase}' },
207
- { cmd: 'manage-issue', args: 'close {issue_id} --resolution fixed' }
208
- ],
209
- 'issue-quick': [
210
- { cmd: 'maestro-plan', args: '--gaps' },
211
- { cmd: 'maestro-execute', args: '' },
212
- { cmd: 'manage-issue', args: 'close {issue_id} --resolution fixed' }
213
- ],
214
-
215
- 'review-fix': [
216
- { cmd: 'maestro-plan', args: '{phase} --gaps' },
217
- { cmd: 'maestro-execute', args: '{phase}' },
218
- { cmd: 'quality-review', args: '{phase}' }
219
- ],
220
- 'quality-loop-partial': [
221
- { cmd: 'maestro-plan', args: '{phase} --gaps' },
222
- { cmd: 'maestro-execute', args: '{phase}' }
223
- ],
224
- 'milestone-release': [
225
- { cmd: 'maestro-milestone-audit' },
226
- { cmd: 'maestro-milestone-release' }
227
- ],
228
-
229
- 'learn': [{ cmd: 'maestro-learn', args: '"{description}"' }],
230
- 'harvest': [{ cmd: 'manage-harvest', args: '"{description}"' }],
231
- 'wiki': [{ cmd: 'manage-wiki' }],
232
- 'wiki_connect': [{ cmd: 'wiki-connect' }],
233
- 'wiki_digest': [{ cmd: 'wiki-digest' }],
234
- 'business_test': [{ cmd: 'quality-auto-test', args: '{phase}' }],
235
- 'spec_remove': [{ cmd: 'spec-remove', args: '"{description}"' }],
236
- 'amend': [{ cmd: 'maestro-amend', args: '"{description}"' }],
237
- 'release': [{ cmd: 'maestro-milestone-release' }],
238
- 'compose': [{ cmd: 'maestro-composer', args: '"{description}"' }],
239
- 'play': [{ cmd: 'maestro-player', args: '"{description}"' }],
240
- 'update': [{ cmd: 'maestro-update' }],
241
- 'overlay': [{ cmd: 'maestro-overlay', args: '"{description}"' }],
242
- 'link_coordinate': [{ cmd: 'maestro-link-coordinate', args: '"{description}"' }],
243
- };
244
-
245
- // Aliases: task type → named chain
246
- const taskToChain = {
247
- 'spec_generate': 'spec-driven',
248
- 'brainstorm': 'brainstorm-driven',
249
- 'issue_execute': 'issue-full', // issue execute always gets review gate
250
- };
251
- ```
252
-
253
- **Resolution order:**
254
- 1. `forceChain` → `chainMap[forceChain]` (E002 if not found)
255
- 2. `state_continue` → `detectNextAction(projectState)` → returns `{ chain, argsOverride? }`. Steps from `chainMap[chain]`. If `argsOverride` present, apply before template substitution.
256
- 3. `taskToChain[taskType]` → named chain
257
- 4. `chainMap[taskType]` → direct lookup
258
-
259
- ### 3d: Resolve phase, description, and issue ID
260
-
261
- **Phase**: from structured extraction → fallback regex (`phase N` or bare number) → `projectState.current_phase`.
262
- **Issue ID**: from structured extraction → regex match `ISS-*-NNN`.
263
-
264
- Build context: `{ current_phase, user_intent, issue_id, spec_session_id: null, scratch_dir: null }`.
265
-
266
- ---
267
-
268
- ## Step 4: Confirm
269
-
270
- **If `DRY_RUN`**: Display chain and exit.
271
-
272
- ```
273
- MAESTRO-COORDINATE: {chain_name} (dry run)
274
- 1. ${step.skill} {step.args}
275
- 2. ${step.skill} {step.args}
276
-
277
- ```
278
-
279
- **If not `AUTO_YES`**: Ask user via `functions.request_user_input`:
280
- - Execute all steps
281
- - Execute from step N
282
- - Cancel
283
-
284
- ---
285
-
286
- ## Step 5: Setup Session
287
-
288
- Create session directory `.workflow/.maestro/maestro-{timestamp}/`.
289
-
290
- **Barrier skills** (solo wave, coordinator analyzes artifacts after): `maestro-analyze`, `maestro-plan`, `maestro-brainstorm`, `maestro-roadmap`, `maestro-execute`.
291
-
292
- **Auto-flag injection** (when AUTO_YES): `maestro-analyze/-brainstorm/-roadmap/-ui-design` → `-y`, `maestro-plan` → `--auto`, `quality-test` → `--auto-fix`, `quality-retrospective` → `--auto-yes`.
293
-
294
- Initialize `state.json` with: session_id, intent, chain_name, auto_yes, context (phase, dirs, issue_id, gaps), waves[], and steps[] (each with index, skill, args, status=pending).
295
-
296
- ---
297
-
298
- ## Step 6: Wave Execution Loop
299
-
300
- ### 6a: Helper functions
301
-
302
- **buildSkillCall**: Replace template placeholders (`{phase}`, `{description}`, `{issue_id}`, `{plan_dir}`, `{analysis_dir}`, `{brainstorm_dir}`, `{spec_session_id}`, `{scratch_dir}`) from context. Inject auto-flag if AUTO_YES. Return `$<cmd> <args>`.
303
-
304
- **buildNextWave**: Take first pending step. If barrier → solo wave. Otherwise group consecutive non-barrier steps into one wave.
305
-
306
- ### 6b: Wave instruction template
307
-
308
- Sub-agent instruction: execute `{skill_call}`, complete `{topic}`, do not modify state files, call `report_agent_job_result` with result JSON.
309
-
310
- Result schema: `{ status: "completed"|"failed", skill_call, summary, artifacts, error }` (all required).
311
-
312
- ### 6c: Main loop
313
-
314
- While pending steps remain:
315
- 1. Build next wave via `buildNextWave` (barrier → solo, non-barriers → grouped)
316
- 2. Write wave CSV (`id, skill_call, topic`) to session dir
317
- 3. Execute via `spawn_agents_on_csv` (max_workers = wave size, timeout 1800s)
318
- 4. Read results CSV, update each step's status/findings/artifacts
319
- 5. If barrier wave → run `analyzeBarrierArtifacts` to update context
320
- 6. Record wave in state, persist `state.json`
321
- 7. On any failure → abort (mark remaining steps skipped, break)
322
-
323
- ---
324
-
325
- ## Step 7: Barrier Artifact Analysis
326
-
327
- After a barrier skill completes, the coordinator reads its artifacts and updates `context` for subsequent waves:
328
-
329
- Context updates per barrier skill:
330
-
331
- | Barrier | Extracts |
332
- |---------|----------|
333
- | `maestro-analyze` | `analysis_dir`, gaps (from context.md markers), phase (if detected) |
334
- | `maestro-plan` | `plan_dir`, task/wave count (from plan.json) |
335
- | `maestro-brainstorm` | `brainstorm_dir` |
336
- | `maestro-roadmap` | `spec_session_id` (SPEC-* pattern) |
337
- | `maestro-execute` | `exec_completed`/`exec_failed` counts (from results.csv) |
338
-
339
- **Key principle**: The coordinator owns all context assembly. Sub-agents receive a fully-resolved `skill_call`.
340
-
341
- ---
342
-
343
- ## Step 8: Completion Report
344
-
345
- Finalize `state.json` (status: completed or current, completed_at timestamp).
346
-
347
- Generate `context.md` report: session ID, chain name, waves executed, steps completed/failed, per-wave result table with context updates.
348
-
349
- Display completion banner: session, chain, wave results (per-step status + summary), artifacts path, resume command.
350
-
351
- ---
352
-
353
- ## Core Rules
354
-
355
- 1. **Semantic routing**: LLM-native structured extraction (`action × object`) replaces regex; disambiguates "问题" by context
356
- 2. **Wave-by-wave**: Never start wave N+1 before wave N results are read and barrier artifacts analyzed
357
- 3. **Barrier = solo wave**: A barrier skill always executes alone; coordinator analyzes its artifacts before proceeding
358
- 4. **Non-barriers can parallel**: Consecutive non-barrier skills share a wave with `max_workers = N`
359
- 5. **Coordinator owns context**: Sub-agents receive fully-resolved `skill_call` — no context discovery needed
360
- 6. **Simple instruction**: Sub-agent instruction is minimal — "execute {skill_call}, report result"
361
- 7. **Quality gates**: Issue chains auto-include review; `issue-full` is default for issue execution
362
- 8. **report_agent_job_result**: Every agent MUST call this with the output schema
363
- 9. **State.json tracks waves**: Each wave recorded with step IDs and results; `--continue` resumes from next pending
364
- 10. **Dry-run is read-only**: Display chain with [BARRIER] markers, no execution
365
- 11. **Abort on failure**: Failed step → skip remaining → report