원클릭으로
worktree
Manage git worktrees for parallel Claude Code development sessions
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
메뉴
Manage git worktrees for parallel Claude Code development sessions
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
SOC 직업 분류 기준
Add files and frameworks to Xcode projects programmatically
Post to Slack channels and manage Trello cards with natural language
Manage UnaMentis services via USM API (never via bash kill commands)
Pre-commit validation ensuring lint and tests pass
Configure MCP session defaults for different project components
Perform a code review on recent changes
| name | worktree |
| description | Manage git worktrees for parallel Claude Code development sessions |
Manages isolated development environments using git worktrees. Each worktree provides a separate working directory for independent Claude Code sessions, enabling 2-4 parallel development tasks.
Key Benefit: Complete file isolation between parallel tasks. No stashing or branch switching needed.
Git worktrees solve the problem of context switching during parallel development:
| Without Worktrees | With Worktrees |
|---|---|
git stash before switching branches | Each branch in its own directory |
| Risk of losing uncommitted work | Work preserved in each worktree |
| One task at a time | 2-4 tasks truly in parallel |
| Must wait for builds to finish | Each worktree builds independently |
| Single Claude Code session | Multiple independent sessions |
How it works: All worktrees share the same .git repository data (commits, branches, history) but have separate working directories. This means:
git fetch| Scenario | Recommendation |
|---|---|
| Working on feature while reviewing PR | Create worktree for review |
| Bug fix needed while mid-feature | Create worktree for fix |
| Experimenting with risky changes | Create worktree for experiment |
| Running long build while coding | Build in one worktree, code in another |
| Multiple related tasks for sprint | One worktree per task |
/worktree list # List all worktrees with status
/worktree create <name> # Create worktree with inferred branch
/worktree create <name> <branch> # Create worktree for existing branch
/worktree open <name> # Reopen worktree in VS Code
/worktree remove <name> # Remove worktree (with safety checks)
/worktree status # Show current worktree context
/worktree cleanup # Clean DerivedData from inactive worktrees
Worktrees are created as siblings to the main repo with unamentis-<name> naming:
/Users/ramerman/dev/
├── unamentis/ # Main repo
├── unamentis-kb-feature/ # Worktree: /worktree create kb-feature
└── unamentis-fix-crash/ # Worktree: /worktree create fix-crash
/worktree listgit worktree list -v*)Commands:
git worktree list -v
# For each worktree path, check DerivedData:
du -sh <worktree>/DerivedData 2>/dev/null
/worktree create <name> [branch]fix-* → fix/<rest> (e.g., fix-crash → fix/crash)feat-* or feature-* → feature/<rest>docs-* → docs/<rest>refactor-* → refactor/<rest>test-* → test/<rest>feature/<name>unamentis)git worktree add -b <branch> ../<repo>-<name>
# Or for existing branch:
git worktree add ../<repo>-<name> <branch>
code ../<repo>-<name>
/mcp-setup ios in the new session"/worktree open <name>../<repo>-<name>code ../<repo>-<name>
/mcp-setup ios/worktree remove <name>Check for uncommitted changes:
cd ../<repo>-<name> && git status --porcelain
If dirty, warn and ask for confirmation.
Check for unpushed commits:
cd ../<repo>-<name> && git log @{u}..HEAD --oneline 2>/dev/null
If ahead of remote, warn and ask for confirmation.
Remove worktree:
git worktree remove ../<repo>-<name>
git worktree prune -v
/worktree statusgit rev-parse --is-inside-work-tree
cat .git # If file (not dir), this is a worktree
/worktree cleanupfor wt in $(git worktree list --porcelain | grep "^worktree" | cut -d' ' -f2); do
if [ -d "$wt/DerivedData" ]; then
du -sh "$wt/DerivedData"
fi
done
rm -rf <worktree>/DerivedData
Create worktree for a feature:
User: /worktree create kb-improvements
Claude: Creating worktree for parallel development...
Branch: feature/kb-improvements (inferred from name)
Path: /Users/ramerman/dev/unamentis-kb-improvements/
✓ Worktree created
✓ Opening in VS Code...
New window opened. Run /mcp-setup ios in the new session to configure MCP.
Create worktree for a bug fix:
User: /worktree create fix-answer-validation
Claude: Creating worktree for parallel development...
Branch: fix/answer-validation (inferred from 'fix-' prefix)
Path: /Users/ramerman/dev/unamentis-fix-answer-validation/
✓ Worktree created
✓ Opening in VS Code...
New window opened. Run /mcp-setup ios in the new session.
Create worktree for existing branch:
User: /worktree create review feature/knowledge-bowl-2
Claude: Creating worktree for parallel development...
Branch: feature/knowledge-bowl-2 (existing)
Path: /Users/ramerman/dev/unamentis-review/
✓ Worktree created
✓ Opening in VS Code...
New window opened. Run /mcp-setup ios in the new session.
List all worktrees:
User: /worktree list
Claude: Git Worktrees:
* /Users/ramerman/dev/unamentis (main) ← current
/Users/ramerman/dev/unamentis-kb-ui (feature/kb-ui)
DerivedData: 2.3 GB
/Users/ramerman/dev/unamentis-fix-crash (fix/crash)
DerivedData: 1.8 GB
Total: 3 worktrees, 4.1 GB DerivedData
Check current status:
User: /worktree status
Claude: Worktree Status:
Location: /Users/ramerman/dev/unamentis-kb-ui (worktree)
Branch: feature/kb-ui
Main repo: /Users/ramerman/dev/unamentis
Sibling worktrees:
- unamentis-fix-crash (fix/crash)
Remove a worktree:
User: /worktree remove kb-ui
Claude: Checking worktree status...
⚠️ Warning: 2 uncommitted changes detected
⚠️ Warning: 3 commits not pushed to remote
Are you sure you want to remove unamentis-kb-ui? (This cannot be undone)
[After confirmation]
✓ Worktree removed
✓ Stale references pruned
Clean up DerivedData:
User: /worktree cleanup
Claude: Checking DerivedData in worktrees...
Worktrees with DerivedData:
- unamentis-kb-ui: 2.3 GB (inactive)
- unamentis-fix-crash: 1.8 GB (inactive)
Clean DerivedData from inactive worktrees? (4.1 GB)
[After confirmation]
✓ Cleaned 4.1 GB from 2 worktrees
Here's a complete example of parallel development with 3 tasks:
# In main repo, check current worktrees
/worktree list
Git Worktrees:
* /Users/ramerman/dev/unamentis (main) ← current
Total: 1 worktree
# Task 1: Knowledge Bowl UI improvements
/worktree create kb-ui
# Task 2: Fix answer validation bug
/worktree create fix-validation
# Task 3: Add regional config feature
/worktree create kb-regional
You now have 4 VS Code windows (main + 3 worktrees).
In each new VS Code window:
/mcp-setup ios
Each Claude Code session works independently:
When a task is complete:
# In the worktree, push the branch
git push -u origin feature/kb-ui
# Create PR (from any worktree)
gh pr create
# After PR is merged, remove worktree
/worktree remove kb-ui
# Check disk usage
/worktree list
# Clean up build artifacts from inactive worktrees
/worktree cleanup
/mcp-setup ios in each new worktree session to configure MCPCLAUDE.md is shared (read from the repo, same across all worktrees)Each worktree accumulates its own build artifacts:
| Artifact | Typical Size | Location |
|---|---|---|
| Xcode DerivedData | 2-5 GB | <worktree>/DerivedData/ |
| node_modules | 500 MB - 2 GB | <worktree>/server/*/node_modules/ |
| Cargo target | 500 MB - 1 GB | <worktree>/server/usm-core/target/ |
With 3-4 active worktrees, this can consume 10-20 GB. Use /worktree cleanup regularly.
You cannot have the same branch checked out in multiple worktrees. Solutions:
/worktree openThe worktree directory may have been manually deleted. Run:
git worktree prune -v
Then create a new worktree.
Ensure VS Code CLI is in your PATH:
which code
# Should return: /usr/local/bin/code or similar
If not found, open VS Code and run "Shell Command: Install 'code' command in PATH" from the command palette.
Run /mcp-setup ios in each new worktree session. MCP connections are per-session, not shared.
If a worktree's parent repo was moved, repair the reference:
git worktree repair
Run /worktree cleanup to remove DerivedData from inactive worktrees. For more aggressive cleanup:
# Remove all DerivedData across all worktrees
for wt in $(git worktree list --porcelain | grep "^worktree" | cut -d' ' -f2); do
rm -rf "$wt/DerivedData"
done
Each branch can only be checked out in one worktree at a time. Use /worktree list to see which worktree has which branch.
# Git worktree commands (for reference)
git worktree add -b <branch> <path> # Create with new branch
git worktree add <path> <branch> # Create for existing branch
git worktree list -v # List all worktrees
git worktree remove <path> # Remove worktree
git worktree prune -v # Clean stale references
git worktree repair # Fix broken worktree references
/mcp-setup - Configure MCP for each worktree session/validate - Run before committing in any worktree/service - Services are shared across all worktrees (same ports)