Where Claude Code stores conversation history

Published · Updated · Checked against Claude Code 2.1.319

~/.claude/projects/<project>/<session-id>.jsonl, where <project> is your working directory with every character other than a letter or digit replaced by -. The files are plain text and unencrypted, one JSON object per line, and Claude Code deletes them after 30 days by default.

The docs reference versions up to v2.1.314 and call the line format internal. Everything about the format below comes from real transcripts written by Claude Code 2.1.319 on macOS.

The path

The Manage sessions page gives the rules. Transcripts are JSONL at ~/.claude/projects/<project>/<session-id>.jsonl. The <project> part is the working directory path with non-alphanumeric characters replaced by -, and a converted name over 200 characters is truncated to 200 with a hash of the full path appended.

ls ~/.claude/projects/
pwd | sed 's/[^A-Za-z0-9]/-/g'      # what this directory is called there
ls -t ~/.claude/projects/-Users-me-myapp | head

By that rule /Users/me/my.app and /Users/me/my-app both become -Users-me-my-app and share a folder. This is untested; it follows from the stated rule.

On Windows, ~/.claude means %USERPROFILE%\.claude. Two environment variables move things:

VariableEffect
CLAUDE_CONFIG_DIREverything that would be in ~/.claude lives there instead, plus .claude.json
CLAUDE_CODE_PROJECT_DIR_NAMENames the <project> folder yourself. Needs CLAUDE_CONFIG_DIR, 1 to 64 letters, digits, hyphens or underscores, and v2.1.234 or later

What else is in ~/.claude

This table follows the claude-directory page. "Swept" means deleted once older than cleanupPeriodDays (default 30).

Path under ~/.claude/ContentsSwept
projects/<project>/<session>.jsonlThe transcriptyes
projects/<project>/<session>/subagents/Subagent transcripts, same formatwith the parent
projects/<project>/<session>/tool-results/Large tool outputs and MCP imagesyes
projects/<project>/memory/Auto memoryno
history.jsonlPrompts you typed, with timestamp and project pathno
file-history/<session>/Pre-edit snapshots for checkpoint restoreyes
plans/, debug/, paste-cache/Plans, debug logs, large pastesyes
sessions/One small file per running sessionremoved on exit

The same page says transcripts and history are not encrypted, and that anything passing through a tool lands on disk: file contents, command output, pasted text. A transcript can also include the system prompt, tool definitions and the instruction files Claude Code loaded, so if a tool read a .env file, its content may be in there.

The line format

The docs put it this way: "The entry format is internal to Claude Code and changes between versions, so scripts that parse these files directly can break on any release." They point to /export and the script interfaces instead. What follows is a snapshot of 2.1.319.

Every line is a JSON object with a type. To count them in a session:

f=~/.claude/projects/-Users-me-myapp/<session-id>.jsonl
jq -r '.type' "$f" | sort | uniq -c | sort -rn

On 2.1.319 that gave attachment, assistant, user, api-request, api-request-blob, ai-title, last-prompt, permission-mode, queue-operation and a few more. The ones you will actually read:

typeWhat it is
userA user message. .message.content is a string for typed prompts, or an array holding tool_result blocks
assistantA model reply. .message.content is an array of text, thinking and tool_use blocks, plus .message.usage with token counts
ai-titleThe generated session title, in .aiTitle

Conversation lines carry uuid, parentUuid, sessionId, timestamp, cwd, gitBranch, version and isSidechain. The parentUuid links form the message chain, and issue anthropics/claude-code#40319 is a community analysis that traces resume bugs to that chain breaking. Anthropic has not confirmed the analysis. The api-request and api-request-blob types match the docs' note that a transcript can record the requests Claude Code sent the model.

Reading it with jq

Your typed prompts, with times:

jq -r 'select(.type=="user" and (.message.content|type=="string"))
       | "\(.timestamp)  \(.message.content)"' "$f"

The assistant's text replies:

jq -r 'select(.type=="assistant") | .message.content[]?
       | select(.type=="text") | .text' "$f"

Every tool the session called:

jq -r 'select(.type=="assistant") | .message.content[]?
       | select(.type=="tool_use") | .name' "$f" | sort | uniq -c | sort -rn

Shell commands it ran (the Bash tool's input has a command field):

jq -r 'select(.type=="assistant") | .message.content[]?
       | select(.type=="tool_use" and .name=="Bash") | .input.command' "$f"

The session title:

jq -r 'select(.type=="ai-title") | .aiTitle' "$f" | tail -1

And a word search across a whole project folder:

grep -l "migration" ~/.claude/projects/-Users-me-myapp/*.jsonl

For a readable copy of one session the supported route is /export, which writes the conversation as plain text; pass a filename to skip the menu. Finding a session by content across many projects is covered in searching past Claude Code conversations.

Things that go wrong

Do not edit a transcript in place, since the resume loader reads these files; copy first. Resuming the same session in two terminals interleaves both into one transcript, per the docs. And the files do not last, as Claude Code silently deletes transcripts after 30 days explains. Codex uses a different layout, described in where Codex stores sessions.

Sealkeep sits beside all this without touching it. A hook catches each finished session, encrypts it on your machine, uploads it to storage you choose and reads it back to verify. With sealkeep search <query> --content you can search inside sessions, and sealkeep recover <id> <dest> brings back the original bytes. It does not change where Claude Code writes or turn the JSONL into another format, and it does not rewrite your transcripts. Reclaiming local disk needs Sealkeep Cloud today.

All of this was read from the docs on 10 November 2026.

FAQ

Where does Claude Code store conversation history on Windows?

%USERPROFILE%\.claude\projects\. The docs say ~/.claude resolves to %USERPROFILE%\.claude there.

Is the history encrypted?

No. The docs say transcripts and history are not encrypted at rest, and file permissions are the only protection.

Is history.jsonl the conversation?

No. It holds the prompts you typed, with timestamp and project path, used for up-arrow recall and Ctrl+R search.

Can I change where it is stored?

Set CLAUDE_CONFIG_DIR and everything that would be in ~/.claude lives in that directory instead.

Back to all guides