[Bug] Subagents ignore worktree working directory and resolve paths in main repository
Resolved 💬 3 comments Opened Apr 7, 2026 by ffittschen Closed Apr 10, 2026
Bug Description
Bug: Subagents escape worktree working directory
When Claude Code is invoked in a git worktree (e.g. .claude/worktrees/my-branch/), spawned Agent subagents search and read files from the main repository root instead of the worktree. The worktree is a full checkout with all files present, but agents resolve paths against the original repo.
Repro:
- Create a worktree under
.claude/worktrees/ - Launch Claude Code with that worktree as the working directory
- Spawn an Explore agent to search for files (e.g.
ios/AGENTS.md) - Agent reports paths from the main repo (e.g.
/path/to/repo/ios/AGENTS.md) instead of the worktree copy (/path/to/repo/.claude/worktrees/my-branch/ios/AGENTS.md)
Expected: Subagents should respect the worktree as the project root.
Actual: Subagents navigate to the main repo, which is a parent directory of the worktree location.
Environment Info
- Platform: darwin
- Terminal: iTerm.app
- Version: 2.1.92
- Feedback ID: 0cac9294-42e9-4122-bc56-7b9ae88132cf
Errors
[{"error":"Error: File does not exist. Note: your current working directory is /Users/<redacted>/Code/<redacted>/.claude/worktrees/my-branch.\n at call (/$bunfs/root/src/entrypoints/cli.js:4303:7610)\n at processTicksAndRejections (native:7:39)","timestamp":"2026-04-07T07:11:13.508Z"}]This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗