maestro-flow 0.4.18 → 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.
- package/.agents/skills/maestro-next/SKILL.md +147 -112
- package/.agents/skills/team-swarm/SKILL.md +180 -0
- package/.agents/skills/team-swarm/roles/analyst/role.md +187 -0
- package/.agents/skills/team-swarm/roles/ant/role.md +169 -0
- package/.agents/skills/team-swarm/roles/coordinator/commands/converge.md +146 -0
- package/.agents/skills/team-swarm/roles/coordinator/commands/init-swarm.md +136 -0
- package/.agents/skills/team-swarm/roles/coordinator/commands/iterate.md +232 -0
- package/.agents/skills/team-swarm/roles/coordinator/role.md +211 -0
- package/.agents/skills/team-swarm/roles/scorer/role.md +157 -0
- package/.agents/skills/team-swarm/scripts/aco.py +473 -0
- package/.agents/skills/team-swarm/scripts/pheromone.py +144 -0
- package/.agents/skills/team-swarm/scripts/scoring.py +92 -0
- package/.agents/skills/team-swarm/scripts/test_aco.py +475 -0
- package/.agents/skills/team-swarm/specs/ant-output-schema.md +119 -0
- package/.agents/skills/team-swarm/specs/convergence-criteria.md +106 -0
- package/.agents/skills/team-swarm/specs/pheromone-schema.md +123 -0
- package/.agents/skills/team-swarm/specs/swarm-config-template.json +71 -0
- package/.agents/skills/team-swarm/specs/swarm-protocol.md +117 -0
- package/.agy/skills/maestro-next/SKILL.md +147 -112
- package/.agy/skills/team-swarm/SKILL.md +176 -0
- package/.agy/skills/team-swarm/roles/analyst/role.md +183 -0
- package/.agy/skills/team-swarm/roles/ant/role.md +165 -0
- package/.agy/skills/team-swarm/roles/coordinator/commands/converge.md +134 -0
- package/.agy/skills/team-swarm/roles/coordinator/commands/init-swarm.md +136 -0
- package/.agy/skills/team-swarm/roles/coordinator/commands/iterate.md +202 -0
- package/.agy/skills/team-swarm/roles/coordinator/role.md +209 -0
- package/.agy/skills/team-swarm/roles/scorer/role.md +153 -0
- package/.agy/skills/team-swarm/scripts/aco.py +473 -0
- package/.agy/skills/team-swarm/scripts/pheromone.py +144 -0
- package/.agy/skills/team-swarm/scripts/scoring.py +92 -0
- package/.agy/skills/team-swarm/scripts/test_aco.py +475 -0
- package/.agy/skills/team-swarm/specs/ant-output-schema.md +119 -0
- package/.agy/skills/team-swarm/specs/convergence-criteria.md +106 -0
- package/.agy/skills/team-swarm/specs/pheromone-schema.md +123 -0
- package/.agy/skills/team-swarm/specs/swarm-config-template.json +71 -0
- package/.agy/skills/team-swarm/specs/swarm-protocol.md +117 -0
- package/.claude/commands/maestro-next.md +147 -112
- package/.claude/skills/team-swarm/SKILL.md +178 -0
- package/.claude/skills/team-swarm/roles/analyst/role.md +185 -0
- package/.claude/skills/team-swarm/roles/ant/role.md +167 -0
- package/.claude/skills/team-swarm/roles/coordinator/commands/converge.md +146 -0
- package/.claude/skills/team-swarm/roles/coordinator/commands/init-swarm.md +136 -0
- package/.claude/skills/team-swarm/roles/coordinator/commands/iterate.md +232 -0
- package/.claude/skills/team-swarm/roles/coordinator/role.md +209 -0
- package/.claude/skills/team-swarm/roles/scorer/role.md +155 -0
- package/.claude/skills/team-swarm/scripts/aco.py +473 -0
- package/.claude/skills/team-swarm/scripts/pheromone.py +144 -0
- package/.claude/skills/team-swarm/scripts/scoring.py +92 -0
- package/.claude/skills/team-swarm/scripts/test_aco.py +475 -0
- package/.claude/skills/team-swarm/specs/ant-output-schema.md +119 -0
- package/.claude/skills/team-swarm/specs/convergence-criteria.md +106 -0
- package/.claude/skills/team-swarm/specs/pheromone-schema.md +123 -0
- package/.claude/skills/team-swarm/specs/swarm-config-template.json +71 -0
- package/.claude/skills/team-swarm/specs/swarm-protocol.md +117 -0
- package/.codex/skills/maestro-next/SKILL.md +297 -0
- package/dist/src/commands/install.js +5 -1
- package/dist/src/commands/install.js.map +1 -1
- package/dist/src/i18n/locales/en.d.ts.map +1 -1
- package/dist/src/i18n/locales/en.js +9 -0
- package/dist/src/i18n/locales/en.js.map +1 -1
- package/dist/src/i18n/locales/zh.d.ts.map +1 -1
- package/dist/src/i18n/locales/zh.js +9 -0
- package/dist/src/i18n/locales/zh.js.map +1 -1
- package/dist/src/i18n/types.d.ts +3 -0
- package/dist/src/i18n/types.d.ts.map +1 -1
- package/dist/src/tui/install-ui/HooksConfig.d.ts +5 -1
- package/dist/src/tui/install-ui/HooksConfig.d.ts.map +1 -1
- package/dist/src/tui/install-ui/HooksConfig.js +5 -3
- package/dist/src/tui/install-ui/HooksConfig.js.map +1 -1
- package/dist/src/tui/install-ui/InstallConfirm.d.ts +2 -0
- package/dist/src/tui/install-ui/InstallConfirm.d.ts.map +1 -1
- package/dist/src/tui/install-ui/InstallConfirm.js +1 -1
- package/dist/src/tui/install-ui/InstallConfirm.js.map +1 -1
- package/dist/src/tui/install-ui/InstallExecution.d.ts +1 -0
- package/dist/src/tui/install-ui/InstallExecution.d.ts.map +1 -1
- package/dist/src/tui/install-ui/InstallExecution.js +26 -3
- package/dist/src/tui/install-ui/InstallExecution.js.map +1 -1
- package/dist/src/tui/install-ui/InstallFlow.d.ts +1 -1
- package/dist/src/tui/install-ui/InstallFlow.d.ts.map +1 -1
- package/dist/src/tui/install-ui/InstallFlow.js +76 -16
- package/dist/src/tui/install-ui/InstallFlow.js.map +1 -1
- package/dist/src/tui/install-ui/InstallHub.d.ts +2 -0
- package/dist/src/tui/install-ui/InstallHub.d.ts.map +1 -1
- package/dist/src/tui/install-ui/InstallHub.js +8 -0
- package/dist/src/tui/install-ui/InstallHub.js.map +1 -1
- package/dist/src/tui/install-ui/InstallResult.d.ts.map +1 -1
- package/dist/src/tui/install-ui/InstallResult.js +1 -1
- package/dist/src/tui/install-ui/InstallResult.js.map +1 -1
- package/dist/src/utils/update-notices.js +11 -0
- package/dist/src/utils/update-notices.js.map +1 -1
- package/package.json +1 -1
|
@@ -10,70 +10,114 @@ allowed-tools:
|
|
|
10
10
|
---
|
|
11
11
|
|
|
12
12
|
<purpose>
|
|
13
|
-
|
|
13
|
+
单链推荐:解析 intent + project state → 路由表评分 → 推荐**单个原子命令** → 确认后通过 `Skill()` 执行。
|
|
14
14
|
|
|
15
|
-
与 `/maestro` / `/maestro-ralph`
|
|
16
|
-
-
|
|
17
|
-
-
|
|
18
|
-
-
|
|
15
|
+
与 `/maestro` / `/maestro-ralph` 区别:
|
|
16
|
+
- 不创建 session、不构建 chain、不写 status.json
|
|
17
|
+
- 始终只推 1 个 top pick,最多列 2-3 个备选
|
|
18
|
+
- 适用场景:意图清晰且单步即可完成;或需要定向推荐时
|
|
19
19
|
</purpose>
|
|
20
20
|
|
|
21
21
|
<context>
|
|
22
|
-
$ARGUMENTS —
|
|
22
|
+
$ARGUMENTS — 意图文本 + 可选 flags。
|
|
23
23
|
|
|
24
24
|
**Flags:**
|
|
25
|
-
- `-y` / `--yes` —
|
|
25
|
+
- `-y` / `--yes` — 跳过确认,直接执行 top pick
|
|
26
26
|
- `--dry-run` — 仅显示推荐结果,不执行
|
|
27
|
-
- `--top N` — 显示前 N
|
|
27
|
+
- `--top N` — 显示前 N 个候选(默认 3)
|
|
28
28
|
- `--list` — 仅列出可推荐命令池,不做推荐
|
|
29
29
|
|
|
30
|
-
**候选池:** 仅
|
|
30
|
+
**候选池:** 仅 A_SCORE_CANDIDATES 路由表中列出的命令。管线编排器(`maestro` / `maestro-ralph*` / `maestro-player` / `maestro-composer`)**永远不在候选池**。
|
|
31
31
|
</context>
|
|
32
32
|
|
|
33
|
-
<
|
|
33
|
+
<invariants>
|
|
34
|
+
1. **不创建 session / 不写 status.json / 不触发后续 chain** — 单次原子执行,产出由目标命令自行管理
|
|
35
|
+
2. **管线编排器不在候选池** — 仅推荐原子命令
|
|
36
|
+
3. **空 intent 或 "继续/下一步/next/接下来"** → 直接采用 lifecycle_position 推断的自然下一步
|
|
37
|
+
4. **字面命中路由表优先** — lifecycle 仅作加分;命中失败时 lifecycle 上升为决定性信号
|
|
38
|
+
5. **参数传递** — 默认 intent 原文作为第一个 arg;用户可在确认环节修改;`-y` 仅当用户传入时透传到 skill args
|
|
39
|
+
6. **`--list` 模式跳过 lifecycle 推断与评分**,仅按 workflow 簇分组列出全部候选
|
|
40
|
+
</invariants>
|
|
34
41
|
|
|
35
|
-
|
|
42
|
+
<state_machine>
|
|
36
43
|
|
|
37
|
-
|
|
44
|
+
<states>
|
|
45
|
+
S_PARSE — 解析 ARGUMENTS、提取 flags PERSIST: —
|
|
46
|
+
S_STATE — 读 project state、推断 lifecycle_position PERSIST: —
|
|
47
|
+
S_RANK — 路由表评分、生成 top-N candidates PERSIST: —
|
|
48
|
+
S_LIST — `--list` 模式:分组展示候选池 PERSIST: —
|
|
49
|
+
S_PRESENT — 显示 top pick + 备选 + 推荐理由 + 执行参数 PERSIST: —
|
|
50
|
+
S_CONFIRM — ask_question 选择/修改参数(auto_mode 跳过) PERSIST: —
|
|
51
|
+
S_EXECUTE — `Skill({ skill, args })` 单次调用 PERSIST: —
|
|
52
|
+
S_FALLBACK — intent 空且 clarification 失败 PERSIST: —
|
|
53
|
+
</states>
|
|
38
54
|
|
|
39
|
-
|
|
40
|
-
- `intent` 为空且非 `--list` → `ask_question`:让用户输入意图(最多 1 轮,仍空则 E001)
|
|
55
|
+
<transitions>
|
|
41
56
|
|
|
42
|
-
|
|
57
|
+
S_PARSE:
|
|
58
|
+
→ S_LIST WHEN: --list flag
|
|
59
|
+
→ S_STATE WHEN: intent text present
|
|
60
|
+
→ S_STATE WHEN: keyword "continue"/"next"/"go"/"继续"/"下一步"/"接下来"
|
|
61
|
+
→ S_PARSE WHEN: no intent (max 1 clarify round) DO: ask_question
|
|
62
|
+
→ S_FALLBACK WHEN: clarification empty
|
|
43
63
|
|
|
44
|
-
|
|
64
|
+
S_STATE:
|
|
65
|
+
→ S_RANK DO: A_INFER_LIFECYCLE
|
|
45
66
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
cat .workflow/state.json 2>$null
|
|
67
|
+
S_RANK:
|
|
68
|
+
→ S_PRESENT DO: A_SCORE_CANDIDATES
|
|
49
69
|
|
|
50
|
-
|
|
51
|
-
|
|
70
|
+
S_LIST:
|
|
71
|
+
→ END DO: 按 workflow 簇分组列出全部候选 + description
|
|
52
72
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
73
|
+
S_PRESENT:
|
|
74
|
+
→ END WHEN: --dry-run
|
|
75
|
+
→ S_EXECUTE WHEN: -y / --yes
|
|
76
|
+
→ S_CONFIRM WHEN: not auto_mode
|
|
77
|
+
|
|
78
|
+
S_CONFIRM:
|
|
79
|
+
→ S_EXECUTE WHEN: 用户确认 top pick / 选备选 / 改参数
|
|
80
|
+
→ END WHEN: 用户取消
|
|
81
|
+
|
|
82
|
+
S_EXECUTE:
|
|
83
|
+
→ END DO: Skill({ skill: <chosen>, args: <args> }) → 输出 "✅ 已执行 /<command>"
|
|
84
|
+
|
|
85
|
+
S_FALLBACK:
|
|
86
|
+
→ END DO: raise E001
|
|
56
87
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
| 项目状态特征 | lifecycle_position | 自然下一步 |
|
|
60
|
-
|--------------|-------------------|-----------|
|
|
61
|
-
| 无 `.workflow/` + 无源码 | `brainstorm` | `maestro-brainstorm` |
|
|
62
|
-
| 无 `.workflow/` + 有源码 | `init` | `maestro-init` |
|
|
63
|
-
| 有 state.json,无 roadmap.md,无 milestones | `analyze-macro` | `maestro-analyze` (宏观调研) |
|
|
64
|
-
| 有 macro analyze artifact,无 roadmap.md | `roadmap` | `maestro-roadmap` |
|
|
65
|
-
| 有 roadmap,未启动 phase | `analyze` | `maestro-analyze {phase}` |
|
|
66
|
-
| 最新 artifact = `analyze` | `plan` | `maestro-plan {phase}` |
|
|
67
|
-
| 最新 artifact = `plan` | `execute` | `maestro-execute {phase}` |
|
|
68
|
-
| 最新 artifact = `execute` | `verify` | `maestro-verify {phase}` |
|
|
69
|
-
| 最新 artifact = `verify`,passed | `review` | `quality-review {phase}` |
|
|
70
|
-
| 最新 artifact = `review`,verdict=PASS | `test-gen` | `quality-auto-test {phase}` |
|
|
71
|
-
| 最新 artifact = `test`,全绿 | `milestone-audit` | `maestro-milestone-audit` |
|
|
72
|
-
| 当前 milestone 全部 phase 完成 | `milestone-complete` | `maestro-milestone-complete` |
|
|
73
|
-
| 任一 stage 产物含 gaps/failed | `debug` | `quality-debug {gap}` |
|
|
74
|
-
|
|
75
|
-
**Maestro Lifecycle 主线(核心 workflow,供推断"下一步"使用):**
|
|
88
|
+
</transitions>
|
|
76
89
|
|
|
90
|
+
<actions>
|
|
91
|
+
|
|
92
|
+
### A_INFER_LIFECYCLE
|
|
93
|
+
|
|
94
|
+
读 project state 推断 `lifecycle_position`(核心信号):
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
cat .workflow/state.json 2>$null # phase / milestone / artifacts
|
|
98
|
+
ls -la .workflow/scratch/ 2>$null | head -10 # 最近 artifact (mtime DESC)
|
|
99
|
+
ls -la .workflow/.maestro/ 2>$null | head -5 # 进行中的 session
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
**项目状态 → lifecycle_position → 自然下一步:**
|
|
103
|
+
|
|
104
|
+
| 项目状态 | lifecycle_position | 自然下一步 |
|
|
105
|
+
|---------|-------------------|-----------|
|
|
106
|
+
| 无 `.workflow/` + 无源码 | brainstorm | `maestro-brainstorm` |
|
|
107
|
+
| 无 `.workflow/` + 有源码 | init | `maestro-init` |
|
|
108
|
+
| 有 state.json,无 roadmap,无 milestones | analyze-macro | `maestro-analyze` (宏观调研) |
|
|
109
|
+
| 有 macro analyze artifact,无 roadmap | roadmap | `maestro-roadmap` |
|
|
110
|
+
| 有 roadmap,未启动 phase | analyze | `maestro-analyze {phase}` |
|
|
111
|
+
| 最新 artifact = analyze | plan | `maestro-plan {phase}` |
|
|
112
|
+
| 最新 artifact = plan | execute | `maestro-execute {phase}` |
|
|
113
|
+
| 最新 artifact = execute | verify | `maestro-verify {phase}` |
|
|
114
|
+
| verify passed | review | `quality-review {phase}` |
|
|
115
|
+
| review verdict=PASS | test-gen | `quality-auto-test {phase}` |
|
|
116
|
+
| 测试全绿 | milestone-audit | `maestro-milestone-audit` |
|
|
117
|
+
| 当前 milestone 全 phase 完成 | milestone-complete | `maestro-milestone-complete` |
|
|
118
|
+
| 任一 stage 产物含 gaps/failed | debug | `quality-debug {gap}` |
|
|
119
|
+
|
|
120
|
+
**Maestro Lifecycle 主线:**
|
|
77
121
|
```
|
|
78
122
|
brainstorm → blueprint → init → analyze-macro → roadmap
|
|
79
123
|
→ [per phase] analyze → plan → execute → verify
|
|
@@ -81,41 +125,28 @@ brainstorm → blueprint → init → analyze-macro → roadmap
|
|
|
81
125
|
→ milestone-audit → milestone-complete → milestone-release
|
|
82
126
|
```
|
|
83
127
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
| Workflow 簇 | 触发场景 | 主推命令 |
|
|
87
|
-
|-------------|---------|---------|
|
|
88
|
-
| Learning | 接触新代码/未知模块 | `learn-follow` → `learn-decompose` → `learn-second-opinion` |
|
|
89
|
-
| Knowledge | 提炼经验 / 沉淀知识 | `manage-harvest` → `manage-knowhow-capture` → `spec-add` |
|
|
90
|
-
| Wiki 维护 | 知识图谱整理 | `manage-wiki` → `wiki-connect` → `wiki-digest` |
|
|
91
|
-
| Issue 治理 | 缺陷管理 | `manage-issue-discover` → `manage-issue` |
|
|
92
|
-
| 文档同步 | 代码大改后 | `quality-sync` → `manage-codebase-refresh` |
|
|
93
|
-
| 重构 | 技术债积累 | `quality-refactor` → `quality-review` |
|
|
94
|
-
| 发布 | 里程碑结束 | `maestro-milestone-audit` → `maestro-milestone-release` |
|
|
95
|
-
| 并行开发 | 多 milestone 并行 | `maestro-fork` → ... → `maestro-merge` |
|
|
96
|
-
|
|
97
|
-
### Step 2.5: Semantic Match & Rank
|
|
128
|
+
### A_SCORE_CANDIDATES
|
|
98
129
|
|
|
99
|
-
|
|
130
|
+
**评分信号**(高→低):
|
|
100
131
|
|
|
101
132
|
| 信号 | 权重 | 说明 |
|
|
102
133
|
|------|------|------|
|
|
103
|
-
| intent
|
|
104
|
-
| **
|
|
105
|
-
| `name` 关键词命中 intent | 中 |
|
|
106
|
-
| Workflow 簇匹配 | 中 | intent 涉及学习/知识/issue
|
|
107
|
-
| Recent activity 反向避免 | 低 | 刚完成的 stage
|
|
134
|
+
| intent 命中路由表关键词 | 高 | 字面匹配主依据 |
|
|
135
|
+
| **lifecycle 自然下一步** | **高** | 空 intent / "继续" / "next" 时为决定性 |
|
|
136
|
+
| `name` 关键词命中 intent | 中 | intent 含 "test" → quality-test/quality-auto-test 加分 |
|
|
137
|
+
| Workflow 簇匹配 | 中 | intent 涉及学习/知识/issue 等场景触发对应簇 |
|
|
138
|
+
| Recent activity 反向避免 | 低 | 刚完成的 stage 短期内降权 |
|
|
108
139
|
|
|
109
140
|
**特殊意图处理:**
|
|
110
141
|
|
|
111
|
-
| Intent 模式 |
|
|
112
|
-
|
|
113
|
-
| 空 / "继续" / "下一步" / "next" / "
|
|
114
|
-
| "什么状态" / "现在到哪了" / "status" |
|
|
115
|
-
|
|
|
116
|
-
| 无任何匹配 |
|
|
142
|
+
| Intent 模式 | top pick |
|
|
143
|
+
|------------|---------|
|
|
144
|
+
| 空 / "继续" / "下一步" / "next" / "接下来" | lifecycle 自然下一步 |
|
|
145
|
+
| "什么状态" / "现在到哪了" / "status" | `manage-status` |
|
|
146
|
+
| 字面命中路由表 | 路由表优先(lifecycle 仅加分) |
|
|
147
|
+
| 无任何匹配 | lifecycle 下一步 + raise W002 |
|
|
117
148
|
|
|
118
|
-
**意图 →
|
|
149
|
+
**意图 → 命令路由表**(候选池):
|
|
119
150
|
|
|
120
151
|
| 意图关键词 | 推荐命令 |
|
|
121
152
|
|-----------|---------|
|
|
@@ -146,70 +177,74 @@ brainstorm → blueprint → init → analyze-macro → roadmap
|
|
|
146
177
|
| fork / 分支 / 并行开发 | `maestro-fork` / `maestro-merge` |
|
|
147
178
|
| 覆盖层 / overlay / amend | `maestro-overlay` / `maestro-amend` |
|
|
148
179
|
|
|
180
|
+
**辅助 workflow 簇**(场景触发,非主线):
|
|
181
|
+
|
|
182
|
+
| 簇 | 触发 | 主推链路 |
|
|
183
|
+
|----|------|---------|
|
|
184
|
+
| Learning | 接触新代码/未知模块 | `learn-follow` → `learn-decompose` → `learn-second-opinion` |
|
|
185
|
+
| Knowledge | 提炼经验 / 沉淀知识 | `manage-harvest` → `manage-knowhow-capture` → `spec-add` |
|
|
186
|
+
| Wiki | 知识图谱整理 | `manage-wiki` → `wiki-connect` → `wiki-digest` |
|
|
187
|
+
| Issue | 缺陷管理 | `manage-issue-discover` → `manage-issue` |
|
|
188
|
+
| 文档同步 | 代码大改后 | `quality-sync` → `manage-codebase-refresh` |
|
|
189
|
+
| 重构 | 技术债积累 | `quality-refactor` → `quality-review` |
|
|
190
|
+
| 发布 | 里程碑结束 | `maestro-milestone-audit` → `maestro-milestone-release` |
|
|
191
|
+
| 并行开发 | 多 milestone 并行 | `maestro-fork` → ... → `maestro-merge` |
|
|
192
|
+
|
|
149
193
|
输出 ranked candidates,取 top N(默认 3)。
|
|
150
194
|
|
|
151
|
-
|
|
195
|
+
</actions>
|
|
196
|
+
|
|
197
|
+
</state_machine>
|
|
198
|
+
|
|
199
|
+
<presentation>
|
|
152
200
|
|
|
153
|
-
|
|
201
|
+
### `--list` 模式
|
|
154
202
|
|
|
155
|
-
|
|
203
|
+
按 workflow 簇(主线 / Learning / Knowledge / Wiki / Issue / 文档 / 重构 / 发布 / 并行)分组展示全部候选 + description,结束。
|
|
204
|
+
|
|
205
|
+
### 正常模式
|
|
156
206
|
|
|
157
|
-
显示:
|
|
158
207
|
```
|
|
159
208
|
🎯 推荐 (top pick): /<command-name>
|
|
160
209
|
<description>
|
|
161
|
-
推荐理由:
|
|
210
|
+
推荐理由: <命中规则 + lifecycle 位置一句话>
|
|
162
211
|
|
|
163
212
|
备选:
|
|
164
213
|
2. /<alt-1> — <description>
|
|
165
214
|
3. /<alt-2> — <description>
|
|
166
215
|
|
|
167
|
-
执行参数: <args
|
|
216
|
+
执行参数: <args>
|
|
168
217
|
```
|
|
169
218
|
|
|
170
|
-
|
|
171
|
-
- `-y` → 直接执行 top pick
|
|
172
|
-
- 否则 → `ask_question` 让用户:执行 top pick / 选备选 / 修改参数 / 取消
|
|
173
|
-
|
|
174
|
-
### Step 4: Execute
|
|
175
|
-
|
|
176
|
-
通过 `view_file(AbsolutePath="<agy-skills-dir>/<chosen-command-name>/SKILL.md") + execute inline (args: "<args>")` 执行。
|
|
219
|
+
`--dry-run` 展示后结束;`-y` 直接 S_EXECUTE;否则 ask_question 提供:执行 top pick / 选备选 / 修改参数 / 取消。
|
|
177
220
|
|
|
178
|
-
|
|
179
|
-
- 默认把 intent 原文作为第一个参数传给目标命令
|
|
180
|
-
- 若用户在 Step 3 修改了参数,使用修改后的版本
|
|
181
|
-
- `-y` flag 透传给目标命令(如果目标命令支持)
|
|
221
|
+
</presentation>
|
|
182
222
|
|
|
183
|
-
|
|
184
|
-
```
|
|
185
|
-
✅ 已执行 /<command-name>
|
|
186
|
-
```
|
|
223
|
+
<appendix>
|
|
187
224
|
|
|
188
|
-
|
|
225
|
+
### Error Codes
|
|
189
226
|
|
|
190
|
-
</execution>
|
|
191
|
-
|
|
192
|
-
<error_codes>
|
|
193
227
|
| Code | Severity | Condition | Recovery |
|
|
194
228
|
|------|----------|-----------|----------|
|
|
195
|
-
| E001 | error |
|
|
196
|
-
| E002 | error |
|
|
197
|
-
| E003 | error |
|
|
198
|
-
| W001 | warning |
|
|
199
|
-
| W002 | warning | intent 与所有候选匹配度均低 |
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
229
|
+
| E001 | error | intent 空且 clarification 后仍空 | 提供意图描述或使用 `--list` 浏览 |
|
|
230
|
+
| E002 | error | 候选池为空(`.claude/commands/` 缺失或无 .md) | 检查 commands 目录 |
|
|
231
|
+
| E003 | error | 选定命令名无法解析为有效 skill | 列出有效命令重选 |
|
|
232
|
+
| W001 | warning | top1 与 top2 得分差距 < 阈值 | 强制展示前 3 让用户裁决 |
|
|
233
|
+
| W002 | warning | intent 与所有候选匹配度均低 | 提示考虑 `/maestro` 或 `/maestro-ralph` 走管线 |
|
|
234
|
+
|
|
235
|
+
### Success Criteria
|
|
236
|
+
|
|
203
237
|
- [ ] Intent 解析 + flags 提取完成
|
|
204
238
|
- [ ] 读取 `.workflow/state.json` + scratch artifacts 推断 lifecycle_position
|
|
205
|
-
- [ ]
|
|
206
|
-
- [ ] 评分综合:intent 字面匹配 + lifecycle
|
|
239
|
+
- [ ] 候选池等于路由表(管线编排器不在)
|
|
240
|
+
- [ ] 评分综合:intent 字面匹配 + lifecycle 下一步 + workflow 簇 + recent activity
|
|
207
241
|
- [ ] 空 intent / "继续" / "下一步" → 直接采用 lifecycle 推断的下一步
|
|
208
|
-
- [ ] top pick
|
|
242
|
+
- [ ] top pick 展示附"推荐理由"(命中规则 + lifecycle 位置)
|
|
209
243
|
- [ ] `--dry-run` 仅展示,不执行
|
|
210
|
-
- [ ] `-y` 自动执行 top pick
|
|
211
|
-
- [ ]
|
|
212
|
-
- [ ]
|
|
213
|
-
- [ ] 不创建 session
|
|
214
|
-
- [ ] `--list` 模式按 workflow
|
|
215
|
-
|
|
244
|
+
- [ ] `-y` 自动执行 top pick;用户传入时透传到 skill args
|
|
245
|
+
- [ ] 非自动模式通过 ask_question 确认或选备选
|
|
246
|
+
- [ ] 选定命令通过单次 `Skill()` 调用执行
|
|
247
|
+
- [ ] 不创建 session / 不生成 status.json / 不触发后续 chain
|
|
248
|
+
- [ ] `--list` 模式按 workflow 簇分组展示
|
|
249
|
+
|
|
250
|
+
</appendix>
|
|
@@ -0,0 +1,176 @@
|
|
|
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:
|
|
5
|
+
- ask_question
|
|
6
|
+
- define_subagent
|
|
7
|
+
- grep_search
|
|
8
|
+
- invoke_subagent
|
|
9
|
+
- manage_subagents
|
|
10
|
+
- replace_file_content
|
|
11
|
+
- run_command
|
|
12
|
+
- send_message
|
|
13
|
+
- view_file
|
|
14
|
+
- write_to_file
|
|
15
|
+
agy-subagents:
|
|
16
|
+
- team-worker
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## Sub-Agent Registration (Antigravity)
|
|
20
|
+
|
|
21
|
+
Before any `invoke_subagent` call below, register each sub-agent type once per session by reading the system_prompt from `<agy-agents-dir>/<name>.md` and passing it to `define_subagent`. The `<agy-agents-dir>` is:
|
|
22
|
+
- global install: `~/.gemini/antigravity-cli/agents/`
|
|
23
|
+
- workspace install: `<project>/.agents/agents/`
|
|
24
|
+
|
|
25
|
+
- `define_subagent(name="team-worker", description="<from agents/team-worker.md frontmatter>", system_prompt=<contents of agents/team-worker.md body>, enable_write_tools=true, enable_mcp_tools=true, enable_subagent_tools=false)`
|
|
26
|
+
|
|
27
|
+
**ConversationId tracking**: `invoke_subagent` returns a ConversationId per spawned instance. Subsequent `send_message(Recipient=<ConversationId>, Message=...)` calls require that ConversationId — never use the role name as the recipient.
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
# Team Swarm
|
|
32
|
+
|
|
33
|
+
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`.
|
|
34
|
+
|
|
35
|
+
## Architecture
|
|
36
|
+
|
|
37
|
+
```
|
|
38
|
+
view_file(AbsolutePath="<agy-skills-dir>/team-swarm/SKILL.md") + execute inline (args: "task description")
|
|
39
|
+
|
|
|
40
|
+
SKILL.md (this file) = Router
|
|
41
|
+
|
|
|
42
|
+
+--------------+--------------+
|
|
43
|
+
| |
|
|
44
|
+
no --role flag --role <name>
|
|
45
|
+
| |
|
|
46
|
+
Coordinator Worker
|
|
47
|
+
roles/coordinator/role.md roles/<name>/role.md
|
|
48
|
+
|
|
|
49
|
+
+-- Phase 1: gen swarm-config
|
|
50
|
+
+-- Phase 2: init --> Bash: scripts/aco.py init
|
|
51
|
+
+-- Phase 3: iterate (K rounds, each = spawn-and-stop)
|
|
52
|
+
| |
|
|
53
|
+
| +-- Bash: aco.py select --iter k -> N assignments
|
|
54
|
+
| +-- Spawn N x team-worker(ant)
|
|
55
|
+
| +-- [callback when all ants done]
|
|
56
|
+
| +-- (optional) Spawn team-worker(scorer)
|
|
57
|
+
| +-- Bash: aco.py update --iter k
|
|
58
|
+
| +-- Bash: aco.py converged
|
|
59
|
+
| +-- branch: loop k+1 OR Phase 4
|
|
60
|
+
|
|
|
61
|
+
+-- Phase 4: converge --> Bash: aco.py report -> Spawn team-worker(analyst)
|
|
62
|
+
-> best-solution.md
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## Role Registry
|
|
66
|
+
|
|
67
|
+
| Role | Path | Prefix | Inner Loop |
|
|
68
|
+
|------|------|--------|------------|
|
|
69
|
+
| coordinator | [roles/coordinator/role.md](roles/coordinator/role.md) | — | — |
|
|
70
|
+
| ant | [roles/ant/role.md](roles/ant/role.md) | ANT-* | false |
|
|
71
|
+
| scorer | [roles/scorer/role.md](roles/scorer/role.md) | SCORE-* | false |
|
|
72
|
+
| analyst | [roles/analyst/role.md](roles/analyst/role.md) | ANALYST-* | false |
|
|
73
|
+
|
|
74
|
+
## Role Router
|
|
75
|
+
|
|
76
|
+
Parse `$ARGUMENTS`:
|
|
77
|
+
- Has `--role <name>` -> Read `roles/<name>/role.md`, execute Phase 2-4
|
|
78
|
+
- No `--role` -> `@roles/coordinator/role.md`, execute entry router
|
|
79
|
+
|
|
80
|
+
## Shared Constants
|
|
81
|
+
|
|
82
|
+
- **Session prefix**: `TS`
|
|
83
|
+
- **Session path**: `.workflow/.team/TS-<slug>-<date>/`
|
|
84
|
+
- **Team name**: `swarm`
|
|
85
|
+
- **Script root**: `<skill_root>/scripts/aco.py` (Python 3.10+)
|
|
86
|
+
- **Message bus**: `mcp__ccw-tools__team_msg(session_id=<session-id>, ...)`
|
|
87
|
+
|
|
88
|
+
## Worker Spawn Template
|
|
89
|
+
|
|
90
|
+
Coordinator spawns workers using this template:
|
|
91
|
+
|
|
92
|
+
```
|
|
93
|
+
invoke_subagent([{ TypeName: "team-worker", Role: "<role>", Prompt: "<Prompt>", Workspace: "inherit" }])
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
## User Commands
|
|
97
|
+
|
|
98
|
+
| Command | Action |
|
|
99
|
+
|---------|--------|
|
|
100
|
+
| `check` / `status` | View iteration progress + convergence curve |
|
|
101
|
+
| `resume` / `continue` | Resume interrupted iteration |
|
|
102
|
+
| `feedback <text>` | Inject feedback into wisdom; applies at next iteration |
|
|
103
|
+
| `revise <ITER>` | Re-run a specific iteration (rare) |
|
|
104
|
+
|
|
105
|
+
## Specs Reference
|
|
106
|
+
|
|
107
|
+
| Spec | Purpose |
|
|
108
|
+
|------|---------|
|
|
109
|
+
| [specs/swarm-protocol.md](specs/swarm-protocol.md) | Master protocol: script <-> coordinator interface, data flow |
|
|
110
|
+
| [specs/pheromone-schema.md](specs/pheromone-schema.md) | Pheromone JSON structure, update formula, evaporation |
|
|
111
|
+
| [specs/ant-output-schema.md](specs/ant-output-schema.md) | Critical contract for ant JSON artifacts |
|
|
112
|
+
| [specs/convergence-criteria.md](specs/convergence-criteria.md) | Stop conditions, multi-criterion logic |
|
|
113
|
+
| [specs/swarm-config-template.json](specs/swarm-config-template.json) | User-facing config template with all knobs |
|
|
114
|
+
|
|
115
|
+
## Scripts
|
|
116
|
+
|
|
117
|
+
| Script | Purpose | Invocation |
|
|
118
|
+
|--------|---------|------------|
|
|
119
|
+
| `scripts/aco.py` | Main CLI: init / select / update / converged / report | `python aco.py --session <path> <cmd>` |
|
|
120
|
+
| `scripts/pheromone.py` | Pheromone matrix module (imported by aco.py) | — |
|
|
121
|
+
| `scripts/scoring.py` | Pluggable scorer (script + fallback modes) | — |
|
|
122
|
+
|
|
123
|
+
## Session Directory
|
|
124
|
+
|
|
125
|
+
```
|
|
126
|
+
.workflow/.team/TS-<slug>-<date>/
|
|
127
|
+
├── team-session.json # Session state
|
|
128
|
+
├── swarm-config.json # User-facing config (Phase 1 output)
|
|
129
|
+
├── role-binding.json # Worker role_spec path map
|
|
130
|
+
├── task-space.json # Resolved nodes list
|
|
131
|
+
├── pheromone/
|
|
132
|
+
│ ├── current.json # Latest pheromone (each iter overwrites)
|
|
133
|
+
│ ├── init.json # Frozen initial state
|
|
134
|
+
│ └── history/<iter>.json # Per-iter snapshot
|
|
135
|
+
├── trails/<iter>.jsonl # Per-iter all-ant paths + scores
|
|
136
|
+
├── scores/iter-<iter>-scores.json # Scorer output (if mode == llm)
|
|
137
|
+
├── artifacts/
|
|
138
|
+
│ ├── ant-<iter>-<id>.json # Per-ant schema-locked output
|
|
139
|
+
│ ├── swarm-report.json # Phase 4 full report dump
|
|
140
|
+
│ └── best-solution.md # Analyst final synthesis
|
|
141
|
+
├── best.json # Canonical best solution
|
|
142
|
+
├── wisdom/ # learnings / decisions / issues
|
|
143
|
+
└── .msg/ # Message bus
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
## Completion Action
|
|
147
|
+
|
|
148
|
+
When swarm converges, coordinator presents:
|
|
149
|
+
|
|
150
|
+
```
|
|
151
|
+
ask_question({
|
|
152
|
+
questions: [{
|
|
153
|
+
question: "Swarm pipeline complete. What would you like to do?",
|
|
154
|
+
header: "Completion",
|
|
155
|
+
multiSelect: false,
|
|
156
|
+
options: [
|
|
157
|
+
{ label: "Archive & Clean (Recommended)", description: "Archive session, delete team" },
|
|
158
|
+
{ label: "Keep Active", description: "Preserve for follow-up" },
|
|
159
|
+
{ label: "Export Best Solution", description: "Copy best-solution.md to target" },
|
|
160
|
+
{ label: "Run Another Round", description: "Reset convergence, K more iterations" }
|
|
161
|
+
]
|
|
162
|
+
}]
|
|
163
|
+
})
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
## Error Handling
|
|
167
|
+
|
|
168
|
+
| Scenario | Resolution |
|
|
169
|
+
|----------|------------|
|
|
170
|
+
| `aco.py` not found | Verify `<skill_root>/scripts/aco.py`; check Python install |
|
|
171
|
+
| Python version < 3.10 | Use `python3` or report dependency error |
|
|
172
|
+
| Config validation fails | ask_question to fix, regenerate, retry |
|
|
173
|
+
| All ants fail in iteration | Halt, ask_question (retry / abort / refine config) |
|
|
174
|
+
| Hallucination cluster (>50%) | Pause, ask_question (continue / refine scoring) |
|
|
175
|
+
| Convergence never trips | `max_iterations` safety net always fires |
|
|
176
|
+
| Session corruption | Phase 0 reconciliation; archive if irrecoverable |
|