tmpclaude-*-cwd temporary files are not cleaned up automatically

Status Closed — duplicate
Maintainer reply ✓ Yes — claude[bot]
Activity 11 comments · opened Jan 12, 2026 · closed Apr 26, 2026
💡 Likely answer: A maintainer (claude[bot], contributor) responded on this thread — see the highlighted reply below.

Description

Claude Code creates temporary files named tmpclaude-XXXX-cwd in the working directory, but these files are not automatically cleaned up after the session ends or when they are no longer needed.

Steps to Reproduce

  1. Use Claude Code in a project directory
  2. Perform various operations (file reading, editing, bash commands, etc.)
  3. End the session or let some time pass
  4. Check the working directory

Expected Behavior

Temporary files should be automatically cleaned up when:

  • The Claude Code session ends
  • The temporary file is no longer needed
  • Or at minimum, they should be created in a system temp directory instead of the working directory

Actual Behavior

Temporary files accumulate in the working directory. In my case, I found 56 tmpclaude-*-cwd files in my project directory.

tmpclaude-0003-cwd  tmpclaude-39be-cwd  tmpclaude-86bb-cwd  tmpclaude-cfc8-cwd
tmpclaude-0e34-cwd  tmpclaude-3cdd-cwd  tmpclaude-8962-cwd  tmpclaude-d45a-cwd
tmpclaude-19e3-cwd  tmpclaude-41be-cwd  tmpclaude-9074-cwd  tmpclaude-d592-cwd
... (56 files total)

Environment

  • OS: Windows 11
  • Claude Code Version: Latest (via VSCode extension)

Suggested Solutions

  1. Automatic cleanup: Delete temp files when the session ends or when they become stale
  2. Use system temp directory: Create these files in %TEMP% or /tmp instead of the working directory
  3. Add to default .gitignore: At minimum, document that users should add tmpclaude-* to their .gitignore

Workaround

Manually delete with:

# Windows
del tmpclaude-*-cwd

# Unix
rm tmpclaude-*-cwd

Or add to .gitignore:

tmpclaude-*

View original on GitHub ↗

11 Comments

github-actions[bot] · 7 months ago

Found 3 possible duplicate issues:

  1. https://github.com/anthropics/claude-code/issues/17600
  2. https://github.com/anthropics/claude-code/issues/17568
  3. https://github.com/anthropics/claude-code/issues/17589

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

OneTokens · 7 months ago

same issue in Windows 11 with Windows Terminal

BOLT04 · 7 months ago

this is super annoying... another bug that seems to have entered this codebase, I never saw the files tmpclaude before 😟

Baesic-Project-Manager · 7 months ago

same issue here - hoping support sees this

gustavolendimuth · 7 months ago

same issue here

hujiawei34 · 6 months ago

same issue in win10

<img width="320" height="730" alt="Image" src="https://github.com/user-attachments/assets/052c740c-684b-4123-a889-8f4b58ca05dc" />

Kang-Zhaoyuan · 5 months ago

same issue in Win 10

yurukusa · 5 months ago

A Stop hook can clean these up at session end:

find /tmp -maxdepth 1 -name 'claude-*-cwd' -type f -mmin +60 -delete 2>/dev/null
exit 0

Only deletes files older than 60 minutes to avoid affecting active sessions.
Install:

npx cc-safe-setup --install-example tmp-cleanup

Same solution as in #8856.

claude[bot] contributor · 4 months ago

This is a duplicate of #17600, which was fixed as of version 2.1.47.

github-actions[bot] · 3 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.