- Primary: JSONL
- Rationale: Matches legacy behavior and preserves human/Git-friendly sessions. SQLite is a derived index for fast lookup and search.
- On session save:
AgentSession::persist_new_messagesupdates the SQLite index - Manual rebuild:
SessionIndex::reindex_all()(CLI command planned) - Timer/throttle: no background timer; indexing is incremental on session save
- DB marker:
meta.last_sync_epoch_ms, per-sessionsessions.last_mtime_ms+last_size_bytes - JSONL marker: file
mtime+size(filesystem metadata)
- Lock file path:
~/.pi/agent/session-index.lock - Busy timeout: 5 seconds (SQLite busy timeout)
- DB locked: retry with busy timeout, then surface a clear error and keep JSONL authoritative
- JSONL parse error: skip indexing for that file, report error, allow manual repair
- Git commit error: not applicable (no automatic git operations)
pi sessions reindex— rebuild SQLite index from JSONLpi sessions export-jsonl— dump index metadata for inspection