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.
Files changed (179) hide show
  1. package/README.md +124 -0
  2. package/agents/aggregator.md +27 -0
  3. package/agents/cli-explore-agent.md +188 -0
  4. package/agents/cross-role-reviewer.md +171 -0
  5. package/agents/delegate.md +19 -0
  6. package/agents/explorer.md +23 -0
  7. package/agents/impeccable-agent.md +99 -0
  8. package/agents/ralph-executor.md +81 -0
  9. package/agents/reference.md +24 -0
  10. package/agents/role-design-author.md +220 -0
  11. package/agents/team-supervisor.md +143 -0
  12. package/agents/team-worker.md +237 -0
  13. package/agents/ui-design-agent.md +270 -0
  14. package/agents/workflow-analyzer.md +116 -0
  15. package/agents/workflow-codebase-mapper.md +77 -0
  16. package/agents/workflow-collab-planner.md +147 -0
  17. package/agents/workflow-debugger.md +104 -0
  18. package/agents/workflow-executor.md +133 -0
  19. package/agents/workflow-external-researcher.md +86 -0
  20. package/agents/workflow-integration-checker.md +83 -0
  21. package/agents/workflow-nyquist-auditor.md +85 -0
  22. package/agents/workflow-phase-researcher.md +85 -0
  23. package/agents/workflow-plan-checker.md +100 -0
  24. package/agents/workflow-planner.md +200 -0
  25. package/agents/workflow-project-researcher.md +74 -0
  26. package/agents/workflow-research-synthesizer.md +70 -0
  27. package/agents/workflow-reviewer.md +82 -0
  28. package/agents/workflow-roadmapper.md +81 -0
  29. package/agents/workflow-verifier.md +120 -0
  30. package/package.json +58 -0
  31. package/skills/codify-to-knowhow/SKILL.md +167 -0
  32. package/skills/delegation-check/SKILL.md +297 -0
  33. package/skills/domain-add/SKILL.md +75 -0
  34. package/skills/insight-challenge/SKILL.md +226 -0
  35. package/skills/learn-decompose/SKILL.md +124 -0
  36. package/skills/learn-follow/SKILL.md +163 -0
  37. package/skills/learn-investigate/SKILL.md +160 -0
  38. package/skills/learn-second-opinion/SKILL.md +128 -0
  39. package/skills/maestro/SKILL.md +239 -0
  40. package/skills/maestro-amend/SKILL.md +169 -0
  41. package/skills/maestro-analyze/SKILL.md +173 -0
  42. package/skills/maestro-blueprint/SKILL.md +159 -0
  43. package/skills/maestro-brainstorm/SKILL.md +193 -0
  44. package/skills/maestro-collab/SKILL.md +181 -0
  45. package/skills/maestro-companion/SKILL.md +536 -0
  46. package/skills/maestro-composer/SKILL.md +192 -0
  47. package/skills/maestro-execute/SKILL.md +193 -0
  48. package/skills/maestro-fork/SKILL.md +104 -0
  49. package/skills/maestro-grill/SKILL.md +151 -0
  50. package/skills/maestro-guard/SKILL.md +124 -0
  51. package/skills/maestro-help/SKILL.md +328 -0
  52. package/skills/maestro-impeccable/SKILL.md +302 -0
  53. package/skills/maestro-init/SKILL.md +151 -0
  54. package/skills/maestro-merge/SKILL.md +90 -0
  55. package/skills/maestro-milestone-audit/SKILL.md +117 -0
  56. package/skills/maestro-milestone-complete/SKILL.md +133 -0
  57. package/skills/maestro-milestone-release/SKILL.md +131 -0
  58. package/skills/maestro-next/SKILL.md +269 -0
  59. package/skills/maestro-overlay/SKILL.md +203 -0
  60. package/skills/maestro-plan/SKILL.md +194 -0
  61. package/skills/maestro-player/SKILL.md +184 -0
  62. package/skills/maestro-quick/SKILL.md +117 -0
  63. package/skills/maestro-ralph/SKILL.md +905 -0
  64. package/skills/maestro-ralph-cli/SKILL.md +976 -0
  65. package/skills/maestro-ralph-cli-execute/SKILL.md +229 -0
  66. package/skills/maestro-ralph-execute/SKILL.md +409 -0
  67. package/skills/maestro-ralph-v2/SKILL.md +1198 -0
  68. package/skills/maestro-roadmap/SKILL.md +157 -0
  69. package/skills/maestro-swarm-workflow/SKILL.md +272 -0
  70. package/skills/maestro-tools-execute/SKILL.md +143 -0
  71. package/skills/maestro-tools-register/SKILL.md +192 -0
  72. package/skills/maestro-ui-codify/SKILL.md +127 -0
  73. package/skills/maestro-universal-workflow/SKILL.md +622 -0
  74. package/skills/maestro-update/SKILL.md +156 -0
  75. package/skills/manage-codebase-rebuild/SKILL.md +111 -0
  76. package/skills/manage-drift-realign/SKILL.md +159 -0
  77. package/skills/manage-harvest/SKILL.md +121 -0
  78. package/skills/manage-issue/SKILL.md +88 -0
  79. package/skills/manage-issue-discover/SKILL.md +104 -0
  80. package/skills/manage-kg-extractors/SKILL.md +147 -0
  81. package/skills/manage-knowhow/SKILL.md +102 -0
  82. package/skills/manage-knowhow-capture/SKILL.md +109 -0
  83. package/skills/manage-knowledge-audit/SKILL.md +147 -0
  84. package/skills/manage-status/SKILL.md +80 -0
  85. package/skills/manage-wiki/SKILL.md +104 -0
  86. package/skills/odyssey-debug/SKILL.md +344 -0
  87. package/skills/odyssey-improve/SKILL.md +423 -0
  88. package/skills/odyssey-planex/SKILL.md +542 -0
  89. package/skills/odyssey-review-test-fix/SKILL.md +392 -0
  90. package/skills/odyssey-ui/SKILL.md +388 -0
  91. package/skills/prompt-generator/SKILL.md +470 -0
  92. package/skills/quality-auto-test/SKILL.md +168 -0
  93. package/skills/quality-debug/SKILL.md +176 -0
  94. package/skills/quality-refactor/SKILL.md +108 -0
  95. package/skills/quality-retrospective/SKILL.md +134 -0
  96. package/skills/quality-review/SKILL.md +169 -0
  97. package/skills/quality-sync/SKILL.md +90 -0
  98. package/skills/quality-test/SKILL.md +183 -0
  99. package/skills/scholar-anti-ai-writing/SKILL.md +173 -0
  100. package/skills/scholar-anti-ai-writing/references/patterns-chinese.md +242 -0
  101. package/skills/scholar-anti-ai-writing/references/patterns-english.md +242 -0
  102. package/skills/scholar-citation-verify/SKILL.md +166 -0
  103. package/skills/scholar-citation-verify/references/api-usage.md +372 -0
  104. package/skills/scholar-citation-verify/references/common-errors.md +384 -0
  105. package/skills/scholar-citation-verify/references/verification-rules.md +399 -0
  106. package/skills/scholar-experiment/SKILL.md +321 -0
  107. package/skills/scholar-ideation/SKILL.md +288 -0
  108. package/skills/scholar-latex-organizer/SKILL.md +186 -0
  109. package/skills/scholar-publish/SKILL.md +220 -0
  110. package/skills/scholar-rebuttal-pro/README.md +313 -0
  111. package/skills/scholar-rebuttal-pro/SKILL.md +511 -0
  112. package/skills/scholar-review/SKILL.md +227 -0
  113. package/skills/scholar-thesis-docx/README.md +111 -0
  114. package/skills/scholar-thesis-docx/README_EN.md +108 -0
  115. package/skills/scholar-thesis-docx/SKILL.md +212 -0
  116. package/skills/scholar-thesis-docx/references/failure-patterns-and-quality-gates.md +178 -0
  117. package/skills/scholar-thesis-docx/references/figure-and-code-rules.md +33 -0
  118. package/skills/scholar-thesis-docx/references/paper-format-workflow.md +68 -0
  119. package/skills/scholar-thesis-docx/references/script-usage.md +157 -0
  120. package/skills/scholar-thesis-docx/scripts/audit_docx_ooxml.py +429 -0
  121. package/skills/scholar-thesis-docx/scripts/check_word_com.ps1 +50 -0
  122. package/skills/scholar-thesis-docx/scripts/export_word_pdf.ps1 +62 -0
  123. package/skills/scholar-thesis-docx/scripts/normalize_word_styles.ps1 +498 -0
  124. package/skills/scholar-thesis-docx/scripts/render_mermaid_figure.ps1 +148 -0
  125. package/skills/scholar-writing/SKILL.md +296 -0
  126. package/skills/security-audit/SKILL.md +244 -0
  127. package/skills/skill-generator/SKILL.md +472 -0
  128. package/skills/skill-iter-tune/SKILL.md +382 -0
  129. package/skills/skill-simplify/SKILL.md +63 -0
  130. package/skills/skill-tuning/SKILL.md +174 -0
  131. package/skills/spec-add/SKILL.md +105 -0
  132. package/skills/spec-load/SKILL.md +98 -0
  133. package/skills/spec-remove/SKILL.md +74 -0
  134. package/skills/spec-setup/SKILL.md +75 -0
  135. package/skills/team-adversarial-swarm/SKILL.md +233 -0
  136. package/skills/team-adversarial-swarm/scripts/__pycache__/pheromone.cpython-313.pyc +0 -0
  137. package/skills/team-adversarial-swarm/scripts/__pycache__/scoring.cpython-313.pyc +0 -0
  138. package/skills/team-adversarial-swarm/scripts/aco.py +473 -0
  139. package/skills/team-adversarial-swarm/scripts/pheromone.py +144 -0
  140. package/skills/team-adversarial-swarm/scripts/scoring.py +92 -0
  141. package/skills/team-adversarial-swarm/scripts/test_aco.py +475 -0
  142. package/skills/team-arch-opt/SKILL.md +158 -0
  143. package/skills/team-brainstorm/SKILL.md +171 -0
  144. package/skills/team-coordinate/SKILL.md +266 -0
  145. package/skills/team-designer/SKILL.md +160 -0
  146. package/skills/team-executor/SKILL.md +189 -0
  147. package/skills/team-frontend/SKILL.md +136 -0
  148. package/skills/team-frontend-debug/SKILL.md +198 -0
  149. package/skills/team-interactive-craft/SKILL.md +141 -0
  150. package/skills/team-issue/SKILL.md +171 -0
  151. package/skills/team-lifecycle-v4/SKILL.md +209 -0
  152. package/skills/team-motion-design/SKILL.md +142 -0
  153. package/skills/team-perf-opt/SKILL.md +175 -0
  154. package/skills/team-planex/SKILL.md +137 -0
  155. package/skills/team-quality-assurance/SKILL.md +147 -0
  156. package/skills/team-review/SKILL.md +147 -0
  157. package/skills/team-roadmap-dev/SKILL.md +169 -0
  158. package/skills/team-swarm/SKILL.md +178 -0
  159. package/skills/team-swarm/scripts/aco.py +473 -0
  160. package/skills/team-swarm/scripts/pheromone.py +144 -0
  161. package/skills/team-swarm/scripts/scoring.py +92 -0
  162. package/skills/team-swarm/scripts/test_aco.py +475 -0
  163. package/skills/team-tech-debt/SKILL.md +128 -0
  164. package/skills/team-testing/SKILL.md +143 -0
  165. package/skills/team-ui-polish/SKILL.md +141 -0
  166. package/skills/team-uidesign/SKILL.md +144 -0
  167. package/skills/team-ultra-analyze/SKILL.md +173 -0
  168. package/skills/team-ux-improve/SKILL.md +151 -0
  169. package/skills/team-visual-a11y/SKILL.md +156 -0
  170. package/skills/workflow-skill-designer/SKILL.md +496 -0
  171. package/src/extension/index.ts +222 -0
  172. package/src/extension/schemas.ts +131 -0
  173. package/src/providers/cli-tools-loader.ts +74 -0
  174. package/src/providers/provider-registry.ts +130 -0
  175. package/src/tools/delegate.ts +85 -0
  176. package/src/tools/explore.ts +134 -0
  177. package/src/tools/moa.ts +213 -0
  178. package/src/tools/status.ts +99 -0
  179. package/src/tools/wait.ts +166 -0
@@ -0,0 +1,133 @@
1
+ ---
2
+ name: maestro-milestone-complete
3
+ description: "Archive completed milestone and prepare for next Arguments: [<milestone>]"
4
+ allowed-tools: Read Write Bash Glob Grep Agent AskUserQuestion
5
+ ---
6
+
7
+ <purpose>
8
+ Archive passed milestone: validate, archive artifacts, extract knowhow, advance state.
9
+ Requires audit PASS; produces milestone archive and learnings.
10
+ </purpose>
11
+
12
+ <required_reading>
13
+ @~/.maestro/workflows/milestone-complete.md
14
+ </required_reading>
15
+
16
+ <deferred_reading>
17
+ - [state.json](~/.maestro/templates/state.json) — read when updating milestone_history and advancing state
18
+ </deferred_reading>
19
+
20
+ <context>
21
+ Milestone: $ARGUMENTS (optional -- defaults to current_milestone from state.json).
22
+ If $ARGUMENTS is empty AND current_milestone is null → raise E001 with message "No milestone specified and no current_milestone set in state.json. Provide a milestone identifier as argument."
23
+
24
+ **Requires:** `/maestro-milestone-audit` should have passed.
25
+
26
+ **State files:**
27
+ - `.workflow/state.json` — artifacts[], milestones[] (with `type` field: `"standard"` | `"adhoc"`), current_milestone, milestone_history[]
28
+ - `.workflow/roadmap.md` — milestone structure (standard milestones only; adhoc milestones may not have roadmap)
29
+ - `.workflow/milestones/{milestone}/audit-report.md` — audit results
30
+ </context>
31
+
32
+ <execution>
33
+ Follow '~/.maestro/workflows/milestone-complete.md' completely.
34
+
35
+ Archive flow steps (validation, directory archival, artifact history, knowhow extraction, state advancement, cleanup) are defined in workflow `milestone-complete.md`.
36
+
37
+ ### Phase Gates (MANDATORY, BLOCKING)
38
+
39
+ **GATE 1: Validation → Archival**
40
+ - REQUIRED: Audit report verified as PASS (E002 if not).
41
+ - REQUIRED: No incomplete artifacts remain (E003 if any).
42
+ - BLOCKED if: audit not passed (E002) or incomplete artifacts remain (E003) — cannot archive unvalidated milestone.
43
+
44
+ **GATE 2: Archival → Knowhow Extraction**
45
+ - REQUIRED: Scratch artifacts moved to `milestones/{M}/artifacts/`.
46
+ - REQUIRED: Artifact entries archived to milestone_history in state.json.
47
+ - BLOCKED if missing: artifacts not moved or history not updated — knowhow extraction needs archived artifacts as input.
48
+
49
+ **GATE 3: Knowhow Extraction → State Advancement**
50
+ - REQUIRED: Knowhow extraction attempted (may produce 0 entries — W001).
51
+ - REQUIRED: `project.md` Context updated with milestone summary.
52
+ - BLOCKED if missing: knowhow extraction not attempted or project.md not updated — state advancement requires completed knowledge capture.
53
+
54
+ **GATE 4: State Advancement → Completion**
55
+ - REQUIRED: AskUserQuestion confirmation before state.json advancement — show current milestone, next milestone (or null for adhoc), and artifacts to clear. User must confirm or abort.
56
+ - REQUIRED: state.json updated — next milestone as current (standard) or current_milestone=null (adhoc) (after confirmation).
57
+ - REQUIRED: Roadmap snapshot saved (standard only).
58
+ - BLOCKED if missing: state.json not advanced — project remains stuck on completed milestone.
59
+
60
+ ### Knowledge Promotion Inquiry
61
+
62
+ After knowhow extraction (step 4), scan `learnings.md` for promotion candidates:
63
+
64
+ 1. **High-frequency pattern detection**: Scan all `<spec-entry>` entries with `roles="implement"` for keyword overlap (≥2 entries sharing keywords):
65
+ → Ask: "Keyword '{keyword}' appears in {N} knowhow entries. Should this be promoted to a formal coding convention? (`/spec-add coding`)"
66
+
67
+ 2. **Convention drift detection**: Compare executed task summaries against `coding-conventions.md` and `architecture-constraints.md`:
68
+ → Ask: "Were any established conventions bypassed during this milestone? Should conventions be updated?"
69
+
70
+ 3. **Wiki island check**: AskUserQuestion "Run wiki-connect --fix to link newly extracted knowledge?" — execute `manage-wiki connect --fix` only if user confirms.
71
+
72
+ Each promotion candidate requires explicit user confirmation via AskUserQuestion before writing:
73
+ - **"Promote"** → invoke `Skill({ skill: "spec-add", args: "<category> <content>" })` with promoted content, preserving original date and source traceability.
74
+ - **"Skip"** → do not promote this candidate; proceed to next.
75
+ - **"Skip all"** → skip remaining candidates.
76
+
77
+ **Adhoc milestone (D-008):** When completing an adhoc milestone, skip roadmap snapshot and do not advance to next milestone. Set `current_milestone = null`, `status = "idle"`. Adhoc milestones are self-contained — no successor in roadmap chain.
78
+ </execution>
79
+
80
+ <completion>
81
+ ### Standalone report
82
+
83
+ ```
84
+ === MILESTONE COMPLETE ===
85
+ Milestone: {milestone_id}
86
+ Status: ARCHIVED
87
+ Artifacts archived: {count}
88
+ Knowhow extracted: {count} entries
89
+ Next milestone: {next_id | "none (adhoc)"}
90
+ ==============================
91
+ ```
92
+
93
+ ### Ralph-invoked completion
94
+
95
+ End the step by calling the CLI (no text block output):
96
+ ```
97
+ maestro ralph complete <idx> --status {STATUS} [--evidence {path}]
98
+ ```
99
+
100
+ Status verdicts:
101
+ - **DONE** — Normal completion
102
+ - **DONE_WITH_CONCERNS** — Completed with caveats; pass `--concerns`
103
+ - **NEEDS_RETRY** — Tooling error / transient issue; ralph will retry
104
+ - **BLOCKED** — External hard blocker; pass `--reason`
105
+
106
+ ### Next-step routing
107
+
108
+ | Condition | Suggestion |
109
+ |-----------|-----------|
110
+ | Cut a release | `/maestro-milestone-release` |
111
+ | Next milestone (standard) | `/maestro-analyze {next_milestone}` or `/maestro-plan {next_milestone}` |
112
+ | View state | `/manage-status` |
113
+ </completion>
114
+
115
+ <error_codes>
116
+ | Code | Severity | Condition | Recovery |
117
+ |------|----------|-----------|----------|
118
+ | E001 | error | Milestone identifier required | Check arguments |
119
+ | E002 | error | Audit not passed | Run maestro-milestone-audit first |
120
+ | E003 | error | Incomplete artifacts remain | Complete remaining work first |
121
+ | W001 | warning | Knowhow extraction produced 0 entries | Review milestone work for missed learnings |
122
+ | W002 | warning | Wiki-connect found unlinked knowledge islands | Run `manage-wiki connect --fix` manually |
123
+ </error_codes>
124
+
125
+ <success_criteria>
126
+ - [ ] Audit report verified as PASS
127
+ - [ ] Scratch artifacts moved to milestones/{M}/artifacts/
128
+ - [ ] Artifact entries archived to milestone_history
129
+ - [ ] Knowhow extracted to specs/learnings.md
130
+ - [ ] state.json updated: next milestone as current (standard) or current_milestone=null (adhoc), artifacts[] cleared
131
+ - [ ] Roadmap snapshot saved (standard only; adhoc skips)
132
+ - [ ] project.md Context updated with milestone summary
133
+ </success_criteria>
@@ -0,0 +1,131 @@
1
+ ---
2
+ name: maestro-milestone-release
3
+ description: "Bump version, generate changelog, tag milestone Arguments: [<version>] [--bump patch|minor|major] [--dry-run] [--no-tag] [--no-push]"
4
+ allowed-tools: Read Write Edit Bash Glob Grep Agent AskUserQuestion
5
+ ---
6
+
7
+ <purpose>
8
+ Package a completed milestone into a releasable version: version bump → changelog → tag → push.
9
+
10
+ Pipeline position: downstream of `/maestro-milestone-complete`. Terminal command.
11
+ </purpose>
12
+
13
+ <required_reading>
14
+ @~/.maestro/workflows/milestone-release.md
15
+ </required_reading>
16
+
17
+ <context>
18
+ $ARGUMENTS -- optional explicit version string and flags.
19
+
20
+ **Flags:**
21
+
22
+ | Flag | Effect | Default |
23
+ |------|--------|---------|
24
+ | `<version>` | Explicit version (e.g. `1.2.0`). If omitted, version is derived from `--bump` or prompted | — |
25
+ | `--bump patch\|minor\|major` | Semver bump relative to the current version | `minor` |
26
+ | `--dry-run` | Compute the next version, changelog diff, and tag name without writing files or creating tags | `false` |
27
+ | `--no-tag` | Skip git tag creation (version bump + changelog only) | `false` |
28
+ | `--no-push` | Skip `git push --follow-tags` after tagging | `false` |
29
+
30
+ **State files:**
31
+ - `.workflow/state.json` -- milestone_history (last completed milestone), previous release version
32
+ - `.workflow/milestones/{milestone}/summary.md` -- milestone summary (from `maestro-milestone-complete`)
33
+ - `.workflow/milestones/{milestone}/audit-report.md` -- audit verdict (must be PASS)
34
+ - `CHANGELOG.md` -- release notes file (created if missing)
35
+ - Version manifest -- `package.json` / `pyproject.toml` / `Cargo.toml` / etc. (auto-detected)
36
+
37
+ **Preconditions:**
38
+ - Current milestone must be completed (audit PASS + `/maestro-milestone-complete` run)
39
+ - Working tree must be clean (no uncommitted changes) unless `--dry-run`
40
+ </context>
41
+
42
+ <interview_protocol>
43
+ Follows @~/.maestro/workflows/interview-mechanics.md standard.
44
+
45
+ **Decision points**: version bump type (major / minor / patch / custom), changelog review and confirmation
46
+ **Scope guard**: only release decisions; do not prejudge next milestone scope
47
+ </interview_protocol>
48
+
49
+ <execution>
50
+ Follow '~/.maestro/workflows/milestone-release.md' completely.
51
+
52
+ ### Phase Gates (MANDATORY, BLOCKING)
53
+
54
+ **GATE 1: Validation → Version Bump**
55
+ - REQUIRED: Target milestone identified from `state.json.milestone_history` (last entry with `status == "completed"`) or explicit `[milestone]` argument. E001 if no completed milestone found.
56
+ - REQUIRED: Working tree clean (no uncommitted changes). E003 if dirty.
57
+
58
+ **GATE 2: Version Bump → Changelog**
59
+ - REQUIRED: Target version computed and greater than previous (E005 if not).
60
+ - REQUIRED: Version manifest file(s) identified and accessible.
61
+
62
+ **GATE 3: Changelog → Tag/Push**
63
+ - REQUIRED: CHANGELOG.md entry written with milestone summary + grouped changes.
64
+ - REQUIRED: AskUserQuestion confirmation before creating release commit — show version, changelog diff, and files to be committed. User must confirm or abort.
65
+ - REQUIRED: Release commit created with conventional message (after confirmation).
66
+
67
+ **GATE 4: Tag → Push → Completion**
68
+ - REQUIRED: AskUserQuestion confirmation before git tag creation — show tag name and annotation (unless --no-tag). User must confirm or abort.
69
+ - REQUIRED: Annotated git tag created (unless --no-tag) (after confirmation).
70
+ - REQUIRED: AskUserQuestion confirmation before git push — show remote and refs to push (unless --no-push). User must confirm or abort.
71
+ - REQUIRED: state.json updated with last_release_version + last_release_at.
72
+
73
+ For `--dry-run`: print computed version, changelog diff, and tag name without side effects.
74
+ </execution>
75
+
76
+ <completion>
77
+ ### Standalone report
78
+
79
+ ```
80
+ === RELEASE COMPLETE ===
81
+ Version: v{previous} → v{new}
82
+ Milestone: {milestone_name}
83
+ Tag: v{new} {pushed|local-only}
84
+ Changelog: {N} entries written to CHANGELOG.md
85
+ Manifest: {file_path} updated
86
+ ```
87
+
88
+ ### Ralph-invoked completion
89
+
90
+ End the step by calling the CLI (no text block output):
91
+ ```
92
+ maestro ralph complete <idx> --status {STATUS} [--evidence {path}]
93
+ ```
94
+
95
+ Status verdicts:
96
+ - **DONE** — Normal completion
97
+ - **DONE_WITH_CONCERNS** — Completed with caveats; pass `--concerns`
98
+ - **NEEDS_RETRY** — Tooling error / transient issue; ralph will retry
99
+ - **BLOCKED** — External hard blocker; pass `--reason`
100
+
101
+ ### Next-step routing
102
+
103
+ | Condition | Suggestion |
104
+ |-----------|-----------|
105
+ | Release successful, starting next milestone | `/maestro-plan {next_milestone}` |
106
+ | Want to view project dashboard | `/manage-status` |
107
+ </completion>
108
+
109
+ <error_codes>
110
+ | Code | Severity | Condition | Recovery |
111
+ |------|----------|-----------|----------|
112
+ | E001 | error | Current milestone not completed (no milestone-complete run) | Run `/maestro-milestone-complete` first |
113
+ | E002 | error | Audit verdict not PASS | Re-run `/maestro-milestone-audit` and resolve findings |
114
+ | E003 | error | Working tree not clean (uncommitted changes) | Commit or stash changes, then retry |
115
+ | E004 | error | Version manifest not found / unsupported | Add supported manifest or pass `<version>` explicitly with `--no-tag` |
116
+ | E005 | error | Target version not greater than current (would break semver monotonicity) | Choose a higher version or run with explicit `<version>` |
117
+ | W001 | warning | No changes detected since last release tag | Confirm whether release is still desired |
118
+ | W002 | warning | Remote push failed (network / auth) | Retry manually with `git push --follow-tags` |
119
+ </error_codes>
120
+
121
+ <success_criteria>
122
+ - [ ] Preconditions validated (milestone complete, audit PASS, clean tree)
123
+ - [ ] Target version computed and greater than previous
124
+ - [ ] Version manifest(s) updated with new version
125
+ - [ ] CHANGELOG.md contains new entry with milestone summary + grouped changes
126
+ - [ ] Release commit created with conventional message
127
+ - [ ] Annotated git tag created (unless `--no-tag`)
128
+ - [ ] Commit + tag pushed to remote (unless `--no-push` or push failed → W002)
129
+ - [ ] User confirmed before each destructive git operation (commit, tag, push) via AskUserQuestion
130
+ - [ ] state.json updated with last_release_version + last_release_at timestamp (after AskUserQuestion confirmation)
131
+ </success_criteria>
@@ -0,0 +1,269 @@
1
+ ---
2
+ name: maestro-next
3
+ description: "Single-command recommendation — pick the best next command from the pool and execute it Arguments: <intent> [-y] [--dry-run] [--top N] [--list]"
4
+ allowed-tools: Read Bash Glob Grep Skill AskUserQuestion
5
+ ---
6
+
7
+ <purpose>
8
+ 解析 intent + project state → 路由表评分 → 推荐单个原子命令 → 确认后 `Skill()` 执行。
9
+ 不创建 session、不构建 chain、不写 status.json。
10
+ </purpose>
11
+
12
+ <context>
13
+ $ARGUMENTS — 意图文本 + 可选 flags。
14
+
15
+ **Flags:**
16
+ - `-y` / `--yes` — 跳过确认,直接执行 top pick
17
+ - `--dry-run` — 仅显示推荐结果,不执行
18
+ - `--top N` — 显示前 N 个候选(默认 3)
19
+ - `--list` — 仅列出可推荐命令池,不做推荐
20
+
21
+ **候选池:** 仅 A_SCORE_CANDIDATES 路由表中列出的命令。管线编排器(`maestro` / `maestro-ralph*` / `maestro-player` / `maestro-composer`)**永远不在候选池**。
22
+ </context>
23
+
24
+ <invariants>
25
+ 1. **不创建 session / 不写 status.json / 不触发后续 chain** — 单次原子执行,产出由目标命令自行管理
26
+ 2. **管线编排器不在候选池** — 仅推荐原子命令
27
+ 3. **空 intent 或 "继续/下一步/next/接下来"** → 直接采用 lifecycle_position 推断的自然下一步
28
+ 4. **字面命中路由表优先** — lifecycle 仅作加分;命中失败时 lifecycle 上升为决定性信号
29
+ 5. **参数传递** — 默认 intent 原文作为第一个 arg;用户可在确认环节修改;`-y` 仅当用户传入时透传到 skill args
30
+ 6. **`--list` 模式跳过 lifecycle 推断与评分**,仅按 workflow 簇分组列出全部候选
31
+ </invariants>
32
+
33
+ <state_machine>
34
+
35
+ <states>
36
+ S_PARSE — 解析 ARGUMENTS、提取 flags PERSIST: —
37
+ S_STATE — 读 project state、推断 lifecycle_position PERSIST: —
38
+ S_RANK — 路由表评分、生成 top-N candidates PERSIST: —
39
+ S_LIST — `--list` 模式:分组展示候选池 PERSIST: —
40
+ S_PRESENT — 显示 top pick + 备选 + 推荐理由 + 执行参数 PERSIST: —
41
+ S_CONFIRM — AskUserQuestion 选择/修改参数(auto_mode 跳过) PERSIST: —
42
+ S_EXECUTE — `Skill({ skill, args })` 单次调用 PERSIST: —
43
+ S_FALLBACK — intent 空且 clarification 失败 PERSIST: —
44
+ </states>
45
+
46
+ <transitions>
47
+
48
+ S_PARSE:
49
+ → S_LIST WHEN: --list flag
50
+ → S_STATE WHEN: intent text present
51
+ → S_STATE WHEN: keyword "continue"/"next"/"go"/"继续"/"下一步"/"接下来"
52
+ → S_PARSE WHEN: no intent (max 1 clarify round) DO: AskUserQuestion
53
+ → S_FALLBACK WHEN: clarification empty
54
+
55
+ S_STATE:
56
+ → S_RANK DO: A_INFER_LIFECYCLE
57
+
58
+ S_RANK:
59
+ → S_PRESENT DO: A_SCORE_CANDIDATES
60
+
61
+ S_LIST:
62
+ → END DO: 按 workflow 簇分组列出全部候选 + description
63
+
64
+ S_PRESENT:
65
+ → END WHEN: --dry-run
66
+ → S_EXECUTE WHEN: -y / --yes
67
+ → S_CONFIRM WHEN: not auto_mode
68
+
69
+ S_CONFIRM:
70
+ → S_EXECUTE WHEN: 用户确认 top pick / 选备选 / 改参数
71
+ → END WHEN: 用户取消
72
+
73
+ S_EXECUTE:
74
+ → END DO: Skill({ skill: <chosen>, args: <args> }) → 输出 "✅ 已执行 /<command>"
75
+
76
+ S_FALLBACK:
77
+ → END DO: raise E001
78
+
79
+ </transitions>
80
+
81
+ <actions>
82
+
83
+ ### A_INFER_LIFECYCLE
84
+
85
+ 读 project state 推断 `lifecycle_position`(核心信号):
86
+
87
+ ```bash
88
+ cat .workflow/state.json 2>/dev/null # phase / milestone / artifacts
89
+ ls -la .workflow/scratch/ 2>/dev/null | head -10 # 最近 artifact (mtime DESC)
90
+ ls -la .workflow/.maestro/ 2>/dev/null | head -5 # 进行中的 session
91
+ ```
92
+
93
+ **项目状态 → lifecycle_position → 自然下一步:**
94
+
95
+ | 项目状态 | lifecycle_position | 自然下一步 |
96
+ |---------|-------------------|-----------|
97
+ | 无 `.workflow/` + 无源码 | brainstorm | `maestro-brainstorm` |
98
+ | 无 `.workflow/` + 有源码 | init | `maestro-init` |
99
+ | 有 state.json,无 roadmap,无 milestones | analyze-macro | `maestro-analyze` (宏观调研) |
100
+ | 有 macro analyze artifact,无 roadmap | roadmap | `maestro-roadmap` |
101
+ | 有 roadmap,未启动 phase | analyze | `maestro-analyze {milestone}` |
102
+ | 最新 artifact = analyze | plan | `maestro-plan {milestone}` |
103
+ | 最新 artifact = plan | execute | `maestro-execute {milestone}` |
104
+ | 最新 artifact = execute | review | `quality-review {milestone}` |
105
+ | review verdict=PASS | test-gen | `quality-auto-test {milestone}` |
106
+ | 测试全绿 + current_milestone 存在 | milestone-audit | `maestro-milestone-audit` |
107
+ | 测试全绿 + current_milestone=null (standalone) | review-done | 回退到 `quality-review` 或 `manage-status`(无 milestone 上下文时不推荐 milestone 命令) |
108
+ | 当前 milestone 全 phase 完成 | milestone-complete | `maestro-milestone-complete` |
109
+ | 任一 stage 产物含 gaps/failed | debug | `quality-debug {gap}` |
110
+
111
+ **Maestro Lifecycle 主线:**
112
+ ```
113
+ init → {grill | brainstorm | blueprint | analyze-macro} → roadmap
114
+ → [per milestone] analyze → plan → execute (includes verification)
115
+ → [quality gate] review → auto-test → test
116
+ → milestone-audit → milestone-complete → milestone-release
117
+ ```
118
+
119
+ **quality vs odyssey 选型:**
120
+
121
+ | 场景 | 推荐 | 原因 |
122
+ |------|------|------|
123
+ | Phase 工件链内的 bug/review/test | `quality-*` | 只读诊断,修复回流 plan→execute 主循环,保持 artifact 链完整 |
124
+ | 独立探索性 bug、跨 phase 问题、非当前 milestone 问题 | `odyssey-debug` | 自带修复+泛化,scratch session 独立于 artifact 链 |
125
+ | Phase 级代码审查(只读报告) | `quality-review` | 输出 verdict + issues,不改代码 |
126
+ | 审查后要求零残留修复 | `odyssey-review-test-fix` | 自带 fix 循环直到零 finding |
127
+ | Phase 级安全专项审计 | `security-audit` | OWASP Top 10 + STRIDE 全覆盖 |
128
+ | 多维运行时质量改进 | `odyssey-improve` | 6 维并行审计 + 泛化 |
129
+ | UI 视觉优化 | `odyssey-ui` | 含发散探索(Polish/Delight) |
130
+
131
+ ### A_SCORE_CANDIDATES
132
+
133
+ **评分信号**(高→低):
134
+
135
+ | 信号 | 权重 | 说明 |
136
+ |------|------|------|
137
+ | intent 命中路由表关键词 | 高 | 字面匹配主依据 |
138
+ | **lifecycle 自然下一步** | **高** | 空 intent / "继续" / "next" 时为决定性 |
139
+ | `name` 关键词命中 intent | 中 | intent 含 "test" → quality-test/quality-auto-test 加分 |
140
+ | Workflow 簇匹配 | 中 | intent 涉及学习/知识/issue 等场景触发对应簇 |
141
+ | Recent activity 反向避免 | 低 | 刚完成的 stage 短期内降权 |
142
+ | **前置条件不满足** | **禁止** | 候选命令的前置条件未满足时,直接从候选池移除(如 `maestro-milestone-*` 在 `current_milestone=null` 时移除) |
143
+
144
+ **前置条件检查(评分前执行,不满足则移除候选):**
145
+
146
+ | 命令 | 前置条件 |
147
+ |------|---------|
148
+ | `maestro-milestone-audit` | `current_milestone` 存在且非 null |
149
+ | `maestro-milestone-complete` | `current_milestone` 存在且非 null |
150
+ | `maestro-milestone-release` | `current_milestone` 存在且非 null |
151
+ | `maestro-merge` | 存在活跃的 fork 分支 |
152
+
153
+ **特殊意图处理:**
154
+
155
+ | Intent 模式 | top pick |
156
+ |------------|---------|
157
+ | 空 / "继续" / "下一步" / "next" / "接下来" | lifecycle 自然下一步 |
158
+ | "什么状态" / "现在到哪了" / "status" | `manage-status` |
159
+ | 字面命中路由表 | 路由表优先(lifecycle 仅加分) |
160
+ | 无任何匹配 | lifecycle 下一步 + raise W002 |
161
+
162
+ **意图 → 命令路由表**(候选池):
163
+
164
+ | 意图关键词 | 推荐命令 |
165
+ |-----------|---------|
166
+ | 头脑风暴 / 探索 / brainstorm / ideate | `maestro-brainstorm` |
167
+ | 规格 / 正式文档 / spec-generate / blueprint | `maestro-blueprint` |
168
+ | 分析 / analyze / 多维度调研 | `maestro-analyze` |
169
+ | 规划 / plan / 任务分解 | `maestro-plan` |
170
+ | 实现 / 执行 / execute | `maestro-execute` |
171
+ | 验证 / verify / 验收 | `maestro-execute` |
172
+ | 调试 / debug / 排查 / bug | `quality-debug` |
173
+ | 审查 / review / 代码审查 | `quality-review` |
174
+ | 测试 / test / UAT | `quality-test` / `quality-auto-test` |
175
+ | 重构 / refactor / 技术债 | `quality-refactor` |
176
+ | 同步文档 / sync docs | `quality-sync` |
177
+ | 回顾 / retro | `quality-retrospective` |
178
+ | issue / 缺陷管理 | `manage-issue` / `manage-issue-discover` |
179
+ | wiki / 知识图谱 | `manage-wiki` (含 connect/digest 子命令) |
180
+ | spec / 规则 / 约束 | `spec-load` / `spec-add` / `spec-setup` |
181
+ | 项目初始化 / init | `maestro-init` |
182
+ | 状态 / status / 仪表盘 | `manage-status` |
183
+ | 文档重建 / codebase 文档 | `manage-codebase-rebuild` / `quality-sync` |
184
+ | 安全 / security / OWASP | `security-audit` |
185
+ | 跟读 / 学习 / 阅读源码 | `learn-follow` / `learn-investigate` |
186
+ | 第二意见 / challenge / consult | `learn-second-opinion` |
187
+ | 提取知识 / harvest | `manage-harvest` / `manage-knowhow-capture` |
188
+ | 设计 / UI / 前端打磨 | `maestro-impeccable` |
189
+ | 里程碑 / milestone | `maestro-milestone-audit` / `maestro-milestone-release` / `maestro-milestone-complete` |
190
+ | fork / 分支 / 并行开发 | `maestro-fork` / `maestro-merge` |
191
+ | 覆盖层 / overlay / amend | `maestro-overlay` / `maestro-amend` |
192
+
193
+ **辅助 workflow 簇**(场景触发,非主线):
194
+
195
+ | 簇 | 触发 | 主推链路 |
196
+ |----|------|---------|
197
+ | Learning | 接触新代码/未知模块 | `learn-follow` → `learn-decompose` → `learn-second-opinion` |
198
+ | Knowledge | 提炼经验 / 沉淀知识 | `manage-harvest` → `manage-knowhow-capture` → `spec-add` |
199
+ | Wiki | 知识图谱整理 | `manage-wiki health` → `manage-wiki connect` → `manage-wiki digest` |
200
+ | Issue | 缺陷管理 | `manage-issue-discover` → `manage-issue` |
201
+ | 文档同步 | 代码大改后 | `quality-sync` → `manage-codebase-rebuild` (if major) |
202
+ | 重构 | 技术债积累 | `quality-refactor` → `quality-review` |
203
+ | 发布 | 里程碑结束 | `maestro-milestone-audit` → `maestro-milestone-release` |
204
+ | 并行开发 | 多 milestone 并行 | `maestro-fork` → ... → `maestro-merge` |
205
+
206
+ 输出 ranked candidates,取 top N(默认 3)。
207
+
208
+ </actions>
209
+
210
+ </state_machine>
211
+
212
+ <presentation>
213
+
214
+ ### `--list` 模式
215
+
216
+ 按 workflow 簇(主线 / Learning / Knowledge / Wiki / Issue / 文档 / 重构 / 发布 / 并行)分组展示全部候选 + description,结束。
217
+
218
+ ### 正常模式
219
+
220
+ ```
221
+ 🎯 推荐 (top pick): /<command-name>
222
+ <description>
223
+ 推荐理由: <命中规则 + lifecycle 位置一句话>
224
+
225
+ 备选:
226
+ 2. /<alt-1> — <description>
227
+ 3. /<alt-2> — <description>
228
+
229
+ 执行参数: <args>
230
+ ```
231
+
232
+ `--dry-run` 展示后结束;`-y` 直接 S_EXECUTE;否则:
233
+
234
+ AskUserQuestion (single-select, header: "执行确认"):
235
+ - **执行推荐** (Recommended) — run top pick with shown args
236
+ - **选择备选** — pick from alternative commands
237
+ - **修改参数** — adjust args before executing
238
+ - **取消** — do nothing
239
+
240
+ </presentation>
241
+
242
+ <appendix>
243
+
244
+ ### Error Codes
245
+
246
+ | Code | Severity | Condition | Recovery |
247
+ |------|----------|-----------|----------|
248
+ | E001 | error | intent 空且 clarification 后仍空 | 提供意图描述或使用 `--list` 浏览 |
249
+ | E002 | error | 候选池为空(`.claude/commands/` 缺失或无 .md) | 检查 commands 目录 |
250
+ | E003 | error | 选定命令名无法解析为有效 skill | 列出有效命令重选 |
251
+ | W001 | warning | top1 与 top2 得分差距 < 阈值 | 强制展示前 3 让用户裁决 |
252
+ | W002 | warning | intent 与所有候选匹配度均低 | 提示考虑 `/maestro` 或 `/maestro-ralph` 走管线 |
253
+
254
+ ### Success Criteria
255
+
256
+ - [ ] Intent 解析 + flags 提取完成
257
+ - [ ] 读取 `.workflow/state.json` + scratch artifacts 推断 lifecycle_position
258
+ - [ ] 候选池等于路由表(管线编排器不在)
259
+ - [ ] 评分综合:intent 字面匹配 + lifecycle 下一步 + workflow 簇 + recent activity
260
+ - [ ] 空 intent / "继续" / "下一步" → 直接采用 lifecycle 推断的下一步
261
+ - [ ] top pick 展示附"推荐理由"(命中规则 + lifecycle 位置)
262
+ - [ ] `--dry-run` 仅展示,不执行
263
+ - [ ] `-y` 自动执行 top pick;用户传入时透传到 skill args
264
+ - [ ] 非自动模式通过 AskUserQuestion 确认或选备选
265
+ - [ ] 选定命令通过单次 `Skill()` 调用执行
266
+ - [ ] 不创建 session / 不生成 status.json / 不触发后续 chain
267
+ - [ ] `--list` 模式按 workflow 簇分组展示
268
+
269
+ </appendix>