Isolated git worktree workspaces for running parallel Claude Code sessions across a monorepo.
You have a monorepo with multiple sub-projects (e.g. backend/, frontend/, infra/). You want to work on several features at the same time, each in its own Claude Code session. But if two sessions touch the same repo directory, they'll collide — uncommitted changes, conflicting branches, confused context.
These scripts use git worktrees to create isolated copies of your repos, each on its own branch, inside a named workspace directory. Each workspace gets:
- A git worktree per repo, checked out to a branch named after the task
- A symlink to your root
CLAUDE.md(so all sessions share the same project guidance) - A copy of your
.claude/config (project settings, permissions) — but not plans or memory, which stay per-session
your-monorepo/
├── backend/ ← main working copies
├── frontend/
├── infra/
├── tasks/
│ ├── add-webhooks/ ← workspace: isolated branches
│ │ ├── backend/ ← worktree on branch "add-webhooks"
│ │ ├── infra/ ← worktree on branch "add-webhooks"
│ │ ├── CLAUDE.md ← symlink to root
│ │ └── .claude/ ← copied config
│ └── redesign-feed/
│ ├── frontend/ ← worktree on branch "redesign-feed"
│ ├── CLAUDE.md
│ └── .claude/
├── task-new.sh
├── task-done.sh
├── repos.conf
└── CLAUDE.md
You can run as many workspaces as you want simultaneously. Each gets its own branches, so there are no conflicts.
-
Place
task-new.shandtask-done.shin the root of your monorepo (alongside your repo directories). -
Create a
repos.conffile listing your repo directory names, one per line:
cp repos.conf.example repos.conf# repos.conf
backend
frontend
infra
- Make the scripts executable (they should already be):
chmod +x task-new.sh task-done.sh# Workspace with specific repos
./task-new.sh add-webhooks backend infra
# Workspace with all repos
./task-new.sh big-refactorThis creates tasks/add-webhooks/ with a worktree per repo, each on a new branch called add-webhooks.
Open Claude Code in the workspace directory:
cd tasks/add-webhooks
claudeClaude Code picks up the symlinked CLAUDE.md and copied .claude/ config automatically.
# Remove the workspace, keep the branches (can resume later)
./task-done.sh add-webhooks
# Remove the workspace and delete the branches
./task-done.sh add-webhooks --delete-branches./task-done.sh
# prints usage + lists all active workspaces under tasks/- Bash 4+
- Git with worktree support (Git 2.5+)
Can I use this without Claude Code?
Yes. The worktree isolation is useful for any parallel development workflow. The CLAUDE.md symlink and .claude/ copy are no-ops if those files don't exist.
What happens if I forget to tear down a workspace?
Nothing bad. The worktrees and branches just stick around. Run task-done.sh whenever you're ready to clean up.
Can two workspaces include the same repo?
No — git worktrees require unique branches per repo. If workspace A already has backend on branch task-a, workspace B can't also create a backend worktree on branch task-b from the same source. Each workspace gets its own branch name, so this works naturally as long as task names are unique.
MIT