Documentation
¶
Overview ¶
Package codex is an observe.Adapter over Codex's own local session transcripts (~/.codex/sessions/YYYY/MM/DD/rollout-*.jsonl — or $CODEX_HOME/sessions if that's set, the officially documented override: developers.openai.com/codex/config-reference). The format is NOT versioned or documented for third-party readers; everything this file assumes was confirmed against a live sample at implementation time (see the field comments below), including the session's recorded cwd field used for repo-root filtering. Parsing is defensive by construction — a line, or a line's shape, this package doesn't recognize is skipped, never fatal; if a future format change moves/renames the cwd field, cwd filtering degrades to "found nothing" (Discover returns no files), never a crash.
Deliberately narrow in what it extracts — same reasoning as package claudecode's doc comment (cost: no raw transcript text ever reaches disk; fidelity to memcode's own "meaningful action" doctrine). Confirmed against a live sample: Codex's own file-edit tool calls all go through a shell invocation (exec_command) rather than a structured full-new-content field, so — unlike Claude Code's Write — there is no FileClaim this importer can recover without replaying a diff against the live filesystem, which an importer must never do. Only a human's own ask and a real `git commit`/`push` become a Record.
Index ¶
Constants ¶
const Source = "codex"
Source is this adapter's provenance tag (focus.Turn.Source and the .memcode/observe/<source>/ directory name).
Variables ¶
This section is empty.
Functions ¶
func Discover ¶
Discover locates every Codex rollout whose session cwd matches one of repoRoots (the project(s) under this workspace), modified within the last maxAge. Rollouts are laid out by calendar date (sessions/YYYY/MM/DD/), so only the last maxAge's worth of day directories are even listed — never a walk over the user's entire Codex history.
func Import ¶
Import parses the new lines appended to path since fromOffset (via observe.ReadNewLines, which bounds how much is read and guarantees a line is never split across two calls), up to maxBytes of new content, and returns the Records extracted plus the offset to resume from next time. A line that fails to parse, or whose shape isn't one this importer recognizes, is skipped — never fatal to the rest of the file.