[Feature Request] Auto-cleanup empty .claude/.cc-writes/ directories after execution
Status Closed — not planned
Maintainer reply None cached
Activity 4 comments · opened Jul 12, 2026 · closed Sep 18, 2026
Can you please automatically clean up the empty .claude/.cc-writes/ directories you create in every project
4 Comments
Adding a repro and an impact case, because this is worse than cosmetic — an empty
.cc-writesdir in the wrong place hard-breaks a Cargo build, and the directories are invisible to git so nobody notices until it does.Version: 2.1.220 · Platform: macOS (Darwin 25.5.0)
The directories are created relative to the shell's persisted cwd
Bash tool cwd persists between calls, so every directory a session
cds into accumulates one. Minimal repro:Note it appears on the second call, not the first. That suggests the staging dir is created during command setup using the cwd persisted from before the command runs — so a
cdinside call N materializes the directory for call N+1. (Inference from the timing; I can't see the setup path.)In one working session across two repos this left 9 of them, one per directory visited:
Impact: breaks Cargo workspaces that use glob members
A Cargo workspace declares members by glob:
When a staging dir lands directly under a glob root — a sibling of the real crates, not inside one — Cargo treats it as a workspace member and every single cargo invocation fails:
cargo build,check,clippy,test— all dead until the directory is removed. The error names.claude, which reads like a project-config problem rather than harness residue, so it costs a debugging cycle to trace.The distinction matters:
tools/proto-gen/.claude/is harmless because it's inside a member.test/integrations/.claude/is fatal because it's beside them. Which one you get depends purely on which directory the agent happened tocdinto.Why it goes unnoticed
Git does not track empty directories. These never appear in
git status, and.gitignorecannot express "ignore this for tooling purposes" — so they silently accumulate across sessions and there's no in-repo signal until a build breaks.Suggested fixes, in order of preference
$TMPDIRand there's no problem to clean up. This also fixes #79945, where the sandbox's own write-deny on.claude/.cc-writesblocksExitWorktreefrom removing a worktree.Worth relabeling from
enhancementtobuggiven the build breakage.Closing for now — inactive for too long. Please open a new issue if this is still relevant.
Still happens. Very frustrating, would love to see it fixed 🙏😊
This issue was incorrectly closed by the github-actions bot, despite having reproduction steps and Claude version. This bot behavior is tracked in https://github.com/anthropics/claude-code/issues/87647. Consider upvoting that issue for visibilty, maybe the bot behavior gets fixed.