[BUG] tmpclaude-*-cwd temp files not cleaned up, accumulate in project folder
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 creates temporary files with pattern tmpclaude-XXXX-cwd in the user's current working directory (project folder). These files:
- Are NOT automatically cleaned up when the session ends
- Accumulate over time (I found 25 files after several sessions)
- Are placed in the project root where they can be accidentally committed to git
Each file contains only the current working directory path:
/c/Projects/my-project-folder
Files found:
tmpclaude-0697-cwd
tmpclaude-0f7e-cwd
tmpclaude-1586-cwd
tmpclaude-3dd8-cwd
... (25 files total)
What Should Happen?
- Temp files should be stored in system temp folder (
%TEMP%on Windows,/tmpon Unix) or a dedicated Claude folder (~/.claude/tmp/) - Temp files should be automatically cleaned up when the session ends
- If cleanup fails, files should NOT be in a location where they can be accidentally committed to version control
- Or use a single file per project (reuse instead of creating new each session)
Error Messages/Logs
N/A - No error messages or warnings displayed. Files are created silently without any notification.
Steps to Reproduce
- Open PowerShell on Windows
- Navigate to project folder:
cd C:\Projects\your-project\app - Run Claude Code:
claude - Use Claude Code for coding tasks
- Check project folder:
dir tmpclaude-*-cwd - Observe: Multiple
tmpclaude-XXXX-cwdfiles created
Complete timeline from my observation (all on 12/01/2026):
| Time | Files Created |
|-------|---------------|
| 14:07 | 2 files |
| 14:08 | 2 files |
| 14:09 | 3 files |
| 14:29 | 1 file |
| 14:33 | 4 files |
| 14:34 | 3 files |
| 14:56 | 2 files |
| 14:57 | 1 file |
| 15:37 | 1 file |
| 15:38 | 2 files |
| 15:53 | 3 files |
| 15:54 | 1 file |
| Total | 25 files |
Key observations:
- 25 files created in ~1 hour 47 minutes
- Files created in bursts (up to 7 files within 1-2 minutes)
- Previous Claude Code usage did not produce these files
- All files contain only the working directory path
- Files are not automatically cleaned up
Claude Model
Opus
Is this a regression?
I don't know
Last Working Version
_No response_
Claude Code Version
v2.1.6
Platform
Anthropic API
Operating System
Windows
Terminal/Shell
PowerShell
Additional Information
Workaround
Users need to:
- Manually delete:
del tmpclaude-*-cwd(Windows) orrm tmpclaude-*-cwd(Unix) - Add to
.gitignore:tmpclaude-*-cwd
Suggested Fix
- Move temp file location to system temp folder or
~/.claude/ - Implement cleanup on session end
- Use a single file per project (reuse instead of creating new each session)
- Or eliminate the need for this file entirely if possible
Impact
- Security risk: None (only contains path, no sensitive data)
- UX issue: Medium (confusing, clutters project folder)
- Potential problem: Accidental commits to git
Thank you for the great product!
This issue has 13 comments on GitHub. Read the full discussion on GitHub ↗