Windows: tmpclaude-*-cwd temp files not being cleaned up
Description
Claude Code is creating tmpclaude-XXXX-cwd temporary files in the working directory but not cleaning them up when sessions end. These files accumulate rapidly on Windows.
Environment
- OS: Windows 10/11 (MSYS/Git Bash)
- Claude Code version: Latest (as of Jan 2025)
Steps to Reproduce
- Run Claude Code from any directory on Windows
- End the session normally
- Check the directory -
tmpclaude-XXXX-cwdfiles remain
Observed Behavior
- ~500 temp files accumulated over ~2 days of normal usage
- Files are 1KB each, named
tmpclaude-XXXX-cwd(where XXXX is a hex string) - Files are created in whatever directory Claude Code is launched from
- Files are NOT cleaned up when sessions end
- New files created with each session
Expected Behavior
These temp files should be automatically deleted when the Claude Code session ends, or should be created in a proper temp directory (%TEMP%) rather than the working directory.
Impact
At the rate of accumulation (~70+ files per day with moderate usage), this quickly clutters working directories and requires manual cleanup.
Workaround
Manual cleanup with:
find /path -name "tmpclaude-*-cwd" -type f -exec rm {} \;
Additional Context
This appears to be Windows-specific - the cleanup mechanism that likely works on macOS/Linux may be failing silently on Windows due to path handling differences or file locking behavior.
This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗