Parsing Claude Code's JSONL: patterns for a schema that keeps moving
A parser for Claude Code's JSONL format must handle changing schema without rejecting malformed input. The key is to normalize at the boundary, once, and preserve unknown shapes. A whitelist of known types helps to skip unknown types and preserve raw JSON for later re-parse. This approach ensures that a bad line never kills the file and downstream code never sees the mess. Engineers should normalize at the boundary, once, and use a whitelist of known types to handle changing schema.