How worktrees work
When you start a new p0 session in worktree mode (the default):- Session starts - p0 creates a new git branch and worktree
- Worktree location - The worktree is stored at
~/.purple-code/worktrees/{workspaceName}-wt-{sessionId}/ - Symlinks created - Configuration directories (
purple/,.claude/,.mcp.json) are symlinked from your workspace - AI works isolated - p0 makes all changes in the worktree while your main branch stays clean
- Review and merge - When finished, you review the diff and merge or discard the changes
Branch naming
Worktree branches follow a consistent naming pattern:- Format:
{workspaceName}-wt-{hex} - Example:
my-app-wt-a3f2 - Alternative:
{adjective}-{animal}-{hex}(e.g.,swift-panda-7b3e)
Multi-repo worktrees
For workspaces containing multiple git repositories, p0 creates a worktree for each repo:- Purple configuration is shared across all repos
- Claude settings and context are consistent
- MCP tools remain accessible
Merging and discarding
When your session is complete, you have two options: Merge the changes:- Review the diff in p0’s session interface
- Approve the changes
- p0 merges the worktree branch into your target branch
- The worktree can be removed after merging
- Close the session without merging
- Delete the worktree branch
- The worktree directory can be cleaned up
Local mode
While worktree mode is recommended and set as the default, you can also configure p0 to work directly in your project directory using local mode. In local mode, changes are made directly to your working directory without worktree isolation.To use local mode, change the work mode setting from “worktree” to “local” in your session configuration.