[BUG] Claude Code loses track of working directory, wastes time with failing calls and pwd: add better tooling
Resolved 💬 2 comments Opened Dec 17, 2025 by corneliusroemer Closed Dec 17, 2025
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
Claude code often loses track of the current working directory.
In one step it changes directory with cd DIRNAME and then in the next bash call it wrongly assumes it's back in the root dir.
What Should Happen?
Claude code should never be wrong about the working directory it's in.
Somehow you don't add the current working directory properly to context. It shouldn't be hard to do this?
Error Messages/Logs
⏺ Now let me regenerate the Gradle lock file with the new Spring Boot 4.0 dependencies.
⏺ Bash(cd backend && rm gradle.lockfile && ./gradlew dependencies --write-locks) timeout: 3m 0s
⎿ Starting a Gradle Daemon (subsequent builds will be faster)
> Task :dependencies
… +452 lines (ctrl+o to expand)
⏺ Excellent! The lock file has been regenerated successfully. I can see that:
- Spring Boot 4.0.0 is active
- Spring Framework 7.0.1 is being used
- Jackson 2 compatibility is working (using com.fasterxml.jackson 2.20.1)
- Exposed 0.61.0 is unchanged
Now let's attempt to build the project.
⏺ Bash(cd backend && ./gradlew clean build --console=plain 2>&1 | head -300) timeout: 5m 0s
⎿ Error: Exit code 1
(eval):cd:1: no such file or directory: backend
⏺ Bash(pwd && ls -la | head -20)
⎿ /Users/cr/code/loculus/backend
total 208
drwxr-xr-x@ 29 cr staff 928 Dec 17 12:58 .
… +18 lines (ctrl+o to expand)
⏺ I'm already in the backend directory. Let me run the build.
⏺ Bash(./gradlew clean build --console=plain 2>&1 | head -300) timeout: 5m 0s
⎿ Running…
ctrl+b to run in background
Steps to Reproduce
Not sure it's easy to reproduce.
Claude Model
Sonnet (default)
Is this a regression?
Yes, this worked in a previous version
Last Working Version
_No response_
Claude Code Version
v2.0.71
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
iTerm2
Additional Information
_No response_
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗