[BUG]

Resolved 💬 2 comments Opened Jan 13, 2026 by Yang642514 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?

Windows: tmpclaude-*-cwd temporary files not cleaned up after bash commands

What Should Happen?

Bug Description

When running Bash commands on Windows, Claude Code leaves temporary files tmpclaude-*-cwd in the working directory. These files accumulate over time and are not automatically cleaned up.

## Environment

  • OS: Windows (win32)
  • Claude Code version: Latest (updated as of 2026-01-14)
  • Working directory: Git repository on Windows

## Steps to Reproduce

  1. Open a Claude Code session in a Windows directory
  2. Run any Bash command (e.g., ls, echo test)
  3. Check the directory - a tmpclaude-{random}-cwd file is created
  4. Run more Bash commands
  5. Observe that these temporary files accumulate and are not cleaned up

## Expected Behavior

Temporary files should be automatically cleaned up after command execution, similar to how they behave on macOS/Linux.

## Actual Behavior

The temporary files persist in the directory indefinitely:
tmpclaude-1296-cwd
tmpclaude-1363-cwd
tmpclaude-1be8-cwd
... (dozens of files)

## Workaround

Manually delete these files: rm -f tmpclaude-*.cwd
Add to .gitignore to prevent tracking: tmpclaude-*

## Impact

  • Annoying clutter in project directories
  • Confusing for users (appears in git status before .gitignore is added)
  • Requires manual cleanup

## Suggested Fix

Ensure temporary file cleanup works correctly on Windows, similar to Unix-like systems.

Error Messages/Logs

Steps to Reproduce

Bug Description

When running Bash commands on Windows, Claude Code leaves temporary files tmpclaude-*-cwd in the working directory. These files accumulate over time and are not automatically cleaned up.

## Environment

  • OS: Windows (win32)
  • Claude Code version: Latest (updated as of 2026-01-14)
  • Working directory: Git repository on Windows

## Steps to Reproduce

  1. Open a Claude Code session in a Windows directory
  2. Run any Bash command (e.g., ls, echo test)
  3. Check the directory - a tmpclaude-{random}-cwd file is created
  4. Run more Bash commands
  5. Observe that these temporary files accumulate and are not cleaned up

## Expected Behavior

Temporary files should be automatically cleaned up after command execution, similar to how they behave on macOS/Linux.

## Actual Behavior

The temporary files persist in the directory indefinitely:
tmpclaude-1296-cwd
tmpclaude-1363-cwd
tmpclaude-1be8-cwd
... (dozens of files)

## Workaround

Manually delete these files: rm -f tmpclaude-*.cwd
Add to .gitignore to prevent tracking: tmpclaude-*

## Impact

  • Annoying clutter in project directories
  • Confusing for users (appears in git status before .gitignore is added)
  • Requires manual cleanup

## Suggested Fix

Ensure temporary file cleanup works correctly on Windows, similar to Unix-like systems.

Claude Model

Sonnet (default)

Is this a regression?

Yes, this worked in a previous version

Last Working Version

_No response_

Claude Code Version

2.1.6

Platform

Anthropic API

Operating System

Windows

Terminal/Shell

VS Code integrated terminal

Additional Information

_No response_

View original on GitHub ↗

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