Claude Code stores session transcripts on your machine as JSONL files in ~/.claude/projects/<project>/<session-id>.jsonl and deletes them after 30 days by default. Settings live in ~/.claude/settings.json (you) and .claude/settings.json (the project), and auto memory sits in ~/.claude/projects/<project>/memory/.
ls ~/.claude/projects/
Applies to: Claude Code 2.1.296 (changelog), docs as of October 10, 2026. Last checked: October 10, 2026.
On this page
Where are Claude Code sessions stored?
Anthropic’s session docs give the path: ~/.claude/projects/<project>/<session-id>.jsonl. The <project> folder name is your working directory path with every character that isn’t a letter or digit replaced by -, so a session started in /home/user/work/my-repo lands in ~/.claude/projects/-home-user-work-my-repo/. Names longer than 200 characters are cut to 200 and get a hash of the full path appended.
Each line of the file is a JSON object for a message, a tool call or metadata. The docs warn that this format “is internal to Claude Code and changes between versions”, so scripts that parse it directly can break on any release. Next to the transcript, the same project folder holds subagent transcripts (<session>/subagents/) and large tool outputs (<session>/tool-results/) (application data).
On Windows, ~/.claude means %USERPROFILE%\.claude (settings docs).
Are sessions saved, and can I resume them?
Yes. Sessions are written continuously, so you can return after exiting or after /clear (resume a session):
| Command | What it does |
|---|---|
claude --continue | Reopens the most recent session in the current directory |
claude --resume | Opens the session picker |
claude --resume <name> | Resumes a named session |
claude --resume <transcript-path> | Resumes the session in that .jsonl file |
/resume | Switches session from inside Claude Code |
To get a readable copy instead of raw JSONL, run /export, which copies the conversation to the clipboard or saves it as a plain-text file. For scripts, the docs point to claude -p --output-format json, claude -p --resume <session-id>, the transcript_path field that hooks receive, or the Agent SDK (export and locate session data).
Where are Claude Code settings and config files?
Claude Code reads four settings files, plus managed settings from an organization (settings files and who they affect):
| Scope | File | Applies to |
|---|---|---|
| User | ~/.claude/settings.json | You, in every project on this machine |
| Shared project | .claude/settings.json | Everyone in the project once committed |
| Project local | .claude/settings.local.json | You, in this project only; kept out of git when Claude Code creates it |
| Managed | managed-settings.json and other managed sources | Everyone your organization deploys it to |
Installing Claude Code creates none of these. It writes ~/.claude/settings.json the first time you change a user option in /config, and .claude/settings.local.json the first time you answer a permission prompt with “Yes, and don’t ask again”.
A fifth file, ~/.claude.json, is one Claude Code writes for itself. The docs say it holds your sign-in session, MCP server configurations, per-project state such as trust decisions, and the global config keys /config writes; you don’t need to edit it.
Where are CLAUDE.md and auto memory stored?
Instruction files you write are covered in our CLAUDE.md best practices and global CLAUDE.md guides: ~/.claude/CLAUDE.md for you, ./CLAUDE.md or ./.claude/CLAUDE.md for the project.
Auto memory, the notes Claude writes itself, goes to ~/.claude/projects/<project>/memory/, with a MEMORY.md index and one Markdown file per topic (storage location). For auto memory the <project> is derived from the git repository, so all worktrees and subdirectories of one repo share a single memory folder. It is machine-local: it isn’t shared across machines or cloud environments. To keep it elsewhere, set autoMemoryDirectory to an absolute path or one starting with ~/:
{
"autoMemoryDirectory": "~/my-custom-memory-dir"
}
Skills you install personally live in ~/.claude/skills/; see our Claude Code skills guide.
What else does ~/.claude hold?
The .claude directory reference lists the data Claude Code writes during sessions. The main paths:
Path under ~/.claude/ | Contents | Cleaned up after cleanupPeriodDays? |
|---|---|---|
projects/<project>/<session>.jsonl | Full transcript: every message, tool call and tool result | Yes |
file-history/<session>/ | Pre-edit snapshots used for checkpoint restore | Yes |
plans/ | Plan files from plan mode | Yes |
debug/ | Debug logs when you start with --debug or run /debug | Yes |
paste-cache/ | Contents of large pastes | Yes |
history.jsonl | Every prompt you typed, for up-arrow and Ctrl+R recall | No, kept until you delete it |
stats-cache.json | Token and cost totals shown by /usage | No |
.credentials.json | Login credentials | Keep this file |
Per-session scratchpad files are not under ~/.claude but under the system temp directory, for example /tmp/claude-<uid>/<project>/<session-id>/scratchpad/ on Linux (session scratchpad directory).
How long does Claude Code keep sessions?
Thirty days by default. Claude Code runs a background sweep after a session starts and deletes transcripts and the other “cleaned up automatically” files older than cleanupPeriodDays (cleanupPeriodDays). The sweep deletes without a message, so an old session simply disappears from the /resume picker. The minimum is 1; 0 fails validation. This example from the reference keeps 20 days:
{
"cleanupPeriodDays": 20
}
Exceptions the docs list:
- Auto memory files are not swept.
- Claude Desktop and Cowork transcripts are kept at any age unless you set
desktopSessionCleanupPeriodDays(v2.1.248 or later), or managed settings setcleanupPeriodDays. claude -p --bareruns skip the sweep for that session.
That local retention is separate from what Anthropic keeps on its side. The data usage page gives 30 days for commercial accounts by default; for Free, Pro and Max accounts it is 30 days if you don’t allow data use for model improvement and five years if you do, a choice made at claude.ai/settings/data-privacy-controls.
Are Claude Code sessions private?
They are plain text on your disk. The docs state that transcripts and history “are not encrypted at rest. OS file permissions are the only protection.” Anything that passes through a tool is written to the transcript, so if Claude reads a .env file or a command prints a credential, that value is in projects/<project>/<session>.jsonl (plaintext storage).
Ways to reduce what is kept, from the same section:
- Lower
cleanupPeriodDays. - Set
desktopSessionCleanupPeriodDaysfor Desktop and Cowork transcripts. - Set the
CLAUDE_CODE_SKIP_PROMPT_HISTORYenvironment variable to skip writing transcripts and prompt history in any mode, or pass--no-session-persistencewithclaude -pfor a single run. - Add permission rules that deny reads of credential files.
How do I move or delete Claude Code data?
To keep everything somewhere other than ~/.claude, set CLAUDE_CONFIG_DIR; settings, session history and plugins then go there. To delete one project’s local state, use claude purge (named claude project purge before v2.1.288). Preview first:
claude purge ~/work/my-repo --dry-run
Then run it without --dry-run and confirm, or add --yes in scripts; --all purges every project. According to the clear local data section, it removes the project’s transcripts and auto memory under projects/, its tasks/, debug/ and file-history/ entries, its lines in history.jsonl and its entry in ~/.claude.json. It doesn’t touch the scratchpad or pasted images in the temp directory, shell-snapshots/ or backups/.
The docs also say not to delete ~/.claude.json, ~/.claude/settings.json or ~/.claude/plugins/, which hold your auth, preferences and installed plugins.





