All insights

Coding agents

Claude Code History: Find, Resume, and Export Past Sessions

Learn how to find and resume Claude Code sessions, export a readable transcript, and understand the limits of retention and deletion.

Illustration for Claude code history

To return to a past Claude Code CLI conversation, run claude --resume to open the session picker, or claude --continue to reopen the latest session in the current directory. To save a readable copy, enter /export inside a session and choose whether to copy it or save it as a plain-text file. Session history is different from shell command history and from memory managed by a separate API-based application. (Claude Code session documentation)

What “Claude Code history” means

A Claude Code session is a saved conversation associated with a project directory. The CLI saves sessions locally as you work, so you can return to a conversation later. That is not the same as shell history, which records terminal commands, or an application’s own policy for storing and reusing conversation context. (Claude Code session documentation)

A saved conversation is also not a snapshot of your project files. Resuming returns you to the conversation; use version control or file-checkpointing features when you need to review or revert file changes. (Claude Code session documentation)

Find and resume a past session

From the project directory where you worked:

  • Run claude --continue to reopen the latest session in that directory.
  • Run claude --resume to open the session picker and choose a conversation.
  • Run claude --resume <name> to resume a named session.
  • Inside an active session, use /resume to switch to another conversation.

If a session does not appear, check that you are in the relevant project and use the picker to look for it. (Claude Code session documentation)

Export a readable transcript

Inside the conversation you want to keep, enter:

/export

Claude Code opens a menu where you can copy the current conversation to your clipboard or save it as a plain-text file. The export renders messages and tool outputs as readable text. This creates a separate record for reading or sharing—it is not a command to resume the session. (Claude Code session documentation)

Before sharing an export, review it for content you did not intend to disclose. The transcript can include tool outputs as well as conversation text. (Claude Code session documentation)

If your goal is… Use… Keep in mind
Continue your latest CLI conversation claude --continue Reopens the latest session in the current directory.
Choose an earlier conversation claude --resume Opens the session picker.
Keep a readable record /export inside the session Copies to the clipboard or saves a plain-text file; it does not itself resume the session.
Remove a project’s local Claude Code state Check the installed CLI’s purge help and preview before confirming deletion The release notes describe a project-purge command and --dry-run preview, but the available excerpt does not establish the command’s default target or exact target-selection procedure. Do not assume a bare invocation selects the project you intend. (release notes)

How session history relates to production model APIs

Claude Code’s CLI sessions are a feature of the coding tool. They do not automatically provide conversation memory to a separate application you build with a model API. In the Messages API’s stateless multi-turn pattern, the application sends the conversation history it wants the model to use. That is a separate design choice from resuming a Claude Code CLI session. (Messages API documentation)

Privacy, retention, and deletion

The session documentation says local transcripts are saved continuously and that you can return to a session after exiting or running /clear. So /clear should not be treated as proof that the saved session was erased. (Claude Code session documentation)

Claude Code release notes describe claude project purge as removing project state, including transcripts, tasks, file history, and the project’s config entry. They list --dry-run for preview and --interactive as an option to choose. However, the available documentation excerpt does not establish the command’s default target, whether a project argument is required, or the exact sequence for selecting and previewing a particular project. Before deleting anything, consult the purge help in your installed CLI and confirm that the preview identifies the intended project. Do not rely on a bare command until you have confirmed its target behavior. A local project purge also does not establish that separately saved exports, backups, or provider-held data have been deleted. (release notes)

Retention qualification: This guide does not state a numeric automatic-cleanup default. Check the current Claude Code settings reference for the applicable retention setting and scope before relying on a session remaining available indefinitely. (Claude Code settings reference)

Bottom line

Use claude --resume to choose a past CLI conversation, claude --continue to reopen the latest session in the current directory, and /export inside a session to save or copy a readable transcript. Treat the export as a separate record, not as API memory or a guarantee of permanent retention. For deletion, verify the target-selection procedure and preview in your installed CLI before confirming a purge.

Sources

Manage sessions — Claude Code Docs

Week 18 — Claude Code Docs

All settings — Claude Code Docs

Using the Messages API — Claude Platform Docs

Contact us