[BUG] tmpclaude-*-cwd temp files not cleaned up, accumulate in project folder

Status Closed — not planned
Maintainer reply None cached
Activity 13 comments · opened Jan 13, 2026 · closed Feb 27, 2026

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 creates temporary files with pattern tmpclaude-XXXX-cwd in the user's current working directory (project folder). These files:

  1. Are NOT automatically cleaned up when the session ends
  2. Accumulate over time (I found 25 files after several sessions)
  3. Are placed in the project root where they can be accidentally committed to git

Each file contains only the current working directory path:
/c/Projects/my-project-folder

Files found:
tmpclaude-0697-cwd
tmpclaude-0f7e-cwd
tmpclaude-1586-cwd
tmpclaude-3dd8-cwd
... (25 files total)

What Should Happen?

  1. Temp files should be stored in system temp folder (%TEMP% on Windows, /tmp on Unix) or a dedicated Claude folder (~/.claude/tmp/)
  2. Temp files should be automatically cleaned up when the session ends
  3. If cleanup fails, files should NOT be in a location where they can be accidentally committed to version control
  4. Or use a single file per project (reuse instead of creating new each session)

Error Messages/Logs

N/A - No error messages or warnings displayed. Files are created silently without any notification.

Steps to Reproduce

  1. Open PowerShell on Windows
  2. Navigate to project folder: cd C:\Projects\your-project\app
  3. Run Claude Code: claude
  4. Use Claude Code for coding tasks
  5. Check project folder: dir tmpclaude-*-cwd
  6. Observe: Multiple tmpclaude-XXXX-cwd files created

Complete timeline from my observation (all on 12/01/2026):

| Time | Files Created |
|-------|---------------|
| 14:07 | 2 files |
| 14:08 | 2 files |
| 14:09 | 3 files |
| 14:29 | 1 file |
| 14:33 | 4 files |
| 14:34 | 3 files |
| 14:56 | 2 files |
| 14:57 | 1 file |
| 15:37 | 1 file |
| 15:38 | 2 files |
| 15:53 | 3 files |
| 15:54 | 1 file |
| Total | 25 files |

Key observations:

  • 25 files created in ~1 hour 47 minutes
  • Files created in bursts (up to 7 files within 1-2 minutes)
  • Previous Claude Code usage did not produce these files
  • All files contain only the working directory path
  • Files are not automatically cleaned up

Claude Model

Opus

Is this a regression?

I don't know

Last Working Version

_No response_

Claude Code Version

v2.1.6

Platform

Anthropic API

Operating System

Windows

Terminal/Shell

PowerShell

Additional Information

Workaround

Users need to:

  1. Manually delete: del tmpclaude-*-cwd (Windows) or rm tmpclaude-*-cwd (Unix)
  2. Add to .gitignore: tmpclaude-*-cwd

Suggested Fix

  1. Move temp file location to system temp folder or ~/.claude/
  2. Implement cleanup on session end
  3. Use a single file per project (reuse instead of creating new each session)
  4. Or eliminate the need for this file entirely if possible

Impact

  • Security risk: None (only contains path, no sensitive data)
  • UX issue: Medium (confusing, clutters project folder)
  • Potential problem: Accidental commits to git

Thank you for the great product!

View original on GitHub ↗

13 Comments

peter-felgate · 7 months ago

I am having the same problem. using version 2.1.6

pablos1rvent · 7 months ago
christophergoltz · 7 months ago

Same issue

mynk-tmr · 7 months ago

Having the same problem here. This needs urgent attention

christophergoltz · 7 months ago
adrianvagner · 7 months ago

Same issue

lordguido · 7 months ago

I have same issue

ercilioareias · 7 months ago

same issue

s1495k043 · 7 months ago

2.1.6 same issue

rpkumar28 · 7 months ago

I am facing the same issue as well. 2.1.6

egdw-xxigb · 7 months ago

Same. Windows, powershell. cc 2.1.6

github-actions[bot] · 6 months ago

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

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