Running Multiple Claude Tasks in Parallel: One Git Worktree per Task

Posted by: Rafael Jaro Date Posted: November 5, 2026
Back to Case Studies

Issue

Claude Code spends a lot of a task waiting: on a PR review, an architect’s reply, a deploy, a backfill. Those waits are worth filling with another task. But I work from one Codespace with one VS Code window, and a Codespace has one working tree. That left me two options, both inefficient:

  • Switch branches in the same tree. This works, but it is a manual WIP-commit/checkout cycle each time, and a mistake can clobber the other task’s uncommitted work.
  • Open a second Codespace/window per task. That is heavy and not workable for me.

Either way I could not really run two tasks at the same time, so every wait was dead time.

Solution

Use git worktrees. A worktree is an extra checkout of the same repo, in its own folder and on its own branch, sharing the main checkout’s .git. Each task gets its own worktree, its own terminal/VS Code window and its own Claude session. No branch switching is needed.

How it works:

  • One worktree per task, named from the client and todo id (e.g. cura-environmental-services-269792395). The shared /new-worktree skill runs git worktree add and pnpm install, then verifies the result.
  • Worktrees are cheap here. pnpm’s store and Claude’s config (auth, skills, plugins) live outside any single checkout, so a new worktree installs fast and its Claude session needs no setup.
  • One Claude session per worktree, named “Client – SiteID”, so I can find and resume the right one.
  • When a task blocks, I /compact its session and move to another window. When I come back, I resume that same session and its history is still there.
  • When a task is done, the shared /clear-worktree skill removes the worktree only after checking that its branch is merged and the tree is clean.

/new-worktree needs a TeamworkFX todo. Give it the todo URL or id and it reads the todo title to get the client name. The todo id is required because it becomes part of the worktree folder, the branch and the session name. If you know the RCFX site id, it goes into the session name as well.

After the worktree is created, add it to your VS Code window (screenshot):

  1. Go to File, then Add Folder to Workspace, and choose the worktree folder.
  2. This lets New Terminal select the worktree’s workspace folder, so the terminal opens inside that worktree.
  3. Run claude there to start the task, or claude -c to resume it.

/new-worktree prints the launch command with the session name already filled in, for example claude -n "Acme Roofing - 54487 - 123". The name is Client – SiteID – todo id, so each task’s session is easy to find later with /resume or claude -c. On first use the skill also offers to add a small SessionStart hook to your Claude settings (a backup is kept, and only if you say yes). After that, plain claude in the worktree names the session automatically.

Gotchas:

  • A session stays rooted in the folder it was launched from. Moving to a new task means opening a new terminal in the new worktree and starting a fresh Claude there.
  • Local dev still has one shared bottleneck: the local-dev proxy uses a fixed port (55340) across all worktrees, so two pnpm start runs collide.
  • The real limit is CPU/RAM if several heavy sessions run at once.

Cleaning up when the task is done:

Once the PR is merged, /clear-worktree removes the worktree and its branch. It deletes nothing until every check passes:

  • The worktree has no uncommitted or untracked changes.
  • The branch is merged into the default branch (checked with git merge-base --is-ancestor).
  • The branch is already deleted on the remote.

Then it runs git worktree remove and git branch -d. It never uses --force unless you override one specific failed check. If the task also had a follow-up PR branch, pass that branch name as an extra argument. The session’s folder no longer exists afterward, so more work on that task means a new worktree.

Achievement

Waiting on one task no longer stops me. I move to another task’s window and keep working. Each task keeps its own branch, uncommitted changes and Claude context, so nothing bleeds between them.

Snippet/Screenshot/Link

The git commands behind the skills:

git worktree add ../micro-services-<slug> -b <branch>
git worktree list
git worktree remove ../micro-services-<slug>

Resuming a task’s session. Each worktree is its own folder, so claude -c run inside it continues that task’s most recent conversation. Open a terminal in the worktree, then:

cd /workspaces/micro-services-<slug>
claude -c

Skills: new-worktree and clear-worktree are shared in the organization’s Claude skills library, so there is nothing to copy. Use /new-worktree to create a task’s worktree and /clear-worktree to remove it once the PR is merged. To customize one, copy it into your own skills folder under a different name.