[Bug] Claude reads from main repo path instead of git worktree when memory namespace matches main repo
Bug Description
Claude reads from main repo path instead of git worktree when memory namespace matches main repo
When Claude Code is launched from a git worktree (e.g. ~/code/starburst-enterprise/tmp-cli), the session's Primary working directory correctly reflects the worktree path. However, the memory namespace is named after the main repo root (e.g. -starburst-enterprise), and Claude
incorrectly uses the memory namespace path to infer file locations rather than the Primary working directory from the session context.
Steps to reproduce:
- Have a git repo at ~/repos/main-repo
- Create a worktree at ~/repos/main-repo-worktree
- Launch claude from within the worktree
- Ask Claude to read a file — it attempts to read from ~/repos/main-repo instead
Expected: Claude uses Primary working directory (the worktree path) for all file operations.
Actual: Claude uses the memory directory name (derived from the main repo path) to construct file paths.
Workaround: User must explicitly correct Claude; it then works correctly for the rest of the session.
Environment Info
- Platform: darwin
- Terminal: tmux
- Version: 2.1.92
- Feedback ID: 816e00ab-5100-444e-8b51-78af20b0bba2
Errors
<i scrubbed this manually since there was no relevant content here>
Note: Content was truncated.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗