Summary
The /worktree skill creates worktrees at Claude Code's native in-repo location (.claude/worktrees/<name>). Working inside such a nested worktree triggers a confirmed, unfixed Claude Code bug that double-loads CLAUDE.md + .claude/rules/ (~26K wasted input tokens per message). The skill should create worktrees out-of-tree to avoid it.
Component
plugins/source-control/skills/worktree/context/create.md (currently calls EnterWorktree, which lands in .claude/worktrees/).
Evidence
- Upstream, confirmed & unfixed: anthropics/claude-code #29599 ("Worktree rules loaded twice", closed as duplicate) and #23565 ("Memory files loaded twice in worktree", closed not-planned). Mechanism: a worktree at
.claude/worktrees/<n> is physically inside the parent repo; CC's upward walk from the worktree discovers both the worktree root and the parent repo root (shared .git), loading rules/memory twice. Reported waste ~12–26K tokens/message.
- Related:
.claude/worktrees/ is not auto-excluded and adding it to .gitignore breaks git worktree add in future clones (#57512 — use .git/info/exclude); worktree .claude/ is missing skills/agents/rules/ (#28041).
- A sibling/external worktree (not nested under the parent repo) is not an ancestor of the parent, so the upward walk does not hit the parent → the double-load does not occur. Out-of-tree placement sidesteps the bug entirely.
Expected
/worktree create places worktrees out-of-tree (via the shared helper / external root), not under .claude/worktrees/, so the double-load bug never triggers.
Acceptance criteria
Part of / depends on
Epic #398; implemented via the shared helper in the unify issue.
Summary
The
/worktreeskill creates worktrees at Claude Code's native in-repo location (.claude/worktrees/<name>). Working inside such a nested worktree triggers a confirmed, unfixed Claude Code bug that double-loadsCLAUDE.md+.claude/rules/(~26K wasted input tokens per message). The skill should create worktrees out-of-tree to avoid it.Component
plugins/source-control/skills/worktree/context/create.md(currently callsEnterWorktree, which lands in.claude/worktrees/).Evidence
.claude/worktrees/<n>is physically inside the parent repo; CC's upward walk from the worktree discovers both the worktree root and the parent repo root (shared.git), loading rules/memory twice. Reported waste ~12–26K tokens/message..claude/worktrees/is not auto-excluded and adding it to.gitignorebreaksgit worktree addin future clones (#57512 — use.git/info/exclude); worktree.claude/is missingskills/agents/rules/(#28041).Expected
/worktree createplaces worktrees out-of-tree (via the shared helper / external root), not under.claude/worktrees/, so the double-load bug never triggers.Acceptance criteria
/worktree createno longer produces in-repo.claude/worktrees/worktrees for ghq/normal repos..git/info/excludeguidance if any in-repo path remains for a fallback.Part of / depends on
Epic #398; implemented via the shared helper in the unify issue.