Skip to main content

normalize_chat_sessions/
lib.rs

1//! Session log parsing for AI coding agents.
2//!
3//! Parses session logs from various AI coding agents:
4//! - Claude Code (JSONL)
5//! - Gemini CLI (JSON)
6//! - OpenAI Codex CLI (JSONL)
7//! - Normalize Agent (JSONL)
8//!
9//! # Architecture
10//!
11//! This crate separates parsing from analysis:
12//!
13//! - **Parsing**: `LogFormat::parse()` converts format-specific logs into a unified `Session` type
14//! - **Analysis**: Consumers compute their own metrics from `Session` data
15//!
16//! Each log format implements the `LogFormat` trait for format detection and parsing.
17//!
18//! # Example
19//!
20//! ```ignore
21//! use normalize_chat_sessions::{parse_session, Session};
22//!
23//! let session = parse_session("~/.claude/projects/foo/session.jsonl")?;
24//! for turn in &session.turns {
25//!     for msg in &turn.messages {
26//!         println!("{}: {} blocks", msg.role, msg.content.len());
27//!     }
28//! }
29//! ```
30
31mod formats;
32mod session;
33
34pub use formats::*;
35pub use session::*;