Field guide
Claude Transcript Anatomy
How to read Claude JSONL transcript artifacts, hook transcript paths, subagent transcript paths, and stream-json output without mixing them up.
Raw artifact
JSONL under ~/.claude/projects
Anthropic documents JSONL transcript files as the default local persistence format for Agent SDK sessions.
Subagents
Nested transcript paths
Hook inputs distinguish the main transcript from subagent transcript paths, which matters when aggregating parallel work.
"JSONL files under ~/.claude/projects/"
The Three Records People Confuse
There are three related but different surfaces: the persisted transcript file, the live stream emitted by CLI or SDK output modes, and the JSON payloads passed to hooks or status-line commands. They can describe the same run, but they are not interchangeable.
The persisted transcript is the durable artifact. Stream output is useful for automation, CI, and live processors. Hook and status-line payloads are lifecycle snapshots: they give enough context for a command to decide what to do at that moment.
Reading JSONL Without Overfitting
JSONL means one JSON object per line. That makes transcripts append-friendly and easy to stream, but it also tempts people to write fragile parsers that assume every line has exactly the same shape. A safer parser treats each line as an event-like record, branches by known fields, preserves unknown fields, and emits warnings rather than crashing on new versions.
If you are building a converter, keep the raw line number and source file path in derived output. That one choice makes later audits easier: a reviewer can jump from a friendly Markdown section back to the exact raw record.
- Parse with a JSONL reader, not split-based string matching.
- Preserve unknown fields for future Claude Code versions.
- Keep source filename, line number, session ID, timestamp if present, and parent/subagent relationships.
Hook Context Is A Lens, Not The Whole Run
Claude Code hook inputs include lifecycle context such as session ID, current working directory, and transcript path. For subagent events, Anthropic documents a separate subagent transcript path. That is enough to build audit hooks, but a hook payload is still a momentary input to the hook, not the complete transcript.
When a hook writes its own audit entry, include the hook event name and tool identifier, then store a pointer to the transcript rather than copying the entire transcript into every audit row.
Stream Output Has A Different Job
The CLI reference documents --output-format stream-json and related flags for print mode. That surface is ideal for scripts that need to consume messages as they happen. It is also where flags such as including hook events or partial messages become relevant.
Do not assume stream output and persisted transcripts are byte-for-byte mirrors. Treat stream output as an automation interface and the transcript as a persistence artifact. When exact provenance matters, store both the command invocation and the transcript pointer.
Primary sources
Sources behind this page
Anthropic
Persist sessions to external storage
Documents default JSONL transcript storage under ~/.claude/projects/ and the SessionStore mirroring interface.
Anthropic
Hooks reference
Reference for hook lifecycle events, JSON input and output formats, and command, HTTP, prompt, and agent hooks.
Anthropic
CLI reference
Documents stream-json output, hook event inclusion, session persistence controls, naming, and resume flags.
Anthropic
Status line
Documents the JSON session data passed to status-line commands.
Cite this page
Claude Logs. "Claude Transcript Anatomy." claudelogs.com, updated 2026-07-06. https://claudelogs.com/transcript-anatomy
FAQ
Should a transcript parser drop fields it does not understand?
No. Preserve unknown fields or at least keep the raw record. Claude Code changes over time, and a lossy converter can erase evidence before a reviewer knows it matters.
Is stream-json enough for an audit archive?
Usually not by itself. It is a useful live interface, but an archive should retain raw transcripts, run metadata, and final repository evidence.
Related evidence
Telemetry
Observability
A practical map of Claude Code and Agent SDK telemetry: traces, metrics, logs, identity attributes, and event analysis.
Controls
Hook Audits
How Claude Code hooks create reliable capture points for prompts, tool calls, stop events, subagents, and policy decisions.
Governance
Storage
How to design Claude transcript storage, SessionStore mirroring, retention windows, and deletion workflows without losing useful evidence.
Free tool
Log Viewer
Drop a Claude Code JSONL transcript and turn it into a readable local timeline of messages, tool calls, tool results, and token fields.
Free tool
Token Analyzer
Estimate Claude Code transcript token usage and cost by turn with a dated model pricing table and CSV export.
Free tool
Audit Checklist
Run an interactive agent-session audit checklist and export a concise Markdown note for PRs, incidents, and handoffs.