maestro-flow 0.3.9 → 0.3.10

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 (125) hide show
  1. package/.claude/commands/maestro-analyze.md +46 -3
  2. package/.claude/commands/maestro-execute.md +14 -0
  3. package/.claude/commands/maestro-plan.md +16 -0
  4. package/.claude/commands/manage-harvest.md +1 -1
  5. package/.claude/commands/manage-issue-discover.md +2 -2
  6. package/.claude/commands/manage-issue.md +3 -3
  7. package/.codex/skills/maestro/SKILL.md +463 -0
  8. package/.codex/skills/maestro-analyze/SKILL.md +28 -7
  9. package/.codex/skills/maestro-chain/SKILL.md +248 -0
  10. package/.codex/skills/maestro-coordinate/SKILL.md +279 -224
  11. package/.codex/skills/maestro-execute/SKILL.md +8 -0
  12. package/.codex/skills/maestro-plan/SKILL.md +9 -1
  13. package/README.md +7 -7
  14. package/README.zh-CN.md +7 -7
  15. package/chains/issue-lifecycle.json +13 -13
  16. package/chains/singles/issue-analyze.json +3 -3
  17. package/chains/singles/issue-execute.json +3 -3
  18. package/chains/singles/issue-plan.json +3 -3
  19. package/dashboard/dist-server/dashboard/src/server/commander/commander-agent.js +2 -2
  20. package/dashboard/dist-server/dashboard/src/server/commander/commander-agent.js.map +1 -1
  21. package/dashboard/dist-server/dashboard/src/server/coordinator/chain-map.js +3 -3
  22. package/dashboard/dist-server/dashboard/src/server/coordinator/chain-map.js.map +1 -1
  23. package/dashboard/dist-server/dashboard/src/server/routes/issues.js +34 -0
  24. package/dashboard/dist-server/dashboard/src/server/routes/issues.js.map +1 -1
  25. package/dashboard/dist-server/dashboard/src/server/ws/handlers/execution-handler.js +2 -3
  26. package/dashboard/dist-server/dashboard/src/server/ws/handlers/execution-handler.js.map +1 -1
  27. package/dashboard/dist-server/dashboard/src/shared/issue-types.d.ts +5 -0
  28. package/dashboard/dist-server/dashboard/src/shared/issue-types.js.map +1 -1
  29. package/dashboard/dist-server/dashboard/src/shared/normalize-task.d.ts +2 -0
  30. package/dashboard/dist-server/dashboard/src/shared/normalize-task.js +75 -0
  31. package/dashboard/dist-server/dashboard/src/shared/normalize-task.js.map +1 -0
  32. package/dashboard/dist-server/src/hooks/constants.d.ts +90 -12
  33. package/dashboard/dist-server/src/hooks/constants.js +149 -16
  34. package/dashboard/dist-server/src/hooks/constants.js.map +1 -1
  35. package/dashboard/dist-server/src/types/index.d.ts +5 -0
  36. package/dist/src/commands/collab.d.ts +1 -34
  37. package/dist/src/commands/collab.d.ts.map +1 -1
  38. package/dist/src/commands/collab.js +4 -72
  39. package/dist/src/commands/collab.js.map +1 -1
  40. package/dist/src/commands/hooks.d.ts +5 -1
  41. package/dist/src/commands/hooks.d.ts.map +1 -1
  42. package/dist/src/commands/hooks.js +50 -10
  43. package/dist/src/commands/hooks.js.map +1 -1
  44. package/dist/src/commands/install-ui/InstallConfirm.d.ts +3 -1
  45. package/dist/src/commands/install-ui/InstallConfirm.d.ts.map +1 -1
  46. package/dist/src/commands/install-ui/InstallConfirm.js +3 -1
  47. package/dist/src/commands/install-ui/InstallConfirm.js.map +1 -1
  48. package/dist/src/commands/install-ui/InstallExecution.d.ts.map +1 -1
  49. package/dist/src/commands/install-ui/InstallExecution.js +5 -1
  50. package/dist/src/commands/install-ui/InstallExecution.js.map +1 -1
  51. package/dist/src/commands/install-ui/InstallFlow.d.ts.map +1 -1
  52. package/dist/src/commands/install-ui/InstallFlow.js +7 -3
  53. package/dist/src/commands/install-ui/InstallFlow.js.map +1 -1
  54. package/dist/src/commands/install-ui/StatuslineConfig.d.ts +6 -1
  55. package/dist/src/commands/install-ui/StatuslineConfig.d.ts.map +1 -1
  56. package/dist/src/commands/install-ui/StatuslineConfig.js +27 -5
  57. package/dist/src/commands/install-ui/StatuslineConfig.js.map +1 -1
  58. package/dist/src/hooks/__tests__/statusline-visual-test.d.ts +7 -0
  59. package/dist/src/hooks/__tests__/statusline-visual-test.d.ts.map +1 -0
  60. package/dist/src/hooks/__tests__/statusline-visual-test.js +236 -0
  61. package/dist/src/hooks/__tests__/statusline-visual-test.js.map +1 -0
  62. package/dist/src/hooks/constants.d.ts +90 -12
  63. package/dist/src/hooks/constants.d.ts.map +1 -1
  64. package/dist/src/hooks/constants.js +149 -16
  65. package/dist/src/hooks/constants.js.map +1 -1
  66. package/dist/src/hooks/guards/index.d.ts +1 -0
  67. package/dist/src/hooks/guards/index.d.ts.map +1 -1
  68. package/dist/src/hooks/guards/index.js +1 -0
  69. package/dist/src/hooks/guards/index.js.map +1 -1
  70. package/dist/src/hooks/guards/preflight-guard.d.ts +29 -0
  71. package/dist/src/hooks/guards/preflight-guard.d.ts.map +1 -0
  72. package/dist/src/hooks/guards/preflight-guard.js +95 -0
  73. package/dist/src/hooks/guards/preflight-guard.js.map +1 -0
  74. package/dist/src/hooks/index.d.ts +1 -0
  75. package/dist/src/hooks/index.d.ts.map +1 -1
  76. package/dist/src/hooks/index.js +1 -0
  77. package/dist/src/hooks/index.js.map +1 -1
  78. package/dist/src/hooks/preflight-core.d.ts +37 -0
  79. package/dist/src/hooks/preflight-core.d.ts.map +1 -0
  80. package/dist/src/hooks/preflight-core.js +86 -0
  81. package/dist/src/hooks/preflight-core.js.map +1 -0
  82. package/dist/src/hooks/statusline.d.ts +8 -17
  83. package/dist/src/hooks/statusline.d.ts.map +1 -1
  84. package/dist/src/hooks/statusline.js +269 -112
  85. package/dist/src/hooks/statusline.js.map +1 -1
  86. package/dist/src/i18n/locales/en.d.ts.map +1 -1
  87. package/dist/src/i18n/locales/en.js +5 -0
  88. package/dist/src/i18n/locales/en.js.map +1 -1
  89. package/dist/src/i18n/locales/zh.d.ts.map +1 -1
  90. package/dist/src/i18n/locales/zh.js +5 -0
  91. package/dist/src/i18n/locales/zh.js.map +1 -1
  92. package/dist/src/i18n/types.d.ts +5 -0
  93. package/dist/src/i18n/types.d.ts.map +1 -1
  94. package/dist/src/tools/collab-adapter.d.ts +17 -0
  95. package/dist/src/tools/collab-adapter.d.ts.map +1 -1
  96. package/dist/src/tools/collab-adapter.js +138 -0
  97. package/dist/src/tools/collab-adapter.js.map +1 -1
  98. package/dist/src/tools/merge-validator.d.ts +24 -0
  99. package/dist/src/tools/merge-validator.d.ts.map +1 -0
  100. package/dist/src/tools/merge-validator.js +220 -0
  101. package/dist/src/tools/merge-validator.js.map +1 -0
  102. package/dist/src/types/index.d.ts +5 -0
  103. package/dist/src/types/index.d.ts.map +1 -1
  104. package/package.json +1 -1
  105. package/templates/cli/prompts/workflow-skill-conflict-patterns.txt +3 -3
  106. package/templates/cli/prompts/workflow-skill-lessons-learned.txt +3 -3
  107. package/templates/search-tools.md +1 -1
  108. package/workflows/cli-tools-usage.md +44 -27
  109. package/workflows/delegate-usage.md +3 -3
  110. package/workflows/issue-analyze.md +6 -2
  111. package/workflows/issue-discover.md +4 -4
  112. package/workflows/issue-execute.md +6 -3
  113. package/workflows/issue-plan.md +5 -2
  114. package/workflows/maestro-coordinate.codex.md +281 -470
  115. package/workflows/maestro-coordinate.md +14 -14
  116. package/workflows/maestro-link-coordinate.md +2 -2
  117. package/workflows/maestro.codex.md +710 -0
  118. package/workflows/maestro.md +10 -11
  119. package/workflows/retrospective.md +1 -1
  120. package/.claude/commands/manage-issue-analyze.md +0 -62
  121. package/.claude/commands/manage-issue-execute.md +0 -73
  122. package/.claude/commands/manage-issue-plan.md +0 -62
  123. package/.codex/skills/manage-issue-analyze/SKILL.md +0 -207
  124. package/.codex/skills/manage-issue-execute/SKILL.md +0 -200
  125. package/.codex/skills/manage-issue-plan/SKILL.md +0 -186
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: maestro-analyze
3
- description: Multi-dimensional analysis via CSV wave pipeline. Diamond topology — CLI exploration agents (Wave 1), 6-dimension scoring agents (Wave 2), decision synthesis agent (Wave 3). Supports dual depth with -q quick mode. Replaces maestro-analyze command.
4
- argument-hint: "[-y|--yes] [-c|--concurrency N] [--continue] \"<phase|topic> [-q|--quick]\""
3
+ description: Multi-dimensional analysis via CSV wave pipeline. Diamond topology — CLI exploration agents (Wave 1), 6-dimension scoring agents (Wave 2), decision synthesis agent (Wave 3). Supports dual depth with -q quick mode and --gaps issue root cause analysis. Replaces maestro-analyze command.
4
+ argument-hint: "[-y|--yes] [-c|--concurrency N] [--continue] \"<phase|topic> [-q|--quick] [--gaps [ISS-ID]]\""
5
5
  allowed-tools: spawn_agents_on_csv, Read, Write, Edit, Bash, Glob, Grep, AskUserQuestion
6
6
  ---
7
7
 
@@ -25,6 +25,7 @@ $maestro-analyze --continue "analyze-microservices-20260318"
25
25
  - `-c, --concurrency N`: Max concurrent agents within each wave (default: 6)
26
26
  - `--continue`: Resume existing session
27
27
  - `-q, --quick`: Quick mode -- skip exploration + scoring, go straight to decision extraction (Wave 3 only)
28
+ - `--gaps [ISS-ID]`: Issue root cause analysis mode. If ISS-ID provided, analyze single issue. If omitted, analyze all open/registered issues from issues.jsonl. Replaces manage-issue-analyze.
28
29
 
29
30
  **Output Directory**: `.workflow/.csv-wave/{session-id}/`
30
31
  **Core Output**: `tasks.csv` (master state) + `results.csv` (final) + `discoveries.ndjson` (shared exploration) + `context.md` (decision extraction report) + `analysis.md` (6-dimension scoring summary)
@@ -37,7 +38,7 @@ Wave-based multi-dimensional analysis using `spawn_agents_on_csv`. Diamond topol
37
38
 
38
39
  **Core workflow**: Parse Subject -> CLI Exploration -> 6-Dimension Scoring -> Decision Synthesis
39
40
 
40
- **Dual depth**: Full mode (all 3 waves) or Quick mode (`-q`, Wave 3 only -- decision extraction from loaded context).
41
+ **Tri-depth**: Full mode (all 3 waves), Quick mode (`-q`, Wave 3 only), or Gaps mode (`--gaps`, issue root cause analysis pipeline).
41
42
 
42
43
  ```
43
44
  +---------------------------------------------------------------------------+
@@ -170,10 +171,13 @@ const maxConcurrency = concurrencyMatch ? parseInt(concurrencyMatch[1]) : 6
170
171
 
171
172
  // Parse analyze-specific flags
172
173
  const QUICK_MODE = $ARGUMENTS.includes('-q') || $ARGUMENTS.includes('--quick')
174
+ const GAPS_MODE = $ARGUMENTS.includes('--gaps')
175
+ const gapsIssueMatch = $ARGUMENTS.match(/--gaps\s+(ISS-\S+)/)
176
+ const gapsIssueId = gapsIssueMatch ? gapsIssueMatch[1] : null
173
177
 
174
178
  // Clean subject text
175
179
  const subjectArg = $ARGUMENTS
176
- .replace(/--yes|-y|--continue|--concurrency\s+\d+|-c\s+\d+|-q|--quick/g, '')
180
+ .replace(/--yes|-y|--continue|--concurrency\s+\d+|-c\s+\d+|-q|--quick|--gaps\s+ISS-\S+|--gaps/g, '')
177
181
  .trim()
178
182
 
179
183
  // Auto-bootstrap state.json if missing
@@ -186,7 +190,11 @@ if (!fileExists('.workflow/state.json')) {
186
190
  const state = JSON.parse(Read('.workflow/state.json'))
187
191
  let scope, slug, phaseNum = null
188
192
 
189
- if (subjectArg === '') {
193
+ if (GAPS_MODE) {
194
+ // --gaps → issue root cause analysis
195
+ scope = 'gaps'
196
+ slug = gapsIssueId ? gapsIssueId.toLowerCase().replace(/[^a-z0-9]+/g, '-') : 'issue-gaps'
197
+ } else if (subjectArg === '') {
190
198
  // No args → milestone-wide
191
199
  if (state.current_milestone && fileExists('.workflow/roadmap.md')) {
192
200
  scope = 'milestone'
@@ -237,6 +245,16 @@ Bash(`mkdir -p ${scratchDir}`)
237
245
 
238
246
  3. **Quick mode routing**: If QUICK_MODE, generate only wave 3 (synthesis/decide) task in CSV. Skip exploration and scoring.
239
247
 
248
+ 3b. **Gaps mode routing** (if GAPS_MODE):
249
+ - Load issues from `.workflow/issues/issues.jsonl`
250
+ - If `gapsIssueId`: load single issue, validate existence
251
+ - If no ISS-ID: filter `status == "open" || status == "registered"`
252
+ - For each issue, generate an exploration task (wave 1) focused on issue context
253
+ - Generate a synthesis task (wave 2) that writes analysis records back to issues.jsonl
254
+ - Skip standard dimension scoring (wave 2 in normal mode)
255
+ - Pipeline: Load Issues → CLI Exploration per issue → Root Cause Synthesis → Write issue.analysis → Output context.md
256
+ - On completion: append history entry `{ action: "analyzed", at: <ISO>, by: "maestro-analyze --gaps" }` per issue
257
+
240
258
  4. **Dimension and perspective selection** (full mode):
241
259
 
242
260
  | Depth | Exploration Dimensions | Scoring Dimensions |
@@ -540,7 +558,9 @@ echo '{"ts":"<ISO>","worker":"{id}","type":"exploration_finding","data":{"file":
540
558
 
541
559
  | Error | Resolution |
542
560
  |-------|------------|
543
- | Subject argument missing | Abort with error: "Analysis subject required (phase number or topic text)" |
561
+ | Subject argument missing (non-gaps) | Abort with error: "Analysis subject required (phase number or topic text)" |
562
+ | --gaps but no issues found | Abort with error: "No open/registered issues in issues.jsonl" |
563
+ | --gaps ISS-ID not found | Abort with error: "Issue {ISS-ID} not found — run manage-issue list" |
544
564
  | Phase directory not found | List available phases, abort with error |
545
565
  | No prior context for quick mode | Warn: limited context, proceed with available information |
546
566
  | Exploration agent timeout | Mark as failed, continue with remaining exploration agents |
@@ -562,7 +582,8 @@ echo '{"ts":"<ISO>","worker":"{id}","type":"exploration_finding","data":{"file":
562
582
  4. **Context Propagation**: prev_context built from master CSV, not from memory
563
583
  5. **Discovery Board is Append-Only**: Never clear, modify, or recreate discoveries.ndjson
564
584
  6. **Quick Mode Shortcut**: With -q flag, generate only wave 3 task, skip exploration and scoring
585
+ 6b. **Gaps Mode Pipeline**: With --gaps flag, load issues, explore per issue, write analysis records back to issues.jsonl, output context.md for plan --gaps
565
586
  7. **Skip on Failure**: Degrade gracefully -- missing exploration reduces scoring quality, missing scoring reduces synthesis quality
566
587
  8. **Cleanup Temp Files**: Remove wave-{N}.csv after results are merged
567
588
  9. **DO NOT STOP**: Continuous execution until all waves complete
568
- 10. **Dual Output**: context.md is ALWAYS produced (both modes). analysis.md + conclusions.json are full-mode only.
589
+ 10. **Tri-Output**: context.md is ALWAYS produced (all modes). analysis.md + conclusions.json are full-mode only. Gaps mode writes analysis records to issues.jsonl + context.md for plan --gaps.
@@ -0,0 +1,248 @@
1
+ ---
2
+ name: maestro-chain
3
+ description: Flat chain coordinator — resolve intent, build single CSV with all steps, execute via spawn_agents_on_csv (max_workers=1). Sub-agents self-discover context from prior results. No coordinator-side artifact analysis. Simpler than maestro but requires skills to be self-discovering.
4
+ argument-hint: "\"intent text\" [-y] [-c|--continue] [--dry-run] [--chain <name>]"
5
+ allowed-tools: spawn_agents_on_csv, Read, Write, Edit, Bash, Glob, Grep, AskUserQuestion
6
+ ---
7
+
8
+ ## Auto Mode
9
+
10
+ When `-y` or `--yes`: Skip clarification and confirmation prompts. Pass `-y` through to each step's skill invocation.
11
+
12
+ # Maestro Chain (Flat)
13
+
14
+ ## Usage
15
+
16
+ ```bash
17
+ $maestro-chain "implement user authentication with JWT"
18
+ $maestro-chain -y "refactor the payment module"
19
+ $maestro-chain --continue
20
+ $maestro-chain --dry-run "add rate limiting to API endpoints"
21
+ $maestro-chain --chain feature "add dark mode toggle"
22
+ ```
23
+
24
+ **Flags**:
25
+ - `-y, --yes` — Auto mode: skip all prompts; propagate `-y` to each skill
26
+ - `--continue` — Resume latest paused session (re-run from first failed/pending step)
27
+ - `--dry-run` — Display planned chain without executing
28
+ - `--chain <name>` — Force a specific chain (skips intent classification)
29
+
30
+ **Session state**: `.workflow/.maestro-chain/{session-id}/`
31
+ **Core Output**: `tasks.csv` + `results.csv` + `state.json`
32
+
33
+ ---
34
+
35
+ ## Overview
36
+
37
+ Flat sequential chain execution — one CSV, one `spawn_agents_on_csv` call, done. Each skill is self-discovering: it reads `.workflow/state.json`, globs for latest artifacts, and resolves its own inputs. The coordinator only assembles initial args and launches.
38
+
39
+ ```
40
+ Intent → Resolve Chain → Build tasks.csv → spawn_agents_on_csv(max_workers=1) → Read results → Report
41
+ (all steps) step 1 → step 2 → … → step N
42
+ (each skill self-discovers context)
43
+ ```
44
+
45
+ **When to use this vs `$maestro`**:
46
+ - Use `$maestro-chain` when all skills in the chain are self-discovering (read state.json, glob artifacts)
47
+ - Use `$maestro` when you need coordinator-side artifact analysis between steps (dynamic arg resolution)
48
+
49
+ ---
50
+
51
+ ## Chain Map
52
+
53
+ | Intent keywords | Chain | Steps (skills, in order) |
54
+ |----------------|-------|--------------------------|
55
+ | fix, bug, error, broken, crash | `quality-fix` | $maestro-analyze --gaps → $maestro-plan --gaps → $maestro-execute → $maestro-verify |
56
+ | test, spec, coverage | `quality-test` | $quality-test |
57
+ | refactor, cleanup, debt | `quality-refactor` | $quality-refactor |
58
+ | feature, implement, add, build | `feature` | $maestro-plan → $maestro-execute → $maestro-verify |
59
+ | review, check, audit | `quality-review` | $quality-review |
60
+ | deploy, release, ship | `deploy` | $maestro-verify → $maestro-execute |
61
+
62
+ ---
63
+
64
+ ## Implementation
65
+
66
+ > **Full chain map reference**: `~/.maestro/workflows/maestro.codex.md` — read for 35+ intent patterns and 40+ chain definitions.
67
+
68
+ ### Phase 1: Resolve Intent and Chain
69
+
70
+ 1. Parse arguments: extract `AUTO_YES`, `RESUME`, `DRY_RUN`, `forceChain`, `intent`
71
+ 2. Read `.workflow/state.json` for project context
72
+ 3. Classify intent → select chain (same logic as `$maestro`)
73
+ 4. If unclear and not AUTO_YES: ask one clarifying question
74
+ 5. Resolve phase from intent or state
75
+
76
+ **`--continue` mode**: Load latest `state.json` from `.workflow/.maestro-chain/`, rebuild CSV from first pending step.
77
+
78
+ **`--dry-run`**: Display chain and stop.
79
+
80
+ ---
81
+
82
+ ### Phase 2: Build CSV and Execute
83
+
84
+ #### Assemble skill_call
85
+
86
+ ```javascript
87
+ const AUTO_FLAG_MAP = {
88
+ 'maestro-analyze': '-y', 'maestro-brainstorm': '-y',
89
+ 'maestro-ui-design': '-y', 'maestro-plan': '--auto',
90
+ 'maestro-spec-generate': '-y', 'quality-test': '--auto-fix',
91
+ 'quality-retrospective': '--auto-yes',
92
+ };
93
+
94
+ function buildSkillCall(step) {
95
+ let args = (step.args ?? '')
96
+ .replace(/{phase}/g, resolvedPhase ?? '')
97
+ .replace(/{description}/g, intent ?? '')
98
+ .replace(/{issue_id}/g, resolvedIssueId ?? '');
99
+
100
+ if (AUTO_YES) {
101
+ const flag = AUTO_FLAG_MAP[step.cmd];
102
+ if (flag && !args.includes(flag)) args = args ? `${args} ${flag}` : flag;
103
+ }
104
+ return `$${step.cmd} ${args}`.trim();
105
+ }
106
+ ```
107
+
108
+ #### Generate tasks.csv
109
+
110
+ ```csv
111
+ id,skill_call,topic
112
+ "1","$maestro-analyze --gaps \"fix auth\" -y","Chain quality-fix step 1/4"
113
+ "2","$maestro-plan --gaps -y","Chain quality-fix step 2/4"
114
+ "3","$maestro-execute -y","Chain quality-fix step 3/4"
115
+ "4","$maestro-verify -y","Chain quality-fix step 4/4"
116
+ ```
117
+
118
+ #### Write state.json
119
+
120
+ ```javascript
121
+ const sessionId = `MC-${dateStr}-${timeStr}`;
122
+ const sessionDir = `.workflow/.maestro-chain/${sessionId}`;
123
+ Bash(`mkdir -p ${sessionDir}`);
124
+
125
+ Write(`${sessionDir}/state.json`, JSON.stringify({
126
+ id: sessionId,
127
+ intent,
128
+ chain: chainName,
129
+ auto_yes: AUTO_YES,
130
+ status: "running",
131
+ started_at: new Date().toISOString(),
132
+ steps: chain.map((s, i) => ({
133
+ step_n: i + 1,
134
+ cmd: s.cmd,
135
+ skill_call: buildSkillCall(s),
136
+ status: "pending"
137
+ }))
138
+ }, null, 2));
139
+ ```
140
+
141
+ #### Execute
142
+
143
+ ```javascript
144
+ spawn_agents_on_csv({
145
+ csv_path: `${sessionDir}/tasks.csv`,
146
+ id_column: "id",
147
+ instruction: INSTRUCTION,
148
+ max_workers: 1,
149
+ max_runtime_seconds: 1800,
150
+ output_csv_path: `${sessionDir}/results.csv`,
151
+ output_schema: {
152
+ type: "object",
153
+ properties: {
154
+ status: { type: "string", enum: ["completed", "failed"] },
155
+ skill_call: { type: "string" },
156
+ summary: { type: "string" },
157
+ artifacts: { type: "string" },
158
+ error: { type: "string" }
159
+ },
160
+ required: ["status", "skill_call", "summary", "artifacts", "error"]
161
+ }
162
+ })
163
+ ```
164
+
165
+ ---
166
+
167
+ ### Instruction Template
168
+
169
+ ```
170
+ 你是 CSV job 子 agent。
171
+
172
+ 先原样执行这一段技能调用:
173
+ {skill_call}
174
+
175
+ 然后基于结果完成这一行任务说明:
176
+ {topic}
177
+
178
+ 限制:
179
+ - skill 内部自己管理 session 和产物发现
180
+ - 不要修改 .workflow/.maestro-chain/ 下的 state 文件
181
+
182
+ 最后必须调用 `report_agent_job_result`,返回 JSON:
183
+ {"status":"completed|failed","skill_call":"{skill_call}","summary":"一句话结果","artifacts":"产物路径或空字符串","error":"失败原因或空字符串"}
184
+ ```
185
+
186
+ ---
187
+
188
+ ### Phase 3: Report
189
+
190
+ Read `results.csv`, update `state.json`:
191
+
192
+ ```javascript
193
+ const results = parseCSV(Read(`${sessionDir}/results.csv`));
194
+ const done = results.filter(r => r.status === 'completed').length;
195
+ const failed = results.filter(r => r.status === 'failed').length;
196
+
197
+ state.status = failed > 0 ? 'completed_with_errors' : 'completed';
198
+ state.completed_at = new Date().toISOString();
199
+ for (const row of results) {
200
+ const step = state.steps[parseInt(row.id) - 1];
201
+ step.status = row.status;
202
+ step.summary = row.summary;
203
+ step.artifacts = row.artifacts;
204
+ step.error = row.error;
205
+ }
206
+ Write(`${sessionDir}/state.json`, JSON.stringify(state, null, 2));
207
+ ```
208
+
209
+ Display:
210
+
211
+ ```
212
+ === CHAIN COMPLETE ===
213
+ Session: <sessionId>
214
+ Chain: <chain>
215
+ Steps: <done>/<total>
216
+
217
+ RESULTS:
218
+ [1] $maestro-analyze --gaps → ✓ <summary>
219
+ [2] $maestro-plan --gaps → ✓ <summary>
220
+ [3] $maestro-execute → ✓ <summary>
221
+ [4] $maestro-verify → ✓ <summary>
222
+
223
+ State: .workflow/.maestro-chain/<sessionId>/state.json
224
+ Resume: $maestro-chain --continue
225
+ ```
226
+
227
+ ---
228
+
229
+ ## Error Handling
230
+
231
+ | Code | Condition | Recovery |
232
+ |------|-----------|----------|
233
+ | E001 | Intent unclassifiable | Default to `feature` chain |
234
+ | E002 | `--chain` not in map | List valid chains, abort |
235
+ | E003 | Step timeout | Mark `failed` in results (subsequent steps still attempt) |
236
+ | E004 | `--continue`: no session | List sessions, prompt |
237
+
238
+ ---
239
+
240
+ ## Core Rules
241
+
242
+ 1. **One CSV, one call**: Entire chain is a single `spawn_agents_on_csv` invocation
243
+ 2. **max_workers=1**: Strict sequential — step N finishes before step N+1 starts
244
+ 3. **Skills self-discover**: Each skill reads `.workflow/state.json` and globs for latest artifacts — no coordinator-side analysis needed
245
+ 4. **Simple instruction**: Sub-agent just executes `{skill_call}` verbatim and reports
246
+ 5. **Args resolved once**: All `{phase}`, `{description}` resolved at CSV build time — no dynamic updates mid-chain
247
+ 6. **Abort tolerance**: A failed step doesn't auto-skip subsequent steps — each skill decides independently whether to proceed
248
+ 7. **Resume = rebuild CSV**: `--continue` rebuilds CSV from first pending/failed step