cd /news/ai-tools/how-to-recover-a-lost-claude-code-se… · home topics ai-tools article
[ARTICLE · art-137873] src=dev.to ↗ pub= topic=ai-tools verified=true sentiment=· neutral

How to Recover a Lost Claude Code Session When --continue Fails

A developer documented how to recover a lost Claude Code session when the `claude --continue` flag fails to find the previous conversation. Because Claude Code stores sessions per project folder under `~/.claude/projects/`, `--continue` only opens the most recent session in the current directory; the developer recommends grepping the `.jsonl` transcript files for a distinctive term, then using the resulting file path to extract the folder and session ID and resume with `claude --resume <id>`.

by read1 min views2 publishedSep 23, 2026

I ran claude --continue to pick up where I left off, and it didn't find my previous session. Here's why that happens and how I got it back.

Claude Code saves sessions per folder, under ~/.claude/projects/. Each project gets a subfolder named after the full path where you launched claude, with slashes and underscores turned into dashes.

--continue only opens the most recent session in your current folder. So it picks the wrong one if:

ls ~/.claude/projects/

Look for folders that match your project path. In my case there were two candidates: one for the parent claude_skills folder and one for the anki-skill subfolder.

Each session is a .jsonl file, so you can grep for something distinctive you know came up in the conversation, like a config key, filename, or error message:

ls -lt $(grep -l "webCorsOriginList" ~/.claude/projects/-Users-yourname-path-to-project*/*.jsonl)

grep -l lists the files that contain the word, and ls -lt sorts them newest first. My top result was:

~/.claude/projects/-Users-yourname-...-anki-skill/aaa6d99e-356e-4148-982e-e6e7a3133939.jsonl

The folder name tells you where the session was started, and the filename (minus .jsonl) is the session ID.

cd /path/to/anki-skill
claude --resume aaa6d99e-356e-4148-982e-e6e7a3133939

Run this from the folder the session belongs to, or Claude Code won't find it.

It's fine to resume a session while a different session is open in another terminal tab. Just don't resume the same session in two tabs at once, since both would write to the same transcript. Also avoid having two sessions edit the same files at the same time.

Skip the guesswork and go straight to Step 2: grep for a word unique to the conversation you want. The file path gives you the folder and the session ID, and claude --resume <id> brings it back.

── more in #ai-tools 4 stories · sorted by recency
── more on @claude code 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
Live at https://your-agent.zahid.host
Get free account → Pricing
from €0/mo · no card required
LIVE [news/how-to-recover-a-los…] indexed:0 read:1min 2026-09-23 ·