- Home
- Claude features
- Save a Code session
Save Claude Code session history for later
Name the conversation, return to the right project, and keep a separate record when the work needs to outlast local history.
To save Claude Code session history for later, start by naming the conversation and noting its project directory. Claude Code normally saves a local terminal session as you work: “Sessions are saved continuously” is how Anthropic describes it in the session guide. Reopen the appropriate conversation when you return, and make a separate backup or readable export when the work needs a lasting record.
Choose what you need to save
A saved conversation, a readable transcript, and a copy of your project serve different purposes. You may need all three for a long investigation, but an ordinary pause between workdays usually starts with finding the conversation again. Decide which question tomorrow’s copy must answer before choosing what to keep.
| Your goal | Useful record | Check before relying on it |
|---|---|---|
| Continue the same investigation | A named saved session | You can identify the right conversation and project |
| Read or share what was discussed | A readable transcript export | The relevant exchange and results are present |
| Preserve session evidence beyond local cleanup | A separate copy of the relevant session data | The copy contains the files you intended to keep |
| Keep the implementation itself | Your project files and normal version-control record | Changes and uncommitted work are accounted for |
Before closing a session whose discussion you need to keep, save a readable transcript using the native Claude Code export guide. Open the saved file and confirm the relevant exchange is present. This page concentrates on the session’s lifecycle and backup; a transcript can explain a patch without containing the patch as a usable project change.
Name the session before leaving
Enter the rename command at Claude Code’s prompt, using a name that distinguishes the task from other work in the same repository. The commands reference documents this command and the in-session resume picker.
/rename invoice-csv-empty-row
Choose the behavior under investigation rather than a name such as “today” or “fix.” If you open a second conversation about the same feature, add the specific question that makes it different. A name you can recognize next week is more useful than one that only made sense while the error was on screen.
Before stopping, record the last verified result and the next unresolved step. Here is a hypothetical stopping note for an invoice-import bug; change the details to match the work you actually completed.
Session: invoice-csv-empty-row
Project: invoice-importer
Observed: an empty row between two invoices stops the import.
Verified: the reproduction uses the supplied three-row fixture.
Changed: a proposed parser adjustment is present locally.
Not verified: the full test suite has not been run.
Next: inspect the diff, then run the parser tests.
Keep the note factual. “Proposed adjustment” and “tests passed” are different states, and a stopping note should preserve that difference. If the work becomes a teammate handoff, the GitHub workflow shows how to place a concise explanation alongside the change.
Resume from the right project
Open your shell in the project directory you used for the investigation. For an ordinary interactive session, the continue option loads the most recent conversation in that directory, according to the CLI reference.
Change to your project’s directory. Replace this example path with its actual location.
cd ~/work/invoice-importerContinue the most recent conversation there.
claude --continue
If you have worked on several tasks there since the investigation, choose a conversation instead of assuming the latest one is the right one. Open the picker with this shell command.
claude --resume
You can also resume by the name you assigned. Run this from your shell, not as a message inside an already open conversation.
claude --resume invoice-csv-empty-row
Inside an active Claude Code conversation, use the in-session picker instead. These shell and conversation entry points are easy to confuse when you switch between a terminal tab and Claude’s prompt.
/resume
Check the reopened exchange before issuing another task. In the example, look for the empty-row fixture and the note that the full test suite hasn’t been run. If you see a different bug or an earlier proposal, select the intended conversation before continuing.
Resuming is not a reason to assume your development environment is unchanged. Check the current files and branch, and confirm which supporting services need starting. Anthropic’s restoration documentation specifically says interrupted tool calls are not rerun and ended background work is not restarted by loading the transcript.
Understand what compaction preserves
The conversation Claude actively uses has a finite context window. Compaction replaces earlier conversation context with a summary and can happen automatically as that window fills. This lets the task continue, but a summary is a different record from the exact wording of every earlier exchange.
When you resume a compacted session, Claude uses the last compaction summary, messages left unsummarized, and messages since then. It does not reload the summarized messages into active context, as the session documentation explains. Use the saved conversation record when an exact command, rejected hypothesis, or error message matters.
For the invoice-import example, a useful summary might keep the finding that empty rows caused the failure. You may still need the precise fixture or command output to reproduce it. Keep those concrete items with the project or your reviewed record, and check them directly rather than asking a later summary to reconstruct exact text.
You can check context use with the following command. Treat that view as information about what Claude is using now, not as an inventory of everything you have archived.
/context
Find the local history files
The documented default transcript pattern is below. These are application data under your home directory, separate from project configuration inside a repository.
~/.claude/projects/<project>/<session-id>.jsonl
The directory guide also distinguishes prompt history from conversation transcripts. The following file holds prompts you typed for recall and search; it is not a substitute for the messages and tool results in a session transcript.
~/.claude/history.jsonl
On Windows, look under your own user profile. The default application-data location is:
%USERPROFILE%\.claude
If a custom configuration directory is set, look there instead. The environment variable controlling that location is:
CLAUDE_CONFIG_DIR
Identify the session you need before copying files, and preserve its association with the project. Use the session name, dates, and recognizable content to check your selection. A recently modified file can belong to a different task, especially when you have several conversations open.
JSONL is an internal record format that can change between releases. Keep an untouched copy if you are preserving raw session evidence, and use the native export for a reading copy rather than editing the working transcript. The session storage reference explains the format and configurable location.
Back up a useful stopping point
Choose a stopping point you can describe, such as after confirming a reproduction and before trying another fix. Finish the current work you intend to capture, then copy the relevant session data into your normal private backup location. Date the copy and include the stopping note so you can tell what stage of the investigation it represents.
A session can have related subagent transcripts and large tool-result files, as the application-data reference documents. Include the associated session folder when those records matter. Preserve the project separately: keeping conversation evidence does not preserve every working file or running process.
Check the backup itself, not just the original. Open a copied record or readable export and locate a distinctive exchange, such as the empty-row reproduction. Confirm that any separate fixture, result, or attachment you expect to rely on is also present in the backup package.
As of November 2026, Anthropic gives the cleanup period as “The default is 30 days” in its directory guide. Settings and special cases affect cleanup, so make a separate copy for longer-term records.
Session data is plaintext and can include material read by tools. Keep raw backups private, and review a separate copy before sharing it. If a colleague only needs one result, the output-copy guide may fit that handoff better than the whole history.
Check a missing conversation
Begin with the project and machine where you worked. Then check whether you launched Claude with the same configuration location, and whether you are looking for the latest conversation or a particular named one. These checks are usually easier to interpret than changing several settings at once.
If the work started in VS Code, the official extension guide documents shared history with the CLI and selecting an extension conversation through the terminal resume picker. That terminal route needs the standalone CLI installation. The VS Code history guide covers the editor-specific workflow.
A launch can also disable session persistence, so a missing record is not always a picker problem. The CLI reference documents these controls, including the print-mode flag and an environment variable that applies across modes:
--no-session-persistence
CLAUDE_CODE_SKIP_PROMPT_HISTORY
For your next pause, name the current conversation and write a short verified stopping note. Return from the correct project, select that session, and check one recognizable exchange before asking Claude to continue. If the investigation needs a lasting record, copy and check the evidence while it is still available.
Questions
Do I need a save command before closing the terminal?
Normal Claude Code sessions save continuously. Give the conversation a recognizable name before leaving, and distinguish the saved conversation from commands or processes that were running in that terminal.
Which Claude history command reopens an old conversation?
Use the resume picker to select a saved conversation. Up-arrow prompt recall is useful for reusing something you typed, but it is a different task from returning to an earlier conversation.
Does compaction mean the whole transcript is active again when I resume?
No. A compacted session resumes with the last compaction summary, messages left unsummarized, and subsequent messages. Check the saved record when you need an exact earlier exchange.
Can I resume a VS Code extension conversation in the terminal?
Yes. Anthropic documents shared conversation history between the extension and CLI. The terminal route requires the standalone CLI installation; installing the extension alone does not put the terminal command on your PATH.
Will local Claude Code history stay available forever?
No. Keep a separate copy for a lasting record; the backup section below explains the retention limit.