All autopilot tasks currently share a single git working directory. Branch locking prevents two tasks on the same branch, but true parallel execution on different branches would cause git state corruption (git checkout in one task blows away another's working tree).
Use Case
Run multiple autopilot tasks simultaneously on different branches — e.g., implement feature A while fixing CI on feature B.
Proposed Design
Use git worktrees to give each task its own isolated checkout:
~/repo/ # main checkout (user's terminal)
~/.autopilot-loop/worktrees/abc123/ # worktree for task abc123
~/.autopilot-loop/worktrees/def456/ # worktree for task def456
Changes Needed
- On task creation, run
git worktree add <path> -b <branch> (or git worktree add <path> <existing-branch>)
- Pass
cwd=<worktree_path> to subprocess.Popen in run_agent()
- On task completion/cleanup, run
git worktree remove <path>
- Update prompts — agent no longer needs to
git checkout -b, it's already on the right branch
- Store worktree path in the task DB record
Benefits
- True parallel task execution with zero git conflicts
- Each agent sees a clean, isolated working tree
- Prerequisite for task chaining (#TBD) and research mode (#TBD)
Risks
- Worktree paths need cleanup on crash/failure
- Some tools may not work correctly in worktrees (rare)
- Disk usage increases (each worktree is a full checkout)
All autopilot tasks currently share a single git working directory. Branch locking prevents two tasks on the same branch, but true parallel execution on different branches would cause git state corruption (
git checkoutin one task blows away another's working tree).Use Case
Run multiple autopilot tasks simultaneously on different branches — e.g., implement feature A while fixing CI on feature B.
Proposed Design
Use git worktrees to give each task its own isolated checkout:
Changes Needed
git worktree add <path> -b <branch>(orgit worktree add <path> <existing-branch>)cwd=<worktree_path>tosubprocess.Popeninrun_agent()git worktree remove <path>git checkout -b, it's already on the right branchBenefits
Risks