
Claude Code Chat History: Find, Read & Export Past Sessions
Find any past Claude Code session on disk, export it to clean markdown with the built-in /export command, and reread long sessions in a reader built for AI output.
Claude Code writes every session to disk, but the files are JSONL buried under your home directory, and the CLI itself has no browser. That gap is the whole problem. You finished a two hour pairing session yesterday where Claude explained your migration plan, and today you need that paragraph for a pull request description. Scrolling the terminal is not going to work, and the output is already past the scrollback limit anyway.
This guide gives you the three operations you need: find the session file, read it without going cross-eyed, and export it to markdown you can keep. None of these steps need a plugin, a login, or a paid add-on. The CLI already ships with the one command that matters, and the file format is boring enough to script around in ten minutes. By the end you will have a reliable loop for turning closed Claude Code sessions into a searchable archive.
Where Claude Code Keeps Your Chat History
Every Claude Code session is a single JSONL file under ~/.claude/projects/ on macOS and Linux, or %USERPROFILE%\.claude\projects\ on Windows. Each project you have used Claude Code inside gets its own folder, and the folder name is your project path with slashes rewritten as dashes. A project at /Users/you/code/api becomes -Users-you-code-api. Inside that folder, each session is a file named after its session ID with a .jsonl extension.
The format is one JSON object per line, each line representing a user message, an assistant message, or a tool event in the order it happened. The schema is stable enough to parse with a short script, and you can skim one in your terminal with less or bat to get a feel. If you want the quick win, run ls -lt ~/.claude/projects/*/*.jsonl | head -10 to see your ten most recently touched sessions across every project at once. That one line is usually enough to find the conversation you half remember from this morning.
A few quirks save pain later. Resumed sessions can create a sibling file, so if a transcript feels truncated at the top, look for an older .jsonl in the same folder and read them in order. The files are plaintext, so they are indexable by rg or any content search tool you already use. They can also contain secrets if Claude Code ever read a .env for you, which means the folder deserves the same care as any credentials directory on your machine.
Find a Specific Past Session Fast
Two patterns cover almost every search you will run. The first is time based, where you know roughly when the session happened and want the most recent matches. The second is content based, where you remember a phrase from the exchange but not when it happened. Both work off the raw folder with tools you already have.
- Time based lookup.
ls -lt ~/.claude/projects/-Users-you-code-api/*.jsonl | head -5lists the five most recent sessions in one project, newest first. - Content based lookup.
rg -l "migration plan" ~/.claude/projects/returns the files that mention the phrase, andrg -C 3 "migration plan" <file>shows the surrounding turns.
Our earlier walkthrough of the folder layout and the built-in exporter covers the mechanics in more depth at how to find and read Claude Code chat history. Once you have the target file, you have two realistic ways to read it. Open the JSONL directly with a pager if you only need to grep a few lines, or export it to markdown if you want to reread the session properly. The markdown path is almost always worth the extra 20 seconds for anything longer than a dozen turns.
Export a Session to Clean Markdown
The fastest export is the one built into the CLI. Inside an active session, type /export and Claude Code writes the full conversation to a .md file in your working directory with turn headers and fenced code blocks preserved. For closed sessions, point a short script at the JSONL, pull type, role, and content out of each line, and emit ## User and ## Assistant headers followed by the message body. That script is under 30 lines in Python or Node, and once you have it, exporting a whole project folder is a loop.
Keep the tool call blocks in your export. The tool call log is often where the real reasoning sits, because Claude Code explains why it is about to edit a file right before it does, and stripping those blocks leaves you with half of the conversation. Do trim giant tool outputs down to the first and last 50 lines so the markdown stays readable. A single ripgrep across a monorepo can bloat a session file by megabytes, and none of those megabytes will help you a week later. For a related angle on the layout problem, handle long code blocks in AI answers covers the reader side.
If the tooling landscape is new to you, the Claude Code docs at docs.claude.com describe the official commands, and the CLI source at anthropics/claude-code shows how messages are serialized if you want to write a stricter parser. Neither is required reading for the basic export flow, but both help when you want to batch process and rename files by project automatically. A one hour investment on a proper converter pays off within a week if you run Claude Code daily. The payoff compounds because the markdown archive becomes searchable, shareable, and far smaller than the raw JSONL.
Read Exported Sessions Without Losing the Plot
A 90 minute Claude Code session is often 15,000 to 40,000 words of prose, bash output, diffs, and code mixed together. Dropping that into Notion flattens the typography and buries the headings. Dropping it into VS Code gives you a wall of monospace with no outline. You want a reader that treats long AI output as a document, not as a message log, and that keeps code and prose visually distinct.
That is why Prism MD exists. It renders markdown with real serif typography, keeps code blocks monospaced and copyable, builds an outline from your H2 headings, and handles 30,000 word files on a phone without choking. The workflow stays short: finish a session, run /export or convert the JSONL, drop the .md into Prism MD, skim the outline, jump to the three turns that mattered, close the laptop. If you want the longer argument for why a dedicated reader beats a general editor for this kind of material, the best markdown reader for AI content spells it out.
Before you sync any export to the cloud, redact credentials. Transcripts can contain tokens, database URLs, and anything else Claude Code read on your behalf, so a one pass scrub is worth building into the export script. The companion guide at redact sensitive info from AI conversations has the patterns most teams use. The scrub works best as a step inside your JSONL converter rather than a manual pass afterwards, because human review of 30,000 word files is exactly the kind of chore people skip.
FAQ
Can I search every past Claude Code session at once? Yes. Because the files are JSONL, rg -l "your query" ~/.claude/projects/ scans the whole archive in under a second on a normal machine. For a nicer experience, export the sessions to markdown first and search them in a reader that respects headings and code blocks. A full text search across your own history is often faster than asking the model to remember what you worked on last Thursday.
Does the /export command work on old, closed sessions? No. /export only writes the current active conversation. For closed sessions, read the .jsonl file directly or run a short converter script that walks the folder and emits one markdown file per session. That script is a one time write and saves hours over the course of a project.
What happens if I delete a session file? Nothing breaks. Claude Code does not need past files to start new sessions. If you want a safety net, move files into a ~/.claude/archive/ folder rather than deleting them outright, because the CLI has no trash can and recovery means dipping into your Time Machine or other backup tool. A simple rule works well: never delete, only archive, until the quarter is over.
Is there a way to continue a past session? Yes, with claude --continue or claude -c inside the same project directory. The CLI picks up the most recent session and may write a new sibling JSONL that references the prior one. When you export, remember to grab both files if the conversation spans the boundary between runs. Resumed sessions are the single most common cause of truncated exports, so build the sibling check into your script and it stops being a surprise.
Open Your Claude Code Archive in a Real Reader
Reread your Claude Code archive like documents
Free to start — no credit card.
Related reading

How to Find and Read Claude Code Chat History (Step-by-Step)
7 min read · claude-code · ai-coding-agent

Claude Code Archive: How to Find and Read Old Sessions (2026)
7 min read · claude-code · archive

How to Find and Read Google Gemini CLI Chat History: Step-by-Step Guide
6 min read · gemini-cli · ai-tools
Ready to read your own AI documents?
Open ChatGPT, Claude, Gemini, or any markdown file in the reader built for the way models write.
- ✓Renders code, math & Mermaid out of the box
- ✓Works offline once you've opened a doc
- ✓Free forever for personal reading