maestro-flow 0.3.9 → 0.3.11
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.
- package/.claude/agents/workflow-collab-planner.md +1 -1
- package/.claude/agents/workflow-executor.md +1 -1
- package/.claude/agents/workflow-plan-checker.md +1 -1
- package/.claude/agents/workflow-planner.md +1 -1
- package/.claude/commands/learn-decompose.md +176 -176
- package/.claude/commands/learn-follow.md +167 -167
- package/.claude/commands/learn-retro.md +1 -1
- package/.claude/commands/maestro-analyze.md +46 -3
- package/.claude/commands/maestro-coordinate.md +1 -3
- package/.claude/commands/maestro-execute.md +14 -0
- package/.claude/commands/maestro-plan.md +16 -0
- package/.claude/commands/manage-harvest.md +131 -131
- package/.claude/commands/manage-issue-discover.md +2 -2
- package/.claude/commands/manage-issue.md +5 -5
- package/.claude/commands/spec-add.md +67 -56
- package/.claude/commands/spec-load.md +66 -64
- package/.claude/commands/spec-setup.md +5 -9
- package/.codex/skills/learn-decompose/SKILL.md +119 -0
- package/.codex/skills/learn-follow/SKILL.md +83 -0
- package/.codex/skills/learn-investigate/SKILL.md +83 -0
- package/.codex/skills/learn-retro/SKILL.md +83 -0
- package/.codex/skills/learn-second-opinion/SKILL.md +86 -0
- package/.codex/skills/maestro/SKILL.md +335 -0
- package/.codex/skills/maestro-analyze/SKILL.md +84 -75
- package/.codex/skills/maestro-brainstorm/SKILL.md +452 -463
- package/.codex/skills/maestro-chain/SKILL.md +233 -0
- package/.codex/skills/maestro-coordinate/SKILL.md +167 -278
- package/.codex/skills/maestro-execute/SKILL.md +435 -438
- package/.codex/skills/maestro-fork/SKILL.md +68 -0
- package/.codex/skills/maestro-init/SKILL.md +171 -167
- package/.codex/skills/maestro-learn/SKILL.md +80 -0
- package/.codex/skills/maestro-link-coordinate/SKILL.md +224 -220
- package/.codex/skills/maestro-merge/SKILL.md +62 -0
- package/.codex/skills/maestro-milestone-audit/SKILL.md +108 -103
- package/.codex/skills/maestro-milestone-complete/SKILL.md +155 -149
- package/.codex/skills/maestro-milestone-release/SKILL.md +70 -0
- package/.codex/skills/maestro-overlay/SKILL.md +188 -185
- package/.codex/skills/maestro-plan/SKILL.md +66 -69
- package/.codex/skills/maestro-quick/SKILL.md +26 -23
- package/.codex/skills/maestro-roadmap/SKILL.md +65 -73
- package/.codex/skills/maestro-spec-generate/SKILL.md +66 -74
- package/.codex/skills/maestro-ui-design/SKILL.md +34 -31
- package/.codex/skills/maestro-verify/SKILL.md +556 -566
- package/.codex/skills/manage-codebase-rebuild/SKILL.md +397 -405
- package/.codex/skills/manage-codebase-refresh/SKILL.md +93 -82
- package/.codex/skills/manage-harvest/SKILL.md +82 -0
- package/.codex/skills/manage-issue/SKILL.md +80 -65
- package/.codex/skills/manage-issue-discover/SKILL.md +491 -503
- package/.codex/skills/manage-learn/SKILL.md +190 -186
- package/.codex/skills/manage-memory/SKILL.md +95 -72
- package/.codex/skills/manage-memory-capture/SKILL.md +99 -86
- package/.codex/skills/manage-status/SKILL.md +102 -89
- package/.codex/skills/quality-business-test/SKILL.md +228 -223
- package/.codex/skills/quality-debug/SKILL.md +54 -66
- package/.codex/skills/quality-integration-test/SKILL.md +532 -544
- package/.codex/skills/quality-refactor/SKILL.md +197 -191
- package/.codex/skills/quality-retrospective/SKILL.md +512 -505
- package/.codex/skills/quality-review/SKILL.md +93 -105
- package/.codex/skills/quality-sync/SKILL.md +101 -89
- package/.codex/skills/quality-test/SKILL.md +202 -198
- package/.codex/skills/quality-test-gen/SKILL.md +93 -104
- package/.codex/skills/spec-add/SKILL.md +58 -39
- package/.codex/skills/spec-load/SKILL.md +45 -40
- package/.codex/skills/spec-map/SKILL.md +180 -182
- package/.codex/skills/spec-setup/SKILL.md +94 -76
- package/.codex/skills/team-coordinate/SKILL.md +346 -357
- package/.codex/skills/team-executor/SKILL.md +70 -112
- package/.codex/skills/team-lifecycle-v4/SKILL.md +311 -299
- package/.codex/skills/team-quality-assurance/SKILL.md +234 -227
- package/.codex/skills/team-review/SKILL.md +232 -225
- package/.codex/skills/team-tech-debt/SKILL.md +78 -100
- package/.codex/skills/team-testing/SKILL.md +242 -235
- package/.codex/skills/wiki-connect/SKILL.md +75 -0
- package/.codex/skills/wiki-digest/SKILL.md +87 -0
- package/README.md +14 -11
- package/README.zh-CN.md +14 -11
- package/chains/issue-lifecycle.json +13 -13
- package/chains/singles/issue-analyze.json +3 -3
- package/chains/singles/issue-execute.json +3 -3
- package/chains/singles/issue-plan.json +3 -3
- package/dashboard/dist-server/dashboard/src/server/commander/commander-agent.js +2 -2
- package/dashboard/dist-server/dashboard/src/server/commander/commander-agent.js.map +1 -1
- package/dashboard/dist-server/dashboard/src/server/coordinator/chain-map.js +3 -3
- package/dashboard/dist-server/dashboard/src/server/coordinator/chain-map.js.map +1 -1
- package/dashboard/dist-server/dashboard/src/server/routes/issues.js +34 -0
- package/dashboard/dist-server/dashboard/src/server/routes/issues.js.map +1 -1
- package/dashboard/dist-server/dashboard/src/server/routes/specs.d.ts +1 -1
- package/dashboard/dist-server/dashboard/src/server/routes/specs.js +75 -30
- package/dashboard/dist-server/dashboard/src/server/routes/specs.js.map +1 -1
- package/dashboard/dist-server/dashboard/src/server/state/event-bus.d.ts +5 -0
- package/dashboard/dist-server/dashboard/src/server/state/event-bus.js +5 -0
- package/dashboard/dist-server/dashboard/src/server/state/event-bus.js.map +1 -1
- package/dashboard/dist-server/dashboard/src/server/ws/handlers/execution-handler.js +2 -3
- package/dashboard/dist-server/dashboard/src/server/ws/handlers/execution-handler.js.map +1 -1
- package/dashboard/dist-server/dashboard/src/shared/constants.js +5 -0
- package/dashboard/dist-server/dashboard/src/shared/constants.js.map +1 -1
- package/dashboard/dist-server/dashboard/src/shared/issue-types.d.ts +5 -0
- package/dashboard/dist-server/dashboard/src/shared/issue-types.js.map +1 -1
- package/dashboard/dist-server/dashboard/src/shared/normalize-task.d.ts +2 -0
- package/dashboard/dist-server/dashboard/src/shared/normalize-task.js +75 -0
- package/dashboard/dist-server/dashboard/src/shared/normalize-task.js.map +1 -0
- package/dashboard/dist-server/dashboard/src/shared/team-types.d.ts +21 -0
- package/dashboard/dist-server/dashboard/src/shared/team-types.js.map +1 -1
- package/dashboard/dist-server/dashboard/src/shared/types.d.ts +3 -2
- package/dashboard/dist-server/dashboard/src/shared/ws-protocol.d.ts +1 -1
- package/dashboard/dist-server/dashboard/src/shared/ws-protocol.js.map +1 -1
- package/dashboard/dist-server/src/hooks/constants.d.ts +92 -12
- package/dashboard/dist-server/src/hooks/constants.js +151 -16
- package/dashboard/dist-server/src/hooks/constants.js.map +1 -1
- package/dashboard/dist-server/src/types/index.d.ts +5 -0
- package/dist/src/commands/collab.d.ts +1 -34
- package/dist/src/commands/collab.d.ts.map +1 -1
- package/dist/src/commands/collab.js +8 -76
- package/dist/src/commands/collab.js.map +1 -1
- package/dist/src/commands/hooks.d.ts +5 -1
- package/dist/src/commands/hooks.d.ts.map +1 -1
- package/dist/src/commands/hooks.js +115 -10
- package/dist/src/commands/hooks.js.map +1 -1
- package/dist/src/commands/install-ui/InstallConfirm.d.ts +3 -1
- package/dist/src/commands/install-ui/InstallConfirm.d.ts.map +1 -1
- package/dist/src/commands/install-ui/InstallConfirm.js +3 -1
- package/dist/src/commands/install-ui/InstallConfirm.js.map +1 -1
- package/dist/src/commands/install-ui/InstallExecution.d.ts.map +1 -1
- package/dist/src/commands/install-ui/InstallExecution.js +5 -1
- package/dist/src/commands/install-ui/InstallExecution.js.map +1 -1
- package/dist/src/commands/install-ui/InstallFlow.d.ts.map +1 -1
- package/dist/src/commands/install-ui/InstallFlow.js +7 -3
- package/dist/src/commands/install-ui/InstallFlow.js.map +1 -1
- package/dist/src/commands/install-ui/StatuslineConfig.d.ts +6 -1
- package/dist/src/commands/install-ui/StatuslineConfig.d.ts.map +1 -1
- package/dist/src/commands/install-ui/StatuslineConfig.js +27 -5
- package/dist/src/commands/install-ui/StatuslineConfig.js.map +1 -1
- package/dist/src/commands/spec.d.ts.map +1 -1
- package/dist/src/commands/spec.js +7 -2
- package/dist/src/commands/spec.js.map +1 -1
- package/dist/src/hooks/__tests__/statusline-visual-test.d.ts +7 -0
- package/dist/src/hooks/__tests__/statusline-visual-test.d.ts.map +1 -0
- package/dist/src/hooks/__tests__/statusline-visual-test.js +236 -0
- package/dist/src/hooks/__tests__/statusline-visual-test.js.map +1 -0
- package/dist/src/hooks/constants.d.ts +92 -12
- package/dist/src/hooks/constants.d.ts.map +1 -1
- package/dist/src/hooks/constants.js +151 -16
- package/dist/src/hooks/constants.js.map +1 -1
- package/dist/src/hooks/guards/index.d.ts +2 -0
- package/dist/src/hooks/guards/index.d.ts.map +1 -1
- package/dist/src/hooks/guards/index.js +2 -0
- package/dist/src/hooks/guards/index.js.map +1 -1
- package/dist/src/hooks/guards/preflight-guard.d.ts +29 -0
- package/dist/src/hooks/guards/preflight-guard.d.ts.map +1 -0
- package/dist/src/hooks/guards/preflight-guard.js +95 -0
- package/dist/src/hooks/guards/preflight-guard.js.map +1 -0
- package/dist/src/hooks/guards/spec-validator.d.ts +25 -0
- package/dist/src/hooks/guards/spec-validator.d.ts.map +1 -0
- package/dist/src/hooks/guards/spec-validator.js +66 -0
- package/dist/src/hooks/guards/spec-validator.js.map +1 -0
- package/dist/src/hooks/index.d.ts +1 -0
- package/dist/src/hooks/index.d.ts.map +1 -1
- package/dist/src/hooks/index.js +1 -0
- package/dist/src/hooks/index.js.map +1 -1
- package/dist/src/hooks/keyword-spec-injector.d.ts +21 -0
- package/dist/src/hooks/keyword-spec-injector.d.ts.map +1 -0
- package/dist/src/hooks/keyword-spec-injector.js +96 -0
- package/dist/src/hooks/keyword-spec-injector.js.map +1 -0
- package/dist/src/hooks/plugins/spec-injection-plugin.d.ts +2 -1
- package/dist/src/hooks/plugins/spec-injection-plugin.d.ts.map +1 -1
- package/dist/src/hooks/plugins/spec-injection-plugin.js +21 -12
- package/dist/src/hooks/plugins/spec-injection-plugin.js.map +1 -1
- package/dist/src/hooks/preflight-core.d.ts +37 -0
- package/dist/src/hooks/preflight-core.d.ts.map +1 -0
- package/dist/src/hooks/preflight-core.js +86 -0
- package/dist/src/hooks/preflight-core.js.map +1 -0
- package/dist/src/hooks/spec-bridge.d.ts +40 -0
- package/dist/src/hooks/spec-bridge.d.ts.map +1 -0
- package/dist/src/hooks/spec-bridge.js +97 -0
- package/dist/src/hooks/spec-bridge.js.map +1 -0
- package/dist/src/hooks/spec-injector.d.ts.map +1 -1
- package/dist/src/hooks/spec-injector.js +18 -12
- package/dist/src/hooks/spec-injector.js.map +1 -1
- package/dist/src/hooks/statusline.d.ts +8 -17
- package/dist/src/hooks/statusline.d.ts.map +1 -1
- package/dist/src/hooks/statusline.js +269 -112
- package/dist/src/hooks/statusline.js.map +1 -1
- package/dist/src/i18n/locales/en.d.ts.map +1 -1
- package/dist/src/i18n/locales/en.js +5 -0
- package/dist/src/i18n/locales/en.js.map +1 -1
- package/dist/src/i18n/locales/zh.d.ts.map +1 -1
- package/dist/src/i18n/locales/zh.js +5 -0
- package/dist/src/i18n/locales/zh.js.map +1 -1
- package/dist/src/i18n/types.d.ts +5 -0
- package/dist/src/i18n/types.d.ts.map +1 -1
- package/dist/src/team/phase-orchestrator.d.ts +52 -0
- package/dist/src/team/phase-orchestrator.d.ts.map +1 -0
- package/dist/src/team/phase-orchestrator.js +165 -0
- package/dist/src/team/phase-orchestrator.js.map +1 -0
- package/dist/src/team/phase-types.d.ts +51 -0
- package/dist/src/team/phase-types.d.ts.map +1 -0
- package/dist/src/team/phase-types.js +41 -0
- package/dist/src/team/phase-types.js.map +1 -0
- package/dist/src/tools/collab-adapter.d.ts +17 -0
- package/dist/src/tools/collab-adapter.d.ts.map +1 -1
- package/dist/src/tools/collab-adapter.js +138 -0
- package/dist/src/tools/collab-adapter.js.map +1 -1
- package/dist/src/tools/index.d.ts.map +1 -1
- package/dist/src/tools/index.js +6 -0
- package/dist/src/tools/index.js.map +1 -1
- package/dist/src/tools/merge-validator.d.ts +24 -0
- package/dist/src/tools/merge-validator.d.ts.map +1 -0
- package/dist/src/tools/merge-validator.js +220 -0
- package/dist/src/tools/merge-validator.js.map +1 -0
- package/dist/src/tools/spec-entry-parser.d.ts +56 -0
- package/dist/src/tools/spec-entry-parser.d.ts.map +1 -0
- package/dist/src/tools/spec-entry-parser.js +196 -0
- package/dist/src/tools/spec-entry-parser.js.map +1 -0
- package/dist/src/tools/spec-init.d.ts.map +1 -1
- package/dist/src/tools/spec-init.js +66 -92
- package/dist/src/tools/spec-init.js.map +1 -1
- package/dist/src/tools/spec-keyword-index.d.ts +30 -0
- package/dist/src/tools/spec-keyword-index.d.ts.map +1 -0
- package/dist/src/tools/spec-keyword-index.js +101 -0
- package/dist/src/tools/spec-keyword-index.js.map +1 -0
- package/dist/src/tools/spec-loader.d.ts +3 -3
- package/dist/src/tools/spec-loader.d.ts.map +1 -1
- package/dist/src/tools/spec-loader.js +49 -23
- package/dist/src/tools/spec-loader.js.map +1 -1
- package/dist/src/tools/team-agents.d.ts +27 -0
- package/dist/src/tools/team-agents.d.ts.map +1 -0
- package/dist/src/tools/team-agents.js +362 -0
- package/dist/src/tools/team-agents.js.map +1 -0
- package/dist/src/tools/team-mailbox.d.ts +40 -0
- package/dist/src/tools/team-mailbox.d.ts.map +1 -0
- package/dist/src/tools/team-mailbox.js +384 -0
- package/dist/src/tools/team-mailbox.js.map +1 -0
- package/dist/src/tools/team-msg.d.ts +17 -8
- package/dist/src/tools/team-msg.d.ts.map +1 -1
- package/dist/src/tools/team-msg.js +110 -13
- package/dist/src/tools/team-msg.js.map +1 -1
- package/dist/src/tools/team-tasks-mcp.d.ts +27 -0
- package/dist/src/tools/team-tasks-mcp.d.ts.map +1 -0
- package/dist/src/tools/team-tasks-mcp.js +408 -0
- package/dist/src/tools/team-tasks-mcp.js.map +1 -0
- package/dist/src/types/index.d.ts +5 -0
- package/dist/src/types/index.d.ts.map +1 -1
- package/package.json +2 -1
- package/templates/cli/prompts/workflow-skill-conflict-patterns.txt +3 -3
- package/templates/cli/prompts/workflow-skill-lessons-learned.txt +3 -3
- package/templates/search-tools.md +1 -1
- package/workflows/analyze.md +816 -816
- package/workflows/brainstorm.md +471 -471
- package/workflows/cli-tools-usage.md +44 -27
- package/workflows/codebase-rebuild.md +332 -332
- package/workflows/codebase-refresh.md +240 -240
- package/workflows/delegate-usage.md +3 -3
- package/workflows/execute.md +1 -1
- package/workflows/harvest.md +420 -420
- package/workflows/integration-test.md +343 -343
- package/workflows/issue-analyze.md +6 -2
- package/workflows/issue-discover.md +414 -414
- package/workflows/issue-execute.md +6 -3
- package/workflows/issue-plan.md +5 -2
- package/workflows/maestro-coordinate.codex.md +281 -470
- package/workflows/maestro-coordinate.md +14 -14
- package/workflows/maestro-link-coordinate.md +2 -2
- package/workflows/maestro.codex.md +710 -0
- package/workflows/maestro.md +10 -11
- package/workflows/map.md +111 -111
- package/workflows/milestone-complete.md +176 -176
- package/workflows/plan.md +1 -1
- package/workflows/quick.md +497 -497
- package/workflows/refactor.md +300 -300
- package/workflows/retrospective.md +1 -1
- package/workflows/roadmap.md +335 -335
- package/workflows/spec-generate.md +640 -640
- package/workflows/specs-add.md +46 -81
- package/workflows/specs-load.md +15 -17
- package/workflows/specs-setup.md +40 -161
- package/.claude/commands/manage-issue-analyze.md +0 -62
- package/.claude/commands/manage-issue-execute.md +0 -73
- package/.claude/commands/manage-issue-plan.md +0 -62
- package/.codex/skills/manage-issue-analyze/SKILL.md +0 -207
- package/.codex/skills/manage-issue-execute/SKILL.md +0 -200
- package/.codex/skills/manage-issue-plan/SKILL.md +0 -186
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
# Workflow:
|
|
1
|
+
# Workflow: Maestro-coordinate (Codex CLI-Delegate Edition)
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Autonomous CLI coordinator for Codex. Classifies intent, selects command chain, executes each step via `codex delegate` with template-driven prompts and async state machine. After each step, gemini evaluates output quality and generates optimization hints for subsequent steps.
|
|
4
4
|
|
|
5
5
|
> Referenced by: `~/.codex/skills/maestro-coordinate/SKILL.md`
|
|
6
6
|
|
|
@@ -10,58 +10,57 @@ Codex team-agent version of `maestro-coordinate`. Replaces `maestro cli` backgro
|
|
|
10
10
|
|
|
11
11
|
```javascript
|
|
12
12
|
const args = $ARGUMENTS.trim();
|
|
13
|
-
const
|
|
14
|
-
const
|
|
15
|
-
const
|
|
16
|
-
const
|
|
13
|
+
const autoYes = /\b(-y|--yes)\b/.test(args);
|
|
14
|
+
const resumeMode = /\b(-c|--continue)\b/.test(args);
|
|
15
|
+
const dryRun = /\b--dry-run\b/.test(args);
|
|
16
|
+
const forcedChain = args.match(/--chain\s+(\S+)/)?.[1] || null;
|
|
17
|
+
const cliTool = args.match(/--tool\s+(\S+)/)?.[1] || 'codex';
|
|
17
18
|
const intent = args
|
|
18
|
-
.replace(
|
|
19
|
-
.replace(
|
|
19
|
+
.replace(/\b(-y|--yes|-c|--continue|--dry-run)\b/g, '')
|
|
20
|
+
.replace(/--(chain|tool)\s+\S+/g, '')
|
|
20
21
|
.trim();
|
|
21
22
|
```
|
|
22
23
|
|
|
23
|
-
**
|
|
24
|
-
1.
|
|
25
|
-
2.
|
|
24
|
+
**If resumeMode:**
|
|
25
|
+
1. Find latest `state.json` in `.workflow/.maestro-coordinate/`
|
|
26
|
+
2. Load state → set `current_step` to first non-completed step
|
|
26
27
|
3. Jump to **Step 6**
|
|
27
28
|
|
|
28
29
|
---
|
|
29
30
|
|
|
30
31
|
## Step 2: Read Project State
|
|
31
32
|
|
|
32
|
-
```
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
const raw = JSON.parse(Read(stateFile));
|
|
38
|
-
projectState = {
|
|
39
|
-
initialized: true,
|
|
40
|
-
current_phase: raw.current_phase,
|
|
41
|
-
phase_slug: raw.phase_slug,
|
|
42
|
-
phase_status: raw.phase_status, // pending|exploring|planning|executing|verifying|testing|completed|blocked
|
|
43
|
-
phase_artifacts: raw.phase_artifacts ?? {},
|
|
44
|
-
execution: raw.execution ?? { tasks_completed: 0, tasks_total: 0 },
|
|
45
|
-
verification_status: raw.verification_status ?? 'pending',
|
|
46
|
-
review_verdict: raw.review_verdict ?? null,
|
|
47
|
-
uat_status: raw.uat_status ?? 'pending',
|
|
48
|
-
phases_total: raw.phases_total ?? 0,
|
|
49
|
-
phases_completed: raw.phases_completed ?? 0,
|
|
50
|
-
has_blockers: raw.has_blockers ?? false,
|
|
51
|
-
accumulated_context: raw.accumulated_context ?? null
|
|
52
|
-
};
|
|
53
|
-
}
|
|
33
|
+
```bash
|
|
34
|
+
test -f .workflow/state.json && echo "exists" || echo "missing"
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
**If exists:** Read `.workflow/state.json` + `.workflow/roadmap.md` + current phase `index.json`:
|
|
54
38
|
|
|
55
|
-
|
|
39
|
+
```javascript
|
|
40
|
+
const projectState = {
|
|
41
|
+
initialized: true,
|
|
42
|
+
current_milestone: /* from state.json */,
|
|
43
|
+
latest_artifact: /* last artifact in artifacts[] */,
|
|
44
|
+
milestone_progress: '...', // derived from artifact registry
|
|
45
|
+
phase_artifacts: { brainstorm: false, analysis: false, context: false, plan: false, verification: false, uat: false },
|
|
46
|
+
execution: { tasks_completed: 0, tasks_total: 0 },
|
|
47
|
+
verification_status: 'pending',
|
|
48
|
+
review_verdict: null, // PASS|WARN|BLOCK|null
|
|
49
|
+
uat_status: 'pending',
|
|
50
|
+
phases_total: 0, phases_completed: 0,
|
|
51
|
+
has_blockers: false, accumulated_context: null
|
|
52
|
+
};
|
|
56
53
|
```
|
|
57
54
|
|
|
55
|
+
**If missing:** `projectState = { initialized: false }`. If intent also empty → **Error E001**.
|
|
56
|
+
|
|
58
57
|
---
|
|
59
58
|
|
|
60
59
|
## Step 3: Classify Intent & Select Chain
|
|
61
60
|
|
|
62
61
|
### 3a: Exact-match keywords (fast path)
|
|
63
62
|
|
|
64
|
-
If `
|
|
63
|
+
If `forcedChain` is set, validate and jump to **3c**.
|
|
65
64
|
|
|
66
65
|
```javascript
|
|
67
66
|
const exactMatch = {
|
|
@@ -83,7 +82,7 @@ Instead of regex, extract a structured intent tuple using LLM semantic understan
|
|
|
83
82
|
```json
|
|
84
83
|
{
|
|
85
84
|
"action": "<create|fix|analyze|plan|execute|verify|review|test|debug|refactor|explore|manage|transition|continue|sync|learn|retrospect>",
|
|
86
|
-
"object": "<feature|bug|issue|code|test|spec|phase|milestone|doc|performance|security|ui|memory|codebase|
|
|
85
|
+
"object": "<feature|bug|issue|code|test|spec|phase|milestone|doc|performance|security|ui|memory|codebase|config>",
|
|
87
86
|
"scope": "<module/file/area or null>",
|
|
88
87
|
"issue_id": "<ISS-XXXXXXXX-NNN if mentioned, else null>",
|
|
89
88
|
"phase_ref": "<integer if mentioned, else null>",
|
|
@@ -108,7 +107,7 @@ function routeIntent(intent, projectState) {
|
|
|
108
107
|
// Action × Object matrix
|
|
109
108
|
const matrix = {
|
|
110
109
|
'fix': { 'bug': 'debug', 'issue': 'issue', 'code': 'debug', 'performance': 'debug', 'security': 'debug', '_default': 'debug' },
|
|
111
|
-
'create': { 'feature': 'quick', 'issue': 'issue', 'test': 'test_gen', 'spec': 'spec_generate', 'ui': 'ui_design', 'config': 'init', 'phase': '
|
|
110
|
+
'create': { 'feature': 'quick', 'issue': 'issue', 'test': 'test_gen', 'spec': 'spec_generate', 'ui': 'ui_design', 'config': 'init', 'phase': 'roadmap', '_default': 'quick' },
|
|
112
111
|
'analyze': { 'bug': 'analyze', 'issue': 'issue_analyze', 'code': 'analyze', 'codebase': 'spec_map', '_default': 'analyze' },
|
|
113
112
|
'explore': { 'issue': 'issue_discover', 'feature': 'brainstorm', 'ui': 'ui_design', '_default': 'brainstorm' },
|
|
114
113
|
'plan': { 'issue': 'issue_plan', 'spec': 'spec_generate', '_default': 'plan' },
|
|
@@ -118,82 +117,63 @@ function routeIntent(intent, projectState) {
|
|
|
118
117
|
'test': { '_default': 'test' },
|
|
119
118
|
'debug': { '_default': 'debug' },
|
|
120
119
|
'refactor': { '_default': 'refactor' },
|
|
121
|
-
'manage': { 'issue': 'issue', 'milestone': 'milestone_audit', 'phase': '
|
|
122
|
-
'transition':{ 'phase': '
|
|
120
|
+
'manage': { 'issue': 'issue', 'milestone': 'milestone_audit', 'phase': 'milestone_close', 'memory': 'memory', 'doc': 'sync', 'codebase': 'codebase_refresh', '_default': 'status' },
|
|
121
|
+
'transition':{ 'phase': 'milestone_close', 'milestone': 'milestone_complete', '_default': 'milestone_close' },
|
|
123
122
|
'continue': { '_default': 'state_continue' },
|
|
124
123
|
'sync': { '_default': 'sync' },
|
|
125
124
|
'learn': { '_default': 'learn' },
|
|
126
125
|
'retrospect':{ '_default': 'retrospective' },
|
|
127
126
|
};
|
|
128
127
|
|
|
129
|
-
// Team skill detection
|
|
130
|
-
if (object === 'team') {
|
|
131
|
-
const teamRoutes = { 'review': 'team_review', 'test': 'team_test', 'debug': 'team_qa', 'refactor': 'team_tech_debt', 'execute': 'team_lifecycle', '_default': 'team_coordinate' };
|
|
132
|
-
return teamRoutes[action] || 'team_coordinate';
|
|
133
|
-
}
|
|
134
|
-
|
|
135
128
|
const actionMap = matrix[action] || matrix['fix'];
|
|
136
129
|
return actionMap[object] || actionMap['_default'] || 'quick';
|
|
137
130
|
}
|
|
138
131
|
```
|
|
139
132
|
|
|
140
|
-
|
|
141
|
-
If
|
|
133
|
+
Compute clarity (3=action+object+scope, 2=action+object, 1=action only, 0=empty).
|
|
134
|
+
If clarity < 2 and not autoYes: clarify via AskUserQuestion (max 2 rounds).
|
|
142
135
|
|
|
143
|
-
### 3b: State-based routing (
|
|
136
|
+
### 3b: State-based routing (task_type == `state_continue`)
|
|
144
137
|
|
|
145
138
|
```javascript
|
|
146
139
|
function detectNextAction(s) {
|
|
147
140
|
if (!s.initialized) return { chain: 'init', steps: [{ cmd: 'maestro-init' }] };
|
|
148
141
|
const ps = s.phase_status, art = s.phase_artifacts, exec = s.execution;
|
|
149
142
|
|
|
143
|
+
// Post-milestone: no roadmap, has accumulated context
|
|
150
144
|
if (s.phases_total === 0 && !fileExists('.workflow/roadmap.md') && s.accumulated_context)
|
|
151
145
|
return { chain: 'next-milestone', steps: [{ cmd: 'maestro-roadmap', args: '"{description}"' }] };
|
|
152
146
|
if (s.phases_total === 0)
|
|
153
|
-
return { chain: 'brainstorm-driven', steps: [
|
|
154
|
-
{ cmd: 'maestro-brainstorm', args: '"{description}"' },
|
|
155
|
-
{ cmd: 'maestro-plan', args: '{phase}' },
|
|
156
|
-
{ cmd: 'maestro-execute', args: '{phase}' },
|
|
157
|
-
{ cmd: 'maestro-verify', args: '{phase}' }
|
|
158
|
-
]};
|
|
147
|
+
return { chain: 'brainstorm-driven', steps: [{ cmd: 'maestro-brainstorm', args: '"{description}"' }, { cmd: 'maestro-plan', args: '{phase}' }, { cmd: 'maestro-execute', args: '{phase}' }, { cmd: 'maestro-verify', args: '{phase}' }] };
|
|
159
148
|
|
|
160
149
|
if (ps === 'pending') {
|
|
161
|
-
if (art.context) return { chain: 'plan',
|
|
162
|
-
return
|
|
150
|
+
if (art.context) return { chain: 'plan', steps: [{ cmd: 'maestro-plan', args: '{phase}' }] };
|
|
151
|
+
return { chain: 'analyze', steps: [{ cmd: 'maestro-analyze', args: '{phase}' }] };
|
|
163
152
|
}
|
|
164
153
|
if (ps === 'exploring' || ps === 'planning') {
|
|
165
|
-
if (art.plan) return { chain: 'execute-verify', steps: [
|
|
166
|
-
{ cmd: 'maestro-execute', args: '{phase}' },
|
|
167
|
-
{ cmd: 'maestro-verify', args: '{phase}' }
|
|
168
|
-
]};
|
|
154
|
+
if (art.plan) return { chain: 'execute-verify', steps: [{ cmd: 'maestro-execute', args: '{phase}' }, { cmd: 'maestro-verify', args: '{phase}' }] };
|
|
169
155
|
return { chain: 'plan', steps: [{ cmd: 'maestro-plan', args: '{phase}' }] };
|
|
170
156
|
}
|
|
171
157
|
if (ps === 'executing') {
|
|
172
|
-
if (exec.tasks_completed >= exec.tasks_total && exec.tasks_total > 0)
|
|
173
|
-
return { chain: 'verify', steps: [{ cmd: 'maestro-verify', args: '{phase}' }] };
|
|
158
|
+
if (exec.tasks_completed >= exec.tasks_total && exec.tasks_total > 0) return { chain: 'verify', steps: [{ cmd: 'maestro-verify', args: '{phase}' }] };
|
|
174
159
|
return { chain: 'execute', steps: [{ cmd: 'maestro-execute', args: '{phase}' }] };
|
|
175
160
|
}
|
|
176
161
|
if (ps === 'verifying') {
|
|
177
162
|
if (s.verification_status === 'passed') {
|
|
178
|
-
if (!s.review_verdict)
|
|
179
|
-
if (s.uat_status === 'pending') return { chain: 'test',
|
|
180
|
-
if (s.uat_status === 'passed')
|
|
163
|
+
if (!s.review_verdict) return { chain: 'review', steps: [{ cmd: 'quality-review', args: '{phase}' }] };
|
|
164
|
+
if (s.uat_status === 'pending') return { chain: 'test', steps: [{ cmd: 'quality-test', args: '{phase}' }] };
|
|
165
|
+
if (s.uat_status === 'passed') return { chain: 'milestone-close', steps: [{ cmd: 'maestro-milestone-audit' }, { cmd: 'maestro-milestone-complete' }] };
|
|
181
166
|
return { chain: 'debug', steps: [{ cmd: 'quality-debug', args: '--from-uat {phase}' }] };
|
|
182
167
|
}
|
|
183
|
-
return { chain: 'quality-loop-partial', steps: [
|
|
184
|
-
{ cmd: 'maestro-plan', args: '{phase} --gaps' },
|
|
185
|
-
{ cmd: 'maestro-execute', args: '{phase}' },
|
|
186
|
-
{ cmd: 'maestro-verify', args: '{phase}' }
|
|
187
|
-
]};
|
|
168
|
+
return { chain: 'quality-loop-partial', steps: [{ cmd: 'maestro-plan', args: '{phase} --gaps' }, { cmd: 'maestro-execute', args: '{phase}' }, { cmd: 'maestro-verify', args: '{phase}' }] };
|
|
188
169
|
}
|
|
189
170
|
if (ps === 'testing') {
|
|
190
|
-
if (s.uat_status === 'passed') return { chain: '
|
|
171
|
+
if (s.uat_status === 'passed') return { chain: 'milestone-close', steps: [{ cmd: 'maestro-milestone-audit' }, { cmd: 'maestro-milestone-complete' }] };
|
|
191
172
|
return { chain: 'debug', steps: [{ cmd: 'quality-debug', args: '--from-uat {phase}' }] };
|
|
192
173
|
}
|
|
193
174
|
if (ps === 'completed') {
|
|
194
|
-
if (s.phases_completed >= s.phases_total)
|
|
195
|
-
|
|
196
|
-
return { chain: 'phase-transition', steps: [{ cmd: 'maestro-phase-transition' }] };
|
|
175
|
+
if (s.phases_completed >= s.phases_total) return { chain: 'milestone-close', steps: [{ cmd: 'maestro-milestone-audit' }, { cmd: 'maestro-milestone-complete' }] };
|
|
176
|
+
return { chain: 'milestone-close', steps: [{ cmd: 'maestro-milestone-audit' }, { cmd: 'maestro-milestone-complete' }] };
|
|
197
177
|
}
|
|
198
178
|
if (ps === 'blocked') return { chain: 'debug', steps: [{ cmd: 'quality-debug' }] };
|
|
199
179
|
return { chain: 'status', steps: [{ cmd: 'manage-status' }] };
|
|
@@ -204,264 +184,157 @@ function detectNextAction(s) {
|
|
|
204
184
|
|
|
205
185
|
```javascript
|
|
206
186
|
const chainMap = {
|
|
207
|
-
//
|
|
187
|
+
// Single-step
|
|
208
188
|
'status': [{ cmd: 'manage-status' }],
|
|
209
189
|
'init': [{ cmd: 'maestro-init' }],
|
|
210
|
-
'analyze': [{ cmd: 'maestro-analyze',
|
|
211
|
-
'ui_design': [{ cmd: 'maestro-ui-design',
|
|
212
|
-
'plan': [{ cmd: 'maestro-plan',
|
|
213
|
-
'execute': [{ cmd: 'maestro-execute',
|
|
214
|
-
'verify': [{ cmd: 'maestro-verify',
|
|
215
|
-
'test_gen': [{ cmd: 'quality-test-gen',
|
|
216
|
-
'test': [{ cmd: 'quality-test',
|
|
217
|
-
'debug': [{ cmd: 'quality-debug',
|
|
218
|
-
'integration_test': [{ cmd: 'quality-integration-test',args: '{phase}' }],
|
|
219
|
-
'refactor': [{ cmd: 'quality-refactor',
|
|
220
|
-
'review': [{ cmd: 'quality-review',
|
|
221
|
-
'retrospective': [{ cmd: 'quality-retrospective',
|
|
222
|
-
'learn': [{ cmd: 'manage-learn',
|
|
223
|
-
'sync': [{ cmd: 'quality-sync',
|
|
224
|
-
'
|
|
225
|
-
'
|
|
190
|
+
'analyze': [{ cmd: 'maestro-analyze', args: '{phase}' }],
|
|
191
|
+
'ui_design': [{ cmd: 'maestro-ui-design', args: '{phase}' }],
|
|
192
|
+
'plan': [{ cmd: 'maestro-plan', args: '{phase}' }],
|
|
193
|
+
'execute': [{ cmd: 'maestro-execute', args: '{phase}' }],
|
|
194
|
+
'verify': [{ cmd: 'maestro-verify', args: '{phase}' }],
|
|
195
|
+
'test_gen': [{ cmd: 'quality-test-gen', args: '{phase}' }],
|
|
196
|
+
'test': [{ cmd: 'quality-test', args: '{phase}' }],
|
|
197
|
+
'debug': [{ cmd: 'quality-debug', args: '"{description}"' }],
|
|
198
|
+
'integration_test': [{ cmd: 'quality-integration-test', args: '{phase}' }],
|
|
199
|
+
'refactor': [{ cmd: 'quality-refactor', args: '"{description}"' }],
|
|
200
|
+
'review': [{ cmd: 'quality-review', args: '{phase}' }],
|
|
201
|
+
'retrospective': [{ cmd: 'quality-retrospective', args: '{phase}' }],
|
|
202
|
+
'learn': [{ cmd: 'manage-learn', args: '"{description}"' }],
|
|
203
|
+
'sync': [{ cmd: 'quality-sync', args: '{phase}' }],
|
|
204
|
+
'milestone_close': [{ cmd: 'maestro-milestone-audit' }, { cmd: 'maestro-milestone-complete' }],
|
|
205
|
+
'roadmap': [{ cmd: 'maestro-roadmap', args: '"{description}"' }],
|
|
226
206
|
'milestone_audit': [{ cmd: 'maestro-milestone-audit' }],
|
|
227
207
|
'milestone_complete': [{ cmd: 'maestro-milestone-complete' }],
|
|
228
208
|
'codebase_rebuild': [{ cmd: 'manage-codebase-rebuild' }],
|
|
229
209
|
'codebase_refresh': [{ cmd: 'manage-codebase-refresh' }],
|
|
230
210
|
'spec_setup': [{ cmd: 'spec-setup' }],
|
|
231
|
-
'spec_add': [{ cmd: 'spec-add',
|
|
232
|
-
'spec_load': [{ cmd: 'spec-load',
|
|
211
|
+
'spec_add': [{ cmd: 'spec-add', args: '"{description}"' }],
|
|
212
|
+
'spec_load': [{ cmd: 'spec-load', args: '"{description}"' }],
|
|
233
213
|
'spec_map': [{ cmd: 'manage-codebase-rebuild' }],
|
|
234
|
-
'memory_capture': [{ cmd: 'manage-memory-capture',
|
|
235
|
-
'memory': [{ cmd: 'manage-memory',
|
|
236
|
-
'issue': [{ cmd: 'manage-issue',
|
|
237
|
-
'issue_discover': [{ cmd: 'manage-issue-discover',
|
|
238
|
-
'issue_analyze': [{ cmd: '
|
|
239
|
-
'issue_plan': [{ cmd: '
|
|
240
|
-
'issue_execute': [{ cmd: '
|
|
241
|
-
'quick': [{ cmd: 'maestro-quick',
|
|
242
|
-
'
|
|
243
|
-
'
|
|
244
|
-
|
|
245
|
-
'
|
|
246
|
-
'
|
|
247
|
-
'
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
'
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
],
|
|
257
|
-
'
|
|
258
|
-
{ cmd: 'maestro-brainstorm', args: '"{description}"' },
|
|
259
|
-
{ cmd: 'maestro-plan', args: '{phase}' },
|
|
260
|
-
{ cmd: 'maestro-execute', args: '{phase}' },
|
|
261
|
-
{ cmd: 'maestro-verify', args: '{phase}' }
|
|
262
|
-
],
|
|
263
|
-
'ui-design-driven': [
|
|
264
|
-
{ cmd: 'maestro-ui-design', args: '{phase}' },
|
|
265
|
-
{ cmd: 'maestro-plan', args: '{phase}' },
|
|
266
|
-
{ cmd: 'maestro-execute', args: '{phase}' },
|
|
267
|
-
{ cmd: 'maestro-verify', args: '{phase}' }
|
|
268
|
-
],
|
|
269
|
-
'full-lifecycle': [
|
|
270
|
-
{ cmd: 'maestro-plan', args: '{phase}' },
|
|
271
|
-
{ cmd: 'maestro-execute', args: '{phase}' },
|
|
272
|
-
{ cmd: 'maestro-verify', args: '{phase}' },
|
|
273
|
-
{ cmd: 'quality-review', args: '{phase}' },
|
|
274
|
-
{ cmd: 'quality-test', args: '{phase}' },
|
|
275
|
-
{ cmd: 'maestro-phase-transition' }
|
|
276
|
-
],
|
|
277
|
-
'execute-verify': [
|
|
278
|
-
{ cmd: 'maestro-execute', args: '{phase}' },
|
|
279
|
-
{ cmd: 'maestro-verify', args: '{phase}' }
|
|
280
|
-
],
|
|
281
|
-
'quality-loop': [
|
|
282
|
-
{ cmd: 'maestro-verify', args: '{phase}' },
|
|
283
|
-
{ cmd: 'quality-review', args: '{phase}' },
|
|
284
|
-
{ cmd: 'quality-test', args: '{phase}' },
|
|
285
|
-
{ cmd: 'quality-debug', args: '--from-uat {phase}' },
|
|
286
|
-
{ cmd: 'maestro-plan', args: '{phase} --gaps' },
|
|
287
|
-
{ cmd: 'maestro-execute', args: '{phase}' }
|
|
288
|
-
],
|
|
289
|
-
'milestone-close': [
|
|
290
|
-
{ cmd: 'maestro-milestone-audit' },
|
|
291
|
-
{ cmd: 'maestro-milestone-complete' }
|
|
292
|
-
],
|
|
293
|
-
'roadmap-driven': [
|
|
294
|
-
{ cmd: 'maestro-init' },
|
|
295
|
-
{ cmd: 'maestro-roadmap', args: '"{description}"' },
|
|
296
|
-
{ cmd: 'maestro-plan', args: '{phase}' },
|
|
297
|
-
{ cmd: 'maestro-execute', args: '{phase}' },
|
|
298
|
-
{ cmd: 'maestro-verify', args: '{phase}' }
|
|
299
|
-
],
|
|
300
|
-
'next-milestone': [
|
|
301
|
-
{ cmd: 'maestro-roadmap', args: '"{description}"' },
|
|
302
|
-
{ cmd: 'maestro-plan', args: '{phase}' },
|
|
303
|
-
{ cmd: 'maestro-execute', args: '{phase}' },
|
|
304
|
-
{ cmd: 'maestro-verify', args: '{phase}' }
|
|
305
|
-
],
|
|
306
|
-
'analyze-plan-execute': [
|
|
307
|
-
{ cmd: 'maestro-analyze', args: '"{description}" -q' },
|
|
308
|
-
{ cmd: 'maestro-plan', args: '--dir {scratch_dir}' },
|
|
309
|
-
{ cmd: 'maestro-execute', args: '--dir {scratch_dir}' }
|
|
310
|
-
],
|
|
311
|
-
|
|
312
|
-
// ── SKILL.md simplified aliases (--chain <name> shortcuts) ───────────────
|
|
313
|
-
'feature': [
|
|
314
|
-
{ cmd: 'maestro-plan', args: '{phase}' },
|
|
315
|
-
{ cmd: 'maestro-execute', args: '{phase}' },
|
|
316
|
-
{ cmd: 'maestro-verify', args: '{phase}' }
|
|
317
|
-
],
|
|
318
|
-
'quality-fix': [
|
|
319
|
-
{ cmd: 'manage-issue-analyze', args: '"{description}"' },
|
|
320
|
-
{ cmd: 'manage-issue-execute', args: '"{description}"' },
|
|
321
|
-
{ cmd: 'maestro-verify', args: '{phase}' }
|
|
322
|
-
],
|
|
323
|
-
'deploy': [
|
|
324
|
-
{ cmd: 'maestro-verify', args: '{phase}' },
|
|
325
|
-
{ cmd: 'maestro-execute', args: '{phase}' }
|
|
326
|
-
],
|
|
327
|
-
|
|
328
|
-
// ── Issue lifecycle chains (with quality gates) ────────────────────────────
|
|
329
|
-
'issue-full': [
|
|
330
|
-
{ cmd: 'manage-issue-analyze', args: '{issue_id}' },
|
|
331
|
-
{ cmd: 'manage-issue-plan', args: '{issue_id}' },
|
|
332
|
-
{ cmd: 'manage-issue-execute', args: '{issue_id}' },
|
|
333
|
-
{ cmd: 'quality-review', args: '--scope {affected_files}' },
|
|
334
|
-
{ cmd: 'manage-issue', args: 'close {issue_id} --resolution fixed' }
|
|
335
|
-
],
|
|
336
|
-
'issue-quick': [
|
|
337
|
-
{ cmd: 'manage-issue-plan', args: '{issue_id}' },
|
|
338
|
-
{ cmd: 'manage-issue-execute', args: '{issue_id}' },
|
|
339
|
-
{ cmd: 'manage-issue', args: 'close {issue_id} --resolution fixed' }
|
|
340
|
-
],
|
|
214
|
+
'memory_capture': [{ cmd: 'manage-memory-capture', args: '"{description}"' }],
|
|
215
|
+
'memory': [{ cmd: 'manage-memory', args: '"{description}"' }],
|
|
216
|
+
'issue': [{ cmd: 'manage-issue', args: '"{description}"' }],
|
|
217
|
+
'issue_discover': [{ cmd: 'manage-issue-discover', args: '"{description}"' }],
|
|
218
|
+
'issue_analyze': [{ cmd: 'maestro-analyze', args: '--gaps "{description}"' }],
|
|
219
|
+
'issue_plan': [{ cmd: 'maestro-plan', args: '--gaps' }],
|
|
220
|
+
'issue_execute': [{ cmd: 'maestro-execute', args: '' }],
|
|
221
|
+
'quick': [{ cmd: 'maestro-quick', args: '"{description}"' }],
|
|
222
|
+
'fork': [{ cmd: 'maestro-fork', args: '-m {milestone_num}' }],
|
|
223
|
+
'merge': [{ cmd: 'maestro-merge', args: '-m {milestone_num}' }],
|
|
224
|
+
// Multi-step chains
|
|
225
|
+
'spec-driven': [{ cmd: 'maestro-init' }, { cmd: 'maestro-spec-generate', args: '"{description}"' }, { cmd: 'maestro-plan', args: '{phase}' }, { cmd: 'maestro-execute', args: '{phase}' }, { cmd: 'maestro-verify', args: '{phase}' }],
|
|
226
|
+
'brainstorm-driven': [{ cmd: 'maestro-brainstorm', args: '"{description}"' }, { cmd: 'maestro-plan', args: '{phase}' }, { cmd: 'maestro-execute', args: '{phase}' }, { cmd: 'maestro-verify', args: '{phase}' }],
|
|
227
|
+
'ui-design-driven': [{ cmd: 'maestro-ui-design', args: '{phase}' }, { cmd: 'maestro-plan', args: '{phase}' }, { cmd: 'maestro-execute', args: '{phase}' }, { cmd: 'maestro-verify', args: '{phase}' }],
|
|
228
|
+
'full-lifecycle': [{ cmd: 'maestro-plan', args: '{phase}' }, { cmd: 'maestro-execute', args: '{phase}' }, { cmd: 'maestro-verify', args: '{phase}' }, { cmd: 'quality-review', args: '{phase}' }, { cmd: 'quality-test', args: '{phase}' }, { cmd: 'maestro-milestone-audit' }, { cmd: 'maestro-milestone-complete' }],
|
|
229
|
+
'execute-verify': [{ cmd: 'maestro-execute', args: '{phase}' }, { cmd: 'maestro-verify', args: '{phase}' }],
|
|
230
|
+
'quality-loop': [{ cmd: 'maestro-verify', args: '{phase}' }, { cmd: 'quality-review', args: '{phase}' }, { cmd: 'quality-test', args: '{phase}' }, { cmd: 'quality-debug', args: '--from-uat {phase}' }, { cmd: 'maestro-plan', args: '{phase} --gaps' }, { cmd: 'maestro-execute', args: '{phase}' }],
|
|
231
|
+
'milestone-close': [{ cmd: 'maestro-milestone-audit' }, { cmd: 'maestro-milestone-complete' }],
|
|
232
|
+
'roadmap-driven': [{ cmd: 'maestro-init' }, { cmd: 'maestro-roadmap', args: '"{description}"' }, { cmd: 'maestro-plan', args: '{phase}' }, { cmd: 'maestro-execute', args: '{phase}' }, { cmd: 'maestro-verify', args: '{phase}' }],
|
|
233
|
+
'next-milestone': [{ cmd: 'maestro-roadmap', args: '"{description}"' }, { cmd: 'maestro-plan', args: '{phase}' }, { cmd: 'maestro-execute', args: '{phase}' }, { cmd: 'maestro-verify', args: '{phase}' }],
|
|
234
|
+
'analyze-plan-execute': [{ cmd: 'maestro-analyze', args: '"{description}" -q' }, { cmd: 'maestro-plan', args: '--dir {scratch_dir}' }, { cmd: 'maestro-execute', args: '--dir {scratch_dir}' }],
|
|
235
|
+
// Issue lifecycle chains (with quality gates)
|
|
236
|
+
'issue-full': [{ cmd: 'maestro-analyze', args: '--gaps {issue_id}' }, { cmd: 'maestro-plan', args: '--gaps' }, { cmd: 'maestro-execute', args: '' }, { cmd: 'quality-review', args: '--scope {affected_files}' }, { cmd: 'manage-issue', args: 'close {issue_id} --resolution fixed' }],
|
|
237
|
+
'issue-quick': [{ cmd: 'maestro-plan', args: '--gaps' }, { cmd: 'maestro-execute', args: '' }, { cmd: 'manage-issue', args: 'close {issue_id} --resolution fixed' }],
|
|
341
238
|
};
|
|
342
239
|
|
|
343
|
-
// Aliases: task type → named chain
|
|
240
|
+
// Aliases: task type → named multi-step chain
|
|
344
241
|
const taskToChain = {
|
|
345
|
-
'spec_generate':
|
|
346
|
-
'brainstorm':
|
|
347
|
-
'issue_execute':
|
|
242
|
+
'spec_generate': 'spec-driven',
|
|
243
|
+
'brainstorm': 'brainstorm-driven',
|
|
244
|
+
'issue_execute': 'issue-full', // issue execute always gets review gate
|
|
348
245
|
};
|
|
349
246
|
```
|
|
350
247
|
|
|
351
248
|
**Resolution order:**
|
|
352
|
-
1. `
|
|
249
|
+
1. `forcedChain` → `chainMap[forcedChain]`
|
|
353
250
|
2. `state_continue` → `detectNextAction(projectState)`
|
|
354
251
|
3. `taskToChain[taskType]` → named chain
|
|
355
252
|
4. `chainMap[taskType]` → direct lookup
|
|
356
253
|
|
|
357
|
-
### 3d: Resolve phase
|
|
254
|
+
### 3d: Resolve phase number and issue ID
|
|
358
255
|
|
|
359
256
|
```javascript
|
|
360
257
|
function resolvePhase() {
|
|
361
258
|
// From structured extraction
|
|
362
259
|
if (intentAnalysis.phase_ref) return intentAnalysis.phase_ref;
|
|
363
260
|
// Fallback regex
|
|
364
|
-
const m = intent.match(
|
|
365
|
-
if (m) return m[1]
|
|
366
|
-
|
|
261
|
+
const m = intent.match(/phase\s*(\d+)|^(\d+)$/);
|
|
262
|
+
if (m) return m[1] || m[2];
|
|
263
|
+
// With scratch-based architecture, commands default to milestone-wide when no phase specified
|
|
367
264
|
return null;
|
|
368
265
|
}
|
|
369
266
|
|
|
370
267
|
function resolveIssueId() {
|
|
371
268
|
if (intentAnalysis.issue_id) return intentAnalysis.issue_id;
|
|
372
|
-
const m = intent.match(
|
|
269
|
+
const m = intent.match(/ISS-[\w]+-\d+/i);
|
|
373
270
|
return m ? m[0] : null;
|
|
374
271
|
}
|
|
375
|
-
|
|
376
|
-
const resolvedPhase = resolvePhase();
|
|
377
|
-
const resolvedIssueId = resolveIssueId();
|
|
378
|
-
const context = {
|
|
379
|
-
current_phase: resolvedPhase,
|
|
380
|
-
user_intent: intent,
|
|
381
|
-
issue_id: resolvedIssueId,
|
|
382
|
-
spec_session_id: null,
|
|
383
|
-
scratch_dir: null
|
|
384
|
-
};
|
|
385
272
|
```
|
|
386
273
|
|
|
274
|
+
When executing issue chains, replace `{issue_id}` in step args with the resolved issue ID.
|
|
275
|
+
|
|
387
276
|
---
|
|
388
277
|
|
|
389
278
|
## Step 4: Confirm
|
|
390
279
|
|
|
391
|
-
**If `
|
|
280
|
+
**If `dryRun`:** Display chain and exit.
|
|
392
281
|
|
|
393
282
|
```
|
|
394
|
-
MAESTRO-COORDINATE: {chain_name}
|
|
395
|
-
1.
|
|
396
|
-
2.
|
|
397
|
-
…
|
|
283
|
+
MAESTRO-COORDINATE: {chain_name} (dry run)
|
|
284
|
+
1. [{cmd}] {args}
|
|
285
|
+
2. [{cmd}] {args}
|
|
398
286
|
```
|
|
399
287
|
|
|
400
|
-
**If not
|
|
401
|
-
- Execute all steps
|
|
402
|
-
- Execute from step N
|
|
403
|
-
- Cancel
|
|
288
|
+
**If not autoYes:** AskUserQuestion — Execute / Execute from step N / Cancel.
|
|
404
289
|
|
|
405
290
|
---
|
|
406
291
|
|
|
407
292
|
## Step 5: Setup Session
|
|
408
293
|
|
|
409
294
|
```javascript
|
|
410
|
-
const
|
|
411
|
-
const sessionId = `coord-${ts}`;
|
|
295
|
+
const sessionId = `coord-${new Date().toISOString().replace(/[-:T]/g, '').slice(0, 15)}`;
|
|
412
296
|
const sessionDir = `.workflow/.maestro-coordinate/${sessionId}`;
|
|
413
297
|
Bash(`mkdir -p "${sessionDir}"`);
|
|
414
298
|
|
|
415
299
|
const state = {
|
|
416
|
-
session_id: sessionId,
|
|
417
|
-
status: 'running',
|
|
300
|
+
session_id: sessionId, status: 'running',
|
|
418
301
|
created_at: new Date().toISOString(),
|
|
419
|
-
intent,
|
|
420
|
-
|
|
421
|
-
chain_name: chainName,
|
|
422
|
-
auto_yes: AUTO_YES,
|
|
423
|
-
phase: resolvedPhase,
|
|
302
|
+
intent, task_type: taskType, chain_name: chainName,
|
|
303
|
+
tool: cliTool, auto_mode: autoYes, phase: resolvedPhase,
|
|
424
304
|
current_step: 0,
|
|
425
|
-
|
|
305
|
+
gemini_session_id: null,
|
|
306
|
+
step_analyses: [],
|
|
426
307
|
steps: chain.map((s, i) => ({
|
|
427
|
-
index: i,
|
|
428
|
-
|
|
429
|
-
args: s.args ?? '',
|
|
430
|
-
status: 'pending',
|
|
431
|
-
findings: null,
|
|
432
|
-
quality_score: null,
|
|
433
|
-
hints_for_next: null
|
|
308
|
+
index: i, cmd: s.cmd, args: s.args || '',
|
|
309
|
+
status: 'pending', exec_id: null, analysis: null
|
|
434
310
|
}))
|
|
435
311
|
};
|
|
436
312
|
Write(`${sessionDir}/state.json`, JSON.stringify(state, null, 2));
|
|
313
|
+
|
|
314
|
+
const context = { resolved_phase: resolvedPhase, user_intent: intent, issue_id: resolvedIssueId, spec_session_id: null };
|
|
437
315
|
```
|
|
438
316
|
|
|
439
317
|
---
|
|
440
318
|
|
|
441
|
-
## Step 6: Execute Step via
|
|
319
|
+
## Step 6: Execute Step via codex delegate
|
|
442
320
|
|
|
443
321
|
### 6a: Assemble args
|
|
444
322
|
|
|
445
323
|
```javascript
|
|
446
324
|
const AUTO_FLAG_MAP = {
|
|
447
|
-
'maestro-analyze':
|
|
448
|
-
'maestro-
|
|
449
|
-
'
|
|
450
|
-
'maestro-plan': '--auto',
|
|
451
|
-
'maestro-spec-generate': '-y',
|
|
452
|
-
'quality-test': '--auto-fix',
|
|
453
|
-
'quality-retrospective': '--auto-yes',
|
|
325
|
+
'maestro-analyze': '-y', 'maestro-brainstorm': '-y', 'maestro-ui-design': '-y',
|
|
326
|
+
'maestro-plan': '--auto', 'maestro-spec-generate': '-y', 'quality-test': '--auto-fix',
|
|
327
|
+
'quality-retrospective': '--auto-yes',
|
|
454
328
|
};
|
|
455
329
|
|
|
456
330
|
function assembleArgs(step) {
|
|
457
|
-
let a = (step.args
|
|
458
|
-
.
|
|
459
|
-
.
|
|
460
|
-
.
|
|
461
|
-
.
|
|
462
|
-
.
|
|
463
|
-
|
|
464
|
-
if (AUTO_YES) {
|
|
331
|
+
let a = (step.args || '')
|
|
332
|
+
.replace(/\{phase\}/g, context.resolved_phase || '') // empty = milestone-wide default
|
|
333
|
+
.replace(/\{description\}/g, context.user_intent || '')
|
|
334
|
+
.replace(/\{issue_id\}/g, context.issue_id || '')
|
|
335
|
+
.replace(/\{spec_session_id\}/g, context.spec_session_id || '')
|
|
336
|
+
.replace(/\{scratch_dir\}/g, context.scratch_dir || '');
|
|
337
|
+
if (state.auto_mode) {
|
|
465
338
|
const flag = AUTO_FLAG_MAP[step.cmd];
|
|
466
339
|
if (flag && !a.includes(flag)) a = a ? `${a} ${flag}` : flag;
|
|
467
340
|
}
|
|
@@ -469,233 +342,179 @@ function assembleArgs(step) {
|
|
|
469
342
|
}
|
|
470
343
|
```
|
|
471
344
|
|
|
472
|
-
### 6b: Build
|
|
473
|
-
|
|
474
|
-
```javascript
|
|
475
|
-
function buildAnalysisHints(stepIdx) {
|
|
476
|
-
const prev = state.step_analyses.find(a => a.step_index === stepIdx - 1);
|
|
477
|
-
if (!prev?.next_step_hints) return '';
|
|
478
|
-
const h = prev.next_step_hints;
|
|
479
|
-
const parts = [];
|
|
480
|
-
if (h.prompt_additions) parts.push(h.prompt_additions);
|
|
481
|
-
if (h.cautions?.length) parts.push('Cautions: ' + h.cautions.join('; '));
|
|
482
|
-
if (h.context_to_carry) parts.push('Context from prior step: ' + h.context_to_carry);
|
|
483
|
-
return parts.join('\n');
|
|
484
|
-
}
|
|
485
|
-
```
|
|
345
|
+
### 6b: Build prompt from template
|
|
486
346
|
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
The prompt embeds the skill invocation so the agent knows exactly what to call:
|
|
347
|
+
Read `~/.maestro/templates/cli/prompts/coordinate-step.txt`, fill placeholders.
|
|
348
|
+
If previous step has analysis hints, inject them as `{{ANALYSIS_HINTS}}`.
|
|
490
349
|
|
|
491
350
|
```javascript
|
|
492
|
-
function
|
|
493
|
-
const skillCall = assembledArgs
|
|
494
|
-
? `$${step.cmd} ${assembledArgs}`
|
|
495
|
-
: `$${step.cmd}`;
|
|
496
|
-
|
|
497
|
-
return `## TASK ASSIGNMENT
|
|
498
|
-
|
|
499
|
-
### MANDATORY FIRST STEPS
|
|
500
|
-
1. Read: ~/.codex/agents/universal-executor.md
|
|
501
|
-
2. Read: ~/.codex/skills/${step.cmd}/SKILL.md
|
|
502
|
-
|
|
503
|
-
---
|
|
351
|
+
function escapeForShell(str) { return "'" + str.replace(/'/g, "'\\''") + "'"; }
|
|
504
352
|
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
Intent: ${state.intent}
|
|
508
|
-
|
|
509
|
-
## Skill Invocation
|
|
510
|
-
Execute this skill to complete your task:
|
|
511
|
-
|
|
512
|
-
${skillCall}
|
|
513
|
-
|
|
514
|
-
Follow the Implementation section of the skill file you loaded in step 2.
|
|
515
|
-
${AUTO_YES ? 'Auto mode: skip all confirmation prompts within the skill.' : ''}
|
|
353
|
+
const assembledArgs = assembleArgs(step);
|
|
354
|
+
const template = Read('~/.maestro/templates/cli/prompts/coordinate-step.txt');
|
|
516
355
|
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
{
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
"hints_for_next": "<specific guidance for the next chain step, or null>"
|
|
356
|
+
// Build analysis hints from previous step's gemini evaluation
|
|
357
|
+
let analysisHints = '';
|
|
358
|
+
const prevAnalysis = (state.step_analyses || []).find(a => a.step_index === state.current_step - 1);
|
|
359
|
+
if (prevAnalysis?.next_step_hints) {
|
|
360
|
+
const h = prevAnalysis.next_step_hints;
|
|
361
|
+
const parts = [];
|
|
362
|
+
if (h.prompt_additions) parts.push(h.prompt_additions);
|
|
363
|
+
if (h.cautions?.length) parts.push('Cautions: ' + h.cautions.join('; '));
|
|
364
|
+
if (h.context_to_carry) parts.push('Context from prior step: ' + h.context_to_carry);
|
|
365
|
+
if (parts.length) analysisHints = parts.join('\n');
|
|
528
366
|
}
|
|
529
|
-
\`\`\`
|
|
530
367
|
|
|
531
|
-
|
|
532
|
-
}
|
|
368
|
+
const prompt = template
|
|
369
|
+
.replace('{{COMMAND}}', `/${step.cmd}`)
|
|
370
|
+
.replace('{{ARGS}}', assembledArgs)
|
|
371
|
+
.replace('{{STEP_N}}', `${state.current_step + 1}/${state.steps.length}`)
|
|
372
|
+
.replace('{{AUTO_DIRECTIVE}}', state.auto_mode ? 'Auto-confirm all prompts. No interactive questions.' : '')
|
|
373
|
+
.replace('{{CHAIN_NAME}}', state.chain_name)
|
|
374
|
+
.replace('{{ANALYSIS_HINTS}}', analysisHints);
|
|
533
375
|
```
|
|
534
376
|
|
|
535
|
-
###
|
|
377
|
+
### 6c: Launch via codex delegate
|
|
536
378
|
|
|
537
|
-
```
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
379
|
+
```
|
|
380
|
+
------------------------------------------------------------
|
|
381
|
+
STEP {i+1}/{total}: {step.cmd} | Tool: {cliTool}
|
|
382
|
+
------------------------------------------------------------
|
|
383
|
+
```
|
|
542
384
|
|
|
543
|
-
|
|
544
|
-
|
|
385
|
+
```javascript
|
|
386
|
+
state.steps[state.current_step].status = 'running';
|
|
387
|
+
state.steps[state.current_step].started_at = new Date().toISOString();
|
|
545
388
|
Write(`${sessionDir}/state.json`, JSON.stringify(state, null, 2));
|
|
546
389
|
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
result = wait({ ids: [stepAgent], timeout_ms: 120000 });
|
|
553
|
-
}
|
|
554
|
-
|
|
555
|
-
const rawOutput = result.status[stepAgent].completed ?? '';
|
|
556
|
-
close_agent({ id: stepAgent });
|
|
557
|
-
|
|
558
|
-
// Save raw output for analysis
|
|
559
|
-
Write(`${sessionDir}/step-${state.current_step + 1}-output.txt`, rawOutput);
|
|
390
|
+
Bash({
|
|
391
|
+
command: `codex delegate ${escapeForShell(prompt)} --to ${state.tool} --mode write`,
|
|
392
|
+
run_in_background: true, timeout: 600000
|
|
393
|
+
});
|
|
394
|
+
// ■ STOP — wait for hook callback
|
|
560
395
|
```
|
|
561
396
|
|
|
562
397
|
---
|
|
563
398
|
|
|
564
|
-
## Step 7: Post-Step
|
|
565
|
-
|
|
566
|
-
### 7a: Parse output and propagate context
|
|
399
|
+
## Step 7: Post-Step Callback
|
|
567
400
|
|
|
568
401
|
```javascript
|
|
569
|
-
const
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
if (
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
if (
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
// → back to Step 6d with same step
|
|
592
|
-
} else if (stepFailed && !AUTO_YES) {
|
|
593
|
-
// Ask: Retry / Skip / Abort
|
|
594
|
-
const choice = functions.request_user_input({
|
|
595
|
-
id: 'step-failure',
|
|
596
|
-
items: [{ type: 'text', text: `Step ${state.current_step + 1} (${step.cmd}) failed. Retry / Skip / Abort?` }]
|
|
597
|
-
});
|
|
598
|
-
if (choice === 'Retry') { /* → back to Step 6d */ }
|
|
599
|
-
if (choice === 'Abort') {
|
|
600
|
-
state.status = 'aborted';
|
|
601
|
-
Write(`${sessionDir}/state.json`, JSON.stringify(state, null, 2));
|
|
602
|
-
return; // exit
|
|
603
|
-
}
|
|
604
|
-
// Skip: fall through
|
|
605
|
-
step.status = 'skipped';
|
|
606
|
-
} else if (stepFailed) {
|
|
402
|
+
const stepIdx = state.current_step;
|
|
403
|
+
const step = state.steps[stepIdx];
|
|
404
|
+
const output = /* callback output */;
|
|
405
|
+
|
|
406
|
+
// Capture exec_id from stderr [CODEX_EXEC_ID=xxx]
|
|
407
|
+
step.exec_id = /* from callback */;
|
|
408
|
+
step.completed_at = new Date().toISOString();
|
|
409
|
+
|
|
410
|
+
// Context propagation
|
|
411
|
+
const phaseMatch = output.match(/PHASE:\s*(\d+)/m);
|
|
412
|
+
if (phaseMatch) context.resolved_phase = phaseMatch[1];
|
|
413
|
+
const specMatch = output.match(/SPEC-[\w-]+/);
|
|
414
|
+
if (specMatch) context.spec_session_id = specMatch[0];
|
|
415
|
+
const scratchMatch = output.match(/scratch_dir:\s*(.+)/m);
|
|
416
|
+
if (scratchMatch) context.scratch_dir = scratchMatch[1].trim();
|
|
417
|
+
|
|
418
|
+
// Success/failure
|
|
419
|
+
const failed = /^STATUS:\s*FAILURE/m.test(output);
|
|
420
|
+
if (!failed) {
|
|
421
|
+
step.status = 'completed';
|
|
422
|
+
} else if (state.auto_mode) {
|
|
423
|
+
if (!step.retried) { step.retried = true; /* re-execute Step 6c */ return; }
|
|
607
424
|
step.status = 'skipped';
|
|
608
425
|
} else {
|
|
609
|
-
|
|
426
|
+
// AskUserQuestion: Retry / Skip / Abort
|
|
427
|
+
// On Abort: state.status = 'aborted', save, exit
|
|
610
428
|
}
|
|
611
429
|
|
|
612
|
-
|
|
613
|
-
step
|
|
614
|
-
step.hints_for_next= output.hints_for_next;
|
|
615
|
-
step.completed_at = new Date().toISOString();
|
|
430
|
+
// Save output for analysis
|
|
431
|
+
Write(`${sessionDir}/step-${stepIdx + 1}-output.txt`, output);
|
|
616
432
|
Write(`${sessionDir}/state.json`, JSON.stringify(state, null, 2));
|
|
617
|
-
```
|
|
618
|
-
|
|
619
|
-
### 7b: Analyze step output (inline analysis agent)
|
|
620
433
|
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
```javascript
|
|
434
|
+
// → Step 7b: Gemini analysis (skip if step failed/skipped or single-step chain)
|
|
624
435
|
if (step.status === 'completed' && state.steps.length > 1) {
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
436
|
+
// → Step 7b
|
|
437
|
+
} else {
|
|
438
|
+
// Skip analysis, advance directly
|
|
439
|
+
state.current_step = stepIdx + 1;
|
|
440
|
+
Write(`${sessionDir}/state.json`, JSON.stringify(state, null, 2));
|
|
441
|
+
if (state.current_step < state.steps.length) { /* → Step 6 */ }
|
|
442
|
+
else { /* → Step 8 */ }
|
|
443
|
+
}
|
|
444
|
+
```
|
|
634
445
|
|
|
635
446
|
---
|
|
636
447
|
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
Step: $${step.cmd} (step ${state.current_step + 1}/${state.steps.length})
|
|
640
|
-
Chain: ${state.chain_name} | Intent: ${state.intent}
|
|
448
|
+
## Step 7b: Analyze Step Output (via gemini)
|
|
641
449
|
|
|
642
|
-
|
|
643
|
-
${rawOutput.split('\n').slice(-200).join('\n')}
|
|
450
|
+
After each step completes, call gemini to evaluate execution quality and generate optimization hints for subsequent steps.
|
|
644
451
|
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
452
|
+
```javascript
|
|
453
|
+
const stepIdx = state.current_step;
|
|
454
|
+
const step = state.steps[stepIdx];
|
|
455
|
+
const output = Read(`${sessionDir}/step-${stepIdx + 1}-output.txt`);
|
|
456
|
+
const nextStep = stepIdx < state.steps.length - 1 ? state.steps[stepIdx + 1] : null;
|
|
457
|
+
|
|
458
|
+
// Build analysis prompt
|
|
459
|
+
const priorAnalyses = (state.step_analyses || [])
|
|
460
|
+
.map(a => `- Step ${a.step_index + 1} (${a.cmd}): score=${a.quality_score}, issues=${a.issues?.length || 0}`)
|
|
461
|
+
.join('\n');
|
|
462
|
+
|
|
463
|
+
const analysisPrompt = `PURPOSE: Evaluate execution quality of coordinate step "${step.cmd}" (${stepIdx + 1}/${state.steps.length}) and generate optimization hints for the next step.
|
|
464
|
+
CHAIN: ${state.chain_name} | Intent: ${state.intent}
|
|
465
|
+
COMMAND: /${step.cmd} ${step.args || ''}
|
|
466
|
+
STEP OUTPUT (last 200 lines):
|
|
467
|
+
${output.split('\n').slice(-200).join('\n')}
|
|
468
|
+
${priorAnalyses ? `PRIOR STEP ANALYSES:\n${priorAnalyses}` : ''}
|
|
469
|
+
${nextStep ? `NEXT STEP: /${nextStep.cmd} ${nextStep.args || ''}` : 'NEXT STEP: None (last step)'}
|
|
470
|
+
EXPECTED OUTPUT (strict JSON):
|
|
650
471
|
{
|
|
651
472
|
"quality_score": <0-100>,
|
|
652
|
-
"execution_assessment": {
|
|
653
|
-
"success": <bool>,
|
|
654
|
-
"completeness": "full|partial|minimal",
|
|
655
|
-
"key_outputs": [],
|
|
656
|
-
"missing_outputs": []
|
|
657
|
-
},
|
|
473
|
+
"execution_assessment": { "success": <bool>, "completeness": "<full|partial|minimal>", "key_outputs": [], "missing_outputs": [] },
|
|
658
474
|
"issues": [{ "severity": "critical|high|medium|low", "description": "" }],
|
|
659
475
|
"next_step_hints": {
|
|
660
476
|
"prompt_additions": "<extra context or constraints to inject into next step prompt>",
|
|
661
477
|
"cautions": ["<things next step should watch out for>"],
|
|
662
|
-
"context_to_carry": "<key facts from this step that next step needs>"
|
|
478
|
+
"context_to_carry": "<key facts from this step's output that next step needs>"
|
|
663
479
|
},
|
|
664
480
|
"step_summary": ""
|
|
665
|
-
}
|
|
666
|
-
\`\`\``;
|
|
481
|
+
}`;
|
|
667
482
|
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
aResult = wait({ ids: [analysisAgent], timeout_ms: 60000 });
|
|
673
|
-
}
|
|
674
|
-
close_agent({ id: analysisAgent });
|
|
675
|
-
|
|
676
|
-
const analysis = parseLastJSON(aResult.status[analysisAgent].completed ?? '') ?? {};
|
|
677
|
-
state.step_analyses.push({
|
|
678
|
-
step_index: state.current_step,
|
|
679
|
-
cmd: step.cmd,
|
|
680
|
-
quality_score: analysis.quality_score,
|
|
681
|
-
issues: analysis.issues,
|
|
682
|
-
next_step_hints: analysis.next_step_hints,
|
|
683
|
-
summary: analysis.step_summary
|
|
684
|
-
});
|
|
685
|
-
step.quality_score = analysis.quality_score ?? step.quality_score;
|
|
686
|
-
Write(`${sessionDir}/step-${state.current_step + 1}-analysis.json`, JSON.stringify(analysis, null, 2));
|
|
687
|
-
Write(`${sessionDir}/state.json`, JSON.stringify(state, null, 2));
|
|
688
|
-
}
|
|
483
|
+
let delegateCmd = `codex delegate ${escapeForShell(analysisPrompt)} --to gemini --mode analysis --rule analysis-review-code-quality`;
|
|
484
|
+
if (state.gemini_session_id) delegateCmd += ` --resume ${state.gemini_session_id}`;
|
|
485
|
+
Bash({ command: delegateCmd, run_in_background: true, timeout: 300000 });
|
|
486
|
+
// ■ STOP — wait for hook callback
|
|
689
487
|
```
|
|
690
488
|
|
|
691
|
-
### 7c:
|
|
489
|
+
### Step 7c: Post-Analyze Callback
|
|
692
490
|
|
|
693
491
|
```javascript
|
|
694
|
-
|
|
492
|
+
const analysisResult = /* parsed JSON from callback output */;
|
|
493
|
+
|
|
494
|
+
// Capture gemini session ID for resume chain
|
|
495
|
+
state.gemini_session_id = /* from callback stderr [CODEX_EXEC_ID=xxx] */;
|
|
496
|
+
|
|
497
|
+
// Store analysis
|
|
498
|
+
if (!state.step_analyses) state.step_analyses = [];
|
|
499
|
+
state.step_analyses.push({
|
|
500
|
+
step_index: stepIdx, cmd: step.cmd,
|
|
501
|
+
quality_score: analysisResult.quality_score,
|
|
502
|
+
issues: analysisResult.issues,
|
|
503
|
+
next_step_hints: analysisResult.next_step_hints,
|
|
504
|
+
summary: analysisResult.step_summary
|
|
505
|
+
});
|
|
506
|
+
step.analysis = {
|
|
507
|
+
quality_score: analysisResult.quality_score,
|
|
508
|
+
issue_count: (analysisResult.issues || []).length
|
|
509
|
+
};
|
|
510
|
+
Write(`${sessionDir}/step-${stepIdx + 1}-analysis.json`, JSON.stringify(analysisResult, null, 2));
|
|
511
|
+
|
|
512
|
+
// Advance
|
|
513
|
+
state.current_step = stepIdx + 1;
|
|
695
514
|
Write(`${sessionDir}/state.json`, JSON.stringify(state, null, 2));
|
|
696
515
|
|
|
697
516
|
if (state.current_step < state.steps.length) {
|
|
698
|
-
// →
|
|
517
|
+
// → Back to Step 6
|
|
699
518
|
} else {
|
|
700
519
|
// → Step 8
|
|
701
520
|
}
|
|
@@ -706,34 +525,26 @@ if (state.current_step < state.steps.length) {
|
|
|
706
525
|
## Step 8: Completion Report
|
|
707
526
|
|
|
708
527
|
```javascript
|
|
709
|
-
const done
|
|
710
|
-
const skipped = state.steps.filter(s => s.status === 'skipped').length;
|
|
711
|
-
const avgScore = state.step_analyses.length
|
|
712
|
-
? Math.round(state.step_analyses.reduce((s, a) => s + (a.quality_score ?? 0), 0) / state.step_analyses.length)
|
|
713
|
-
: null;
|
|
714
|
-
|
|
528
|
+
const done = state.steps.filter(s => s.status === 'completed').length;
|
|
715
529
|
state.status = state.steps.some(s => s.status === 'failed') ? 'completed_with_errors' : 'completed';
|
|
716
530
|
state.completed_at = new Date().toISOString();
|
|
717
531
|
Write(`${sessionDir}/state.json`, JSON.stringify(state, null, 2));
|
|
718
532
|
```
|
|
719
533
|
|
|
720
|
-
Display:
|
|
721
534
|
```
|
|
722
535
|
============================================================
|
|
723
536
|
MAESTRO-COORDINATE COMPLETE
|
|
724
537
|
============================================================
|
|
725
|
-
Session:
|
|
726
|
-
Chain:
|
|
538
|
+
Session: {session_id}
|
|
539
|
+
Chain: {chain_name} ({done}/{total})
|
|
540
|
+
Tool: {cliTool}
|
|
727
541
|
|
|
728
542
|
Steps:
|
|
729
|
-
[✓] 1.
|
|
730
|
-
[✓] 2.
|
|
731
|
-
[⚠] 3. {cmd} — skipped
|
|
732
|
-
|
|
733
|
-
Avg Quality: {avgScore}/100
|
|
734
|
-
Artifacts: .workflow/.maestro-coordinate/{session_id}/
|
|
543
|
+
[✓] 1. maestro-plan — completed (quality: 85/100)
|
|
544
|
+
[✓] 2. maestro-execute — completed (quality: 78/100)
|
|
735
545
|
|
|
736
|
-
|
|
546
|
+
Avg Quality: {avg_score}/100
|
|
547
|
+
Next: $Maestro-coordinate --continue
|
|
737
548
|
============================================================
|
|
738
549
|
```
|
|
739
550
|
|
|
@@ -741,15 +552,15 @@ Display:
|
|
|
741
552
|
|
|
742
553
|
## Core Rules
|
|
743
554
|
|
|
744
|
-
1. **Semantic routing
|
|
745
|
-
2. **
|
|
746
|
-
3. **
|
|
747
|
-
4. **
|
|
748
|
-
5. **Context propagation
|
|
749
|
-
6. **Quality gates
|
|
750
|
-
7. **
|
|
751
|
-
8. **
|
|
752
|
-
9. **
|
|
753
|
-
10. **
|
|
754
|
-
11. **
|
|
755
|
-
12. **Analysis skip conditions
|
|
555
|
+
1. **Semantic routing** — LLM-native structured extraction (`action × object`) replaces regex; disambiguates "问题" by context
|
|
556
|
+
2. **STOP after each `codex delegate` call** — background execution, wait for hook callback
|
|
557
|
+
3. **State machine** — advance via `current_step`, no sync loops for async operations
|
|
558
|
+
4. **Template-driven** — all steps use `coordinate-step.txt`, no per-command prompt assembly
|
|
559
|
+
5. **Context propagation** — parse PHASE / spec session ID / scratch_dir / issue_id from each step output, feed to next step
|
|
560
|
+
6. **Quality gates** — issue chains auto-include review; `issue-full` is default for issue execution
|
|
561
|
+
7. **Tool fallback** — if `codex delegate` fails: retry with same tool once, then try `gemini` → `qwen`
|
|
562
|
+
8. **Auto-confirm injection** — `{{AUTO_DIRECTIVE}}` in template prevents blocking during background execution
|
|
563
|
+
9. **Resumable** — `-c` reads `state.json`, jumps to first pending step
|
|
564
|
+
10. **Gemini analysis after each step** — evaluate output quality via `codex delegate --to gemini --mode analysis`, chained via `--resume`. Analysis generates `next_step_hints` injected into next step's prompt as `{{ANALYSIS_HINTS}}`
|
|
565
|
+
11. **Session capture** — after each gemini callback, capture exec_id → `gemini_session_id` for resume chain
|
|
566
|
+
12. **Analysis skip conditions** — skip gemini analysis for: failed/skipped steps, single-step chains
|