Temporary files (tmpclaude-*-cwd) not cleaned up on exit (Windows)
Resolved 💬 3 comments Opened Feb 3, 2026 by Leo-Nan Closed Feb 7, 2026
Temporary files (tmpclaude-*-cwd) not cleaned up on exit (Windows)
Description
On Windows, Claude Code creates temporary files with the pattern tmpclaude-XXXX-cwd in the working directory to track the current working directory for bash sandbox operations. These files are not being cleaned up when exiting the session with /exit command.
Environment
- Platform: Windows (MINGW64_NT-10.0-26200)
- Shell: Git Bash / MINGW64
Steps to Reproduce
- Start Claude Code in a directory (e.g.,
D:\Desktop\wsp) - Run any bash command (this creates the temp file)
- Exit with
/exitcommand - Check the directory -
tmpclaude-XXXX-cwdfile still exists
Expected Behavior
The temporary file should be automatically deleted when the session ends normally via /exit.
Actual Behavior
The temporary file remains in the working directory. Over time, multiple sessions accumulate many orphaned temp files.
Example
$ ls tmpclaude-*
tmpclaude-9cba-cwd
tmpclaude-f29d-cwd
...
(40+ files accumulated over time)
File content is just the working directory path:
/d/Desktop/wsp
Possible Cause
The cleanup logic may not be handling Windows paths correctly, or the exit hook is not being triggered properly on Windows.
Workaround
Manually delete the files:
rm -rf ./tmpclaude-*This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗