Skip to main content

Module session

Module session 

Source
Expand description

Shared session-file parsing layer.

Every supported provider writes its session history to disk in a provider-specific JSON, JSONL, or SQLite shape. This module owns the “turn raw bytes into a typed crate::CodeAnalysis” boundary so both of the features that consume session files — crate::analysis (aggregated tool-call metrics) and crate::usage (aggregated token counts) — share the same parsers and intermediate shape instead of one feature reaching into the other.

Naming convention: the file-backed providers expose parse_* entry points (parse_session_file_*), while the SQLite-backed providers (OpenCode / Cursor / Hermes) expose read_* entry points, since they query a database rather than parse a byte stream.

Re-exports§

pub use cursor::read_cursor_analysis;
pub use cursor::read_cursor_usage;
pub use detector::classify_records;
pub use detector::detect_extension_type;
pub use hermes::read_hermes_usage;
pub use opencode::read_opencode_analysis;
pub use opencode::read_opencode_usage;
pub use parser::parse_session_file_to_value;
pub use parser::parse_session_file_typed;
pub use parser::parse_session_file_typed_as;
pub use parser::parse_session_file_typed_with_mode;
pub use state::ParseMode;
pub use state::SessionParseState;

Modules§

claude
Parser for Claude Code session logs (~/.claude/projects/**/*.jsonl).
codex
Parser for OpenAI Codex rollout logs (~/.codex/sessions/**/*.jsonl).
copilot
Parser for GitHub Copilot CLI session events (~/.copilot/session-state/<sessionId>/events.jsonl).
cursor
Cursor session reader (local SQLite blob stores).
detector
Content-based provider classification for session JSON and JSONL data.
gemini
Parser for Gemini CLI session logs (~/.gemini/tmp/<project_hash>/chats/*.jsonl).
grok
Grok CLI signals.json and sibling session-history parser.
hermes
Hermes session reader (SQLite, not JSONL).
opencode
OpenCode session reader (SQLite, not JSONL).
parser
state
Mutable accumulator shared by every per-provider session parser.