tmpclaude-*-cwd temp files created in working directory instead of system temp

Resolved 💬 7 comments Opened Jan 12, 2026 by j2clark Closed Mar 25, 2026

Description

Claude Code creates temporary files with the pattern tmpclaude-XXXX-cwd (used to track current working directory across Bash commands) in the current working directory instead of the system temp directory.

Problem

These files accumulate in the codebase alongside actual code:

tests/lua/tmpclaude-f88b-cwd
tests/lua/tmpclaude-123a-cwd
tests/lua/stubs/tmpclaude-4c2c-cwd
plugins/shared/tmpclaude-f22b-cwd
... (100+ files across various directories)

This causes several issues:

  1. Pollutes the codebase - temp files mixed with actual source code
  2. Makes git status noisy - have to add gitignore patterns to suppress
  3. Confusing during code review - hard to distinguish real changes from artifacts
  4. Accumulates over time - files are not cleaned up after sessions end

Expected Behavior

These temp files should be created in:

  • %TEMP% on Windows
  • /tmp or $TMPDIR on Unix/macOS

Current Behavior

Files are created in whatever directory the Bash tool happens to be operating in.

Environment

  • OS: Windows 11
  • Claude Code: Latest version

Workaround

Users can add /**/tmpclaude-* to .gitignore and periodically clean up with:

find . -name "tmpclaude-*" -type f -delete

View original on GitHub ↗

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