Expand description
OpenAI Codex CLI: ~/.codex/sessions/YYYY/MM/DD/rollout-<ts>-<id>.jsonl.
Format notes (verified on Codex CLI 0.149, 2026-09-03):
- The first line is
session_metawithpayload.cwd,payload.id,payload.cli_versionandpayload.originator. event_msg/token_countcarriesinfo.total_token_usage, which is cumulative for the session;infois null on rate-limit-only events.input_tokensincludescached_input_tokens.task_started/task_complete/turn_abortedbracket a turn.response_itemwithpayload.typefunction_callorcustom_tool_callis one tool call; the matching*_outputitem carries the samepayload.call_id, and the two lines’ timestamps bracket the call. That pairing is the trace.task_startedandtask_completebracket a turn span. An inference span runs from a usermessageitem or a*_outputitem to the next thing the model produced: a call, areasoningitem, aweb_search_call, or an assistantmessage.response_itemweb_search_callis one server-side web search.
Codex model prices are not in the static table, so cost is reported as unpriced tokens.
Structs§
- Codex
Adapter - The Codex adapter: a process is matched to the rollouts it holds open, and only where the platform cannot say to the cwd and activity heuristics. See DEC-006.
- Codex
Transcript
Functions§
- codex_
dir - read_
meta - Cheap header read: cwd and start time from the first line only.
- recent_
rollouts - Every rollout written since
since. - rollout_
id - The id in
rollout-2026-05-14T21-37-50-<id>: what follows the fixed-width timestamp. A file named some other way is matched on its whole stem. - rollouts_
open_ by - Rollout files modified after
since. WalksYYYY/MM/DDand prunes by directory mtime so the walk stays cheap on a long history. Rollouts the process has open: the app-server’s live threads, or the CLI’s one conversation.Nonewhen the platform cannot say. Filtered to the sessions directory so an unrelated file the process holds (a log, a config) is never mistaken for a thread, and mapped back under the un-canonicalised sessions directory so the paths compare equal to those fromrecent_rollouts. - sessions_
dir