claude-code icon indicating copy to clipboard operation
claude-code copied to clipboard

[Bug] Temporary tmpclaude-*-cwd files not cleaned up after session end

Open thomasDreamlands opened this issue 10 months ago • 6 comments

Description:

Claude Code creates tmpclaude-XXXX-cwd files to track shell working directory state, but never cleans them up. They accumulate over time in the project directory.

Repro:

  1. Use Claude Code with Bash commands across multiple sessions
  2. Observe tmpclaude-*-cwd files accumulating in the working directory

Expected: Temp files cleaned up on session end or startup

Actual: Files persist indefinitely, requiring manual cleanup

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

Environment Info

  • Platform: win32
  • Terminal: null
  • Version: 2.1.5
  • Feedback ID: ec4c7ec7-a6d3-4f85-9b07-8c4a9f7ded7b

thomasDreamlands avatar Jan 12 '26 22:01 thomasDreamlands

same. just updated to 2.1.5 on windows 11, now every bash command creates a tmpclaude-XXXX-cwd file and leaves it in my project directory. what a mess... sigh...

Image

bigshiny90 avatar Jan 12 '26 23:01 bigshiny90

Same here. Really disappointing to see the release quality sometimes ... introducing CLAUDE_CODE_TMPDIR and then causing this issue :-(

mathiaswillburger avatar Jan 12 '26 23:01 mathiaswillburger

This issue has been confirmed here #17568

WangShiSoftware avatar Jan 13 '26 01:01 WangShiSoftware

same issue here

fseminario avatar Jan 13 '26 15:01 fseminario

also unable to drag and drop files into message box using shift anymore in code claude ui...used to work just fine

fseminario avatar Jan 13 '26 16:01 fseminario

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.

Varietyz avatar Jan 15 '26 00:01 Varietyz

Closing for now — inactive for too long. Please open a new issue if this is still relevant.

github-actions[bot] avatar Feb 27 '26 10:02 github-actions[bot]

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.

github-actions[bot] avatar Mar 08 '26 14:03 github-actions[bot]