pi-maestro-flow 0.2.0
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/README.md +124 -0
- package/agents/aggregator.md +27 -0
- package/agents/cli-explore-agent.md +188 -0
- package/agents/cross-role-reviewer.md +171 -0
- package/agents/delegate.md +19 -0
- package/agents/explorer.md +23 -0
- package/agents/impeccable-agent.md +99 -0
- package/agents/ralph-executor.md +81 -0
- package/agents/reference.md +24 -0
- package/agents/role-design-author.md +220 -0
- package/agents/team-supervisor.md +143 -0
- package/agents/team-worker.md +237 -0
- package/agents/ui-design-agent.md +270 -0
- package/agents/workflow-analyzer.md +116 -0
- package/agents/workflow-codebase-mapper.md +77 -0
- package/agents/workflow-collab-planner.md +147 -0
- package/agents/workflow-debugger.md +104 -0
- package/agents/workflow-executor.md +133 -0
- package/agents/workflow-external-researcher.md +86 -0
- package/agents/workflow-integration-checker.md +83 -0
- package/agents/workflow-nyquist-auditor.md +85 -0
- package/agents/workflow-phase-researcher.md +85 -0
- package/agents/workflow-plan-checker.md +100 -0
- package/agents/workflow-planner.md +200 -0
- package/agents/workflow-project-researcher.md +74 -0
- package/agents/workflow-research-synthesizer.md +70 -0
- package/agents/workflow-reviewer.md +82 -0
- package/agents/workflow-roadmapper.md +81 -0
- package/agents/workflow-verifier.md +120 -0
- package/package.json +58 -0
- package/skills/codify-to-knowhow/SKILL.md +167 -0
- package/skills/delegation-check/SKILL.md +297 -0
- package/skills/domain-add/SKILL.md +75 -0
- package/skills/insight-challenge/SKILL.md +226 -0
- package/skills/learn-decompose/SKILL.md +124 -0
- package/skills/learn-follow/SKILL.md +163 -0
- package/skills/learn-investigate/SKILL.md +160 -0
- package/skills/learn-second-opinion/SKILL.md +128 -0
- package/skills/maestro/SKILL.md +239 -0
- package/skills/maestro-amend/SKILL.md +169 -0
- package/skills/maestro-analyze/SKILL.md +173 -0
- package/skills/maestro-blueprint/SKILL.md +159 -0
- package/skills/maestro-brainstorm/SKILL.md +193 -0
- package/skills/maestro-collab/SKILL.md +181 -0
- package/skills/maestro-companion/SKILL.md +536 -0
- package/skills/maestro-composer/SKILL.md +192 -0
- package/skills/maestro-execute/SKILL.md +193 -0
- package/skills/maestro-fork/SKILL.md +104 -0
- package/skills/maestro-grill/SKILL.md +151 -0
- package/skills/maestro-guard/SKILL.md +124 -0
- package/skills/maestro-help/SKILL.md +328 -0
- package/skills/maestro-impeccable/SKILL.md +302 -0
- package/skills/maestro-init/SKILL.md +151 -0
- package/skills/maestro-merge/SKILL.md +90 -0
- package/skills/maestro-milestone-audit/SKILL.md +117 -0
- package/skills/maestro-milestone-complete/SKILL.md +133 -0
- package/skills/maestro-milestone-release/SKILL.md +131 -0
- package/skills/maestro-next/SKILL.md +269 -0
- package/skills/maestro-overlay/SKILL.md +203 -0
- package/skills/maestro-plan/SKILL.md +194 -0
- package/skills/maestro-player/SKILL.md +184 -0
- package/skills/maestro-quick/SKILL.md +117 -0
- package/skills/maestro-ralph/SKILL.md +905 -0
- package/skills/maestro-ralph-cli/SKILL.md +976 -0
- package/skills/maestro-ralph-cli-execute/SKILL.md +229 -0
- package/skills/maestro-ralph-execute/SKILL.md +409 -0
- package/skills/maestro-ralph-v2/SKILL.md +1198 -0
- package/skills/maestro-roadmap/SKILL.md +157 -0
- package/skills/maestro-swarm-workflow/SKILL.md +272 -0
- package/skills/maestro-tools-execute/SKILL.md +143 -0
- package/skills/maestro-tools-register/SKILL.md +192 -0
- package/skills/maestro-ui-codify/SKILL.md +127 -0
- package/skills/maestro-universal-workflow/SKILL.md +622 -0
- package/skills/maestro-update/SKILL.md +156 -0
- package/skills/manage-codebase-rebuild/SKILL.md +111 -0
- package/skills/manage-drift-realign/SKILL.md +159 -0
- package/skills/manage-harvest/SKILL.md +121 -0
- package/skills/manage-issue/SKILL.md +88 -0
- package/skills/manage-issue-discover/SKILL.md +104 -0
- package/skills/manage-kg-extractors/SKILL.md +147 -0
- package/skills/manage-knowhow/SKILL.md +102 -0
- package/skills/manage-knowhow-capture/SKILL.md +109 -0
- package/skills/manage-knowledge-audit/SKILL.md +147 -0
- package/skills/manage-status/SKILL.md +80 -0
- package/skills/manage-wiki/SKILL.md +104 -0
- package/skills/odyssey-debug/SKILL.md +344 -0
- package/skills/odyssey-improve/SKILL.md +423 -0
- package/skills/odyssey-planex/SKILL.md +542 -0
- package/skills/odyssey-review-test-fix/SKILL.md +392 -0
- package/skills/odyssey-ui/SKILL.md +388 -0
- package/skills/prompt-generator/SKILL.md +470 -0
- package/skills/quality-auto-test/SKILL.md +168 -0
- package/skills/quality-debug/SKILL.md +176 -0
- package/skills/quality-refactor/SKILL.md +108 -0
- package/skills/quality-retrospective/SKILL.md +134 -0
- package/skills/quality-review/SKILL.md +169 -0
- package/skills/quality-sync/SKILL.md +90 -0
- package/skills/quality-test/SKILL.md +183 -0
- package/skills/scholar-anti-ai-writing/SKILL.md +173 -0
- package/skills/scholar-anti-ai-writing/references/patterns-chinese.md +242 -0
- package/skills/scholar-anti-ai-writing/references/patterns-english.md +242 -0
- package/skills/scholar-citation-verify/SKILL.md +166 -0
- package/skills/scholar-citation-verify/references/api-usage.md +372 -0
- package/skills/scholar-citation-verify/references/common-errors.md +384 -0
- package/skills/scholar-citation-verify/references/verification-rules.md +399 -0
- package/skills/scholar-experiment/SKILL.md +321 -0
- package/skills/scholar-ideation/SKILL.md +288 -0
- package/skills/scholar-latex-organizer/SKILL.md +186 -0
- package/skills/scholar-publish/SKILL.md +220 -0
- package/skills/scholar-rebuttal-pro/README.md +313 -0
- package/skills/scholar-rebuttal-pro/SKILL.md +511 -0
- package/skills/scholar-review/SKILL.md +227 -0
- package/skills/scholar-thesis-docx/README.md +111 -0
- package/skills/scholar-thesis-docx/README_EN.md +108 -0
- package/skills/scholar-thesis-docx/SKILL.md +212 -0
- package/skills/scholar-thesis-docx/references/failure-patterns-and-quality-gates.md +178 -0
- package/skills/scholar-thesis-docx/references/figure-and-code-rules.md +33 -0
- package/skills/scholar-thesis-docx/references/paper-format-workflow.md +68 -0
- package/skills/scholar-thesis-docx/references/script-usage.md +157 -0
- package/skills/scholar-thesis-docx/scripts/audit_docx_ooxml.py +429 -0
- package/skills/scholar-thesis-docx/scripts/check_word_com.ps1 +50 -0
- package/skills/scholar-thesis-docx/scripts/export_word_pdf.ps1 +62 -0
- package/skills/scholar-thesis-docx/scripts/normalize_word_styles.ps1 +498 -0
- package/skills/scholar-thesis-docx/scripts/render_mermaid_figure.ps1 +148 -0
- package/skills/scholar-writing/SKILL.md +296 -0
- package/skills/security-audit/SKILL.md +244 -0
- package/skills/skill-generator/SKILL.md +472 -0
- package/skills/skill-iter-tune/SKILL.md +382 -0
- package/skills/skill-simplify/SKILL.md +63 -0
- package/skills/skill-tuning/SKILL.md +174 -0
- package/skills/spec-add/SKILL.md +105 -0
- package/skills/spec-load/SKILL.md +98 -0
- package/skills/spec-remove/SKILL.md +74 -0
- package/skills/spec-setup/SKILL.md +75 -0
- package/skills/team-adversarial-swarm/SKILL.md +233 -0
- package/skills/team-adversarial-swarm/scripts/__pycache__/pheromone.cpython-313.pyc +0 -0
- package/skills/team-adversarial-swarm/scripts/__pycache__/scoring.cpython-313.pyc +0 -0
- package/skills/team-adversarial-swarm/scripts/aco.py +473 -0
- package/skills/team-adversarial-swarm/scripts/pheromone.py +144 -0
- package/skills/team-adversarial-swarm/scripts/scoring.py +92 -0
- package/skills/team-adversarial-swarm/scripts/test_aco.py +475 -0
- package/skills/team-arch-opt/SKILL.md +158 -0
- package/skills/team-brainstorm/SKILL.md +171 -0
- package/skills/team-coordinate/SKILL.md +266 -0
- package/skills/team-designer/SKILL.md +160 -0
- package/skills/team-executor/SKILL.md +189 -0
- package/skills/team-frontend/SKILL.md +136 -0
- package/skills/team-frontend-debug/SKILL.md +198 -0
- package/skills/team-interactive-craft/SKILL.md +141 -0
- package/skills/team-issue/SKILL.md +171 -0
- package/skills/team-lifecycle-v4/SKILL.md +209 -0
- package/skills/team-motion-design/SKILL.md +142 -0
- package/skills/team-perf-opt/SKILL.md +175 -0
- package/skills/team-planex/SKILL.md +137 -0
- package/skills/team-quality-assurance/SKILL.md +147 -0
- package/skills/team-review/SKILL.md +147 -0
- package/skills/team-roadmap-dev/SKILL.md +169 -0
- package/skills/team-swarm/SKILL.md +178 -0
- package/skills/team-swarm/scripts/aco.py +473 -0
- package/skills/team-swarm/scripts/pheromone.py +144 -0
- package/skills/team-swarm/scripts/scoring.py +92 -0
- package/skills/team-swarm/scripts/test_aco.py +475 -0
- package/skills/team-tech-debt/SKILL.md +128 -0
- package/skills/team-testing/SKILL.md +143 -0
- package/skills/team-ui-polish/SKILL.md +141 -0
- package/skills/team-uidesign/SKILL.md +144 -0
- package/skills/team-ultra-analyze/SKILL.md +173 -0
- package/skills/team-ux-improve/SKILL.md +151 -0
- package/skills/team-visual-a11y/SKILL.md +156 -0
- package/skills/workflow-skill-designer/SKILL.md +496 -0
- package/src/extension/index.ts +222 -0
- package/src/extension/schemas.ts +131 -0
- package/src/providers/cli-tools-loader.ts +74 -0
- package/src/providers/provider-registry.ts +130 -0
- package/src/tools/delegate.ts +85 -0
- package/src/tools/explore.ts +134 -0
- package/src/tools/moa.ts +213 -0
- package/src/tools/status.ts +99 -0
- package/src/tools/wait.ts +166 -0
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: maestro-overlay
|
|
3
|
+
description: "Create or edit command overlays from natural language Arguments: <intent> — 描述要添加的规则或步骤,如 'always verify after execute'"
|
|
4
|
+
allowed-tools: Read Write Bash Glob Grep AskUserQuestion
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
<purpose>
|
|
8
|
+
Turn natural-language instructions into command overlays — JSON patch files that augment
|
|
9
|
+
`.claude/commands/*.md` non-invasively. Auto-applied by `maestro install`.
|
|
10
|
+
</purpose>
|
|
11
|
+
|
|
12
|
+
<required_reading>
|
|
13
|
+
@~/.maestro/workflows/overlays.md
|
|
14
|
+
@~/.maestro/cli-tools.json
|
|
15
|
+
</required_reading>
|
|
16
|
+
|
|
17
|
+
<context>
|
|
18
|
+
**Overlay model**:
|
|
19
|
+
- JSON file: `name`, `targets[]` (command names), `patches[]`
|
|
20
|
+
- Patch: `section` (XML tag), `mode` (append/prepend/replace/new-section), `content`
|
|
21
|
+
- Apply: hashed HTML-comment markers (idempotent, surgical removal)
|
|
22
|
+
|
|
23
|
+
**Where overlays live**
|
|
24
|
+
- User overlays: `~/.maestro/overlays/*.json` — created by this skill
|
|
25
|
+
- Shared docs: `~/.maestro/overlays/docs/*.md` — referenced via `@~/.maestro/overlays/docs/*.md` inside patch content
|
|
26
|
+
- Shipped examples: `~/.maestro/overlays/_shipped/` — read-only, do not edit
|
|
27
|
+
|
|
28
|
+
**Management** — listing and removing overlays is handled by `maestro overlay list` (ink TUI with interactive delete). This skill focuses solely on creation.
|
|
29
|
+
|
|
30
|
+
**Available sections** (for `section:` in patches): `purpose`, `required_reading`, `deferred_reading`, `context`, `execution`, `completion`, `invariants`, `error_codes`, `success_criteria`.
|
|
31
|
+
|
|
32
|
+
**Output boundary**: ALL file writes MUST target `~/.maestro/overlays/` (overlay JSON + docs) only. Command file patching is handled by `maestro overlay add` — this skill NEVER modifies `.claude/commands/*.md` directly.
|
|
33
|
+
</context>
|
|
34
|
+
|
|
35
|
+
<invariants>
|
|
36
|
+
1. **Non-invasive** — overlays MUST use hashed HTML-comment markers for injection; NEVER edit command file content directly outside the overlay system
|
|
37
|
+
2. **Idempotent** — re-running `maestro overlay apply` with the same overlay JSON MUST produce no file changes
|
|
38
|
+
3. **Creation only** — this skill MUST only create overlays; listing and removal are handled by `maestro overlay list` (ink TUI)
|
|
39
|
+
4. **Pristine source preferred** — injection point analysis MUST read from `$PKG_ROOT/.claude/commands/` (untouched originals) first, fall back to `~/.claude/commands/` only if pristine unavailable
|
|
40
|
+
5. **User approval before write** — overlay JSON MUST be shown and approved via AskUserQuestion before writing to disk; NEVER auto-install without confirmation
|
|
41
|
+
6. **Chain skip option mandatory** — if a skill chain is configured, the injected content MUST include a "Skip" option in AskUserQuestion; NEVER force the user into a chain
|
|
42
|
+
</invariants>
|
|
43
|
+
|
|
44
|
+
<execution>
|
|
45
|
+
### 1. Parse user intent
|
|
46
|
+
|
|
47
|
+
Treat the argument as natural-language intent. If unclear, ask up to 2 questions with AskUserQuestion: (a) which command(s) to target, (b) where in the command flow the injection should happen.
|
|
48
|
+
|
|
49
|
+
### 2. Identify targets, injection points, and visualize
|
|
50
|
+
|
|
51
|
+
For each likely target command, read the pristine source from `$PKG_ROOT/.claude/commands/<name>.md` (preferred — untouched by overlays) or fall back to `~/.claude/commands/<name>.md`. Inspect the XML sections and pick the right one:
|
|
52
|
+
|
|
53
|
+
- **New step after execution** → `section: execution`, `mode: append`
|
|
54
|
+
- **Required reading** → `section: required_reading`, `mode: append`
|
|
55
|
+
- **Preconditions / gating** → `section: context`, `mode: append`
|
|
56
|
+
- **Output quality gate** → `section: success_criteria`, `mode: append`
|
|
57
|
+
|
|
58
|
+
If the user wants a whole new section, use `mode: new-section` with `afterSection: execution` (or whichever anchor makes sense).
|
|
59
|
+
|
|
60
|
+
**Injection point preview** — after selecting section + mode, render the target command's section map showing existing overlays and the new injection point:
|
|
61
|
+
|
|
62
|
+
```
|
|
63
|
+
=== maestro-execute.md (1 overlay exists) ===
|
|
64
|
+
|
|
65
|
+
<purpose>
|
|
66
|
+
<required_reading>
|
|
67
|
+
<context>
|
|
68
|
+
<execution>
|
|
69
|
+
├─ [existing] cli-verify #1 "CLI Verification step"
|
|
70
|
+
>>> NEW: append here (your overlay)
|
|
71
|
+
<success_criteria>
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
Use AskUserQuestion to confirm:
|
|
75
|
+
- **"Confirm"** — proceed with this injection point
|
|
76
|
+
- **"Pick different section"** — re-select section/mode
|
|
77
|
+
- **"Cancel"** — abort
|
|
78
|
+
|
|
79
|
+
### 2.5. Skill chain configuration
|
|
80
|
+
|
|
81
|
+
After confirming the injection point, ask whether this overlay should chain to another skill upon completion. This enables the overlay's injected content to hand off to a skill via AskUserQuestion at runtime, using `Skill({ skill: "...", args: "..." })` syntax.
|
|
82
|
+
|
|
83
|
+
Use AskUserQuestion:
|
|
84
|
+
- **"No chain"** — standard overlay, no skill handoff
|
|
85
|
+
- **"Chain to skill"** → ask for the target skill name (e.g., `quality-review`, `maestro-execute`, `quality-test`)
|
|
86
|
+
- **"Chain with alternatives"** → ask for primary skill + 1-2 alternative skills
|
|
87
|
+
|
|
88
|
+
If chain is selected, record the skill name(s) for use in Step 3.
|
|
89
|
+
|
|
90
|
+
### 3. Draft the overlay JSON
|
|
91
|
+
|
|
92
|
+
Build a slug from the user's intent (kebab-case, lowercase). Write to `~/.maestro/overlays/<slug>.json`:
|
|
93
|
+
|
|
94
|
+
```json
|
|
95
|
+
{
|
|
96
|
+
"name": "<slug>",
|
|
97
|
+
"description": "<short summary of what and why>",
|
|
98
|
+
"targets": ["maestro-execute"],
|
|
99
|
+
"priority": 50,
|
|
100
|
+
"enabled": true,
|
|
101
|
+
"patches": [
|
|
102
|
+
{
|
|
103
|
+
"section": "execution",
|
|
104
|
+
"mode": "append",
|
|
105
|
+
"content": "## CLI Verification (overlay)\n\nAfter execution, run:\n```\nccw cli -p \"PURPOSE: ...\" --mode analysis --rule analysis-review-code-quality\n```"
|
|
106
|
+
}
|
|
107
|
+
]
|
|
108
|
+
}
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
**Content guidelines**
|
|
112
|
+
- Lead the injected block with a heading that includes `(overlay)` so readers see it's machine-injected
|
|
113
|
+
- Keep content concise — overlays should add a step, not rewrite the command
|
|
114
|
+
- `@~/.maestro/...` references are encouraged for pointing at docs
|
|
115
|
+
- Escape `\n` in JSON strings; use a HEREDOC via Bash if content is long
|
|
116
|
+
|
|
117
|
+
**Skill chain content** — if a chain was configured in Step 2.5, append a Skill Handoff block at the end of the patch `content`. The handoff uses AskUserQuestion so the user controls whether to proceed:
|
|
118
|
+
|
|
119
|
+
```markdown
|
|
120
|
+
---
|
|
121
|
+
|
|
122
|
+
**Skill Handoff** (overlay)
|
|
123
|
+
|
|
124
|
+
After the above step completes, use AskUserQuestion:
|
|
125
|
+
- "Proceed to /quality-review" — Hand off to quality review
|
|
126
|
+
- "Skip" — Continue with current command flow
|
|
127
|
+
- "Alternative: /maestro-execute" — Run execution with built-in verification instead
|
|
128
|
+
|
|
129
|
+
On user selection:
|
|
130
|
+
- Proceed → Skill({ skill: "quality-review", args: "{phase}" })
|
|
131
|
+
- Alternative → Skill({ skill: "maestro-execute", args: "{phase}" })
|
|
132
|
+
- Skip → continue normally
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
Handoff rules:
|
|
136
|
+
- Always include a **"Skip"** option — the user can always decline the chain
|
|
137
|
+
- Use `Skill({ skill: "<name>", args: "..." })` syntax for handoff calls
|
|
138
|
+
- Mark handoff heading with `(overlay)` tag
|
|
139
|
+
- Support runtime variable placeholders: `{phase}`, `{description}`, `{session_id}`
|
|
140
|
+
- Keep handoff block under 10 lines of markdown
|
|
141
|
+
|
|
142
|
+
### 3.5. Content approval
|
|
143
|
+
|
|
144
|
+
Display the full overlay JSON to the user. AskUserQuestion:
|
|
145
|
+
- **"Approve & install"** — proceed to installation
|
|
146
|
+
- **"Edit"** — user provides corrections, re-draft
|
|
147
|
+
- **"Cancel"** — discard overlay, do not write
|
|
148
|
+
|
|
149
|
+
Only write the overlay JSON file to `~/.maestro/overlays/<slug>.json` after user approval.
|
|
150
|
+
|
|
151
|
+
### 4. Install via `maestro overlay add`
|
|
152
|
+
|
|
153
|
+
Run:
|
|
154
|
+
|
|
155
|
+
```bash
|
|
156
|
+
maestro overlay add ~/.maestro/overlays/<slug>.json
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
### 5. Report
|
|
160
|
+
|
|
161
|
+
Show the user:
|
|
162
|
+
- Path of the saved overlay JSON
|
|
163
|
+
- Which targets were patched and which were skipped (missing/disabled)
|
|
164
|
+
- Skill chain info (if configured)
|
|
165
|
+
- A reminder that `maestro install` will auto-reapply on every run
|
|
166
|
+
- How to remove: `maestro overlay remove <slug>`
|
|
167
|
+
|
|
168
|
+
**Report format**
|
|
169
|
+
|
|
170
|
+
```
|
|
171
|
+
=== OVERLAY INSTALLED ===
|
|
172
|
+
Name: <slug>
|
|
173
|
+
Path: ~/.maestro/overlays/<slug>.json
|
|
174
|
+
Targets: maestro-execute (applied), maestro-plan (skipped: missing)
|
|
175
|
+
Chain: quality-review (via AskUserQuestion) | none
|
|
176
|
+
Scopes: [global]
|
|
177
|
+
|
|
178
|
+
Re-apply: maestro overlay apply
|
|
179
|
+
Remove: maestro overlay remove <slug>
|
|
180
|
+
Inspect: maestro overlay list
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
After the report, remind the user they can run `maestro overlay list` for the interactive TUI showing section maps and overlay management.
|
|
184
|
+
</execution>
|
|
185
|
+
|
|
186
|
+
<success_criteria>
|
|
187
|
+
- [ ] Overlay JSON written to `~/.maestro/overlays/<slug>.json` and validates
|
|
188
|
+
- [ ] `maestro overlay add` exited successfully and applied to at least one scope
|
|
189
|
+
- [ ] Target command file(s) contain `<!-- maestro-overlay:<slug>#N hash=... -->` markers
|
|
190
|
+
- [ ] Re-running `maestro overlay apply` produces no file changes (idempotent)
|
|
191
|
+
- [ ] User shown the report with target list and removal instructions
|
|
192
|
+
- [ ] Injection point preview shown (with existing overlays + `>>>` marker) and confirmed before drafting
|
|
193
|
+
- [ ] If chain configured, `content` includes Skill Handoff block with AskUserQuestion + Skip option + `Skill()` calls
|
|
194
|
+
</success_criteria>
|
|
195
|
+
|
|
196
|
+
<completion>
|
|
197
|
+
### Next-step routing
|
|
198
|
+
| Condition | Suggestion |
|
|
199
|
+
|-----------|-----------|
|
|
200
|
+
| Overlay installed | `maestro overlay list` for interactive management |
|
|
201
|
+
| Want to create another | `/maestro-overlay "<intent>"` |
|
|
202
|
+
| Want to remove | `maestro overlay remove <slug>` |
|
|
203
|
+
</completion>
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: maestro-plan
|
|
3
|
+
description: "Use when creating, revising, or verifying an execution plan for a milestone or task Arguments: [milestone] [--spec SPEC-xxx] [-y] [--gaps] [--tdd] [--dir <path>] [--from <source>] [--revise [instructions]] [--check <plan-dir>]"
|
|
4
|
+
allowed-tools: Read Write Edit Bash Glob Grep Agent AskUserQuestion
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
<purpose>
|
|
8
|
+
Create, revise, or verify execution plans (5-stage pipeline).
|
|
9
|
+
Produces plan.json + TASK files; registers PLN artifact in state.json.
|
|
10
|
+
</purpose>
|
|
11
|
+
|
|
12
|
+
<required_reading>
|
|
13
|
+
@~/.maestro/workflows/plan.md
|
|
14
|
+
</required_reading>
|
|
15
|
+
|
|
16
|
+
<deferred_reading>
|
|
17
|
+
- [plan.json](~/.maestro/templates/plan.json) — read when generating plan output
|
|
18
|
+
- [task.json](~/.maestro/templates/task.json) — read when generating task files
|
|
19
|
+
- [state.json](~/.maestro/templates/state.json) — read when registering artifact
|
|
20
|
+
- [boundary-grill.md](~/.maestro/workflows/boundary-grill.md) — read when boundary conflicts detected (in P4)
|
|
21
|
+
</deferred_reading>
|
|
22
|
+
|
|
23
|
+
<context>
|
|
24
|
+
$ARGUMENTS — milestone number, or no args for current milestone, with optional flags.
|
|
25
|
+
|
|
26
|
+
Scope routing, base flags (`--spec`, `-y`, `--gaps`, `--dir`), output directory format, and artifact registration are defined in workflow plan.md.
|
|
27
|
+
|
|
28
|
+
**Command-level flags** (extensions beyond workflow base):
|
|
29
|
+
- `--from <source>`: Load upstream context directly (bypasses roadmap requirement):
|
|
30
|
+
- `analyze:ANL-xxx` → CONTEXT_DIR = artifact path, scope = "standalone"
|
|
31
|
+
- `blueprint:BLP-xxx` → CONTEXT_DIR = blueprint path, scope = "standalone"
|
|
32
|
+
- `@file` or `path/` → load context-package.json from path
|
|
33
|
+
- `--tdd` — Enable TDD mode: generate test-first task structure (Red-Green-Refactor). See workflow `plan.md` § TDD Mode for task generation rules.
|
|
34
|
+
- `--revise [instructions]` -- See workflow plan.md § Revise Mode
|
|
35
|
+
- `--check <plan-dir>` -- See workflow plan.md § Check Mode
|
|
36
|
+
|
|
37
|
+
**Upstream context (resolution priority):**
|
|
38
|
+
1. `--from analyze:ANL-xxx` → uses analyze conclusions.implementation_scope directly
|
|
39
|
+
2. `--from blueprint:BLP-xxx` → uses blueprint requirements + architecture
|
|
40
|
+
3. `--dir <path>` → explicit context directory (unchanged)
|
|
41
|
+
4. Numeric arg → scope = "milestone", resolve from roadmap
|
|
42
|
+
5. No args + roadmap → scope = "current_milestone"
|
|
43
|
+
6. No args + no roadmap → search state.json for latest analyze artifact, fallback standalone
|
|
44
|
+
|
|
45
|
+
**Ad-hoc milestone (D-008):** When scope resolves to "standalone" via the standard standalone resolution (no `--from` source), and `current_milestone == null`, plan auto-creates an adhoc milestone (`type: "adhoc"`) in state.json before proceeding. This ensures downstream milestone-audit/complete have a valid milestone context. See workflow plan.md § "Ad-hoc Milestone Auto-Creation".
|
|
46
|
+
|
|
47
|
+
**`--from analyze:*` / `blueprint:*`**: scope=standalone → skip adhoc milestone auto-creation.
|
|
48
|
+
|
|
49
|
+
### Role Knowledge
|
|
50
|
+
`maestro search --category arch` → select relevant → `maestro load --type knowhow --id`
|
|
51
|
+
</context>
|
|
52
|
+
|
|
53
|
+
<execution>
|
|
54
|
+
### Pre-flight: team conflict check
|
|
55
|
+
|
|
56
|
+
Before starting the plan pipeline, run:
|
|
57
|
+
```
|
|
58
|
+
Bash("maestro collab preflight --phase <phase-number>")
|
|
59
|
+
```
|
|
60
|
+
If exit code is 1, present warnings and ask whether to proceed.
|
|
61
|
+
|
|
62
|
+
Follow '~/.maestro/workflows/plan.md' completely.
|
|
63
|
+
|
|
64
|
+
### Plan Agent Model
|
|
65
|
+
|
|
66
|
+
Plan automatically selects agent mode based on milestone scope:
|
|
67
|
+
|
|
68
|
+
**Single agent mode** (default):
|
|
69
|
+
- Milestone involves ≤3 modules
|
|
70
|
+
- 1 workflow-planner agent, max 8 TASK JSON output
|
|
71
|
+
- Directly produces plan.json
|
|
72
|
+
|
|
73
|
+
**2+1 agent mode** (auto-triggered):
|
|
74
|
+
- Milestone involves >3 modules
|
|
75
|
+
- 2 parallel workflow-planner agents, each scoped to 2-3 modules
|
|
76
|
+
- Each agent produces max 8 TASK JSON (total max 16)
|
|
77
|
+
- +1 synthesis agent:
|
|
78
|
+
- Merges TASK JSON from both agents
|
|
79
|
+
- DAG analysis: dependency correctness, cycle detection, cross-module conflicts
|
|
80
|
+
- Terminology consistency check
|
|
81
|
+
- Wave ordering optimization
|
|
82
|
+
- Produces unified plan.json
|
|
83
|
+
|
|
84
|
+
Module count is derived from milestone phase definitions and analyze upstream context.
|
|
85
|
+
|
|
86
|
+
### Phase Gates (MANDATORY, BLOCKING — Create mode only)
|
|
87
|
+
|
|
88
|
+
**GATE P1 → P2: Context Collection → Clarification**
|
|
89
|
+
- REQUIRED: Context files loaded (roadmap, analyze artifact, or --from source).
|
|
90
|
+
- REQUIRED: Codebase docs read if available (ARCHITECTURE.md, FEATURES.md).
|
|
91
|
+
- REQUIRED: Wiki searched for prior knowledge related to phase keywords.
|
|
92
|
+
- BLOCKED if missing: no context source found — cannot plan without upstream input (E001).
|
|
93
|
+
|
|
94
|
+
**GATE P2 → P3: Clarification → Plan Generation**
|
|
95
|
+
- REQUIRED: Ambiguous requirements resolved via AskUserQuestion (<=3 rounds).
|
|
96
|
+
- BLOCKED if: unresolved ambiguities remain after 3 clarification rounds — escalate to user before proceeding.
|
|
97
|
+
|
|
98
|
+
**GATE P3 → P4: Plan Generation → Plan Check**
|
|
99
|
+
- REQUIRED: Plan generated by planner agent — `plan.json` + `.task/TASK-*.json` files written.
|
|
100
|
+
- REQUIRED: Main flow inline planning is FORBIDDEN (see P3 Agent Constraint below).
|
|
101
|
+
- BLOCKED if missing: plan.json or TASK files not produced by planner agent — do not proceed to checking.
|
|
102
|
+
|
|
103
|
+
**GATE P3.5 → P4: Boundary Grill → Plan Check**
|
|
104
|
+
- REQUIRED: Boundary grill executed per workflow boundary-grill.md.
|
|
105
|
+
- NON-BLOCKING: conflicts logged as warnings, not hard stops.
|
|
106
|
+
|
|
107
|
+
**GATE P4 → P5: Plan Check → User Confirmation**
|
|
108
|
+
- REQUIRED: Plan-checker passed (or minor issues acknowledged).
|
|
109
|
+
- REQUIRED: Boundary grill completed.
|
|
110
|
+
- REQUIRED: Confidence scored with 5-dimension factor model.
|
|
111
|
+
- REQUIRED: Pressure pass completed on highest-complexity task.
|
|
112
|
+
- REQUIRED: UI plans have `[UI-observable]` convergence criteria per wave (details in workflow).
|
|
113
|
+
- BLOCKED if: plan-checker found critical issues, OR UI plan missing `[UI-observable]` coverage.
|
|
114
|
+
|
|
115
|
+
**GATE P5 → Completion: User Confirmation → Done**
|
|
116
|
+
- REQUIRED: User confirmation captured (execute/modify/cancel).
|
|
117
|
+
- REQUIRED: PLN artifact registered in state.json.
|
|
118
|
+
- BLOCKED if missing: no user confirmation — do not register artifact or report completion.
|
|
119
|
+
|
|
120
|
+
### Mode: Revise / Check
|
|
121
|
+
|
|
122
|
+
Follow workflow plan.md § "Revise Mode" and § "Check Mode" respectively. These modes bypass the standard P1-P5 create pipeline.
|
|
123
|
+
</execution>
|
|
124
|
+
|
|
125
|
+
<completion>
|
|
126
|
+
### Standalone report
|
|
127
|
+
|
|
128
|
+
```
|
|
129
|
+
=== PLAN READY ===
|
|
130
|
+
Milestone: {milestone_name}
|
|
131
|
+
Tasks: {task_count} tasks in {wave_count} waves
|
|
132
|
+
Check: {checker_status} (iteration {check_count}/{max_checks})
|
|
133
|
+
Collision: {collision_status}
|
|
134
|
+
|
|
135
|
+
Plan: scratch/{YYYYMMDD}-plan-P{N}-{slug}/plan.json
|
|
136
|
+
Tasks: scratch/{YYYYMMDD}-plan-P{N}-{slug}/.task/TASK-*.json
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
### Ralph-invoked completion
|
|
140
|
+
|
|
141
|
+
End the step by calling the CLI (no text block output):
|
|
142
|
+
```
|
|
143
|
+
maestro ralph complete <idx> --status {STATUS} [--evidence scratch/{YYYYMMDD}-plan-P{N}-{slug}/plan.json]
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
Status verdicts:
|
|
147
|
+
- **DONE** — Plan created/revised and confirmed → next step picks up automatically
|
|
148
|
+
- **DONE_WITH_CONCERNS** — Plan produced but with explicit caveats; pass `--concerns "..."`
|
|
149
|
+
- **NEEDS_RETRY** — Plan failed (tooling error, transient issue); ralph will retry
|
|
150
|
+
- **BLOCKED** — External hard blocker (e.g., upstream artifact missing, dependency unavailable); pass `--reason "..."`
|
|
151
|
+
|
|
152
|
+
> Ambiguous requirements are NOT a completion status — resolve them in-place via `AskUserQuestion` during planning (≤3 rounds), then proceed to DONE. `NEEDS_CONTEXT` has been removed; context shortage is handled by the harness's automatic compaction.
|
|
153
|
+
|
|
154
|
+
### Next-step routing
|
|
155
|
+
|
|
156
|
+
| Condition | Suggestion |
|
|
157
|
+
|-----------|-----------|
|
|
158
|
+
| Plan confirmed for execution | `/maestro-execute` |
|
|
159
|
+
| Plan confirmed, specific directory | `/maestro-execute --dir {dir}` |
|
|
160
|
+
| Re-plan with modifications | `/maestro-plan {milestone}` |
|
|
161
|
+
</completion>
|
|
162
|
+
|
|
163
|
+
<error_codes>
|
|
164
|
+
| Code | Severity | Condition | Recovery |
|
|
165
|
+
|------|----------|-----------|----------|
|
|
166
|
+
| E001 | error | No args and no roadmap (cannot determine scope) | Provide milestone number or topic, or create roadmap |
|
|
167
|
+
| E003 | error | --gaps requires prior verification/issues to exist | Run maestro-execute first (verification is built-in) |
|
|
168
|
+
| E004 | error | No plan found to revise (--revise without target) | Use --dir to specify plan, or create plan first |
|
|
169
|
+
| E005 | error | Plan directory not found (--check) | Check path, use --dir |
|
|
170
|
+
| W001 | warning | Exploration agent returned incomplete results | Retry exploration or proceed with available context |
|
|
171
|
+
| W002 | warning | Plan-checker found minor issues, continuing | Review plan-checker feedback, adjust plan if needed |
|
|
172
|
+
| W003 | warning | Wiki search unavailable or returned no results | Continue without prior knowledge context |
|
|
173
|
+
| W004 | warning | Collision detected with existing plan | Review colliding files, confirm or adjust scope |
|
|
174
|
+
</error_codes>
|
|
175
|
+
|
|
176
|
+
<success_criteria>
|
|
177
|
+
- [ ] plan.json written to scratch directory with summary, approach, task_ids, waves (with phase labels)
|
|
178
|
+
- [ ] .task/TASK-*.json files created for each task
|
|
179
|
+
- [ ] Every task has `read_first[]` with at least the file being modified + source of truth files
|
|
180
|
+
- [ ] Every task has `convergence.criteria[]` with grep-verifiable conditions (no subjective language)
|
|
181
|
+
- [ ] UI plans: each delivery wave has ≥1 `[UI-observable]` convergence criterion (vertical slice; verified at runtime by ralph frontend-verify gate)
|
|
182
|
+
- [ ] Every task `action` and `implementation` contain concrete values (no "align X with Y")
|
|
183
|
+
- [ ] Boundary grill executed in P3.5 (skip if no conflicts detected)
|
|
184
|
+
- [ ] Boundary grill results written to plan.json `boundary_grill` section (if conflicts found)
|
|
185
|
+
- [ ] DEC conflicts reflected in confidence `boundary_warning` factor
|
|
186
|
+
- [ ] Plan confidence scored in P4 with 5-dimension factor model
|
|
187
|
+
- [ ] Plan readiness gate checked before P4.5 collision detection
|
|
188
|
+
- [ ] Pressure pass completed on highest-complexity task
|
|
189
|
+
- [ ] plan.json includes confidence section (overall, dimensions, pressure_pass)
|
|
190
|
+
- [ ] Collision detection executed against same-milestone plans (non-blocking)
|
|
191
|
+
- [ ] Plan-checker passed (or minor issues acknowledged)
|
|
192
|
+
- [ ] User confirmation captured (execute/modify/cancel) with confidence displayed
|
|
193
|
+
- [ ] Artifact registered in state.json with correct scope/milestone/phase/depends_on
|
|
194
|
+
</success_criteria>
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: maestro-player
|
|
3
|
+
description: "Play workflow templates with checkpoint resume Arguments: <template-slug|path> [--context key=value...] [-c [session-id]] [--list] [--dry-run]"
|
|
4
|
+
allowed-tools: Read Write Edit Bash Glob Grep Agent AskUserQuestion Skill
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
<purpose>
|
|
8
|
+
Load workflow template (from maestro-composer) → bind context variables → execute DAG nodes in topological order → persist state at checkpoints → support resume.
|
|
9
|
+
|
|
10
|
+
Session: `.workflow/.maestro/player-{YYYYMMDD-HHmmss}/status.json`
|
|
11
|
+
</purpose>
|
|
12
|
+
|
|
13
|
+
<context>
|
|
14
|
+
$ARGUMENTS — template slug/path, or flags.
|
|
15
|
+
|
|
16
|
+
**Flags**:
|
|
17
|
+
- `--context key=value`: Bind context variables (repeatable)
|
|
18
|
+
- `-c [session-id]`: Resume paused/interrupted session
|
|
19
|
+
- `--list`: List available templates from index.json
|
|
20
|
+
- `--dry-run`: Show execution plan without executing
|
|
21
|
+
|
|
22
|
+
**Node execution mechanisms**:
|
|
23
|
+
|
|
24
|
+
| Node type | Mechanism | Blocking |
|
|
25
|
+
|-----------|-----------|----------|
|
|
26
|
+
| skill | `Skill(skill, args)` | sync |
|
|
27
|
+
| command | `Skill(skill, args)` | sync |
|
|
28
|
+
| cli | `maestro delegate --to tool --mode mode` via `Bash(run_in_background: true)` | async, STOP + wait |
|
|
29
|
+
| agent | `Agent(subagent_type, prompt)` — any registered subagent_type (see `.claude/agents/`); defaults to `"general-purpose"` if omitted or unrecognized. | configurable |
|
|
30
|
+
| checkpoint | State save + optional user pause | — |
|
|
31
|
+
|
|
32
|
+
**Runtime reference resolution** in args_template:
|
|
33
|
+
|
|
34
|
+
| Reference | Resolves to |
|
|
35
|
+
|-----------|-------------|
|
|
36
|
+
| `{variable}` | session context[variable] |
|
|
37
|
+
| `{N-001.session_id}` | node's session_id |
|
|
38
|
+
| `{N-001.output_path}` | node's output_path |
|
|
39
|
+
| `{prev_session_id}` | previous non-checkpoint node's session_id |
|
|
40
|
+
| `{prev_output_path}` | previous non-checkpoint node's output_path |
|
|
41
|
+
|
|
42
|
+
**Session schema** (status.json):
|
|
43
|
+
```json
|
|
44
|
+
{
|
|
45
|
+
"session_id": "player-<YYYYMMDD>-<HHmmss>",
|
|
46
|
+
"status": "running|paused|completed|failed|aborted",
|
|
47
|
+
"template_id": "wft-<slug>-<date>",
|
|
48
|
+
"template_path": "<path>",
|
|
49
|
+
"auto_mode": false,
|
|
50
|
+
"context": { "goal": "..." },
|
|
51
|
+
"steps": [{
|
|
52
|
+
"index": 0, "node_id": "N-001", "skill": "<executor>",
|
|
53
|
+
"args": "<resolved>", "type": "skill|cli|agent|checkpoint",
|
|
54
|
+
"status": "pending|running|completed|skipped|failed",
|
|
55
|
+
"session_id": null, "output_path": null, "artifacts": []
|
|
56
|
+
}],
|
|
57
|
+
"current_step": 0,
|
|
58
|
+
"last_checkpoint": null
|
|
59
|
+
}
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
**Output boundary**: ALL file writes MUST target `.workflow/.maestro/player-*/` (session status.json + step outputs) only. Template files (`~/.maestro/templates/workflows/`) are read-only. NEVER modify source code or `.claude/commands/` files.
|
|
63
|
+
</context>
|
|
64
|
+
|
|
65
|
+
<invariants>
|
|
66
|
+
1. **Resume-safe** — status.json MUST be updated after every step change; an interrupted session MUST be resumable from the last checkpoint via `-c`
|
|
67
|
+
2. **One step at a time** — execution loop MUST process steps sequentially in topological order; parallel steps share a batch index but NEVER run concurrently within the player
|
|
68
|
+
3. **CLI nodes async** — cli-type nodes MUST use `Bash(run_in_background: true)` + STOP pattern; NEVER block the main thread on delegate execution
|
|
69
|
+
4. **Templates read-only** — player MUST NOT modify template JSON files; runtime state belongs in status.json only
|
|
70
|
+
5. **Failure requires user decision** — on step failure without explicit `on_fail`, player MUST prompt via AskUserQuestion (Retry/Skip/Abort); NEVER silently skip or auto-abort
|
|
71
|
+
6. **Reference resolution at runtime** — `{N-xxx.field}` and `{prev_*}` references MUST be resolved at execution time from status.json step results, NEVER pre-resolved during init
|
|
72
|
+
</invariants>
|
|
73
|
+
|
|
74
|
+
<state_machine>
|
|
75
|
+
|
|
76
|
+
<states>
|
|
77
|
+
S_ROUTE — 入口路由(list/resume/dry-run/normal) PERSIST: —
|
|
78
|
+
S_RESUME — 恢复已暂停 session PERSIST: —
|
|
79
|
+
S_LOAD — 加载模板、收集变量、绑定引用 PERSIST: —
|
|
80
|
+
S_INIT — 创建 session、拓扑排序、初始化 steps PERSIST: status.json
|
|
81
|
+
S_EXEC_LOOP — 逐步执行(核心循环) PERSIST: status.json (每步更新)
|
|
82
|
+
S_COMPLETE — 标记完成、输出摘要 PERSIST: status.json (final)
|
|
83
|
+
</states>
|
|
84
|
+
|
|
85
|
+
<transitions>
|
|
86
|
+
|
|
87
|
+
S_ROUTE:
|
|
88
|
+
→ handleList WHEN: --list DO: scan index.json, display templates
|
|
89
|
+
→ S_RESUME WHEN: -c flag
|
|
90
|
+
→ S_LOAD WHEN: template slug/path provided
|
|
91
|
+
→ handleList WHEN: no args DO: display templates + AskUserQuestion
|
|
92
|
+
|
|
93
|
+
S_RESUME:
|
|
94
|
+
→ S_EXEC_LOOP WHEN: session found DO: A_RESUME_SESSION
|
|
95
|
+
→ ERROR(E004) WHEN: no session found
|
|
96
|
+
|
|
97
|
+
S_LOAD:
|
|
98
|
+
→ S_INIT DO: A_LOAD_AND_BIND
|
|
99
|
+
|
|
100
|
+
S_INIT:
|
|
101
|
+
→ END WHEN: --dry-run DO: display execution plan
|
|
102
|
+
→ S_EXEC_LOOP DO: A_INIT_SESSION (topological sort → steps[], write status.json, display banner)
|
|
103
|
+
|
|
104
|
+
S_EXEC_LOOP:
|
|
105
|
+
→ S_EXEC_LOOP WHEN: step completed, more steps DO: A_EXECUTE_STEP → advance current_step
|
|
106
|
+
→ S_COMPLETE WHEN: all steps completed
|
|
107
|
+
→ END WHEN: checkpoint pause DO: set status=paused, display resume command
|
|
108
|
+
→ END WHEN: abort chosen DO: set status=aborted, save progress
|
|
109
|
+
GUARD: cli nodes → Bash(run_in_background: true) + STOP, wait for callback
|
|
110
|
+
GUARD: on failure → on_fail: skip (log, advance) | retry (once) | abort (AskUserQuestion: Retry/Skip/Abort). Default on_fail when not specified: `abort` (prompt user via AskUserQuestion).
|
|
111
|
+
GUARD: after step 3+ → display context hint "可随时 /maestro-player -c 恢复"
|
|
112
|
+
|
|
113
|
+
S_COMPLETE:
|
|
114
|
+
→ END DO: A_COMPLETE_SESSION
|
|
115
|
+
|
|
116
|
+
</transitions>
|
|
117
|
+
|
|
118
|
+
<actions>
|
|
119
|
+
|
|
120
|
+
### A_RESUME_SESSION
|
|
121
|
+
|
|
122
|
+
1. If session-id: load status.json. If none: scan player-*/status.json for running|paused.
|
|
123
|
+
2. Reset any "running" steps to "pending" (interrupted mid-execution)
|
|
124
|
+
3. Set current_step to resume point after last_checkpoint
|
|
125
|
+
4. Enter S_EXEC_LOOP
|
|
126
|
+
|
|
127
|
+
### A_LOAD_AND_BIND
|
|
128
|
+
|
|
129
|
+
1. Resolve template: absolute path → as-is; relative → from cwd; slug → index.json lookup
|
|
130
|
+
2. Parse `--context key=value` pairs
|
|
131
|
+
3. Validate template (template_id, nodes, edges, context_schema required)
|
|
132
|
+
4. Collect missing required variables via AskUserQuestion
|
|
133
|
+
5. Bind {variable} placeholders (leave {N-xxx.field} and {prev_*} for runtime)
|
|
134
|
+
|
|
135
|
+
### A_INIT_SESSION
|
|
136
|
+
|
|
137
|
+
1. Generate session_id: player-{YYYYMMDD-HHmmss}
|
|
138
|
+
2. Topological sort (Kahn's algorithm) → flatten to steps[] (parallel nodes share batch index)
|
|
139
|
+
3. All steps status: "pending"
|
|
140
|
+
4. Write status.json
|
|
141
|
+
|
|
142
|
+
### A_EXECUTE_STEP
|
|
143
|
+
|
|
144
|
+
1. Resolve runtime references ({N-xxx.field}, {prev_*}) in args
|
|
145
|
+
2. Set step status="running", write status.json
|
|
146
|
+
3. Execute by type:
|
|
147
|
+
- **skill/command**: `Skill(skill, resolved_args)` → extract session_id, output_path, artifacts
|
|
148
|
+
- **cli**: `Bash(run_in_background: true)` → STOP, wait for callback → `maestro delegate output <id>`
|
|
149
|
+
- **agent**: `Agent(subagent_type, resolved_args)`
|
|
150
|
+
- **checkpoint**: write checkpoint snapshot. If auto_continue==false:
|
|
151
|
+
AskUserQuestion (single-select, header: "Checkpoint"):
|
|
152
|
+
- **Continue** — proceed to next step
|
|
153
|
+
- **Pause** — save progress, exit (resume with `-c`)
|
|
154
|
+
- **Abort** — stop workflow
|
|
155
|
+
4. Set step status="completed" (or "skipped"/"failed"), write status.json
|
|
156
|
+
|
|
157
|
+
### A_COMPLETE_SESSION
|
|
158
|
+
|
|
159
|
+
Set status="completed", completed_at. Display summary: session, template, steps completed, context, per-step results, artifacts, session dir.
|
|
160
|
+
AskUserQuestion (single-select, header: "完成"):
|
|
161
|
+
- **Keep session** — preserve artifacts for reference
|
|
162
|
+
- **Run again** — re-execute with same template
|
|
163
|
+
- **Done** — clean up and exit
|
|
164
|
+
|
|
165
|
+
</actions>
|
|
166
|
+
|
|
167
|
+
</state_machine>
|
|
168
|
+
|
|
169
|
+
<error_codes>
|
|
170
|
+
| Code | Condition | Recovery |
|
|
171
|
+
|------|-----------|----------|
|
|
172
|
+
| E001 | Template not found | Show --list, suggest closest match |
|
|
173
|
+
| E002 | Template JSON invalid (missing template_id/nodes/edges) | Point to template file for fix |
|
|
174
|
+
| E004 | Resume session not found | List available player-*/ sessions |
|
|
175
|
+
| E005 | DAG cycle in template | Point to template, suggest --edit |
|
|
176
|
+
| E006 | Node execution failed + abort chosen | Save state, suggest `-c` resume |
|
|
177
|
+
</error_codes>
|
|
178
|
+
|
|
179
|
+
<success_criteria>
|
|
180
|
+
- [ ] Template loaded, variables bound, session created with topological steps
|
|
181
|
+
- [ ] status.json written after every step change (resume-safe)
|
|
182
|
+
- [ ] CLI nodes use Bash(run_in_background) + STOP pattern
|
|
183
|
+
- [ ] Checkpoints saved, resume via -c works
|
|
184
|
+
</success_criteria>
|