Agent worktrees and branching
Branch protection
dev and main are protected. Work on feature/*, bugfix/*, hotfix/*, or chore/* branches and submit PRs to dev.
Worktree policy
- The primary checkout remains the canonical
devworkspace. - Use
scripts/worktree.sh create <type>/<branch-slug>to create implementation worktrees (feature,bugfix,hotfix, orchorefor<type>). - Never create a worktree for
devormain. - One branch maps to one worktree path at a time.
- Keep one active OpenSpec change scope per branch where possible.
- Create a dedicated virtual environment inside each worktree.
- Bootstrap Hatch once per new worktree with
hatch env create. - Run quick pre-flight checks from the worktree root with
hatch run smart-test-statusandhatch run contract-test-status.
Conflict avoidance
- Check
openspec/CHANGE_ORDER.mdbefore creating a new worktree. - Avoid concurrent branches editing the same
openspec/changes/<change-id>/directory. - Rebase frequently on
origin/dev. - Use
git worktree listto detect stale or incorrect attachments.