Harness Notes

Transcript format

Updated 2026-11-22,

On this page

The complete on-disk format of each harness’s session transcripts: every file a session writes, every record type and field, and how to rebuild the conversation from them. Where sessions live and how to resume, export or delete them is on the Transcripts page. Examples use placeholder values.

At a glance

QuestionCodex CLI0.169.0
SpecificationNo published schema; defined by the open-source code
Transcript file~/.codex/sessions/YYYY/MM/DD/rollout-YYYY-MM-DDThh-mm-ss-<thread-id>.jsonl
StorageJSON Lines, appended as the local thread runs. The first record is session_meta. Cold .jsonl files can become .jsonl.zst after 7 idle days only when local_thread_store_compression is enabled (under development, off by default at 0.169.0); they are materialized before append. This describes LocalThreadStore, not hosted Cloud storage.
Record type fieldtype, then payload.type inside response_item, event_msg, retained_context and realtime_item, then payload.item.type (and payload.item.kind for extension items) inside event_msg item_completed. Messages are further split by payload.role.
Size75 record types, 24 content blocks

Records by purpose

RecordsCodex CLI0.169.0
Session
Session header
Model, directory and settings
Forks and subagents
Files and workspace state
Conversation
User message
Assistant message
System and injected context
Reasoning
Images, files and attachments
Queued and steered input
Tools
Tool call
Tool result
Tool progress
Approvals and denials
Hook output
Turns
Turn starts
Turn ends
Turn is interrupted
Context and accounting
Compaction
Summaries
Token usage
Other records

Codex CLI 0.169.0

No published schema; defined by the open-source code. JSON Lines, appended as the local thread runs. The first record is session_meta. Cold .jsonl files can become .jsonl.zst after 7 idle days only when local_thread_store_compression is enabled (under development, off by default at 0.169.0); they are materialized before append. This describes LocalThreadStore, not hosted Cloud storage.

Files

$CODEX_HOME (default ~/.codex)Root of all Codex local state; overridable with CODEX_HOME.
~/.codex/sessions/YYYY/MM/DD/rollout-YYYY-MM-DDThh-mm-ss-<thread-id>.jsonlThe rollout: one JSONL file per thread. Directory date and filename timestamp are LOCAL time at creation; the file is created lazily when the first item is persisted.
~/.codex/sessions/YYYY/MM/DD/rollout-YYYY-MM-DDThh-mm-ss-<thread-id>_<rollout-id>.jsonlRollout written by thread/revert (or other rollout-id overrides): same thread id, new rollout id. The previous file is left intact; state_5.sqlite threads.rollout_path says which is current.
~/.codex/sessions/YYYY/MM/DD/rollout-...jsonl.zstSame rollout zstd-compressed (level 3) by a background worker once unmodified for 7 days; exactly one of .jsonl/.jsonl.zst exists. Decompressed back to .jsonl before any append (resume).
~/.codex/archived_sessions/rollout-...jsonl[.zst]Archived rollouts, moved flat (no date folders) with the same filename.
~/.codex/session_index.jsonlAppend-only thread names: {id, thread_name, updated_at(RFC3339)}; the last entry for an id wins.
~/.codex/history.jsonlPrompt history across sessions (not a transcript): {session_id, ts (Unix seconds), text}.
~/.codex/state_5.sqlite (+ -wal, -shm)Thread metadata index: threads (id, rollout_path, created_at[_ms], updated_at[_ms], source, model_provider, model, reasoning_effort, cwd, title, name, preview, first_user_message, tokens_used, archived, git_*, cli_version, agent_*, history_mode, thread_source, ...), thread_spawn_edges, thread_dynamic_tools, rollout_migration_state, etc. Authoritative for which rollout file is current.
~/.codex/thread_history_1.sqlite (+ -wal, -shm)Projection of paginated rollouts for paging: thread_turns (turn_id, rollout_ordinal, status, timestamps, byte offsets), thread_items (item_json in app-server camelCase ThreadItem form, item_type e.g. userMessage, rollout_ordinal, updated_at_ordinal), thread_realtime_items, thread_history_projection_state (next byte offset/ordinal). Rebuildable from the rollout.
~/.codex/logs_2.sqlite, goals_1.sqlite, memories_1.sqlite, queue_1.sqliteLogs, thread goals, memories, and queued input; not transcript content but keyed by thread id.
~/.codex/rollout-migrations/<thread-id>.pendingJournal for the in-place legacy -> paginated rollout migration (legacy_to_paginated_v1) that runs at startup.
~/.codex/thread-writer-locks/<thread-id>.lockPer-thread writer lock files.
~/.codex/shell_snapshots/<session-id>.<nonce>.shCaptured login-shell environment snapshot used for command execution.
~/.codex/generated_images/<thread-id>/<call-id>.pngSaved generated images referenced by saved_path/savedPath.

Fields on every record

Record type is chosen by type, then payload.type inside response_item, event_msg, retained_context and realtime_item, then payload.item.type (and payload.item.kind for extension items) inside event_msg item_completed. Messages are further split by payload.role..

FieldTypeMeaning
timestampstringWrite time, UTC, format YYYY-MM-DDTHH:MM:SS.mmmZ (milliseconds).
ordinaloptionalintegerPresent only in paginated rollouts: dense 0-based position in the logical thread history (session_meta of a root thread is 0; a fork/revert file starts at history_base.end_ordinal_exclusive). Absent in legacy rollouts.
typeenum(session_meta|dynamic_tools_updated|response_item|inter_agent_communication|inter_agent_communication_metadata|compacted|turn_context|token_usage_record|world_state|retained_context|security_risk_score|event_msg|realtime_item)Rollout item kind (snake_case).
payloadobjectItem body; for response_item, event_msg, retained_context and realtime_item it carries its own payload.type.
metadataoptionalobjectOnly on response_item: CodexHarnessMetadata {client_authored (bool, always written), fallback_token_limit_override, retained_source{id{message_id,turn_id,role},revision,complete}, user_input_order, guardian_sources, guardian_review_ids, guardian_source_order_guidance, guardian_retained_omissions, delivered_assistant_message, harness_authored_configuration, compaction_model_hash, compaction_output, inherited_user_message, mcp_attribution, sender_user_messages}.

Records (75)

session_meta

Identifies the thread and records how, where and by which build it was created.

Written first line of every rollout when the file is materialized (creation is deferred until the first item is persisted). Not rewritten on resume. Legacy forks may contain later session_meta lines copied from the parent; only the first belongs to this file.

FieldTypeMeaning
idstring(uuid)Thread id (stable across revert).
session_idstring(uuid)Root thread id of the session tree. Backfilled from id when absent in older files.
timestampstring(RFC3339 UTC, ms)Thread creation time.
cwdstring(path)Working directory at creation.
originatorstringClient originator (e.g. codex_cli_rs, codex_vscode).
cli_versionstringVersion of the build that created the thread; NOT updated by later writers or by legacy->paginated migration.
sourceoptionalstring | objectSessionSource, lowercase externally tagged: "cli" | "vscode" | "exec" | "mcp" | "unknown" | {"custom":string} | {"internal":"memory_consolidation"|"guardian"} | {"subagent": "review"|"compact"|"memory_consolidation"|{"thread_spawn":{parent_thread_id,depth,agent_path?,agent_nickname?,agent_role?}}|{"other":string}}. Defaults to vscode when absent.
thread_sourceoptionalstringAnalytics classification: user | subagent | guardian_review | memory_consolidation | <feature string>.
forked_from_idoptionalstring(uuid)Thread this one was forked from.
forked_from_ordinal_exclusiveoptionalintegerFork boundary in the parent's paginated history (only with forked_from_id).
parent_thread_idoptionalstring(uuid)Parent thread for spawned sub-agents.
runtime_workspace_rootsoptionalstring[]Workspace roots at creation; absent = unknown, [] = none.
creator_user_idoptionalstringChatGPT user that created the thread.
creator_account_idoptionalstringChatGPT account selected at creation.
agent_nicknameoptionalstringNickname of a spawned sub-agent.
agent_roleoptionalstringRole of a spawned sub-agent. Alias on read: agent_type.
agent_pathoptionalstringCanonical agent path of a spawned sub-agent.
model_providerstring | nullModel provider id.
base_instructionsobject | null{text, provenance?} system instructions for the thread.
dynamic_toolsoptionalarrayClient-supplied dynamic tool specs (older flat camelCase shape also accepted on read).
selected_capability_rootsoptionalarrayCapability roots selected by the hosting platform.
memory_modeoptionalstring"disabled" when memory generation is off.
history_modeoptionalenum(legacy|paginated)Format discriminator for the whole file; absent = legacy. Unknown values make Codex reject the file.
history_baseoptionalobject{thread_id (actually a rollout id), end_ordinal_exclusive, end_byte_offset}: immutable prefix of another paginated rollout inherited by this one (forks and reverts).
subagent_history_start_ordinaloptionalintegerFirst ordinal that belongs to this sub-agent's own history; earlier records are inherited parent context.
multi_agent_versionoptionalenum(disabled|v1|v2)Multi-agent protocol version.
context_windowoptionalobject{window_id}: initial context-window identity (UUIDv7).
gitoptionalobject{commit_hash?, branch?, repository_url?} collected when cwd is inside a git repo; URL is sanitized.
account_scopedoptionalbooleanDiscovery is scoped to the creator when true; omitted means false in older files.
attached_threadoptionalbooleanAttached fork; paginated display history can hide its inherited parent prefix.
{"timestamp":"2026-01-02T03:04:05.678Z","ordinal":0,"type":"session_meta","payload":{"id":"0199aaaa-0000-7000-8000-000000000001","session_id":"0199aaaa-0000-7000-8000-000000000001","timestamp":"2026-01-02T03:04:05.600Z","cwd":"/workspace/project","originator":"codex_cli_rs","cli_version":"0.164.0","source":"cli","thread_source":"user","model_provider":"openai","base_instructions":{"text":"You are a coding agent."},"history_mode":"paginated","context_window":{"window_id":"0199aaaa-0000-7000-8000-0000000000ff"},"git":{"commit_hash":"0123456789abcdef0123456789abcdef01234567","branch":"main"}}}

git is flattened into the same payload object (SessionMetaLine = SessionMeta + git).

Source values include "cli", "vscode", "exec", and {"subagent":...} with review / thread_spawn / other.

SessionSource is externally tagged lowercase, so a sub-agent appears as {"subagent":{"thread_spawn":{...}}}, not as a type field.

dynamic_tools_updated

Replaces the persistent dynamic tool catalogue without starting a turn.

Stored Both history modes; the registered host must permit persistent dynamic tool updates.

FieldTypeMeaning
thread_idstring(uuid)Owning thread.
toolsDynamicToolSpec[]Complete replacement catalogue; an empty list clears it.

The core writer appends and flushes before publishing the catalogue. Default core configuration disables persistent dynamic tool updates; other hosts can supply a different policy.

turn_context

Model, cwd, approval and sandbox settings that applied to one turn.

Written once per real user turn after model-visible context updates are computed, and again after mid-turn compaction re-establishes context.

FieldTypeMeaning
turn_idoptionalstringTurn this context belongs to.
root_turn_idoptionalstringCausal root turn.
cwdstring(path)Absolute working directory.
approval_policystring | objectAskForApproval: "untrusted" | "on-request" (alias on-failure) | "never" | {"granular":{...}}.
approvals_revieweroptionalenum(user|auto_review)Who reviews approvals (alias guardian_subagent).
sandbox_policyobjectCompatibility field emitted by the rollout wire serializer; runtime TurnContextItem itself now carries permission_profile. Do not derive the on-disk shape from serializing the runtime type alone.
permission_profileobjectCanonical runtime permissions. Historical readers accept sandbox_policy when this is absent.
active_permission_profileoptionalobjectNamed/built-in profile that produced permission_profile.
file_system_sandbox_policyoptionalobjectCompatibility split policy emitted when it differs from the legacy approximation.
modelstringModel slug used for the turn.
comp_hashoptionalstringOpaque compatibility hash.
collaboration_modeoptionalobject{mode: plan|default, settings:{...}}.
multi_agent_versionoptionalenum(disabled|v1|v2)—
realtime_activeoptionalbooleanRealtime voice session active.
cyber_access_programoptionalobjectCyber access program state.
disabled_plugin_idsoptionalstring[]Plugin selection for the turn.
effortoptionalenum(none|minimal|low|medium|high|xhigh|max|ultra|persistent)Reasoning effort.
summaryoptionalenum(auto|concise|detailed|none)Legacy reasoning-summary placeholder, now written as "none" for older readers.
direct_only_tool_namespacesoptionalstring[]Explicit routing; an empty list clears the direct namespaces.
{"timestamp":"2026-01-02T03:04:05.678Z","ordinal":7,"type":"turn_context","payload":{"turn_id":"0199aaaa-0000-7000-8000-000000000010","cwd":"/workspace/project","approval_policy":"on-request","sandbox_policy":{"type":"workspace-write","writable_roots":[],"network_access":false,"exclude_tmpdir_env_var":false,"exclude_slash_tmp":false},"model":"gpt-5-codex","collaboration_mode":{"mode":"default","settings":{"model":"gpt-5-codex"}},"effort":"medium","summary":"none"}}

Older files carry fields no longer in the struct and ignored on read: personality, current_date, timezone, workspace_roots (and, in early builds, user_instructions/developer_instructions).

token_usage_record

Best-effort token usage for one completed Responses API response, with running turn and thread totals.

Written after each completed model response.

FieldTypeMeaning
thread_idstring(uuid)—
turn_idstring—
session_idstring(uuid)Root session id.
root_turn_idstring—
response_idstringResponses API response id.
usageTokenUsageThis response: {input_tokens, cached_input_tokens, cache_write_input_tokens, output_tokens, reasoning_output_tokens, total_tokens}.
turn_token_usageTokenUsageCumulative for the turn.
thread_token_usageTokenUsageCumulative for the thread.
{"timestamp":"2026-01-02T03:04:05.678Z","ordinal":7,"type":"token_usage_record","payload":{"thread_id":"0199aaaa-0000-7000-8000-000000000001","turn_id":"0199aaaa-0000-7000-8000-000000000010","session_id":"0199aaaa-0000-7000-8000-000000000001","root_turn_id":"0199aaaa-0000-7000-8000-000000000010","response_id":"resp_123","usage":{"input_tokens":1200,"cached_input_tokens":1000,"cache_write_input_tokens":0,"output_tokens":80,"reasoning_output_tokens":40,"total_tokens":1280},"turn_token_usage":{"input_tokens":1200,"cached_input_tokens":1000,"cache_write_input_tokens":0,"output_tokens":80,"reasoning_output_tokens":40,"total_tokens":1280},"thread_token_usage":{"input_tokens":5000,"cached_input_tokens":3000,"cache_write_input_tokens":0,"output_tokens":400,"reasoning_output_tokens":200,"total_tokens":5400}}}

compacted

A context compaction checkpoint; when replacement_history is present it is the complete new model history.

Written when the conversation is compacted (manual /compact or automatic).

FieldTypeMeaning
messagestringSummary text (may be empty for remote/encrypted compaction).
replacement_historyoptionalResponseItem[]Complete history after compaction; same shapes as response_item payloads. Absent in early legacy rollouts.
replacement_history_metadataoptionalCodexHarnessMetadata[]Parallel array of per-item metadata; must have the same length as replacement_history.
guardian_historyoptionalobjectGuardian reviewer history checkpoint.
retained_contextoptionalobjectSnapshot of retained verified answers / user and assistant messages {verified_answers, incomplete, user_messages, user_messages_incomplete, assistant_messages, assistant_messages_incomplete, next_order, sender_deliveries?}.
mcp_resource_originsoptionalobjectMCP resource origin checkpoint.
window_numberoptionalintegerContext-window sequence number.
first_window_idoptionalstring—
previous_window_idoptionalstring—
window_idoptionalstring | integerNew window id; older rollouts stored the numeric window number here.
compaction_response_idoptionalstring | nullResponses API id for the compaction request; serialized as null when absent.
latest_token_usage_recordoptionalTokenUsageRecord | nullLatest usage snapshot at compaction time; serialized as null when absent.
resume_metadataoptionalobjectRecovery checkpoint: rejected_audio_file_ids, dynamic_tools {thread_id, tools}, multi_agent_version, last_started_turn_id, turn_attribution and previous_turn_settings. This is distinct from replacement model history.
{"timestamp":"2026-01-02T03:04:05.678Z","ordinal":7,"type":"compacted","payload":{"message":"Summary of earlier work.","replacement_history":[{"type":"message","role":"user","content":[{"type":"input_text","text":"Fix the failing test."}]},{"type":"compaction","encrypted_content":"gAAAA..."}],"window_number":2,"window_id":"0199aaaa-0000-7000-8000-000000000020","previous_window_id":"0199aaaa-0000-7000-8000-0000000000ff","first_window_id":"0199aaaa-0000-7000-8000-0000000000ff","compaction_response_id":null,"latest_token_usage_record":null}}

Legacy ghost_snapshot entries inside replacement_history are stripped on read.

world_state

Persisted comparison state for model-visible world-state diffing (full snapshot or patch).

Written when world-state context is computed for a turn; full snapshots establish a new baseline.

FieldTypeMeaning
fullbooleantrue = full baseline; false = patch onto the current baseline.
stateobjectOpaque key/value map.
{"timestamp":"2026-01-02T03:04:05.678Z","ordinal":7,"type":"world_state","payload":{"full":true,"state":{"example_key":"example_value"}}}

inter_agent_communication

A message between agents in a multi-agent tree, recorded as history of the recipient.

Written when an agent sends a message or task to another agent through the thread submission lifecycle.

FieldTypeMeaning
idoptionalstring—
authorstringSender agent path.
recipientstringRecipient agent path.
other_recipientsstring[]Defaults to [].
contentstringPlain text (empty when encrypted_content is set).
encrypted_contentoptionalstring—
internal_chat_message_metadata_passthroughoptionalobjectHarness metadata copied from the Responses API: turn_id (string), create_time (fractional Unix seconds), content_item_kinds (string[] aligned with content), content_item_metadata ([{provenance:{type: unknown|developer_instructions|skills|agents_md|harness|tool|user, ...}}] aligned with content). cell_id, executed_tool_calls and tool_calls_complete may be written but are ignored on read.
trigger_turnbooleanWhether delivery starts a turn (NEW_TASK vs MESSAGE).
{"timestamp":"2026-01-02T03:04:05.678Z","ordinal":7,"type":"inter_agent_communication","payload":{"author":"/root","recipient":"/root/worker","other_recipients":[],"content":"Please check the tests.","trigger_turn":true}}

Concept is user-message for the recipient: it is input from another agent, not from the human.

inter_agent_communication_metadata

Records whether a delivered inter-agent message triggered a turn.

Written alongside inter-agent message delivery.

FieldTypeMeaning
trigger_turnboolean—
{"timestamp":"2026-01-02T03:04:05.678Z","ordinal":7,"type":"inter_agent_communication_metadata","payload":{"trigger_turn":false}}

security_risk_score

Security-risk classifier scores for a reviewed tool action; never model- or user-visible.

Written when a security risk classifier scores an action.

FieldTypeMeaning
scoresobject<string, number>Classifier name -> score.
call_idoptionalstringTool call that produced the score.
actionoptionalanyBounded description of the reviewed action.
sampled_atoptionalstring(RFC3339)When sampling started.
{"timestamp":"2026-01-02T03:04:05.678Z","ordinal":7,"type":"security_risk_score","payload":{"scores":{"example_classifier":0.02},"call_id":"call_abc"}}

retained_context / verified_answer

Host-only record of user answers verified for a request_user_input-style call, retained for delegated review.

Written when a question/answer exchange is accepted.

FieldTypeMeaning
turn_idstring—
call_idstring—
questionsarray[{question, answer}]
acceptance_orderoptionalintegerAbsent in legacy events.
{"timestamp":"2026-01-02T03:04:05.678Z","ordinal":7,"type":"retained_context","payload":{"type":"verified_answer","turn_id":"t1","call_id":"call_abc","questions":[{"question":"Proceed?","answer":"Yes"}],"acceptance_order":3}}

The other RetainedContextEvent variant, delivered_assistant_message, is never written as retained_context: it is rewritten as a response_item assistant message with metadata.delivered_assistant_message = "codex:code-mode-delivery:v1:complete" (or "...:incomplete:<text>") and metadata.user_input_order, and turned back into the event on read. https://github.com/openai/codex/blob/d32063f96c2dff1dc96af839b3952abb6acfeda4/codex-rs/history/src/rollout_payload.rs#L181-L224

realtime_item / realtime_session_started

A realtime voice session began.

Written during realtime (voice) sessions; paginated threads only.

Stored only history_mode = paginated only; dropped in legacy

FieldTypeMeaning
idstring—
realtime_session_idstring—
{"timestamp":"2026-01-02T03:04:05.678Z","ordinal":7,"type":"realtime_item","payload":{"id":"rt1","realtime_session_id":"rs1","type":"realtime_session_started"}}

RealtimeItem flattens its content, so payload.type is the content discriminator alongside id and realtime_session_id.

realtime_item / transcript_segment

A transcribed realtime speech segment (role user or assistant).

Written during realtime (voice) sessions; paginated threads only.

Stored only history_mode = paginated only; dropped in legacy

FieldTypeMeaning
idstring—
realtime_session_idstring—
roleenum(user|assistant)—
textstring—
{"timestamp":"2026-01-02T03:04:05.678Z","ordinal":7,"type":"realtime_item","payload":{"id":"rt1","realtime_session_id":"rs1","type":"transcript_segment","role":"user","text":"Hello"}}

RealtimeItem flattens its content, so payload.type is the content discriminator alongside id and realtime_session_id.

realtime_item / bem_item_promoted

An existing agent item was presented inside the realtime conversation.

Written during realtime (voice) sessions; paginated threads only.

Stored only history_mode = paginated only; dropped in legacy

FieldTypeMeaning
idstring—
realtime_session_idstring—
turn_idstring—
item_idstring—
presentationobject{type: whole_item | inline_markdown | inline_visualization, index?}
{"timestamp":"2026-01-02T03:04:05.678Z","ordinal":7,"type":"realtime_item","payload":{"id":"rt1","realtime_session_id":"rs1","type":"bem_item_promoted","turn_id":"t1","item_id":"i1","presentation":{"type":"whole_item"}}}

RealtimeItem flattens its content, so payload.type is the content discriminator alongside id and realtime_session_id.

realtime_item / realtime_session_closed

A realtime session ended.

Written during realtime (voice) sessions; paginated threads only.

Stored only history_mode = paginated only; dropped in legacy

FieldTypeMeaning
idstring—
realtime_session_idstring—
outcomeenum(ended|failed)—
{"timestamp":"2026-01-02T03:04:05.678Z","ordinal":7,"type":"realtime_item","payload":{"id":"rt1","realtime_session_id":"rs1","type":"realtime_session_closed","outcome":"ended"}}

RealtimeItem flattens its content, so payload.type is the content discriminator alongside id and realtime_session_id.

response_item / message (role=user)

A user message as sent to the model (also used for injected user-role context such as AGENTS.md and environment context).

Written when user input is recorded for a turn; also for harness-injected user-role context fragments.

Stored always (both history modes)

FieldTypeMeaning
idoptionalstringResponses API item id (e.g. msg_..., rs_..., fc_...) or a harness-generated <prefix>_<uuidv7>.
rolestring"user"
contentContentItem[]input_text / input_image / input_audio blocks.
statusoptionalstring—
encrypted_contentoptionalstringOpaque encrypted payload.
phaseoptionalstring—
internal_chat_message_metadata_passthroughoptionalobjectHarness metadata copied from the Responses API: turn_id (string), create_time (fractional Unix seconds), content_item_kinds (string[] aligned with content), content_item_metadata ([{provenance:{type: unknown|developer_instructions|skills|agents_md|harness|tool|user, ...}}] aligned with content). cell_id, executed_tool_calls and tool_calls_complete may be written but are ignored on read.
{"timestamp":"2026-01-02T03:04:05.678Z","ordinal":7,"type":"response_item","payload":{"type":"message","role":"user","content":[{"type":"input_text","text":"Fix the failing test."}]},"metadata":{"client_authored":false,"user_input_order":1}}

Injected context (AGENTS.md, environment_context, skills) is also role=user; distinguish via internal_chat_message_metadata_passthrough.content_item_metadata[].provenance when present, otherwise by text markers such as <environment_context> or # AGENTS.md.

metadata (sibling of payload) carries CodexHarnessMetadata; see the envelope.

response_item / message (role=assistant)

Assistant output text.

Written when the model emits an output message.

Stored always (both history modes)

FieldTypeMeaning
idoptionalstringResponses API item id (e.g. msg_..., rs_..., fc_...) or a harness-generated <prefix>_<uuidv7>.
rolestring"assistant"
contentContentItem[]output_text blocks.
phaseoptionalenum(commentary|partial_answer|final_answer)Absent = unknown (older models/providers).
statusoptionalstring—
encrypted_contentoptionalstringOpaque encrypted payload.
internal_chat_message_metadata_passthroughoptionalobjectHarness metadata copied from the Responses API: turn_id (string), create_time (fractional Unix seconds), content_item_kinds (string[] aligned with content), content_item_metadata ([{provenance:{type: unknown|developer_instructions|skills|agents_md|harness|tool|user, ...}}] aligned with content). cell_id, executed_tool_calls and tool_calls_complete may be written but are ignored on read.
{"timestamp":"2026-01-02T03:04:05.678Z","ordinal":7,"type":"response_item","payload":{"type":"message","role":"assistant","id":"msg_123","content":[{"type":"output_text","text":"Done."}],"phase":"final_answer","internal_chat_message_metadata_passthrough":{"turn_id":"t1","create_time":1767323045.678}}}

Also used for code-mode delivered assistant messages (see retained_context note).

2026-11-13 supplement, Codex rust-v0.167.2 at ce21072c90d32c40af7a55b60b2fb35c84a43a6a: assistant text can contain :codex-file-citation{path="…" purpose="source"}. This is inline message markup, not a new JSONL record or memory_citation field. The TUI assistant renderer interprets it; external transcript/App Server consumers need their own rendering. HTTPS paths are live-observed; the inspected TUI treats non-local paths as relative, so its destination logic is not a web-link contract. See docs/research/codex-file-citations.md and docs/research/evidence/codex-file-citations-2026-11-13.json. The original supplement did not refresh the full schema; the 2026-11-15 audit supplies the current local format pin.

response_item / message (role=developer)

Developer-role instructions/context injected by the harness (permissions, collaboration mode, skills, hook output, etc.).

Written at session start and whenever model-visible context changes.

Stored always (both history modes)

FieldTypeMeaning
idoptionalstringResponses API item id (e.g. msg_..., rs_..., fc_...) or a harness-generated <prefix>_<uuidv7>.
rolestring"developer" ("system" is possible from older/other producers)
contentContentItem[]input_text blocks.
internal_chat_message_metadata_passthroughoptionalobjectHarness metadata copied from the Responses API: turn_id (string), create_time (fractional Unix seconds), content_item_kinds (string[] aligned with content), content_item_metadata ([{provenance:{type: unknown|developer_instructions|skills|agents_md|harness|tool|user, ...}}] aligned with content). cell_id, executed_tool_calls and tool_calls_complete may be written but are ignored on read.
{"timestamp":"2026-01-02T03:04:05.678Z","ordinal":7,"type":"response_item","payload":{"type":"message","role":"developer","content":[{"type":"input_text","text":"<permissions instructions>...</permissions instructions>"}]},"metadata":{"client_authored":false}}

metadata.client_authored=true marks developer text supplied by the client rather than the harness.

response_item / reasoning

Model reasoning item: readable summaries plus (usually) encrypted reasoning content.

Written when the model emits reasoning.

Stored always (both history modes)

FieldTypeMeaning
idoptionalstringResponses API item id (e.g. msg_..., rs_..., fc_...) or a harness-generated <prefix>_<uuidv7>.
summaryarray[{type:"summary_text", text}]
contentoptionalarray[{type:"reasoning_text"|"text", text}] raw reasoning; omitted on write when absent or when it contains reasoning_text.
encrypted_contentstring | nullAlways serialized (null when absent).
internal_chat_message_metadata_passthroughoptionalobjectHarness metadata copied from the Responses API: turn_id (string), create_time (fractional Unix seconds), content_item_kinds (string[] aligned with content), content_item_metadata ([{provenance:{type: unknown|developer_instructions|skills|agents_md|harness|tool|user, ...}}] aligned with content). cell_id, executed_tool_calls and tool_calls_complete may be written but are ignored on read.
{"timestamp":"2026-01-02T03:04:05.678Z","ordinal":7,"type":"response_item","payload":{"type":"reasoning","id":"rs_123","summary":[{"type":"summary_text","text":"Inspecting the test."}],"encrypted_content":"gAAAA..."}}

response_item / function_call

A JSON-arguments function tool call (shell, MCP tools, multi-agent tools, etc.).

Written when the model calls a function tool.

Stored always (both history modes)

FieldTypeMeaning
idoptionalstringResponses API item id (e.g. msg_..., rs_..., fc_...) or a harness-generated <prefix>_<uuidv7>.
namestringTool name.
namespaceoptionalstringTool namespace (e.g. MCP server namespace).
argumentsstringJSON-encoded arguments STRING, not an object.
encrypted_function_argsoptionalstring[]—
call_idstringPairs with function_call_output.call_id.
statusoptionalstring—
encrypted_contentoptionalstringOpaque encrypted payload.
internal_chat_message_metadata_passthroughoptionalobjectHarness metadata copied from the Responses API: turn_id (string), create_time (fractional Unix seconds), content_item_kinds (string[] aligned with content), content_item_metadata ([{provenance:{type: unknown|developer_instructions|skills|agents_md|harness|tool|user, ...}}] aligned with content). cell_id, executed_tool_calls and tool_calls_complete may be written but are ignored on read.
{"timestamp":"2026-01-02T03:04:05.678Z","ordinal":7,"type":"response_item","payload":{"type":"function_call","name":"exec_command","arguments":"{\"cmd\":\"ls\"}","call_id":"call_abc"}}

response_item / function_call_output

Result of a function tool call.

Written after the tool finishes.

Stored always (both history modes)

FieldTypeMeaning
idoptionalstringResponses API item id (e.g. msg_..., rs_..., fc_...) or a harness-generated <prefix>_<uuidv7>.
call_idoptionalstringMatches function_call.call_id.
nameoptionalstring—
namespaceoptionalstring—
outputstring | FunctionCallOutputContentItem[]Plain string, or an array of input_text / input_image / input_audio / encrypted_content items.
internal_chat_message_metadata_passthroughoptionalobjectHarness metadata copied from the Responses API: turn_id (string), create_time (fractional Unix seconds), content_item_kinds (string[] aligned with content), content_item_metadata ([{provenance:{type: unknown|developer_instructions|skills|agents_md|harness|tool|user, ...}}] aligned with content). cell_id, executed_tool_calls and tool_calls_complete may be written but are ignored on read.
{"timestamp":"2026-01-02T03:04:05.678Z","ordinal":7,"type":"response_item","payload":{"type":"function_call_output","call_id":"call_abc","output":"Process exited with code 0\nOutput:\nREADME.md"}}

The success flag is internal and never serialized; success must be inferred from output text or from the paired item_completed event.

Very early rollouts stored output as an object {content, success}; current deserializer accepts only string or array.

response_item / custom_tool_call

A freeform (grammar/plain-text input) tool call such as apply_patch or code-mode exec.

Written when the model calls a custom tool.

Stored always (both history modes)

FieldTypeMeaning
idoptionalstringResponses API item id (e.g. msg_..., rs_..., fc_...) or a harness-generated <prefix>_<uuidv7>.
call_idstring—
namestring—
namespaceoptionalstring—
inputstringRaw freeform input (e.g. a patch).
statusoptionalstring—
encrypted_contentoptionalstringOpaque encrypted payload.
internal_chat_message_metadata_passthroughoptionalobjectHarness metadata copied from the Responses API: turn_id (string), create_time (fractional Unix seconds), content_item_kinds (string[] aligned with content), content_item_metadata ([{provenance:{type: unknown|developer_instructions|skills|agents_md|harness|tool|user, ...}}] aligned with content). cell_id, executed_tool_calls and tool_calls_complete may be written but are ignored on read.
{"timestamp":"2026-01-02T03:04:05.678Z","ordinal":7,"type":"response_item","payload":{"type":"custom_tool_call","status":"completed","call_id":"call_def","name":"apply_patch","input":"*** Begin Patch\n*** End Patch"}}

response_item / custom_tool_call_output

Result of a custom tool call.

Written after the custom tool finishes.

Stored always (both history modes)

FieldTypeMeaning
idoptionalstringResponses API item id (e.g. msg_..., rs_..., fc_...) or a harness-generated <prefix>_<uuidv7>.
call_idstring—
nameoptionalstring—
outputstring | FunctionCallOutputContentItem[]Same encoding as function_call_output.output.
internal_chat_message_metadata_passthroughoptionalobjectHarness metadata copied from the Responses API: turn_id (string), create_time (fractional Unix seconds), content_item_kinds (string[] aligned with content), content_item_metadata ([{provenance:{type: unknown|developer_instructions|skills|agents_md|harness|tool|user, ...}}] aligned with content). cell_id, executed_tool_calls and tool_calls_complete may be written but are ignored on read.
{"timestamp":"2026-01-02T03:04:05.678Z","ordinal":7,"type":"response_item","payload":{"type":"custom_tool_call_output","call_id":"call_def","output":[{"type":"input_text","text":"Success. Updated the following files: M src/lib.rs"}]}}

response_item / local_shell_call

Responses API built-in local shell call (legacy shell tool).

Written when a model using the local_shell tool runs a command.

Stored always (both history modes)

FieldTypeMeaning
idoptionalstringResponses API item id (e.g. msg_..., rs_..., fc_...) or a harness-generated <prefix>_<uuidv7>.
call_idstring | null—
statusenum(completed|in_progress|incomplete)—
actionobject{type:"exec", command:string[], timeout_ms, working_directory, env, user}
encrypted_contentoptionalstringOpaque encrypted payload.
internal_chat_message_metadata_passthroughoptionalobjectHarness metadata copied from the Responses API: turn_id (string), create_time (fractional Unix seconds), content_item_kinds (string[] aligned with content), content_item_metadata ([{provenance:{type: unknown|developer_instructions|skills|agents_md|harness|tool|user, ...}}] aligned with content). cell_id, executed_tool_calls and tool_calls_complete may be written but are ignored on read.
{"timestamp":"2026-01-02T03:04:05.678Z","ordinal":7,"type":"response_item","payload":{"type":"local_shell_call","call_id":"call_ls","status":"completed","action":{"type":"exec","command":["ls"],"timeout_ms":null,"working_directory":null,"env":null,"user":null}}}

Its result is recorded as function_call_output with the same call_id.

response_item / tool_search_call

A tool-search request (deferred tool discovery).

Written when the model searches for tools.

Stored always (both history modes)

FieldTypeMeaning
idoptionalstringResponses API item id (e.g. msg_..., rs_..., fc_...) or a harness-generated <prefix>_<uuidv7>.
call_idstring | null—
statusoptionalstring—
executionstring—
argumentsanyJSON value (not a string).
encrypted_contentoptionalstringOpaque encrypted payload.
internal_chat_message_metadata_passthroughoptionalobjectHarness metadata copied from the Responses API: turn_id (string), create_time (fractional Unix seconds), content_item_kinds (string[] aligned with content), content_item_metadata ([{provenance:{type: unknown|developer_instructions|skills|agents_md|harness|tool|user, ...}}] aligned with content). cell_id, executed_tool_calls and tool_calls_complete may be written but are ignored on read.
{"timestamp":"2026-01-02T03:04:05.678Z","ordinal":7,"type":"response_item","payload":{"type":"tool_search_call","call_id":"call_ts","status":"completed","execution":"client","arguments":{"query":"calendar"}}}

response_item / tool_search_output

Tools returned by a tool search.

Written after tool search completes.

Stored always (both history modes)

FieldTypeMeaning
idoptionalstringResponses API item id (e.g. msg_..., rs_..., fc_...) or a harness-generated <prefix>_<uuidv7>.
call_idstring | null—
statusstring—
executionstring—
toolsany[]Tool declarations.
internal_chat_message_metadata_passthroughoptionalobjectHarness metadata copied from the Responses API: turn_id (string), create_time (fractional Unix seconds), content_item_kinds (string[] aligned with content), content_item_metadata ([{provenance:{type: unknown|developer_instructions|skills|agents_md|harness|tool|user, ...}}] aligned with content). cell_id, executed_tool_calls and tool_calls_complete may be written but are ignored on read.
{"timestamp":"2026-01-02T03:04:05.678Z","ordinal":7,"type":"response_item","payload":{"type":"tool_search_output","call_id":"call_ts","status":"completed","execution":"client","tools":[]}}

response_item / web_search_call

Hosted web search performed by the Responses API (call and result in one item).

Written when the model uses hosted web search.

Stored always (both history modes)

FieldTypeMeaning
idoptionalstringResponses API item id (e.g. msg_..., rs_..., fc_...) or a harness-generated <prefix>_<uuidv7>.
statusoptionalstring—
actionoptionalobject{type: search {query?, queries?} | open_page {url?} | find_in_page {url?, pattern?} | other}
encrypted_contentoptionalstringOpaque encrypted payload.
internal_chat_message_metadata_passthroughoptionalobjectHarness metadata copied from the Responses API: turn_id (string), create_time (fractional Unix seconds), content_item_kinds (string[] aligned with content), content_item_metadata ([{provenance:{type: unknown|developer_instructions|skills|agents_md|harness|tool|user, ...}}] aligned with content). cell_id, executed_tool_calls and tool_calls_complete may be written but are ignored on read.
{"timestamp":"2026-01-02T03:04:05.678Z","ordinal":7,"type":"response_item","payload":{"type":"web_search_call","status":"completed","action":{"type":"search","query":"rust serde flatten"}}}

Results are not in this item; paginated rollouts may carry them in item_completed WebSearch.results.

response_item / image_generation_call

Hosted image generation call including the base64 result.

Written when the model generates an image via the hosted tool.

Stored always (both history modes)

FieldTypeMeaning
idoptionalstringResponses API item id (e.g. msg_..., rs_..., fc_...) or a harness-generated <prefix>_<uuidv7>.
statusstring—
revised_promptoptionalstring—
resultstringBase64 image data (can be very large).
encrypted_contentoptionalstringOpaque encrypted payload.
internal_chat_message_metadata_passthroughoptionalobjectHarness metadata copied from the Responses API: turn_id (string), create_time (fractional Unix seconds), content_item_kinds (string[] aligned with content), content_item_metadata ([{provenance:{type: unknown|developer_instructions|skills|agents_md|harness|tool|user, ...}}] aligned with content). cell_id, executed_tool_calls and tool_calls_complete may be written but are ignored on read.
{"timestamp":"2026-01-02T03:04:05.678Z","ordinal":7,"type":"response_item","payload":{"type":"image_generation_call","id":"ig_123","status":"completed","revised_prompt":"A blue square","result":"iVBORw0KGgo="}}

response_item / agent_message

Model-visible inter-agent message (author -> recipient).

Written when a multi-agent v2 message is delivered into this agent's history.

Stored always (both history modes)

FieldTypeMeaning
idoptionalstringResponses API item id (e.g. msg_..., rs_..., fc_...) or a harness-generated <prefix>_<uuidv7>.
authorstringAgent path.
recipientstringAgent path.
contentarray[{type:"input_text", text} | {type:"encrypted_content", encrypted_content}]
internal_chat_message_metadata_passthroughoptionalobjectHarness metadata copied from the Responses API: turn_id (string), create_time (fractional Unix seconds), content_item_kinds (string[] aligned with content), content_item_metadata ([{provenance:{type: unknown|developer_instructions|skills|agents_md|harness|tool|user, ...}}] aligned with content). cell_id, executed_tool_calls and tool_calls_complete may be written but are ignored on read.
{"timestamp":"2026-01-02T03:04:05.678Z","ordinal":7,"type":"response_item","payload":{"type":"agent_message","author":"/root","recipient":"/root/worker","content":[{"type":"input_text","text":"Run the linter."}]}}

response_item / additional_tools

Tool declarations added to the model's tool set at this point in history.

Written when tools are added mid-thread (e.g. after tool search or plugin enablement).

Stored always (both history modes)

FieldTypeMeaning
idoptionalstringResponses API item id (e.g. msg_..., rs_..., fc_...) or a harness-generated <prefix>_<uuidv7>.
rolestring—
toolsany[]Tool declarations (JSON).
{"timestamp":"2026-01-02T03:04:05.678Z","ordinal":7,"type":"response_item","payload":{"type":"additional_tools","role":"developer","tools":[{"type":"function","name":"example_tool"}]}}

response_item / configuration_update

Durable input control (reasoning effort) interpreted by the backend at this point in history.

Written when reasoning effort changes mid-thread. Since 0.165.0 this is on by default for OpenAI providers with models that support effort updates; otherwise the effort goes on the request instead.

Stored always (both history modes)

FieldTypeMeaning
reasoningobject{effort}
{"timestamp":"2026-01-02T03:04:05.678Z","ordinal":7,"type":"response_item","payload":{"type":"configuration_update","reasoning":{"effort":"high"}},"metadata":{"client_authored":false,"harness_authored_configuration":true}}

response_item / compaction

Opaque encrypted compaction item returned by remote compaction; replaces summarized history for the model.

Written on remote/model-backed compaction.

Stored always (both history modes)

FieldTypeMeaning
idoptionalstringResponses API item id (e.g. msg_..., rs_..., fc_...) or a harness-generated <prefix>_<uuidv7>.
encrypted_contentstring—
internal_chat_message_metadata_passthroughoptionalobjectHarness metadata copied from the Responses API: turn_id (string), create_time (fractional Unix seconds), content_item_kinds (string[] aligned with content), content_item_metadata ([{provenance:{type: unknown|developer_instructions|skills|agents_md|harness|tool|user, ...}}] aligned with content). cell_id, executed_tool_calls and tool_calls_complete may be written but are ignored on read.
{"timestamp":"2026-01-02T03:04:05.678Z","ordinal":7,"type":"response_item","payload":{"type":"compaction","id":"cmp_123","encrypted_content":"gAAAA..."},"metadata":{"client_authored":false,"compaction_model_hash":"abc","compaction_output":true}}

Read alias: compaction_summary.

response_item / context_compaction

Context-compaction item from the Responses API (optionally encrypted).

Written on server-side context compaction.

Stored always (both history modes)

FieldTypeMeaning
idoptionalstringResponses API item id (e.g. msg_..., rs_..., fc_...) or a harness-generated <prefix>_<uuidv7>.
encrypted_contentoptionalstringOpaque encrypted payload.
internal_chat_message_metadata_passthroughoptionalobjectHarness metadata copied from the Responses API: turn_id (string), create_time (fractional Unix seconds), content_item_kinds (string[] aligned with content), content_item_metadata ([{provenance:{type: unknown|developer_instructions|skills|agents_md|harness|tool|user, ...}}] aligned with content). cell_id, executed_tool_calls and tool_calls_complete may be written but are ignored on read.
{"timestamp":"2026-01-02T03:04:05.678Z","ordinal":7,"type":"response_item","payload":{"type":"context_compaction","id":"cc_123"}}

event_msg / task_started

A turn began.

Written at the start of every turn (regular, review, compact, user shell).

Stored always (both history modes)

FieldTypeMeaning
turn_idstring—
root_turn_idoptionalstringOriginating turn in the root thread.
turn_attributionoptionalobjectProvenance of a regular turn.
trace_idoptionalstringTelemetry trace id.
started_atoptionalinteger(Unix seconds)—
model_context_windowinteger | null—
collaboration_mode_kindoptionalenum(plan|default)Aliases on read: code, pair_programming, execute, custom.
{"timestamp":"2026-01-02T03:04:05.678Z","ordinal":7,"type":"event_msg","payload":{"type":"task_started","turn_id":"t1","started_at":1767323045,"model_context_window":258400,"collaboration_mode_kind":"default"}}

Serialized name is task_started; turn_started is accepted as an alias on read.

event_msg / task_complete

A turn finished (successfully or with a terminal error).

Written at the end of a turn.

Stored always (both history modes)

FieldTypeMeaning
turn_idstring—
root_turn_idoptionalstring—
last_agent_messagestring | nullFinal assistant text.
erroroptionalobject{message, codex_error_info?} when the turn failed.
started_atoptionalintegerUnix seconds
completed_atoptionalintegerUnix seconds
duration_msoptionalinteger—
time_to_first_token_msoptionalinteger—
{"timestamp":"2026-01-02T03:04:05.678Z","ordinal":7,"type":"event_msg","payload":{"type":"task_complete","turn_id":"t1","last_agent_message":"Done.","started_at":1767323045,"completed_at":1767323100,"duration_ms":55000,"time_to_first_token_ms":900}}

Serialized name task_complete; alias turn_complete on read.

error.codex_error_info is an enum; misalignment details are never persisted.

event_msg / turn_aborted

A turn was interrupted, replaced, ended by review, or budget-limited.

Written when a turn is aborted.

Stored always (both history modes)

FieldTypeMeaning
turn_idstring | null—
root_turn_idoptionalstring—
reasonenum(interrupted|replaced|review_ended|budget_limited)—
erroroptionalobject—
started_atoptionalinteger—
completed_atoptionalinteger—
duration_msoptionalinteger—
{"timestamp":"2026-01-02T03:04:05.678Z","ordinal":7,"type":"event_msg","payload":{"type":"turn_aborted","turn_id":"t1","reason":"interrupted","completed_at":1767323060,"duration_ms":15000}}

event_msg / token_count

Cumulative and last-response token usage plus rate-limit snapshot.

Written after each model response and on rate-limit updates.

Stored always (both history modes)

FieldTypeMeaning
infoobject | null{total_token_usage: TokenUsage, last_token_usage: TokenUsage, model_context_window: integer|null, last_usage_includes_reasoning?: boolean} (last_usage_includes_reasoning since 0.166.0; omitted when unknown)
rate_limitsobject | null{limit_id, limit_name, normal_model_slug?, primary:{used_percent, window_minutes, resets_at}|null, secondary, credits:{has_credits, unlimited, balance}|null, individual_limit, spend_control_reached, plan_type, rate_limit_reached_type}
{"timestamp":"2026-01-02T03:04:05.678Z","ordinal":7,"type":"event_msg","payload":{"type":"token_count","info":{"total_token_usage":{"input_tokens":5000,"cached_input_tokens":3000,"cache_write_input_tokens":0,"output_tokens":400,"reasoning_output_tokens":200,"total_tokens":5400},"last_token_usage":{"input_tokens":1200,"cached_input_tokens":1000,"cache_write_input_tokens":0,"output_tokens":80,"reasoning_output_tokens":40,"total_tokens":1280},"model_context_window":258400},"rate_limits":{"limit_id":"codex","limit_name":null,"primary":{"used_percent":12.0,"window_minutes":300,"resets_at":1767330000},"secondary":null,"credits":null,"individual_limit":null,"spend_control_reached":null,"plan_type":"plus","rate_limit_reached_type":null}}}

info may be null (rate-limit-only update). Do not sum token_count events: totals are already cumulative and some events repeat the same totals.

event_msg / thread_settings_applied

Snapshot of thread-level settings after they were applied.

Written when thread settings are applied or changed.

Stored always (both history modes)

FieldTypeMeaning
thread_idoptionalstring(uuid)Owner thread; absent in older histories.
thread_settingsobject{model, model_provider_id, service_tier?, approval_policy, approvals_reviewer, permission_profile, active_permission_profile?, cwd, runtime_workspace_roots?, reasoning_effort?, reasoning_summary?, personality?, collaboration_mode, disabled_plugin_ids}
{"timestamp":"2026-01-02T03:04:05.678Z","ordinal":7,"type":"event_msg","payload":{"type":"thread_settings_applied","thread_id":"0199aaaa-0000-7000-8000-000000000001","thread_settings":{"model":"gpt-5-codex","model_provider_id":"openai","approval_policy":"on-request","approvals_reviewer":"user","permission_profile":{"type":"managed"},"cwd":"/workspace/project","collaboration_mode":{"mode":"default","settings":{"model":"gpt-5-codex"}},"disabled_plugin_ids":[]}}}

event_msg / thread_goal_updated

The thread's goal (objective, status, budget) changed.

Written when a goal is created or updated.

Stored always (both history modes)

FieldTypeMeaning
threadIdstring(uuid)camelCase field names in this record.
turnIdoptionalstring—
goalobject{threadId, objective, status: active|paused|blocked|usageLimited|budgetLimited|complete, tokenBudget?, tokensUsed, timeUsedSeconds, createdAt, updatedAt}
{"timestamp":"2026-01-02T03:04:05.678Z","ordinal":7,"type":"event_msg","payload":{"type":"thread_goal_updated","threadId":"0199aaaa-0000-7000-8000-000000000001","goal":{"threadId":"0199aaaa-0000-7000-8000-000000000001","objective":"Ship the fix","status":"active","tokensUsed":0,"timeUsedSeconds":0,"createdAt":1767323045,"updatedAt":1767323045}}}

event_msg / thread_rolled_back

The last N user turns were removed from model context (rewind).

Written when the user rolls back turns.

Stored always (both history modes)

FieldTypeMeaning
num_turnsintegerNumber of user turns dropped.
{"timestamp":"2026-01-02T03:04:05.678Z","ordinal":7,"type":"event_msg","payload":{"type":"thread_rolled_back","num_turns":1}}

Concept is branches/rewind; see linking. Earlier records stay in the file.

event_msg / item_completed

Wrapper for a completed TurnItem (the paginated-mode canonical item stream).

Written when any turn item completes. Legacy mode keeps only items with no other lossless representation.

Stored only paginated: every TurnItem, with CommandExecution.aggregated_output and McpToolCall.result truncated to 64 KiB; legacy: only FunctionCallOutput, Plan, Extension clock.sleep, and SubAgentActivity kind=completed

FieldTypeMeaning
thread_idstring(uuid)—
turn_idstring—
itemTurnItemTagged by item.type (PascalCase variant names); see item_completed sub-records.
started_at_msoptionalinteger—
completed_at_msintegerDefaults to 0 for old records.
content_token_countoptionalintegerOptional producer-supplied assistant content-token count, including sampled footer; completion telemetry, not billing.
{"timestamp":"2026-01-02T03:04:05.678Z","ordinal":7,"type":"event_msg","payload":{"type":"item_completed","thread_id":"0199aaaa-0000-7000-8000-000000000001","turn_id":"t1","item":{"type":"Plan","id":"p1","text":"1. Fix"},"completed_at_ms":1767323050000}}

event_msg / user_message

UI-level user message (legacy history).

Written when the user submits input (legacy mode).

Stored only history_mode = legacy only

FieldTypeMeaning
messagestring—
client_idoptionalstring—
imagesoptionalstring[]Image URLs/data URLs.
image_detailsoptionalarray—
file_idsoptionalstring[]—
file_id_detailsoptionalarray—
image_orderoptionalenum(inline|file)[]—
local_imagesstring[]Local image paths (default []).
local_image_detailsoptionalarray—
audiooptionalstring[]—
local_audiostring[]—
text_elementsarray[{byte_range:{start,end}, placeholder}]
audio_referencesoptionalAudioReference[]File-backed audio; older producers may retain the complete ordered reference list here.
audio_orderoptional(inline|file)[]Use split audio arrays in this order only when the counts and reference kinds account for every element.
{"timestamp":"2026-01-02T03:04:05.678Z","type":"event_msg","payload":{"type":"user_message","message":"Fix the failing test.","local_images":[],"local_audio":[],"text_elements":[]}}

Contains the user's text without injected context, unlike response_item/message role=user.

event_msg / agent_message

UI-level assistant message (legacy history).

Written when the assistant produces a message (legacy mode).

Stored only history_mode = legacy only

FieldTypeMeaning
messagestring—
phaseoptionalstring | null—
memory_citationoptionalobject | null—
deliveryoptionalenum(async)—
questionsoptionalarray[{title, options}]
moderationoptional{item_id, moderated, display?}Targeted presentation metadata; preserve unknown display actions.
{"timestamp":"2026-01-02T03:04:05.678Z","type":"event_msg","payload":{"type":"agent_message","message":"Done.","phase":"final_answer","memory_citation":null}}

event_msg / agent_reasoning

UI-level reasoning summary text (legacy).

Written when a reasoning summary is produced (legacy).

Stored only history_mode = legacy only

FieldTypeMeaning
textstring—
{"timestamp":"2026-01-02T03:04:05.678Z","type":"event_msg","payload":{"type":"agent_reasoning","text":"**Inspecting** the test."}}

event_msg / agent_reasoning_raw_content

UI-level raw reasoning text (legacy).

Written when raw reasoning is exposed (legacy).

Stored only history_mode = legacy only

FieldTypeMeaning
textstring—
{"timestamp":"2026-01-02T03:04:05.678Z","type":"event_msg","payload":{"type":"agent_reasoning_raw_content","text":"..."}}

event_msg / entered_review_mode

A /review sub-turn started (legacy).

Written when review mode starts.

Stored only history_mode = legacy only

FieldTypeMeaning
targetobject{type: uncommittedChanges | baseBranch{branch} | commit{sha,title} | custom{instructions}}
user_facing_hintoptionalstring—
turn_idoptionalstring—
item_idoptionalstring—
{"timestamp":"2026-01-02T03:04:05.678Z","type":"event_msg","payload":{"type":"entered_review_mode","target":{"type":"uncommittedChanges"},"user_facing_hint":"current changes"}}

event_msg / exited_review_mode

A review finished, with structured findings (legacy).

Written when review mode ends.

Stored only history_mode = legacy only

FieldTypeMeaning
turn_idoptionalstring—
item_idoptionalstring—
review_outputobject | null{findings:[{title, body, confidence_score, priority, code_location:{absolute_file_path, line_range:{start,end}}}], overall_correctness, overall_explanation, overall_confidence_score}
{"timestamp":"2026-01-02T03:04:05.678Z","type":"event_msg","payload":{"type":"exited_review_mode","review_output":{"findings":[],"overall_correctness":"patch is correct","overall_explanation":"No issues.","overall_confidence_score":0.8}}}

event_msg / patch_apply_end

Outcome of applying a patch (legacy).

Written after apply_patch completes.

Stored only history_mode = legacy only

FieldTypeMeaning
call_idstring—
turn_idstringDefault "".
stdoutstring—
stderrstring—
successboolean—
changesobject<path, FileChange>FileChange = {type:add,content} | {type:delete,content} | {type:update,unified_diff,move_path}
statusenum(completed|failed|declined)—
{"timestamp":"2026-01-02T03:04:05.678Z","type":"event_msg","payload":{"type":"patch_apply_end","call_id":"call_def","turn_id":"t1","stdout":"Success.","stderr":"","success":true,"changes":{"/workspace/project/a.txt":{"type":"add","content":"hi\n"}},"status":"completed"}}

event_msg / context_compacted

Marker that context was compacted (legacy).

Written after compaction.

Stored only history_mode = legacy only

{"timestamp":"2026-01-02T03:04:05.678Z","type":"event_msg","payload":{"type":"context_compacted"}}

event_msg / mcp_tool_call_end

Completed MCP tool call with invocation and result (legacy).

Written after an MCP tool call.

Stored only history_mode = legacy only

FieldTypeMeaning
call_idstring—
turn_idstring—
invocationobject{server, tool, arguments}
connector_idoptionalstring—
mcp_app_resource_urioptionalstring—
mcp_app_uioptionalobject{resourceUri, preferredModelDisplayMode}
link_idoptionalstring—
app_nameoptionalstring—
action_nameoptionalstring—
plugin_idoptionalstring—
read_only_hintoptionalboolean—
durationobjectRust Duration {secs, nanos}.
resultobjectRust Result: {"Ok": CallToolResult{content, structuredContent?, isError?, _meta?}} or {"Err": string}
{"timestamp":"2026-01-02T03:04:05.678Z","type":"event_msg","payload":{"type":"mcp_tool_call_end","call_id":"call_m","turn_id":"t1","invocation":{"server":"docs","tool":"search","arguments":{"q":"x"}},"duration":{"secs":1,"nanos":5000000},"result":{"Ok":{"content":[{"type":"text","text":"result"}]}}}}

event_msg / web_search_end

Completed web search with query and action (legacy).

Written after a web search.

Stored only history_mode = legacy only

FieldTypeMeaning
call_idstring—
querystring—
actionobjectResponses WebSearchAction (snake_case type).
resultsoptionalany[]—
{"timestamp":"2026-01-02T03:04:05.678Z","type":"event_msg","payload":{"type":"web_search_end","call_id":"ws_1","query":"rust serde","action":{"type":"search","query":"rust serde"}}}

event_msg / image_generation_end

Completed image generation (legacy).

Written after image generation.

Stored only history_mode = legacy only

FieldTypeMeaning
call_idstring—
statusstring—
revised_promptoptionalstring—
result | fileIdstringFlattened GeneratedImageRef: either result (inline base64) or fileId.
transparent_backgroundoptionalboolean—
failureoptionalobject{type:usageLimitExceeded, limitId, resetsAt}
saved_pathoptionalstring—
input_imagesoptionalarray[{path, sha256}]
generation_idoptionalstringOptional generation identity.
{"timestamp":"2026-01-02T03:04:05.678Z","type":"event_msg","payload":{"type":"image_generation_end","call_id":"ig_1","status":"completed","result":"iVBORw0KGgo=","saved_path":"/workspace/.codex/generated_images/thread/ig_1.png"}}

event_msg / sub_agent_activity

A sub-agent was started, interacted with, or interrupted (legacy).

Written on sub-agent lifecycle activity (kind=completed is stored as an item_completed SubAgentActivity instead).

Stored only history_mode = legacy and kind != completed

FieldTypeMeaning
modelstring | null—
reasoning_effortstring | null—
event_idstring—
occurred_at_msoptionalinteger—
agent_thread_idstring(uuid)Child thread id.
agent_pathstring—
kindenum(started|interacted|interrupted)—
{"timestamp":"2026-01-02T03:04:05.678Z","type":"event_msg","payload":{"type":"sub_agent_activity","model":null,"reasoning_effort":null,"event_id":"e1","occurred_at_ms":1767323050000,"agent_thread_id":"0199aaaa-0000-7000-8000-000000000002","agent_path":"/root/worker","kind":"started"}}

event_msg / item_completed / UserMessage

User input for the turn as the user entered it (no injected context).

Written when the item completes within a turn.

Stored only history_mode = paginated

FieldTypeMeaning
item.typestring"UserMessage"
item.idstring—
item.client_idoptionalstring—
item.contentUserInput[]text | image | local_image | audio | local_audio | skill | mention blocks (snake_case type).
{"timestamp":"2026-01-02T03:04:05.678Z","ordinal":7,"type":"event_msg","payload":{"type":"item_completed","thread_id":"0199aaaa-0000-7000-8000-000000000001","turn_id":"t1","item":{"type":"UserMessage","id":"u1","content":[{"type":"text","text":"Fix the failing test.","text_elements":[]}]},"started_at_ms":1767323049000,"completed_at_ms":1767323050000}}

event_msg / item_completed / AgentMessage

Assistant message as displayed.

Written when the item completes within a turn.

Stored only history_mode = paginated

FieldTypeMeaning
item.typestring"AgentMessage"
item.idstring—
item.contentarray[{type:"Text", text}] (PascalCase type).
item.phaseoptionalstring—
item.memory_citationoptionalobject—
item.deliveryoptionalenum(async)—
item.questionsoptionalarray—
item.moderationoptional{moderated, display?}Optional presentation instructions; display uses camelCase keys.
{"timestamp":"2026-01-02T03:04:05.678Z","ordinal":7,"type":"event_msg","payload":{"type":"item_completed","thread_id":"0199aaaa-0000-7000-8000-000000000001","turn_id":"t1","item":{"type":"AgentMessage","id":"msg_1","content":[{"type":"Text","text":"Done."}],"phase":"final_answer"},"started_at_ms":1767323049000,"completed_at_ms":1767323050000}}

event_msg / item_completed / Reasoning

Reasoning summary and raw text as displayed.

Written when the item completes within a turn.

Stored only history_mode = paginated

FieldTypeMeaning
item.typestring"Reasoning"
item.idstring—
item.summary_textstring[]—
item.raw_contentstring[]Default [].
{"timestamp":"2026-01-02T03:04:05.678Z","ordinal":7,"type":"event_msg","payload":{"type":"item_completed","thread_id":"0199aaaa-0000-7000-8000-000000000001","turn_id":"t1","item":{"type":"Reasoning","id":"rs_1","summary_text":["Inspecting the test."],"raw_content":[]},"started_at_ms":1767323049000,"completed_at_ms":1767323050000}}

event_msg / item_completed / Plan

Plan text produced in plan collaboration mode.

Written when the item completes within a turn.

Stored always (both history modes)

FieldTypeMeaning
item.typestring"Plan"
item.idstring—
item.textstring—
{"timestamp":"2026-01-02T03:04:05.678Z","ordinal":7,"type":"event_msg","payload":{"type":"item_completed","thread_id":"0199aaaa-0000-7000-8000-000000000001","turn_id":"t1","item":{"type":"Plan","id":"p1","text":"1. Reproduce\n2. Fix"},"started_at_ms":1767323049000,"completed_at_ms":1767323050000}}

event_msg / item_completed / CommandExecution

A shell command run, with output and exit code.

Written when the item completes within a turn.

Stored only history_mode = paginated

FieldTypeMeaning
item.typestring"CommandExecution"
item.idstringTool call id.
item.commandstring[]—
item.cwdstring(file URI)PathUri serialized as a URI string.
item.parsed_cmdarray[{type: read{cmd,name,path} | list_files{cmd,path} | search{cmd,query,path} | unknown{cmd}}]
item.sourceenum(agent|user_shell|unified_exec_startup|unified_exec_interaction)—
item.statusenum(in_progress|completed|failed|declined)—
item.aggregated_outputoptionalstringTruncated in the middle to 64 KiB with marker "... command output truncated for persistence ...".
item.exit_codeoptionalinteger—
item.durationoptionalobject{secs, nanos}
item.process_idoptionalstring—
item.interaction_inputoptionalstring—
item.plugin_idoptionalstring—
item.script_pathoptionalstring—
{"timestamp":"2026-01-02T03:04:05.678Z","ordinal":7,"type":"event_msg","payload":{"type":"item_completed","thread_id":"0199aaaa-0000-7000-8000-000000000001","turn_id":"t1","item":{"type":"CommandExecution","id":"call_abc","command":["/bin/zsh","-lc","ls"],"cwd":"file:///workspace/project","parsed_cmd":[{"type":"list_files","cmd":"ls","path":null}],"source":"agent","status":"completed","aggregated_output":"README.md\n","exit_code":0,"duration":{"secs":0,"nanos":120000000}},"started_at_ms":1767323049000,"completed_at_ms":1767323050000}}

Older files also carry stdout, stderr and formatted_output, which current builds ignore.

event_msg / item_completed / FileChange

Patch application result with per-file changes.

Written when the item completes within a turn.

Stored only history_mode = paginated

FieldTypeMeaning
item.typestring"FileChange"
item.idstring—
item.changesobject<path, FileChange>—
item.statusoptionalenum(completed|failed|declined)—
item.auto_approvedoptionalboolean—
item.stdoutoptionalstring—
item.stderroptionalstring—
{"timestamp":"2026-01-02T03:04:05.678Z","ordinal":7,"type":"event_msg","payload":{"type":"item_completed","thread_id":"0199aaaa-0000-7000-8000-000000000001","turn_id":"t1","item":{"type":"FileChange","id":"call_def","changes":{"/workspace/project/a.txt":{"type":"update","unified_diff":"@@ -1 +1 @@\n-a\n+b\n","move_path":null}},"status":"completed","stdout":"Success."},"started_at_ms":1767323049000,"completed_at_ms":1767323050000}}

event_msg / item_completed / McpToolCall

MCP tool invocation with result (camelCase fields).

Written when the item completes within a turn.

Stored only history_mode = paginated

FieldTypeMeaning
item.typestring"McpToolCall"
item.idstring—
item.serverstring—
item.toolstring—
item.argumentsany—
item.connectorIdoptionalstring—
item.mcpAppResourceUrioptionalstring—
item.mcpAppUioptionalobject—
item.linkIdoptionalstring—
item.appNameoptionalstring—
item.actionNameoptionalstring—
item.pluginIdoptionalstring—
item.readOnlyHintoptionalboolean—
item.statusenum(inProgress|completed|failed)—
item.resultoptionalobjectCallToolResult {content, structuredContent?, isError?, _meta?}, truncated to 64 KiB.
item.erroroptionalobject{message}
item.durationoptionalobject{secs, nanos}
{"timestamp":"2026-01-02T03:04:05.678Z","ordinal":7,"type":"event_msg","payload":{"type":"item_completed","thread_id":"0199aaaa-0000-7000-8000-000000000001","turn_id":"t1","item":{"type":"McpToolCall","id":"call_m","server":"docs","tool":"search","arguments":{"q":"x"},"status":"completed","result":{"content":[{"type":"text","text":"result"}]},"duration":{"secs":1,"nanos":0}},"started_at_ms":1767323049000,"completed_at_ms":1767323050000}}

event_msg / item_completed / DynamicToolCall

Client-implemented dynamic tool call with result.

Written when the item completes within a turn.

Stored only history_mode = paginated

FieldTypeMeaning
item.typestring"DynamicToolCall"
item.idstring—
item.namespaceoptionalstring—
item.toolstring—
item.argumentsany—
item.statusenum(in_progress|completed|failed)—
item.content_itemsoptionalarray[{type: inputText|inputImage|inputAudio, ...}] (camelCase)
item.successoptionalboolean—
item.erroroptionalstring—
item.durationoptionalobject—
{"timestamp":"2026-01-02T03:04:05.678Z","ordinal":7,"type":"event_msg","payload":{"type":"item_completed","thread_id":"0199aaaa-0000-7000-8000-000000000001","turn_id":"t1","item":{"type":"DynamicToolCall","id":"call_d","tool":"lookup","arguments":{},"status":"completed","content_items":[{"type":"inputText","text":"ok"}],"success":true},"started_at_ms":1767323049000,"completed_at_ms":1767323050000}}

event_msg / item_completed / FunctionCallOutput

Function tool output as a display item.

Written when the item completes within a turn.

Stored always (both history modes)

FieldTypeMeaning
item.typestring"FunctionCallOutput"
item.idstring—
item.namestring—
item.namespaceoptionalstring—
item.outputstring | arrayFunctionCallOutputBody.
{"timestamp":"2026-01-02T03:04:05.678Z","ordinal":7,"type":"event_msg","payload":{"type":"item_completed","thread_id":"0199aaaa-0000-7000-8000-000000000001","turn_id":"t1","item":{"type":"FunctionCallOutput","id":"call_abc","name":"example","output":"ok"},"started_at_ms":1767323049000,"completed_at_ms":1767323050000}}

event_msg / item_completed / CollabAgentToolCall

A multi-agent tool call (spawn, send, wait, close...) with target agents and states.

Written when the item completes within a turn.

Stored only history_mode = paginated

FieldTypeMeaning
item.typestring"CollabAgentToolCall"
item.idstring—
item.toolenum(spawn_agent|send_input|resume_agent|wait|close_agent|send_message|followup_task|interrupt_agent|list_agents)—
item.statusenum(in_progress|completed|failed|interrupted)—
item.sender_thread_idstring(uuid)—
item.receiver_thread_idsstring[]—
item.receiver_agentsarray[{thread_id, agent_nickname?, agent_role?}]
item.promptoptionalstring—
item.modeloptionalstring—
item.reasoning_effortoptionalstring—
item.agents_statesobject<thread_id, AgentStatus>AgentStatus: "pending_init"|"running"|"interrupted"|"shutdown"|"not_found"|{"completed":string|null}|{"errored":string}
{"timestamp":"2026-01-02T03:04:05.678Z","ordinal":7,"type":"event_msg","payload":{"type":"item_completed","thread_id":"0199aaaa-0000-7000-8000-000000000001","turn_id":"t1","item":{"type":"CollabAgentToolCall","id":"call_c","tool":"spawn_agent","status":"completed","sender_thread_id":"0199aaaa-0000-7000-8000-000000000001","receiver_thread_ids":["0199aaaa-0000-7000-8000-000000000002"],"receiver_agents":[],"agents_states":{}},"started_at_ms":1767323049000,"completed_at_ms":1767323050000}}

event_msg / item_completed / SubAgentActivity

Sub-agent lifecycle activity.

Written when the item completes within a turn.

Stored only paginated: all kinds; legacy: kind=completed only

FieldTypeMeaning
item.typestring"SubAgentActivity"
item.idstring—
item.kindenum(started|interacted|interrupted|completed)—
item.agent_thread_idstring(uuid)—
item.agent_pathstring—
item.modelstring | null—
item.reasoning_effortstring | null—
{"timestamp":"2026-01-02T03:04:05.678Z","ordinal":7,"type":"event_msg","payload":{"type":"item_completed","thread_id":"0199aaaa-0000-7000-8000-000000000001","turn_id":"t1","item":{"type":"SubAgentActivity","id":"a1","kind":"completed","agent_thread_id":"0199aaaa-0000-7000-8000-000000000002","agent_path":"/root/worker","model":null,"reasoning_effort":null},"started_at_ms":1767323049000,"completed_at_ms":1767323050000}}

event_msg / item_completed / WebSearch

Hosted web search display item.

Written when the item completes within a turn.

Stored only history_mode = paginated

FieldTypeMeaning
item.typestring"WebSearch"
item.idstring—
item.querystring—
item.actionobjectsnake_case WebSearchAction
item.resultsoptionalany[]—
{"timestamp":"2026-01-02T03:04:05.678Z","ordinal":7,"type":"event_msg","payload":{"type":"item_completed","thread_id":"0199aaaa-0000-7000-8000-000000000001","turn_id":"t1","item":{"type":"WebSearch","id":"ws_1","query":"rust serde","action":{"type":"search","query":"rust serde"}},"started_at_ms":1767323049000,"completed_at_ms":1767323050000}}

event_msg / item_completed / ImageView

The agent viewed a local image.

Written when the item completes within a turn.

Stored only history_mode = paginated

FieldTypeMeaning
item.typestring"ImageView"
item.idstring—
item.pathstring(file URI)—
{"timestamp":"2026-01-02T03:04:05.678Z","ordinal":7,"type":"event_msg","payload":{"type":"item_completed","thread_id":"0199aaaa-0000-7000-8000-000000000001","turn_id":"t1","item":{"type":"ImageView","id":"call_v","path":"file:///workspace/project/shot.png"},"started_at_ms":1767323049000,"completed_at_ms":1767323050000}}

event_msg / item_completed / ImageGeneration

Hosted image generation display item.

Written when the item completes within a turn.

Stored only history_mode = paginated

FieldTypeMeaning
item.typestring"ImageGeneration"
item.idstring—
item.statusstring—
item.revised_promptoptionalstring—
item.resultstringbase64
item.saved_pathoptionalstring—
{"timestamp":"2026-01-02T03:04:05.678Z","ordinal":7,"type":"event_msg","payload":{"type":"item_completed","thread_id":"0199aaaa-0000-7000-8000-000000000001","turn_id":"t1","item":{"type":"ImageGeneration","id":"ig_1","status":"completed","result":"iVBORw0KGgo="},"started_at_ms":1767323049000,"completed_at_ms":1767323050000}}

event_msg / item_completed / HookPrompt

Prompt fragments injected by hooks.

Written when the item completes within a turn.

Stored only history_mode = paginated

FieldTypeMeaning
item.typestring"HookPrompt"
item.idstring—
item.fragmentsarray[{text, hookRunId}]
{"timestamp":"2026-01-02T03:04:05.678Z","ordinal":7,"type":"event_msg","payload":{"type":"item_completed","thread_id":"0199aaaa-0000-7000-8000-000000000001","turn_id":"t1","item":{"type":"HookPrompt","id":"h1","fragments":[{"text":"Remember to run tests.","hookRunId":"hr1"}]},"started_at_ms":1767323049000,"completed_at_ms":1767323050000}}

event_msg / item_completed / EnteredReviewMode

Review mode started.

Written when the item completes within a turn.

Stored only history_mode = paginated

FieldTypeMeaning
item.typestring"EnteredReviewMode"
item.idstring—
item.targetobjectReviewTarget (camelCase type)
item.user_facing_hintstring—
{"timestamp":"2026-01-02T03:04:05.678Z","ordinal":7,"type":"event_msg","payload":{"type":"item_completed","thread_id":"0199aaaa-0000-7000-8000-000000000001","turn_id":"t1","item":{"type":"EnteredReviewMode","id":"r1","target":{"type":"uncommittedChanges"},"user_facing_hint":"current changes"},"started_at_ms":1767323049000,"completed_at_ms":1767323050000}}

event_msg / item_completed / ExitedReviewMode

Review finished with output.

Written when the item completes within a turn.

Stored only history_mode = paginated

FieldTypeMeaning
item.typestring"ExitedReviewMode"
item.idstring—
item.review_outputobject | null—
{"timestamp":"2026-01-02T03:04:05.678Z","ordinal":7,"type":"event_msg","payload":{"type":"item_completed","thread_id":"0199aaaa-0000-7000-8000-000000000001","turn_id":"t1","item":{"type":"ExitedReviewMode","id":"r1","review_output":null},"started_at_ms":1767323049000,"completed_at_ms":1767323050000}}

event_msg / item_completed / ContextCompaction

Display marker for a context compaction.

Written when the item completes within a turn.

Stored only history_mode = paginated

FieldTypeMeaning
item.typestring"ContextCompaction"
item.idstring—
{"timestamp":"2026-01-02T03:04:05.678Z","ordinal":7,"type":"event_msg","payload":{"type":"item_completed","thread_id":"0199aaaa-0000-7000-8000-000000000001","turn_id":"t1","item":{"type":"ContextCompaction","id":"0199aaaa-0000-7000-8000-000000000030"},"started_at_ms":1767323049000,"completed_at_ms":1767323050000}}

event_msg / item_completed / Extension / clock.sleep

The agent slept/waited.

Written when the item completes within a turn.

Stored always (both history modes)

FieldTypeMeaning
item.typestring"Extension"
item.kindstring"clock.sleep"
item.idstring—
item.durationMsinteger—
{"timestamp":"2026-01-02T03:04:05.678Z","ordinal":7,"type":"event_msg","payload":{"type":"item_completed","thread_id":"0199aaaa-0000-7000-8000-000000000001","turn_id":"t1","item":{"type":"Extension","kind":"clock.sleep","id":"s1","durationMs":30000},"started_at_ms":1767323049000,"completed_at_ms":1767323050000}}

event_msg / item_completed / Extension / image_gen.generation

Standalone image-generation extension item (camelCase).

Written when the item completes within a turn.

Stored only history_mode = paginated

FieldTypeMeaning
item.typestring"Extension"
item.kindstring"image_gen.generation"
item.idstring—
item.statusstring—
item.revisedPromptstring | null—
item.result | item.fileIdstringFlattened GeneratedImageRef.
item.transparentBackgroundoptionalboolean | null—
item.failureoptionalobject | null—
item.savedPathoptionalstring—
item.inputImagesoptionalarray[{path, sha256}]
item.generationIdoptionalstring|nullImage backend generation identity. imagegen_request_id is in-process analytics only and is explicitly excluded from serialization.
{"timestamp":"2026-01-02T03:04:05.678Z","ordinal":7,"type":"event_msg","payload":{"type":"item_completed","thread_id":"0199aaaa-0000-7000-8000-000000000001","turn_id":"t1","item":{"type":"Extension","kind":"image_gen.generation","id":"ig_2","status":"completed","revisedPrompt":"A blue square","result":"iVBORw0KGgo=","transparentBackground":null,"failure":null,"savedPath":"/workspace/.codex/generated_images/thread/ig_2.png"},"started_at_ms":1767323049000,"completed_at_ms":1767323050000}}

retained_context / accepted_file_audio

Host evidence that uploaded audio IDs were decoded for a model and provider; not a guarantee of future file availability.

FieldTypeMeaning
evidence{turn_id, model, provider, file_ids:string[]}Host-accepted file-audio identities.

retained_context / delivered_assistant_message

Assistant text confirmed delivered by a messaging tool, retained outside summarization; never user authorization.

FieldTypeMeaning
turn_idstringSource turn.
message_idstring|nullOriginal message identity.
textstringOriginal conversational text.
completebooleanFalse means incomplete evidence.
originoptionalUserInputOriginDefaults to user for historical checkpoints.
phaseoptionalMessagePhaseOriginal assistant phase, when available.
acceptance_orderintegerThread-local acceptance order.

Content blocks (24)

message.content / input_text

Text sent to the model (user, developer, injected context).

Written inside the parent record named in type.

FieldTypeMeaning
textstring—
{"type":"input_text","text":"Fix the failing test."}

message.content / input_image

Image sent to the model, inline (data URL) or by file id.

Written inside the parent record named in type.

FieldTypeMeaning
image_urloptionalstringData URL or URL (untagged with file_id).
file_idoptionalstring—
detailoptionalenum(auto|low|high|original)—
{"type":"input_image","image_url":"data:image/png;base64,iVBORw0KGgo=","detail":"high"}

message.content / input_audio

Inline or uploaded audio reference; file identity does not include the bytes.

Written inside the parent record named in type.

FieldTypeMeaning
audio_url | file_idstringFlattened AudioReference: inline URL/data URL or an uploaded audio file identity.
{"type":"input_audio","audio_url":"data:audio/wav;base64,UklGRg=="}

message.content / output_text

Assistant output text.

Written inside the parent record named in type.

FieldTypeMeaning
textstring—
annotationsoptionalany[]—
logprobsoptionalany[]—
{"type":"output_text","text":"Done."}

reasoning.summary / summary_text

Readable reasoning summary part.

Written inside the parent record named in type.

FieldTypeMeaning
textstring—
{"type":"summary_text","text":"Inspecting the test."}

reasoning.content / reasoning_text

Raw reasoning text part.

Written inside the parent record named in type.

FieldTypeMeaning
textstring—
{"type":"reasoning_text","text":"..."}

reasoning.content / text

Raw reasoning text part (alternate form).

Written inside the parent record named in type.

FieldTypeMeaning
textstring—
{"type":"text","text":"..."}

agent_message.content / input_text

Plain inter-agent message text.

Written inside the parent record named in type.

FieldTypeMeaning
textstring—
{"type":"input_text","text":"Run the linter."}

agent_message.content / encrypted_content

Encrypted inter-agent message.

Written inside the parent record named in type.

FieldTypeMeaning
encrypted_contentstring—
{"type":"encrypted_content","encrypted_content":"gAAAA..."}

tool output (string form)

function_call_output.output / custom_tool_call_output.output as a bare JSON string.

Written inside the parent record named in type.

"Process exited with code 0"

tool output / input_text

Text part of a structured tool output.

Written inside the parent record named in type.

FieldTypeMeaning
textstring—
{"type":"input_text","text":"ok"}

tool output / input_image

Image returned by a tool.

Written inside the parent record named in type.

FieldTypeMeaning
image_url | file_idstring—
detailoptionalstring—
{"type":"input_image","image_url":"data:image/png;base64,iVBORw0KGgo="}

tool output / input_audio

Inline or uploaded audio reference; file identity does not include the bytes.

Written inside the parent record named in type.

FieldTypeMeaning
audio_url | file_idstringFlattened AudioReference: inline URL/data URL or an uploaded audio file identity.
{"type":"input_audio","audio_url":"data:audio/wav;base64,UklGRg=="}

tool output / encrypted_content

Encrypted tool output part.

Written inside the parent record named in type.

FieldTypeMeaning
encrypted_contentstring—
{"type":"encrypted_content","encrypted_content":"gAAAA..."}

UserMessage.content / text

User text with UI element spans.

Written inside the parent record named in type.

FieldTypeMeaning
textstring—
text_elementsarray[{byte_range:{start,end}, placeholder}]
{"type":"text","text":"Fix it","text_elements":[]}

UserMessage.content / image

Image by URL/data URL or file id.

Written inside the parent record named in type.

FieldTypeMeaning
image_url | file_idstring—
detailoptionalstring—
{"type":"image","image_url":"data:image/png;base64,iVBORw0KGgo="}

UserMessage.content / local_image

Image attached from a local path (bytes not stored in this block).

Written inside the parent record named in type.

FieldTypeMeaning
pathstring—
detailoptionalstring—
{"type":"local_image","path":"/workspace/shot.png"}

UserMessage.content / audio

Inline or uploaded audio reference; file identity does not include the bytes.

Written inside the parent record named in type.

FieldTypeMeaning
audio_url | file_idstringFlattened AudioReference: inline URL/data URL or an uploaded audio file identity.
{"type":"audio","audio_url":"data:audio/wav;base64,UklGRg=="}

UserMessage.content / local_audio

Audio from a local path.

Written inside the parent record named in type.

FieldTypeMeaning
pathstring—
{"type":"local_audio","path":"/workspace/a.wav"}

UserMessage.content / skill

Explicitly selected skill.

Written inside the parent record named in type.

FieldTypeMeaning
namestring—
pathstring—
{"type":"skill","name":"example-skill","path":"/workspace/.codex/skills/example/SKILL.md"}

UserMessage.content / mention

@-mention of a resource.

Written inside the parent record named in type.

FieldTypeMeaning
namestring—
pathstring—
{"type":"mention","name":"README.md","path":"README.md"}

AgentMessage.content / Text

Display text of an AgentMessage item (PascalCase type).

Written inside the parent record named in type.

FieldTypeMeaning
textstring—
{"type":"Text","text":"Done."}

DynamicToolCall.content_items / inputText|inputImage|inputAudio

Dynamic tool output parts (camelCase type and fields).

Written inside the parent record named in type.

FieldTypeMeaning
text | imageUrl | audioUrlstring—
{"type":"inputText","text":"ok"}

McpToolCall.result.content / <MCP content block>

Opaque MCP content blocks (text, image, resource, ...), passed through as JSON.

Written inside the parent record named in type.

FieldTypeMeaning
typestringMCP block type
{"type":"text","text":"result"}

Rebuilding the conversation

ordering
Use file order. In paginated files ordinal increases by exactly 1 per line and is the canonical position (thread_history_1.sqlite keys on it); timestamps are millisecond write times and are not unique. A record whose line fails to parse should be skipped (Codex counts and skips it), not treated as end of file.
turns
A turn is bounded by event_msg task_started and task_complete or turn_aborted with the same turn_id. turn_context.turn_id, item_completed.turn_id, token_usage_record.turn_id and response_item internal_chat_message_metadata_passthrough.turn_id attach records to a turn; root_turn_id links turns caused by another (e.g. sub-agent work) back to the originating root turn. Older response items have no turn_id: assign them to the open task_started span.
message parent links
There are no parent pointers between messages; the conversation is the ordered sequence of response_item records (model view) or item_completed items (display view in paginated mode). Do not merge both views: in paginated files every user/assistant message appears twice (response_item message and item_completed UserMessage/AgentMessage).
tool call ↔ result
Pair function_call -> function_call_output, custom_tool_call -> custom_tool_call_output, tool_search_call -> tool_search_output, local_shell_call -> function_call_output by call_id. web_search_call and image_generation_call contain their own results. Display items (CommandExecution, FileChange, McpToolCall, DynamicToolCall, CollabAgentToolCall) use the tool call_id as item.id.
subagents
A child thread has its own rollout. Its session_meta has parent_thread_id and source {"subagent":{"thread_spawn":{parent_thread_id, depth, agent_path, agent_nickname, agent_role}}} (review/compact sub-agents use {"subagent":"review"} etc.). Records with ordinal < subagent_history_start_ordinal are inherited parent context, not the child's own work. In the parent, CollabAgentToolCall (receiver_thread_ids) and SubAgentActivity (agent_thread_id) point to children; state_5.sqlite thread_spawn_edges indexes the edges. session_id is the root thread id for the whole tree.
forks
forked_from_id names the source thread. Legacy: the parent's records are copied into the child file, possibly including the parent's session_meta lines (only the first session_meta is the file's own). Paginated: history_base {thread_id = source ROLLOUT id, end_ordinal_exclusive, end_byte_offset} points at an immutable prefix; resolve it recursively and prepend the source rollout's records with ordinal in [start, end_ordinal_exclusive), where start is 1 for a root file and base.end_ordinal_exclusive+1 for a file that itself has a history_base (skipping each file's own session_meta). At 0.169.0, attached_thread forks hide inherited parent context from history-page display while retaining it for model reconstruction. Respect the resolver mode and original fork bookmark after reverts.
compaction
A compacted record whose replacement_history is present is a complete new model history: discard earlier model-history items and continue from replacement_history plus later lines. Older compacted records without replacement_history require replaying earlier items and inserting the message summary. response_item compaction / context_compaction are opaque encrypted items that stand in for summarized history. item_completed ContextCompaction and legacy event_msg context_compacted are display markers only. Only the newest compaction bounds replay.
resume
Resume appends to the same rollout file (no new session_meta, ordinals continue from the last line). A compressed file is first decompressed to .jsonl and the .zst removed.
branches/rewind
event_msg thread_rolled_back {num_turns}: drop the last num_turns user turns (segments containing a real user message) from the reconstructed history; the dropped records remain in the file. thread/revert instead writes a new rollout file <thread-id>_<rollout-id> whose history_base points at the retained prefix; the old file is untouched and state_5.sqlite threads.rollout_path is the only pointer to the current one.
sidecar references
Thread names: last session_index.jsonl entry for the id (state_5 threads.name/title may also hold it). Current rollout path, archive state and titles: state_5.sqlite threads. Paginated page projection: thread_history_1.sqlite keyed by (thread_id, rollout_ordinal). Generated images: saved_path / savedPath. local_image blocks reference paths only; image bytes are present only in inline data URLs.
Assistant file citation directives (0.167.2 supplement)
Preserve raw assistant source. Parse :codex-file-citation{...} at the presentation boundary before GFM autolinking; require a nonempty path, respect literal Markdown regions and escaped markers, and retain unknown metadata. Treat HTTPS URLs separately from local paths. Do not model the directive as a transcript record.
retained evidence and response metadata
Preserve response_item envelope metadata (CodexHarnessMetadata): acceptance order, inherited provenance, retained sources and delivery completeness are distinct from model payload. Compaction resume_metadata can retain rejected_audio_file_ids; reconstruction also collects them from task_complete.error. Missing fields are unknown, not authorization or acceptance.

Token usage

token_usage_record.payload.usage
Tokens for exactly one Responses API response (response_id). Sum these for exact per-response accounting.
token_usage_record.payload.turn_token_usage / thread_token_usage
Running totals for the turn / the thread at that response; take the last value, do not sum.
event_msg token_count.payload.info.total_token_usage
Cumulative thread usage (same TokenUsage shape); last_token_usage is the latest response. info may be null; events can repeat. After a context-window overflow Codex can synthesize a filled total (total_tokens = model_context_window), which is not provider-reported usage.
TokenUsage.input_tokens
Prompt tokens including cached ones.
TokenUsage.cached_input_tokens
Subset of input_tokens served from cache (non-cached = input - cached).
TokenUsage.cache_write_input_tokens
Input tokens written to cache; defaults to 0 when absent (older records lack it).
TokenUsage.output_tokens
Completion tokens; reasoning_output_tokens is the reasoning portion of them.
TokenUsage.total_tokens
input_tokens + output_tokens as reported.
token_count.payload.info.model_context_window / task_started.model_context_window
Context window size in tokens for the model.
token_count.payload.rate_limits
Plan rate-limit snapshot (used_percent, window_minutes, resets_at, credits); not a cost. No monetary cost is recorded anywhere in the rollout.
token_count.payload.info.last_usage_includes_reasoning
Optional context-accounting signal; describes whether the last count includes retained reasoning. It is not an additional token counter.

Versions

There is no schema version field. Signals: session_meta.payload.history_mode (absent = legacy, "paginated" = ordinals present and a different event persistence policy); presence of envelope ordinal; session_meta.cli_version records only the build that created the thread and is preserved by the in-place legacy->paginated migration, so it does not identify the writer of later lines. Older shapes that Codex 0.169.0 still reads: task_started/task_complete accept turn_started/turn_complete aliases; response_item compaction accepts compaction_summary; agent_type -> agent_role; session_id backfilled from id; compacted.window_id may be a legacy integer; ghost_snapshot response items (removed feature) are stripped on read; content_item_metadata legacy harness_injected/source_tool_namespace forms are mapped; dynamic_tools legacy flat camelCase shape accepted; ItemCompleted.completed_at_ms defaults to 0; TurnContext fields such as user_instructions, personality, current_date, timezone, workspace_roots were dropped and are ignored. Current wire additions include dynamic_tools_updated, attached_thread/account_scoped, direct_only_tool_namespaces, file-backed audio, retained accepted_file_audio/delivered_assistant_message, requested_approvals_reviewer in settings, and moderation/display metadata. Introduction versions are not inferred from this endpoint comparison.

Parsing pitfalls

  • Paginated files (the default for current builds, and legacy files after the startup migration) persist BOTH the model view (response_item) and the display view (event_msg item_completed); counting both double-counts every message and tool call.
  • Legacy and paginated files persist different event_msg sets: user_message/agent_message/agent_reasoning/etc. exist only in legacy files; most item_completed variants exist only in paginated files.
  • TurnItem types are PascalCase ("UserMessage", "CommandExecution") and Extension items add a second discriminator kind ("web.search", "clock.sleep", "image_gen.generation"); everything else uses snake_case.
  • Field casing is mixed: McpToolCall items, extension items, thread_goal_updated, ReviewTarget and dynamic-tool content items are camelCase; the rest is snake_case.
  • Rollout directory and filename timestamps are local time; session_meta.timestamp and line timestamps are UTC.
  • function_call.arguments is a JSON-encoded string; tool_search_call.arguments is a JSON value.
  • Tool outputs are either a bare string or an array of content items; the success flag is never serialized.
  • Durations are Rust Duration objects {secs, nanos}; mcp_tool_call_end.result is a Rust Result {"Ok":...}|{"Err":...}.
  • role=user response_item messages include harness-injected context (AGENTS.md, environment_context, skills), not just what the human typed; use item_completed UserMessage (paginated) or event_msg user_message (legacy) for the human's input.
  • Reasoning is mostly encrypted_content; only summary[] (and occasionally content[]) is readable.
  • Unparseable lines occur mid-file; skip them and continue.
  • Legacy forks contain copied parent records including parent session_meta lines; only the first session_meta describes the file.
  • A thread can have several rollout files after revert; only state_5.sqlite threads.rollout_path identifies the current one. Paginated forks/reverts need history_base resolution to see the inherited prefix.
  • When local_thread_store_compression is explicitly enabled, files can be compressed to .jsonl.zst after 7 idle days and decompressed again on resume, so the same thread's path extension changes over time.
  • cli_version is the creating build, not the writer; migrated legacy rollouts look paginated while claiming old versions.
  • Large outputs: CommandExecution.aggregated_output and McpToolCall.result in paginated item_completed are truncated to 64 KiB, but the matching response_item output may be complete (or separately truncated by the model-history budget).
  • image_generation_call.result and inline input_image data URLs can be megabytes of base64 on a single line.
  • 2026-11-13 supplement, Codex rust-v0.167.2 at ce21072c90d32c40af7a55b60b2fb35c84a43a6a: assistant text can contain :codex-file-citation{path="…" purpose="source"}. This is inline message markup, not a new JSONL record or memory_citation field. The TUI assistant renderer interprets it; external transcript/App Server consumers need their own rendering. HTTPS paths are live-observed; the inspected TUI treats non-local paths as relative, so its destination logic is not a web-link contract. See docs/research/codex-file-citations.md and docs/research/evidence/codex-file-citations-2026-11-13.json. The original supplement did not refresh the full schema; the 2026-11-15 audit supplies the current local format pin.
  • Source audit 2026-11-15: version and commit identify inspected release source, not a passing runtime probe or a compatibility guarantee. Earlier source pins and observations are retained in the audit evidence manifest.
  • The full local persistence filter is recorded in the 2026-11-15 evidence manifest. It does not define Cloud or injected ThreadStore persistence.
  • Local malformed-line recovery does not establish integrity: unknown records must remain inspectable. Ordinal gaps caused by skipped records must be diagnosed rather than silently renumbered.
  • At 0.169.0 the local persistence filter explicitly drops transient approval requests, Guardian assessment/warning, raw streaming deltas and several lifecycle events. Persisted completions, retained answers and injected HookPrompt items can still contain related evidence. The evidence manifest inventories the exact excluded event variants; this is not a universal cross-host absence claim.
  • Use the canonical rollout envelope parser as implementation evidence: flattened serde decoding was replaced to preserve nested decimal JSON values. Public App Server schema generation does not generate this internal storage parser.
  • At 0.169.0 the opt-in terminal workspace can persist attached side chats; temporary chats remain ephemeral. The same /side UI action does not imply one storage policy across configurations.

Sources

Codex CLI