Background task output files in /private/tmp grow unbounded, no cleanup

Resolved 💬 2 comments Opened Apr 2, 2026 by achillesheel02 Closed May 10, 2026

Summary

Claude Code stores background task output in /private/tmp/claude-{UID}/ with no size limits, no TTL, and no automatic cleanup. A single runaway task output file consumed 405 GB of disk space, filling the drive to 99% capacity (236 MB free on a 926 GB disk).

Reproduction

  1. Use Claude Code over many sessions (background tasks via run_in_background parameter)
  2. Check /private/tmp/claude-{UID}/ — old session directories and task output files accumulate indefinitely
  3. One pathological task output file (bzkdoq3qh.output) grew to 405 GB, likely from a command that produced massive stdout

Expected behaviour

  • Task output files should have a size cap (e.g. truncate after 100 MB)
  • Old session directories in /private/tmp/claude-* should be cleaned up on session start or after a TTL (e.g. 7 days)
  • Users should be warned if a background task's output is growing beyond a reasonable threshold

Actual behaviour

  • No size limit on task output files
  • No automatic cleanup of old session temp directories
  • No visibility to the user — the directory is hidden in /private/tmp and doesn't show up in normal disk usage tools like Finder or du -sh ~
  • macOS doesn't reliably clean /private/tmp on reboot for large files

Impact

Severe — silently fills disk to capacity. The user had no idea where 405 GB went. The path /private/tmp/claude-501/ is not something anyone would think to check.

Environment

  • macOS 15 (Darwin 25.2.0)
  • Apple Silicon (M4)
  • Claude Code (latest as of 2026-04-02)

🤖 Generated with Claude Code

View original on GitHub ↗

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