Skip to main content

Module schema

Module schema 

Source
Expand description

Typed schemas for the on-disk session formats.

The loaders in crate::session used to pluck fields out of untyped serde_json::Values, which meant anything we didn’t explicitly look for was silently lost — and invisible. These modules give each format a typed representation instead, with two deliberate escape hatches that turn “what are we missing?” into a mechanical question:

  • every discriminated enum has a #[serde(other)] Unknown variant, so an unmodeled record/block/payload type deserializes into a named bucket instead of erroring or vanishing; and
  • every record struct carries a flattened extra: ExtraFields map, so an unmodeled field is captured rather than dropped.

The crate::audit module walks a corpus, deserializes into these types, and reports every Unknown and every non-empty extra — an evidence-based map of exactly where our coverage ends.

Modules§

claude_code
Typed schema for Claude Code transcript JSONL (~/.claude/projects/<encoded-cwd>/<id>.jsonl).
codex
Typed schema for Codex rollout JSONL (~/.codex/sessions/.../rollout-*.jsonl).

Enums§

ContentBlock
A content block that may carry text, used by both formats’ message bodies. Unknown block types are preserved by tag in ContentBlock::Unknown.

Functions§

raw_block_tag
Recover the type discriminant of an arbitrary JSON content block, even one that deserialized as ContentBlock::Unknown — used by the audit to name the unknown.

Type Aliases§

ExtraFields
Catch-all for object fields a struct does not explicitly model.