9thlevelsoftware/legion/wave-executor
- community
- ext:[{"type":"hook","description":"Pre/post lifecycle hooks"}]
Checking that the SKILL.md file is still in the repository.
Executes wave-structured plans with personality-injected agents — parallel or sequential per CLI adapter
Install
npx vskill@latest install 9thlevelsoftware/legion/wave-executorSemi-extensibleMentions customization, but needs skill-specific knowledge. Read the extensible skills standard
SKILL.md
Wave Executor
Engine for /legion:build. Takes the plan files in a phase directory and executes them in wave order — spawning personality-injected agents in parallel within each wave, waiting for completion before advancing to the next wave. The full flow: discover plans, validate structure, inject personalities, spawn parallel agents, collect results, write summaries, report.
Section 1: Execution Principles
These rules govern all execution decisions. Do not deviate from them.
MANDATORY: Follow the active CLI adapter's Execution Protocol.Before executing any plans, load the active adapter (see workflow-common CLI Detection Protocol).The adapter defines how agents are spawned, coordinated, and cleaned up.If adapter.parallel_execution is true AND adapter.structured_messaging is true (e.g., Claude Code):Use the adapter's full coordination lifecycle (e.g., TeamCreate → TaskCreate → Agent with team_name → SendMessage → TeamDelete on Claude Code).On Claude Code specifically:CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMSmust be enabled.If Teams are unavailable, stop and tell the user to enable the flag.If adapter.parallel_execution is true but adapter.structured_messaging is false (e.g., Cursor):Spawn agents in parallel. Collect results via file system per adapter.collect_results.If adapter.parallel_execution is false (e.g., Codex CLI, Gemini CLI, Aider):Execute plans sequentially within each wave. No agent spawning may be needed —use adapter.spawn_agent_personality or execute inline per adapter protocol.This is not optional. Always consult the adapter before spawning agents.
- Wave-sequential, parallel-within — all Wave 1 plans must complete before any Wave 2 plan begins. Within a wave, plans run simultaneously if
adapter.parallel_executionis true, or sequentially if false. - Full personality injection — each agent receives the ENTIRE contents of its assigned personality
.mdfile. No summaries, no excerpts, no paraphrasing. On CLIs without agent spawning, personality is a prompt prefix in the current session. - Adapter model for execution — all spawned agents use
adapter.model_execution. This matches the Cost Profile Convention fromworkflow-common.md. - No automatic retries — if an agent fails, capture the error output and stop the wave. Report to the user. Do not re-spawn the failed agent. See Error Handling Pattern in
workflow-common.md. - Each plan produces a summary — after an agent completes, write a
{NN}-{PP}-SUMMARY.mdfile to the phase directory, whether the result is success or failure. - Orchestrator stays in main context — the
/legion:buildcommand itself does not execute plan work. It reads, validates, dispatches, and collects. On CLIs without spawning, personality injection is temporary and dropped after each plan. - Failed wave blocks subsequent waves — if any plan in a wave fails, do not proceed to the next wave. Report wave status and pause for user decision.
- Files isolation per wave — plans within the same wave must not share files_modified entries. This is guaranteed by plan authoring (see phase-decomposer.md), but flag a warning if a conflict is detected. When
execution.use_worktreesistrue, this constraint is relaxed — each agent operates in its own git worktree, providing filesystem-level isolation. See Section 1.5. - Sequential file ordering — when plans in the same wave declare
sequential_files, the wave-executor must serialize dispatch for plans that share a sequential file. Plans with no sequential file overlap still execute in parallel. This constraint applies even whenadapter.parallel_executionis true. - One coordination context per phase — per adapter protocol: one Team on Claude Code, one checklist file on other CLIs. Not per wave.
- Agents report via adapter.collect_results — spawned agents send their structured completion summary per the adapter's result collection method. This keeps the coordinator's context window small.
- Verification-gated completion — after each task, the agent MUST run all
> verification:commands from the task's action block. If any verification command returns a non-zero exit code, the task is marked as failed and the agent must report the failure. Do not proceed to the next task until all verifications pass. - No agent self-deferrals — agents must attempt every in-scope planned task. They may complete it, fail it with evidence, or raise a blocker escalation for human resolution. They must never mark planned work as deferred on their own authority, treat deferred work as complete, or move in-scope planned work to a later phase without an explicit user decision.
- Execution harness contract — every executor prompt enforces
read-before-write -> evidence-before-action -> minimal diff -> verify-before-report. Agents must read listed context before editing, prove source evidence before acting, keep diffs insidefiles_modified, run verification before reporting, and emitBLOCKEDinstead of guessing on ambiguity, missing files, conflicting instructions, forbidden operations, or unverifiable success.
Section 1.5: Worktree Isolation Mode
When settings.json execution.use_worktrees is true, the wave-executor creates isolated git worktrees for each agent in a wave, eliminating the need for files_modified disjointness checking.
When to Use
- Multiple agents in the same wave need to modify overlapping files
- The
files_modifieddisjointness constraint (Principle 8) is too restrictive for the task - Maximum isolation is needed for safety during parallel execution
Prerequisites
adapter.parallel_executionmust betrue(worktrees are pointless for sequential execution)- Git must be available and the project must be a git repository
- Sufficient disk space for worktree copies
- If prerequisites are not met: fall back to standard execution with a warning
Worktree Lifecycle
Integration with Existing Principles
When worktree mode is active:
- Principle 8 (Files isolation per wave) is relaxed — worktrees provide filesystem-level isolation instead of plan-level file list disjointness
- Principle 9 (Sequential file ordering) is NOT relaxed — sequential_files still serialize dispatch even in worktree mode, because merge order matters for files that require single-writer semantics
- Principle 12 (Verification-gated completion) runs inside the worktree — verification commands execute against the worktree's file state, not the main tree
Adapter Requirements
| Adapter Capability | Worktree Support | |
|---|---|---|
| Claude Code | Full support — Agent tool accepts cwd override | |
| Cursor/Windsurf | Partial — file-based result collection works, but agents may not respect cwd | |
| Sequential CLIs | N/A — worktrees disabled for sequential execution |
Error Handling
- Worktree creation fails: Fall back to standard execution, warn user
- Merge conflict: Halt wave, report conflicts, preserve worktrees for manual resolution
- Disk space: If worktree creation fails with disk space error, fall back with warning
- Git not available: Fall back to standard execution (should never happen — git is required for Legion)
- Orphaned worktrees: On next
/legion:build, check for stale.legion-worktrees/and offer cleanup
Section 2: Plan Discovery
How to find, read, and organize plan files for a phase before any execution begins.
This is the start of the file. Read the full SKILL.md on GitHub.
Security
- Security scanPassed, 95 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/wave-executor/SKILL.md
Popularity
- Repository stars
- 62
- Repository forks
- 7
- 7-day trend score
- 21
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Extension points
hookPre/post lifecycle hooks
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/9thlevelsoftware/legion/wave-executor)