Claude Code fix: A session you know exists is not in the list

Claude Code session is not in the list

Sessions are grouped by a slug built from the working directory string, character by character. Two paths that open the same folder are therefore two different projects.

Comes from Claude Code.

Diagnosis

What it actually is

The folder name is the path with every other character replaced

Each character that is not a letter or a digit becomes a hyphen, so the directory name is a transcription of the path rather than a lookup. Different text means a different folder, even when both paths reach the same files.

A symlink or a worktree is a different path

Starting the CLI through a symlinked route, or inside a git worktree, produces a different working directory string and therefore a different project folder. The sessions are not lost, they are filed somewhere you have not looked.

A trailing slash is a different string too

A path written with and without its final separator encodes two ways, which is why a careful reader normalises before slugging and a careless one ends up with a pair of near-identical folders.

The slug cannot be read backwards reliably

A hyphen in the folder name might have been a hyphen in the path or a separator between parts. That is why the real path belongs with the session data, and why decoding the folder name is a last resort rather than a lookup.

Check

Confirm it before you fix it

Run thisWhat a good answer looks like
pwdThe exact string that decides the folder. Run it where the session was started, not where you happen to be now.
ls ~/.claude/projectsOne directory per project path the CLI has seen. The one you want is usually a near twin of the one you expected, differing by a symlink component or a case.
ls -t ~/.claude/projects/*/*.jsonl | headSorted by time, so the session you just ran is at the top whichever folder it landed in.

Every command here has been run on a real machine. Termdeck answers the same questions for every machine you have connected, without opening a terminal on any of them.

Fix

Cheapest thing first

1. Start from the canonical path

Resolve the symlinks once, use that path from then on, and the sessions rejoin. On a machine whose home is reachable two ways, picking one and staying with it is the entire fix.

2. Open it by file rather than by list

The transcript is a plain JSONL file and its name carries the session id, which is what any resume takes.

3. Prefer a tool that reads the path from the data

Termdeck groups sessions by the working directory recorded inside the transcript rather than by decoding a folder name, which is what keeps a worktree and its parent legible side by side.

Not this

What will not help

Renaming the project folder to match

The CLI writes to whichever folder its slug rule produces. A hand-renamed directory is ignored on the next run, and now you have two.

FAQ

A session you know exists is not in the list, answered

Does Claude Code delete old sessions?

No. They stay as plain JSONL files until something removes them.

Why do a repo and its worktree have separate histories?

They are different working directories, so they slug differently. The grouping is per path rather than per repository.

Can I move a session file somewhere else?

The file is portable and its id travels in the name. Nothing rewrites the path recorded inside it, so a moved session still remembers where it ran.