Skip to content

Session Format

How Claude Code Stores Sessions

Claude Code stores session data in ~/.claude/projects/. Each project directory is named using an encoded path (e.g., -Users-vineeth-projects-myapp).

Inside each project directory, sessions are stored as .jsonl files named by session ID.

Directory Layout

~/.claude/projects/
├── -Users-vineeth-projects-myapp/
│   ├── abc123def.jsonl
│   ├── xyz789ghi.jsonl
│   └── ...
├── -Users-vineeth-projects-other/
│   └── ...

JSONL Structure

Each line in a .jsonl file is a JSON object representing a message:

json
{"type": "human", "message": {"content": "Fix the auth bug"}}
{"type": "assistant", "message": {"content": "I'll look at the auth module..."}}

What agent-sessions Extracts

Session List

FieldSource
Session IDFilename (without .jsonl)
ProjectDecoded from parent directory name
Modified AtFile modification timestamp
Git BranchExtracted from session metadata
Message CountCount of human + assistant messages
PreviewFirst human message, truncated to 80 chars
Working DirectoryDecoded from directory path

Session Preview

When you press p on a session, the tool parses the full JSONL file and extracts the first 20 user/assistant messages with their complete text content. This lets you review a conversation before resuming it.

Path Decoding

The encoded directory name -Users-vineeth-projects-myapp is decoded to /Users/vineeth/projects/myapp, and the home prefix is replaced with ~ for display.

Released under the MIT License.