Explore the .claude directory changedclaude-directory
Nearest release: v2.1.283, published 4 hours before upstream edited the page. Shown because the two are within 24 hours of each other. Nothing here says the release caused the edit.
Upstream edited this page at 25 Sep 2026 23:24 UTC, give or take a minute or two: the time comes from Anthropic’s own sitemap rather than from a commit. This site recorded the change at 25 Sep 2026 23:37 UTC.
Upstream edited
Recorded here
Lines+21added
Lines−1removed
From line
1,562
where the diff opens
First seen
14 Aug 2026
this site's first read of the page
Recorded edits26to this page, all time
### Session scratchpad directory
The whole hunk
from line 1562, old and new numbered
/
from line 1562
15621562* **Bare mode**: when you run `claude -p` with [`--bare`](/docs/en/headless#start-faster-with-bare-mode), Claude Code doesn't run the sweep in that session.
15631563* **Paused sweep**: if Claude Code can't safely determine the retention period, it pauses the retention cleanup sweep; the [`retention_sweep` event](/docs/en/monitoring-usage#retention-sweep-event) lists each configuration that pauses it. When the cause is a settings file that can't be read or parsed, or settings errors with `cleanupPeriodDays` or `desktopSessionCleanupPeriodDays` explicitly set, Claude Code also shows a warning in `/status` until you fix the settings errors. When [managed settings](/docs/en/server-managed-settings) provide `cleanupPeriodDays`, Claude Code runs the sweep at the managed value in either case.
15641564
1565### Session scratchpad directory
1566
1567The scratchpad is a per-session directory that Claude Code gives Claude for temporary files: intermediate results, helper scripts, and drafts that don't belong in your project. When Claude says it saved something "to the scratchpad", the file is there. Claude uses it instead of `/tmp`, and can create, edit, and read files in it without a permission prompt.
1568
1569The scratchpad lives under Claude Code's temp directory rather than `~/.claude`. Find the current session's path for your platform:
1570
1571* **macOS**: `/private/tmp/claude-<uid>/<project>/<session-id>/scratchpad/`
1572* **Linux**: `/tmp/claude-<uid>/<project>/<session-id>/scratchpad/`, or the same shape under `$TMPDIR` when your system sets one
1573* **Windows**: `%TEMP%\claude\<project>\<session-id>\scratchpad\`
1574
1575`<project>` is your working directory path with every character other than letters and digits replaced by `-`, such as `-Users-you-my-project`. If you set [`CLAUDE_CODE_TMPDIR`](/docs/en/env-vars), the tree moves under that directory instead. Hooks receive the current session's path as [`scratchpad_dir`](/docs/en/hooks#common-input-fields).
1576
1577Scratchpad files last as long as the session's transcript: the [retention sweep](#cleaned-up-automatically) deletes the directory when it deletes the transcript, and [`claude project purge`](#clear-local-data) doesn't touch the temp directory. Because the directory sits under the system temp location, your operating system can also clear it, such as on restart. To keep something Claude wrote there, ask Claude to move it into your project.
1578
1579A session has a scratchpad only when all of these hold:
1580
1581* You're signed in with a claude.ai account rather than an API key
1582* The session uses the Anthropic API, not Amazon Bedrock, Google Cloud's Agent Platform, or Microsoft Foundry
1583* [`enableArtifact`](/docs/en/settings-reference#enableartifact) isn't set to `false`
1584
15651585### Kept until you delete them
15661586
15671587The retention cleanup sweep doesn't remove the paths below. Claude Code keeps them until you delete them, apart from the two caches it deletes when you log out.
from line 1620
16001620* Matching prompt lines in `history.jsonl`
16011621* The project's entry in `~/.claude.json`
16021622
1603Images you pasted or attached in the project's sessions are stored under Claude Code's temp directory rather than `~/.claude`, so the purge doesn't remove them. The [retention sweep](#cleaned-up-automatically) deletes them once they're older than `cleanupPeriodDays`.
1623Images you pasted or attached in the project's sessions and each session's [scratchpad](#session-scratchpad-directory) are stored under Claude Code's temp directory rather than `~/.claude`, so the purge doesn't remove them. The [retention sweep](#cleaned-up-automatically) still deletes the images once they're older than `cleanupPeriodDays`; a purged session's scratchpad stays until you delete it or your operating system clears the temp directory.
16041624
16051625The command prints the full deletion plan and asks for confirmation before removing anything.
16061626
No line in this hunk matches that.