Workspace Worktree
Manage git worktrees for workitems. Provides deterministic creation, removal, and status of worktrees so the LLM doesn't need to run git commands directly.
Usage
bash
# Create worktrees for a workitem
bash <skill-path>/scripts/worktree.sh create {type}/{name} {repo1} {repo2} ...
# Remove worktrees for a workitem
bash <skill-path>/scripts/worktree.sh remove {type}/{name}
# Show worktree status for a workitem
bash <skill-path>/scripts/worktree.sh status {type}/{name}
Commands
create
Creates the worktree structure for a workitem:
- •Creates branch
{type}/{name}in each specified repo underrepos/ - •Creates
worktrees/{type}/{name}/directory - •Runs
git worktree addfor each repo intoworktrees/{type}/{name}/{repo}/ - •Installs dependencies in each worktree (detects package manager from lockfile)
- •Verifies build passes in each worktree (if build process is available)
- •Writes the worktree path to
.claude/workitems/{type}/{name}/worktree.path
If a branch already exists, it reuses it. If a worktree already exists, it skips it.
remove
Cleans up worktrees for a completed or abandoned workitem:
- •Runs
git worktree removefor each repo worktree - •Removes the
worktrees/{type}/{name}/directory - •Optionally deletes the branches (prompts unless
--forceis passed)
status
Shows the current state of worktrees for a workitem:
- •Which repo worktrees exist
- •Branch name and status (clean/dirty, ahead/behind)
- •Whether dependencies are installed