codex

package
v0.1.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 21, 2026 License: Apache-2.0 Imports: 5 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package codex adapts Codex CLI's rollout JSONL format (one JSON object per line under ~/.codex/sessions/YYYY/MM/DD/rollout-*.jsonl) into the shapes internal/ingest knows how to store.

Every line has the shape {timestamp, ordinal, type, payload}. Confirmed against two real files: one that failed on an auth error before doing any work, and one deliberately generated (with the user's permission, using their own authenticated `codex exec`) to capture a real tool call and assistant reply, since the first sample never got that far.

Two structural differences from Claude Code's format, both discovered from those real files:

  1. No per-line session id. A rollout file is one session (like Claude Code), but unlike Claude Code, individual lines don't repeat the session id — only the first `session_meta` line carries it. This adapter is therefore STATEFUL: it remembers the session id from session_meta and attaches it to every later line. Adapter values must not be reused across files (see internal/ingest.RunAll, which constructs a fresh one per file for exactly this reason).

  2. Framework-injected context (skills instructions, permission policy, plugin recommendations, an environment snapshot) rides in the SAME role=user / role=developer messages a genuine human prompt arrives in — there's no separate isMeta-style flag like Claude Code has. The one thing that does discriminate them is internal_chat_message_metadata_passthrough.content_item_kinds: a genuine human turn's block is tagged "user.text"; everything else seen ("host_skills.instructions", "plugins.recommendations", "environments.environment_context", "multi_agent.role_instructions", ...) is injected context. This matters beyond labeling — the shared chunker treats a new role=user/kind=text message as a turn boundary, so misclassifying injected context as a genuine turn would fragment chunks around framework noise instead of real turns.

custom_tool_call / custom_tool_call_output (not "function_call" — that was an assumption from general Responses-API knowledge that turned out wrong against the real file) are confirmed from the generated sample. `reasoning` items are NOT confirmed — this session used reasoning effort "none" and never produced one — so that parser is best-effort from public Responses API convention and degrades to Skip rather than guess wrong if the shape doesn't match.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Adapter

type Adapter struct {
	// contains filtered or unexported fields
}

Adapter is stateful: it must not be shared across files. Use New() to get a fresh one, or ingest.RunAll's per-file factory.

func New

func New() *Adapter

func (*Adapter) Agent

func (a *Adapter) Agent() string

func (*Adapter) ParseLine

func (a *Adapter) ParseLine(raw []byte) (ingest.ParseResult, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL