| name | team-swarm |
| disable-model-invocation | true |
| 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", "่็พค". |
| allowed-tools | ["Bash","Edit","Glob","Grep","Read","Write","followup_task","interrupt_agent","list_agents","mcp__maestro__team_msg","request_user_input","send_message","spawn_agent","spawn_agents_on_csv","update_plan","wait_agent"] |
| session-mode | run |
| version | 0.5.83 |
| contract | {"discovery":"self-described","consumes":[],"produces":[],"gates":{"entry":[],"exit":[]}} |
Agent timeout: spawn_agent ๅผๆญฅๆง่กไธๆ ๅ
็ฝฎ่ถ
ๆถ โ ้คๆ็กฎ็ญไปปๅกๅคไธๅพ spawn_agent ๅ็ซๅณ wait_agent({ timeout_ms: 3600000 })๏ผไธ้ 1 ๅฐๆถ๏ผ้ปๅก็ญๅพ
๏ผ็ปไธไพ่ต 30000 ้ป่ฎคๅผ๏ผtimed_out: true ไธ Agent ๆชๅฎๆๆถๅๆฌก wait_agent ็ปญ็ญ๏ผไธไธขๅผใๆน้ๅบๆฏไฝฟ็จ spawn_agents_on_csv({ max_runtime_seconds: 3600, ... })ใ
<required_reading>
@~/.maestro/workflows/run-mode-lite.md
</required_reading>
Team Swarm
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.
Architecture
spawn_agent({ task_name: "team_swarm", message: "Execute skill team-swarm, args: task description" })
|
SKILL.md (this file) = Router
|
+--------------+--------------+
| |
no --role flag --role <name>
| |
Coordinator Worker
roles/coordinator/role.md roles/<name>/role.md
|
+-- Phase 1: gen swarm-config
+-- Phase 2: init --> Bash: scripts/aco.py init
+-- Phase 3: iterate (K rounds, each = spawn-and-stop)
| |
| +-- Bash: aco.py select --iter k -> N assignments
| +-- Spawn N x team-worker(ant)
| +-- [callback when all ants done]
| +-- (optional) Spawn team-worker(scorer)
| +-- Bash: aco.py update --iter k
| +-- Bash: aco.py converged
| +-- branch: loop k+1 OR Phase 4
|
+-- Phase 4: converge --> Bash: aco.py report -> Spawn team-worker(analyst)
-> best-solution.md
Role Registry
Role Router
Parse $ARGUMENTS:
- Has
--role <name> -> Read roles/<name>/role.md, execute Phase 2-4
- No
--role -> @roles/coordinator/role.md, execute entry router
Shared Constants
- Session prefix:
TS
- Session path:
{run_dir}/work/team/
- Team name:
swarm
- Script root:
<skill_root>/scripts/aco.py (Python 3.10+)
- Message bus:
mcp__maestro__team_msg(session_id=<run-id>, ...)
Worker Spawn Template
Coordinator spawns workers using this template:
spawn_agent({
subagent_type: "team-worker",
description: "Spawn <role> worker",
team_name: "swarm",
name: "<role>",
run_in_background: true,
prompt: `## Role Assignment
role: <role>
role_spec: <skill_root>/roles/<role>/role.md
session: {run_dir}/work/team
session_id: <run-id>
team_name: swarm
requirement: <task-description>
inner_loop: false
## Assignment (ant only)
<assignment JSON from aco.py select>
## Progress Milestones
session_id: <run-id>
Report progress via team_msg at natural phase boundaries.
Report blockers immediately via team_msg type="blocker".
Report completion via team_msg type="task_complete" after final send_message.
Read role_spec file (@<skill_root>/roles/<role>/role.md) to load Phase 2-4 domain instructions.
Execute built-in Phase 1 (task discovery) -> role Phase 2-4 -> built-in Phase 5 (report).`
})
User Commands
| Command | Action |
|---|
check / status | View iteration progress + convergence curve |
resume / continue | Resume interrupted iteration |
feedback <text> | Inject feedback into wisdom; applies at next iteration |
revise <ITER> | Re-run a specific iteration (rare) |
Specs Reference
Scripts
| Script | Purpose | Invocation |
|---|
scripts/aco.py | Main CLI: init / select / update / converged / report | python aco.py --session <path> <cmd> |
scripts/pheromone.py | Pheromone matrix module (imported by aco.py) | โ |
scripts/scoring.py | Pluggable scorer (script + fallback modes) | โ |
Session Directory
{run_dir}/work/team/
โโโ team-session.json # Session state
โโโ swarm-config.json # User-facing config (Phase 1 output)
โโโ role-binding.json # Worker role_spec path map
โโโ task-space.json # Resolved nodes list
โโโ pheromone/
โ โโโ current.json # Latest pheromone (each iter overwrites)
โ โโโ init.json # Frozen initial state
โ โโโ history/<iter>.json # Per-iter snapshot
โโโ trails/<iter>.jsonl # Per-iter all-ant paths + scores
โโโ scores/iter-<iter>-scores.json # Scorer output (if mode == llm)
โโโ {run_dir}/outputs/ # Formal deliverables
โ โโโ ant-<iter>-<id>.json # Per-ant schema-locked output
โ โโโ swarm-report.json # Phase 4 full report dump
โ โโโ best-solution.md # Analyst final synthesis
โโโ best.json # Canonical best solution
โโโ wisdom/ # learnings / decisions / issues
โโโ .msg/ # Message bus
Completion Action
When swarm converges, coordinator presents:
request_user_input({
questions: [{
question: "Swarm pipeline complete. What would you like to do?",
header: "Completion",
multiSelect: false,
options: [
{ label: "Archive & Clean (Recommended)", description: "Archive session, delete team" },
{ label: "Keep Active", description: "Preserve for follow-up" },
{ label: "Export Best Solution", description: "Copy best-solution.md to target" },
{ label: "Run Another Round", description: "Reset convergence, K more iterations" }
]
}]
})
Error Handling
| Scenario | Resolution |
|---|
aco.py not found | Verify <skill_root>/scripts/aco.py; check Python install |
| Python version < 3.10 | Use python3 or report dependency error |
| Config validation fails | request_user_input to fix, regenerate, retry |
| All ants fail in iteration | Halt, request_user_input (retry / abort / refine config) |
| Hallucination cluster (>50%) | Pause, request_user_input (continue / refine scoring) |
| Convergence never trips | max_iterations safety net always fires |
| Session corruption | Phase 0 reconciliation; archive if irrecoverable |