create-worktree
June 11, 2026 ยท View on GitHub
Purpose
Create a new branch and linked Git worktree for isolated or parallel work without changing the current checkout.
Usage
/create-worktree <issue-or-change|type description> [<target-path>] [<base-reference>]
Accepted Inputs
- An issue/change identifier, or an explicit branch type and description
- Optional target path
- Optional base reference
- Supported branch types:
feat,fix,docs,refactor, andchore
Owning Agent
@robot-tech-lead
Associated Capabilities
- Git branch naming and validation
- Git linked worktrees
- Parallel OpenSpec child-change coordination
Workflow
- Resolve the branch name from the issue/change identifier or explicit branch details.
- Resolve an absolute target path and the base reference.
- Resolve the repository default branch and the current branch.
- Verify the current checkout is
mainor the repository default branch before creating the worktree branch. - If the current branch is not
mainor the default branch, stop and ask whether to switch to the default branch, choose a different base, or continue explicitly from the current branch. - Verify the repository, base reference, branch name, and target path are available.
- Verify the branch is not already checked out in another worktree.
- Run the equivalent of
git worktree add -b <branch> <target-path> <base-reference>. - Report the created branch, absolute worktree path, and base reference.
Output
- Created local branch
- Created linked worktree
- Exact branch name, absolute path, and base reference
Safeguards
- Stop if the branch exists, is already checked out, or the target path exists.
- Stop and ask when the current branch is not
mainor the repository default branch. - Stop if the base reference is invalid.
- Leave existing branches, worktrees, directories, and files unchanged on conflict.
- Do not commit, push, remove worktrees, delete branches, or use force.