maestro-flow 0.4.19 → 0.4.20

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 (122) hide show
  1. package/.agents/agents/workflow-collab-planner.md +4 -1
  2. package/.agents/agents/workflow-plan-checker.md +11 -1
  3. package/.agents/agents/workflow-planner.md +4 -1
  4. package/.agents/skills/maestro/SKILL.md +8 -5
  5. package/.agents/skills/maestro-analyze/SKILL.md +1 -1
  6. package/.agents/skills/maestro-brainstorm/SKILL.md +2 -1
  7. package/.agents/skills/maestro-companion/SKILL.md +533 -0
  8. package/.agents/skills/maestro-grill/SKILL.md +116 -0
  9. package/.agents/skills/maestro-plan/SKILL.md +4 -0
  10. package/.agents/skills/maestro-ralph/SKILL.md +11 -7
  11. package/.agents/skills/maestro-swarm-workflow/SKILL.md +258 -0
  12. package/.agents/skills/manage-codebase-rebuild/SKILL.md +13 -1
  13. package/.agents/skills/manage-codebase-refresh/SKILL.md +3 -0
  14. package/.agents/skills/spec-setup/SKILL.md +9 -5
  15. package/.agy/agents/workflow-collab-planner.md +4 -1
  16. package/.agy/agents/workflow-plan-checker.md +11 -1
  17. package/.agy/agents/workflow-planner.md +4 -1
  18. package/.agy/skills/maestro/SKILL.md +8 -5
  19. package/.agy/skills/maestro-analyze/SKILL.md +1 -1
  20. package/.agy/skills/maestro-brainstorm/SKILL.md +2 -1
  21. package/.agy/skills/maestro-companion/SKILL.md +529 -0
  22. package/.agy/skills/maestro-grill/SKILL.md +116 -0
  23. package/.agy/skills/maestro-plan/SKILL.md +4 -0
  24. package/.agy/skills/maestro-ralph/SKILL.md +11 -7
  25. package/.agy/skills/maestro-swarm-workflow/SKILL.md +255 -0
  26. package/.agy/skills/manage-codebase-rebuild/SKILL.md +13 -1
  27. package/.agy/skills/manage-codebase-refresh/SKILL.md +3 -0
  28. package/.agy/skills/spec-setup/SKILL.md +9 -5
  29. package/.claude/agents/workflow-collab-planner.md +4 -1
  30. package/.claude/agents/workflow-plan-checker.md +11 -1
  31. package/.claude/agents/workflow-planner.md +4 -1
  32. package/.claude/commands/maestro-analyze.md +1 -1
  33. package/.claude/commands/maestro-brainstorm.md +2 -1
  34. package/.claude/commands/maestro-companion.md +531 -0
  35. package/.claude/commands/maestro-grill.md +114 -0
  36. package/.claude/commands/maestro-plan.md +4 -0
  37. package/.claude/commands/maestro-ralph.md +11 -7
  38. package/.claude/commands/maestro-swarm-workflow.md +256 -0
  39. package/.claude/commands/maestro.md +8 -5
  40. package/.claude/commands/manage-codebase-rebuild.md +13 -1
  41. package/.claude/commands/manage-codebase-refresh.md +3 -0
  42. package/.claude/commands/spec-setup.md +9 -5
  43. package/.codex/skills/maestro/SKILL.md +7 -2
  44. package/.codex/skills/maestro-companion/SKILL.md +485 -0
  45. package/.codex/skills/maestro-grill/SKILL.md +111 -0
  46. package/.codex/skills/maestro-ralph/SKILL.md +11 -7
  47. package/.codex/skills/manage-codebase-rebuild/SKILL.md +6 -0
  48. package/.codex/skills/manage-codebase-refresh/SKILL.md +6 -0
  49. package/dashboard/dist-server/dashboard/src/server/wiki/graph-analysis.d.ts +36 -0
  50. package/dashboard/dist-server/dashboard/src/server/wiki/graph-analysis.js +138 -2
  51. package/dashboard/dist-server/dashboard/src/server/wiki/graph-analysis.js.map +1 -1
  52. package/dashboard/dist-server/dashboard/src/server/wiki/search.js +13 -0
  53. package/dashboard/dist-server/dashboard/src/server/wiki/search.js.map +1 -1
  54. package/dashboard/dist-server/dashboard/src/server/wiki/virtual-wiki-adapters.d.ts +11 -0
  55. package/dashboard/dist-server/dashboard/src/server/wiki/virtual-wiki-adapters.js +178 -0
  56. package/dashboard/dist-server/dashboard/src/server/wiki/virtual-wiki-adapters.js.map +1 -1
  57. package/dashboard/dist-server/dashboard/src/server/wiki/wiki-indexer.d.ts +1 -0
  58. package/dashboard/dist-server/dashboard/src/server/wiki/wiki-indexer.js +39 -23
  59. package/dashboard/dist-server/dashboard/src/server/wiki/wiki-indexer.js.map +1 -1
  60. package/dist/src/cli.js +1 -0
  61. package/dist/src/cli.js.map +1 -1
  62. package/dist/src/commands/install-backend.d.ts +7 -0
  63. package/dist/src/commands/install-backend.d.ts.map +1 -1
  64. package/dist/src/commands/install-backend.js +14 -0
  65. package/dist/src/commands/install-backend.js.map +1 -1
  66. package/dist/src/commands/install.d.ts.map +1 -1
  67. package/dist/src/commands/install.js +18 -0
  68. package/dist/src/commands/install.js.map +1 -1
  69. package/dist/src/commands/kg.d.ts +11 -0
  70. package/dist/src/commands/kg.d.ts.map +1 -0
  71. package/dist/src/commands/kg.js +515 -0
  72. package/dist/src/commands/kg.js.map +1 -0
  73. package/dist/src/i18n/locales/en.d.ts.map +1 -1
  74. package/dist/src/i18n/locales/en.js +10 -0
  75. package/dist/src/i18n/locales/en.js.map +1 -1
  76. package/dist/src/i18n/locales/zh.d.ts.map +1 -1
  77. package/dist/src/i18n/locales/zh.js +10 -0
  78. package/dist/src/i18n/locales/zh.js.map +1 -1
  79. package/dist/src/i18n/types.d.ts +9 -0
  80. package/dist/src/i18n/types.d.ts.map +1 -1
  81. package/dist/src/tui/install-ui/InstallConfirm.d.ts +1 -0
  82. package/dist/src/tui/install-ui/InstallConfirm.d.ts.map +1 -1
  83. package/dist/src/tui/install-ui/InstallConfirm.js +1 -1
  84. package/dist/src/tui/install-ui/InstallConfirm.js.map +1 -1
  85. package/dist/src/tui/install-ui/InstallExecution.d.ts +1 -0
  86. package/dist/src/tui/install-ui/InstallExecution.d.ts.map +1 -1
  87. package/dist/src/tui/install-ui/InstallExecution.js +22 -0
  88. package/dist/src/tui/install-ui/InstallExecution.js.map +1 -1
  89. package/dist/src/tui/install-ui/InstallFlow.d.ts +1 -1
  90. package/dist/src/tui/install-ui/InstallFlow.d.ts.map +1 -1
  91. package/dist/src/tui/install-ui/InstallFlow.js +23 -5
  92. package/dist/src/tui/install-ui/InstallFlow.js.map +1 -1
  93. package/dist/src/tui/install-ui/InstallHub.d.ts +2 -0
  94. package/dist/src/tui/install-ui/InstallHub.d.ts.map +1 -1
  95. package/dist/src/tui/install-ui/InstallHub.js +6 -0
  96. package/dist/src/tui/install-ui/InstallHub.js.map +1 -1
  97. package/dist/src/tui/install-ui/InstallResult.d.ts.map +1 -1
  98. package/dist/src/tui/install-ui/InstallResult.js +1 -1
  99. package/dist/src/tui/install-ui/InstallResult.js.map +1 -1
  100. package/dist/src/tui/install-ui/KgVendorConfig.d.ts +7 -0
  101. package/dist/src/tui/install-ui/KgVendorConfig.d.ts.map +1 -0
  102. package/dist/src/tui/install-ui/KgVendorConfig.js +9 -0
  103. package/dist/src/tui/install-ui/KgVendorConfig.js.map +1 -0
  104. package/dist/src/utils/update-notices.js +11 -0
  105. package/dist/src/utils/update-notices.js.map +1 -1
  106. package/package.json +1 -1
  107. package/workflows/analyze.md +2 -1
  108. package/workflows/brainstorm.md +24 -1
  109. package/workflows/codebase-rebuild.md +141 -1
  110. package/workflows/codebase-refresh.md +20 -0
  111. package/workflows/finish-work.md +7 -2
  112. package/workflows/grill.md +513 -0
  113. package/workflows/plan.md +7 -4
  114. package/workflows/specs-setup.md +99 -3
  115. package/workflows/swarm/wf-analyze.js +186 -0
  116. package/workflows/swarm/wf-brainstorm.js +284 -0
  117. package/workflows/swarm/wf-execute.js +203 -0
  118. package/workflows/swarm/wf-grill.js +198 -0
  119. package/workflows/swarm/wf-milestone-audit.js +236 -0
  120. package/workflows/swarm/wf-plan.js +233 -0
  121. package/workflows/swarm/wf-review.js +226 -0
  122. package/workflows/swarm/wf-verify.js +298 -0
@@ -129,20 +129,20 @@ S_INFER:
129
129
 
130
130
  S_RESOLVE_SCOPE:
131
131
  → S_QUALITY_MODE DO: A_RESOLVE_SCOPE_VERDICT
132
- GUARD: position ∈ {brainstorm, blueprint, init} → skip (scope_verdict = null)
132
+ GUARD: position ∈ {grill, brainstorm, blueprint, init} → skip (scope_verdict = null)
133
133
 
134
134
  S_QUALITY_MODE:
135
135
  → S_PLANNING_MODE DO: A_DETERMINE_QUALITY_MODE
136
136
 
137
137
  S_PLANNING_MODE:
138
138
  → S_DECOMPOSE DO: A_DETERMINE_PLANNING_MODE
139
- GUARD: lifecycle_position ∈ {brainstorm, blueprint, init, analyze-macro, roadmap} → skip (force independent)
139
+ GUARD: lifecycle_position ∈ {grill, brainstorm, blueprint, init, analyze-macro, roadmap} → skip (force independent)
140
140
 
141
141
  S_DECOMPOSE:
142
142
  → S_BUILD_CHAIN DO: A_DECOMPOSE_TASKS
143
143
  GUARD: broad intent → MUST clarify boundary even if auto_confirm
144
144
  GUARD: narrow intent → auto-derive, skip questions
145
- GUARD: position ∈ {brainstorm, blueprint, init} → skip decomposition
145
+ GUARD: position ∈ {grill, brainstorm, blueprint, init} → skip decomposition
146
146
 
147
147
  S_BUILD_CHAIN:
148
148
  → S_CREATE_SESSION DO: A_BUILD_STEPS
@@ -242,6 +242,7 @@ resolve_milestone(phase_number):
242
242
 
243
243
  | Pattern | Position |
244
244
  |---------|----------|
245
+ | 压力测试 / 拷问 / 验证假设 / grill / stress-test | `grill`(**auto_confirm=true 时跳过,直接 `brainstorm`**) |
245
246
  | brainstorm / 头脑风暴 / 探索 / ideate / 设计思路 | `brainstorm` |
246
247
  | blueprint / 规格 / 正式文档 / spec-generate / 7-phase | `blueprint` |
247
248
  | broad/medium intent 无数字 phase (重构/全面/重写/迁移/新功能 X) | `analyze-macro` |
@@ -262,7 +263,7 @@ resolve_milestone(phase_number):
262
263
  | `phase_is_new == true` (新 phase) | `analyze` |
263
264
  | no milestones AND no roadmap.md AND has analyze macro artifact | `roadmap` |
264
265
  | no milestones AND no roadmap.md AND no analyze artifact | `analyze-macro` |
265
- | `phase == null` (brainstorm/blueprint/init/roadmap/analyze-macro override 已定) | n/a |
266
+ | `phase == null` (grill/brainstorm/blueprint/init/roadmap/analyze-macro override 已定) | n/a |
266
267
  | phase 已存在 + 无任何 artifact | `analyze` |
267
268
  | phase 已存在 + 最新 artifact = analyze | `plan` |
268
269
  | phase 已存在 + 最新 artifact = plan | `execute` |
@@ -317,7 +318,7 @@ resolve_milestone(phase_number):
317
318
 
318
319
  | Condition | Mode | Reason |
319
320
  |-----------|------|--------|
320
- | lifecycle_position ∈ {brainstorm, init, roadmap} | `independent` | 前期阶段不涉及多 phase 规划 |
321
+ | lifecycle_position ∈ {grill, brainstorm, init, roadmap} | `independent` | 前期阶段不涉及多 phase 规划 |
321
322
  | `phase_is_new == true` | `independent` | 新 phase 尚无里程碑上下文 |
322
323
  | intent 显式指定 phase 编号(如 "phase 2"、"P3") | `independent` | 用户明确针对单个 phase |
323
324
  | milestone 仅含 1 个 phase(读 state.json) | `independent` | 统一无意义 |
@@ -380,7 +381,8 @@ Generate steps from `session.lifecycle_position` to `milestone-complete`.
380
381
 
381
382
  | Stage | Skill (independent) | Skill (unified) | Decision after | quality_mode |
382
383
  |-------|---------------------|-----------------|----------------|--------------|
383
- | brainstorm | `maestro-brainstorm "{intent}"` | *(same)* | — | all |
384
+ | grill | `maestro-grill "{intent}"` | *(same)* | — | all (**skip when auto_confirm**) |
385
+ | brainstorm | `maestro-brainstorm "{intent}" --from grill:{grill_id}` *(if grill ran)* / `maestro-brainstorm "{intent}"` *(otherwise)* | *(same)* | — | all |
384
386
  | blueprint | `maestro-blueprint "{intent}"` | *(same)* | — | all |
385
387
  | init | `maestro-init` | *(same)* | — | all |
386
388
  | analyze-macro | `maestro-analyze "{intent}"` | *(same)* | `post-analyze-scope` | all |
@@ -405,6 +407,7 @@ Generate steps from `session.lifecycle_position` to `milestone-complete`.
405
407
  1. **起点**:从 `session.lifecycle_position` 开始
406
408
  2. **跳过已完成**:跳过当前 milestone+phase 下已有 completed artifact 的 stage(按 `session.phase` 过滤);unified 按 milestone 过滤
407
409
  3. **quality_mode 过滤**:按 `session.quality_mode` 排除不匹配 stage
410
+ 3.5. **grill auto_confirm 跳过**:`auto_confirm == true` 时删除 `grill` stage(grill 为交互式苏格拉底拷问,不支持自动模式);brainstorm args 不含 `--from grill:*`
408
411
  4. **决策节点**:每个 Decision after 非空的 stage 之后插入 `{ decision: "<gate>", retry_count: 0, max_retries: 2, command_scope: null, command_path: null }`
409
412
  5. **goal-audit 插入**:`task_decomposition` 存在时,在最后一个 evidence-producing stage(verify/review/test)之后、`milestone-complete` 之前插入 `decision:post-goal-audit`
410
413
  6. **终点硬约束**:chain 以 `milestone-complete` 结尾
@@ -741,7 +744,8 @@ decision:post-goal-audit {retry+1}
741
744
  - [ ] Phase 先于 position 解析;phase_is_new 标记写入 session
742
745
  - [ ] D-007 反查:phase 数字 → `session.milestone`,禁止读 current_milestone;写入 step.milestone_id
743
746
  - [ ] phase_is_new=true → lifecycle_position 强制 `analyze`
744
- - [ ] Intent overrides 识别 brainstorm / blueprint / analyze-macro
747
+ - [ ] Intent overrides 识别 grill / brainstorm / blueprint / analyze-macro
748
+ - [ ] auto_confirm=true 时 grill stage 跳过(交互式拷问不支持自动模式)
745
749
  - [ ] A_RESOLVE_SCOPE_VERDICT 读 macro analyze conclusions.scope_verdict,写入 session.scope_verdict + analyze_macro_id
746
750
  - [ ] 链路起点 = analyze-macro 时:large→roadmap+analyze+plan(phase);medium/small→直跳 plan --from analyze:{ANL_ID}(跳过 roadmap+analyze)
747
751
  - [ ] post-analyze-scope decision 节点在 macro analyze 之后插入;A_SCOPE_EVALUATE/A_APPLY_SCOPE_VERDICT 重塑链路
@@ -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>
@@ -50,10 +50,11 @@ $ARGUMENTS — user intent text, or special keywords.
50
50
  4. **Decomposition contract shared with maestro-ralph** — broad/lifecycle intents run S_DECOMPOSE producing the SAME additive block (`boundary_contract`, `execution_criteria`, `task_decomposition`)。Reference maestro-ralph `A_DECOMPOSE_TASKS`
51
51
  5. **status.json 唯一真源** — 不生成 `goal-checklist.md` 或外部清单
52
52
  6. **执行步骤统一通过 `maestro ralph next` 加载** — `command_scope`/`command_path` 由 `maestro ralph skills --json --quiet` 预校验(project 覆盖 global);decision 节点不走 CLI,走 `Skill("maestro-ralph")` handoff
53
- 7. **Topology awareness** — chain catalog 含 brainstorm / blueprint / analyze-macro / analyze / roadmap / plan(三路径) / execute / verify / ...;scope_verdict 由 ralph 在 `post-analyze-scope` 决定
54
- 8. **D-007 milestone 反查**数字 phase `milestone_id` `state.json.milestones[].phase_slugs` 反查
55
- 9. **每个 step 必须 `completion_confirmed: true`** `maestro ralph complete N --status DONE|DONE_WITH_CONCERNS` 写入
56
- 10. **schema** `ralph_protocol_version: "1"` 标记 CLI-driven session;新增字段全部可选
53
+ 7. **Topology awareness** — chain catalog 含 grill / brainstorm / blueprint / analyze-macro / analyze / roadmap / plan(三路径) / execute / verify / ...;scope_verdict 由 ralph 在 `post-analyze-scope` 决定
54
+ 8. **Grill is interactive-only**`-y` auto mode MUST skip grill stage and route directly to brainstorm; grill requires Socratic Q&A with the user
55
+ 9. **D-007 milestone 反查** 数字 phase `milestone_id` `state.json.milestones[].phase_slugs` 反查
56
+ 10. **每个 step 必须 `completion_confirmed: true`** — 由 `maestro ralph complete N --status DONE|DONE_WITH_CONCERNS` 写入
57
+ 11. **schema** — `ralph_protocol_version: "1"` 标记 CLI-driven session;新增字段全部可选
57
58
  </invariants>
58
59
 
59
60
  <state_machine>
@@ -132,6 +133,7 @@ S_FALLBACK:
132
133
  1. Read `~/.maestro/workflows/maestro.md` from deferred_reading
133
134
  2. Match intent to task_type via chain catalog (semantic)
134
135
  3. Select chain from chainMap,遵循拓扑约束:
136
+ - 压力测试/拷问/验证假设/grill/stress-test → `grill`(**-y 模式跳过 grill,直接走 brainstorm**)
135
137
  - 头脑风暴/探索 → `brainstorm`
136
138
  - 正式规格/spec-generate/7-phase → `blueprint`
137
139
  - 项目初始化 → `init`
@@ -216,7 +218,8 @@ S_FALLBACK:
216
218
  ### Success Criteria
217
219
 
218
220
  - [ ] Intent classified with task_type, complexity, clarity_score
219
- - [ ] Chain catalog 覆盖 brainstorm / blueprint / analyze-macro / analyze / roadmap / plan(三路径) / execute / verify / quality pipeline
221
+ - [ ] Chain catalog 覆盖 grill / brainstorm / blueprint / analyze-macro / analyze / roadmap / plan(三路径) / execute / verify / quality pipeline
222
+ - [ ] `-y` 模式不触发 grill(交互式压力测试不支持自动模式,跳过直接走 brainstorm)
220
223
  - [ ] D-007: 数字 phase 步骤的 `milestone_id` 通过 `state.json.milestones[].phase_slugs` 反查
221
224
  - [ ] macro analyze 后跟 `decision:post-analyze-scope`(由 ralph 评估 scope_verdict 决定下游链路)
222
225
  - [ ] plan 支持 `{phase}` / `--from analyze:{ANL_ID}` / `--from blueprint:{BLP_ID}` 三路径;`source_artifact_ref` 写入 step
@@ -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>
@@ -43,7 +43,8 @@ $ARGUMENTS — user intent text, or special flags.
43
43
  3. **Decomposition contract shared with maestro-ralph** — broad/lifecycle intents run S_DECOMPOSE producing the SAME additive block (`boundary_contract`, `execution_criteria`, `task_decomposition`). Reference maestro-ralph `A_DECOMPOSE_TASKS`
44
44
  4. **Goal is tool-created** — `A_DECOMPOSE_TASKS` calls `create_goal` with sub-goal success criteria. `update_goal` on convergence; held while aborted/paused
45
45
  5. **status.json 唯一真源** — 不生成 `goal-checklist.md`;step 含 `command_scope` + `command_path` + `completion_confirmed`
46
- 6. **Topology awareness** — chain catalog 含 brainstorm / blueprint / analyze-macro(text) / analyze(numeric) / roadmap / plan(三路径) / execute / verify / ...
46
+ 6. **Topology awareness** — chain catalog 含 grill / brainstorm / blueprint / analyze-macro(text) / analyze(numeric) / roadmap / plan(三路径) / execute / verify / ...
47
+ 6.5. **Grill is interactive-only** — auto_mode MUST skip grill stage and route directly to brainstorm; grill requires Socratic Q&A with the user
47
48
  7. **D-007 milestone 反查** — 数字 phase 步骤的 `milestone_id` 由 `state.json.milestones[].phase_slugs` 反查
48
49
  8. **schema 向后兼容** — decomposition 字段可选;`steps[]` 由 post-goal-audit 动态生长(goal_ref tagged);既有字段不删不改;`waves` 保留空数组
49
50
  9. **Sequential execution** — one step at a time in index order; each step's result read before the next starts
@@ -154,6 +155,7 @@ Extract:
154
155
 
155
156
  | task_type | When user intent is about... |
156
157
  |-----------|---------------------------|
158
+ | `grill` | Stress-test, challenge assumptions, Socratic questioning on a plan/idea (**skip when auto_mode — grill is interactive-only**) |
157
159
  | `quick` | Simple/small task, add a feature, quick change |
158
160
  | `blueprint` | Formal spec generation (Product Brief / PRD / Architecture / Epics) |
159
161
  | `analyze_macro` | Broad/medium intent w/o numeric phase — explore impact, produce scope_verdict |
@@ -208,7 +210,8 @@ Extract:
208
210
  1. `issue_id` present → prefer issue chains
209
211
  2. UI/design/界面/页面/原型 → prefer `ui_design`
210
212
  3. 正式规格/spec-generate/7-phase → `blueprint` (single-step) 或 `blueprint-driven`
211
- 4. 头脑风暴/探索 → `brainstorm-driven`
213
+ 4. 压力测试/拷问/grill/stress-test → `grill` (single-step); **auto_mode → skip grill, route to `brainstorm-driven` instead**
214
+ 5. 头脑风暴/探索 → `brainstorm-driven`
212
215
  5. Broad/medium intent + 无数字 phase → `analyze_macro`(产 scope_verdict);后续 large→roadmap链;medium/small→`plan_from_analyze`
213
216
  6. 已有 analyze artifact 直达 plan → `plan_from_analyze`
214
217
  7. 已有 blueprint artifact 直达 plan → `plan_from_blueprint`
@@ -384,6 +387,7 @@ S_DECISION_EVAL 入口;镜像 maestro-ralph `A_GOAL_AUDIT_EVALUATE`。Condense
384
387
 
385
388
  | Chain | Command + Args |
386
389
  |-------|---------------|
390
+ | `grill` | `maestro-grill "{intent}"` |
387
391
  | `status` | `manage-status` |
388
392
  | `init` | `maestro-init` |
389
393
  | `blueprint` | `maestro-blueprint "{intent}"` |
@@ -444,6 +448,7 @@ S_DECISION_EVAL 入口;镜像 maestro-ralph `A_GOAL_AUDIT_EVALUATE`。Condense
444
448
  | `deploy` | maestro-verify → maestro-milestone-release |
445
449
  | `blueprint-driven` | maestro-init → [B] maestro-blueprint → [B] maestro-plan --from blueprint:{BLP} → [B] maestro-execute → maestro-verify |
446
450
  | `analyze-macro-driven` | [B] maestro-analyze "{intent}" → ◆ post-analyze-scope → (large: [B] maestro-roadmap --from analyze:{ANL} → [B] maestro-analyze {phase} → [B] maestro-plan {phase}) / (medium\|small: [B] maestro-plan --from analyze:{ANL}) → [B] maestro-execute → maestro-verify |
451
+ | `grill-brainstorm` | [B] maestro-grill → [B] maestro-brainstorm --from grill:{GRL} → [B] maestro-plan → [B] maestro-execute → maestro-verify (**auto_mode: skip grill step, fall back to brainstorm-driven**) |
447
452
  | `brainstorm-driven` | [B] maestro-brainstorm → [B] maestro-plan → [B] maestro-execute → maestro-verify |
448
453
  | `ui-craft-build` | maestro-impeccable build → [B] maestro-plan → [B] maestro-execute → maestro-verify |
449
454
  | `roadmap-driven` | maestro-init → [B] maestro-roadmap → [B] maestro-plan → [B] maestro-execute → maestro-verify |