[FEATURE] Auto-cleanup tmpclaude-* temporary files
Preflight Checklist
- [x] I have searched existing requests and this feature hasn't been requested yet
- [x] This is a single feature request (not multiple features)
Problem Statement
## 📋 Problem Description
Claude Code generates temporary files with the pattern tmpclaude-*-cwd during operation. These files store session
state information such as the current working directory path. However, they are not automatically cleaned up after
the session ends, causing them to accumulate in the project directory over time.
### Examples of Temporary Files
````
tmpclaude-6a71-cwd
tmpclaude-d988-cwd
tmpclaude-76f1-cwd
tmpclaude-4836-cwd
... (can accumulate to dozens of files)
## 🔍 Current Behavior
- ✅ Temporary files are created during Claude Code operations
- ❌ These files persist in the project directory after session ends
- ❌ Files accumulate over time (10+ files in my case)
- ❌ Users must manually clean them:
rm -f tmpclaude-* - ✅ Already in
.gitignore, confirming they shouldn't be tracked
## 💡 Suggested Improvement
Implement automatic cleanup of temporary files when sessions end.
## 🔗 Related Issues
This is a quality-of-life improvement that affects all Claude Code users. Similar tools (VS Code, Webpack, etc.)
implement automatic temp file cleanup as standard practice.
## 🙏 Additional Notes
These temporary files are harmless but annoying. Auto-cleanup would significantly improve the user experience and make
Claude Code more polished and professional.
---
Thank you for considering this improvement! 🚀
Proposed Solution
Proposed Solutions
#### Option 1: Cleanup on Session Exit (Recommended)
- Delete all
tmpclaude-*files when Claude Code session ends - Simple and effective
#### Option 2: Use OS Temporary Directory
- Store temp files in system temp folder instead of project root:
- Windows:
%TEMP% - Linux/Mac:
/tmp - More professional approach
#### Option 3: Session-Based Cleanup
- Clean up old temp files before starting a new session
- Use a single persistent temp file per session
#### Option 4: Periodic Cleanup
- Implement automatic cleanup mechanism that runs periodically
- Remove temp files older than X hours/days
Alternative Solutions
_No response_
Priority
Critical - Blocking my work
Feature Category
CLI commands and flags
Use Case Example
_No response_
Additional Context
_No response_
This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗