Where Are Claude Code Sessions and Chat History Stored?
Claude Code stores your sessions locally on your computer, inside the ~/.claude/projects/ folder. Each session is saved as a .jsonl file named after the session ID, grouped in a folder for the project where you ran Claude Code.
Nothing is stored inside your project folder, and nothing is saved in the cloud for terminal sessions. The files are plain text on your own disk.
This article shows exactly where to find them on each operating system, what’s inside, how to resume a session, and how long Claude Code keeps them.
The session folder location
Here’s where the session folder lives on each operating system:
| OS | Location |
|---|---|
| macOS | /Users/<you>/.claude/projects/ |
| Linux / WSL | /home/<you>/.claude/projects/ |
| Windows | C:\Users\<you>\.claude\projects\ |
On Windows, ~/.claude means %USERPROFILE%\.claude.
If you’ve set the CLAUDE_CONFIG_DIR environment variable, Claude Code uses that directory instead of ~/.claude.
How the files are organized
Inside projects/, Claude Code creates one folder per project. The folder name is the full path of your project, with every character that isn’t a letter or digit replaced by a dash (-).
For example, if you run Claude Code in /Users/nathan/projects/my-app, the sessions are saved in:
~/.claude/projects/-Users-nathan-projects-my-app/
Inside that folder, each session gets its own file:
~/.claude/projects/-Users-nathan-projects-my-app/
├── 1055fb67-3074-40cf-86f2-80b2f978486a.jsonl
├── 4e125b22-3a9d-4ad2-be56-d78df93afb4c.jsonl
├── 4e125b22-3a9d-4ad2-be56-d78df93afb4c/
│ ├── subagents/
│ └── tool-results/
└── memory/
Here’s what each item contains:
<session-id>.jsonlis the full conversation transcript: every message, tool call, and tool result<session-id>/subagents/holds the transcripts of any subagents that session started<session-id>/tool-results/holds large tool outputs that were too big to keep in the main transcriptmemory/is the auto memory for the project, not a session (see where Claude Code memory is stored)
To list the session files for your current project on macOS or Linux, run:
ls ~/.claude/projects/
Then open the folder that matches your project path.
What’s inside a session file
A .jsonl file is “JSON Lines”: one JSON object per line. Each line is an event in the session, such as your message, Claude’s reply, a tool call, or a file snapshot.
You can peek at the first few lines with head:
head -n 3 ~/.claude/projects/-Users-nathan-projects-my-app/<session-id>.jsonl
The output looks like this (shortened):
{"type":"permission-mode","permissionMode":"default","sessionId":"1055fb67-..."}
{"type":"user","message":{"role":"user","content":"fix the failing test"}, ...}
{"type":"assistant","message":{"role":"assistant","content":[...]}, ...}
The files are not meant to be edited by hand. Use them for searching or backing up past conversations.
How to resume a past session
You don’t need to open these files to continue a conversation. Claude Code reads them for you:
claude --continue(orclaude -c) resumes the most recent session in the current folderclaude --resume(orclaude -r) opens a picker to choose a past session/resumedoes the same from inside a running session
Since sessions are grouped by project path, run these commands from the same folder where you started the original session.
Where is the prompt history stored?
Separate from the transcripts, Claude Code keeps a list of every prompt you typed in ~/.claude/history.jsonl.
That file powers the up-arrow recall and Ctrl+R history search in the terminal. It only holds your prompts, not Claude’s answers.
How long are sessions kept?
By default, Claude Code deletes session transcripts that are older than 30 days.
You can change this with the cleanupPeriodDays setting in your ~/.claude/settings.json file. For example, to keep sessions for 90 days:
{
"cleanupPeriodDays": 90
}
The minimum value is 1. The auto memory in memory/ is not deleted by this cleanup.
If you want to know where this settings file lives, see where is the Claude Code settings.json file.
Are Claude Code sessions private?
The session files are stored locally on your machine and only protected by your operating system’s file permissions. They are not encrypted.
This matters because anything Claude reads ends up in the transcript. If Claude opens a .env file or a command prints an API key, that value is written to the .jsonl file.
To reduce the risk:
- Lower
cleanupPeriodDaysso old transcripts are deleted sooner - Add permission rules that deny reading secret files like
.env - Run
claude purgeto delete all transcripts, memory, and history for one project
You can preview what claude purge would delete before removing anything:
claude purge ~/projects/my-app --dry-run
Conclusion
Claude Code saves each session as a .jsonl file under ~/.claude/projects/<project>/, where the project folder name is your project path with dashes.
You can resume any of them with claude --resume, they’re kept for 30 days by default, and you can wipe a project’s history with claude purge.