一键导入
agents-swarm-orchestration
Coordinate parallel subagents in dependency-aware waves. Use when executing multi-task plans with Claude Code or Codex agent swarms.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Coordinate parallel subagents in dependency-aware waves. Use when executing multi-task plans with Claude Code or Codex agent swarms.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
| name | agents-swarm-orchestration |
| description | Coordinate parallel subagents in dependency-aware waves. Use when executing multi-task plans with Claude Code or Codex agent swarms. |
Coordinate multiple subagents to execute a plan in parallel. The orchestrator reads a dependency graph, dispatches agents in waves (or all at once), validates outputs, and resolves conflicts. Agent-agnostic — works with Claude Code, OpenAI Codex, and similar multi-agent platforms.
Related skills: dev-workflow-planning (plan creation), agents-subagents (agent creation and handoffs).
1. PLAN → Create detailed spec with task dependency graph
2. DISPATCH → Launch subagents per wave (or all at once)
3. VALIDATE → Check each agent's output against acceptance criteria
4. RESOLVE → Fix conflicts between parallel outputs
5. ADVANCE → Update plan state, launch next wave
6. COMPLETE → All tasks done, final integration verification
For swarm execution, your plan must include a task dependency graph. Every task declares what it depends on.
| Task ID | Name | depends_on | Files (owned) | Agent Role |
|---------|------|------------|----------------|------------|
| T1 | Setup DB schema | [] | db/schema.sql, db/migrations/ | db-engineer |
| T2 | API routes | [T1] | src/routes/*.ts | backend-dev |
| T3 | Auth middleware | [T1] | src/middleware/auth.ts | backend-dev |
| T4 | UI components | [] | src/components/*.tsx | frontend-dev |
| T5 | Integration tests | [T2, T3, T4] | tests/*.test.ts | qa-agent |
Rules:
depends_on: [] (empty = no blockers, runs immediately).Choose based on accuracy vs. speed:
Launch one subagent per unblocked task, in dependency-respecting waves. Wait for each wave to complete before the next.
Wave 1: T1, T4 → no dependencies, run in parallel
↓ (wait for completion)
Wave 2: T2, T3 → T1 complete, now unblocked
↓ (wait for completion)
Wave 3: T5 → T2, T3, T4 complete
Protocol:
depends_on → Wave N.When to use: Production code, complex interdependencies, high-stakes changes.
Launch as many subagents as possible at once, regardless of dependencies.
Protocol:
When to use: Prototypes, greenfield scaffolding, independent modules, time-sensitive demos.
Tradeoffs: Faster execution, but more merge conflicts. The orchestrator must be ready to re-dispatch individual tasks if conflicts invalidate their output.
Parallel agents should work on isolated copies of the codebase to prevent interference:
| Platform | Isolation Method | How |
|---|---|---|
| Claude Code | Git worktrees | Set isolation: "worktree" on the Agent tool call. Each agent gets an isolated branch; changes merge after validation. |
| Codex | Sandboxed containers | Each agent runs in its own sandbox with a repo snapshot. Outputs are collected and merged by the orchestrator. |
| Generic | Branch-per-task | Create a branch per task before dispatch. Agents commit to their branch. Orchestrator merges post-validation. |
The key to effective parallel agents is front-loaded context. Subagents have no prior conversation history — they start cold. Give them everything upfront.
You are implementing a specific task from a development plan.
## Context
- Plan: [path/filename]
- Goals: [what this task achieves in the larger plan]
- Dependencies: [prerequisite tasks and their outputs]
- Related tasks: [sibling tasks and what they produce]
## Scope
- Files to create/modify: [full paths — this agent owns these]
- Files to read (not modify): [reference files]
- Do-not-touch: [files owned by other agents]
## Acceptance Criteria
- [Criterion 1]
- [Criterion 2]
- [Test command to verify]
## Implementation Steps
1. Read the plan at [path] for full context
2. [Concrete step]
3. [Concrete step]
4. Run verification: [command]
5. Commit completed work
Every agent understands:
This front-loading reduces token usage (fewer tool calls for discovery) and drift (agent stays on task).
When populating subagent prompts with dynamic values:
The orchestrator is the brain. It holds the plan, tracks state, and ensures quality.
Keep the orchestrator's context intact across waves. It needs the full plan and history of agent outputs to make good decisions. If context is low (< 40% remaining), compact rather than reset — subagents handle the heavy lifting, so orchestrator context stays lean.
When parallel agents produce conflicting changes:
When a subagent fails or produces invalid output:
| Role | Claude Code | Codex | Reasoning Level |
|---|---|---|---|
| Planning | opus | o3 / o4-mini (high reasoning) | High — plan quality is paramount |
| Orchestration | opus or sonnet | o3 / o4-mini | High — needs full-plan reasoning |
| Subagent execution | sonnet or haiku | codex-mini or gpt-4.1 | Medium — focused, well-scoped tasks |
| Verification | haiku | gpt-4.1-mini or gpt-4.1-nano | Low — binary pass/fail checks |
Principle: Invest reasoning budget in planning and orchestration. Subagents with good context can use lighter models effectively.
Track per swarm execution:
| Metric | Why |
|---|---|
| Wall-clock time vs. sum of task times | Measures parallelism efficiency |
| Conflicts resolved | High count signals poor file ownership |
| Re-dispatched tasks | High count signals plan quality issues |
| Token usage per agent | Detects over-exploration or drift |
| Wave count vs. DAG critical path | Actual waves should match theoretical minimum |
| Mistake | Fix |
|---|---|
| Launching agents without a dependency graph | Write the DAG first; it takes 5 minutes and saves hours |
| Vague subagent prompts ("implement the auth") | Use the context-rich template with file paths and criteria |
| Multiple agents editing the same file | Enforce file ownership in the plan |
| Orchestrator resets context between waves | Keep context; compact if needed |
| Skipping validation between waves | Always verify before launching next wave |
| Too many agents overwhelming the system | Start with 3-5; scale up only if stable |
| Injecting raw external content into prompts | Sanitize dynamic context; treat ticket/user input as untrusted |
| Retrying failed agents indefinitely | Fail after 2 attempts; escalate structural failures to the user |
Patterns adapted from am.will (@LLMJunky) "Codex Multi Agent Playbook: Swarms Lvl. 1" (Feb 2026), generalized for agent-agnostic use. Original Codex skills: github.com/am-will/codex-skills.
Builds multi-repo context hubs and compiled markdown knowledge maps. Use when profiling repo portfolios or assembling LLM-ready cross-repo knowledge bases.
Builds per-repo code graphs in JSON and markdown-ready derived artifacts. Use when you need blast radius, symbol-level maps, import graphs, inheritance, or test links.
Context-driven AI development with AGENTS.md, repo knowledge bases, Claude Code, Codex, and Copilot. Use when adopting repo-native AI workflows or multi-repo setups.
Technical writing for READMEs, ADRs, API docs, and changelogs. Use when revising or consolidating a repo documentation folder.
Design, implement, and troubleshoot NUKE-based CI/CD pipelines for .NET services with fast local-to-CI feedback loops. Use when creating or refactoring `nuke/Build.cs` target graphs, tuning `DependsOn`/`After`/`Triggers`/`OnlyWhenDynamic` behavior, orchestrating unit/API/DB test categories, merging and publishing coverage and test reports, building and pushing Docker images with traceable tags and digests, producing artifact contracts such as `deploy.env`, and diagnosing flaky or slow pipeline execution. For service code changes use $software-csharp-backend, for NUnit fixture design use $qa-testing-nunit, and for safe logging rewrites use $dev-structured-logs.
Systematic debugging for crashes, regressions, flakes, and production bugs. Use when diagnosing stack traces, logs, traces, or profiling data.