Scratchpad temp dir hardcoded to /private/tmp, ignores $TMPDIR, no config override

Status Open
Maintainer reply None cached
Activity 1 comment · opened Jul 17, 2026

Description

Claude Code creates per-session scratchpad directories at:

/private/tmp/claude-503/<escaped-cwd>/<session-id>/scratchpad

one per project working directory, and these are never automatically cleaned up.

Issues found

  1. $TMPDIR (the standard macOS per-user temp directory, e.g. /var/folders/.../T/) is set correctly in the shell environment, but is not consulted when constructing the scratchpad path. Confirmed no claude-503 directory exists anywhere under $TMPDIR — the path is hardcoded to /private/tmp regardless.
  2. Checked the full settings.json schema — there is no scratchpadDirectory key or equivalent. Nothing in the env block redirects it either, since path construction doesn't read TMPDIR in the first place.
  3. Scratchpad directories accumulate indefinitely (found 4 project dirs, ~7MB, some multiple days old) with no automatic cleanup based on age.

Request

  • Honor $TMPDIR when present (standard OS behavior on macOS/Linux), or
  • Add a scratchpadDirectory (or similar) key to settings.json so users can redirect this path (e.g. to ~/tmp), and/or
  • Auto-clean stale session scratchpad directories after some configurable age.

Environment

  • Platform: macOS (Darwin 24.6.0)
  • Shell: fish

View original on GitHub ↗

This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗