Bug report: uncleaned Core ML temp caches consuming large amounts of disk space
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?
Bug report: uncleaned Core ML temp caches consuming large amounts of disk space
Reported by: Steve Peacock
Date observed: 2026-07-27
Platform: macOS (Darwin 25.5.0), Claude Desktop app + Claude Code (VS Code extension)
Summary
While using Claude (Desktop app, then Claude Code inside VS Code for a coding
task), my available SSD space dropped by roughly 105GB over the course of a
single session. I tracked the cause using a macOS Saved Search targeting my$TMPDIR ("T") folder and watched files appear in real time.
What accumulated
1,332 directories in /private/var/folders/<hash>/T/, each named like:
realesrgan512_<UUID>.mlmodelc(~64MB each)MPRNetDenoising_<UUID>.mlmodelc(~64MB each)
Total: 105GB.
These are compiled Core ML model bundles. realesrgan512 is a Real-ESRGAN
image super-resolution model; MPRNetDenoising is an image denoising model.
Each appears to be a fresh compiled instance (unique UUID, no reuse/caching
between invocations), which is why the count grew so large so quickly.
Timeline / evidence
- The T folder had none of these files before I started my session with Claude.
- Files began appearing as soon as I started using Claude (Desktop app first,
then Claude Code in VS Code once I realized the task was code-focused).
- I watched new
.mlmodelcdirectories appear live via the Saved Search while
the session was active.
- File creation stopped as soon as the task (which involved Claude Code
rendering/reading several screenshots and image assets) finished.
- No process had these files open by the time I investigated (
lsofshowed
nothing), so whatever created them had already finished running and simply
left the cache behind.
- The files were never written to Claude Code's own scratch/tmp directory
(/private/tmp/claude-501/..., which totaled only ~30MB for the whole
session) — they were written to the separate per-app $TMPDIR
(/private/var/folders/.../T/), which is not swept by the periodic macOS
/tmp cleanup job and is normally only cleared on logout/reboot.
Impact
I've previously run out of SSD space specifically because of this pattern.
The only fixes available to me were manual deletion of the cache directory
contents or a full restart — neither is discoverable or obvious to a typical
user, and 105GB accumulating during a single ~1 hour session is a lot of
unexpected disk pressure.
Suspected cause
Something in the image-rendering/preview pipeline (used when Claude
Desktop and/or the Claude Code VS Code extension displays images — e.g.
screenshots or image files read during a conversation) appears to invoke an
on-device Core ML image super-resolution/denoising pass per image, and does
not reuse a cached compiled model or clean up the compiled .mlmodelc
bundle afterward.
Request
- Please investigate whether the image display/preview pipeline is
recompiling and leaking these Core ML model bundles per-image instead of
compiling once and reusing the cached model.
- At minimum, please ensure these temp files are cleaned up when the
triggering process/session ends, rather than persisting until next reboot.
What I did to recover the space (for reference)
# Confirmed no process had the files open
lsof +D "/private/var/folders/<hash>/T" | grep -i mlmodelc
# Deleted the orphaned cache directories
find "/private/var/folders/<hash>/T" -maxdepth 1 -iname "*mlmodelc*" -print0 | xargs -0 rm -rf
# macOS held the freed blocks as "purgeable" via local Time Machine
# snapshots, so df didn't reflect the recovered space until thinning:
tmutil thinlocalsnapshots / 999999999999999 4
What Should Happen?
temp AI files should be purged regularity and completely at the ens of a session
Error Messages/Logs
N/A user observed a reduction in SSD Space and the generation of files in T drive as Claude worked
Steps to Reproduce
Using Claude in VSCode
Claude Model
Sonnet (default)
Is this a regression?
I don't know
Last Working Version
N/A
Claude Code Version
Claude Code CLI version: 2.1.197. I also noticed earlier the VS Code extension itself reports as anthropic.claude-code-2.1.220-darwin-arm64 (from the process list) — slightly different version number, worth including too.
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
VS Code integrated terminal
Additional Information
N/A