Claude Code Scratchpad Wipes Work on macOS Reboot

Claude Code scratchpad folder erased after a macOS restart, wiping a week of code

The Claude Code scratchpad is a temporary folder, and on macOS it gets wiped at every restart. One developer found that out on 18 October 2026, when two crashes in seventeen minutes took a week of uncommitted work with them.

The lost code was a set of video effects for a music-video editor: shooting stars, rain, vintage film and bokeh. Claude Code had been saving it in its scratchpad, and nothing in the tool or its documentation said the folder wouldn’t survive a reboot.

Why the Claude Code scratchpad loses files

The scratchpad lives in the system’s temporary directory. On macOS that is /private/tmp, which the operating system empties each time the machine restarts. The developer’s sessions had used it since 20 September, so the first warning was the crash itself.

The problem was already on record. A Linux user opened issue #92166 on the claude-code repository on 4 September, reporting that the scratchpad was erased on reboot with no warning and that a full day of pipeline output had vanished. A second report, #97759, followed on 28 September. It says the tool instructs the model to save work to the scratchpad, macOS clears it at reboot, and there is no setting to move or disable it. Both issues were still open when the developer wrote up the incident.

How the work came back

Claude Code logs every session under ~/.claude/projects, including each file write and edit. The developer rebuilt the code by replaying those steps in order. Rendered output and other program results couldn’t be recovered, but the source files could.

The developer packaged the method as a free, open-source Python tool that uses only the standard library and runs in a sandbox on macOS. It replays file-writing steps from the transcripts that still exist and checks them against full-file printouts in the record.

The 30-day transcript cleanup

Recovery depends on those transcripts surviving, and by default they don’t last. Claude Code deletes session logs after 30 days. The retention period is controlled by the cleanupPeriodDays setting in ~/.claude/settings.json. By the time the developer found it, 456 sessions covering 31 March to 25 May 2026 were already gone.

The public changelog shows the cleanup routine has needed repeated fixes this year:

  • v2.1.89 (31 March): setting cleanupPeriodDays to 0 had silently turned off transcript saving.
  • v2.1.101 (10 April): a settings flag could make the cleanup ignore the setting and delete history older than 30 days.
  • v2.1.248 (27 August): Claude Desktop and Cowork sessions were disappearing after 30 days.
  • v2.1.310 (23 October): very large values of the setting caused the cleanup to delete some recent files, such as pasted images.

The last of those matters for anyone following the obvious advice. The developer had recommended a value of 3650 days on 18 October, five days before that bug was fixed.

A separate change landed in v2.1.325 on 13 November. Claude’s instructions now tell it to keep files the user will want out of its temporary scratchpad folder, which can be cleared. That is the model being told what users were never told directly, and the two open issues remain the place to watch for a setting that lets people relocate the folder.

What Claude Code users should do now

The fixes are small and the cost of skipping them is a lost week.

  1. Check that you run Claude Code v2.1.310 or later, then raise cleanupPeriodDays in ~/.claude/settings.json to a long retention such as 3650.
  2. Copy ~/.claude/projects to storage off your machine every night. If the transcripts are gone, the work can’t be replayed.
  3. Add a rule to your CLAUDE.md file saying the scratchpad is not storage.
  4. Commit work to a git branch at every checkpoint, whether or not it runs yet.

Git remains the only safeguard that doesn’t depend on a temp folder or a retention timer. Anything Claude Code writes that isn’t committed is one restart away from disappearing.

What to watch next

Anthropic hasn’t closed #92166 or #97759, and no release so far adds a setting to relocate the scratchpad. Until one does, the 13 November instruction change is the main protection, and it only works if the model follows it. Users on macOS should assume anything in the scratchpad is gone after the next reboot.

Source: Christina Souch

Written by

Saksham Bhargava

Saksham Bhargava runs Alteroid and has been writing about consumer technology for over five years, covering iPhone, Android, Windows, AI tools and gaming. With an MCA and six years of hands-on web development experience, he tests the features he writes about on his own devices and focuses on clear, practical guides that solve real problems. Away from the screen, he enjoys travelling to places most tourists skip.