[BUG] tmpclaude-*-cwd temp files created in project root directory

Resolved 💬 2 comments Opened Jan 13, 2026 by Anoesi98 Closed Feb 26, 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 project's working directory during sessions. These files appear to be for internal CWD tracking but are being written to the user's project root instead of a system temp directory.

Steps to Reproduce:

  1. Start a Claude Code session in a project directory
  2. Run various tool commands (Bash, Read, etc.)
  3. Check project root - temp files like tmpclaude-7ee1-cwd, tmpclaude-b9c5-cwd appear

Expected Behavior:
Internal temp files should be written to system temp directory (e.g., %TEMP% on Windows, /tmp on Unix), not the user's project directory.

Actual Behavior:
Files are created in the project root, polluting git status and occasionally getting committed accidentally.

Workaround:
Add tmpclaude-* to .gitignore

Environment:

  • OS: Windows 11
  • Claude Code version: v2.1.6

What Should Happen?

Internal temp files (tmpclaude-*-cwd) should be written to the system temp directory (%TEMP% on Windows, /tmp on Unix) instead of the user's project working directory. These files should never appear in the project root or show up in git status.

Error Messages/Logs

Steps to Reproduce

  1. Start a Claude Code session in any git repository
  2. Execute multiple tool calls (Bash commands, file reads, etc.)
  3. Run git status or check the project root directory
  4. Observe tmpclaude-XXXX-cwd files appearing in the project root

Claude Model

Opus

Is this a regression?

Yes, this worked in a previous version

Last Working Version

v2.1.3

Claude Code Version

v2.1.6

Platform

Anthropic API

Operating System

Windows

Terminal/Shell

PowerShell

Additional Information

Files follow pattern tmpclaude-XXXX-cwd where XXXX is a hex string (e.g., tmpclaude-7ee1-cwd, tmpclaude-b9c5-cwd)

  • Files are sometimes accidentally staged and committed with git add .
  • Workaround: Add tmpclaude-* to .gitignore
  • Platform: Windows 11
  • Multiple files can accumulate during a single session

View original on GitHub ↗

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