Batch-create worktrees for a fleet of agents

ai agents & parallel sessions

// what it does

worktree add is a local, near-instant operation — no network, no object copying — so creating a fleet is just a loop: one branch and directory per task, all starting from the same base commit. Every agent begins from identical state, and each result stays independently reviewable.

// shell

$ for t in auth search billing; do git worktree add -b agent/$t ../myapp-agents/$t main; done
$ git worktree list

// gotcha

The git side is cheap; the runtime side isn't. Each worktree still needs its own node_modules, .env, build caches, and a free dev-server port. Script that provisioning into the same loop, or agents will fail on their first npm run dev.

// resources