Expand description
On-disk schema for Codex CLI rollout JSONL files.
Mirrors the upstream Rust types in
openai/codex:codex-rs/protocol/src/{protocol,models}.rs closely
enough for fidelity, but uses Value fallbacks on enum variants we
don’t exhaustively enumerate so unknown future payloads survive
round-trip. Each top-level line is a RolloutLine:
{"timestamp":"2026-04-20T16:44:37.772Z","type":"session_meta","payload":{...}}The type field discriminates at the outer level. payload.type
discriminates inside response_item and event_msg payloads.
Structs§
- Base
Instructions - Custom
Tool Call - Custom
Tool Call Output - Exec
Command End - Function
Call - Function
Call Output - GitInfo
- Message
- Patch
Apply End - Reasoning
- Rollout
Line - One JSONL line from a rollout file — a tagged payload with a
timestamp. The struct preserves unknown fields and unknown
typetags verbatim so round-trip re-serialization stays faithful. - Sandbox
Policy - Session
- A parsed session: the sequence of lines plus derived first-line metadata and a reference to the file on disk.
- Session
Meta - First line of every rollout file;
session_metapayload. - Session
Metadata - Lightweight session metadata (no full parse).
- Token
Count Event - Token
Count Info - Token
Usage - Turn
Context - Per-turn context snapshot.
Enums§
- Content
Part - Event
Msg - Non-model events: task lifecycle, exec results, patch application,
token accounting, and a long tail of less common variants. The
crate strongly-types the common ones and captures the rest as raw
Value. - Patch
Change - One file’s change within a
PatchApplyEnd. Threetypevalues documented upstream:add,update,delete. We strongly-type the common two (addhascontent,updatehasunified_diffand optionalmove_path) and leave room for more. - Response
Item - Items emitted by the model — messages, reasoning, and tool calls.
- Rollout
Item - Typed view of a
RolloutLine::payloadbykind.