fix(using-git-worktrees): default to global worktree location to avoid CLAUDE.md double-loading#639
Conversation
…d CLAUDE.md double-loading\n\n- Prioritize global location (~/.config/superpowers/worktrees/<project>/) to avoid nested worktrees loading parent CLAUDE.md\n- Keep support for project-local worktrees when explicitly requested or already in use\n- Update quick reference, example workflow, and common mistakes to reflect new default\n- Closes obra#279
Uses ~/.config/superpowers/worktrees/<project>/ instead of project subdirectory to avoid CLAUDE.md double-loading from nested worktrees. Upstream PR: obra#639 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
mvanhorn
left a comment
There was a problem hiding this comment.
Summary
Clean change - defaulting to global worktree location to avoid CLAUDE.md double-loading makes sense. The priority reordering (CLAUDE.md > existing > global default > ask) is logical.
Findings
The existing ### For Global Directory safety section (line 88-90) is a one-liner: "No .gitignore verification needed - outside project entirely." Now that global is the default path, it might be worth expanding this in a follow-up to mention git worktree prune for cleaning stale refs - if a user deletes the global directory manually instead of using git worktree remove, the next git worktree add to the same path would fail with "already registered as a worktree."
One small inline suggestion on the Quick Reference table to mirror the "(verify ignored)" safety note the project-local rows have.
Recommendation
Looks good to merge. The suggestion is a minor improvement, not a blocker.
Review assisted by Claude Code
| | Both exist | Use `.worktrees/` | | ||
| | Neither exists | Check CLAUDE.md → Ask user | | ||
| | CLAUDE.md specifies location | Use that location | | ||
| | Global worktree dir exists | Reuse global location | |
There was a problem hiding this comment.
Consider adding a safety note parallel to the project-local rows' "(verify ignored)". If the user previously deleted the global worktree directory without git worktree remove, stale refs in .git/worktrees/ would cause git worktree add to fail.
| | Global worktree dir exists | Reuse global location | | |
| | Global worktree dir exists | Reuse global location (prune stale refs) | |
Problem
Project-local worktrees (
.worktrees/inside the repo) can cause nested worktrees to load both the worktree'sCLAUDE.mdand the parent repo'sCLAUDE.md, creating conflicting instructions.Closes #279
Solution
~/.config/superpowers/worktrees/<project-name>/Changes
Testing
Checklist