[BUG] creates `tmpclaude-*-cwd` files in the current working directory

Resolved 💬 72 comments Opened Jan 12, 2026 by seeper0 Closed Feb 18, 2026
💡 Likely answer: A maintainer (ashwin-ant, collaborator) responded on this thread — see the highlighted reply below.

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

  1. Start Claude Code in a project directory
  2. Execute several bash commands
  3. Check the working directory for tmpclaude-*-cwd files

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_

View original on GitHub ↗

72 Comments

github-actions[bot] · 6 months ago

Found 2 possible duplicate issues:

  1. https://github.com/anthropics/claude-code/issues/17589
  2. 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

misterpalmer · 6 months ago

Additional reproduction data:

  • Claude Code version: 2.1.5
  • OS: Windows 11
  • Shell: Git Bash
  • Files accumulated: 119 tmpclaude-*-cwd files
  • 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.

iverson333333 · 6 months ago

<img width="845" height="316" alt="Image" src="https://github.com/user-attachments/assets/b7774bb8-363d-4879-a6b8-8bd9e91d5f93" /> even a empty directory will creat these rubish

domNocrus · 6 months ago

I am also experiencing this

<img width="301" height="255" alt="Image" src="https://github.com/user-attachments/assets/b094636f-476e-454a-96b5-71284fe6b8e3" />

mudassar003 · 6 months ago

I am also experiencing same really annoying

wheeler88 · 6 months ago

yes, same issue.

jrolh · 6 months ago

Same issue here

cailleachzou · 6 months ago

+1

sriram-rach · 6 months ago

+1

literallytwo · 6 months ago

+1

calvincronin · 6 months ago

+1

LavelleUp · 6 months ago

+1

comdexxsolutionsllc · 6 months ago

+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

westjan · 6 months ago

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.

banga87 · 6 months ago

+1

Aguila321 · 6 months ago

+1

aryamurray · 6 months ago

+1

Babadinho · 6 months ago

+1

dw4n · 6 months ago

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.

glennawatson · 6 months ago

Still an issue with Claude 2.1.6

LightPowerman · 6 months ago

+1

pandemonium0225 · 6 months ago
  • 1
JoeSelfani · 6 months ago

+1

<img width="277" height="269" alt="Image" src="https://github.com/user-attachments/assets/093652d5-0944-4a13-901d-77dbf9db81a5" />

cailleachzou · 6 months ago

补充,很多时候会产生 空的 nul 文件,他甚至不能删除

<img width="1542" height="672" alt="Image" src="https://github.com/user-attachments/assets/e5e79499-adb2-4485-a7b6-4b0aec025117" />

Haleclipse · 6 months ago
补充,很多时候会产生 空的 nul 文件,他甚至不能删除 <img alt="Image" width="1542" height="672" src="https://private-user-images.githubusercontent.com/80539315/534941515-e5e79499-adb2-4485-a7b6-4b0aec025117.png?jwt=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3NjgyODY4NjIsIm5iZiI6MTc2ODI4NjU2MiwicGF0aCI6Ii84MDUzOTMxNS81MzQ5NDE1MTUtZTVlNzk0OTktYWRiMi00NDg1LWE3YjYtNGIwYWVjMDI1MTE3LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNjAxMTMlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjYwMTEzVDA2NDI0MlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWM3NjdkNjUyZGI3MTYwMWQyYzAwNmE3MmVlYzQ2MDBjY2I5ZTIxNWIyZDliM2VjMGE3YmVmOGVjNTlhNjM0MWImWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.0qprWEyvbTvJex3T9RO5O2oWSmQlcwgx4s199RTNxso">

我上面发了个脚本 修补此问题

Y-ASLant · 6 months ago

+1 不但有这个cwd 还有nul无法删除的文件

TomDDms · 6 months ago

+1

trivexis-labs · 6 months ago

+1

Y-ASLant · 6 months ago

<img width="841" height="733" alt="Image" src="https://github.com/user-attachments/assets/262c5fa6-0585-4973-ad75-af50e38e6aca" />
回收站已经满了

longerking · 6 months ago
lazwolf · 6 months ago

+1

Danylo-Boisan · 6 months ago

+1

mark-whelan · 6 months ago

+1

vmendes90 · 6 months ago

same issue

<img width="224" height="364" alt="Image" src="https://github.com/user-attachments/assets/d859c425-6e22-4e6f-b3df-b4c863a25767" />

hermannakruse · 6 months ago

+1 Confirming this issue on Windows 11.

Found 47 tmpclaude-*-cwd files accumulated across my project directories. Files persist after Claude Code sessions end and show as untracked in git.

Also found a nul file created in the working directory (related issue mentioned above).

Workaround: find . -name 'tmpclaude-*-cwd' -delete

veysiemrah · 6 months ago

+1

<img width="513" height="1215" alt="Image" src="https://github.com/user-attachments/assets/f25acb1b-9ce6-4223-abfc-a2848286bbc9" />

dankicode · 6 months ago

+1 Confirming this issue on Windows 11.

sujitn · 6 months ago

+1

sbonnell · 6 months ago

Same issue on windows 11. Had claude version 2.0.76 have now upgraded to 2.1.6 both versions exhibited the problem.

piodois · 6 months ago

+1

Azathoth88 · 6 months ago

Same problem

mariuszr2404 · 6 months ago

same problem

EmilMN · 6 months ago

same

ktsaiims · 6 months ago

+1

ARIFALIDAWOOD · 6 months ago

+1

jalalirs · 6 months ago

+1

Raundahl · 6 months ago

+1

MrAssel · 6 months ago

+1 version 2.1.7, windows 11

shauptmann · 6 months ago

+1 same

Dimonka2 · 6 months ago

+1. Same, but only in my C# project. All others do not have this issue yet.

UNUKyfmt · 6 months ago

+1

xMazaki · 6 months ago

+1 same

georgesedyankov · 6 months ago

+1 same on my machine

Y-ASLant · 6 months ago

v2.1.7 已修复..

marcu1es · 6 months ago

yes

scytaskin · 6 months ago

Also have this issue. Windows 11 - 2.1.7 (Claude Code)

timgu0 · 6 months ago

Hi! If it's still happening to you, do you mind sharing a screenshot of your claude --version number and the path of these tmp files? New files should be properly handled but you may need to manually delete the old tmp files.

iam-icare · 6 months ago

@timgu0 Same issue here - this is getting out of control

Environment:

  • OS: Windows 11
  • Claude version: 2.1.3 (updated on Jan 10th)
  • Claude CLI directory: C:\Users\raul_\.local\bin\claude.exe
  • Working directory: C:\Users\raul_\Dealy

Expected behavior:
Temporary working directory marker files should be created in:
C:\Users\raul_\AppData\Local\Temp\claude\c--Users-raul--Dealy\

Actual behavior:
Files are created in project root:
C:\Users\raul_\Dealy\tmpclaude-{hex}-cwd

Added to .gitignore to avoid polluting my repo but it's still polluting my project's directory tree

EDIT: Just updated my version to 2.1.7 and bug is still not resolved

<img width="608" height="336" alt="Image" src="https://github.com/user-attachments/assets/ff09ff17-cb97-42aa-8dfd-43d76d58b25d" />

))

seanGSISG · 6 months ago

any fix for this yet?

nshkrdotcom · 6 months ago

Confirming on Windows 11 + Git Bash with Claude Code v2.1.7.

Found 9 tmpclaude-*-cwd files in my working directory after a session. All contain Unix-style paths:

/c/Users/windo/projects/dotfiles_private/windows/setup_wsl

Files are 59 bytes each and persist after session ends.

Varietyz · 6 months ago

Temporary Workaround: Automated Cleanup

I've created an automated solution that cleans up these temp files automatically: tmpclaude-auto-cleanup

Quick Setup (30 seconds)

Just copy the prompt from CLAUDE_PROMPT.md and paste it into Claude Code. Claude will configure everything automatically.

What It Does

  • Session Start Cleanup: Runs automatically when you start Claude Code
  • On-Save Cleanup: (Optional) Runs on every file save in VSCode
  • Cross-Platform: Works on Linux, macOS, Windows
  • Git Ignore: Prevents temp files from showing in git status

Manual Setup

Full instructions and manual configuration files available in the repo.

---

Note: This is a workaround until the core issue is fixed in Claude Code CLI. The real bug still needs to be addressed by Anthropic.

iam-icare · 6 months ago

@timgu0 - any ETA from your end guys to resolve this ? Cheers

arun279 · 5 months ago

Seeing the same issue

<img width="681" height="490" alt="Image" src="https://github.com/user-attachments/assets/c9e4e62b-45af-4c47-8f93-83dc9f080a37" />

jibrilsharafi · 5 months ago

Also happening in VS Code with Claude agent handoff.

rushjam · 5 months ago

It's also happening when GitHub Copilot delegate sessions to Claude Code in VS Code.

ashwin-ant collaborator · 4 months ago

Will be fixed in an upcoming release!

marcindulak · 4 months ago
Will be fixed in an upcoming release!

@ashwin-ant - could you use a different pattern when closing bugs? First make a release, then populate the changelog, linking to this issue, and write a comment in the issue so people can test the change?

ashwin-ant collaborator · 4 months ago

@marcindulak I'll leave this open until the fix is released.

AmusedAlex · 4 months ago

@ashwin-ant Do you know when the new release will arrive? And is there a manual fix for this?

pfin · 4 months ago
Will be fixed in an upcoming release!

@ashwin-ant
this fix seems to move everything to a /tmp directory. this behavoir is SUBSTANTIALLY WORSE if you use VMs heavily as it leaves the git system and will be lost when you change machines.

Also, the heavy usage of the MEMORY.md files from ~/.claude also introduces significant problems between VMs. I have to completely disable the memory system and rewire the tmp file usage for any meaningful work across multiple machines

github-actions[bot] · 4 months ago

This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.