Use Git Worktrees
Ensure an isolated workspace exists for feature work via git worktrees. Creates a worktree at the canonical location before any implementation. Single-repo work: <repo>/.worktrees/<name>/. Cross-repo or persistent: ~/.ai/worktrees/<name>/. Use at the start of any non-trivial feature or before executing implementation plans.
Contract
| Direction | Name | Type | Description |
|---|---|---|---|
| in | branch_name | string | The feature branch name (kebab-case). |
| in | base_branchoptional | string | The base branch to branch from. Defaults to main. |
| in | globaloptional | boolean | When true, place at ~/.ai/worktrees/ (cross-repo/persistent). Defaults to false. |
| out | worktree_path | string | Absolute path to the created worktree. |
- creates git worktree
- creates feature branch
System prompt fragment
Before starting feature work: (1) Determine the lifecycle — single-repo ephemeral →