[BUG] Excessive tmpclaude-*-cwd temporary files being created in working directory
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?
Since a recent update, Claude Code is creating multiple tmpclaude-XXXX-cwd temporary files in the working directory during normal usage. These files appear to be created on almost every command/interaction.
Environment:
- OS: Windows 10/11
- Claude Code version: (latest)
- Shell: Git Bash / PowerShell
Steps to reproduce:
- Open Claude Code in a project directory
- Execute several commands (e.g., read files, run bash commands)
- Check the working directory
Expected behavior:
Temporary files should be cleaned up automatically after use, or stored in a system temp directory instead of the project folder.
Actual behavior:
Multiple tmpclaude-*-cwd files accumulate in the working directory:
tmpclaude-0148-cwd
tmpclaude-0b14-cwd
tmpclaude-131b-cwd
tmpclaude-817f-cwd
...
Each file contains the current working directory path (~42 bytes).
Workaround:
Adding tmpclaude-* to .gitignore prevents them from being tracked, but they still clutter the directory.
What Should Happen?
Suggestion:
These files should either be:
- Created in system temp directory ($TMPDIR or %TEMP%)
- Automatically cleaned up after each command
- Or stored in a hidden .claude folder
Error Messages/Logs
Steps to Reproduce
Steps to reproduce:
- Open terminal and navigate to any project directory
- Start Claude Code by running claude
- Ask Claude to clone a git repository:
"clone repo from https://github.com/example/repo.git"
- Ask Claude to read a file:
"read the package.json file"
- Ask Claude to run a bash command:
"run ls -la"
- After 3-5 interactions, run ls tmpclaude* in the project directory
- Observe multiple tmpclaude-XXXX-cwd files have been created and not cleaned up
Frequency: Files are created on nearly every tool invocation (Bash, Read, etc.), not just once per session.
Claude Model
Opus
Is this a regression?
Yes, this worked in a previous version
Last Working Version
_No response_
Claude Code Version
2.1.5
Platform
Anthropic API
Operating System
Windows
Terminal/Shell
Windows Terminal
Additional Information
_No response_
This issue has 5 comments on GitHub. Read the full discussion on GitHub ↗