一键导入
legion
Select optimal subagent topology (hierarchical, mesh, ring, star) based on task structure; adds Ruflo-style swarm intelligence to Superpowers
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Select optimal subagent topology (hierarchical, mesh, ring, star) based on task structure; adds Ruflo-style swarm intelligence to Superpowers
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Store and retrieve patterns from past work using semantic search; adds self-learning capability to Superpowers
Use when facing 2+ independent tasks that can be worked on without shared state or sequential dependencies
Structured first-pass exploration of an unfamiliar codebase — what to read, in what order, what to map, what traps to find. Use when entering any new or inherited project before writing code.
Select optimal AI model by task complexity — route to cheap/fast models for simple tasks, capable models for complex reasoning
Use when starting any conversation - establishes how to find and use skills, requiring Skill tool invocation before ANY response including clarifying questions
Use when implementing any feature or bugfix, before writing implementation code
| name | legion |
| description | Select optimal subagent topology (hierarchical, mesh, ring, star) based on task structure; adds Ruflo-style swarm intelligence to Superpowers |
| type | process |
LEGION — A legion is a large, coordinated force organized into precise, independent units. When invoked: selects the optimal agent topology for the task — parallel (independent tasks), pipeline (sequential stages), hierarchical (orchestrator + specialists), or mesh (peer review) — and coordinates execution across all agents.
Core principle: Match agent topology to task structure — the right coordination pattern prevents chaos and maximizes parallelism.
Announce at start: "Running LEGION to select agent topology and coordinate."
Independent tasks, no coordination needed → STAR (see patterns/star.md)
Sequential stages, each transforms previous output → RING (see patterns/ring.md)
Exploration, multiple hypotheses, no clear structure → MESH (see patterns/mesh.md)
Plan execution, coordinator + specialists → HIERARCHICAL (see patterns/hierarchical.md)
Load the matching pattern file for full prompt templates and examples.
| Topology | Parallelism | Best For |
|---|---|---|
| Hierarchical | Moderate | Plan execution, structured tasks |
| Mesh | High | Exploration, research, bug investigation |
| Ring | Low (sequential) | Data pipelines, multi-stage transforms |
| Star | Very High | Independent parallel work, batch processing |
| Task Complexity | Swarm Size | Topology |
|---|---|---|
| Single file edit | 1 agent | N/A (no swarm) |
| 2-5 files | 2-3 agents | Hierarchical |
| 5-10 files | 3-5 agents | Hierarchical or Star |
| Multi-module | 5-7 agents | Hierarchical-Mesh |
| System-wide | 7-15 agents | Adaptive with phases |
10 agents: coordination overhead exceeds parallelism benefit. >15 agents: decompose into separate projects.
Complex projects with both exploration and execution:
PHASE 1: Exploration (Mesh) — explore angles, synthesize requirements
PHASE 2: Planning (Hierarchical) — coordinator writes plan, decomposes tasks
PHASE 3: Execution (Hierarchical) — workers execute, coordinator reviews
PHASE 4: Integration (Mesh) — collective debugging and integration
Majority: 3 agents agree A, 2 agree B → proceed with A, document dissent. Weighted: Security decision → security-architect vote 3x weight. Byzantine: f < n/3 faulty agents. With 4 agents: tolerate 1 faulty opinion. If no majority → escalate to human.
Auto-trigger when ALL of:
Auto-trigger announcement:
DETECTING: This task touches N independent files with no cross-dependencies.
AUTO-TRIGGERING: <topology> swarm (N spokes/workers)
Topology rationale: [reason]
Do NOT auto-trigger for: bug fixes (investigate first), tasks < 3 files, shared state changes.
| Skill | Integration |
|---|---|
phantom | Hierarchical topology by default |
architect | Mesh topology for exploration phase |
hunter | Mesh topology for multi-angle investigation |
blueprint | Plan should specify recommended topology |
tribunal | Star topology for parallel file review |
Never:
Topology determines success — match structure to task
Hierarchical for execution | Mesh for exploration
Ring for pipelines | Star for parallel work