[BUG] creates `tmpclaude-*-cwd` files in the current 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?
Claude Code 2.1.5 creates tmpclaude-*-cwd files in the current working directory instead of /tmp. These files are never cleaned up and accumulate in project directories.
What Should Happen?
This appears to be a regression from the original issue #8856, where files were created in /tmp/claude-*-cwd. Now they are created directly in the working directory with a different naming pattern (tmpclaude-*-cwd).
Error Messages/Logs
Steps to Reproduce
- Start Claude Code in a project directory
- Execute several bash commands
- Check the working directory for
tmpclaude-*-cwdfiles
Claude Model
Opus
Is this a regression?
No, this never worked
Last Working Version
No response
Claude Code Version
2.1.5
Platform
Anthropic API
Operating System
Windows
Terminal/Shell
PowerShell
Additional Information
No response
Found 2 possible duplicate issues:
- https://github.com/anthropics/claude-code/issues/17589
- https://github.com/anthropics/claude-code/issues/17568
This issue will be automatically closed as a duplicate in 3 days.
- If your issue is a duplicate, please close it and 👍 the existing issue instead
- To prevent auto-closure, add a comment or 👎 this comment
🤖 Generated with Claude Code
Additional reproduction data:
- Claude Code version: 2.1.5
- OS: Windows 11
- Shell: Git Bash
- Files accumulated: 119
tmpclaude-*-cwdfiles - Time period: Single session (~2.5 hours)
- Location: Project working directory (not
%TEMP%) - File contents: Unix-style path (e.g.,
/d/repos/organization/pot/pineapple)
Timestamps show files created throughout the session (19:08-21:31) correlating with Bash tool invocations. Files persist after session ends.
This appears to be the same root cause as #8856 (missing unlinkSync after reading the temp file), with the Windows variant incorrectly placing files in CWD instead of the system temp directory.
https://github.com/anthropics/claude-code/issues/17568#issuecomment-3736945382
even a empty directory will creat these rubish
I am also experiencing this
I am also experiencing same really annoying
yes, same issue.
Same issue here
+1
+1
+1
+1
+1
+1
PS C:\Users\USER\DIR_FHE> ls .\tmpclaude-*-cwd ; git status -s
Directory: C:\Users\USER\DIR_FHE
Mode LastWriteTime Length Name
-a---- 2026-01-12 14:22 30 tmpclaude-020b-cwd -a---- 2026-01-12 14:22 30 tmpclaude-06ae-cwd -a---- 2026-01-12 15:20 30 tmpclaude-0903-cwd -a---- 2026-01-12 14:43 30 tmpclaude-0d70-cwd -a---- 2026-01-12 14:35 30 tmpclaude-149c-cwd -a---- 2026-01-12 14:44 30 tmpclaude-25d9-cwd -a---- 2026-01-12 15:57 30 tmpclaude-2630-cwd -a---- 2026-01-12 14:33 30 tmpclaude-2787-cwd -a---- 2026-01-12 15:31 30 tmpclaude-324f-cwd -a---- 2026-01-12 14:33 30 tmpclaude-32b3-cwd -a---- 2026-01-12 14:43 30 tmpclaude-41fa-cwd -a---- 2026-01-12 15:31 30 tmpclaude-4e36-cwd -a---- 2026-01-12 14:41 30 tmpclaude-69e6-cwd -a---- 2026-01-12 14:31 30 tmpclaude-6cf5-cwd -a---- 2026-01-12 14:26 30 tmpclaude-779d-cwd -a---- 2026-01-12 14:43 30 tmpclaude-7ad2-cwd -a---- 2026-01-12 14:41 30 tmpclaude-828f-cwd -a---- 2026-01-12 15:53 30 tmpclaude-8de4-cwd -a---- 2026-01-12 15:20 30 tmpclaude-97cb-cwd -a---- 2026-01-12 14:26 30 tmpclaude-9c5a-cwd -a---- 2026-01-12 14:43 30 tmpclaude-b4a6-cwd -a---- 2026-01-12 14:31 30 tmpclaude-c026-cwd -a---- 2026-01-12 14:41 30 tmpclaude-cdc3-cwd -a---- 2026-01-12 14:34 30 tmpclaude-dc22-cwd -a---- 2026-01-12 14:43 30 tmpclaude-e9ed-cwd -a---- 2026-01-12 14:43 30 tmpclaude-f4c4-cwd
?? tmpclaude-020b-cwd ?? tmpclaude-06ae-cwd ?? tmpclaude-0903-cwd ?? tmpclaude-0d70-cwd ?? tmpclaude-149c-cwd ?? tmpclaude-25d9-cwd ?? tmpclaude-2630-cwd ?? tmpclaude-2787-cwd ?? tmpclaude-324f-cwd ?? tmpclaude-32b3-cwd ?? tmpclaude-41fa-cwd ?? tmpclaude-4e36-cwd ?? tmpclaude-69e6-cwd ?? tmpclaude-6cf5-cwd ?? tmpclaude-779d-cwd ?? tmpclaude-7ad2-cwd ?? tmpclaude-828f-cwd ?? tmpclaude-8de4-cwd ?? tmpclaude-97cb-cwd ?? tmpclaude-9c5a-cwd ?? tmpclaude-b4a6-cwd ?? tmpclaude-c026-cwd ?? tmpclaude-cdc3-cwd ?? tmpclaude-dc22-cwd ?? tmpclaude-e9ed-cwd ?? tmpclaude-f4c4-cwd
Confirming this issue on Windows 11 with Claude Code 2.1.5.
Additional observation: Setting CLAUDE_CODE_TMPDIR environment variable (added in 2.1.5 per the changelog) does NOT redirect these -cwd files. They continue to be created in the project's working directory regardless of the env var setting.
Workaround: Adding tmpclaude-* to .gitignore hides them from git status, but doesn't prevent their creation in the project directory.
+1
+1
+1
+1
Additional reproduction data:
Claude Code version: 2.1.5 OS: Windows 11 Model: Tried on other model such as GLM 4.7
So i believe this is pure claude code issue.