1.1 KiB
1.1 KiB
Session history
Status: Implemented · Code: Scripts/sessions-store.js
Resume Session… lists this project's previous Claude Code sessions — including
ones started in a terminal — without shelling out to the interactive picker.
Where Claude Code stores sessions
~/.claude/projects/<slug>/<session-id>.jsonl
The slug is the project path with / and . flattened to -:
/Users/me/Developer/git.example.ca/thing.novaextension
→ -Users-me-Developer-git-example-ca-thing-novaextension
projectSlug() implements exactly that substitution. Files are sorted by mtime,
newest first.
Labels
firstPrompt() reads up to 40 lines of a transcript looking for the first
non-meta, non-synthetic user message and uses it as the picker label, falling
back to the short session id.
Resuming
--resume <id> replaces --session-id. The session model is reset and rebuilt
from the resumed session's messages as they stream in.
Gotchas
- Transcripts can be megabytes;
firstPrompt()usesreadline()and stops early rather than reading whole files. - Zero-byte and non-
.jsonlentries are skipped.