Understand the Session File Format
mainSessions are stored as JSONL (JSON Lines) files. Each line is a single JSON object representing a SessionEntryBase.
Tree Structure
Entries form a tree structure using id and parentId fields. This allows for in-place branching (e.g., via /fork) without creating new files.
- The first entry (the
SessionHeader) has noparentId. - Subsequent entries point to their parent via
parentId. - The "leaf" represents the current position in the conversation.
File Location
Sessions are located at:
~/.pi/agent/sessions/--<path>--/<timestamp>_<uuid>.jsonl
Note: <path> is the working directory with / replaced by -.