Skip to content

Session Format

Provider Storage Overview

Each AI agent stores sessions differently. agent-sessions reads each format natively.

ProviderLocationFormatMetadata Extracted
Claude~/.claude/projects/<encoded-path>/JSONLProject, git branch, cwd, messages
Gemini~/.gemini/tmp/<hash>/chats/JSONProject, git branch, cwd, messages
OpenAI Codex~/.codex/sessions/ (recursive)JSONLProject, git branch, cwd, messages
Cursor~/.cursor/chats/<hash>/<uuid>/store.dbSQLiteSession name, cwd, messages
WindsurfPlatform-specific (see below)JSONTitle, git branch, cwd, messages

Claude Code

Sessions are stored in ~/.claude/projects/. Each project directory is named using an encoded path (e.g., -Users-vineeth-projects-myapp).

Directory Layout

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

JSONL Structure

Each line is a JSON object representing a message:

json
{"type": "user", "message": {"content": "Fix the auth bug"}, "gitBranch": "main", "cwd": "/Users/me/myapp"}
{"type": "assistant", "message": {"content": "I'll look at the auth module..."}}

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.

Gemini CLI

Sessions are stored as JSON files inside ~/.gemini/tmp/<project-hash>/chats/.

JSON Structure

json
{
  "sessionId": "session-abc",
  "project": "my-project",
  "cwd": "/home/user/project",
  "gitBranch": "main",
  "messages": [
    { "type": "user", "content": "How do I fix this?" },
    { "type": "gemini", "content": "Let me help..." }
  ]
}

Note: Gemini uses type: "gemini" for assistant messages (not "assistant").

OpenAI Codex

Sessions are stored as JSONL files in ~/.codex/sessions/, scanned recursively.

JSONL Structure

json
{"role": "user", "content": "Build a REST API"}
{"role": "assistant", "content": "I'll create the API..."}

Codex uses role (not type) to identify message authors. Metadata fields (cwd, gitBranch, project) are extracted from JSONL entries when present.

Cursor

Cursor stores sessions as SQLite databases at ~/.cursor/chats/<workspace-hash>/<agent-uuid>/store.db. On Windows, the path is %APPDATA%/Cursor/chats/.

Database Schema

meta table — Session metadata stored as hex-encoded JSON:

json
{
  "agentId": "3d52bc50-f05d-44fc-9bd1-2b2d3b9e4059",
  "name": "Fix Auth Bug",
  "createdAt": 1772175077867,
  "lastUsedModel": "claude-4.6-opus-high-thinking"
}

blobs table — Messages stored as JSON blobs:

json
{"role": "user", "content": "Fix the login bug"}
{"role": "assistant", "content": "I'll investigate the login flow..."}

The first user message typically contains Cursor's system context (<user_info> block with OS, workspace path, etc.). The actual user query is wrapped in <user_query> tags in subsequent messages. agent-sessions extracts the workspace path and strips the XML wrappers automatically.

Windsurf (Cascade)

Windsurf stores Cascade conversations as JSON files. The storage location is platform-specific:

PlatformPath
macOS~/Library/Application Support/Windsurf/User/globalStorage/codeium.windsurf/cascade/
Linux~/.config/Windsurf/User/globalStorage/codeium.windsurf/cascade/
Windows%APPDATA%/Windsurf/User/globalStorage/codeium.windsurf/cascade/

Override with WINDSURF_SESSIONS_DIR environment variable.

JSON Structure

json
{
  "conversationId": "conv-abc123",
  "title": "Fix Auth Bug",
  "workspace": "/home/user/project",
  "cwd": "/home/user/project",
  "gitBranch": "main",
  "messages": [
    { "role": "user", "content": "Fix the auth bug" },
    { "role": "assistant", "content": "I'll look into it..." }
  ]
}

What agent-sessions Extracts

Session List

FieldClaudeGeminiCodexCursorWindsurf
Session IDFilenameFilenameFilenameAgent UUIDConversation ID
ProjectDecoded dir nameJSON fieldJSONL metadataSession nameTitle / workspace
Git BranchJSONL metadataJSON fieldJSONL metadataJSON field
Working DirJSONL metadataJSON fieldJSONL metadataExtracted from contextJSON field
Message Countuser + assistantuser + geminiuser + assistantuser + assistantuser + assistant
PreviewFirst user messageFirst user messageFirst user messageFirst user query (XML-stripped)First user message

Session Preview

When you press p on a session, the tool parses up to 20 messages and displays the conversation with proper You / <Agent> labels.

Resume

When you press Enter, agent-sessions spawns the agent's CLI resume command from the session's original working directory, so the agent can locate its session files.

Released under the MIT License.