[BUG] With --project-config-root (desktop worktree sessions), hook processes start in the config root, not the session cwd
What's wrong
The hooks docs say command hooks "run in the current directory with Claude Code's environment". When a session starts with --project-config-root <dir>, command hooks start with their process cwd set to <dir>, not the session's current directory. The cwd field in the hook input JSON is still the session directory.
Since 2026-09-30 the Claude desktop app passes --project-config-root <main checkout> to every worktree session, including worktrees made by a WorktreeCreate hook. So in every desktop worktree session, hooks run in the main checkout while Claude works in the worktree.
Plugin LSP servers have the same problem (#98538, which its author closed without a fix).
Why it matters
A hook that uses its process cwd (git without -C, relative paths from the tool input) checks the wrong checkout. Example: a PreToolUse guard on gh pr create runs git merge-base and diff checks against the main checkout's branch, not the branch being pushed. It blocks or passes the PR for the wrong reason. A relative --body-file body.md also fails to read.
Reading project settings, hooks and skills from the config root is fine. Only the process cwd is the problem.
Expected
Hook and LSP processes start in the session's current directory, as the docs state. --project-config-root only changes where project config is read from.
Other notes
- The flag is not in
--help, the docs or the changelog. There is no setting to turn it off in the desktop app. - Versions: Claude Code 2.1.284, Claude desktop 2.16120.0, Windows 11.
_Written by Claude Opus 5.5_
This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗