Day 7 of 16 · Saturday · Learning

Worktrees and parallel agentsCapability

A git worktree is a second working copy of the same repo on a different branch, in its own folder, sharing one history. You can run several at once — which is exactly how you test three versions of an idea side by side without them stepping on each other.

Catch-up progress
7/16
Why this matters to you

Your whole sabbatical mandate is 'test build ideas cheaply, in isolation, and concentrate where signal emerges.' But you have one PDB checkout on one branch — to try variation B you'd stash A, switch, lose your place, and you can never see them next to each other. Worktrees are the missing primitive: spin up A, B, and C as separate folders, point a Claude agent at each, and compare the real running results instead of imagining them.

Normally a git repo is one folder on one branch. To work on something else you switch branches in place — which forces you to put away whatever you were doing first. That serial bottleneck is the enemy of cheap experimentation: trying a second idea means abandoning the first.

A worktree breaks that. `git worktree add` creates a SECOND folder, checked out to its own branch, but sharing the same underlying repo and history. Edits in folder A don't touch folder B. Commits made in either show up in the shared history. It's like having two desks for the same project — same filing cabinet behind both, but two surfaces you can spread work across simultaneously.

This is why your superpowers bundle ships `using-git-worktrees` and `dispatching-parallel-agents` together: the worktree is the isolation, and a separate Claude agent in each worktree is the parallelism. You give agent A 'build the lesson card with a sidebar', agent B 'build it with a top strip', let both run, then open the two pages and pick. Same move as `design-shotgun` generating variants — but for whole working code, not just mockups.

Worked example

Two parallel variations of one small change, from your real PDB repo. Run these in /Users/tom/Claude/PDB:

git worktree add ../PDB-variantA -b try/sidebar-layout
git worktree add ../PDB-variantB -b try/topstrip-layout

git worktree list

# ...make the sidebar change in PDB-variantA, the top-strip change in PDB-variantB...

# when done comparing, throw the losers away cleanly:
git worktree remove ../PDB-variantA
git worktree remove ../PDB-variantB
git branch -D try/sidebar-layout try/topstrip-layout
▶ Do it now
  1. In /Users/tom/Claude/PDB, run `git worktree add ../PDB-tryA -b try/lesson-A` then `git worktree add ../PDB-tryB -b try/lesson-B`. Run `git worktree list` and confirm three lines: main + two variants.
  2. Open both new folders in Finder (`open ../PDB-tryA ../PDB-tryB`). Notice they're full, independent copies of PDB — you could edit the same file in each and they wouldn't collide.
  3. Make ONE trivial different edit in each — e.g. add a comment line to DESIGN.md in tryA, a different one in tryB. Confirm with `git -C ../PDB-tryA status` and `git -C ../PDB-tryB status` that each sees only its own change.
  4. Tear it all down: `git worktree remove ../PDB-tryA && git worktree remove ../PDB-tryB && git branch -D try/lesson-A try/lesson-B`. Run `git worktree list` again and watch it shrink back to just PDB. You just ran — and cleaned up — a 2-track parallel experiment.

Gotchas

Go deeper: git worktree — official docs · superpowers: using-git-worktrees
One-card takeaway

One repo, many desks: worktrees turn 'try an idea' from a serial commitment into a parallel, throwaway experiment — the cheapest way to let signal pick the winner instead of you guessing.