Documentation
¶
Overview ¶
Package claudesessions discovers and defensively parses Claude Code session transcripts under ~/.claude/projects/<encoded-cwd>/<uuid>.jsonl.
Unlike Codex rollout files (a type/payload wrapper per line), Claude Code writes one flat JSON object per line whose fields live at the top level (type, uuid, sessionId, cwd, version, gitBranch, timestamp, message{role,content}, ...). The transcript is the durable record; Claude Code rediscovers a dropped-in file with no registry to update.
Claude Code is closed-source and its format moves quickly, so all parsing here is best-effort: unknown fields are ignored, bad lines become warnings rather than fatal errors, and a single unreadable file never aborts a scan. The per-line "version" is surfaced so format drift is visible.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Scan ¶
func Scan(home claudehome.Home, _ ScanOptions) (sessions.ScanResult, error)
Scan discovers Claude Code transcripts under <home>/projects/<encoded-cwd>/. Every *.jsonl file in a project folder is a session (a logical conversation may also include sidechain lines inside the same file). Results reuse the shared sessions.Session / sessions.ScanResult types and are sorted most-recent-first.
Scan is defensive: an unreadable directory or a single unparseable transcript produces a warning and is otherwise skipped, never aborting the whole scan.
Types ¶
type ScanOptions ¶
ScanOptions controls how a Claude home is scanned. It mirrors the Codex sessions.ScanOptions shape for symmetry, though Claude Code has no archived or compressed sessions today (the fields are accepted and ignored).