| name | maestro-next |
| description | Default interactive entry for development intents โ score intent + project state, recommend one atomic step, execute after confirmation. Multi-step intents: stepwise, user-confirmed manual-engine chain, or hand off to /maestro. Never auto-orchestrates |
| argument-hint | <intent>|--list|--suggest [-y] [--dry-run] |
| allowed-tools | ["AskUserQuestion","Bash","Edit","Glob","Grep","Read","Skill","Write"] |
| session-mode | run |
| contract | null |
<required_reading>
@~/.maestro/workflows/run-mode.md
</required_reading>
<host_mirror>
้ๅๅ่ฎฎ๏ผ็ถๆๅฏน่ดฆ็ฑๆไปถ่ชๅจๅฎๆ๏ผLLM ๅชไฟ็ไธคไธช่ฏญไนๅจไฝ๏ผ๏ผ
| ๅจไฝ | ๅทฅๅ
ท่ฐ็จ | ่ฏดๆ |
|---|
| ๆญฅ่ฟ | todo({ action: "next" }) | ๆฟๆดปไธไธๆญฅ + ๆณจๅ
ฅไธๆธธๆ่ฆ + ็ปๅฎ skill |
| ๅฎๆๅฎฃๅ | goal done | ่งฆๅๅ็ฝฎๆ ก้ช๏ผchain ๅ
จ completed + gates ๆ failed๏ผ+ verifier |
- ็ฆๆญขๆๅทฅ
todo({ action: "create" }) / todo({ action: "update" }) ้ๅไปปๅกโโbridge ไป session.json ่ชๅจ็ฉๅ
- goal ็ฑ bridge ไป session intent + definition_of_done ่ชๅจๆดพ็
- ๅ็ผฉๆขๅคๅ้ฆไธชๅจไฝ๏ผ
maestro run brief --platform pi <run-id> ้ๆๅ่ฎฎ
</host_mirror>
Default interactive entry for development intents. Parse intent + project state โ run read-only `maestro run recall --json` โ score candidates from the step registry โ recommend resume/fork/import/new or a single atomic step โ confirm โ execute. Historical similarity is advisory-only and never mutates without an explicit confirmation token.
Multi-step work has three paths: stepwise (each completed step re-enters lifecycle inference), a user-confirmed manual-engine chain (explicit short chain in session.json, advanced step-by-step via `maestro run next`), or handoff to /maestro. Never auto-orchestrates.
$ARGUMENTS โ intent text + optional flags.
Flags:
| Flag | Effect |
|---|
-y / --yes | Skip confirmation, execute top pick directly |
--dry-run | Show recommendation only, do not execute |
--top N | Show top N candidates (default 3) |
--list | List all available steps grouped by workflow cluster |
--suggest | Suggest-only mode: show recommendation + prepare content, NEVER auto-execute |
--note <text> | Append a structured note to the active run's companion doc |
--promote | Interactively promote run insights to spec/knowhow |
--lite | Force lightweight companion channel (zero-run, knowledge load only) |
--run | Force standard channel (create a run even for simple tasks) |
--chain | Force manual-engine chain creation for a multi-step intent (skip detection, go straight to S_CHAIN_CREATE) |
Mode detection (priority order):
--note โ S_NOTE (companion note mode)
--promote โ S_PROMOTE (companion promote mode)
--lite โ S_LITE (companion lightweight channel)
--chain โ S_CHAIN_CREATE (build a manual-engine chain from the intent)
--suggest โ S_RANK โ S_PRESENT (suggest only, never execute)
--list โ S_LIST
- Active manual-engine chain with pending steps AND intent empty/"continue" โ S_CHAIN_CONT
- Intent text present โ S_STATE โ S_RANK โ S_PRESENT
- No arguments โ lifecycle inference for natural next step
Candidate pool: All 15 first-tier steps registered in prepare/ + workflows/. Pipeline orchestrators (maestro, maestro-ralph*) are NEVER in the candidate pool.
1. **No auto-orchestration** โ chains only via explicit user confirmation, always `--engine manual`, never auto-dispatched. Every chain step requires per-step confirmation; with `-y` execute the current step only, then stop with a continuation hint โ never walk the chain unattended. Chain state lives in session.json and is written via CLI verbs only (`run next` / `run complete --verdict`) โ never written directly
2. **Pipeline orchestrators excluded** โ only recommend registered steps
3. **Empty intent or "continue"/"next"** โ lifecycle_position inference for natural next step
4. **Literal match priority** โ keyword match takes precedence; lifecycle is tie-breaker
5. **Argument pass-through** โ intent text becomes first arg to target step; user can modify at confirmation; `-y` only passes through when user provided it
6. **--suggest never executes** โ show recommendation + prepare content only
7. **--note is append-only** โ never overwrite or reorder existing entries
8. **--promote delegates** โ spec/knowhow promotion routes through `spec add` / `manage knowledge capture`, never writes directly
9. **Recall is advisory** โ exact live identity may suggest `session resume`; historical similarity always has `automatic=false` and requires `run recall-confirm` before fork/import/new
<state_machine>
S_PARSE โ Parse arguments, extract flags, detect mode
S_LITE โ Lightweight companion: load specs + knowhow for the task, no run creation
S_NOTE โ Append structured note to active run companion doc
S_PROMOTE โ Review run outputs, promote insights to spec/knowhow
S_CHAIN_CREATE โ Compose chain definition from intent โ create manual-engine session โ step
S_CHAIN_CONT โ Resume active manual-engine chain: show progress, advance the queue head
S_CHAIN_STEP โ One chain step: `run next` โ confirm โ execute โ `run complete --verdict`
S_STATE โ Read project state, infer lifecycle_position
S_RANK โ Score candidates, generate top-N
S_LIST โ --list mode: grouped display of all steps
S_PRESENT โ Show top pick + alternatives + reasoning + prepare content
S_CONFIRM โ AskUserQuestion for confirmation (skipped by -y)
S_EXECUTE โ Run prepare + create for selected step
S_FALLBACK โ Intent empty after clarification
S_PARSE:
โ S_NOTE WHEN: --note flag
โ S_PROMOTE WHEN: --promote flag
โ S_LITE WHEN: --lite flag
โ S_CHAIN_CREATE WHEN: --chain flag
โ S_LIST WHEN: --list flag
โ S_CHAIN_CONT WHEN: active manual-engine chain has pending steps AND intent empty/"continue"
โ S_STATE WHEN: intent present / "continue"/"next"/"go"
โ S_PARSE WHEN: no intent (1 clarify round via AskUserQuestion)
โ S_FALLBACK WHEN: clarification empty
S_LITE:
โ END DO: load specs + knowhow โ display summary โ suggest next step (no run)
S_NOTE:
โ END DO: append entry to {run_dir}/outputs/companion.md
S_PROMOTE:
โ END DO: review outputs โ Skill(spec, "add") / Skill(manage, "knowledge capture") for each insight
S_CHAIN_CREATE:
โ S_CHAIN_STEP WHEN: user confirms the chain definition DO: A_CREATE_CHAIN
โ END WHEN: user cancels
S_CHAIN_CONT:
โ S_CHAIN_STEP WHEN: pending steps remain DO: show chain progress (step k/n)
โ END WHEN: chain exhausted โ completion summary
S_CHAIN_STEP:
โ S_CHAIN_STEP WHEN: step completed AND user confirms "Continue next step"
โ END WHEN: user stops / -y single step done / chain exhausted
DO: A_STEP_CHAIN
S_STATE:
โ S_RANK DO: A_INFER_LIFECYCLE
S_RANK:
โ S_PRESENT DO: A_SCORE_CANDIDATES
S_LIST:
โ END DO: group steps by cluster, display with descriptions
S_PRESENT:
โ END WHEN: --dry-run OR --suggest
โ S_EXECUTE WHEN: -y
โ S_CONFIRM WHEN: interactive
S_CONFIRM:
โ S_EXECUTE WHEN: user confirms / selects alternative / modifies args
โ S_CHAIN_CREATE WHEN: multi_step AND user picks "Create a manual chain"
โ END WHEN: user cancels
S_EXECUTE:
โ END DO: A_EXECUTE_STEP
S_FALLBACK:
โ END DO: raise E001
A_INFER_LIFECYCLE
Read project state to infer lifecycle_position:
maestro run prepare --platform pi --workflow-root .
cat .workflow/state.json 2>/dev/null
State โ lifecycle_position โ natural next step:
| State | lifecycle_position | Natural next |
|---|
No .workflow/ + no source code | brainstorm | brainstorm |
No .workflow/ + has source code | init | (maestro-init, not a step) |
| state.json exists, no roadmap, no sessions | analyze-macro | analyze |
| Has macro analysis, no roadmap | roadmap | roadmap |
| Has roadmap, dep-ready session unstarted | analyze | analyze --session {slug} |
| Latest artifact = analysis | plan | plan --session {active} |
| Latest artifact = plan | execute | execute --session {active} |
| Latest artifact = execution | review | review --session {active} |
| Review verdict = PASS | auto-test | auto-test --session {active} |
| Tests green + active session | session-seal | (maestro-session-seal, not a step) |
| Any stage has gaps/failures | debug | debug {gap} |
Lifecycle main line:
init โ {brainstorm | blueprint | analyze-macro} โ roadmap
โ [per session] analyze โ plan โ execute
โ [quality gate] review โ auto-test โ test
โ session-seal โ next dep-ready session
A_SCORE_CANDIDATES
Scoring signals (high โ low):
| Signal | Weight | Description |
|---|
| Intent keyword match | High | Literal match against routing table |
| Lifecycle natural next | High | Decisive when intent is empty/"continue" |
| Step name keyword match | Medium | Intent contains "test" โ test/auto-test boosted |
| Workflow cluster match | Medium | Learning/knowledge/issue clusters |
| Recent activity avoidance | Low | Recently completed steps demoted |
| Precondition unmet | Exclude | Remove from pool entirely |
Multi-step detection: intent matches keywords of โฅ2 distinct steps in the routing table โ set multi_step. Candidate pool unchanged โ orchestrators stay excluded (invariant 2); the flag drives the advisory banner + Channel: multi-step in S_PRESENT, offering three continuation modes: a user-confirmed manual-engine chain (S_CHAIN_CREATE), stepwise without a chain, or handoff to /maestro.
Intent โ step routing table (candidate pool):
| Intent keywords | Recommended step | What it does |
|---|
| brainstorm / ideate / what-if / perspectives / multi-role | brainstorm | Multi-role creative exploration with cross-role conflict resolution |
| blueprint / PRD / architecture doc / formal spec / epic | blueprint | Generate formal specification package (Brief, PRD, Architecture, Epics) via 6-phase document chain |
| analyze / assess / evaluate / multi-dimension / findings | analyze | Systematic multi-angle assessment producing findings + risk-matrix for plan consumption |
| plan / decompose / breakdown / task split / DAG / waves | plan | Decompose confirmed analysis into executable task DAG with waves and collision avoidance |
| execute / implement / build / code / develop | execute | Implement code changes following current-plan DAG+waves with smoke self-check |
| verify / validate / acceptance / confirm implementation | verify | Independent verification of requirement coverage and behavioral correctness against plan |
| debug / bug / error / root cause / failing / broken / trace | debug | Scientific-method root cause diagnosis โ reproduction, hypothesis testing, backward tracing |
| review / code review / audit / inspect / PR review | review | Layered multi-dimensional code review producing traceable review-findings |
| test / UAT / manual test / browser test / acceptance test | test | Conversational UAT + coverage + optional browser acceptance on verified deliverables |
| auto-test / automated test / CI test / pipeline test / L0-L3 | auto-test | Automated CSV-layered test pipeline iterating to convergence |
| roadmap / milestone / phasing / session plan / work breakdown | roadmap | Decompose requirements into session DAG with scope, success criteria, dependency edges |
| quick / small / ad-hoc / one-off / trivial | quick | Shortened pipeline for small tasks, preserving atomic commits and state tracking |
| retrospective / retro / lessons learned / post-mortem / reflect | retrospective | Post-phase four-lens review (technical/process/quality/decision) โ spec/knowhow/issue routing |
| grill / pressure test / stress test | grill | Socratic pressure-test of a plan/idea against codebase reality โ adversarial questioning, terminology collision checks |
| collab / cross-verify / multi-tool / second opinion | collab | Fan out one requirement to multiple CLI tools, cross-verify findings into a unified conclusion |
| refactor / tech debt | quality-refactor (retained skill) | โ |
| sync docs | manage sync codebase (retained skill) | โ |
| issue / defect | manage issue (retained skill) | โ |
| wiki / knowledge graph | manage knowledge wiki (retained skill) | โ |
| spec / rule / constraint | spec load / spec add (retained skill) | โ |
| init / project setup | maestro-init (retained skill) | โ |
| status / dashboard | manage status (retained skill) | โ |
| security / OWASP | security-audit (retained skill) | โ |
| learn / explore code / follow | learn follow / learn investigate (retained skill) | โ |
| harvest / extract knowledge | manage knowledge harvest (retained skill) | โ |
| fork / parallel dev | maestro-fork (retained skill) | โ |
Auxiliary workflow clusters:
| Cluster | Trigger | Chain |
|---|
| Learning | New code / unknown module | learn follow โ learn decompose โ learn consult |
| Knowledge | Distill experience | manage knowledge harvest โ manage knowledge capture โ spec add |
| Issue | Defect management | manage issue discover โ manage issue |
A_EXECUTE_STEP
Non-chain path (standalone single run). Steps inside a manual-engine chain advance via A_STEP_CHAIN instead โ never mix the two for one step.
For first-tier steps (those with prepare/ + workflows/ files):
maestro run recall <step> --intent "<short goal>" --json --workflow-root .
maestro run prepare --platform pi <step> --workflow-root .
maestro run create <step> --session YYYYMMDD-<step>-<topic> --intent "<short goal>" --workflow-root . [-- args...]
maestro run brief --platform pi <run_id> --workflow-root .
maestro run complete <run_id> --workflow-root .
After run complete: re-infer lifecycle and surface the natural next step as a continuation hint โ stepwise multi-step work proceeds by re-invoking /maestro-next.
For retained skills (not in step registry): execute via Skill({ skill: <name>, args: <args> }) directly.
A_CREATE_CHAIN
- Compose 2-5 steps from the routing-table hits, ordered by the lifecycle main line;
command values limited to first-tier steps.
- Present the chain for confirmation (ordered step list + intent). User can drop/reorder steps before creation.
- Create the session โ chain definition JSON via stdin, slug per run-mode convention (
YYYYMMDD-next-<topic>, ASCII โค64):
echo '{"intent":"<phrase>","steps":[{"command":"plan"},{"command":"execute"},{"command":"test"}]}' \
| maestro session create YYYYMMDD-next-<topic> --chain-file - --engine manual --intent "<phrase>" --workflow-root .
- Capture the returned
session_id. Leave the lease unset โ interactive sessions stay unlocked. Proceed to S_CHAIN_STEP.
A_STEP_CHAIN
maestro run next --session <session_id> --workflow-root . โ the birth packet carries run_id / run_dir / upstream. NEVER call run create for this step (birth-packet red line, run-mode.md).
- Present the step + chain progress (
step k/n) โ AskUserQuestion: Execute / Skip this step (maestro session chain skip) / Modify step (maestro session chain replace) / Stop chain.
- Execute the workflow (re-attach context via
maestro run brief --platform pi <run_id> when needed), then maestro run complete <run_id> --verdict done โ the chain step advances atomically.
- Pending steps remain โ offer Continue next step (loop to 1) or stop with a continuation hint (
/maestro-next resumes the chain). With -y: execute the current step only, then stop with the hint โ never walk the chain unattended.
- No pending steps โ chain completion summary (steps done/skipped, artifact paths).
</state_machine>
<complexity_routing>
Three-way complexity routing
Assess task complexity at S_RANK and surface the verdict in S_PRESENT (Channel line), so the routing decision is visible before confirmation:
| Complexity | Channel | Criteria | Action |
|---|
| Lightweight | Companion (zero-run) | Simple lookup, quick question, knowledge check | Load specs/knowhow, answer directly, no run created |
| Standard | Single step (one run) | Clear atomic task matching one step | prepare โ create โ brief โ complete |
| Multi-step | Chain or stepwise | Task spans multiple steps | Create a user-confirmed manual-engine chain (S_CHAIN_CREATE), execute the best first step stepwise, or hand off to /maestro |
Routing preference: prefer Standard over Lightweight. When uncertain, create a run. A run with a thin report is better than a missed artifact.
Override flags:
--lite forces Lightweight (companion channel)
--run forces Standard (single run)
- Neither flag: auto-detect from intent complexity
</complexity_routing>
--list mode
Group all 15 first-tier steps by cluster + show retained skills separately:
Core Chain: analyze โ plan โ execute โ verify
Quality: review, test, auto-test, debug, retrospective
Discovery: grill, collab, brainstorm, blueprint, roadmap, quick
Retained Skills: quality-refactor, manage sync codebase, manage-*, learn-*, spec-*, ...
Normal mode
[โ Multi-step intent โ create a manual chain, take just the first step, or hand off to /maestro "<intent>"] โ only when multi_step
Target: /<step-name>
<description>
Reason: <match rule + lifecycle position>
Channel: companion (zero-run) | single run | multi-step (stepwise / chain)
Alternatives:
2. /<alt-1> โ <description>
3. /<alt-2> โ <description>
Args: <args>
When multi_step: the executable recommendation stays the best first step, and the confirmation menu becomes three-way โ Create a manual chain (Recommended; โ S_CHAIN_CREATE), Just this step (stepwise; lifecycle inference recommends the follow-up), Hand off to /maestro.
--dry-run / --suggest: display and stop.
-y: execute immediately.
Otherwise: AskUserQuestion (single-select, header: "Confirm"):
- Execute recommendation (Recommended)
- Choose alternative
- Modify arguments
- Cancel
<error_codes>
| Code | Severity | Condition | Recovery |
|---|
| E001 | error | Intent empty after clarification | Provide intent or use --list |
| E002 | error | No steps found in registry | Check prepare/ and workflows/ directories |
| E003 | error | Selected step has no prepare/workflow files | Verify step installation |
| E004 | error | Multiple running manual chains, ambiguous resolution | Pass --session explicitly (run next lists candidates) |
| W001 | warning | Top-1 and top-2 scores too close | Force show top 3 for user decision |
| W002 | warning | No good match for intent | Suggest /maestro or /maestro-ralph for orchestration |
| W003 | warning | Chain step skipped or replaced | Recorded in chain (status=skipped); remaining steps unaffected |
</error_codes>