Directory Structure
Sessions are stored using XDG conventions:Path Components
| Component | Description |
|---|---|
{git-hash} | First 16 chars of SHA-256 hash of git root path |
{sessionID} | ULID (time-sortable unique ID) |
{agentName} | Sanitized agent name (lowercase, alphanumeric) |
{messageID} | ULID for message exchange |
{partID} | ULID for individual parts |
Subagent Sessions
When an agent invokes subagents, their sessions are nested:Data Schemas
SessionInfo
Stored insession.json at the root of each session directory.
Message
Stored in{messageID}/message.json. Contains both user input and assistant response.
Parts
Stored in{messageID}/part/{partID}.json. Each part represents a discrete unit of content.
Base Fields
All parts include these fields:Part Types
| Type | Description |
|---|---|
text | Text output from the model |
reasoning | Internal reasoning/thinking content |
tool | Tool call with input, output, status, duration |
file | File references |
agent | Subagent invocations |
step-start | Step boundary markers |
step-finish | Step completion with token counts |
TextPart
ReasoningPart
ToolPart
FilePart
AgentPart
StepStartPart
StepFinishPart
Related
- Session Logs Guide - How to use the sessions CLI
- Environment Variables - Configure storage location
