Agent skill
git-worktree-swarm
Automates the complex setup of parallel git worktrees for agentic swarms with dependency-aware wave execution.
Install this agent skill to your Project
npx add-skill https://github.com/winstonkoh87/Athena-Public/tree/main/examples/skills/coding/git-worktree-swarm
SKILL.md
Git Worktree Swarm Orchestrator
Sets up parallel, isolated git environments so multiple sub-agents can work on the same repository simultaneously without merge conflicts. Uses wave-based execution to respect task dependencies.
Triggers
"swarm", "parallel agents", "setup worktrees", "multi-agent", "wave execution"
Core Mechanics
Phase 1: Setup
- Detect current branch.
- Spawn
ntemporary worktrees (.agent-workspace-1, etc.). - Assign tasks to isolated clones.
Phase 2: Wave Execution (Dependency DAG)
Plans are grouped into waves based on dependency analysis:
WAVE 1 (parallel — no dependencies)
├── Worktree A: Task 1 (User model) → Fresh context (P513)
├── Worktree B: Task 2 (Product model) → Fresh context (P513)
│
[State merge: A.state + B.state → combined handoff]
│
WAVE 2 (parallel — depends on Wave 1)
├── Worktree C: Task 3 (Orders API, needs User model)
├── Worktree D: Task 4 (Cart API, needs Product model)
│
[State merge: C.state + D.state → combined handoff]
│
WAVE 3 (sequential — depends on Wave 2)
└── Worktree E: Task 5 (Checkout UI, needs Orders + Cart)
Wave Assignment Rules:
| Condition | Assignment |
|---|---|
| Task has no dependencies | Wave 1 |
| Task depends on Wave N output | Wave N+1 |
| Tasks touch the same files | Same wave, sequential (not parallel) |
| Task has cross-cutting concerns | Latest wave of any dependency |
Phase 3: Context Isolation (P513)
Each worktree agent receives only:
- The specific plan/task
- Relevant source files (from dependency analysis)
- STATE.md (accumulated decisions from prior waves)
- Project context (design.md / REQUIREMENTS.md)
Never: full conversation history, debug logs, unrelated research.
Phase 4: Merge
- Each task commits atomically (P43 micro-commit).
- Merge worktrees back to main branch in wave order.
- Conflict resolution: if merge conflicts arise, spawn resolution agent.
- Cleanup: remove temporary worktrees.
Reference Paths
- Protocol 513: Context Isolation
- Protocol 43: Micro-Commit
.context/memories/protocols/engineering/100-git-worktree-parallelism.md.context/memories/protocols/architecture/409-parallel-worktree-orchestration.md
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
context-compactor
9-section context compression with analysis scratchpad. Adapted from Claude Code's /compact system (2026-03-31).
academic-delivery
8-step pipeline for academic deliverables — essays, reports, analysis, capstones. Encodes the full intake-to-delivery workflow with automatic red-team triggering.
trade-journal-analyzer
Unified post-trade analytics: journal pattern extraction + drawdown classification. Absorbs: drawdown-classifier.
circuit-breaker
Mandatory systemic pause when cumulative red flags exceed threshold. Forces disengagement across Trading, Spending, Relationships, Work, and Energy domains.
Red-Team Review
Bias-aware adversarial review for any artifact before shipping. 5-phase QA protocol with severity-weighted findings.
power-inversion
Unified negotiation engine: BATNA mapping, Dignity Premium pricing, and commitment device protection. Absorbs: commitment-device.
Didn't find tool you were looking for?