Where Claude Code Keeps Its Scratchpad, and Why It Disappears

Every Claude Code session announces a scratchpad directory and then never shows it again. Here is the exact path on macOS, Linux and Windows, what sits next to it, why a reboot or a temp cleanup erases it, what you can and cannot configure, and the one rule we gave the seven agents that write into it every night.

Every Claude Code session starts with a line you probably skim past. Ours, tonight, reads like this:

Scratchpad directory: /private/tmp/claude-501/-Users-jbchauvin-Projets-AgentsRoom/5a506305-…/scratchpad

Then the CLI never mentions it again. No command lists it, no panel opens it, and the day you go looking for the CSV the agent said it wrote there, the folder may already be gone.

We run seven scheduled agents on a Mac mini every night, and each of them writes into that folder. So we went and looked at what it is, where it lives on each system, what deletes it, and what we tell the agents to do about it. Everything below was checked on Claude Code 2.1.278 on the 19th of September 2026, and on the GitHub issues people opened when they lost work in it.

What Claude Code tells the agent

The line is part of the system prompt. The instruction that follows it, in the current version, says the agent should always use that directory for temporary files, meaning intermediate results, scripts and outputs that do not belong in the project, instead of /tmp or any other system temp directory, that it is session-specific and isolated from the project, that it can generally be used without permission prompts, and that /tmp should only be used when you explicitly ask.

That last part is the useful one for you. Files written inside the scratchpad do not trigger the write-permission dialog, which is why the agent puts its helper scripts and its exports there rather than asking you every time. It is also why you are never asked, and never told, where they went.

If you want the path in a running session, ask the agent. "Print your scratchpad directory" is answered from the system prompt, without running anything.

The path, system by system

The folder sits under the operating system's temp directory, and its name encodes who you are, which project you were in, and which session it was.

On macOS and Linux:

/tmp/claude-<uid>/<project path, slashes replaced by dashes>/<session id>/scratchpad

On a Mac, /tmp is a link to /private/tmp, so the same folder is shown as /private/tmp/claude-501/…. The number is your user id, what id -u prints: 501 for the first account on a Mac, 1000 on most Linux distributions, 0 for root. The Linux report we cite below shows /tmp/claude-0/, because the pipeline ran as root in a container. Issues opened earlier in 2026 show /tmp/claude/<project slug>/… with no uid at all, so the suffix was added along the way. If you are on an older build, drop it.

On Windows, as reported on Windows 11 in July 2026:

%TEMP%\claude\<project slug>\<session id>\scratchpad

which usually expands to C:\Users\<you>\AppData\Local\Temp\claude\…. The path is derived from the TEMP variable, so if you point TEMP somewhere else, the scratchpad follows.

The project slug is your working directory with every slash turned into a dash. Our repository lives at /Users/jbchauvin/Projets/AgentsRoom, so the slug is -Users-jbchauvin-Projets-AgentsRoom. One folder per project, then one folder per session inside it.

To list every session folder you still have for the current user on a Mac or Linux box:

ls /tmp/claude-$(id -u)/

What sits next to it

The session folder is not only the scratchpad. On the machine that runs our nightly agents, seven of the nine session folders of the day contain two entries: scratchpad and tasks. The tasks folder is where the output of background tasks lands, the commands the agent runs detached and reads later.

There is a third place you should know about, and it is not under the temp directory at all: ~/.claude/projects/<project slug>/<session id>/tool-results/. When a tool returns more than the context can take, Claude Code saves the full output there and gives the agent the path. Tonight, a 68 KB Search Console export went there instead of the scratchpad. That location is permanent, next to the session transcript. So the split is: transcripts and oversized tool outputs under ~/.claude, which stays; scripts, intermediate files and background task output under the temp directory, which does not.

Why it disappears

Because the temp directory means "safe to delete" to every operating system, and nothing in Claude Code argues with that.

On Linux, systemd-tmpfiles applies whatever /usr/lib/tmpfiles.d/tmp.conf says. One reporter lost the entire output of a 24 hour data generation pipeline, review verdicts, scripts and a Python virtualenv included, when the host rebooted: the rule on that Debian container was D /tmp 1777 root root 30d, which recreates /tmp empty at every boot. That was Claude Code 2.1.260, and the system prompt had said nothing about volatility. Check your own rule with cat /usr/lib/tmpfiles.d/tmp.conf: a D line wipes at boot, an age like 10d prunes on a timer.

On Windows, the folder is under %TEMP%, which Storage Sense and Disk Cleanup sweep. In July 2026 someone ran a disk cleanup while two sessions were live and lost the git worktrees both agents were working in, uncommitted edits included. The edits were recovered only because they still existed in the conversation context.

On macOS, /private/tmp is emptied at reboot and old files are pruned by the system. On our Mac mini tonight, /private/tmp/claude-501 holds nine session folders for this project, 452 files and 25 MB, and nothing older than the day. Whatever the agents of the previous nights left there is gone.

None of this is a bug in the sense that anything misbehaved. The folder is exactly where the CLI says it is, and the operating system did exactly what it does with temp folders. The gap is that the prompt calls it a scratchpad and a scratchpad sounds like something you keep.

What you can configure, and what you cannot

As of 2.1.278 there is no setting for the scratchpad location. The folder follows the temp directory, so TEMP on Windows and TMPDIR on Unix move it. CLAUDE_CODE_TMPDIR, which exists for other temporary files, was reported not to move the scratchpad, and that request was closed as not planned. So were the requests for a CLAUDE_CODE_SCRATCHPAD_DIR variable and for a default under ~/.claude/scratchpad/. A visible scratchpad folder in the desktop app is an open feature request.

Two things do work today. A resumed session (claude --resume) keeps its session id, so it looks for the same folder, and finds it if nothing has deleted it in between. And you can ask the agent, in plain words, to write a given file somewhere permanent. That is the whole of our fix.

The rule we gave our nightly agents

Seven agents start at 20:00 on the same machine: SEO, product, social, a fixer, a documentalist, a CEO report and a rapporteur that emails the night's summary at 22:00. Each one produces a lot of intermediate material: Search Console exports, filtered JSON, scripts that count strings across twenty locales. All of it goes to the scratchpad, on purpose, because none of it belongs in the repository and none of it should trigger a permission prompt at two in the morning.

The rule in every prompt is one sentence: the scratchpad holds what the next command needs, the repository holds what the next night needs. Anything an agent will want to read tomorrow, its report, its run marker, the file it was editing, is written under reports/nuit/<date>/ and committed as soon as it is done, not at the end of the run. An agent that gets cut mid-task leaves a partial report in git and 25 MB of scratch files that nobody will miss.

The mirror image of that rule is the one the Linux reporter learned the hard way: never let a long job accumulate its only copy in the scratchpad. If a pipeline runs for a day, its outputs go to a path you chose, and the scratchpad keeps the helpers.

Opening the folder without leaving the app

If you run Claude Code inside AgentsRoom, File > Open File (Cmd/Ctrl+O) opens any file of that folder in the preview, marked as outside the project so you do not mistake it for something tracked. It is the quickest way we have found to read an export the agent just produced, without pasting a /private/tmp path into a terminal.

And to close the loop on the name: the AgentsRoom Scratchpad is something else. It is the prompt editor built into the agent composer, where a long prompt is written and kept as a draft per agent between sessions. Same word, chosen before Claude Code used it for a folder. One is where you write to the agent; the other is where the agent writes for itself.

FAQ

Where is the Claude Code scratchpad on macOS and Linux?

Under the system temp directory: /tmp/claude-<your uid>/<project path with slashes turned into dashes>/<session id>/scratchpad. On macOS the same folder shows up as /private/tmp/claude-501/… because /tmp is a link to /private/tmp. Your uid is what id -u prints: 501 for the first user on a Mac, 1000 on most Linux distributions, 0 for root. Older versions used /tmp/claude/ without the uid suffix.

Where is the Claude Code scratchpad on Windows?

Under the TEMP folder: %TEMP%\claude\<project slug>\<session id>\scratchpad, which usually expands to C:\Users\<you>\AppData\Local\Temp\claude\…. Changing the TEMP environment variable moves it, because the path is derived from TEMP rather than from a Claude Code setting.

Why did my Claude Code scratchpad disappear?

Because it lives under the temp directory, and every operating system considers the temp directory safe to delete. On Linux, systemd-tmpfiles applies the rule written in /usr/lib/tmpfiles.d/tmp.conf, often a wipe at boot or after a number of days. macOS empties /private/tmp at reboot and prunes old files. On Windows, Storage Sense and Disk Cleanup sweep %TEMP%. Nothing in Claude Code protects the folder from any of these.

Can I change where Claude Code puts its scratchpad?

Not with a dedicated setting, as of Claude Code 2.1.278. The folder follows the temp directory of the operating system, so moving TEMP on Windows or TMPDIR on Unix moves it. Requests for a separate variable or a persistent location under ~/.claude have been closed as not planned. The reliable option is to tell the agent to write anything that matters into the project instead.

Is the scratchpad the same as ~/.claude/projects?

No. ~/.claude/projects/<project slug>/ holds the session transcripts and, per session, a tool-results folder where oversized tool outputs are saved. That location is permanent. The scratchpad under the temp directory is the working space the agent uses for scripts and intermediate files, and that one is volatile.

Is this the AgentsRoom Scratchpad?

Same word, different thing. The AgentsRoom Scratchpad is the prompt editor built into the agent composer, where you write and keep a draft per agent. Claude Code's scratchpad is a folder the CLI creates for each session. AgentsRoom can open any file of that folder with File > Open File, and it is marked as outside the project.

Download AgentsRoom

Run all your AI agents, on all your projects, from a single window.

FreeDownload AgentsRoom

Companion app: monitor your agents on the go

Bring your own: Claude, Codex, Antigravity CLI, or other AI provider.

Get the extension
Chrome Web Store

Push bugs and requests straight to your public backlog.

Multiple projects
Multi-provider
Multiple agents
Live status
File diff & commit
Mobile companion
Live preview
Agent teams
Browser automation
Backlog-driven dev
Prompt Library
Skills Library
View all features

Keep reading