Worktrees & Isolation
When Genie creates a team, it provisions an isolated copy of the repository so agents can work on different branches without conflicts. Understanding this isolation model is important for debugging file paths and cleanup.Isolation Model
Genie usesgit clone --shared instead of git worktree for team isolation.
Why Not git worktree?
A known bug in Claude Code can flipcore.bare=true on the parent repository via shared .git metadata when using standard git worktrees. This silently corrupts the parent repo, making all worktrees non-functional.
git clone --shared creates a full clone that shares object storage with the parent (saving disk space) but has its own .git directory — safe from metadata corruption.
How It Works
Directory Structure
Shared vs. Independent State
| State | Shared? | Why |
|---|---|---|
Wish state (.genie/state/) | Shared | All agents on same wish need consistent state |
Mailbox (.genie/mailbox/) | Shared | Messages must be visible across all team members |
Team chat (.genie/chat/) | Per-worktree | Different worktrees may have different team contexts |
| Git objects | Shared (via --shared) | Saves disk space |
| Git refs/branches | Independent | Each worktree has its own branch |
Configuring the Base Directory
The worktree base directory defaults to~/.genie/worktrees/. Override it in config:
GENIE_HOME to relocate everything:
Path Resolution
When a team is created, the worktree path is computed as:- Repo:
/home/user/projects/my-api - Team:
feat/auth-fix - Result:
~/.genie/worktrees/my-api/feat--auth-fix
Team Config File
Each team stores its full configuration at~/.genie/teams/<safe-name>.json:
Cleanup
Disbanding a Team
- The team config file (
~/.genie/teams/auth-fix.json) - All worker registry entries for team members
- tmux windows/panes for team agents
- Native team directory (
~/.claude/teams/auth-fix/)
Cleaning Up Orphaned Worktrees
If worktrees accumulate from disbanded teams, clean them up:Worktree Gotchas
- Worktrees share
.genie/state viagit rev-parse --git-common-dir. Changes to wish state in one worktree are visible in all others for the same repo. - Team name IS the branch name — conventional prefixes (
feat/,fix/,chore/) are required. - The
--sharedflag means git objects are hardlinked. Deleting the parent repo’s objects can break worktrees. Don’t rungit gc --pruneon the parent while worktrees exist.