Documentation
¶
Overview ¶
Package codex adapts Codex CLI's rollout JSONL format (one JSON object per line under ~/.codex/sessions/YYYY/MM/DD/rollout-*.jsonl) into the shapes internal/ingest knows how to store.
Every line has the shape {timestamp, ordinal, type, payload}. Confirmed against two real files: one that failed on an auth error before doing any work, and one deliberately generated (with the user's permission, using their own authenticated `codex exec`) to capture a real tool call and assistant reply, since the first sample never got that far.
Two structural differences from Claude Code's format, both discovered from those real files:
No per-line session id. A rollout file is one session (like Claude Code), but unlike Claude Code, individual lines don't repeat the session id — only the first `session_meta` line carries it. This adapter is therefore STATEFUL: it remembers the session id from session_meta and attaches it to every later line. Adapter values must not be reused across files (see internal/ingest.RunAll, which constructs a fresh one per file for exactly this reason).
Framework-injected context (skills instructions, permission policy, plugin recommendations, an environment snapshot) rides in the SAME role=user / role=developer messages a genuine human prompt arrives in — there's no separate isMeta-style flag like Claude Code has. The one thing that does discriminate them is internal_chat_message_metadata_passthrough.content_item_kinds: a genuine human turn's block is tagged "user.text"; everything else seen ("host_skills.instructions", "plugins.recommendations", "environments.environment_context", "multi_agent.role_instructions", ...) is injected context. This matters beyond labeling — the shared chunker treats a new role=user/kind=text message as a turn boundary, so misclassifying injected context as a genuine turn would fragment chunks around framework noise instead of real turns.
custom_tool_call / custom_tool_call_output (not "function_call" — that was an assumption from general Responses-API knowledge that turned out wrong against the real file) are confirmed from the generated sample. `reasoning` items are NOT confirmed — this session used reasoning effort "none" and never produced one — so that parser is best-effort from public Responses API convention and degrades to Skip rather than guess wrong if the shape doesn't match.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.