[Bug] Subagents default to bare repo root instead of current worktree directory

Resolved 💬 3 comments Opened Apr 7, 2026 by rickdunkin Closed May 19, 2026

Bug Description
Bug: Subagents default to bare repo root instead of current worktree directory

When working in a git bare repo setup with worktrees (e.g., repo.git/ + worktrees/main/), subagents (Explore, Plan, etc.) appear to resolve their starting directory from git metadata rather than inheriting the current working directory. This causes them to start in the bare repo root where no source files exist, leading to failed searches and missed project context (CLAUDE.md, source files, etc.).

Setup:

  • Bare repo: /path/to/project/repo.git
  • Worktrees: /path/to/project/worktrees/main/, /path/to/project/worktrees/feature-branch/, etc.
  • Claude Code launched from a worktree directory

Expected: Subagents start in the same working directory as the parent session (the worktree).

Actual: Subagents appear to resolve to the bare repo root or git common directory, where no working tree files exist.

Workaround: Explicitly include the worktree path in the subagent prompt.

Environment Info

  • Platform: darwin
  • Terminal: ghostty
  • Version: 2.1.92
  • Feedback ID: c0edbec4-e3a3-414b-a92e-aa90a532055e

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗