Context
Claude Code's per-session scratchpad tree accumulates without any observed pruning. Measured on one machine over 10 days:
%LOCALAPPDATA%\Temp\claude — 34,968 files, 3.6 GB total; the scratchpad subtrees alone are 230 directories, 31,260 files, 2.96 GB.
- 219 session directories under a single project key; 45 CWD-derived project keys in total.
- Oldest directory 10 days old, newest same-day — nothing in between was reclaimed.
For contrast, the surface that DOES have a documented cleanup owner — ~/.claude/jobs/<id>/tmp/, "Removed when the session is deleted" — measures 1 MB across 6 directories on the same machine. Three orders of magnitude, and the difference is precisely whether a cleanup owner exists.
Neither shipped hygiene plugin covers this today:
plugins/disk-hygiene/skills/clean owns the concern by charter — "orphaned, temporary, stale-lock, failed-write, partial-download, and empty leftover artifacts", arbitrary target directory, confidence tiers, per-tier approval — but it is disable-model-invocation: true and manual-only, so it never notices growth; someone has to already suspect it and aim it.
plugins/machine-health/skills/audit is the proactive surface but does not track this path (grep for AppData / LOCALAPPDATA / /tmp/claude under plugins/repo-hygiene/ and plugins/disk-hygiene/ returns nothing relevant).
So the concern has an owner for removal and no owner for detection.
Cost of leaving it: multi-gigabyte silent growth on every developer machine, discovered only when a volume fills.
Proposed work
- Add a disk-growth check for the Claude Code temp root to
plugins/machine-health/skills/audit: %LOCALAPPDATA%\Temp\claude on Windows, /tmp/claude (or $TMPDIR-derived) on POSIX, honoring CLAUDE_CODE_TMPDIR when set since it relocates the root.
- Report size, directory count, and oldest-entry age with trend-aware severity, per the audit skill's existing catalog shape.
- Route remediation to
disk-hygiene:clean rather than removing anything from machine-health — detection and removal stay separately owned.
- Ensure any removal path cannot delete a LIVE session's scratchpad. A session's own directory is addressable via
CLAUDE_CODE_SESSION_ID (documented at env-vars.md:305, and empirically equal to the scratchpad path's UUID segment), but a concurrently running OTHER session is the real hazard — age-based tiers must account for it.
Acceptance criteria
References
plugins/disk-hygiene/skills/clean/SKILL.md — charter, disable-model-invocation: true, manual-only
plugins/disk-hygiene/skills/clean/reference/safety-model.md — where the live-session hazard belongs
plugins/machine-health/skills/audit — versioned check catalog with trend-aware severity
- Claude Code docs
env-vars.md:330 (CLAUDE_CODE_TMPDIR), env-vars.md:305 (CLAUDE_CODE_SESSION_ID), agent-view "Where state is stored" (~/.claude/jobs/<id>/tmp/ — the documented-cleanup contrast)
docs/PLUGIN-PHILOSOPHY.md — prerequisites and failure behavior (not-applicable exits quietly)
Context
Claude Code's per-session scratchpad tree accumulates without any observed pruning. Measured on one machine over 10 days:
%LOCALAPPDATA%\Temp\claude— 34,968 files, 3.6 GB total; thescratchpadsubtrees alone are 230 directories, 31,260 files, 2.96 GB.For contrast, the surface that DOES have a documented cleanup owner —
~/.claude/jobs/<id>/tmp/, "Removed when the session is deleted" — measures 1 MB across 6 directories on the same machine. Three orders of magnitude, and the difference is precisely whether a cleanup owner exists.Neither shipped hygiene plugin covers this today:
plugins/disk-hygiene/skills/cleanowns the concern by charter — "orphaned, temporary, stale-lock, failed-write, partial-download, and empty leftover artifacts", arbitrary target directory, confidence tiers, per-tier approval — but it isdisable-model-invocation: trueand manual-only, so it never notices growth; someone has to already suspect it and aim it.plugins/machine-health/skills/auditis the proactive surface but does not track this path (grep forAppData/LOCALAPPDATA//tmp/claudeunderplugins/repo-hygiene/andplugins/disk-hygiene/returns nothing relevant).So the concern has an owner for removal and no owner for detection.
Cost of leaving it: multi-gigabyte silent growth on every developer machine, discovered only when a volume fills.
Proposed work
plugins/machine-health/skills/audit:%LOCALAPPDATA%\Temp\claudeon Windows,/tmp/claude(or$TMPDIR-derived) on POSIX, honoringCLAUDE_CODE_TMPDIRwhen set since it relocates the root.disk-hygiene:cleanrather than removing anything frommachine-health— detection and removal stay separately owned.CLAUDE_CODE_SESSION_ID(documented atenv-vars.md:305, and empirically equal to the scratchpad path's UUID segment), but a concurrently running OTHER session is the real hazard — age-based tiers must account for it.Acceptance criteria
machine-health:auditreports size, entry count, and oldest-entry age for the Claude Code temp root on Windows and POSIX.CLAUDE_CODE_TMPDIRwhen set.disk-hygiene:cleanfor removal;machine-healthremoves nothing itself.disk-hygiene's safety model documents the live-session hazard and how its confidence tiers avoid deleting an in-use scratchpad.References
plugins/disk-hygiene/skills/clean/SKILL.md— charter,disable-model-invocation: true, manual-onlyplugins/disk-hygiene/skills/clean/reference/safety-model.md— where the live-session hazard belongsplugins/machine-health/skills/audit— versioned check catalog with trend-aware severityenv-vars.md:330(CLAUDE_CODE_TMPDIR),env-vars.md:305(CLAUDE_CODE_SESSION_ID), agent-view "Where state is stored" (~/.claude/jobs/<id>/tmp/— the documented-cleanup contrast)docs/PLUGIN-PHILOSOPHY.md— prerequisites and failure behavior (not-applicable exits quietly)