Skip to main content
← All posts
A 30s South Asian man developer in a slim-fit dark navy shirt at a minimal black-stained oak desk in a dimly lit home office at night, looking at a split-screen laptop showing a dark terminal with coral-highlighted JSONL file paths on the left and a rendered clean markdown transcript with coral H2 headings on the right, Monocle editorial photography, warm coral screen glow on face
·7 min read

Claude Code Archive 2026: Find, Restore, Export Chats

Claude Code keeps every session on disk. Here is how to find any past chat in seconds, resume it in the CLI, and export it to readable markdown.

Claude Code keeps every session you have ever run. The archive is not a hidden menu or a paid feature. It is a folder called ~/.claude/projects/ on macOS and Linux, and %USERPROFILE%\.claude\projects\ on Windows. This post pulls together the three things people want from that folder: finding any session you have had, resuming one to continue working, and exporting the transcript to a readable format. The quick-start answer is above, and each section below covers one operation in full.

How The Claude Code Archive Works

Each session you start becomes a single .jsonl file inside a subfolder named after your project directory. The subfolder uses your working directory path with slashes replaced by dashes, so a project at /Users/you/code/api becomes -Users-you-code-api. Every line in the file is a JSON object representing one message: your prompt, the assistant reply, a tool call, or tool output. The timestamp in the filename is when the session started, not when it ended.

Nothing is purged automatically. Claude Code does not enforce a retention window, does not compress old sessions, and does not move anything to cold storage. If you have been using the tool daily for a year, every session from day one is still sitting in that folder exactly as it was written. The folder grows proportionally with use, reaching somewhere between 100 MB and 4 GB for heavy daily users over twelve months. That is small enough that most people never need to prune it, and simple enough that any backup tool handles it without configuration. Our earlier guide covers the full folder layout and file schema if you want the complete picture of how the JSONL structure maps to what you see on screen.

Find Any Past Session In Under Ten Seconds

The archive is on disk, so finding anything in it is a shell problem. The good news is that two commands cover the majority of real lookups. Neither requires any special tooling beyond what ships with your system, though one of them runs faster with ripgrep installed. The setup cost is minimal, and the time savings compound quickly once you start using the archive regularly.

  • List the ten most recent sessions across all projects: ls -lt ~/.claude/projects/*/*.jsonl | head -10
  • Search every session for a phrase or code snippet: rg -l "your search term" ~/.claude/projects/

The ls -lt command sorts by modification time, newest first, and the top of the list is almost always the session you are thinking of. If not, the timestamp in the filename narrows it down without much effort. The rg -l command requires ripgrep, which is one brew install ripgrep or apt install ripgrep away and pays for itself across dozens of daily tasks. It prints only the file paths where your search term appears, so the output stays readable even when a phrase occurs in many sessions. Drop the -l flag to see the matching lines in context, with surrounding content visible at the standard ripgrep defaults.

Resume A Past Session And Continue Working

Finding a file and resuming a session are two different operations. The file gives you a read-only transcript for reference. Resuming picks up the full conversation state inside the CLI and lets you continue working from where you stopped. Both are useful, but they answer different questions, so it helps to be clear on which one you need before you start.

To resume a session, run claude --resume from the same project directory where the original session was started. Claude Code presents the most recent sessions for that directory and lets you select one from a short list. Once you pick a session, it loads the full context back into the model window and the conversation continues as though the terminal was never closed. The resumed conversation is saved as a new .jsonl file, but the original file remains on disk untouched.

The --resume flag only works for sessions that belong to the current working directory. If you want to resume a session from a different project, change to that directory first with cd, then run claude --resume. Cross-project resume is not supported within a single CLI invocation. This design keeps context clean but means you need to know which project directory the original session was started from. That detail is encoded in the subfolder name inside ~/.claude/projects/, so it is usually a quick lookup once you have located the file.

Export A Session To Readable Markdown

JSONL is the right format for a machine to write and an uncomfortable format for a human to read later. The raw file has escaped newlines, inline JSON for every tool call, and code blocks that render as literal backslash strings in most text editors. Reading a long transcript in that state is slow and easy to get wrong. The export step converts the structured log into clean markdown that opens normally in any reader or editor.

If the session is still open, the fastest export path is /export inside the CLI. It writes a clean markdown file to the current directory and handles all the escaping automatically. If the session has already ended, a short jq pipeline extracts the assistant turns: cat session.jsonl | jq -r 'select(.type == "say") | .message.content'. That output is flat but readable, and it covers the basic need in most cases. The Codex CLI export and search guide covers comparable patterns for Codex sessions, and most of the shell patterns transfer directly to Claude Code files because both tools follow similar JSONL conventions.

Read The Export Without Squinting

Exporting a session produces a markdown file that may contain code blocks, tables, math output from tool calls, and diagrams if the model generated any. Opening that file in a plain editor works for short sessions. For anything that ran over an hour or produced substantial structured output, a plain preview loses the visual hierarchy entirely and makes scanning much harder than it needs to be. The right approach is a reader built to handle the specific patterns AI conversations produce.

A reader built for AI-generated markdown keeps code blocks monospaced, renders LaTeX if the session touched math, draws Mermaid diagrams inline, and builds an outline from the H2s so you can jump to any section without scrolling. Search becomes faster too, because a rendered outline is easier to scan than a flat wall of text. For sessions that produced tables or complex tool output, the difference between a plain editor and a proper markdown reader is immediately visible. If you export sessions regularly, reading Claude Code chat history with a proper renderer covers the setup and explains what gets lost when you open a JSONL-derived transcript in a standard preview. The complete Claude Code chat history guide also covers what different export paths preserve and what they drop, which is worth reading before you commit to a workflow.

Read your Claude Code archive like a document, not a log.

Free to start — no credit card.

Open Prism MD free →

FAQ

Is there an archive button or menu inside Claude Code? No. There is no archive command, no archive menu, and no retention settings inside the CLI. The folder at ~/.claude/projects/ is the only place sessions are stored, and it is written to automatically the moment a session starts. If you want archive-style browsing, build it with ls, rg, and your backup tool of choice. The shell commands in this guide are the equivalent of that archive interface.

Can I move old session files without breaking Claude Code? Yes. Claude Code does not reread old session files after they close, so moving .jsonl files to any location on disk has no effect on future sessions or on the CLI. A common pattern is ~/.claude/archive/YYYY-QN/ for quarterly rollover, which keeps the active folder small and keeps old sessions discoverable. The one exception is a session you are currently trying to resume: do not move that file until you have finished with it.

What is the difference between resuming and exporting? Resuming a session loads its context back into the model window so you can continue the conversation. Exporting a session converts the JSONL file to a human-readable format for reference, review, or sharing. You cannot resume a session that has been exported; the two operations are independent. If you want both, resume first to finish the work, then export the final file once the session is closed.

Is the archive secure? The files are plain text and unencrypted. If Claude Code read a secret from an environment file or printed an API key during a session, that string is stored in the archive in clear text. Before syncing the archive to a shared drive or attaching any file to a support ticket, grep for known key prefixes such as AWS_, SECRET, and TOKEN, and redact or exclude the offending files. This is especially important before sharing an export with a teammate or uploading a transcript to any external service.

Related reading

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