claude-code-transcripts
Typed parser for Claude Code transcript JSONL files.
Claude Code writes one JSON object per line into ~/.claude/projects/<slug>/<session>.jsonl.
This crate exposes strongly-typed Entry variants covering every line kind the current
client emits (user, assistant, system, summary, attachments, progress, tool uses, tool
results, usage blocks, cache tokens, etc.), plus a round-trip validator useful for
catching schema drift when Claude Code ships new fields.
Install
Usage
use Entry;
let text = read_to_string?;
for line in text.lines.filter
# Ok::
Round-trip validator
Parse every line of a transcript and diff the re-serialized JSON against the original to detect unknown fields:
let result = check_transcript;
result.print_report;
Two examples ship in-tree:
License
Dual-licensed under MIT OR Apache-2.0.