Claude Code session recovery: resume first, then verify.

If a Claude Code session stops mid-task, first try Claude's built-in continuation options. claude --continue opens the most recent conversation for the current directory; claude --resume lets you choose a session or resume one by ID. Then inspect the working tree and rerun the relevant check before trusting a remembered completion claim.

Free first step: from the same project directory, try claude --continue. If it opens the wrong conversation, use claude --resume and select the intended session. Neither command proves that the repository is clean or that a test passed.

What survives a stopped Claude Code session?

Claude Code stores conversation messages, tool calls, and results locally as JSONL under ~/.claude/projects/. The directory contains project-specific session files, commonly with a .jsonl extension. The exact project-directory name is derived from the working location, so avoid guessing a filename from the UI title alone. Claude also works against ordinary repository files and Git state. These are different records: the JSONL shows what the session said and attempted; the working tree shows what is currently on disk.

A crash or closed terminal does not automatically erase the work. Conversely, a surviving chat history does not imply the edit was saved, tested, or committed. Start by checking both surfaces. Run git status --short to list changes, git diff --stat to see their scope, and git diff to inspect content. If there are untracked files, open them explicitly; Git diff does not include their contents. Look at recent commits only when the task may have committed part of the work.

Use claude --continue for the latest session.

In a terminal opened at the original project directory, claude --continue (or claude -c) loads the most recent conversation for that directory. This is the fastest path when you closed the terminal and immediately want to keep working. Once it opens, ask Claude to state the unfinished goal, changed files, and next check. Compare that answer to the checkout. If the session says a file was changed but the diff disagrees, investigate before asking for a new edit.

Continuation depends on finding a suitable local session record and on the CLI being usable. It may not select the conversation you expect if several sessions ran in the same project. Do not respond by repeatedly asking the wrong session to reconstruct the work. Switch to the resume picker or use a known session ID. If a usage or network restriction prevents a new model request, you can still examine project files without making another Claude call.

Use claude --resume when you need a particular conversation.

claude --resume opens the session selector; claude --resume <session-id> targets an identified session. Claude's CLI reference also documents the short form claude -r. Pick the session whose project, time, and topic match the interrupted task, then confirm the current branch and diff. The in-session /resume command can return to an earlier conversation when you are already inside Claude Code.

A resumed conversation has its own history and may immediately approach its context limit. If it is responsive but crowded, check /context and use /compact after saving the critical state. If it refuses a prompt because context is full, use the context-limit recovery guide. Do not conflate this with a rate limit: waiting for usage to reset does not make a large conversation smaller.

Find the local record without editing it.

If the session picker does not show the conversation you expected, inspect ~/.claude/projects/ on the machine where Claude Code ran. The folder can contain JSONL session records from multiple projects. Check timestamps and project identity before opening a candidate file. Read it as evidence of what the agent tried, not as a document you should hand-edit to force a resume. Work on a copy if you need to search or extract snippets. Session logs may contain prompts, paths, command output, or sensitive data, so keep them local and share only what the next tool needs.

The record can reveal a rejected approach or command output that was never written into a plan file. It may not exist if the session was deleted, retention rules removed it, or the run happened in a different environment. Do not promise recovery of a transcript you have not located. Even when it exists, inspect current files and tests to distinguish historical observations from today's state.

Choose the right recovery path.

Terminal closed, session healthy

Open the project and try claude --continue. Verify the right conversation and working tree before continuing.

Several sessions in one project

Use claude --resume to choose. Do not assume the newest session owns every file in the checkout.

History missing or inaccessible

Use Git, current files, notes, and available logs. Mark conversation-only details as unknown.

Changing tools

Prepare a portable brief with the goal, diff, failed attempts, tests, and next action. A Claude session ID is not a cross-tool handoff.

Verify before the next edit.

Write down the exact acceptance condition for the unfinished task. If the previous session claimed completion, identify the expected files and run the narrowest safe check. Capture the command, exit code, and output. If the test environment has changed, say so instead of calling the result a code regression. If the code is partially correct, preserve it and ask for only the missing change.

Check for rejected approaches as well as successful ones. A fresh AI often retries a familiar-looking fix because the diff does not explain why it failed earlier. Keep a short note: “Tried approach A; failed because test B still reported C; next test is D.” Include the relevant version, branch, and configuration when they affect the result. Do not paste the whole reasoning transcript unless a specific excerpt is needed.

Then give the resumed or new session a bounded instruction: “Inspect this diff, verify the failing condition, and propose the smallest next step. Do not rewrite working files until you have checked the current test result.” This keeps the first move diagnostic instead of forcing another broad attempt.

When the built-in path is not enough.

Claude's own resume and compact features are the default path when its session record is available and you want to stay in Claude. ShardStitch is optional when you need to carry the task to another coding tool, the old session cannot answer, or a local checkpoint needs to distinguish verified disk facts from inferred intent. It can assemble a continuation packet from the project state; it cannot recover an unsaved decision from a missing transcript or certify that code is correct. The relevant test still has to run.

Sources and boundaries.

Anthropic's CLI reference documents --continue and --resume. Its session documentation describes local JSONL under ~/.claude/projects/, and the command reference describes /resume, /context, and /compact. Check your installed version for differences before following a historical workaround.

FAQ.

Does claude --continue restore unsaved code?

No. It loads a conversation. Inspect the working tree to learn which edits actually survived.

Can I choose a session other than the newest one?

Yes. Use claude --resume or provide a known session ID, then confirm you opened it in the intended project.

Should I edit a session JSONL file to force recovery?

No. Read it as local evidence. Work from a copy for analysis and use the supported resume command for the live session.

What if Claude is rate-limited?

You may be unable to make another Claude request immediately. Save the diff, test results, and next action now; resume after access returns or prepare a verified handoff for a different tool.