maestro-flow-one 0.2.23 → 0.2.25

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.
@@ -0,0 +1,256 @@
1
+ ---
2
+ name: maestro-swarm-workflow
3
+ description: Parallel workflow accelerator — route intent to fixed Workflow scripts for multi-agent concurrent execution
4
+ argument-hint: "<intent> [--script <name>] [--dims <d1,d2>] [--roles <r1,r2>] [--count N] [--tier quick|standard] [--resume <runId>]"
5
+ allowed-tools:
6
+ - Read
7
+ - Write
8
+ - Edit
9
+ - Bash
10
+ - Glob
11
+ - Grep
12
+ - Workflow
13
+ - AskUserQuestion
14
+ ---
15
+ <purpose>
16
+ Parallel accelerator layer for maestro commands. Routes user intent to pre-built Workflow scripts
17
+ that leverage `parallel()` / `pipeline()` for multi-agent concurrent execution.
18
+
19
+ Complements maestro-ralph (sequential decision chain) — ralph manages state + decisions,
20
+ swarm-workflow provides parallel compute bursts within individual steps.
21
+
22
+ Scripts: `~/.maestro/workflows/swarm/wf-*.js`
23
+
24
+ | Script | Accelerates | Pattern |
25
+ |--------|-------------|---------|
26
+ | `wf-analyze` | maestro-analyze | cli-explore-agent → 6-dimension parallel scoring → synthesis |
27
+ | `wf-brainstorm` | maestro-brainstorm | multi-role parallel analysis → cross-role-reviewer → guidance |
28
+ | `wf-review` | quality-review | 6-dimension workflow-reviewer → adversarial verify → report |
29
+ | `wf-verify` | maestro-verify | 3-layer workflow-verifier + convergence + antipattern → aggregate |
30
+ | `wf-grill` | maestro-grill | cli-explore-agent → parallel branch stress-testing → contradiction synthesis |
31
+ | `wf-plan` | maestro-plan | parallel context exploration → workflow-planner → plan-checker |
32
+ | `wf-execute` | maestro-execute | wave-based parallel workflow-executor (worktree isolation) |
33
+ | `wf-milestone-audit` | maestro-milestone-audit | parallel coverage + execution + integration-checker |
34
+
35
+ Integration modes:
36
+ - **Standalone**: `/maestro-swarm-workflow "analyze auth module"` — direct invocation
37
+ - **Ralph step**: ralph chain 中某个 step 可指定 `swarm-workflow` 作为加速执行器
38
+ - **Chained**: 输出 JSON 可被下游命令通过 `--from` 消费
39
+ </purpose>
40
+
41
+ <context>
42
+ $ARGUMENTS — intent text with optional flags.
43
+
44
+ **Parse:**
45
+ ```
46
+ --script <name> → 强制指定脚本(wf-analyze, wf-brainstorm, wf-review, wf-verify)
47
+ --dims <d1,d2> → 限定分析维度(analyze: architecture,complexity,patterns,risk,testability,performance)
48
+ --roles <r1,r2> → 限定角色(brainstorm: system-architect,product-manager,test-strategist,ux-expert,security-analyst,data-architect)
49
+ --count N → 角色数量(brainstorm 默认 3)
50
+ --tier <level> → review 层级(quick=2 维度, standard=4 维度)
51
+ --resume <runId> → 从之前的 workflow 运行恢复(增量重跑)
52
+ Remaining → intent
53
+ ```
54
+
55
+ **Script inventory** (`~/.maestro/workflows/swarm/`):
56
+
57
+ | Script | args 接口 |
58
+ |--------|-----------|
59
+ | `wf-analyze` | `{ target, scope, context, phase?, dimensions? }` |
60
+ | `wf-brainstorm` | `{ topic, context, count?, roles? }` |
61
+ | `wf-review` | `{ target, scope, specs?, tier?, dimensions? }` |
62
+ | `wf-verify` | `{ goals, plan_dir?, scope?, task_files?, must_haves?, skip_antipattern? }` |
63
+ | `wf-grill` | `{ topic, context?, depth?: "shallow"\|"standard"\|"deep" }` |
64
+ | `wf-plan` | `{ context_dir?, from?, phase?, scope?, specs?, gaps?, quick? }` |
65
+ | `wf-execute` | `{ plan_dir, specs?, codebase_context?, wiki_context?, auto_commit? }` |
66
+ | `wf-milestone-audit` | `{ milestone?, is_adhoc? }` |
67
+ </context>
68
+
69
+ <state_machine>
70
+
71
+ <states>
72
+ S_PARSE — 解析参数和意图 PERSIST: —
73
+ S_ROUTE — 路由到目标脚本 PERSIST: —
74
+ S_CONTEXT — 组装 context payload PERSIST: —
75
+ S_DISPATCH — 调用 Workflow 工具 PERSIST: —
76
+ S_INGEST — 处理返回结果 PERSIST: —
77
+ S_FALLBACK — 无法路由 PERSIST: —
78
+ </states>
79
+
80
+ <transitions>
81
+
82
+ S_PARSE:
83
+ → S_ROUTE WHEN: intent parsed DO: A_PARSE_ARGS
84
+ → S_FALLBACK WHEN: no intent
85
+
86
+ S_ROUTE:
87
+ → S_CONTEXT WHEN: script resolved DO: A_ROUTE_SCRIPT
88
+ → S_FALLBACK WHEN: ambiguous intent DO: AskUserQuestion
89
+
90
+ S_CONTEXT:
91
+ → S_DISPATCH DO: A_ASSEMBLE_CONTEXT
92
+
93
+ S_DISPATCH:
94
+ → S_INGEST WHEN: workflow completed DO: A_DISPATCH_WORKFLOW
95
+ → S_FALLBACK WHEN: workflow failed
96
+
97
+ S_INGEST:
98
+ → END DO: A_INGEST_RESULTS
99
+
100
+ S_FALLBACK:
101
+ → S_PARSE WHEN: user provides input
102
+ → END WHEN: user cancels
103
+
104
+ </transitions>
105
+
106
+ <actions>
107
+
108
+ ### A_PARSE_ARGS
109
+
110
+ 1. 提取 flags(--script, --dims, --roles, --count, --tier, --resume)
111
+ 2. 剩余文本作为 intent
112
+ 3. 若有 --resume,记录 resumeRunId
113
+
114
+ ### A_ROUTE_SCRIPT
115
+
116
+ Intent-to-script routing(按关键词匹配,--script 优先级最高):
117
+
118
+ | Keywords | Script |
119
+ |----------|--------|
120
+ | 分析 / analyze / 探索 / explore / 架构 / architecture / 复杂度 / 风险 | `wf-analyze` |
121
+ | 头脑风暴 / brainstorm / 方案 / 设计 / 评估 / evaluate / 多角度 | `wf-brainstorm` |
122
+ | 审查 / review / 代码审查 / code review / 质量 / quality | `wf-review` |
123
+ | 验证 / verify / 检查 / check / 反模式 / antipattern | `wf-verify` |
124
+ | 拷问 / grill / 压力测试 / stress-test / 挑战 / challenge | `wf-grill` |
125
+ | 规划 / plan / 任务分解 / decompose / 分波 / wave | `wf-plan` |
126
+ | 执行 / execute / 实现 / implement / 开发 / develop | `wf-execute` |
127
+ | 里程碑审计 / milestone-audit / 集成检查 / integration | `wf-milestone-audit` |
128
+
129
+ 多命中 → AskUserQuestion 让用户选择。
130
+
131
+ ### A_ASSEMBLE_CONTEXT
132
+
133
+ 根据目标脚本组装 args payload:
134
+
135
+ **wf-analyze:**
136
+ 1. Read `.workflow/state.json` 获取当前 phase/milestone 信息
137
+ 2. `target` = intent 中的目标描述
138
+ 3. `scope` = 从 intent 推断文件范围,或读 roadmap 获取 phase scope
139
+ 4. `context` = 拼接相关上下文(上游 artifact 摘要、specs)
140
+ 5. `dimensions` = --dims 解析结果(可选)
141
+
142
+ **wf-brainstorm:**
143
+ 1. `topic` = intent 文本
144
+ 2. `context` = 读取相关代码文件摘要 + 已有 specs
145
+ 3. `count` = --count 或默认 3
146
+ 4. `roles` = --roles 解析结果(可选)
147
+
148
+ **wf-review:**
149
+ 1. `target` = 读 git diff 描述变更范围
150
+ 2. `scope` = 变更文件列表
151
+ 3. `tier` = --tier 或 "standard"
152
+ 4. `dimensions` = --dims 解析结果(可选)
153
+
154
+ **wf-verify:**
155
+ 1. `goals` = 读最近的 plan artifact 提取目标列表
156
+ 2. `plan_dir` = 定位最近的 plan scratch 目录
157
+ 3. `scope` = plan 涉及的文件范围
158
+ 4. `skip_tests` / `skip_antipattern` = 从 flags 提取
159
+
160
+ ### A_DISPATCH_WORKFLOW
161
+
162
+ 1. 确定 scriptPath = `~/.maestro/workflows/swarm/{script}.js`(展开为绝对路径)
163
+ 2. 构建 Workflow 调用:
164
+ ```
165
+ Workflow({
166
+ scriptPath: absoluteScriptPath,
167
+ args: assembledArgs,
168
+ resumeFromRunId: resumeRunId // 若有
169
+ })
170
+ ```
171
+ 3. 等待 Workflow 返回结果
172
+ 4. 记录 runId 用于潜在的后续 resume
173
+
174
+ ### A_INGEST_RESULTS
175
+
176
+ Workflow 返回 JSON 后:
177
+
178
+ 1. **摘要输出**:按脚本类型格式化关键指标
179
+ - analyze: overall_score, scope_verdict, go_no_go, critical findings count
180
+ - brainstorm: role count, conflict/synergy count, top guidance items
181
+ - review: verdict (APPROVE/REQUEST_CHANGES/BLOCK), confirmed vs false-positive count
182
+ - verify: overall_passed, confidence, gap count, antipattern blocker count
183
+
184
+ 2. **Artifact 写入**(可选):
185
+ - 若当前在 ralph session 中(检测 `.workflow/.maestro/ralph-*/status.json` 状态为 running):
186
+ 将结果写入对应 step 的 scratch 目录,格式兼容命令产出
187
+ - 否则写入 `.workflow/scratch/{YYYYMMDD}-swarm-{script}-{slug}/results.json`
188
+
189
+ 3. **Ralph 兼容产出**:
190
+ - analyze → `analysis.md` + `context.md`(decisions)+ `conclusions.json`
191
+ - brainstorm → `guidance-specification.md`
192
+ - review → `review.json`
193
+ - verify → `verification.json`
194
+
195
+ 4. **RunId 提示**:显示 `Resume: /maestro-swarm-workflow --resume {runId}` 用于增量重跑
196
+
197
+ </actions>
198
+
199
+ </state_machine>
200
+
201
+ <invariants>
202
+ 1. **只做并行加速,不做状态决策** — 不修改 ralph status.json,不推进 step
203
+ 2. **args 预编译** — 所有 FS 读取在 A_ASSEMBLE_CONTEXT 完成,脚本内 agent 通过工具自行读取补充
204
+ 3. **产出格式兼容** — 写入的 artifact 格式必须与对应命令(analyze/brainstorm/review/verify)的产出一致
205
+ 4. **resume 透传** — resumeFromRunId 直接透传给 Workflow 工具,利用内置缓存机制
206
+ 5. **脚本只读** — 路由命令不修改 `~/.maestro/workflows/swarm/wf-*.js` 脚本文件
207
+ 6. **结果必须展示** — Workflow 返回后必须向用户展示格式化摘要,不得静默完成
208
+ </invariants>
209
+
210
+ <appendix>
211
+
212
+ ### 与 Ralph 集成
213
+
214
+ Ralph 可以在 A_BUILD_STEPS 中将某些 step 的执行方式标记为 `swarm-workflow`:
215
+
216
+ ```json
217
+ {
218
+ "index": 2,
219
+ "skill": "maestro-swarm-workflow",
220
+ "args": "--script wf-analyze {phase}",
221
+ "stage": "analyze",
222
+ "command_scope": "project",
223
+ "command_path": "<resolved by maestro ralph skills>"
224
+ }
225
+ ```
226
+
227
+ ralph-execute 正常通过 `maestro ralph next` 加载并执行,swarm-workflow 内部再调 Workflow 工具。
228
+
229
+ ### 输出示例
230
+
231
+ ```
232
+ ┌─ wf-analyze ──────────────────────────────────────┐
233
+ │ Explore [████████████████████] 6/6 dimensions │
234
+ │ Synthesize [████████████████] done │
235
+ ├────────────────────────────────────────────────────┤
236
+ │ Score: 7.2/10 Scope: medium Verdict: go │
237
+ │ Findings: 23 total (2 critical, 5 high) │
238
+ │ Cross-cutting: 3 themes │
239
+ │ Decisions: 4 locked, 2 free, 1 deferred │
240
+ ├────────────────────────────────────────────────────┤
241
+ │ Output: .workflow/scratch/20260530-swarm-analyze/ │
242
+ │ Resume: /maestro-swarm-workflow --resume wf_abc123 │
243
+ └────────────────────────────────────────────────────┘
244
+ ```
245
+
246
+ ### Error Codes
247
+
248
+ | Code | Description | Recovery |
249
+ |------|-------------|----------|
250
+ | E001 | No intent and no --script | Prompt for intent |
251
+ | E002 | Ambiguous routing | AskUserQuestion |
252
+ | E003 | Script file not found | Check .claude/workflows/ |
253
+ | E004 | Workflow execution failed | Show error, suggest --resume |
254
+ | E005 | Result ingestion failed | Write raw JSON to scratch |
255
+
256
+ </appendix>
@@ -35,7 +35,7 @@ $ARGUMENTS -- optional flags.
35
35
  | Agent | Focus | Output file |
36
36
  |-------|-------|-------------|
37
37
  | Mapper 1 | **Tech stack** -- languages, frameworks, dependencies, build system | `tech-stack.md` |
38
- | Mapper 2 | **Architecture** -- layers, module boundaries, data flow, entry points | `architecture.md` |
38
+ | Mapper 2 | **Architecture** -- produced by KG pipeline Step 14 (UA architecture-analyzer delegate); layers, module boundaries, data flow, entry points | `architecture.md` |
39
39
  | Mapper 3 | **Features** -- capabilities, API surface, user-facing functionality | `features.md` |
40
40
  | Mapper 4 | **Cross-cutting concerns** -- error handling, logging, auth, config, testing | `concerns.md` |
41
41
 
@@ -43,6 +43,9 @@ $ARGUMENTS -- optional flags.
43
43
  - `.workflow/` -- must be initialized (project.md, state.json exist)
44
44
  - `.workflow/codebase/` -- target directory (will be cleared and rebuilt)
45
45
  - `.workflow/codebase/doc-index.json` -- generated documentation index
46
+ - `.workflow/codebase/knowledge-graph.json` -- Knowledge Graph with nodes, edges, layers, and tour (generated by KG pipeline Steps 10–17 if UA vendor is installed)
47
+
48
+ **UA vendor requirement:** The KG pipeline (Steps 10–17) requires the UA vendor at `~/.maestro/vendor/ua/understand-anything-plugin/`. If not installed, these steps are skipped automatically. Run `scripts/ua-vendor-setup.sh` to install.
46
49
  </context>
47
50
 
48
51
  <execution>
@@ -53,6 +56,9 @@ Follow '~/.maestro/workflows/codebase-rebuild.md' completely.
53
56
  **Next-step routing on completion:**
54
57
  - View updated project state → `/manage-status`
55
58
  - Incremental updates later → `/manage-codebase-refresh`
59
+ - Verify KG stats → `maestro kg stats`
60
+ - Verify wiki integration → `maestro wiki list --keyword kg`
61
+ - Future change impact → `maestro kg diff-wiki`
56
62
  </execution>
57
63
 
58
64
  <error_codes>
@@ -61,6 +67,8 @@ Follow '~/.maestro/workflows/codebase-rebuild.md' completely.
61
67
  | E001 | error | .workflow/ not initialized | Run maestro-init first to create .workflow/ |
62
68
  | W001 | warning | A mapper agent failed (partial results) | Retry failed mapper or accept partial results |
63
69
  | W002 | warning | `.workflow/codebase/` already exists -- user prompted for rebuild/skip | check_existing |
70
+ | W003 | warning | KG validation failed (graph written with valid=false) | Review .kg-tmp/ artifacts, re-run KG pipeline |
71
+ | W004 | warning | Wiki index rebuild failed after KG generation | Non-fatal, retries on next wiki access |
64
72
  </error_codes>
65
73
 
66
74
  <success_criteria>
@@ -71,5 +79,9 @@ Follow '~/.maestro/workflows/codebase-rebuild.md' completely.
71
79
  - [ ] All documentation files regenerated
72
80
  - [ ] state.json updated with rebuild timestamp
73
81
  - [ ] project.md Tech Stack section updated if changes detected
82
+ - [ ] KG pipeline executed (if UA vendor installed)
83
+ - [ ] knowledge-graph.json generated in .workflow/codebase/ (if UA vendor installed)
84
+ - [ ] KG nodes indexed as virtual wiki entries (automatic via WikiIndexer on next wiki access)
74
85
  - [ ] Next step routing: `/manage-status` or `/manage-codebase-refresh` for incremental updates later
86
+ - [ ] KG impact check available: `maestro kg diff-wiki` for future change impact analysis
75
87
  </success_criteria>
@@ -32,6 +32,7 @@ $ARGUMENTS -- optional flags.
32
32
  - `.workflow/` -- must be initialized
33
33
  - `.workflow/codebase/` -- must contain existing docs (from prior rebuild)
34
34
  - `.workflow/codebase/doc-index.json` -- documentation index with timestamps
35
+ - `.workflow/codebase/knowledge-graph.json` -- Knowledge Graph (optional, for KG impact analysis)
35
36
  - `.workflow/state.json` -- contains `codebase_last_rebuilt` timestamp
36
37
  </context>
37
38
 
@@ -50,6 +51,8 @@ Follow '~/.maestro/workflows/codebase-refresh.md' completely.
50
51
  <success_criteria>
51
52
  - [ ] Changed files detected via git diff since last refresh
52
53
  - [ ] Affected documentation entries identified from doc-index.json
54
+ - [ ] KG impact analysis run (if knowledge-graph.json exists): `maestro kg diff-wiki --json`
55
+ - [ ] Affected wiki entries flagged with warnings (if any)
53
56
  - [ ] Only affected docs refreshed (selective mapper re-run)
54
57
  - [ ] doc-index.json timestamps updated per affected entry
55
58
  - [ ] state.json updated with codebase_last_refreshed timestamp
@@ -11,8 +11,9 @@ allowed-tools:
11
11
  ---
12
12
  <purpose>
13
13
  Initialize the project-level specs directory by scanning the codebase for conventions, patterns, and tech stack.
14
- Core files (coding, arch, knowhow) are always created. Optional files (quality, debug, test, review) are created only when relevant signals are detected.
15
- All output lands in `.workflow/specs/`.
14
+ Core files (coding, arch, learnings) are always created. Optional spec files (quality, test, ui) are created only when relevant signals are detected.
15
+ Additionally, generates recipe-type knowhow docs in `.workflow/knowhow/` for detected operational workflows (test / debug / build / dev / lint) — capturing "how to do X in this project" so future agents can find them via `maestro wiki search`.
16
+ Spec output lands in `.workflow/specs/`; recipe output lands in `.workflow/knowhow/`.
16
17
  </purpose>
17
18
 
18
19
  <required_reading>
@@ -37,12 +38,15 @@ Follow '~/.maestro/workflows/specs-setup.md' completely.
37
38
  | E001 | fatal | `.workflow/` directory not initialized -- run `/maestro-init` first | parse_input |
38
39
  | E002 | fatal | No source files found in project -- nothing to scan | scan_codebase |
39
40
  | W001 | warning | Convention detection uncertain for one or more categories -- marked `[UNCERTAIN]` | generate_specs |
41
+ | W002 | warning | Workflow recipe signals detected but commands ambiguous -- recipe skipped | generate_recipes |
42
+ | W003 | warning | Existing recipe slug found -- new content written as `.proposed.md` for manual diff | generate_recipes |
40
43
  </error_codes>
41
44
 
42
45
  <success_criteria>
43
46
  - [ ] `.workflow/specs/` directory created
44
- - [ ] Core files always created: `coding-conventions.md`, `architecture-constraints.md`, `knowhow.md`
45
- - [ ] Optional files created when detected: `quality-rules.md` (linter/CI), `test-conventions.md` (test framework), `debug-notes.md` (on demand), `review-standards.md` (on demand)
46
- - [ ] Report displayed with summary and next steps
47
+ - [ ] Core spec files always created: `coding-conventions.md`, `architecture-constraints.md`, `learnings.md`
48
+ - [ ] Optional spec files created when detected: `quality-rules.md` (linter/CI), `test-conventions.md` (test framework), `ui-conventions.md` (frontend framework). `debug-notes.md` / `review-standards.md` deferred (on demand via `/spec-add`).
49
+ - [ ] Workflow recipe knowhow created in `.workflow/knowhow/` for each detected operational workflow (test / debug / build / dev / lint). Each recipe matches the `recipe` schema in `~/.maestro/workflows/knowhow.md` Part B and contains at least one runnable command.
50
+ - [ ] Report displayed grouped by destination (specs / recipes / skipped / deferred), with `.proposed.md` files surfaced when an existing recipe slug was preserved.
47
51
  </success_criteria>
48
52
  </output>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "maestro-flow-one",
3
- "version": "0.2.23",
3
+ "version": "0.2.25",
4
4
  "description": "All Maestro workflow commands as a single Claude Code skill — intent routing, decision gates, minimal closed-loop chains",
5
5
  "bin": {
6
6
  "maestro-flow": "bin/maestro-flow.js"