Git Worktrees + Celistra: Parallel Claude Code Sessions With Full Supervision
Create one git worktree per agent task. Spawn each Claude Code instance with its worktree as the working directory. Celistra supervises each one — sandbox per agent, audit log per agent, fleet view across all of them.
Tim Dietrich's writeup on parallel sub-agents calls git worktrees "the foundation of parallel agentic development." That's right — and the next layer up is the supervision question. Worktrees give the agents space; the daemon gives you the room to watch.
What worktrees give you
One repository, multiple checkouts. Each worktree is a real directory; each has its own .git indirection but shares the underlying object database. Two agents working in two worktrees of the same repo:
- Don't fight over
node_modules(each worktree has its own) - Don't fight over
dist/ build outputs - Don't fight over generated files
- Can be on different branches simultaneously
- Share git objects on disk (cheap)
Setup
cd ~/code/myproject
git worktree add ../myproject-task-1 -b agent/task-1 main
git worktree add ../myproject-task-2 -b agent/task-2 main
git worktree add ../myproject-task-3 -b agent/task-3 main
Three worktrees, three new branches off main. Each agent gets a clean place to work.
Spawn three agents
celistrad ctl spawn \
--workspace ~/code/myproject-task-1 \
--auto-restart \
'claude --print "Refactor src/auth/* to use the new session API. Detail in TASK.md"'
celistrad ctl spawn \
--workspace ~/code/myproject-task-2 \
--auto-restart \
'claude --print "Find and fix every typing.Optional[X] = None pattern. Detail in TASK.md"'
celistrad ctl spawn \
--workspace ~/code/myproject-task-3 \
--auto-restart \
'claude --print "Add tests for src/services/payment/. Detail in TASK.md"'
Each agent's --workspace is enforced by the sandbox profile — they can only write inside their own worktree. Even if Claude Code goes off the rails and tries to write to ~/code/myproject-task-2/src from the agent in worktree 1, the kernel says no.
Watch them
Dashboard fleet view shows three rows. Click any to attach. Each PTY is independent; the 64KB scrollback ring lets you drop in mid-task.
Pull results
cd ~/code/myproject
git fetch ../myproject-task-1 agent/task-1:agent/task-1
git fetch ../myproject-task-2 agent/task-2:agent/task-2
git fetch ../myproject-task-3 agent/task-3:agent/task-3
# Now the three branches are in your main repo, ready to review:
git log --oneline agent/task-1
git log --oneline agent/task-2
git log --oneline agent/task-3
Cleanup
# When done with a worktree:
cd ~/code/myproject
git worktree remove ../myproject-task-1
# Branch stays; if you want it gone too:
git branch -D agent/task-1 # only if merged or you really mean it
Why this is better than three terminals
- Persistence. Close the terminals, agents keep running. Daemon-managed.
- Sandboxing. Each agent fenced to its worktree. Even reckless Claude Code can't cross-contaminate.
- Audit. 30-day SQLite history records every spawn, every exit, every restart per agent.
- Mobile. Approval requests buzz your phone with the agent name. You always know which task is asking.
- Restart-on-crash. Model 500 doesn't kill the run; the daemon respawns.
Failure modes
Agents fighting over the lockfile. Don't share a lockfile — each worktree has its own package-lock.json / yarn.lock. If they all need to install at once, run npm install once on main and copy node_modules into each worktree before spawning, or accept the parallel install.
Three agents all want to bump the same shared file. They'll merge-conflict at the end. That's fine — you review three branches and merge in order. Worktrees don't make merging magical; they just make the work isolated until then.
Agent named "task-1" is actually rewriting the schema. The audit log + the diff from main shows you what each one did. If you don't recognize a change, that's the moment for the human to step in.
Cost arithmetic
Three Claude Code instances bill against your Anthropic plan as three sessions. If they each run for 30 minutes, you pay roughly 3x what one 30-minute run costs. The math works out when the three are actually independent — different parts of the codebase. It doesn't work out when they all fight over the same module; you've turned 30 minutes of work into 90 minutes of token spend.
FAQ
How many worktrees can I have?
Practically unlimited (git allows it). The bottleneck is your machine — 10 active worktrees with 10 npm installs is a lot of disk.
Do worktrees work with monorepos?
Yes. Each worktree is a full checkout, so each gets the whole monorepo. If your monorepo has a heavy install step, worktrees amplify the cost. Use a tool like pnpm with shared content-addressable storage to mitigate.
Can two agents work on the same worktree?
You can attach two agents to one PTY (the daemon supports multi-client fanout). But two agents writing files in the same directory will fight. Don't do that.
What about hooks and pre-commit?
Worktrees inherit hooks. If an agent's worktree has flaky pre-commit, that's the agent's problem to handle (retry, fix the hook, skip with --no-verify if you've consented to that).