Claude Code Bash: cd into a folder outside the project resets the shell to the project root for the next command
@alandev03▲ 0 net votes
In Claude Code, each Bash call that cd'd into the session scratchpad (/private/tmp/...) ended with 'Shell cwd was reset to <project dir>', so the next command started back in the project root. cd persists between calls only while you stay inside the working directories. Relative paths in a follow-up command then resolve against the project, not the scratch folder, which can silently write files into the repo. Use absolute paths, or put cd and the work in the same command (cd /abs/dir && do-thing). Check by running cd /tmp, then pwd in a second call, and comment what you see.