maestro-flow 0.3.24 → 0.3.26
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/cli-explore-agent.md +2 -2
- package/.claude/commands/learn-investigate.md +26 -0
- package/.claude/commands/maestro.md +8 -9
- package/dashboard/dist-server/dashboard/src/server/agents/codex-cli-adapter.d.ts +2 -0
- package/dashboard/dist-server/dashboard/src/server/agents/codex-cli-adapter.js +32 -7
- package/dashboard/dist-server/dashboard/src/server/agents/codex-cli-adapter.js.map +1 -1
- package/dashboard/dist-server/src/agents/cli-agent-runner.d.ts +2 -0
- package/dashboard/dist-server/src/agents/cli-agent-runner.js +62 -4
- package/dashboard/dist-server/src/agents/cli-agent-runner.js.map +1 -1
- package/dashboard/dist-server/src/commands/delegate.d.ts +2 -0
- package/dashboard/dist-server/src/commands/delegate.js +1 -0
- package/dashboard/dist-server/src/commands/delegate.js.map +1 -1
- package/dashboard/dist-server/src/config/paths.d.ts +1 -0
- package/dashboard/dist-server/src/config/paths.js +1 -0
- package/dashboard/dist-server/src/config/paths.js.map +1 -1
- package/dashboard/dist-server/src/tools/spec-entry-parser.d.ts +55 -0
- package/dashboard/dist-server/src/tools/spec-entry-parser.js +222 -0
- package/dashboard/dist-server/src/tools/spec-entry-parser.js.map +1 -0
- package/dashboard/dist-server/src/tools/spec-loader.d.ts +51 -0
- package/dashboard/dist-server/src/tools/spec-loader.js +267 -0
- package/dashboard/dist-server/src/tools/spec-loader.js.map +1 -0
- package/dist/src/agents/cli-agent-runner.d.ts +2 -0
- package/dist/src/agents/cli-agent-runner.d.ts.map +1 -1
- package/dist/src/agents/cli-agent-runner.js +62 -4
- package/dist/src/agents/cli-agent-runner.js.map +1 -1
- package/dist/src/cli.js +2 -0
- package/dist/src/cli.js.map +1 -1
- package/dist/src/commands/config-ui/ConfigSourcesView.d.ts +6 -0
- package/dist/src/commands/config-ui/ConfigSourcesView.d.ts.map +1 -0
- package/dist/src/commands/config-ui/ConfigSourcesView.js +25 -0
- package/dist/src/commands/config-ui/ConfigSourcesView.js.map +1 -0
- package/dist/src/commands/config-ui/SkillConfigDashboard.d.ts +9 -0
- package/dist/src/commands/config-ui/SkillConfigDashboard.d.ts.map +1 -0
- package/dist/src/commands/config-ui/SkillConfigDashboard.js +64 -0
- package/dist/src/commands/config-ui/SkillConfigDashboard.js.map +1 -0
- package/dist/src/commands/config-ui/SkillParamEditor.d.ts +12 -0
- package/dist/src/commands/config-ui/SkillParamEditor.d.ts.map +1 -0
- package/dist/src/commands/config-ui/SkillParamEditor.js +162 -0
- package/dist/src/commands/config-ui/SkillParamEditor.js.map +1 -0
- package/dist/src/commands/config-ui/SkillsList.d.ts +12 -0
- package/dist/src/commands/config-ui/SkillsList.d.ts.map +1 -0
- package/dist/src/commands/config-ui/SkillsList.js +91 -0
- package/dist/src/commands/config-ui/SkillsList.js.map +1 -0
- package/dist/src/commands/config.d.ts +8 -0
- package/dist/src/commands/config.d.ts.map +1 -0
- package/dist/src/commands/config.js +172 -0
- package/dist/src/commands/config.js.map +1 -0
- package/dist/src/commands/delegate.d.ts +2 -0
- package/dist/src/commands/delegate.d.ts.map +1 -1
- package/dist/src/commands/delegate.js +1 -0
- package/dist/src/commands/delegate.js.map +1 -1
- package/dist/src/config/argument-hint-parser.d.ts +49 -0
- package/dist/src/config/argument-hint-parser.d.ts.map +1 -0
- package/dist/src/config/argument-hint-parser.js +283 -0
- package/dist/src/config/argument-hint-parser.js.map +1 -0
- package/dist/src/config/paths.d.ts +1 -0
- package/dist/src/config/paths.d.ts.map +1 -1
- package/dist/src/config/paths.js +1 -0
- package/dist/src/config/paths.js.map +1 -1
- package/dist/src/config/skill-config.d.ts +56 -0
- package/dist/src/config/skill-config.d.ts.map +1 -0
- package/dist/src/config/skill-config.js +188 -0
- package/dist/src/config/skill-config.js.map +1 -0
- package/dist/src/hooks/skill-context.d.ts +12 -2
- package/dist/src/hooks/skill-context.d.ts.map +1 -1
- package/dist/src/hooks/skill-context.js +126 -39
- package/dist/src/hooks/skill-context.js.map +1 -1
- package/package.json +1 -1
- package/templates/cli/protocols/analysis-protocol.md +121 -121
- package/templates/cli/protocols/write-protocol.md +138 -138
- package/workflows/debug.md +35 -0
- package/workflows/execute.md +23 -0
- package/workflows/maestro-chain-execute.md +204 -0
- package/workflows/maestro.md +21 -99
- package/workflows/milestone-audit.md +28 -0
- package/workflows/plan.md +17 -0
- package/workflows/review.md +46 -0
- package/workflows/test-gen.md +28 -0
- package/workflows/verify.md +38 -0
|
@@ -1,138 +1,138 @@
|
|
|
1
|
-
# Write Mode Protocol
|
|
2
|
-
## Prompt Structure
|
|
3
|
-
|
|
4
|
-
```
|
|
5
|
-
PURPOSE: [development goal]
|
|
6
|
-
TASK: [specific implementation task]
|
|
7
|
-
MODE: [auto|write]
|
|
8
|
-
CONTEXT: [file patterns]
|
|
9
|
-
EXPECTED: [deliverables]
|
|
10
|
-
RULES: [templates | additional constraints]
|
|
11
|
-
```
|
|
12
|
-
## Operation Boundaries
|
|
13
|
-
|
|
14
|
-
### MODE: write
|
|
15
|
-
- **READ**: All CONTEXT files and analyze content
|
|
16
|
-
- **CREATE**: New files (documentation, code, configuration)
|
|
17
|
-
- **MODIFY**: Existing files (update content, refactor code)
|
|
18
|
-
- **DELETE**: Files when explicitly required
|
|
19
|
-
|
|
20
|
-
**Restrictions**: Follow project conventions, cannot break existing functionality
|
|
21
|
-
|
|
22
|
-
**Constraint**: Must test every change
|
|
23
|
-
|
|
24
|
-
## Execution Flow
|
|
25
|
-
|
|
26
|
-
### MODE: write
|
|
27
|
-
0. **
|
|
28
|
-
1. **Parse** all 6 fields (PURPOSE, TASK, MODE, CONTEXT, EXPECTED, RULES)
|
|
29
|
-
2. **Read** CONTEXT files, find 3+ similar patterns
|
|
30
|
-
3. **Plan** implementation following RULES
|
|
31
|
-
4. **Execute** requested file operations
|
|
32
|
-
5. **Validate** changes
|
|
33
|
-
6. **Report** file changes
|
|
34
|
-
|
|
35
|
-
## Core Requirements
|
|
36
|
-
|
|
37
|
-
**ALWAYS**:
|
|
38
|
-
-
|
|
39
|
-
- Study CONTEXT files - find 3+ similar patterns before implementing
|
|
40
|
-
- Apply RULES exactly
|
|
41
|
-
- Test continuously (auto mode)
|
|
42
|
-
- Commit incrementally (auto mode)
|
|
43
|
-
- Match project style exactly
|
|
44
|
-
- List all created/modified files at output beginning
|
|
45
|
-
|
|
46
|
-
**NEVER**:
|
|
47
|
-
- Make assumptions without code verification
|
|
48
|
-
- Ignore existing patterns
|
|
49
|
-
- Skip tests (auto mode)
|
|
50
|
-
- Use clever tricks over boring solutions
|
|
51
|
-
- Break backward compatibility
|
|
52
|
-
- Exceed 3 failed attempts without stopping
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
**Three-Attempt Rule**: On 3rd failure, stop and report what attempted, what failed, root cause
|
|
56
|
-
|
|
57
|
-
| Error Type | Response |
|
|
58
|
-
|------------|----------|
|
|
59
|
-
| Syntax/Type | Review → Fix → Re-run tests |
|
|
60
|
-
| Runtime | Analyze stack → Add handling → Test |
|
|
61
|
-
| Test Failure | Debug → Review setup → Fix |
|
|
62
|
-
| Build Failure | Check messages → Fix incrementally |
|
|
63
|
-
|
|
64
|
-
---
|
|
65
|
-
|
|
66
|
-
## Output Format
|
|
67
|
-
|
|
68
|
-
### Format Priority
|
|
69
|
-
|
|
70
|
-
**If template defines output format** → Follow template format EXACTLY
|
|
71
|
-
|
|
72
|
-
**If template has no format** → Use default format below
|
|
73
|
-
|
|
74
|
-
### Task Implementation
|
|
75
|
-
|
|
76
|
-
```markdown
|
|
77
|
-
# Implementation: [TASK Title]
|
|
78
|
-
|
|
79
|
-
## Changes
|
|
80
|
-
- Created: `path/to/file1.ext` (X lines)
|
|
81
|
-
- Modified: `path/to/file2.ext` (+Y/-Z lines)
|
|
82
|
-
- Deleted: `path/to/file3.ext`
|
|
83
|
-
|
|
84
|
-
## Summary
|
|
85
|
-
[2-3 sentence overview]
|
|
86
|
-
|
|
87
|
-
## Key Decisions
|
|
88
|
-
1. [Decision] - Rationale and reference to similar pattern
|
|
89
|
-
2. [Decision] - path/to/reference:line
|
|
90
|
-
|
|
91
|
-
## Implementation Details
|
|
92
|
-
[Evidence-based description with code references]
|
|
93
|
-
|
|
94
|
-
## Testing
|
|
95
|
-
- Tests written: X new tests
|
|
96
|
-
- Tests passing: Y/Z tests
|
|
97
|
-
|
|
98
|
-
## Validation
|
|
99
|
-
✅ Tests: X passing
|
|
100
|
-
✅ Build: Success
|
|
101
|
-
|
|
102
|
-
## Next Steps
|
|
103
|
-
[Recommendations if any]
|
|
104
|
-
```
|
|
105
|
-
|
|
106
|
-
### Partial Completion
|
|
107
|
-
|
|
108
|
-
```markdown
|
|
109
|
-
# Task Status: Partially Completed
|
|
110
|
-
|
|
111
|
-
## Completed
|
|
112
|
-
- [What worked]
|
|
113
|
-
- Files: `path/to/completed.ext`
|
|
114
|
-
|
|
115
|
-
## Blocked
|
|
116
|
-
- **Issue**: [What failed]
|
|
117
|
-
- **Root Cause**: [Analysis]
|
|
118
|
-
- **Attempted**: [Solutions tried - attempt X of 3]
|
|
119
|
-
|
|
120
|
-
## Required
|
|
121
|
-
[What's needed to proceed]
|
|
122
|
-
|
|
123
|
-
## Recommendation
|
|
124
|
-
[Suggested next steps]
|
|
125
|
-
```
|
|
126
|
-
|
|
127
|
-
### Code References
|
|
128
|
-
|
|
129
|
-
**Format**: `path/to/file:line_number`
|
|
130
|
-
**Example**: `src/auth/jwt.ts:45` - Implemented following pattern from `src/auth/session.ts:78`
|
|
131
|
-
|
|
132
|
-
### Quality Checklist
|
|
133
|
-
|
|
134
|
-
- [ ] All tests pass
|
|
135
|
-
- [ ] Build succeeds
|
|
136
|
-
- [ ] All EXPECTED deliverables met
|
|
137
|
-
- [ ] Code follows existing patterns
|
|
138
|
-
- [ ] File changes listed at beginning
|
|
1
|
+
# Write Mode Protocol
|
|
2
|
+
## Prompt Structure
|
|
3
|
+
|
|
4
|
+
```
|
|
5
|
+
PURPOSE: [development goal]
|
|
6
|
+
TASK: [specific implementation task]
|
|
7
|
+
MODE: [auto|write]
|
|
8
|
+
CONTEXT: [file patterns]
|
|
9
|
+
EXPECTED: [deliverables]
|
|
10
|
+
RULES: [templates | additional constraints]
|
|
11
|
+
```
|
|
12
|
+
## Operation Boundaries
|
|
13
|
+
|
|
14
|
+
### MODE: write
|
|
15
|
+
- **READ**: All CONTEXT files and analyze content
|
|
16
|
+
- **CREATE**: New files (documentation, code, configuration)
|
|
17
|
+
- **MODIFY**: Existing files (update content, refactor code)
|
|
18
|
+
- **DELETE**: Files when explicitly required
|
|
19
|
+
|
|
20
|
+
**Restrictions**: Follow project conventions, cannot break existing functionality
|
|
21
|
+
|
|
22
|
+
**Constraint**: Must test every change
|
|
23
|
+
|
|
24
|
+
## Execution Flow
|
|
25
|
+
|
|
26
|
+
### MODE: write
|
|
27
|
+
0. **Apply Project Specs** - Review the `[PROJECT SPECS]` section (pre-loaded in this prompt) and apply specs to guide coding standards, architecture decisions, and quality gates
|
|
28
|
+
1. **Parse** all 6 fields (PURPOSE, TASK, MODE, CONTEXT, EXPECTED, RULES)
|
|
29
|
+
2. **Read** CONTEXT files, find 3+ similar patterns
|
|
30
|
+
3. **Plan** implementation following RULES
|
|
31
|
+
4. **Execute** requested file operations
|
|
32
|
+
5. **Validate** changes
|
|
33
|
+
6. **Report** file changes
|
|
34
|
+
|
|
35
|
+
## Core Requirements
|
|
36
|
+
|
|
37
|
+
**ALWAYS**:
|
|
38
|
+
- Apply `[PROJECT SPECS]` constraints (pre-loaded in prompt) to guide implementation
|
|
39
|
+
- Study CONTEXT files - find 3+ similar patterns before implementing
|
|
40
|
+
- Apply RULES exactly
|
|
41
|
+
- Test continuously (auto mode)
|
|
42
|
+
- Commit incrementally (auto mode)
|
|
43
|
+
- Match project style exactly
|
|
44
|
+
- List all created/modified files at output beginning
|
|
45
|
+
|
|
46
|
+
**NEVER**:
|
|
47
|
+
- Make assumptions without code verification
|
|
48
|
+
- Ignore existing patterns
|
|
49
|
+
- Skip tests (auto mode)
|
|
50
|
+
- Use clever tricks over boring solutions
|
|
51
|
+
- Break backward compatibility
|
|
52
|
+
- Exceed 3 failed attempts without stopping
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
**Three-Attempt Rule**: On 3rd failure, stop and report what attempted, what failed, root cause
|
|
56
|
+
|
|
57
|
+
| Error Type | Response |
|
|
58
|
+
|------------|----------|
|
|
59
|
+
| Syntax/Type | Review → Fix → Re-run tests |
|
|
60
|
+
| Runtime | Analyze stack → Add handling → Test |
|
|
61
|
+
| Test Failure | Debug → Review setup → Fix |
|
|
62
|
+
| Build Failure | Check messages → Fix incrementally |
|
|
63
|
+
|
|
64
|
+
---
|
|
65
|
+
|
|
66
|
+
## Output Format
|
|
67
|
+
|
|
68
|
+
### Format Priority
|
|
69
|
+
|
|
70
|
+
**If template defines output format** → Follow template format EXACTLY
|
|
71
|
+
|
|
72
|
+
**If template has no format** → Use default format below
|
|
73
|
+
|
|
74
|
+
### Task Implementation
|
|
75
|
+
|
|
76
|
+
```markdown
|
|
77
|
+
# Implementation: [TASK Title]
|
|
78
|
+
|
|
79
|
+
## Changes
|
|
80
|
+
- Created: `path/to/file1.ext` (X lines)
|
|
81
|
+
- Modified: `path/to/file2.ext` (+Y/-Z lines)
|
|
82
|
+
- Deleted: `path/to/file3.ext`
|
|
83
|
+
|
|
84
|
+
## Summary
|
|
85
|
+
[2-3 sentence overview]
|
|
86
|
+
|
|
87
|
+
## Key Decisions
|
|
88
|
+
1. [Decision] - Rationale and reference to similar pattern
|
|
89
|
+
2. [Decision] - path/to/reference:line
|
|
90
|
+
|
|
91
|
+
## Implementation Details
|
|
92
|
+
[Evidence-based description with code references]
|
|
93
|
+
|
|
94
|
+
## Testing
|
|
95
|
+
- Tests written: X new tests
|
|
96
|
+
- Tests passing: Y/Z tests
|
|
97
|
+
|
|
98
|
+
## Validation
|
|
99
|
+
✅ Tests: X passing
|
|
100
|
+
✅ Build: Success
|
|
101
|
+
|
|
102
|
+
## Next Steps
|
|
103
|
+
[Recommendations if any]
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
### Partial Completion
|
|
107
|
+
|
|
108
|
+
```markdown
|
|
109
|
+
# Task Status: Partially Completed
|
|
110
|
+
|
|
111
|
+
## Completed
|
|
112
|
+
- [What worked]
|
|
113
|
+
- Files: `path/to/completed.ext`
|
|
114
|
+
|
|
115
|
+
## Blocked
|
|
116
|
+
- **Issue**: [What failed]
|
|
117
|
+
- **Root Cause**: [Analysis]
|
|
118
|
+
- **Attempted**: [Solutions tried - attempt X of 3]
|
|
119
|
+
|
|
120
|
+
## Required
|
|
121
|
+
[What's needed to proceed]
|
|
122
|
+
|
|
123
|
+
## Recommendation
|
|
124
|
+
[Suggested next steps]
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
### Code References
|
|
128
|
+
|
|
129
|
+
**Format**: `path/to/file:line_number`
|
|
130
|
+
**Example**: `src/auth/jwt.ts:45` - Implemented following pattern from `src/auth/session.ts:78`
|
|
131
|
+
|
|
132
|
+
### Quality Checklist
|
|
133
|
+
|
|
134
|
+
- [ ] All tests pass
|
|
135
|
+
- [ ] Build succeeds
|
|
136
|
+
- [ ] All EXPECTED deliverables met
|
|
137
|
+
- [ ] Code follows existing patterns
|
|
138
|
+
- [ ] File changes listed at beginning
|
package/workflows/debug.md
CHANGED
|
@@ -144,6 +144,41 @@ All agents run concurrently. Collect all results.
|
|
|
144
144
|
|
|
145
145
|
---
|
|
146
146
|
|
|
147
|
+
### Step 5.5: CLI Supplementary Evidence Gathering (optional)
|
|
148
|
+
|
|
149
|
+
**Purpose:** Use external CLI tool for broad codebase evidence collection before spawning debug agents. Provides agents with richer context without consuming their token budget on exploration.
|
|
150
|
+
|
|
151
|
+
**Skip if** no enabled CLI tools or standalone mode with minimal context.
|
|
152
|
+
|
|
153
|
+
```
|
|
154
|
+
IF no CLI tools enabled: skip to Step 6
|
|
155
|
+
|
|
156
|
+
# Build evidence request from symptoms
|
|
157
|
+
symptom_summary = symptoms or gap descriptions, concatenated
|
|
158
|
+
|
|
159
|
+
Bash({
|
|
160
|
+
command: 'maestro delegate "PURPOSE: Gather codebase evidence related to a bug investigation
|
|
161
|
+
TASK: Trace call chains for affected functions | Find recent changes to related files | Identify error handling gaps | Check for similar patterns elsewhere
|
|
162
|
+
MODE: analysis
|
|
163
|
+
CONTEXT: @${affected_files or scoped_path}/**/*
|
|
164
|
+
EXPECTED: JSON { call_chains: [{ entry, chain: [file:line...] }], recent_changes: [{ file, commits: [...] }], error_gaps: [{ file, line, description }], similar_patterns: [{ file, line, description }] }
|
|
165
|
+
CONSTRAINTS: Focus on code paths related to the symptoms | Max 20 entries per category
|
|
166
|
+
|
|
167
|
+
Symptoms: ${symptom_summary}
|
|
168
|
+
" --role explore --mode analysis',
|
|
169
|
+
run_in_background: true
|
|
170
|
+
})
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
**On callback:**
|
|
174
|
+
```
|
|
175
|
+
cli_evidence = maestro delegate output <id>
|
|
176
|
+
Parse and append to evidence.ndjson with type: "cli-exploration"
|
|
177
|
+
Pass cli_evidence as supplementary_context to debug agent prompts in Step 5/6
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
---
|
|
181
|
+
|
|
147
182
|
### Step 6: Spawn Single Debug Agent (sequential mode)
|
|
148
183
|
|
|
149
184
|
Spawn general-purpose agent (`run_in_background: false`) with:
|
package/workflows/execute.md
CHANGED
|
@@ -336,6 +336,29 @@ If constraints exist:
|
|
|
336
336
|
Scan each for disallowed import patterns → critical "tech_stack_violation" per match
|
|
337
337
|
```
|
|
338
338
|
|
|
339
|
+
### Check 4: CLI Supplementary Validation (optional)
|
|
340
|
+
|
|
341
|
+
**Purpose:** Use external CLI tool for semantic validation that structural checks miss — dead code, unused exports, circular dependencies introduced by execution.
|
|
342
|
+
|
|
343
|
+
```
|
|
344
|
+
IF no CLI tools enabled OR completed_tasks.length == 0: skip
|
|
345
|
+
|
|
346
|
+
modified_files = collect all files modified by completed tasks
|
|
347
|
+
|
|
348
|
+
Bash({
|
|
349
|
+
command: 'maestro delegate "PURPOSE: Validate execution output for semantic issues
|
|
350
|
+
TASK: Check for circular dependency introduction | Detect dead code / unused exports | Verify public API consistency (no breaking changes to existing exports)
|
|
351
|
+
MODE: analysis
|
|
352
|
+
CONTEXT: @${modified_files as glob}
|
|
353
|
+
EXPECTED: JSON { circular_deps: [{ cycle: [file...] }], dead_code: [{ file, line, symbol }], breaking_changes: [{ file, export_name, change_type }] }
|
|
354
|
+
CONSTRAINTS: Only check modified files and their direct importers | severity = critical for breaking_changes, warning for others
|
|
355
|
+
" --role analyze --mode analysis',
|
|
356
|
+
run_in_background: true
|
|
357
|
+
})
|
|
358
|
+
```
|
|
359
|
+
|
|
360
|
+
**On callback:** Parse result. Append critical-severity items to violations list. Log warnings separately.
|
|
361
|
+
|
|
339
362
|
### Gate Logic
|
|
340
363
|
|
|
341
364
|
```
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
# Workflow: maestro-chain-execute
|
|
2
|
+
|
|
3
|
+
Upgraded version of maestro's original direct execution strategy.
|
|
4
|
+
Reads session status.json, loops through steps with per-step engine selection,
|
|
5
|
+
context propagation, post-step Gemini analysis, and error handling.
|
|
6
|
+
Tracks all progress via status.json (the JSON file created during selection).
|
|
7
|
+
|
|
8
|
+
**Prerequisites:**
|
|
9
|
+
- Session directory with valid status.json (status: "running", pending steps)
|
|
10
|
+
- $SESSION_PATH passed from maestro.md dispatch
|
|
11
|
+
|
|
12
|
+
## Step 1: Load Session
|
|
13
|
+
|
|
14
|
+
Read status.json from `$SESSION_PATH`.
|
|
15
|
+
|
|
16
|
+
Extract: `session_id`, `chain_name`, `steps[]`, `context`, `auto_mode`, `exec_mode`, `cli_tool`, `gemini_session_id`.
|
|
17
|
+
|
|
18
|
+
Set `$STEP_INDEX` = `current_step` (first pending step).
|
|
19
|
+
|
|
20
|
+
Validate: `status == "running"` and at least one pending step exists.
|
|
21
|
+
|
|
22
|
+
Display banner:
|
|
23
|
+
|
|
24
|
+
```
|
|
25
|
+
============================================================
|
|
26
|
+
CHAIN EXECUTOR
|
|
27
|
+
============================================================
|
|
28
|
+
Session: {session_id}
|
|
29
|
+
Chain: {chain_name}
|
|
30
|
+
Steps: {completed}/{total} done, starting from step {$STEP_INDEX}
|
|
31
|
+
Auto: {auto_mode}
|
|
32
|
+
Exec: {exec_mode}
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Step 2: Context & Argument Assembly
|
|
36
|
+
|
|
37
|
+
Initialize context object from `status.json.context`:
|
|
38
|
+
|
|
39
|
+
```
|
|
40
|
+
context = {
|
|
41
|
+
current_phase, // from status.json.context or top-level phase
|
|
42
|
+
user_intent, // from status.json.context or top-level intent
|
|
43
|
+
issue_id,
|
|
44
|
+
spec_session_id,
|
|
45
|
+
scratch_dir,
|
|
46
|
+
auto_mode // from status.json.auto_mode
|
|
47
|
+
}
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
### assembleArgs(step)
|
|
51
|
+
|
|
52
|
+
```
|
|
53
|
+
1. Substitute placeholders in step.args:
|
|
54
|
+
{phase} → context.current_phase
|
|
55
|
+
{description} → context.user_intent
|
|
56
|
+
{issue_id} → context.issue_id
|
|
57
|
+
{spec_session_id} → context.spec_session_id
|
|
58
|
+
{scratch_dir} → context.scratch_dir
|
|
59
|
+
|
|
60
|
+
2. In auto_mode, append per-command flag if not already present:
|
|
61
|
+
maestro-analyze / maestro-brainstorm / maestro-roadmap / maestro-ui-design → -y
|
|
62
|
+
maestro-plan → --auto
|
|
63
|
+
quality-test → --auto-fix
|
|
64
|
+
quality-retrospective → --auto-yes
|
|
65
|
+
|
|
66
|
+
3. Shell-escape strings with single quotes for CLI delegate calls.
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## Step 3: Step Loop
|
|
70
|
+
|
|
71
|
+
For each step starting at `$STEP_INDEX`:
|
|
72
|
+
|
|
73
|
+
### 3a. Select engine & display banner
|
|
74
|
+
|
|
75
|
+
Per-step engine selection:
|
|
76
|
+
|
|
77
|
+
```
|
|
78
|
+
If exec_mode is 'cli' or 'skill' → force that engine for all steps.
|
|
79
|
+
|
|
80
|
+
In 'auto' mode, select per step:
|
|
81
|
+
CLI steps (heavy, context-isolated):
|
|
82
|
+
maestro-plan, maestro-execute, maestro-analyze, maestro-brainstorm,
|
|
83
|
+
maestro-roadmap, maestro-ui-design, quality-refactor
|
|
84
|
+
|
|
85
|
+
Skill steps (observable, interactive, lightweight):
|
|
86
|
+
everything else — verify, review, test, debug, milestone-*,
|
|
87
|
+
manage-*, spec-*, quick, etc.
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
Display: `[Step {N}/{total}] /{cmd} [{engine}] — {args}`
|
|
91
|
+
|
|
92
|
+
Update status.json: step `status = "running"`, `engine`, `started_at`.
|
|
93
|
+
|
|
94
|
+
Context window hint:
|
|
95
|
+
- Step >= 4 and not autoYes: hint user about `/maestro -c` for fresh context resume.
|
|
96
|
+
- autoYes and step >= 5: log warning to status.json.
|
|
97
|
+
|
|
98
|
+
### 3b. Execute (engine-dependent)
|
|
99
|
+
|
|
100
|
+
**Skill engine** — invoke directly (synchronous, visible):
|
|
101
|
+
|
|
102
|
+
```
|
|
103
|
+
Skill({ skill: step.cmd, args: assembledArgs })
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
**CLI engine** — template-driven, async, context-isolated:
|
|
107
|
+
|
|
108
|
+
```
|
|
109
|
+
1. Load template ~/.maestro/templates/cli/prompts/coordinate-step.txt
|
|
110
|
+
2. Build analysisHints from previous step's next_step_hints
|
|
111
|
+
(prompt_additions, cautions, context_to_carry)
|
|
112
|
+
3. Substitute template placeholders:
|
|
113
|
+
{{COMMAND}}, {{ARGS}}, {{STEP_N}}, {{AUTO_DIRECTIVE}},
|
|
114
|
+
{{CHAIN_NAME}}, {{ANALYSIS_HINTS}}
|
|
115
|
+
4. Run:
|
|
116
|
+
Bash(maestro delegate "<prompt>" --to {cli_tool} --mode write,
|
|
117
|
+
run_in_background: true, timeout: 600000)
|
|
118
|
+
5. **STOP** — wait for background callback
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
### 3c. Parse output & update context
|
|
122
|
+
|
|
123
|
+
Scan step output for context propagation:
|
|
124
|
+
|
|
125
|
+
```
|
|
126
|
+
PHASE: N → context.current_phase
|
|
127
|
+
SPEC-xxx → context.spec_session_id
|
|
128
|
+
scratch_dir: path → context.scratch_dir
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
CLI: capture `exec_id` from stderr `[MAESTRO_EXEC_ID=<id>]`.
|
|
132
|
+
|
|
133
|
+
**Persist context back to status.json** after each step — write updated `context` field and `current_step`. This enables resume via `/maestro -c`.
|
|
134
|
+
|
|
135
|
+
### 3d. Handle result
|
|
136
|
+
|
|
137
|
+
**Success:** mark step `status = "completed"`, set `completed_at` in status.json.
|
|
138
|
+
CLI: save output to `step-{N}-output.txt` in session directory.
|
|
139
|
+
|
|
140
|
+
**Failure:**
|
|
141
|
+
- `auto_mode` → retry once, then skip (mark `"skipped"`).
|
|
142
|
+
- Interactive → offer: Retry (max 2) / Skip / Abort.
|
|
143
|
+
- Abort → **Error E003** — update status.json `status = "aborted"`, display resume hint: `/maestro -c`.
|
|
144
|
+
|
|
145
|
+
### 3e. Post-step analysis (CLI steps only)
|
|
146
|
+
|
|
147
|
+
Skip if: step failed/skipped, or `engine == 'skill'`.
|
|
148
|
+
|
|
149
|
+
Delegate to gemini (analysis mode, `--resume` if `gemini_session_id` exists) with prompt containing:
|
|
150
|
+
- Step command, args, chain name, intent
|
|
151
|
+
- Last 200 lines of step output
|
|
152
|
+
- Next step info (command, args) if any
|
|
153
|
+
|
|
154
|
+
Expected JSON response:
|
|
155
|
+
|
|
156
|
+
```json
|
|
157
|
+
{
|
|
158
|
+
"quality_score": "<0-100>",
|
|
159
|
+
"execution_assessment": {
|
|
160
|
+
"success": "<bool>",
|
|
161
|
+
"completeness": "<full|partial|minimal>",
|
|
162
|
+
"key_outputs": [],
|
|
163
|
+
"missing_outputs": []
|
|
164
|
+
},
|
|
165
|
+
"issues": [
|
|
166
|
+
{ "severity": "critical|high|medium|low", "description": "" }
|
|
167
|
+
],
|
|
168
|
+
"next_step_hints": {
|
|
169
|
+
"prompt_additions": "<extra context for next step>",
|
|
170
|
+
"cautions": ["<things to watch out for>"],
|
|
171
|
+
"context_to_carry": "<key facts from this step>"
|
|
172
|
+
},
|
|
173
|
+
"step_summary": ""
|
|
174
|
+
}
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
On callback:
|
|
178
|
+
1. Capture gemini `exec_id` → store as `gemini_session_id` in status.json for session continuity.
|
|
179
|
+
2. Store analysis in `step_analyses[]` and `step-{N}-analysis.json` in session directory.
|
|
180
|
+
3. Advance to next step (**3a**).
|
|
181
|
+
|
|
182
|
+
## Step 4: Completion Report
|
|
183
|
+
|
|
184
|
+
Update status.json: `status = "completed"`.
|
|
185
|
+
|
|
186
|
+
```
|
|
187
|
+
============================================================
|
|
188
|
+
MAESTRO SESSION COMPLETE
|
|
189
|
+
============================================================
|
|
190
|
+
Session: {session_id}
|
|
191
|
+
Chain: {chain_name}
|
|
192
|
+
Steps: {completed}/{total} completed
|
|
193
|
+
Phase: {context.current_phase}
|
|
194
|
+
|
|
195
|
+
Results:
|
|
196
|
+
[✓] 1. maestro-plan — completed [cli] (quality: 85/100)
|
|
197
|
+
[✓] 2. maestro-verify — completed [skill]
|
|
198
|
+
[—] 3. quality-review — skipped [skill]
|
|
199
|
+
|
|
200
|
+
CLI Avg Quality: {avgScore}/100 (based on {cliStepCount} cli steps)
|
|
201
|
+
|
|
202
|
+
Next: /maestro continue | /manage-status
|
|
203
|
+
============================================================
|
|
204
|
+
```
|