[BUG] Claude cannot change directory, not even navigating to subdirectories
Environment
- Platform (select one):
- [ ] Anthropic API
- [ ] AWS Bedrock
- [ ] Google Vertex AI
- [x] Other: Claude code using my claude max subscription
- Claude CLI version: 1.0.27
- Operating System: Fedora 40
- Terminal: kitty
Bug Description
Claude code is not able to change directory using its Bash tool.
If my claude does something like cd sample && go mod tidy it won't work because ANY cd command silently fails (or at least it doesn't complain and the next command gets executed) or rather cwd never gets changed.
In fact I had my claude code run pwd and then cd sample && pwd and the directory was still the same.
Steps to Reproduce
- open claude code in a terminal with zsh as the shell
- tell claude to cd into the directory and check pwd, it'll still be in the root of the project even after cd gets executed "successfully"
Expected Behavior
Claude changes current directory
Actual Behavior
The current directory always remains the same (root of the project/workspace)
Additional Context
use pwd here, create a subdirectory, then cd into it and use pwd again and report back; did it work or are you still in the root of the workspace?
● Bash(pwd)
⎿ /home/user/Documents/claude-test
● Bash(mkdir test-subdir)
⎿ (No content)
● Bash(cd test-subdir && pwd)
⎿ /home/user/Documents/claude-test
● The cd command didn't work as expected - I'm still in the root workspace directory /home/user/Documents/claude-test even after the chained command.
can you try to first cd and then use pwd without chaining
● Bash(cd test-subdir)
⎿ (No content)
● Bash(pwd)
⎿ /home/user/Documents/claude-test
● Still in the root workspace directory. The cd command doesn't persist between separate Bash tool calls - each call starts fresh from the original working directory.
UPDATE:
I am normally using zsh with a few plugins, so I thought let's try and switch to using plain bash instead as a shell in which I run claude, and if I do that it works correctly.
UPDATE 2:
I tried to open claude and test this again in a fresh zsh shell without configs nor plugins and it still doesn't work. It looks like zsh is the culprit.
This issue has 10 comments on GitHub. Read the full discussion on GitHub ↗