Sessions and Storage
A session is one saved conversation. Claude Code writes it to a file on your disk as you work. You can leave and come back to continue, or branch the conversation to try another path. This page covers the flags, the files, and the cleanup rules. The line format is on the Transcript Format page.
At a Glance
| Question | Answer |
|---|---|
| Can you use it? | ✅ Yes. Every session is saved unless you turn it off. |
| Can you change it? | ✅ Yes. Move the folder, change the retention, or skip saving. |
| Can you turn it on or off? | -- (print mode) or CLAUDE_ (any mode). |
| Where does it live? | ~/. |
| Status | Documented Undocumented |
The Life of a Session
Resume and Branch
Source: Manage Sessions.
| Item | Status | What it does |
|---|---|---|
claude --, - | Documented | Reopens the newest session of the current folder. |
claude --, - | Documented | Opens the picker, or resumes by session ID, name, or transcript path. |
claude -- | Documented | Opens a picker with the sessions that link to a pull request. |
claude -- | Documented | With -- or --, copies the history to a new session ID. |
/ | Documented | Copies the conversation and switches to the copy. The "allow for this session" grants carry over. |
-- | Documented | Uses a UUID that you give for a new session. |
-, -- | Documented | Names the session in the picker and the terminal title. |
-- | Documented | Writes nothing. Print mode only. |
-- | Undocumented | A hidden flag that resumes only up to one message. |
-- | Undocumented | A hidden flag that asks the model to reply at once when the transcript ends with a user message. |
-- | Undocumented | A hidden flag that restores the files to the state at a message and then exits. It needs --. |
claude attach, logs, stop, rm, respawn | Documented | Control background sessions. |
CLAUDE_ | Documented | Resumes a turn that a crash cut off. |
A resumed session restores the history, the model, the agent, the permission mode, an active goal, and scheduled tasks.
It does not restore the values of --mcp-config, --settings, --plugin-dir, --fallback-model, or --add-dir, so pass them again.
If you resume one session in two terminals, the messages mix in one transcript.
Where Files Live
Source: Explore the .claude Directory: Application Data.
CLAUDE_CONFIG_DIR moves ~/.claude.
The <project> name is the folder path with every character other than a letter or a digit changed to -.
A name over 200 characters is cut and gets a hash.
CLAUDE_CODE_PROJECT_DIR_NAME sets the name by hand, and it needs CLAUDE_CONFIG_DIR.
~/.claude/projects/<project>/<session>.jsonltranscript<session>.orphaned-<time>-<id>.jsonlset aside, not in the picker<session>.jsonl.superseded-<time>set aside, not in the picker<session>/subagents/subagent transcriptstool-results/large tool outputs and MCP images
memory/auto memory (never cleaned)
file-history/<session>/snapshots before editsplans/debug/paste-cache/uploads/<session>/dev-mods/<session>/session-env/tasks/shell-snapshots/backups/keeps 5 copies of~/.claude.jsonsessions/one small file per running sessionhistory.jsonlevery prompt you typedstats-cache.jsonremote-settings.jsonpolicy-limits.jsoncache/changelog.md
.credentials.jsonagent-memory/jobs/daemon/settings.jsonplugins/skills/agents/CLAUDE.md
The last column shows whether Claude Code deletes the item after cleanupPeriodDays.
Path under ~/.claude/ | Status | Content | Cleaned |
|---|---|---|---|
projects/ | Documented | The transcript. | ✅ |
projects/ | Documented | The transcripts of subagents. | ✅ |
projects/ | Documented | Large tool outputs and MCP images. | ✅ |
projects/ | Documented | Auto memory. | ❌ |
*., *. | Documented | Transcripts that Claude Code set aside. | ✅ |
file- | Documented | Snapshots from before edits, with the 100 newest checkpoints. | ✅ |
plans/, debug/, paste-, uploads/, dev-, session- | Documented | Plan files, debug logs, pastes, uploads, mods that Claude wrote, and session data. | ✅ |
tasks/, shell-, backups/ | Documented | Task lists, shell setup, and copies of ~/. (5 are kept). | ✅ |
sessions/ | Documented | One small file for each running session, removed at exit. | ❌ |
history. | Documented | Every prompt you typed. | ❌ |
stats-, remote-, policy-, cache/ | Documented | Usage totals, cached organization settings, organization limits, and the changelog. | ❌ |
., agent-, jobs/, daemon/ | Documented | Files that you should keep. | ❌ |
settings., plugins/, skills/, agents/, CLAUDE. | Documented | Your configuration. | ❌ |
state/, mods/, bridge-, seed-, downloads/, cache/ | Undocumented | Seen on a 2.1.304 machine or named in the program. No docs page describes them. | ❓ |
~/.claude.json, next to the folder, holds app state, the sign-in, and personal MCP servers.
The default retention is 30 days, and the minimum is 1.
The scratchpad of a session is in the temp folder (/private/tmp/claude-<uid>/<project>/<session-id>/scratchpad/ on macOS), and claude purge does not touch it.
The files are plain text and are not encrypted.
A secret that a tool prints goes into the transcript.
Lower cleanupPeriodDays or set CLAUDE_CODE_SKIP_PROMPT_HISTORY if that matters to you.
Controls
| Item | Status | Effect |
|---|---|---|
cleanup, desktop | Documented | Set how long Claude Code keeps files. |
CLAUDE_ | Documented | Writes no transcript and no history in any mode. |
CLAUDE_ | Documented | Limits the transcript size of - and SDK sessions. |
CLAUDE_ | Documented | Moves ~/. to another folder. |
CLAUDE_ | Documented | Sets the <project> folder name by hand. Needs CLAUDE_. |
claude purge [path] | Documented | Deletes the transcripts, tasks, file history, and config entry of a project. Flags: --, --, -, -. |
/ | Documented | Exports a conversation. Use it, not the JSONL file, for scripts. |
Example
You close the terminal in the middle of a task.
The next day you run claude --continue in the same folder.
The conversation, the model, and the permission mode come back.
claude --continue
claude --resume my-feature --fork-session
claude purge --dry-run
Related Pages
- Transcript Format
- Context and Compaction
- Architecture
- CLI and Environment Variable pages in Configure.