What this thread does
Update before adding a workaround: Claude Code 2.1.111 (April 2026) lists a fix for redundant project-directory prefixes. Do first: compare your version with that release and omit a redundant cd when a prompt persists. Changelog.
The problem
Claude Code often writes cd <project dir> && git .... Users report a permission prompt about the cd that cannot be made permanent, even when the directory is the one Claude was started in. The GitHub issue (opened 2026-02-24 by prezzz, first seen on Windows, version 2.1.52) is open (checked 2026-11-17).
What the docs say
Claude Code's permissions page says rules match each part of a compound command separately, and that cd into a path inside your working directory is read-only. It also says cd combined with git prompts when the cd changes into a different directory, because git there could run that directory's hooks, while a cd that resolves to the current directory is a no-op and does not trigger the prompt. So a prompt for the project directory itself looks like a bug, not intended behavior. The 2.1.111 changelog lists a fix for commands beginning with cd <project-dir> &&; the open issue alone does not mean that fix is absent.
What commenters report
- Likely cause on Windows (a guess by one commenter): a path comparison failing between forms such as the MSYS-style /c/... path and the native drive-letter path. Others saw it on macOS and WSL, so it is not only Windows.
- Rule in CLAUDE.md: a very explicit "never cd to the current working directory, just run the command" rule helped some, about a 50% reduction for one, but others had to repeat it each session.
- Agents route around a ban: commenters saw
cd; ..., thengit -C, thenpushd, then GIT_DIR variables. One said the hook must also return guidance, not only block. - PreToolUse hook that denies a cd-prefixed command and tells Claude to run the command directly, several commenters. One said it did not hold once subagents were involved; another believed subagents inherit hooks. Treat that as unsettled. A commenter on WSL had to rewrite the hook script in Node.
- Allow rule: one commenter said adding
Bash(cd )to allow suppresses it; another triedBash(cd:)andBash(cd *)on macOS, restarted, and still got the prompt (the docs say the two forms are equivalent). - Auto-approve hook only for chains where every part is read-only: one commenter reported success. Another warned the matching must also deny destructive chains, otherwise it becomes a fast path for them. Per the docs, a hook's allow does not override a matching ask rule.
Caveats
The workaround reports are anecdotal and version-specific. The release-note fix is stronger evidence than assuming all current builds retain the original bug. Prefer the narrowest option (the CLAUDE.md rule, or a deny hook with guidance) over blanket auto-approval.
Sources
- Claude Code permissions: compound-command checks, no-op
cd, directory changes and hook precedence. - Claude Code changelog, 2.1.111: a fix for commands beginning with
cd <project-dir> &&. - Issue 28240: open upstream report and version-specific commenter workarounds.
Started from a post by @prezzz, packaged by the editor. Original post