Session storage
Sessions are stored in~/.claude/sessions/ as JSONL files. Each line in the file is a serialized message — assistant turns, user turns, tool calls, file snapshots, and metadata are all recorded in order.
Resuming a session
To pick up where you left off, use the--resume flag when starting Claude Code, or run /resume inside an active session to switch to a previous one.
Listing sessions
The/session command shows your recent sessions with their titles, timestamps, and working directories. Use it to find and switch between sessions without leaving the terminal.
Searching sessions
Claude Code can search your session history by title, content, and metadata. This is useful when you remember working on something but can’t recall which session it was in.Branching sessions
Fork any session at its current point with/branch. The original session is preserved unchanged; the new branch starts as an identical copy and diverges from that point forward.
Background sessions
You can run multiple Claude Code sessions concurrently. Each session operates independently with its own conversation history, tool permissions, and working directory. Use/session to switch between active background sessions.
File history and undo/redo
Claude Code takes file snapshots before each destructive edit. These snapshots are stored asFileHistorySnapshotMessage entries in the session JSONL. If a change produces an unexpected result, you can undo it without leaving Claude Code.
Session teleportation
The/teleport command transfers a session from one machine to another using a Git-based serialization mechanism (utils/teleport.tsx).
Initiate teleport
Run
/teleport on the source machine. Claude Code serializes the session state and uploads it using your claude.ai OAuth credentials.Create a Git bundle
Claude packages the relevant Git branch state into a bundle alongside the conversation transcript.
Teleportation requires an active claude.ai OAuth session on both machines. The feature uses
checkGate to verify access before proceeding.Session titles
Claude Code automatically generates a title for each session based on the opening messages. To rename a session manually:Exporting sessions
Export the current session transcript to a file with/export. The output is a human-readable version of the conversation, suitable for sharing or archiving.
Cost tracking
The/cost command displays token usage and estimated USD spend for the current session, broken down by model and token type (input, output, cache read, cache creation).