maestro-flow 0.4.17 → 0.4.19

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 (165) hide show
  1. package/.agents/skills/maestro/SKILL.md +1 -1
  2. package/.agents/skills/maestro-analyze/SKILL.md +5 -0
  3. package/.agents/skills/maestro-blueprint/SKILL.md +5 -0
  4. package/.agents/skills/maestro-brainstorm/SKILL.md +5 -0
  5. package/.agents/skills/maestro-next/SKILL.md +254 -0
  6. package/.agents/skills/team-swarm/SKILL.md +180 -0
  7. package/.agents/skills/team-swarm/roles/analyst/role.md +187 -0
  8. package/.agents/skills/team-swarm/roles/ant/role.md +169 -0
  9. package/.agents/skills/team-swarm/roles/coordinator/commands/converge.md +146 -0
  10. package/.agents/skills/team-swarm/roles/coordinator/commands/init-swarm.md +136 -0
  11. package/.agents/skills/team-swarm/roles/coordinator/commands/iterate.md +232 -0
  12. package/.agents/skills/team-swarm/roles/coordinator/role.md +211 -0
  13. package/.agents/skills/team-swarm/roles/scorer/role.md +157 -0
  14. package/.agents/skills/team-swarm/scripts/aco.py +473 -0
  15. package/.agents/skills/team-swarm/scripts/pheromone.py +144 -0
  16. package/.agents/skills/team-swarm/scripts/scoring.py +92 -0
  17. package/.agents/skills/team-swarm/scripts/test_aco.py +475 -0
  18. package/.agents/skills/team-swarm/specs/ant-output-schema.md +119 -0
  19. package/.agents/skills/team-swarm/specs/convergence-criteria.md +106 -0
  20. package/.agents/skills/team-swarm/specs/pheromone-schema.md +123 -0
  21. package/.agents/skills/team-swarm/specs/swarm-config-template.json +71 -0
  22. package/.agents/skills/team-swarm/specs/swarm-protocol.md +117 -0
  23. package/.agy/skills/maestro/SKILL.md +1 -1
  24. package/.agy/skills/maestro-analyze/SKILL.md +5 -0
  25. package/.agy/skills/maestro-blueprint/SKILL.md +5 -0
  26. package/.agy/skills/maestro-brainstorm/SKILL.md +5 -0
  27. package/.agy/skills/maestro-next/SKILL.md +250 -0
  28. package/.agy/skills/team-swarm/SKILL.md +176 -0
  29. package/.agy/skills/team-swarm/roles/analyst/role.md +183 -0
  30. package/.agy/skills/team-swarm/roles/ant/role.md +165 -0
  31. package/.agy/skills/team-swarm/roles/coordinator/commands/converge.md +134 -0
  32. package/.agy/skills/team-swarm/roles/coordinator/commands/init-swarm.md +136 -0
  33. package/.agy/skills/team-swarm/roles/coordinator/commands/iterate.md +202 -0
  34. package/.agy/skills/team-swarm/roles/coordinator/role.md +209 -0
  35. package/.agy/skills/team-swarm/roles/scorer/role.md +153 -0
  36. package/.agy/skills/team-swarm/scripts/aco.py +473 -0
  37. package/.agy/skills/team-swarm/scripts/pheromone.py +144 -0
  38. package/.agy/skills/team-swarm/scripts/scoring.py +92 -0
  39. package/.agy/skills/team-swarm/scripts/test_aco.py +475 -0
  40. package/.agy/skills/team-swarm/specs/ant-output-schema.md +119 -0
  41. package/.agy/skills/team-swarm/specs/convergence-criteria.md +106 -0
  42. package/.agy/skills/team-swarm/specs/pheromone-schema.md +123 -0
  43. package/.agy/skills/team-swarm/specs/swarm-config-template.json +71 -0
  44. package/.agy/skills/team-swarm/specs/swarm-protocol.md +117 -0
  45. package/.claude/commands/maestro-analyze.md +5 -0
  46. package/.claude/commands/maestro-blueprint.md +5 -0
  47. package/.claude/commands/maestro-brainstorm.md +5 -0
  48. package/.claude/commands/maestro-next.md +252 -0
  49. package/.claude/commands/maestro.md +1 -1
  50. package/.claude/skills/team-swarm/SKILL.md +178 -0
  51. package/.claude/skills/team-swarm/roles/analyst/role.md +185 -0
  52. package/.claude/skills/team-swarm/roles/ant/role.md +167 -0
  53. package/.claude/skills/team-swarm/roles/coordinator/commands/converge.md +146 -0
  54. package/.claude/skills/team-swarm/roles/coordinator/commands/init-swarm.md +136 -0
  55. package/.claude/skills/team-swarm/roles/coordinator/commands/iterate.md +232 -0
  56. package/.claude/skills/team-swarm/roles/coordinator/role.md +209 -0
  57. package/.claude/skills/team-swarm/roles/scorer/role.md +155 -0
  58. package/.claude/skills/team-swarm/scripts/aco.py +473 -0
  59. package/.claude/skills/team-swarm/scripts/pheromone.py +144 -0
  60. package/.claude/skills/team-swarm/scripts/scoring.py +92 -0
  61. package/.claude/skills/team-swarm/scripts/test_aco.py +475 -0
  62. package/.claude/skills/team-swarm/specs/ant-output-schema.md +119 -0
  63. package/.claude/skills/team-swarm/specs/convergence-criteria.md +106 -0
  64. package/.claude/skills/team-swarm/specs/pheromone-schema.md +123 -0
  65. package/.claude/skills/team-swarm/specs/swarm-config-template.json +71 -0
  66. package/.claude/skills/team-swarm/specs/swarm-protocol.md +117 -0
  67. package/.codex/skills/learn-decompose/SKILL.md +34 -3
  68. package/.codex/skills/learn-retro/SKILL.md +31 -1
  69. package/.codex/skills/learn-second-opinion/SKILL.md +34 -4
  70. package/.codex/skills/maestro-analyze/SKILL.md +44 -5
  71. package/.codex/skills/maestro-blueprint/SKILL.md +5 -0
  72. package/.codex/skills/maestro-brainstorm/SKILL.md +46 -0
  73. package/.codex/skills/maestro-execute/SKILL.md +61 -5
  74. package/.codex/skills/maestro-milestone-audit/SKILL.md +64 -13
  75. package/.codex/skills/maestro-milestone-complete/SKILL.md +12 -0
  76. package/.codex/skills/maestro-next/SKILL.md +297 -0
  77. package/.codex/skills/maestro-plan/SKILL.md +36 -1
  78. package/.codex/skills/maestro-player/SKILL.md +25 -6
  79. package/.codex/skills/maestro-ralph/SKILL.md +17 -10
  80. package/.codex/skills/maestro-ralph-execute/SKILL.md +2 -1
  81. package/.codex/skills/maestro-roadmap/SKILL.md +35 -4
  82. package/.codex/skills/maestro-ui-codify/SKILL.md +38 -10
  83. package/.codex/skills/maestro-verify/SKILL.md +40 -5
  84. package/.codex/skills/manage-codebase-rebuild/SKILL.md +52 -5
  85. package/.codex/skills/manage-issue-discover/SKILL.md +106 -15
  86. package/.codex/skills/quality-auto-test/SKILL.md +70 -16
  87. package/.codex/skills/quality-debug/SKILL.md +139 -28
  88. package/.codex/skills/quality-refactor/SKILL.md +61 -11
  89. package/.codex/skills/quality-review/SKILL.md +45 -9
  90. package/.codex/skills/quality-test/SKILL.md +58 -3
  91. package/.codex/skills/security-audit/SKILL.md +38 -0
  92. package/.codex/skills/spec-map/SKILL.md +65 -8
  93. package/.codex/skills/team-coordinate/SKILL.md +28 -11
  94. package/.codex/skills/team-coordinate/specs/role-catalog.md +20 -0
  95. package/.codex/skills/team-lifecycle-v4/SKILL.md +23 -7
  96. package/.codex/skills/team-lifecycle-v4/instructions/agent-instruction.md +20 -0
  97. package/.codex/skills/team-quality-assurance/SKILL.md +40 -2
  98. package/.codex/skills/team-review/SKILL.md +42 -2
  99. package/.codex/skills/team-tech-debt/SKILL.md +45 -2
  100. package/.codex/skills/team-testing/SKILL.md +42 -2
  101. package/dashboard/dist-server/dashboard/src/server/wiki/search.d.ts +6 -4
  102. package/dashboard/dist-server/dashboard/src/server/wiki/search.js +50 -8
  103. package/dashboard/dist-server/dashboard/src/server/wiki/search.js.map +1 -1
  104. package/dashboard/dist-server/dashboard/src/server/wiki/virtual-wiki-adapters.d.ts +32 -0
  105. package/dashboard/dist-server/dashboard/src/server/wiki/virtual-wiki-adapters.js +294 -0
  106. package/dashboard/dist-server/dashboard/src/server/wiki/virtual-wiki-adapters.js.map +1 -1
  107. package/dashboard/dist-server/dashboard/src/server/wiki/wiki-indexer.d.ts +1 -0
  108. package/dashboard/dist-server/dashboard/src/server/wiki/wiki-indexer.js +35 -1
  109. package/dashboard/dist-server/dashboard/src/server/wiki/wiki-indexer.js.map +1 -1
  110. package/dashboard/dist-server/dashboard/src/server/wiki/wiki-indexer.test.js +235 -0
  111. package/dashboard/dist-server/dashboard/src/server/wiki/wiki-indexer.test.js.map +1 -1
  112. package/dist/src/commands/install.js +5 -1
  113. package/dist/src/commands/install.js.map +1 -1
  114. package/dist/src/i18n/locales/en.d.ts.map +1 -1
  115. package/dist/src/i18n/locales/en.js +9 -0
  116. package/dist/src/i18n/locales/en.js.map +1 -1
  117. package/dist/src/i18n/locales/zh.d.ts.map +1 -1
  118. package/dist/src/i18n/locales/zh.js +9 -0
  119. package/dist/src/i18n/locales/zh.js.map +1 -1
  120. package/dist/src/i18n/types.d.ts +3 -0
  121. package/dist/src/i18n/types.d.ts.map +1 -1
  122. package/dist/src/ralph/cmd-check.js +1 -1
  123. package/dist/src/ralph/cmd-check.js.map +1 -1
  124. package/dist/src/ralph/cmd-complete.js +1 -1
  125. package/dist/src/ralph/cmd-complete.js.map +1 -1
  126. package/dist/src/ralph/cmd-next.d.ts.map +1 -1
  127. package/dist/src/ralph/cmd-next.js +12 -4
  128. package/dist/src/ralph/cmd-next.js.map +1 -1
  129. package/dist/src/ralph/cmd-session.js +2 -2
  130. package/dist/src/ralph/cmd-session.js.map +1 -1
  131. package/dist/src/ralph/status-store.d.ts +8 -1
  132. package/dist/src/ralph/status-store.d.ts.map +1 -1
  133. package/dist/src/ralph/status-store.js +12 -2
  134. package/dist/src/ralph/status-store.js.map +1 -1
  135. package/dist/src/tools/store-knowhow.d.ts.map +1 -1
  136. package/dist/src/tools/store-knowhow.js +51 -64
  137. package/dist/src/tools/store-knowhow.js.map +1 -1
  138. package/dist/src/tui/install-ui/HooksConfig.d.ts +5 -1
  139. package/dist/src/tui/install-ui/HooksConfig.d.ts.map +1 -1
  140. package/dist/src/tui/install-ui/HooksConfig.js +5 -3
  141. package/dist/src/tui/install-ui/HooksConfig.js.map +1 -1
  142. package/dist/src/tui/install-ui/InstallConfirm.d.ts +2 -0
  143. package/dist/src/tui/install-ui/InstallConfirm.d.ts.map +1 -1
  144. package/dist/src/tui/install-ui/InstallConfirm.js +1 -1
  145. package/dist/src/tui/install-ui/InstallConfirm.js.map +1 -1
  146. package/dist/src/tui/install-ui/InstallExecution.d.ts +1 -0
  147. package/dist/src/tui/install-ui/InstallExecution.d.ts.map +1 -1
  148. package/dist/src/tui/install-ui/InstallExecution.js +26 -3
  149. package/dist/src/tui/install-ui/InstallExecution.js.map +1 -1
  150. package/dist/src/tui/install-ui/InstallFlow.d.ts +1 -1
  151. package/dist/src/tui/install-ui/InstallFlow.d.ts.map +1 -1
  152. package/dist/src/tui/install-ui/InstallFlow.js +76 -16
  153. package/dist/src/tui/install-ui/InstallFlow.js.map +1 -1
  154. package/dist/src/tui/install-ui/InstallHub.d.ts +2 -0
  155. package/dist/src/tui/install-ui/InstallHub.d.ts.map +1 -1
  156. package/dist/src/tui/install-ui/InstallHub.js +8 -0
  157. package/dist/src/tui/install-ui/InstallHub.js.map +1 -1
  158. package/dist/src/tui/install-ui/InstallResult.d.ts.map +1 -1
  159. package/dist/src/tui/install-ui/InstallResult.js +1 -1
  160. package/dist/src/tui/install-ui/InstallResult.js.map +1 -1
  161. package/dist/src/utils/update-notices.js +23 -0
  162. package/dist/src/utils/update-notices.js.map +1 -1
  163. package/package.json +1 -1
  164. package/workflows/finish-work.md +119 -0
  165. package/workflows/milestone-complete.md +23 -1
@@ -0,0 +1,252 @@
1
+ ---
2
+ name: maestro-next
3
+ description: Single-command recommendation — pick the best next command from the pool and execute it
4
+ argument-hint: "<intent> [-y] [--dry-run] [--top N] [--list]"
5
+ allowed-tools:
6
+ - Read
7
+ - Bash
8
+ - Glob
9
+ - Grep
10
+ - Skill
11
+ - AskUserQuestion
12
+ ---
13
+
14
+ <purpose>
15
+ 单链推荐:解析 intent + project state → 路由表评分 → 推荐**单个原子命令** → 确认后通过 `Skill()` 执行。
16
+
17
+ 与 `/maestro` / `/maestro-ralph` 区别:
18
+ - 不创建 session、不构建 chain、不写 status.json
19
+ - 始终只推 1 个 top pick,最多列 2-3 个备选
20
+ - 适用场景:意图清晰且单步即可完成;或需要定向推荐时
21
+ </purpose>
22
+
23
+ <context>
24
+ $ARGUMENTS — 意图文本 + 可选 flags。
25
+
26
+ **Flags:**
27
+ - `-y` / `--yes` — 跳过确认,直接执行 top pick
28
+ - `--dry-run` — 仅显示推荐结果,不执行
29
+ - `--top N` — 显示前 N 个候选(默认 3)
30
+ - `--list` — 仅列出可推荐命令池,不做推荐
31
+
32
+ **候选池:** 仅 A_SCORE_CANDIDATES 路由表中列出的命令。管线编排器(`maestro` / `maestro-ralph*` / `maestro-player` / `maestro-composer`)**永远不在候选池**。
33
+ </context>
34
+
35
+ <invariants>
36
+ 1. **不创建 session / 不写 status.json / 不触发后续 chain** — 单次原子执行,产出由目标命令自行管理
37
+ 2. **管线编排器不在候选池** — 仅推荐原子命令
38
+ 3. **空 intent 或 "继续/下一步/next/接下来"** → 直接采用 lifecycle_position 推断的自然下一步
39
+ 4. **字面命中路由表优先** — lifecycle 仅作加分;命中失败时 lifecycle 上升为决定性信号
40
+ 5. **参数传递** — 默认 intent 原文作为第一个 arg;用户可在确认环节修改;`-y` 仅当用户传入时透传到 skill args
41
+ 6. **`--list` 模式跳过 lifecycle 推断与评分**,仅按 workflow 簇分组列出全部候选
42
+ </invariants>
43
+
44
+ <state_machine>
45
+
46
+ <states>
47
+ S_PARSE — 解析 ARGUMENTS、提取 flags PERSIST: —
48
+ S_STATE — 读 project state、推断 lifecycle_position PERSIST: —
49
+ S_RANK — 路由表评分、生成 top-N candidates PERSIST: —
50
+ S_LIST — `--list` 模式:分组展示候选池 PERSIST: —
51
+ S_PRESENT — 显示 top pick + 备选 + 推荐理由 + 执行参数 PERSIST: —
52
+ S_CONFIRM — AskUserQuestion 选择/修改参数(auto_mode 跳过) PERSIST: —
53
+ S_EXECUTE — `Skill({ skill, args })` 单次调用 PERSIST: —
54
+ S_FALLBACK — intent 空且 clarification 失败 PERSIST: —
55
+ </states>
56
+
57
+ <transitions>
58
+
59
+ S_PARSE:
60
+ → S_LIST WHEN: --list flag
61
+ → S_STATE WHEN: intent text present
62
+ → S_STATE WHEN: keyword "continue"/"next"/"go"/"继续"/"下一步"/"接下来"
63
+ → S_PARSE WHEN: no intent (max 1 clarify round) DO: AskUserQuestion
64
+ → S_FALLBACK WHEN: clarification empty
65
+
66
+ S_STATE:
67
+ → S_RANK DO: A_INFER_LIFECYCLE
68
+
69
+ S_RANK:
70
+ → S_PRESENT DO: A_SCORE_CANDIDATES
71
+
72
+ S_LIST:
73
+ → END DO: 按 workflow 簇分组列出全部候选 + description
74
+
75
+ S_PRESENT:
76
+ → END WHEN: --dry-run
77
+ → S_EXECUTE WHEN: -y / --yes
78
+ → S_CONFIRM WHEN: not auto_mode
79
+
80
+ S_CONFIRM:
81
+ → S_EXECUTE WHEN: 用户确认 top pick / 选备选 / 改参数
82
+ → END WHEN: 用户取消
83
+
84
+ S_EXECUTE:
85
+ → END DO: Skill({ skill: <chosen>, args: <args> }) → 输出 "✅ 已执行 /<command>"
86
+
87
+ S_FALLBACK:
88
+ → END DO: raise E001
89
+
90
+ </transitions>
91
+
92
+ <actions>
93
+
94
+ ### A_INFER_LIFECYCLE
95
+
96
+ 读 project state 推断 `lifecycle_position`(核心信号):
97
+
98
+ ```bash
99
+ cat .workflow/state.json 2>$null # phase / milestone / artifacts
100
+ ls -la .workflow/scratch/ 2>$null | head -10 # 最近 artifact (mtime DESC)
101
+ ls -la .workflow/.maestro/ 2>$null | head -5 # 进行中的 session
102
+ ```
103
+
104
+ **项目状态 → lifecycle_position → 自然下一步:**
105
+
106
+ | 项目状态 | lifecycle_position | 自然下一步 |
107
+ |---------|-------------------|-----------|
108
+ | 无 `.workflow/` + 无源码 | brainstorm | `maestro-brainstorm` |
109
+ | 无 `.workflow/` + 有源码 | init | `maestro-init` |
110
+ | 有 state.json,无 roadmap,无 milestones | analyze-macro | `maestro-analyze` (宏观调研) |
111
+ | 有 macro analyze artifact,无 roadmap | roadmap | `maestro-roadmap` |
112
+ | 有 roadmap,未启动 phase | analyze | `maestro-analyze {phase}` |
113
+ | 最新 artifact = analyze | plan | `maestro-plan {phase}` |
114
+ | 最新 artifact = plan | execute | `maestro-execute {phase}` |
115
+ | 最新 artifact = execute | verify | `maestro-verify {phase}` |
116
+ | verify passed | review | `quality-review {phase}` |
117
+ | review verdict=PASS | test-gen | `quality-auto-test {phase}` |
118
+ | 测试全绿 | milestone-audit | `maestro-milestone-audit` |
119
+ | 当前 milestone 全 phase 完成 | milestone-complete | `maestro-milestone-complete` |
120
+ | 任一 stage 产物含 gaps/failed | debug | `quality-debug {gap}` |
121
+
122
+ **Maestro Lifecycle 主线:**
123
+ ```
124
+ brainstorm → blueprint → init → analyze-macro → roadmap
125
+ → [per phase] analyze → plan → execute → verify
126
+ → [quality gate] review → auto-test → test
127
+ → milestone-audit → milestone-complete → milestone-release
128
+ ```
129
+
130
+ ### A_SCORE_CANDIDATES
131
+
132
+ **评分信号**(高→低):
133
+
134
+ | 信号 | 权重 | 说明 |
135
+ |------|------|------|
136
+ | intent 命中路由表关键词 | 高 | 字面匹配主依据 |
137
+ | **lifecycle 自然下一步** | **高** | 空 intent / "继续" / "next" 时为决定性 |
138
+ | `name` 关键词命中 intent | 中 | intent 含 "test" → quality-test/quality-auto-test 加分 |
139
+ | Workflow 簇匹配 | 中 | intent 涉及学习/知识/issue 等场景触发对应簇 |
140
+ | Recent activity 反向避免 | 低 | 刚完成的 stage 短期内降权 |
141
+
142
+ **特殊意图处理:**
143
+
144
+ | Intent 模式 | top pick |
145
+ |------------|---------|
146
+ | 空 / "继续" / "下一步" / "next" / "接下来" | lifecycle 自然下一步 |
147
+ | "什么状态" / "现在到哪了" / "status" | `manage-status` |
148
+ | 字面命中路由表 | 路由表优先(lifecycle 仅加分) |
149
+ | 无任何匹配 | lifecycle 下一步 + raise W002 |
150
+
151
+ **意图 → 命令路由表**(候选池):
152
+
153
+ | 意图关键词 | 推荐命令 |
154
+ |-----------|---------|
155
+ | 头脑风暴 / 探索 / brainstorm / ideate | `maestro-brainstorm` |
156
+ | 规格 / 正式文档 / spec-generate / blueprint | `maestro-blueprint` |
157
+ | 分析 / analyze / 多维度调研 | `maestro-analyze` |
158
+ | 规划 / plan / 任务分解 | `maestro-plan` |
159
+ | 实现 / 执行 / execute | `maestro-execute` |
160
+ | 验证 / verify / 验收 | `maestro-verify` |
161
+ | 调试 / debug / 排查 / bug | `quality-debug` |
162
+ | 审查 / review / 代码审查 | `quality-review` |
163
+ | 测试 / test / UAT | `quality-test` / `quality-auto-test` |
164
+ | 重构 / refactor / 技术债 | `quality-refactor` |
165
+ | 同步文档 / sync docs | `quality-sync` |
166
+ | 回顾 / retro | `quality-retrospective` / `learn-retro` |
167
+ | issue / 缺陷管理 | `manage-issue` / `manage-issue-discover` |
168
+ | wiki / 知识图谱 | `manage-wiki` / `wiki-connect` / `wiki-digest` |
169
+ | spec / 规则 / 约束 | `spec-load` / `spec-add` / `spec-setup` |
170
+ | 项目初始化 / init | `maestro-init` |
171
+ | 状态 / status / 仪表盘 | `manage-status` |
172
+ | 文档重建 / codebase 文档 | `manage-codebase-rebuild` / `manage-codebase-refresh` |
173
+ | 安全 / security / OWASP | `security-audit` |
174
+ | 跟读 / 学习 / 阅读源码 | `learn-follow` / `learn-investigate` |
175
+ | 第二意见 / challenge / consult | `learn-second-opinion` |
176
+ | 提取知识 / harvest | `manage-harvest` / `manage-knowhow-capture` |
177
+ | 设计 / UI / 前端打磨 | `maestro-impeccable` |
178
+ | 里程碑 / milestone | `maestro-milestone-audit` / `maestro-milestone-release` / `maestro-milestone-complete` |
179
+ | fork / 分支 / 并行开发 | `maestro-fork` / `maestro-merge` |
180
+ | 覆盖层 / overlay / amend | `maestro-overlay` / `maestro-amend` |
181
+
182
+ **辅助 workflow 簇**(场景触发,非主线):
183
+
184
+ | 簇 | 触发 | 主推链路 |
185
+ |----|------|---------|
186
+ | Learning | 接触新代码/未知模块 | `learn-follow` → `learn-decompose` → `learn-second-opinion` |
187
+ | Knowledge | 提炼经验 / 沉淀知识 | `manage-harvest` → `manage-knowhow-capture` → `spec-add` |
188
+ | Wiki | 知识图谱整理 | `manage-wiki` → `wiki-connect` → `wiki-digest` |
189
+ | Issue | 缺陷管理 | `manage-issue-discover` → `manage-issue` |
190
+ | 文档同步 | 代码大改后 | `quality-sync` → `manage-codebase-refresh` |
191
+ | 重构 | 技术债积累 | `quality-refactor` → `quality-review` |
192
+ | 发布 | 里程碑结束 | `maestro-milestone-audit` → `maestro-milestone-release` |
193
+ | 并行开发 | 多 milestone 并行 | `maestro-fork` → ... → `maestro-merge` |
194
+
195
+ 输出 ranked candidates,取 top N(默认 3)。
196
+
197
+ </actions>
198
+
199
+ </state_machine>
200
+
201
+ <presentation>
202
+
203
+ ### `--list` 模式
204
+
205
+ 按 workflow 簇(主线 / Learning / Knowledge / Wiki / Issue / 文档 / 重构 / 发布 / 并行)分组展示全部候选 + description,结束。
206
+
207
+ ### 正常模式
208
+
209
+ ```
210
+ 🎯 推荐 (top pick): /<command-name>
211
+ <description>
212
+ 推荐理由: <命中规则 + lifecycle 位置一句话>
213
+
214
+ 备选:
215
+ 2. /<alt-1> — <description>
216
+ 3. /<alt-2> — <description>
217
+
218
+ 执行参数: <args>
219
+ ```
220
+
221
+ `--dry-run` 展示后结束;`-y` 直接 S_EXECUTE;否则 AskUserQuestion 提供:执行 top pick / 选备选 / 修改参数 / 取消。
222
+
223
+ </presentation>
224
+
225
+ <appendix>
226
+
227
+ ### Error Codes
228
+
229
+ | Code | Severity | Condition | Recovery |
230
+ |------|----------|-----------|----------|
231
+ | E001 | error | intent 空且 clarification 后仍空 | 提供意图描述或使用 `--list` 浏览 |
232
+ | E002 | error | 候选池为空(`.claude/commands/` 缺失或无 .md) | 检查 commands 目录 |
233
+ | E003 | error | 选定命令名无法解析为有效 skill | 列出有效命令重选 |
234
+ | W001 | warning | top1 与 top2 得分差距 < 阈值 | 强制展示前 3 让用户裁决 |
235
+ | W002 | warning | intent 与所有候选匹配度均低 | 提示考虑 `/maestro` 或 `/maestro-ralph` 走管线 |
236
+
237
+ ### Success Criteria
238
+
239
+ - [ ] Intent 解析 + flags 提取完成
240
+ - [ ] 读取 `.workflow/state.json` + scratch artifacts 推断 lifecycle_position
241
+ - [ ] 候选池等于路由表(管线编排器不在)
242
+ - [ ] 评分综合:intent 字面匹配 + lifecycle 下一步 + workflow 簇 + recent activity
243
+ - [ ] 空 intent / "继续" / "下一步" → 直接采用 lifecycle 推断的下一步
244
+ - [ ] top pick 展示附"推荐理由"(命中规则 + lifecycle 位置)
245
+ - [ ] `--dry-run` 仅展示,不执行
246
+ - [ ] `-y` 自动执行 top pick;用户传入时透传到 skill args
247
+ - [ ] 非自动模式通过 AskUserQuestion 确认或选备选
248
+ - [ ] 选定命令通过单次 `Skill()` 调用执行
249
+ - [ ] 不创建 session / 不生成 status.json / 不触发后续 chain
250
+ - [ ] `--list` 模式按 workflow 簇分组展示
251
+
252
+ </appendix>
@@ -23,7 +23,7 @@ Entry points:
23
23
  - **`/maestro --dry-run "intent"`** — Show chain, no execution
24
24
  - **`/maestro --super "intent"`** — Production-ready mode (read maestro-super.md)
25
25
 
26
- Session: `.workflow/.maestro/{session_id}/status.json`
26
+ **Session**: `.workflow/.maestro/{session_id}/status.json` — 工作流唯一真源。session_id 格式 `maestro-{YYYYMMDD-HHmmss}`(本 command 创建,静态链)或 `ralph-{YYYYMMDD-HHmmss}`(`/maestro-ralph` 创建,自适应链)。两类都由 `/maestro-ralph-execute` 推进;schema 与 ralph 共用(含 `ralph_protocol_version: "1"` + `active_step_index`)。
27
27
  </purpose>
28
28
 
29
29
  <deferred_reading>
@@ -0,0 +1,178 @@
1
+ ---
2
+ name: team-swarm
3
+ description: Swarm intelligence team skill — ACO-driven multi-agent exploration with hybrid LLM coordinator + Python optimization controller. Coordinator generates swarm-config from user task, then runs K iterations of N parallel ants guided by pheromone state. Universal task space via config (nodes + scoring rule). Triggers on "team swarm", "swarm intelligence", "蚁群".
4
+ allowed-tools: TeamCreate(*), TeamDelete(*), SendMessage(*), TaskCreate(*), TaskUpdate(*), TaskList(*), TaskGet(*), Agent(*), AskUserQuestion(*), Read(*), Write(*), Edit(*), Bash(*), Glob(*), Grep(*), mcp__ccw-tools__team_msg(*)
5
+ ---
6
+
7
+ # Team Swarm
8
+
9
+ Orchestrate ant-colony-style exploration over a user-defined task space. **Hybrid coordinator**: LLM handles task translation + worker spawning; Python script owns all numeric decisions (selection / pheromone update / convergence). Universal — task space and scoring rule come from `swarm-config.json`.
10
+
11
+ ## Architecture
12
+
13
+ ```
14
+ Skill(skill="team-swarm", args="task description")
15
+ |
16
+ SKILL.md (this file) = Router
17
+ |
18
+ +--------------+--------------+
19
+ | |
20
+ no --role flag --role <name>
21
+ | |
22
+ Coordinator Worker
23
+ roles/coordinator/role.md roles/<name>/role.md
24
+ |
25
+ +-- Phase 1: gen swarm-config
26
+ +-- Phase 2: init --> Bash: scripts/aco.py init
27
+ +-- Phase 3: iterate (K rounds, each = spawn-and-stop)
28
+ | |
29
+ | +-- Bash: aco.py select --iter k -> N assignments
30
+ | +-- Spawn N x team-worker(ant)
31
+ | +-- [callback when all ants done]
32
+ | +-- (optional) Spawn team-worker(scorer)
33
+ | +-- Bash: aco.py update --iter k
34
+ | +-- Bash: aco.py converged
35
+ | +-- branch: loop k+1 OR Phase 4
36
+ |
37
+ +-- Phase 4: converge --> Bash: aco.py report -> Spawn team-worker(analyst)
38
+ -> best-solution.md
39
+ ```
40
+
41
+ ## Role Registry
42
+
43
+ | Role | Path | Prefix | Inner Loop |
44
+ |------|------|--------|------------|
45
+ | coordinator | [roles/coordinator/role.md](roles/coordinator/role.md) | — | — |
46
+ | ant | [roles/ant/role.md](roles/ant/role.md) | ANT-* | false |
47
+ | scorer | [roles/scorer/role.md](roles/scorer/role.md) | SCORE-* | false |
48
+ | analyst | [roles/analyst/role.md](roles/analyst/role.md) | ANALYST-* | false |
49
+
50
+ ## Role Router
51
+
52
+ Parse `$ARGUMENTS`:
53
+ - Has `--role <name>` -> Read `roles/<name>/role.md`, execute Phase 2-4
54
+ - No `--role` -> `@roles/coordinator/role.md`, execute entry router
55
+
56
+ ## Shared Constants
57
+
58
+ - **Session prefix**: `TS`
59
+ - **Session path**: `.workflow/.team/TS-<slug>-<date>/`
60
+ - **Team name**: `swarm`
61
+ - **Script root**: `<skill_root>/scripts/aco.py` (Python 3.10+)
62
+ - **Message bus**: `mcp__ccw-tools__team_msg(session_id=<session-id>, ...)`
63
+
64
+ ## Worker Spawn Template
65
+
66
+ Coordinator spawns workers using this template:
67
+
68
+ ```
69
+ Agent({
70
+ subagent_type: "team-worker",
71
+ description: "Spawn <role> worker",
72
+ team_name: "swarm",
73
+ name: "<role>",
74
+ run_in_background: true,
75
+ prompt: `## Role Assignment
76
+ role: <role>
77
+ role_spec: <skill_root>/roles/<role>/role.md
78
+ session: <session-folder>
79
+ session_id: <session-id>
80
+ team_name: swarm
81
+ requirement: <task-description>
82
+ inner_loop: false
83
+
84
+ ## Assignment (ant only)
85
+ <assignment JSON from aco.py select>
86
+
87
+ ## Progress Milestones
88
+ session_id: <session-id>
89
+ Report progress via team_msg at natural phase boundaries.
90
+ Report blockers immediately via team_msg type="blocker".
91
+ Report completion via team_msg type="task_complete" after final SendMessage.
92
+
93
+ Read role_spec file (@<skill_root>/roles/<role>/role.md) to load Phase 2-4 domain instructions.
94
+ Execute built-in Phase 1 (task discovery) -> role Phase 2-4 -> built-in Phase 5 (report).`
95
+ })
96
+ ```
97
+
98
+ ## User Commands
99
+
100
+ | Command | Action |
101
+ |---------|--------|
102
+ | `check` / `status` | View iteration progress + convergence curve |
103
+ | `resume` / `continue` | Resume interrupted iteration |
104
+ | `feedback <text>` | Inject feedback into wisdom; applies at next iteration |
105
+ | `revise <ITER>` | Re-run a specific iteration (rare) |
106
+
107
+ ## Specs Reference
108
+
109
+ | Spec | Purpose |
110
+ |------|---------|
111
+ | [specs/swarm-protocol.md](specs/swarm-protocol.md) | Master protocol: script <-> coordinator interface, data flow |
112
+ | [specs/pheromone-schema.md](specs/pheromone-schema.md) | Pheromone JSON structure, update formula, evaporation |
113
+ | [specs/ant-output-schema.md](specs/ant-output-schema.md) | Critical contract for ant JSON artifacts |
114
+ | [specs/convergence-criteria.md](specs/convergence-criteria.md) | Stop conditions, multi-criterion logic |
115
+ | [specs/swarm-config-template.json](specs/swarm-config-template.json) | User-facing config template with all knobs |
116
+
117
+ ## Scripts
118
+
119
+ | Script | Purpose | Invocation |
120
+ |--------|---------|------------|
121
+ | `scripts/aco.py` | Main CLI: init / select / update / converged / report | `python aco.py --session <path> <cmd>` |
122
+ | `scripts/pheromone.py` | Pheromone matrix module (imported by aco.py) | — |
123
+ | `scripts/scoring.py` | Pluggable scorer (script + fallback modes) | — |
124
+
125
+ ## Session Directory
126
+
127
+ ```
128
+ .workflow/.team/TS-<slug>-<date>/
129
+ ├── team-session.json # Session state
130
+ ├── swarm-config.json # User-facing config (Phase 1 output)
131
+ ├── role-binding.json # Worker role_spec path map
132
+ ├── task-space.json # Resolved nodes list
133
+ ├── pheromone/
134
+ │ ├── current.json # Latest pheromone (each iter overwrites)
135
+ │ ├── init.json # Frozen initial state
136
+ │ └── history/<iter>.json # Per-iter snapshot
137
+ ├── trails/<iter>.jsonl # Per-iter all-ant paths + scores
138
+ ├── scores/iter-<iter>-scores.json # Scorer output (if mode == llm)
139
+ ├── artifacts/
140
+ │ ├── ant-<iter>-<id>.json # Per-ant schema-locked output
141
+ │ ├── swarm-report.json # Phase 4 full report dump
142
+ │ └── best-solution.md # Analyst final synthesis
143
+ ├── best.json # Canonical best solution
144
+ ├── wisdom/ # learnings / decisions / issues
145
+ └── .msg/ # Message bus
146
+ ```
147
+
148
+ ## Completion Action
149
+
150
+ When swarm converges, coordinator presents:
151
+
152
+ ```
153
+ AskUserQuestion({
154
+ questions: [{
155
+ question: "Swarm pipeline complete. What would you like to do?",
156
+ header: "Completion",
157
+ multiSelect: false,
158
+ options: [
159
+ { label: "Archive & Clean (Recommended)", description: "Archive session, delete team" },
160
+ { label: "Keep Active", description: "Preserve for follow-up" },
161
+ { label: "Export Best Solution", description: "Copy best-solution.md to target" },
162
+ { label: "Run Another Round", description: "Reset convergence, K more iterations" }
163
+ ]
164
+ }]
165
+ })
166
+ ```
167
+
168
+ ## Error Handling
169
+
170
+ | Scenario | Resolution |
171
+ |----------|------------|
172
+ | `aco.py` not found | Verify `<skill_root>/scripts/aco.py`; check Python install |
173
+ | Python version < 3.10 | Use `python3` or report dependency error |
174
+ | Config validation fails | AskUserQuestion to fix, regenerate, retry |
175
+ | All ants fail in iteration | Halt, AskUserQuestion (retry / abort / refine config) |
176
+ | Hallucination cluster (>50%) | Pause, AskUserQuestion (continue / refine scoring) |
177
+ | Convergence never trips | `max_iterations` safety net always fires |
178
+ | Session corruption | Phase 0 reconciliation; archive if irrecoverable |
@@ -0,0 +1,185 @@
1
+ ---
2
+ role: analyst
3
+ prefix: ANALYST
4
+ inner_loop: false
5
+ output_tag: "[analyst]"
6
+ message_types:
7
+ success: analysis_ready
8
+ error: error
9
+ ---
10
+
11
+ # Analyst Role — Phase 2-4
12
+
13
+ Tag: `[analyst]` | Prefix: `ANALYST-*`
14
+ Responsibility: After swarm converges, synthesize the best solution + top trails + convergence curve into a human-readable `best-solution.md` report. Provides interpretation, not just data dump.
15
+
16
+ ## Boundaries
17
+
18
+ ### MUST
19
+ - Read `<session>/best.json`, `<session>/artifacts/swarm-report.json`, all `<session>/trails/*.jsonl`
20
+ - Produce `<session>/artifacts/best-solution.md` as the final deliverable
21
+ - Explain WHY the best path won (which decisions mattered, evidence chain)
22
+ - Compare best vs runner-ups to surface stability vs luck
23
+ - Document convergence story (entropy curve, when stagnation hit)
24
+
25
+ ### MUST NOT
26
+ - Re-score solutions (that is scorer's job — analyst takes verified_score as given)
27
+ - Modify best.json, trails, or pheromone state
28
+ - Generate solutions of its own — analyst synthesizes existing ant outputs
29
+ - Exceed ~150 lines in best-solution.md (be sharp, not verbose)
30
+
31
+ ## Phase 2: Context Loading
32
+
33
+ | Input | Source | Required |
34
+ |-------|--------|----------|
35
+ | Original objective | `<session>/swarm-config.json#ant_prompt.objective` | Yes |
36
+ | Best solution | `<session>/best.json` | Yes |
37
+ | Full swarm report | `<session>/artifacts/swarm-report.json` | Yes |
38
+ | All trails | `<session>/trails/*.jsonl` | Yes |
39
+ | Convergence reason | swarm-report.json or `aco.py converged` output | Yes |
40
+ | Best ant artifact | `<session>/artifacts/ant-<best.iteration>-<best.id>.json` (full evidence) | Yes |
41
+ | Issues log | `<session>/wisdom/issues.md` | Optional |
42
+
43
+ Workflow:
44
+ 1. Extract session path from task description
45
+ 2. Read swarm-config.json -> capture objective
46
+ 3. Read best.json -> identify best ant
47
+ 4. Read full swarm-report.json -> get top_k + convergence_curve
48
+ 5. Read the best ant's full artifact for evidence chain
49
+ 6. Read all trails/*.jsonl into a list (chronological)
50
+
51
+ ## Phase 3: Synthesis
52
+
53
+ ### 3.1 Structure the report
54
+
55
+ Layout for `best-solution.md`:
56
+
57
+ ```markdown
58
+ # Swarm Result — <objective_short_form>
59
+
60
+ ## Best Solution
61
+
62
+ **Path**: node_a → node_c → node_f
63
+ **Verified Score**: 0.82
64
+ **Iteration**: 3 of 5
65
+ **Ant**: ANT-3-2
66
+
67
+ ### Summary
68
+ <one paragraph — what the best solution proposes and why it answers the objective>
69
+
70
+ ### Evidence Chain
71
+ - `src/foo.ts:42` — <how this evidence supports the decision>
72
+ - `tests/foo.spec.ts:18` — <...>
73
+
74
+ ### Candidate Artifact
75
+ <extract from best.candidate_solution — quote or summarize, link to file if file_ref>
76
+
77
+ ## Why This Path Won
78
+
79
+ | Decision | Pheromone-guided? | Why it mattered |
80
+ |----------|-------------------|-----------------|
81
+ | start = node_a | weighted | <reason> |
82
+ | a → c | yes (0.45 hint) | <reason> |
83
+ | c → f | NO (deviation) | <reason> — this was the key call |
84
+
85
+ ## Runner-Up Solutions
86
+
87
+ | Rank | Ant | Path | Score | Diff from best |
88
+ |------|-----|------|-------|----------------|
89
+ | 2 | ANT-2-1 | a → b → e | 0.74 | -0.08; weaker evidence at e |
90
+ | 3 | ANT-4-3 | a → c → g | 0.71 | -0.11; valid but less specific |
91
+
92
+ ## Convergence Story
93
+
94
+ Iterations: 4 of 5 max
95
+ Trigger: stagnation (best unchanged for 2 iterations)
96
+
97
+ Entropy curve:
98
+ - iter 1: 3.21 (broad exploration)
99
+ - iter 2: 2.45 (narrowing on node_a region)
100
+ - iter 3: 1.85 (best emerges at ANT-3-2)
101
+ - iter 4: 1.72 (consensus around best, no improvement)
102
+
103
+ Interpretation: <2-3 sentences on whether the swarm converged on a genuine optimum or got stuck>
104
+
105
+ ## Caveats
106
+
107
+ - <e.g., 40% of ants in iter 2 flagged as hallucinations>
108
+ - <e.g., evidence for node_f is single-source — recommend manual verification>
109
+ - <e.g., search space had only N nodes — larger space may surface better solutions>
110
+
111
+ ## Reproducibility
112
+
113
+ - Config: `swarm-config.json` (pinned)
114
+ - Best path: `best.json`
115
+ - Full trails: `trails/<iter>.jsonl`
116
+ - Random seed: <if used>
117
+ ```
118
+
119
+ ### 3.2 Interpretation rules
120
+
121
+ - **Why-it-won analysis** is the highest-value content. Don't just describe the path — explain which decisions were pivotal.
122
+ - **Pheromone vs deviation**: track which steps followed pheromone hints vs deviated. Deviations that produced higher scores are the most interesting signal.
123
+ - **Runner-up diff**: surface why #2 lost — was it a weaker path or just unlucky evidence?
124
+ - **Caveats are mandatory**: every swarm result has limitations. List them honestly.
125
+
126
+ ### 3.3 Constraints
127
+
128
+ - Target ≤ 150 lines
129
+ - No prose padding — every section earns its place
130
+ - Quote evidence verbatim where possible (file:line refs)
131
+ - Don't editorialize beyond what evidence supports
132
+
133
+ ## Phase 4: Verify + Publish
134
+
135
+ ### Behavioral Traits
136
+
137
+ #### Accuracy
138
+ - Every cited path/score MUST match best.json or trails source
139
+ - Every evidence reference MUST be verifiable (Read to confirm if file_ref)
140
+ - Convergence curve numbers MUST match swarm-report.json#convergence_curve
141
+
142
+ #### Feedback Contract
143
+ | Field | Required | Content |
144
+ |-------|----------|---------|
145
+ | artifacts_written | Always | `<session>/artifacts/best-solution.md` |
146
+ | line_count | Always | int (target ≤ 150) |
147
+ | verification_method | Always | "cross_ref_with_best.json + evidence_verified" |
148
+
149
+ #### Quality Gate
150
+ - Final report file exists and parses as markdown
151
+ - All sections present (Best Solution / Why Won / Runner-Ups / Convergence / Caveats / Reproducibility)
152
+ - Line count ≤ 200 (hard cap — fail if exceeded, retry with sharper edit)
153
+
154
+ ### Verification Steps
155
+
156
+ 1. Read written best-solution.md back
157
+ 2. Cross-check best.score against best.json
158
+ 3. Confirm runner-up scores against trails
159
+ 4. If file_ref evidence in best.candidate_solution -> Read to confirm file exists
160
+ 5. Count lines — if > 200, condense and rewrite
161
+
162
+ ### State Update
163
+
164
+ ```json
165
+ {
166
+ "task_id": "ANALYST-1",
167
+ "role": "analyst",
168
+ "status": "completed",
169
+ "artifact_path": "<session>/artifacts/best-solution.md",
170
+ "best_score": <float>,
171
+ "best_ant_id": "<id>",
172
+ "line_count": <int>,
173
+ "verification": "cross_ref_pass + evidence_verified"
174
+ }
175
+ ```
176
+
177
+ ## Error Handling
178
+
179
+ | Scenario | Resolution |
180
+ |----------|------------|
181
+ | best.json missing | Pipeline produced no valid ant — write minimal report with `status: no_solution` |
182
+ | Trails empty | Same as above — no exploration data to analyze |
183
+ | Best ant artifact missing | Use only best.json fields; note as caveat |
184
+ | Cross-ref mismatch (score discrepancy) | Trust best.json; note discrepancy in caveats |
185
+ | Line count > 200 after rewrite | Hard-fail report; coordinator decides retry vs accept |