When this fires
Plan exists (docs/matilha/plans/<slug>-plan.md) and user wants to enter Phase 40 execution. Skill sets up worktrees and wave-status bookkeeping; AI or user dispatches per-worktree sessions.
Preconditions
project-status.mdshowscurrent_phase ≥ 30.- Plan file exists.
- Working tree clean.
- Disjunction validated (intra-wave SPs touch disjoint files).
Execution Workflow
- Pre-flight (Swiss Cheese): resolve plan path, read project-status
current_phase ≥ 30, verify clean tree via Bashgit status --porcelain. - Parse plan markdown (soft-strict: em-dash / colon / single-hyphen SP headings).
- Pick target wave (default wave 1, or
--wave N). - Validate disjunction (SPs in same wave must touch disjoint
Toucheslists); on violation throw 5-rule error unless--allow-overlap. - Detect companions (superpowers via
project-status.md:companion_skills.superpowers == "installed"). - Idempotency guard: if
docs/matilha/waves/wave-NN-status.mdexists and not--force, halt with recovery options. - If
--dry-run: emit preview and exit. - For each SP: create branch
wave-NN-sp-<slug>via Bashgit branch, worktree../<project>-sp-<slug>via Bashgit worktree add, render kickoff.md + SP-DONE.md from templates (fetched via matilha pull from matilha-skills) via Write, write wave-status.md entry. - Update .gitignore to include
kickoff.mdvia Edit. - Emit dispatch commands (one per worktree).
Rules: Do
- Validate disjunction.
- Gitignore kickoff.md.
- Write wave-status before dispatch (bookkeeping survives partial failures).
- Follow merge_order strictly in documentation.
Rules: Don't
- Execute the SPs yourself (plugin only creates worktrees).
- Force-merge (no
--no-verify). - Modify
project-status.md:current_phase.
Expected Behavior
N worktrees + N kickoff.md + N SP-DONE.md + 1 wave-status.md. User opens N terminals and pastes the dispatch commands.
Quality Gates
wave-NN-status.mdexists and conforms towaveSchema.- Every SP entry has
branch,worktree,status. .gitignorecontainskickoff.md.current_phase ≥ 30in project-status.md.
Companion Integration
- If superpowers:executing-plans is available: kickoff.md recommends it as the preferred task-control engine. Matilha provides the harness (worktree isolation, disjunction gates, wave-status tracking); superpowers drives execution with TDD + review checkpoints.
- Otherwise: kickoff.md instructs the AI to execute with TDD + atomic commits standalone.
Output Artifacts
- N git branches
wave-NN-sp-<slug>. - N worktrees at
../<project>-sp-<slug>/. - N
kickoff.mdfiles in worktrees. - N
SP-DONE.mdtemplates in worktrees. docs/matilha/waves/wave-NN-status.md.- Updated
.gitignore.
Example Constraint Language
- Use "must" for: disjunction validated; wave-status written before any dispatch.
- Use "should" for: run
--dry-runfirst when new to the plan. - Use "may" for:
--allow-overlaponly with understood risk.
Troubleshooting
- "branch already exists": Use
--force(destructive; logs recovery first). - "disjunction violated": Edit plan to move overlap to a later wave, or
--allow-overlap. - "current_phase < 30": Finish phases 10/20/30 first.
CLI shortcut (optional)
If matilha CLI is installed (
matilha --versionsucceeds), you can runmatilha hunt <slug>to execute this deterministically. The plugin path above works without any CLI installation.