worktree-fleet
Original:🇺🇸 English
Translated
8 scriptsChecked / no sensitive code detected
Independence-validated parallel fleet that runs each worker (claude -p or codex exec) in its own git worktree. Use when tasks touch non-overlapping files and you need merge-safe isolation (each worker on its own branch). For DAG-ordered one-shot workers with budgets, use dag-fleet. For headless iteration with a reviewer loop, use iterative-fleet.
12installs
Sourcequickcall-dev/skills
Added on
NPX Install
npx skill4agent add quickcall-dev/skills worktree-fleetTags
Translated version includes tags in frontmatterSKILL.md Content
View Translation Comparison →Worktree Fleet
A skill for running N independent agents in parallel, each isolated in its own git worktree on its own branch. Independence is validated before anything spawns — if two workers declare overlapping , the skill refuses with a clear conflict message.
target_filesDecision tree — which fleet?
You want to run multiple agents in parallel. Which fleet?
1. Are the tasks independent (no shared files, no shared state)?
YES → worktree-fleet ← YOU ARE HERE
NO → continue
2. Does the work need iteration with a reviewer making accept/iterate decisions?
YES → iterative-fleet
NO → continue
3. Is the work a one-shot DAG (each agent runs to completion, dependencies via depends_on)?
YES → dag-fleet
NO → continue
4. None of the above?
→ You're the orchestrator. Open multiple Claude Code sessions.When to use THIS skill
- Tasks touch non-overlapping files (different modules, different docs, etc.)
- You want merge-safe isolation — each worker on its own branch, no mid-flight conflicts possible
- The merge decision is yours — after workers complete, you choose merge order / strategy
- You want independent branches in git that you can inspect, cherry-pick, or discard
When NOT to use this skill
- Workers need to coordinate or read each other's output → with
dag-fleetdepends_on - Tasks overlap files (even partially) → fix the task split first, then come back
- You want headless workers + reviewer-in-loop →
iterative-fleet - Work fits in the current conversation → use Claude Code's built-in Agent tool directly
fleet.json schema
json
{
"fleet_name": "refactor-utils",
"type": "worktree",
"config": {
"max_concurrent": 4,
"model": "sonnet",
"fallback_model": "haiku"
},
"workers": [
{
"id": "rename-foo",
"task": "Rename foo() to baz() in src/utils/foo.ts and all callers",
"target_files": ["src/utils/foo.ts", "src/**/*.test.ts"],
"branch": "rename-foo-to-baz",
"type": "code-run",
"max_turns": 30,
"max_budget_usd": 2.0
}
]
}New fields vs dag-fleet:
- (required per worker) — list of file globs this worker will touch. Overlap across workers = launch refuses with exit 2.
target_files - (required per worker) — git branch name for this worker's worktree. Must not already exist.
branch
Worker type override (Claude only): Worktree workers always need Bash for . If you set to , , or , launch.sh will automatically override to with a warning. The worktree itself provides isolation — Bash restrictions are unnecessary here. This override does not apply to codex workers (codex uses sandbox modes).
git committyperead-onlywritereviewercode-runProvider support: Set at config or per-worker level to use OpenAI Codex CLI instead of Claude. Codex workers use (needed for git commit). See dag-fleet SKILL.md for full codex provider documentation (model aliases, reasoning_effort, limitations).
"provider": "codex"--sandbox workspace-writeDefault max_turns is 100 (not 50 like dag-fleet). Worktree workers typically edit, test, and commit — they need headroom.
Available scripts
| Script | When to call | Args |
|---|---|---|
| Validate independence, create worktrees, spawn workers in tmux | |
| Per-worktree progress, cost, completion state | |
| Print merge plan (files changed, line counts) — no auto-merge | |
| Remove git worktrees, requires --force | |
Launch procedure
- Set to an absolute path.
FLEET_ROOT - Create with the schema above.
$FLEET_ROOT/fleet.json - For each worker, create . Include:
$FLEET_ROOT/workers/{id}/prompt.mdSave ALL output to $FLEET_ROOT/workers/{id}/output/ — use absolute paths. - Run:
bash ${CLAUDE_SKILL_DIR}/scripts/launch.sh $FLEET_ROOT - validates independence without creating worktrees or spawning workers.
--dry-run - ALWAYS tell the user the exact status command so they can monitor manually:
This is mandatory after every launch. The user must be able to check status without asking you.
bash ${CLAUDE_SKILL_DIR}/scripts/status.sh <fleet-name-or-root>
IMPORTANT: Worker prompts MUST instruct the worker to commit its changes before exiting:
When you are done, commit your changes on the current branch with a descriptive message.Without this, changes stay as unstaged modifications and cannot be merged via .
git mergeAfter workers complete
- Run to see what each branch changed.
merge.sh - Decide your merge strategy (in-order, cherry-pick, etc.).
- Merge manually — the skill does NOT auto-merge.
- Run to remove worktrees.
cleanup.sh --force
Rationalizations to reject
| Agent says | Rebuttal |
|---|---|
| "The tasks overlap slightly but I can manage" | Overlapping target_files = reject. No exceptions. Fix the task split first. If you think you can manage it, you're wrong — merge conflicts in parallel worktrees are unrecoverable. |
"I'll skip | Then dry-run will be fast. Run it. The independence validator catches things you didn't think of (glob overlap, bidirectional fnmatch). |
| "Two workers both need the config file, but in different sections" | Same file = overlap. The validator doesn't know about "sections." Split the config change into a separate sequential step, or have one worker own it. |
| "I'll auto-merge since the branches are clean" | Never auto-merge. Run |
| "I can skip cleanup — the worktrees aren't hurting anything" | Worktrees hold branch locks. Stale worktrees block future branch creation and waste disk. Run |
STRICT RULES
- Never skip validation for new fleet configurations.
--dry-run - Never merge without reviewing output first.
merge.sh - requires
cleanup.sh— no accidental removals.--force - Worktrees persist until you explicitly clean them up. They will not auto-remove.
$ARGUMENTS