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,192 @@
1
+ ---
2
+ name: maestro-composer
3
+ description: "Compose reusable workflow templates from natural language Arguments: <workflow-description> [--resume] [--edit <template-path>]"
4
+ allowed-tools: Read Write Edit Bash Glob Grep Agent AskUserQuestion Skill
5
+ ---
6
+
7
+ <purpose>
8
+ Interactive workflow template composer: natural language to DAG template.
9
+ Three modes: new design (default), resume (`--resume`), edit (`--edit <path>`).
10
+ </purpose>
11
+
12
+ <deferred_reading>
13
+ - [node-catalog](~/.maestro/templates/workflows/specs/node-catalog.md) — read at Phase 2 (Resolve)
14
+ - [template-schema](~/.maestro/templates/workflows/specs/template-schema.md) — read at Phase 5 (Persist)
15
+ </deferred_reading>
16
+
17
+ <context>
18
+ $ARGUMENTS — natural language description, or flags.
19
+
20
+ **Flags**: `--resume` (resume in-progress design), `--edit <path>` (edit existing template)
21
+
22
+ **Constants**:
23
+ - Template dir: `~/.maestro/templates/workflows/`
24
+ - Template index: `~/.maestro/templates/workflows/index.json`
25
+ - Design drafts: `.workflow/templates/design-drafts/`
26
+ - Template ID: `wft-<slug>-<YYYYMMDD>`, Node ID: `N-<seq>`, Checkpoint: `CP-<seq>`
27
+ - Max nodes: 20
28
+
29
+ ### Pre-load specs
30
+ 1. **Architecture specs**: Run `maestro load --type spec --category arch` to load architecture constraints. Use as context for node resolution — ensures workflow design respects documented patterns.
31
+ 2. **Coding specs**: Run `maestro load --type spec --category coding` to load coding conventions. Informs executor argument defaults and context injection.
32
+ 3. Optional — proceed without if unavailable.
33
+
34
+ **Output boundary**: ALL file writes MUST target `~/.maestro/templates/workflows/` (template JSON + index.json) and `.workflow/templates/design-drafts/` (intermediate drafts) only. NEVER modify source code or `.claude/commands/` files.
35
+ </context>
36
+
37
+ <invariants>
38
+ 1. **Max 20 nodes** — workflow templates MUST NOT exceed 20 nodes; larger workflows MUST be split into sub-workflows
39
+ 2. **Acyclic DAG** — generated template MUST be a directed acyclic graph; cycles MUST be detected and rejected before persistence
40
+ 3. **No orphan nodes** — every node MUST be reachable from at least one edge; unreachable nodes MUST be flagged
41
+ 4. **Confirmation before write** — template JSON MUST be shown to user via AskUserQuestion before writing to `~/.maestro/templates/workflows/`; cancellation saves draft only
42
+ 5. **Draft preservation** — abandoning at any confirmation gate MUST save current progress to design-drafts directory; NEVER discard user's partial work
43
+ 6. **Deferred reading only** — node-catalog and template-schema MUST be read at their designated phases (P2, P5), NEVER loaded eagerly at startup
44
+ </invariants>
45
+
46
+ <state_machine>
47
+
48
+ <states>
49
+ S_ROUTE — 入口路由(new/resume/edit) PERSIST: —
50
+ S_PARSE — 语义意图提取 PERSIST: intent.json
51
+ S_CONFIRM_1 — 确认解析结果 PERSIST: —
52
+ S_RESOLVE — 映射步骤到 executor 节点 PERSIST: nodes.json
53
+ S_CONFIRM_2 — 确认节点映射 PERSIST: —
54
+ S_ENRICH — 注入 checkpoint + 构建 DAG PERSIST: dag.json
55
+ S_CONFIRM_3 — 可视化 pipeline + 用户审批 PERSIST: —
56
+ S_PERSIST — 组装 JSON + 保存模板 PERSIST: template file + index
57
+ </states>
58
+
59
+ <transitions>
60
+
61
+ S_ROUTE:
62
+ → S_PARSE WHEN: no flags (new design)
63
+ → S_RESOLVE WHEN: --resume DO: load draft, skip to last incomplete phase
64
+ → S_CONFIRM_3 WHEN: --edit <path> DO: load template, show pipeline, ask edits
65
+
66
+ S_PARSE:
67
+ → S_CONFIRM_1 DO: A_PARSE_INTENT
68
+
69
+ S_CONFIRM_1:
70
+ → S_RESOLVE WHEN: user confirms "Looks good"
71
+ → S_PARSE WHEN: user selects "Edit steps" or "Add step"
72
+ → END WHEN: user cancels DO: save draft
73
+
74
+ S_RESOLVE:
75
+ → S_CONFIRM_2 DO: A_RESOLVE_NODES (read deferred: node-catalog)
76
+
77
+ S_CONFIRM_2:
78
+ → S_ENRICH WHEN: user confirms "Continue"
79
+ → S_RESOLVE WHEN: user changes executor or node type
80
+ → S_PARSE WHEN: user selects "Back to intent"
81
+ → END WHEN: user cancels DO: save draft
82
+
83
+ S_ENRICH:
84
+ → S_CONFIRM_3 DO: A_BUILD_DAG
85
+
86
+ S_CONFIRM_3:
87
+ → S_PERSIST WHEN: user confirms "Confirm & Save"
88
+ → S_CONFIRM_3 WHEN: user edits/adds/removes node DO: apply change, re-render
89
+ → S_ENRICH WHEN: user selects "Re-run checkpoints"
90
+ → END WHEN: user cancels DO: save draft
91
+
92
+ S_PERSIST:
93
+ → END DO: A_SAVE_TEMPLATE (read deferred: template-schema)
94
+
95
+ </transitions>
96
+
97
+ <actions>
98
+
99
+ ### A_PARSE_INTENT
100
+
101
+ 1. Parse description (if empty: AskUserQuestion for workflow description)
102
+ 2. Extract candidate nodes via semantic signals:
103
+
104
+ | Signal | Type hint |
105
+ |--------|-----------|
106
+ | "analyze", "review", "explore" | analysis (cli) |
107
+ | "plan", "design", "spec" | planning (skill) |
108
+ | "implement", "build", "code", "fix" | execution (skill) |
109
+ | "test", "validate", "verify" | testing (skill) |
110
+ | "then", "next", "after" | sequential edge |
111
+ | "parallel", "simultaneously" | parallel edge |
112
+
113
+ 3. Extract variables (inputs that vary per run)
114
+ 4. Classify: task type + complexity (simple 1-3 / medium 4-7 / complex 8+)
115
+ 5. Write `intent.json` to design drafts dir
116
+ 6. Display: parsed steps, variables, task type, complexity
117
+
118
+ ### A_RESOLVE_NODES
119
+
120
+ Read deferred `node-catalog.md` (fallback to built-in mapping):
121
+
122
+ | Type hint | Default executor |
123
+ |-----------|-----------------|
124
+ | planning | `maestro-plan` |
125
+ | execution | `maestro-execute` |
126
+ | testing | `quality-test` |
127
+ | review | `quality-review` |
128
+ | brainstorm | `maestro-brainstorm` |
129
+ | analysis | `maestro delegate --to <tool> --mode analysis` |
130
+ | verify | `maestro-execute` |
131
+ | refactor | `quality-refactor` |
132
+ | debug | `quality-debug` |
133
+
134
+ Build `args_template` with variable placeholders. Context injection: planning-after-analysis → `--context {prev_output_path}`, execution-after-planning → `--resume-session {prev_session_id}`.
135
+ Write `nodes.json`. Display resolved node list.
136
+
137
+ ### A_BUILD_DAG
138
+
139
+ 1. Build sequential edges (fan-out/fan-in for parallel groups)
140
+ 2. Auto-inject checkpoints:
141
+
142
+ | Rule | Condition |
143
+ |------|-----------|
144
+ | Artifact boundary | Source outputs plan/spec/analysis/review |
145
+ | Execution gate | Target contains `execute` |
146
+ | Long-running | Target is maestro-plan, maestro-blueprint |
147
+ | Post-testing | Source contains `test` or `auto-test` |
148
+ | User-defined | type_hint == checkpoint |
149
+
150
+ 3. Finalize context_schema from {variable} references
151
+ 4. Validate: no cycles, no orphans, all reachable
152
+ 5. Write `dag.json`
153
+ 6. Display ASCII pipeline visualization
154
+
155
+ ### A_SAVE_TEMPLATE
156
+
157
+ Read deferred `template-schema.md` (fallback to built-in structure).
158
+ Assemble template JSON: template_id, name, nodes, edges, checkpoints, context_schema, execution_mode.
159
+ **Confirmation gate**: AskUserQuestion showing template summary (ID, node count, variables) before writing.
160
+ - User confirms → write to `~/.maestro/templates/workflows/<slug>.json` and update index.json.
161
+ - User cancels → save draft, do not write template or index.
162
+ Display: path, ID, node count, variables, execute/edit commands. Clean up draft dir.
163
+
164
+ </actions>
165
+
166
+ </state_machine>
167
+
168
+ <error_codes>
169
+ | Code | Condition | Recovery |
170
+ |------|-----------|----------|
171
+ | E002 | 0 steps extracted | Ask user to rephrase with action verbs |
172
+ | E003 | Node count > 20 | Suggest splitting into sub-workflows |
173
+ | E005 | DAG cycle detected | Show cycle, ask user to resolve |
174
+ | E006 | Edit template not found (--edit) | Show available templates |
175
+ | W001 | Ambiguous step→executor mapping | Show candidates, let user choose |
176
+ </error_codes>
177
+
178
+ <success_criteria>
179
+ - [ ] Each phase has interactive confirmation gate
180
+ - [ ] Template JSON written with nodes, edges, checkpoints, context_schema
181
+ - [ ] Index updated; deferred specs loaded only when phase needs them
182
+ </success_criteria>
183
+
184
+ <completion>
185
+ ### Next-step routing
186
+
187
+ | Condition | Suggestion |
188
+ |-----------|-----------|
189
+ | Template saved | `/maestro-player <template-id>` |
190
+ | Template needs edits | `maestro composer --edit <template-path>` |
191
+ | Design abandoned mid-flow | `maestro composer --resume` to continue from last draft |
192
+ </completion>
@@ -0,0 +1,193 @@
1
+ ---
2
+ name: maestro-execute
3
+ description: "Use when a confirmed plan is ready for implementation Arguments: [milestone] [--auto-commit] [--method agent|cli|auto] [--executor <tool>] [--dir <path>] [-y]"
4
+ allowed-tools: Read Write Edit Bash Glob Grep Agent AskUserQuestion
5
+ ---
6
+
7
+ <purpose>
8
+ Execute confirmed plan tasks via wave-based parallel dispatch.
9
+ Consumes plan from maestro-plan; registers EXC artifact in state.json.
10
+ </purpose>
11
+
12
+ <required_reading>
13
+ @~/.maestro/workflows/execute.md
14
+ </required_reading>
15
+
16
+ <deferred_reading>
17
+ - [task.json](~/.maestro/templates/task.json) — read when reading task definitions
18
+ - [state.json](~/.maestro/templates/state.json) — read when registering artifact
19
+ </deferred_reading>
20
+
21
+ <context>
22
+ $ARGUMENTS — milestone number, or no args for current milestone, with optional flags.
23
+
24
+ ### Flags
25
+
26
+ | Flag | Effect | Default |
27
+ |------|--------|---------|
28
+ | `--auto-commit` | Auto-commit after each completed task | false |
29
+ | `--method agent\|cli\|auto` | Execution method: Agent tool, CLI delegate, or auto-select | `auto` |
30
+ | `--executor <tool>` | Explicit executor tool for CLI delegate mode | First enabled in config |
31
+ | `--dir <path>` | Execute a specific plan directory instead of auto-discovery | — |
32
+ | `-y` / `--yes` | Auto mode — skip ALL interactive questions (executor selection, wave progression, blocked prompts) | false |
33
+
34
+ ### Scope routing
35
+
36
+ | Input | Scope | Resolution |
37
+ |-------|-------|------------|
38
+ | numeric arg | milestone | Resolve plans for the given milestone |
39
+ | `--dir <path>` | explicit | Use specified plan directory |
40
+ | no args + milestone | milestone | Find all pending plans, execute sequentially |
41
+ | no args + no milestone | error E001 | No plan found |
42
+
43
+ Full resolution logic, output directory format, artifact registration schema, and incremental knowhow extraction are defined in workflow `execute.md`.
44
+
45
+ ### Pre-load context (before task execution)
46
+
47
+ 1. **Codebase docs**: If `.workflow/codebase/doc-index.json` exists, read `ARCHITECTURE.md` for module boundaries. Pass as shared context to executor agents.
48
+ 2. **Wiki knowledge**: Run `maestro search "<phase keywords>" --json 2>/dev/null`. If results found, extract top 5 entries as prior knowledge context for agents.
49
+ 3. **Coding specs + tools**: Run `maestro load --type spec --category coding` to load coding conventions AND discoverable knowhow tools (tool: true entries). Pass as specs context to all executor agents.
50
+ 4. **UI specs (conditional)**: If any task involves frontend/UI work (task scope/description contains keywords like component, page, style, layout, CSS, HTML, frontend; or focus_paths in `src/components/`, `src/pages/`, `src/styles/`, `src/ui/`), also run `maestro load --type spec --category ui` and include in agent context.
51
+ 5. All are optional — proceed without if unavailable (log warning).
52
+
53
+ ### Role Knowledge
54
+ `maestro search --category coding` → select relevant → `maestro load --type knowhow --id`
55
+ </context>
56
+
57
+ <execution>
58
+ ### Pre-flight: team conflict check
59
+
60
+ Before any task execution, run:
61
+ ```
62
+ Bash("maestro collab preflight --phase <phase-number>")
63
+ ```
64
+ If exit code is 1, present warnings and ask whether to proceed.
65
+
66
+ Follow '~/.maestro/workflows/execute.md' completely.
67
+
68
+ ### Phase Gates (MANDATORY, BLOCKING)
69
+
70
+ **GATE 1: Plan Load → Task Execution**
71
+ - REQUIRED: plan.json found and parsed with valid task definitions.
72
+ - REQUIRED: `.task/TASK-*.json` files exist for all tasks in plan.
73
+ - BLOCKED if no pending tasks: error E004.
74
+
75
+ **GATE 2: Per-Task Execution → Summary**
76
+ - REQUIRED: Each completed task has `.summaries/TASK-{NNN}-summary.md` written with concrete evidence (files changed, tests run, verification results).
77
+ - REQUIRED: `.task/TASK-{NNN}.json` status updated to completed|blocked.
78
+ - BLOCKED if missing: summary file absent or task status not updated — halt wave progression until evidence is recorded.
79
+ - Do NOT silently skip failed tasks — mark as blocked with reason.
80
+
81
+ **GATE 2.5: Wave Failure Handling**
82
+ - IF all tasks in a wave failed: halt wave progression, report E005 with per-task failure reasons. Do NOT proceed to next wave — downstream waves depend on current wave outputs.
83
+ - IF cascading failure (wave N fails → wave N+1 has unmet dependencies): mark all dependent tasks in subsequent waves as `blocked` with reason `"upstream_wave_failed"`. Skip blocked waves and proceed to completion with partial results.
84
+ - `-y` mode: auto-skip blocked waves without prompting, log warning W002.
85
+ - Non `-y` mode: `AskUserQuestion` with options [retry wave / skip and continue / abort execution].
86
+
87
+ **GATE 3: All Tasks → Completion**
88
+ - REQUIRED: All waves executed in dependency order (or explicitly skipped via Gate 2.5).
89
+ - REQUIRED: EXC artifact registered in state.json.
90
+ - BLOCKED if missing: waves incomplete or EXC artifact not registered — do not report execution complete.
91
+
92
+ ### Evidence Requirement
93
+
94
+ Task summaries MUST include:
95
+ - Files actually modified (not just planned targets)
96
+ - Convergence criteria verification results (pass/fail with evidence)
97
+ - Any deviations from the plan with rationale
98
+
99
+ ### Post-task Knowledge Inquiry
100
+
101
+ After each task completion, extract structured fields from the task summary, then check triggers:
102
+
103
+ **Structured extraction** (from `.summaries/TASK-{NNN}-summary.md`):
104
+ - `deviations[]` — explicit plan deviations (look for "deviated", "changed approach", "instead of", "unlike plan")
105
+ - `design_rationale[]` — explicit design decisions (look for "chose X because", "decided to", "trade-off")
106
+ - `retry_count` — from `.task/TASK-{NNN}.json` status history
107
+
108
+ | Condition | Ask | Route |
109
+ |-----------|-----|-------|
110
+ | `deviations[]` is non-empty | "Record as arch constraint?" | spec-add arch |
111
+ | `retry_count >= 2` | "Document fix pattern?" | spec-add debug |
112
+ | `design_rationale[]` is non-empty | "Record as knowhow?" | spec-add learning |
113
+
114
+ On confirm → `Skill("spec-add", "<category> <content> --description \"<summary>\"")`.
115
+ Include `--description` with a one-line summary for search result display.
116
+
117
+ ### Issue Status Sync
118
+
119
+ On each task completion, if `task.issue_id` exists, sync status back to the issue in `.workflow/issues/issues.jsonl`.
120
+
121
+ **Confirmation gate**: Before writing to issues.jsonl, show the proposed status change and ask for confirmation — unless `-y` is active, in which case auto-approve.
122
+
123
+ ```
124
+ For each completed/failed TASK with issue_id:
125
+ Read issue from issues.jsonl by issue_id
126
+ Collect all task_refs[] statuses for that issue:
127
+ all task_refs completed → proposed issue.status = "resolved"
128
+ any task_ref failed → proposed issue.status = "in_progress"
129
+ IF NOT auto_mode (-y):
130
+ AskUserQuestion: "Update issue {issue_id} status to {proposed_status}?" [Yes / Skip]
131
+ IF Skip → continue to next task without writing
132
+ Append history entry: { action: "executed", at: <ISO>, by: "maestro-execute", summary: "TASK-{NNN} {status}" }
133
+ Write updated issue back to issues.jsonl
134
+ ```
135
+
136
+ </execution>
137
+
138
+ <completion>
139
+ ### Standalone report
140
+
141
+ ```
142
+ === EXECUTION COMPLETE ===
143
+ Plans executed: {plans_count}
144
+ Completed: {completed_count}/{total_count} tasks
145
+ Failed: {failed_count} tasks
146
+
147
+ Summaries: {plan_dir}/.summaries/
148
+ Tasks: {plan_dir}/.task/
149
+ ```
150
+
151
+ ### Ralph-invoked completion
152
+
153
+ End the step by calling the CLI (no text block output):
154
+ ```
155
+ maestro ralph complete <idx> --status {STATUS} [--evidence {path}]
156
+ ```
157
+
158
+ Status verdicts:
159
+ - **DONE** — Normal completion
160
+ - **DONE_WITH_CONCERNS** — Completed with caveats; pass `--concerns`
161
+ - **NEEDS_RETRY** — Tooling error / transient issue; ralph will retry
162
+ - **BLOCKED** — External hard blocker; pass `--reason`
163
+
164
+ ### Next-step routing
165
+
166
+ | Condition | Suggestion |
167
+ |-----------|-----------|
168
+ | All tasks completed successfully | `/quality-review` |
169
+ | Failed tasks exist | `/quality-debug` |
170
+ | View project dashboard | `/manage-status` |
171
+ </completion>
172
+
173
+ <error_codes>
174
+ | Code | Severity | Condition | Recovery |
175
+ |------|----------|-----------|----------|
176
+ | E001 | error | No pending plans found | Verify plans exist, run maestro-plan first |
177
+ | E002 | error | Plan directory not found | Check --dir path |
178
+ | E003 | error | plan.json not found in directory | Verify plan.json exists, run maestro-plan first |
179
+ | E004 | error | No pending tasks, all tasks already completed | Check task statuses, reset if needed |
180
+ | E005 | error | All tasks in wave failed — wave progression halted | Review per-task failure reasons; retry wave or abort |
181
+ | W001 | warning | Executor completed with partial failures | Check task dependencies, retry failed wave |
182
+ | W002 | warning | Cascading wave failure — downstream waves auto-blocked | Review blocked tasks; re-run after fixing upstream failures |
183
+ </error_codes>
184
+
185
+ <success_criteria>
186
+ - [ ] All pending plans identified and executed sequentially
187
+ - [ ] Within each plan: waves executed in parallel, waves串行
188
+ - [ ] `.summaries/TASK-{NNN}-summary.md` written for each completed task
189
+ - [ ] `.task/TASK-{NNN}.json` statuses updated (completed|blocked)
190
+ - [ ] EXC artifact registered in state.json for each plan executed
191
+ - [ ] Incremental knowhow extracted to specs/learnings.md
192
+ - [ ] state.json updated with execution progress
193
+ </success_criteria>
@@ -0,0 +1,104 @@
1
+ ---
2
+ name: maestro-fork
3
+ description: "Create or sync milestone worktree for parallel dev Arguments: -m <milestone-number> [--base <branch>] [--sync]"
4
+ allowed-tools: Read Write Edit Bash Glob Grep Agent AskUserQuestion
5
+ ---
6
+
7
+ <purpose>
8
+ Create or sync a milestone-level git worktree for parallel development.
9
+ Supports `--sync` mode to pull latest main changes into an active worktree.
10
+ </purpose>
11
+
12
+ <required_reading>
13
+ @~/.maestro/workflows/fork.md
14
+ </required_reading>
15
+
16
+ <deferred_reading>
17
+ - [worktrees.json](~/.maestro/templates/worktrees.json) — read when updating registry
18
+ - [worktree-scope.json](~/.maestro/templates/worktree-scope.json) — read when writing scope marker
19
+ </deferred_reading>
20
+
21
+ <context>
22
+ $ARGUMENTS -- milestone number and optional flags.
23
+
24
+ Modes (`Fork` / `Sync`), flags (`-m`, `--base`, `--sync`), milestone resolution, worktree layout, and artifact scoping are defined in workflow `fork.md`.
25
+ </context>
26
+
27
+ <execution>
28
+ Follow '~/.maestro/workflows/fork.md' completely.
29
+
30
+ Fork and sync algorithm steps are defined in workflow `fork.md`.
31
+
32
+ ### Phase Gates (MANDATORY, BLOCKING)
33
+
34
+ **Fork mode:**
35
+
36
+ **GATE 1: Validation → Worktree Creation**
37
+ - REQUIRED: Milestone resolved from state.json.milestones[].
38
+ - REQUIRED: No existing active worktree for this milestone (E008).
39
+ - REQUIRED: Not running inside a worktree (E003).
40
+ - BLOCKED if: milestone not found (E006), already forked (E008), or running inside worktree (E003).
41
+
42
+ **GATE 2: Worktree Creation → Artifact Copy**
43
+ - REQUIRED: Git worktree created with branch (`milestone/{slug}`).
44
+ - REQUIRED: Shared `.workflow/` files copied (project.md, roadmap.md, config.json, specs/).
45
+ - BLOCKED if missing: worktree creation failed or shared files not copied — do not proceed to artifact scoping.
46
+
47
+ **GATE 3: Artifact Copy → Completion**
48
+ - REQUIRED: AskUserQuestion confirmation before registry writes — show milestone scope, worktree path, and state entries to be written. User must confirm or abort.
49
+ - REQUIRED: `worktree-scope.json` written with milestone scope (after confirmation).
50
+ - REQUIRED: Scoped `state.json` written (only this milestone's artifacts) (after confirmation).
51
+ - REQUIRED: `worktrees.json` registry updated in main worktree (after confirmation).
52
+ - BLOCKED if missing: scope marker, scoped state, or registry update absent — worktree is unusable without these.
53
+
54
+ **Sync mode:**
55
+
56
+ **GATE: Sync → Completion**
57
+ - REQUIRED: Git merge main into worktree branch completed.
58
+ - REQUIRED: Shared artifacts re-copied.
59
+ - BLOCKED if: merge has unresolved conflicts or shared artifacts failed to copy.
60
+
61
+ </execution>
62
+
63
+ <completion>
64
+ ### Next-step routing
65
+
66
+ | Condition | Suggestion |
67
+ |-----------|-----------|
68
+ | Fork complete | `cd {wt.path} && /maestro-analyze` |
69
+ | Fork + automated | `maestro delegate "run full lifecycle for milestone" --cd {wt.path} --mode write` |
70
+ | Fork + status check | Skill({ skill: "manage-status" }) |
71
+ | Sync complete | Resume work in worktree |
72
+ | Sync conflicts found | Resolve manually, then retry |
73
+ </completion>
74
+
75
+ <error_codes>
76
+ | Code | Severity | Condition | Recovery |
77
+ |------|----------|-----------|----------|
78
+ | E001 | error | Project not initialized | Run maestro-init first |
79
+ | E002 | error | No roadmap found | Run maestro-roadmap first |
80
+ | E003 | error | Running inside a worktree | Run from main worktree |
81
+ | E004 | error | No milestone number provided | Provide `-m <N>` |
82
+ | E005 | error | No milestones defined in state.json | Run maestro-roadmap first |
83
+ | E006 | error | Milestone number out of range | Check available milestones |
84
+ | E007 | error | No active worktree for milestone (--sync) | Check worktrees.json |
85
+ | E008 | error | Milestone already has active worktree | Merge or cleanup first |
86
+ </error_codes>
87
+
88
+ <success_criteria>
89
+ Fork mode:
90
+ - [ ] Milestone resolved from state.json.milestones[]
91
+ - [ ] Git worktree created with branch (`milestone/{slug}`)
92
+ - [ ] Shared `.workflow/` files copied (project.md, roadmap.md, config.json, specs/)
93
+ - [ ] Milestone scratch artifacts copied (filtered from artifact registry)
94
+ - [ ] `worktree-scope.json` written with milestone scope
95
+ - [ ] Scoped `state.json` written (only this milestone's artifacts)
96
+ - [ ] `worktrees.json` registry updated in main worktree
97
+ - [ ] Milestone marked as `"forked"` in main `state.json.milestones[]`
98
+ - [ ] Summary displayed with next-step commands
99
+
100
+ Sync mode:
101
+ - [ ] Git merge main into worktree branch
102
+ - [ ] Shared artifacts re-copied (project.md, roadmap.md, config.json, specs/)
103
+ - [ ] Conflicts reported if any
104
+ </success_criteria>
@@ -0,0 +1,151 @@
1
+ ---
2
+ name: maestro-grill
3
+ description: "Use when stress-testing a plan, idea, or requirement against codebase reality before brainstorming Arguments: <topic|plan> [-y] [-c] [--from <source>] [--depth shallow|standard|deep]"
4
+ allowed-tools: Read Write Edit Bash Glob Grep Agent AskUserQuestion
5
+ ---
6
+
7
+ <purpose>
8
+ Socratic stress-testing of plans/ideas against codebase reality. Produces grill-report.md + terminology.md + context-package.json for downstream brainstorm/analyze/roadmap.
9
+
10
+ Pipeline position: BEFORE brainstorm (stress-test → then elaborate).
11
+ </purpose>
12
+
13
+ <required_reading>
14
+ @~/.maestro/workflows/grill.md
15
+ </required_reading>
16
+
17
+ <deferred_reading>
18
+ - [state.json](~/.maestro/templates/state.json) — read when registering artifact
19
+ </deferred_reading>
20
+
21
+ <context>
22
+ $ARGUMENTS -- topic/plan text for interactive mode, or --from source for upstream input.
23
+
24
+ **Mode selection:**
25
+ - **Interactive mode** (default): Topic text triggers full Socratic grilling with user Q&A
26
+ - **Auto mode** (`-y`): Code exploration answers questions instead of the user
27
+ - **Resume mode** (`-c` or `--session ID`): Continue from a previous grill session
28
+
29
+ **Flags:**
30
+
31
+ | Flag | Effect | Default |
32
+ |------|--------|---------|
33
+ | `-y` / `--yes` | Auto mode — CLI exploration replaces human answers | `false` |
34
+ | `-c` / `--continue` | Resume from last grill session | — |
35
+ | `--session ID` | Resume specific session | — |
36
+ | `--depth shallow\|standard\|deep` | Branch count 3/5/8 | `standard` |
37
+ | `--from <source>` | Load upstream material (`blueprint:ID`, `@file`, or path) | — |
38
+
39
+ **Output directory**: `.workflow/scratch/{YYYYMMDD}-grill-{slug}/`
40
+ **Produced files**: `grill-report.md`, `terminology.md`, `context-package.json`
41
+
42
+ ### Pre-load
43
+
44
+ 1. **Specs**: `maestro load --type spec --category arch` — load architecture constraints
45
+ 2. **Wiki search**: `maestro search "{topic keywords}"` → load relevant entries before grilling
46
+ 3. All optional — proceed without if unavailable
47
+ </context>
48
+
49
+ <interview_protocol>
50
+ Follows @~/.maestro/workflows/interview-mechanics.md standard.
51
+
52
+ **Interaction mode override**: adversarial Socratic — NOT menu-driven
53
+ **Question style**:
54
+ - Reference specific code: "The codebase uses `{symbol}` at `{file:line}` — your proposal calls it `{term}`. Which wins?"
55
+ - Concrete scenarios: "What happens when {action} while {condition}?"
56
+ - Challenge contradictions: immediately surface conflicts with code evidence or prior answers
57
+ - Escalating depth: per branch basic → specific → adversarial
58
+ **Branch traversal** (depth-gated, --depth controls count): Scope & Boundaries → Data Model & State → Edge Cases & Failure Modes → Integration & Dependencies → Scale & Performance → Security & Access Control → Observability & Operations → Migration & Rollback
59
+ **Writeback target**: grill-report.md (Q&A append per question) + terminology.md (term crystallization)
60
+ **Additional skip conditions**: none beyond standard (-y, -c)
61
+ **Exit condition**: all depth-selected branches fully walked → finalize report + context-package.json
62
+ </interview_protocol>
63
+
64
+ <execution>
65
+ Follow '~/.maestro/workflows/grill.md' completely.
66
+
67
+ ### Phase Gates (MANDATORY, BLOCKING)
68
+
69
+ **GATE 1: Setup → Branch Walking** (Step 1 → Step 2)
70
+ - REQUIRED: Topic parsed and output directory created.
71
+ - REQUIRED: Initial codebase scan completed — at least one code reference identified for grounding.
72
+ - BLOCKED if missing: cannot grill without code reality baseline.
73
+
74
+ **GATE 2: Branch Walking → Synthesis** (Step 2 → Step 3)
75
+ - REQUIRED: All depth-selected branches walked (shallow=3, standard=5, deep=8).
76
+ - REQUIRED: Each branch has ≥2 Q&A pairs with evidence (code reference or explicit user input).
77
+ - REQUIRED: Every locked decision has evidence — NOT just orchestrator inference.
78
+ - BLOCKED if branches incomplete: continue walking before synthesizing.
79
+
80
+ **GATE 3: Synthesis → Completion** (Step 3 → Report)
81
+ - REQUIRED: `grill-report.md` written with Branch Log table + all Q&A entries + synthesis section.
82
+ - REQUIRED: `terminology.md` written with ≥5 terms.
83
+ - REQUIRED: `context-package.json` generated.
84
+ - BLOCKED if any artifact missing: produce it before reporting completion.
85
+
86
+ </execution>
87
+
88
+ <completion>
89
+ ### Standalone report
90
+
91
+ ```
92
+ === GRILL READY ===
93
+ Topic: {topic}
94
+ Branches walked: {count}/{depth_target}
95
+ Decisions locked: {locked_count}
96
+ Open risks: {risk_count}
97
+ Output: {output_dir}
98
+ Artifact: GRL-{id}
99
+ === END GRILL ===
100
+ ```
101
+
102
+ ### Ralph-invoked completion
103
+
104
+ End the step by calling the CLI (no text block output):
105
+ ```
106
+ maestro ralph complete <idx> --status {STATUS} [--evidence {path}]
107
+ ```
108
+
109
+ Status verdicts:
110
+ - **DONE** — Normal completion
111
+ - **DONE_WITH_CONCERNS** — Completed with caveats; pass `--concerns`
112
+ - **NEEDS_RETRY** — Tooling error / transient issue; ralph will retry
113
+ - **BLOCKED** — External hard blocker; pass `--reason`
114
+
115
+ ### Next-step routing
116
+
117
+ | Condition | Suggestion |
118
+ |-----------|-----------|
119
+ | Need multi-role elaboration | `Skill({ skill: "maestro-brainstorm", args: "{topic} --from grill:{artifact_id}" })` |
120
+ | Need deep technical analysis | `Skill({ skill: "maestro-analyze", args: "{topic} --from grill:{artifact_id}" })` |
121
+ | Scope is clear, ready for roadmap | `Skill({ skill: "maestro-roadmap", args: "--from grill:{artifact_id}" })` |
122
+ | Need formal spec package | `Skill({ skill: "maestro-blueprint", args: "--from grill:{artifact_id}" })` |
123
+ | More branches to walk | `Skill({ skill: "maestro-grill", args: "{topic} -c" })` |
124
+ </completion>
125
+
126
+ <error_codes>
127
+ | Code | Severity | Condition | Recovery |
128
+ |------|----------|-----------|----------|
129
+ | E001 | error | No topic/plan and no --from/--continue flag | Prompt user for topic text |
130
+ | E002 | error | --session ID not found | Show available sessions |
131
+ | W001 | warning | Codebase scan failed or returned empty | Continue without code grounding, note limitation |
132
+ | W002 | warning | CLI exploration timeout in auto mode | Skip question, mark as open |
133
+ | W003 | warning | Max branch depth reached without resolution | Force synthesis, offer continuation |
134
+ </error_codes>
135
+
136
+ <success_criteria>
137
+ - [ ] Interactive mode: all depth-selected branches walked (shallow=3, standard=5, deep=8)
138
+ - [ ] Each branch has >= 2 question-answer pairs with evidence or explicit user input
139
+ - [ ] `grill-report.md` written with Branch Log table, all Q&A entries, synthesis section
140
+ - [ ] `terminology.md` written with >= 5 terms, code references where applicable
141
+ - [ ] Every locked decision has evidence (code reference or explicit user confirmation)
142
+ - [ ] Contradictions between answers and code surfaced and resolved (or logged as risks)
143
+ - [ ] Risk register captures all unresolved tensions
144
+ - [ ] `context-package.json` generated with schema "context-package/1.0"
145
+ - [ ] Artifact registered in state.json (type=grill, id=GRL-xxx)
146
+ - [ ] Session sealed via finish-work (finish-work.md includes AskUserQuestion confirmation before state.json artifact registration and optional spec/knowhow extraction)
147
+ </success_criteria>
148
+
149
+ <on_complete>
150
+ @~/.maestro/workflows/finish-work.md — SESSION_DIR={output_dir}, SESSION_TYPE=grill, SESSION_ID={artifact_id}, LINKED_MILESTONE=null
151
+ </on_complete>