OpenParable
Skip to content
← Back to skills

Git Worktree Swarm

Agent Building
git-worktree-swarm

Git Worktree Swarm is an Agent Skill for agent building published in the winstonkoh87/Athena-Public repository on GitHub: a SKILL.md instruction file an AI agent can load to do this task.

Automates the complex setup of parallel git worktrees for agentic swarms with dependency-aware wave execution.

View on GitHub ↗
QUICK START

How to use this skill

Bring this guide into your coding agent with a prompt tailored to the tool you use.

  1. Open your project in Codex.
  2. Copy and paste the prompt below.
  3. Review files and risks before approving any action.
Prompt to paste
Inspect the Agent Skill at https://github.com/winstonkoh87/Athena-Public/blob/HEAD/examples/skills/coding/git-worktree-swarm/SKILL.md and all supporting files. Report provenance, permissions, scripts, dependencies, and security risks. Propose an exact installation into .agents/skills/git-worktree-swarm, but wait for my approval before writing files or running scripts.

Copying this prompt does not install or run the skill. Review third-party files before use.

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

  1. Detect current branch.
  2. Spawn n temporary worktrees (.agent-workspace-1, etc.).
  3. 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:

ConditionAssignment
Task has no dependenciesWave 1
Task depends on Wave N outputWave N+1
Tasks touch the same filesSame wave, sequential (not parallel)
Task has cross-cutting concernsLatest 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

  1. Each task commits atomically (P43 micro-commit).
  2. Merge worktrees back to main branch in wave order.
  3. Conflict resolution: if merge conflicts arise, spawn resolution agent.
  4. Cleanup: remove temporary worktrees.

Reference Paths