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

Resolved 💬 11 comments Opened Jan 12, 2026 by geshi0820 Closed Apr 26, 2026

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 ↗

This issue has 11 comments on GitHub. Read the full discussion on GitHub ↗