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.
- package/.agents/skills/maestro/SKILL.md +1 -1
- package/.agents/skills/maestro-analyze/SKILL.md +5 -0
- package/.agents/skills/maestro-blueprint/SKILL.md +5 -0
- package/.agents/skills/maestro-brainstorm/SKILL.md +5 -0
- package/.agents/skills/maestro-next/SKILL.md +254 -0
- 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/SKILL.md +1 -1
- package/.agy/skills/maestro-analyze/SKILL.md +5 -0
- package/.agy/skills/maestro-blueprint/SKILL.md +5 -0
- package/.agy/skills/maestro-brainstorm/SKILL.md +5 -0
- package/.agy/skills/maestro-next/SKILL.md +250 -0
- 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-analyze.md +5 -0
- package/.claude/commands/maestro-blueprint.md +5 -0
- package/.claude/commands/maestro-brainstorm.md +5 -0
- package/.claude/commands/maestro-next.md +252 -0
- package/.claude/commands/maestro.md +1 -1
- 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/learn-decompose/SKILL.md +34 -3
- package/.codex/skills/learn-retro/SKILL.md +31 -1
- package/.codex/skills/learn-second-opinion/SKILL.md +34 -4
- package/.codex/skills/maestro-analyze/SKILL.md +44 -5
- package/.codex/skills/maestro-blueprint/SKILL.md +5 -0
- package/.codex/skills/maestro-brainstorm/SKILL.md +46 -0
- package/.codex/skills/maestro-execute/SKILL.md +61 -5
- package/.codex/skills/maestro-milestone-audit/SKILL.md +64 -13
- package/.codex/skills/maestro-milestone-complete/SKILL.md +12 -0
- package/.codex/skills/maestro-next/SKILL.md +297 -0
- package/.codex/skills/maestro-plan/SKILL.md +36 -1
- package/.codex/skills/maestro-player/SKILL.md +25 -6
- package/.codex/skills/maestro-ralph/SKILL.md +17 -10
- package/.codex/skills/maestro-ralph-execute/SKILL.md +2 -1
- package/.codex/skills/maestro-roadmap/SKILL.md +35 -4
- package/.codex/skills/maestro-ui-codify/SKILL.md +38 -10
- package/.codex/skills/maestro-verify/SKILL.md +40 -5
- package/.codex/skills/manage-codebase-rebuild/SKILL.md +52 -5
- package/.codex/skills/manage-issue-discover/SKILL.md +106 -15
- package/.codex/skills/quality-auto-test/SKILL.md +70 -16
- package/.codex/skills/quality-debug/SKILL.md +139 -28
- package/.codex/skills/quality-refactor/SKILL.md +61 -11
- package/.codex/skills/quality-review/SKILL.md +45 -9
- package/.codex/skills/quality-test/SKILL.md +58 -3
- package/.codex/skills/security-audit/SKILL.md +38 -0
- package/.codex/skills/spec-map/SKILL.md +65 -8
- package/.codex/skills/team-coordinate/SKILL.md +28 -11
- package/.codex/skills/team-coordinate/specs/role-catalog.md +20 -0
- package/.codex/skills/team-lifecycle-v4/SKILL.md +23 -7
- package/.codex/skills/team-lifecycle-v4/instructions/agent-instruction.md +20 -0
- package/.codex/skills/team-quality-assurance/SKILL.md +40 -2
- package/.codex/skills/team-review/SKILL.md +42 -2
- package/.codex/skills/team-tech-debt/SKILL.md +45 -2
- package/.codex/skills/team-testing/SKILL.md +42 -2
- package/dashboard/dist-server/dashboard/src/server/wiki/search.d.ts +6 -4
- package/dashboard/dist-server/dashboard/src/server/wiki/search.js +50 -8
- package/dashboard/dist-server/dashboard/src/server/wiki/search.js.map +1 -1
- package/dashboard/dist-server/dashboard/src/server/wiki/virtual-wiki-adapters.d.ts +32 -0
- package/dashboard/dist-server/dashboard/src/server/wiki/virtual-wiki-adapters.js +294 -0
- package/dashboard/dist-server/dashboard/src/server/wiki/virtual-wiki-adapters.js.map +1 -1
- package/dashboard/dist-server/dashboard/src/server/wiki/wiki-indexer.d.ts +1 -0
- package/dashboard/dist-server/dashboard/src/server/wiki/wiki-indexer.js +35 -1
- package/dashboard/dist-server/dashboard/src/server/wiki/wiki-indexer.js.map +1 -1
- package/dashboard/dist-server/dashboard/src/server/wiki/wiki-indexer.test.js +235 -0
- package/dashboard/dist-server/dashboard/src/server/wiki/wiki-indexer.test.js.map +1 -1
- 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/ralph/cmd-check.js +1 -1
- package/dist/src/ralph/cmd-check.js.map +1 -1
- package/dist/src/ralph/cmd-complete.js +1 -1
- package/dist/src/ralph/cmd-complete.js.map +1 -1
- package/dist/src/ralph/cmd-next.d.ts.map +1 -1
- package/dist/src/ralph/cmd-next.js +12 -4
- package/dist/src/ralph/cmd-next.js.map +1 -1
- package/dist/src/ralph/cmd-session.js +2 -2
- package/dist/src/ralph/cmd-session.js.map +1 -1
- package/dist/src/ralph/status-store.d.ts +8 -1
- package/dist/src/ralph/status-store.d.ts.map +1 -1
- package/dist/src/ralph/status-store.js +12 -2
- package/dist/src/ralph/status-store.js.map +1 -1
- package/dist/src/tools/store-knowhow.d.ts.map +1 -1
- package/dist/src/tools/store-knowhow.js +51 -64
- package/dist/src/tools/store-knowhow.js.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 +23 -0
- package/dist/src/utils/update-notices.js.map +1 -1
- package/package.json +1 -1
- package/workflows/finish-work.md +119 -0
- package/workflows/milestone-complete.md +23 -1
|
@@ -0,0 +1,250 @@
|
|
|
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
|
+
- ask_question
|
|
7
|
+
- grep_search
|
|
8
|
+
- run_command
|
|
9
|
+
- view_file
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
<purpose>
|
|
13
|
+
单链推荐:解析 intent + project state → 路由表评分 → 推荐**单个原子命令** → 确认后通过 `Skill()` 执行。
|
|
14
|
+
|
|
15
|
+
与 `/maestro` / `/maestro-ralph` 区别:
|
|
16
|
+
- 不创建 session、不构建 chain、不写 status.json
|
|
17
|
+
- 始终只推 1 个 top pick,最多列 2-3 个备选
|
|
18
|
+
- 适用场景:意图清晰且单步即可完成;或需要定向推荐时
|
|
19
|
+
</purpose>
|
|
20
|
+
|
|
21
|
+
<context>
|
|
22
|
+
$ARGUMENTS — 意图文本 + 可选 flags。
|
|
23
|
+
|
|
24
|
+
**Flags:**
|
|
25
|
+
- `-y` / `--yes` — 跳过确认,直接执行 top pick
|
|
26
|
+
- `--dry-run` — 仅显示推荐结果,不执行
|
|
27
|
+
- `--top N` — 显示前 N 个候选(默认 3)
|
|
28
|
+
- `--list` — 仅列出可推荐命令池,不做推荐
|
|
29
|
+
|
|
30
|
+
**候选池:** 仅 A_SCORE_CANDIDATES 路由表中列出的命令。管线编排器(`maestro` / `maestro-ralph*` / `maestro-player` / `maestro-composer`)**永远不在候选池**。
|
|
31
|
+
</context>
|
|
32
|
+
|
|
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>
|
|
41
|
+
|
|
42
|
+
<state_machine>
|
|
43
|
+
|
|
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>
|
|
54
|
+
|
|
55
|
+
<transitions>
|
|
56
|
+
|
|
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
|
|
63
|
+
|
|
64
|
+
S_STATE:
|
|
65
|
+
→ S_RANK DO: A_INFER_LIFECYCLE
|
|
66
|
+
|
|
67
|
+
S_RANK:
|
|
68
|
+
→ S_PRESENT DO: A_SCORE_CANDIDATES
|
|
69
|
+
|
|
70
|
+
S_LIST:
|
|
71
|
+
→ END DO: 按 workflow 簇分组列出全部候选 + description
|
|
72
|
+
|
|
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
|
|
87
|
+
|
|
88
|
+
</transitions>
|
|
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 主线:**
|
|
121
|
+
```
|
|
122
|
+
brainstorm → blueprint → init → analyze-macro → roadmap
|
|
123
|
+
→ [per phase] analyze → plan → execute → verify
|
|
124
|
+
→ [quality gate] review → auto-test → test
|
|
125
|
+
→ milestone-audit → milestone-complete → milestone-release
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
### A_SCORE_CANDIDATES
|
|
129
|
+
|
|
130
|
+
**评分信号**(高→低):
|
|
131
|
+
|
|
132
|
+
| 信号 | 权重 | 说明 |
|
|
133
|
+
|------|------|------|
|
|
134
|
+
| intent 命中路由表关键词 | 高 | 字面匹配主依据 |
|
|
135
|
+
| **lifecycle 自然下一步** | **高** | 空 intent / "继续" / "next" 时为决定性 |
|
|
136
|
+
| `name` 关键词命中 intent | 中 | intent 含 "test" → quality-test/quality-auto-test 加分 |
|
|
137
|
+
| Workflow 簇匹配 | 中 | intent 涉及学习/知识/issue 等场景触发对应簇 |
|
|
138
|
+
| Recent activity 反向避免 | 低 | 刚完成的 stage 短期内降权 |
|
|
139
|
+
|
|
140
|
+
**特殊意图处理:**
|
|
141
|
+
|
|
142
|
+
| Intent 模式 | top pick |
|
|
143
|
+
|------------|---------|
|
|
144
|
+
| 空 / "继续" / "下一步" / "next" / "接下来" | lifecycle 自然下一步 |
|
|
145
|
+
| "什么状态" / "现在到哪了" / "status" | `manage-status` |
|
|
146
|
+
| 字面命中路由表 | 路由表优先(lifecycle 仅加分) |
|
|
147
|
+
| 无任何匹配 | lifecycle 下一步 + raise W002 |
|
|
148
|
+
|
|
149
|
+
**意图 → 命令路由表**(候选池):
|
|
150
|
+
|
|
151
|
+
| 意图关键词 | 推荐命令 |
|
|
152
|
+
|-----------|---------|
|
|
153
|
+
| 头脑风暴 / 探索 / brainstorm / ideate | `maestro-brainstorm` |
|
|
154
|
+
| 规格 / 正式文档 / spec-generate / blueprint | `maestro-blueprint` |
|
|
155
|
+
| 分析 / analyze / 多维度调研 | `maestro-analyze` |
|
|
156
|
+
| 规划 / plan / 任务分解 | `maestro-plan` |
|
|
157
|
+
| 实现 / 执行 / execute | `maestro-execute` |
|
|
158
|
+
| 验证 / verify / 验收 | `maestro-verify` |
|
|
159
|
+
| 调试 / debug / 排查 / bug | `quality-debug` |
|
|
160
|
+
| 审查 / review / 代码审查 | `quality-review` |
|
|
161
|
+
| 测试 / test / UAT | `quality-test` / `quality-auto-test` |
|
|
162
|
+
| 重构 / refactor / 技术债 | `quality-refactor` |
|
|
163
|
+
| 同步文档 / sync docs | `quality-sync` |
|
|
164
|
+
| 回顾 / retro | `quality-retrospective` / `learn-retro` |
|
|
165
|
+
| issue / 缺陷管理 | `manage-issue` / `manage-issue-discover` |
|
|
166
|
+
| wiki / 知识图谱 | `manage-wiki` / `wiki-connect` / `wiki-digest` |
|
|
167
|
+
| spec / 规则 / 约束 | `spec-load` / `spec-add` / `spec-setup` |
|
|
168
|
+
| 项目初始化 / init | `maestro-init` |
|
|
169
|
+
| 状态 / status / 仪表盘 | `manage-status` |
|
|
170
|
+
| 文档重建 / codebase 文档 | `manage-codebase-rebuild` / `manage-codebase-refresh` |
|
|
171
|
+
| 安全 / security / OWASP | `security-audit` |
|
|
172
|
+
| 跟读 / 学习 / 阅读源码 | `learn-follow` / `learn-investigate` |
|
|
173
|
+
| 第二意见 / challenge / consult | `learn-second-opinion` |
|
|
174
|
+
| 提取知识 / harvest | `manage-harvest` / `manage-knowhow-capture` |
|
|
175
|
+
| 设计 / UI / 前端打磨 | `maestro-impeccable` |
|
|
176
|
+
| 里程碑 / milestone | `maestro-milestone-audit` / `maestro-milestone-release` / `maestro-milestone-complete` |
|
|
177
|
+
| fork / 分支 / 并行开发 | `maestro-fork` / `maestro-merge` |
|
|
178
|
+
| 覆盖层 / overlay / amend | `maestro-overlay` / `maestro-amend` |
|
|
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
|
+
|
|
193
|
+
输出 ranked candidates,取 top N(默认 3)。
|
|
194
|
+
|
|
195
|
+
</actions>
|
|
196
|
+
|
|
197
|
+
</state_machine>
|
|
198
|
+
|
|
199
|
+
<presentation>
|
|
200
|
+
|
|
201
|
+
### `--list` 模式
|
|
202
|
+
|
|
203
|
+
按 workflow 簇(主线 / Learning / Knowledge / Wiki / Issue / 文档 / 重构 / 发布 / 并行)分组展示全部候选 + description,结束。
|
|
204
|
+
|
|
205
|
+
### 正常模式
|
|
206
|
+
|
|
207
|
+
```
|
|
208
|
+
🎯 推荐 (top pick): /<command-name>
|
|
209
|
+
<description>
|
|
210
|
+
推荐理由: <命中规则 + lifecycle 位置一句话>
|
|
211
|
+
|
|
212
|
+
备选:
|
|
213
|
+
2. /<alt-1> — <description>
|
|
214
|
+
3. /<alt-2> — <description>
|
|
215
|
+
|
|
216
|
+
执行参数: <args>
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
`--dry-run` 展示后结束;`-y` 直接 S_EXECUTE;否则 ask_question 提供:执行 top pick / 选备选 / 修改参数 / 取消。
|
|
220
|
+
|
|
221
|
+
</presentation>
|
|
222
|
+
|
|
223
|
+
<appendix>
|
|
224
|
+
|
|
225
|
+
### Error Codes
|
|
226
|
+
|
|
227
|
+
| Code | Severity | Condition | Recovery |
|
|
228
|
+
|------|----------|-----------|----------|
|
|
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
|
+
|
|
237
|
+
- [ ] Intent 解析 + flags 提取完成
|
|
238
|
+
- [ ] 读取 `.workflow/state.json` + scratch artifacts 推断 lifecycle_position
|
|
239
|
+
- [ ] 候选池等于路由表(管线编排器不在)
|
|
240
|
+
- [ ] 评分综合:intent 字面匹配 + lifecycle 下一步 + workflow 簇 + recent activity
|
|
241
|
+
- [ ] 空 intent / "继续" / "下一步" → 直接采用 lifecycle 推断的下一步
|
|
242
|
+
- [ ] top pick 展示附"推荐理由"(命中规则 + lifecycle 位置)
|
|
243
|
+
- [ ] `--dry-run` 仅展示,不执行
|
|
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 |
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
---
|
|
2
|
+
role: analyst
|
|
3
|
+
prefix: ANALYST
|
|
4
|
+
inner_loop: false
|
|
5
|
+
output_tag: [analyst]
|
|
6
|
+
message_types:
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Analyst Role — Phase 2-4
|
|
10
|
+
|
|
11
|
+
Tag: `[analyst]` | Prefix: `ANALYST-*`
|
|
12
|
+
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.
|
|
13
|
+
|
|
14
|
+
## Boundaries
|
|
15
|
+
|
|
16
|
+
### MUST
|
|
17
|
+
- Read `<session>/best.json`, `<session>/artifacts/swarm-report.json`, all `<session>/trails/*.jsonl`
|
|
18
|
+
- Produce `<session>/artifacts/best-solution.md` as the final deliverable
|
|
19
|
+
- Explain WHY the best path won (which decisions mattered, evidence chain)
|
|
20
|
+
- Compare best vs runner-ups to surface stability vs luck
|
|
21
|
+
- Document convergence story (entropy curve, when stagnation hit)
|
|
22
|
+
|
|
23
|
+
### MUST NOT
|
|
24
|
+
- Re-score solutions (that is scorer's job — analyst takes verified_score as given)
|
|
25
|
+
- Modify best.json, trails, or pheromone state
|
|
26
|
+
- Generate solutions of its own — analyst synthesizes existing ant outputs
|
|
27
|
+
- Exceed ~150 lines in best-solution.md (be sharp, not verbose)
|
|
28
|
+
|
|
29
|
+
## Phase 2: Context Loading
|
|
30
|
+
|
|
31
|
+
| Input | Source | Required |
|
|
32
|
+
|-------|--------|----------|
|
|
33
|
+
| Original objective | `<session>/swarm-config.json#ant_prompt.objective` | Yes |
|
|
34
|
+
| Best solution | `<session>/best.json` | Yes |
|
|
35
|
+
| Full swarm report | `<session>/artifacts/swarm-report.json` | Yes |
|
|
36
|
+
| All trails | `<session>/trails/*.jsonl` | Yes |
|
|
37
|
+
| Convergence reason | swarm-report.json or `aco.py converged` output | Yes |
|
|
38
|
+
| Best ant artifact | `<session>/artifacts/ant-<best.iteration>-<best.id>.json` (full evidence) | Yes |
|
|
39
|
+
| Issues log | `<session>/wisdom/issues.md` | Optional |
|
|
40
|
+
|
|
41
|
+
Workflow:
|
|
42
|
+
1. Extract session path from task description
|
|
43
|
+
2. Read swarm-config.json -> capture objective
|
|
44
|
+
3. Read best.json -> identify best ant
|
|
45
|
+
4. Read full swarm-report.json -> get top_k + convergence_curve
|
|
46
|
+
5. Read the best ant's full artifact for evidence chain
|
|
47
|
+
6. Read all trails/*.jsonl into a list (chronological)
|
|
48
|
+
|
|
49
|
+
## Phase 3: Synthesis
|
|
50
|
+
|
|
51
|
+
### 3.1 Structure the report
|
|
52
|
+
|
|
53
|
+
Layout for `best-solution.md`:
|
|
54
|
+
|
|
55
|
+
```markdown
|
|
56
|
+
# Swarm Result — <objective_short_form>
|
|
57
|
+
|
|
58
|
+
## Best Solution
|
|
59
|
+
|
|
60
|
+
**Path**: node_a → node_c → node_f
|
|
61
|
+
**Verified Score**: 0.82
|
|
62
|
+
**Iteration**: 3 of 5
|
|
63
|
+
**Ant**: ANT-3-2
|
|
64
|
+
|
|
65
|
+
### Summary
|
|
66
|
+
<one paragraph — what the best solution proposes and why it answers the objective>
|
|
67
|
+
|
|
68
|
+
### Evidence Chain
|
|
69
|
+
- `src/foo.ts:42` — <how this evidence supports the decision>
|
|
70
|
+
- `tests/foo.spec.ts:18` — <...>
|
|
71
|
+
|
|
72
|
+
### Candidate Artifact
|
|
73
|
+
<extract from best.candidate_solution — quote or summarize, link to file if file_ref>
|
|
74
|
+
|
|
75
|
+
## Why This Path Won
|
|
76
|
+
|
|
77
|
+
| Decision | Pheromone-guided? | Why it mattered |
|
|
78
|
+
|----------|-------------------|-----------------|
|
|
79
|
+
| start = node_a | weighted | <reason> |
|
|
80
|
+
| a → c | yes (0.45 hint) | <reason> |
|
|
81
|
+
| c → f | NO (deviation) | <reason> — this was the key call |
|
|
82
|
+
|
|
83
|
+
## Runner-Up Solutions
|
|
84
|
+
|
|
85
|
+
| Rank | Ant | Path | Score | Diff from best |
|
|
86
|
+
|------|-----|------|-------|----------------|
|
|
87
|
+
| 2 | ANT-2-1 | a → b → e | 0.74 | -0.08; weaker evidence at e |
|
|
88
|
+
| 3 | ANT-4-3 | a → c → g | 0.71 | -0.11; valid but less specific |
|
|
89
|
+
|
|
90
|
+
## Convergence Story
|
|
91
|
+
|
|
92
|
+
Iterations: 4 of 5 max
|
|
93
|
+
Trigger: stagnation (best unchanged for 2 iterations)
|
|
94
|
+
|
|
95
|
+
Entropy curve:
|
|
96
|
+
- iter 1: 3.21 (broad exploration)
|
|
97
|
+
- iter 2: 2.45 (narrowing on node_a region)
|
|
98
|
+
- iter 3: 1.85 (best emerges at ANT-3-2)
|
|
99
|
+
- iter 4: 1.72 (consensus around best, no improvement)
|
|
100
|
+
|
|
101
|
+
Interpretation: <2-3 sentences on whether the swarm converged on a genuine optimum or got stuck>
|
|
102
|
+
|
|
103
|
+
## Caveats
|
|
104
|
+
|
|
105
|
+
- <e.g., 40% of ants in iter 2 flagged as hallucinations>
|
|
106
|
+
- <e.g., evidence for node_f is single-source — recommend manual verification>
|
|
107
|
+
- <e.g., search space had only N nodes — larger space may surface better solutions>
|
|
108
|
+
|
|
109
|
+
## Reproducibility
|
|
110
|
+
|
|
111
|
+
- Config: `swarm-config.json` (pinned)
|
|
112
|
+
- Best path: `best.json`
|
|
113
|
+
- Full trails: `trails/<iter>.jsonl`
|
|
114
|
+
- Random seed: <if used>
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
### 3.2 Interpretation rules
|
|
118
|
+
|
|
119
|
+
- **Why-it-won analysis** is the highest-value content. Don't just describe the path — explain which decisions were pivotal.
|
|
120
|
+
- **Pheromone vs deviation**: track which steps followed pheromone hints vs deviated. Deviations that produced higher scores are the most interesting signal.
|
|
121
|
+
- **Runner-up diff**: surface why #2 lost — was it a weaker path or just unlucky evidence?
|
|
122
|
+
- **Caveats are mandatory**: every swarm result has limitations. List them honestly.
|
|
123
|
+
|
|
124
|
+
### 3.3 Constraints
|
|
125
|
+
|
|
126
|
+
- Target ≤ 150 lines
|
|
127
|
+
- No prose padding — every section earns its place
|
|
128
|
+
- Quote evidence verbatim where possible (file:line refs)
|
|
129
|
+
- Don't editorialize beyond what evidence supports
|
|
130
|
+
|
|
131
|
+
## Phase 4: Verify + Publish
|
|
132
|
+
|
|
133
|
+
### Behavioral Traits
|
|
134
|
+
|
|
135
|
+
#### Accuracy
|
|
136
|
+
- Every cited path/score MUST match best.json or trails source
|
|
137
|
+
- Every evidence reference MUST be verifiable (Read to confirm if file_ref)
|
|
138
|
+
- Convergence curve numbers MUST match swarm-report.json#convergence_curve
|
|
139
|
+
|
|
140
|
+
#### Feedback Contract
|
|
141
|
+
| Field | Required | Content |
|
|
142
|
+
|-------|----------|---------|
|
|
143
|
+
| artifacts_written | Always | `<session>/artifacts/best-solution.md` |
|
|
144
|
+
| line_count | Always | int (target ≤ 150) |
|
|
145
|
+
| verification_method | Always | "cross_ref_with_best.json + evidence_verified" |
|
|
146
|
+
|
|
147
|
+
#### Quality Gate
|
|
148
|
+
- Final report file exists and parses as markdown
|
|
149
|
+
- All sections present (Best Solution / Why Won / Runner-Ups / Convergence / Caveats / Reproducibility)
|
|
150
|
+
- Line count ≤ 200 (hard cap — fail if exceeded, retry with sharper edit)
|
|
151
|
+
|
|
152
|
+
### Verification Steps
|
|
153
|
+
|
|
154
|
+
1. Read written best-solution.md back
|
|
155
|
+
2. Cross-check best.score against best.json
|
|
156
|
+
3. Confirm runner-up scores against trails
|
|
157
|
+
4. If file_ref evidence in best.candidate_solution -> Read to confirm file exists
|
|
158
|
+
5. Count lines — if > 200, condense and rewrite
|
|
159
|
+
|
|
160
|
+
### State Update
|
|
161
|
+
|
|
162
|
+
```json
|
|
163
|
+
{
|
|
164
|
+
"task_id": "ANALYST-1",
|
|
165
|
+
"role": "analyst",
|
|
166
|
+
"status": "completed",
|
|
167
|
+
"artifact_path": "<session>/artifacts/best-solution.md",
|
|
168
|
+
"best_score": <float>,
|
|
169
|
+
"best_ant_id": "<id>",
|
|
170
|
+
"line_count": <int>,
|
|
171
|
+
"verification": "cross_ref_pass + evidence_verified"
|
|
172
|
+
}
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
## Error Handling
|
|
176
|
+
|
|
177
|
+
| Scenario | Resolution |
|
|
178
|
+
|----------|------------|
|
|
179
|
+
| best.json missing | Pipeline produced no valid ant — write minimal report with `status: no_solution` |
|
|
180
|
+
| Trails empty | Same as above — no exploration data to analyze |
|
|
181
|
+
| Best ant artifact missing | Use only best.json fields; note as caveat |
|
|
182
|
+
| Cross-ref mismatch (score discrepancy) | Trust best.json; note discrepancy in caveats |
|
|
183
|
+
| Line count > 200 after rewrite | Hard-fail report; coordinator decides retry vs accept |
|