tmpclaude-*-cwd temp files not cleaned up and created in project root

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

a## Description

When using the Task tool to spawn subagents, Claude Code creates temporary files named tmpclaude-XXXX-cwd (where XXXX is a hex identifier) to track the working directory of each subprocess.

Problem

  1. These files are created in the project root directory instead of in .claude/ or the system temp directory
  2. The files are not cleaned up after the subagent task completes
  3. Over time, dozens of these 31-byte files accumulate and clutter the project directory

What Should Happen?

a## Expected Behavior

  • Temp files should be created in .claude/ or system temp directory
  • Temp files should be automatically deleted when the subagent completes

Workaround

Add tmpclaude-* to .gitignore and manually delete the files periodically.

Environment

  • OS: Windows
  • Claude Code CLI

Error Messages/Logs

Steps to Reproduce

a1. Create a new project directory

  1. Open the directory in Claude Code
  2. 3. Use the Task tool to spawn a subagent for any task
  3. 4. Complete the subagent task
  4. 5. Check the project root directory
  5. 6. Observe multiple tmpclaude-*-cwd files accumulating
  6. 7. Note that these files persist even after the subagent completes
  7. 8. Repeat several times to see dozens of temporary files cluttering the directory

Claude Model

None

Is this a regression?

No, this never worked

Last Working Version

_No response_

Claude Code Version

1.0.123

Platform

Anthropic API

Operating System

Windows

Terminal/Shell

PowerShell

Additional Information

_No response_

View original on GitHub ↗

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