Maestro
--- name: maestro description: Auto-route intent to optimal command chain argument-hint: "<intent [-y] [-c] [--dry-run] [--sup…
Claude CodeGeneric
---
name: maestro
description: Auto-route intent to optimal command chain
argument-hint: "<intent> [-y] [-c] [--dry-run] [--super]"
allowed-tools:
- Read
- Write
- Edit
- Bash
- Glob
- Grep
- Agent
- AskUserQuestion
- TodoWrite
---
<purpose>
Orchestrate all maestro commands based on user intent and project state.
Classify intent → select chain → create session → dispatch to `maestro-ralph-execute`.
Entry points:
- **`/maestro "intent"`** — Intent-based: classify → chain → execute
- **`/maestro -c`** — Resume previous session
- **`/maestro --dry-run "intent"`** — Show chain, no execution
- **`/maestro --super "intent"`** — Production-ready mode (read maestro-super.md)
Session: `.workflow/.maestro/{session_id}/status.json`
</purpose>
<deferred_reading>
- [maestro.md](~/.maestro/workflows/maestro.md) — read at execution start for intent analysis + chain selection
- [maestro-super.md](~/.maestro/workflows/maestro-super.md) — read when `--super` flag active
</deferred_reading>
<context>
$ARGUMENTS — user intent text, or special keywords.
**Keywords:** `continue`/`next`/`go` → state-based routing; `status` → `Skill("manage-status")`
**Flags:**
- `-y` / `--yes` — Auto mode: skip clarification, skip confirmation, auto-skip on errors
- `-c` / `--continue` — Resume previous session
- `--dry-run` — Show chain without executing
- `--super` — Read and follow `maestro-super.md`
</context>
<invariants>
1. **All chains dispatch via maestro-ralph-execute** — maestro never executes steps directly
2. **Session before execution** — status.json created before any step runs
3. **Auto flag pass-through** — 仅当用户传入 `-y` 时透传 `-y` 到 skill args
4. **Decomposition contract shared with maestro-ralph** — broad/lifecycle intents run S_DECOMPOSE producing the SAME additive block (`boundary_contract`, `execution_criteria`, `task_decomposition`)。Reference maestro-ralph `A_DECOMPOSE_TASKS`
5. **status.json 唯一真源** — 不生成 `goal-checklist.md` 或外部清单
6. **执行步骤统一通过 `maestro ralph next` 加载** — `command_scope`/`command_path` 由 `maestro ralph skills --json --quiet` 预校验(project 覆盖 global);decision 节点不走 CLI,走 `Skill("maestro-ralph")` handoff
7. **Topology awareness** — chain catalog 含 brainstorm / blueprint / analyze-macro / analyze / roadmap / plan(三路径) / execute / verify / ...;scope_verdict 由 ralph 在 `post-analyze-scope` 决定
8. **D-007 milestone 反查** — 数字 phase 的 `milestone_id` 由 `state.json.milestones[].phase_slugs` 反查
9. **每个 step 必须 `completion_confirmed: true`** — 由 `maestro ralph complete N --status DONE|DONE_WITH_CONCERNS` 写入
10. **schema** — `ralph_protocol_version: "1"` 标记 CLI-driven session;新增字段全部可选
</invariants>
<state_machine>
<states>
S_PARSE — 解析参数、检测 flags PERSIST: —
S_RESUME — 扫描已有 session、恢复执行 PERSIST: —
S_CLASSIFY — 意图分类、chain 选择 PERSIST: —
S_DECOMPOSE — 边界澄清、写执行准则+子目标清单 PERSIST: session.boundary_contract, .execution_criteria, .task_decomposition
S_CREATE — 创建 session + status.json PERSIST: session (全量)
S_DRY_RUN — 显示 chain 后结束 PERSIST: —
S_CONFIRM — 用户确认(auto_mode 跳过) PERSIST: —
S_DISPATCH — 移交 maestro-ralph-execute PERSIST: —
S_FALLBACK — 意图无法分类、请求输入 PERSIST: —
</states>
<transitions>
S_PARSE:
→ S_RESUME WHEN: -c / --continue flag
→ S_CLASSIFY WHEN: intent text present
→ S_CLASSIFY WHEN: keyword "continue"/"next"/"go" DO: A_STATE_BASED_ROUTE
→ S_FALLBACK WHEN: no intent AND no flags
S_RESUME:
→ S_DISPATCH WHEN: session found DO: A_LOCATE_SESSION
→ S_FALLBACK WHEN: no session found
S_CLASSIFY:
→ S_DECOMPOSE WHEN: chain resolved DO: A_CLASSIFY_INTENT
→ S_FALLBACK WHEN: no match AND auto_mode
→ S_CLASSIFY WHEN: no match AND not auto_mode DO: A_CLARIFY
GUARD: max 2 clarification rounds → S_FALLBACK
S_DECOMPOSE:
→ S_CREATE DO: A_DECOMPOSE_TASKS
GUARD: broad intent (重构/全面/重写/迁移/overhaul/migrate/rewrite) on a multi-step lifecycle chain → MUST clarify even if auto_mode
GUARD: single-step chain OR narrow intent OR chain ∈ {status,init,quick} → skip decomposition (pass through)
S_CREATE:
→ S_DRY_RUN WHEN: --dry-run flag DO: A_CREATE_SESSION
→ S_CONFIRM WHEN: not auto_mode DO: A_CREATE_SESSION
→ S_DISPATCH WHEN: auto_mode DO: A_CREATE_SESSION
S_DRY_RUN:
→ END DO: display chain with step types
S_CONFIRM:
→ S_DISPATCH WHEN: user confirms
→ S_PARSE WHEN: user wants to modify
→ END WHEN: user cancels
S_DISPATCH:
→ END DO: Skill({ skill: "maestro-ralph-execute" })
S_FALLBACK:
→ S_CLASSIFY WHEN: user provides new intent DO: AskUserQuestion
→ END WHEN: user cancels
</transitions>
<actions>
### A_STATE_BASED_ROUTE
1. Read `.workflow/state.json` → determine next logical step
2. Convert to equivalent intent for chain classification
### A_LOCATE_SESSION
1. Scan `.workflow/.maestro/*/status.json`, filter `status == "running"`, sort DESC
2. Take most recent; if not found → S_FALLBACK
### A_CLASSIFY_INTENT
1. Read `~/.maestro/workflows/maestro.md` from deferred_reading
2. Match intent to task_type via chain catalog (semantic)
3. Select chain from chainMap,遵循拓扑约束:
- 头脑风暴/探索 → `brainstorm`
- 正式规格/spec-generate/7-phase → `blueprint`
- 项目初始化 → `init`
- 宽/中等意图 + 无数字 phase → `analyze-macro`(产 scope_verdict,由 ralph 在 `post-analyze-scope` 决定是否插入 roadmap+analyze 或直跳 plan --from analyze)
- 数字 phase 上下文 → `analyze {phase}` → `plan {phase}` → `execute {phase}` → `verify {phase}` → quality pipeline
- 已有 analyze artifact 想直达执行 → `plan --from analyze:{ANL_ID}` → execute → verify
-
Maintain Maestro?
Let people know it's listed here — add the badge (live metrics, light/dark aware) or a plain link to your README or docs.
[Maestro on getagentictools](https://getagentictools.com/loops/fidstyle-maestro?ref=badge) npx agentictools info loops/fidstyle-maestro The second line is the CLI lookup for this page — handy in READMEs and docs.