src/auth/refresh.ts+18 −6claude --resume 7c41e0a2Claude Code stores full local session transcripts as JSONL files under ~/.claude/projects/<encoded-project-path>/<session-id>.jsonl, and keeps a separate terminal prompt log in ~/.claude/history.jsonl. To reopen a previous conversation in the terminal, run claude --continue or claude --resume. To search older conversations, tool outputs, and touched files across all projects, run npx codesesh --agent claudecode --days 0.
Where Claude Code stores session files
By default, Claude Code writes its local state under ~/.claude/ (~ is your home directory). If you set CLAUDE_CONFIG_DIR, every path below moves under that root instead.
- Full session transcripts (
~/.claude/projects/<project>/<session-id>.jsonl): One JSON object per line covering user prompts, assistant responses, thinking blocks, tool calls, tool results, and token usage. Claude Code encodes each working directory path into a folder name underprojects/. - Subagent transcripts (
<session>/subagents/*.jsonl): When Claude Code spawns subagents or workflow runs, their JSONL transcripts and.meta.jsonfiles live under the parent session directory. CodeSesh nests these child sessions under the parent conversation. - Prompt history (
~/.claude/history.jsonl): Stores your input history and timestamps for quick terminal recall. It does not contain assistant replies or tool output.
Because history.jsonl only tracks prompts you typed, always look inside ~/.claude/projects/ when you need the actual code changes, error output, or reasoning from a past session.
List and open previous sessions in Claude Code
If you are already inside the project directory where a session started, Claude Code’s built-in CLI flags are the fastest way to jump back in.
Continue the most recent session in the current directory:
claude --continueOpen an interactive picker to browse and resume past sessions:
claude --resumeJump directly to a specific session ID (for example, one copied from CodeSesh or a JSONL filename):
claude --resume <session-id>Inside an active Claude Code terminal session, you can also type /resume to switch conversations without exiting.
Why old or archived Claude Code sessions disappear
If a conversation from last month is missing from claude --resume or from ~/.claude/projects/, check these common causes first:
- Automatic local cleanup (
cleanupPeriodDays): Claude Code deletes local transcript files older than its configuredcleanupPeriodDaysin~/.claude/settings.json(30 days by default). Once Claude Code removes a JSONL file from disk, neither Claude Code nor CodeSesh can recover it unless you already have a backup or an existing CodeSesh SQLite index from before deletion. - Different working directory or git worktree: Claude Code scopes session directories by project path. Running
claude --resumefrom a parent folder or a different worktree hides sessions recorded under another path. - Custom
CLAUDE_CONFIG_DIR: Sessions created with a separate profile or environment variable live under that custom directory rather than~/.claude/projects/.
Search and replay Claude Code history with CodeSesh
When you need to find a conversation across repositories, search tool output, or trace which session edited a specific file, native CLI pickers are not enough. CodeSesh indexes your local ~/.claude/projects/ JSONL transcripts into SQLite and opens a read-only Web UI on localhost.
Scan all local Claude Code sessions (not just the default 7-day window):
npx codesesh --agent claudecode --days 0To inspect only the current repository:
npx codesesh --agent claudecode --days 0 --cwd .In the Web UI, you can:
- Search across projects: Match user messages, assistant replies, tool outputs, and file paths in one query, then jump directly to the matching message inside the replay timeline.
- Inspect nested subagents and costs: View parent and child agent runs together with rolled-up input, output, cache-read tokens, and estimated costs by project or model. See the usage and costs guide for how token accounting and cost estimates work.
- Track file activity: Look up a path such as
src/auth.tsto find every Claude Code session that read, edited, or created it. - Copy worktree-aware resume commands: Click copy on any session detail page to get the exact
claude --resume <session-id>command for that workspace.
If you use both Claude Code and Codex, see the Codex session history guide or the cross-agent session history overview. For installation options without Node.js, see getting started.
Preserve transcripts safely
CodeSesh never modifies or deletes your ~/.claude/projects/ files. If you want to keep Claude Code transcripts beyond the default retention period, increase cleanupPeriodDays in ~/.claude/settings.json and back up ~/.claude/projects/ directly. If you want to export individual conversations into standalone files for sharing or archiving, pair CodeSesh with Agent Dump.
Browse your local history in one Web UI
MIT open source and read-only on your machine. Search conversations, tool calls, file changes, and token costs with one command.
Frequently asked questions
Where is Claude Code history stored on disk?
Claude Code stores full session transcripts as JSONL files under ~/.claude/projects/<encoded-project-path>/<session-id>.jsonl, with subagent runs in nested subagents/ directories. Prompt input history is stored separately in ~/.claude/history.jsonl. If CLAUDE_CONFIG_DIR is set, Claude Code uses that directory instead of ~/.claude.
How do I open a previous session in Claude Code?
Run claude --continue (or claude -c) in the same project directory to reopen the latest conversation, or run claude --resume to pick from past sessions interactively. If you know the session ID, run claude --resume <session-id>, or use /resume inside an active Claude Code session.
What is the difference between history.jsonl and projects/*.jsonl?
~/.claude/history.jsonl only records your prompt inputs and metadata for terminal history recall. The full conversation—assistant replies, tool calls, tool output, reasoning, and token usage—lives in ~/.claude/projects/<project>/<session-id>.jsonl.
Why are my old or archived Claude Code sessions missing?
Claude Code automatically deletes local session transcripts after its configured cleanupPeriodDays retention window (30 days by default in ~/.claude/settings.json). Sessions can also appear missing if you ran Claude Code from a different directory or with a different CLAUDE_CONFIG_DIR.
Related guides
- Start locally
Install CodeSesh and browse AI coding sessions
Read - Start locally
How to find AI coding session history locally
Read