[BUG] Harness tells the model to save scripts and outputs to the scratchpad, which macOS wipes at reboot; no setting to relocate or disable it

Status Open
Reported on v2.1.283
Maintainer reply None cached
Activity 0 comments · opened Sep 28, 2026

Preflight Checklist

  • [x] I have searched existing issues and this hasn't been reported yet
  • [x] This is a single bug report
  • [x] I am using the latest version of Claude Code

What's Wrong?

The harness instructs the model to save scripts and outputs to the session scratchpad. On macOS the scratchpad is under /private/tmp, which is cleared at every reboot. Work the user intended to keep is lost without warning. The instruction cannot be relocated or disabled, and CLAUDE.md instructions do not override it because it says "always".

Sources in the 2.1.283 bundle:

  1. System prompt, environment section, sent with every request:

> Scratchpad directory: <path> — always use it for temporary files (intermediate results, scripts, outputs that don't belong in the project) instead of /tmp or other system temp directories [...] Only use /tmp if the user explicitly asks.

  1. The same sentence is re-sent in a mid-session "Environment update" when the scratchpad path changes.
  2. Coordinator/worker context: "Use this for durable cross-worker knowledge". The directory is not durable.
  3. Artifact tool description: files are placed "in its scratchpad directory when the system prompt lists one and the person names no other location".

The line is gated by tengu_scratch || isArtifactToolEligible(). Setting "enableArtifact": false in settings.json removes it: confirmed mid-session, when the harness sent "The scratchpad directory announced earlier is no longer available; use it no further." The only way to stop the instruction is therefore to give up artifacts.

What Should Happen?

  1. A setting to relocate the scratchpad (accepting a path relative to the working directory, e.g. ./temporary) or to turn the instruction off.
  2. The instruction should state that the scratchpad is erased on reboot and that files worth keeping belong in the project.
  3. User instructions on where to save files should take precedence over this default.
  4. A single documented setting for where Claude saves temporary and intermediate files (e.g. "temporaryDirectory": "./temporary"), applied consistently to the system prompt, the scratchpad, the Artifact tool, sandboxed Bash $TMPDIR and subagents. At present the only reliable safeguard is a user-written PreToolUse hook that parses every Bash command, file write and MCP call to deny writes to /tmp, /var/folders and the scratchpad. Users should not need one.

Error Messages/Logs

None. The loss is silent.

Steps to Reproduce

  1. On macOS, start claude in any project with artifacts enabled.
  2. Ask for an analysis script and a plot without naming a location.
  3. The files are written to /private/tmp/claude-<uid>/<project>/<session>/scratchpad/.
  4. Reboot. The files are gone.

Claude Model

Opus

Is this a regression?

I don't know

Claude Code Version

2.1.283 (Claude Code)

Platform

Anthropic API

Operating System

macOS

Terminal/Shell

zsh

Additional Information

Related: #92166, #88773, #89878, #97128, #93746; #78687 and #78475 (closed as stale).

View original on GitHub ↗