codex

package
v0.56.6 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2026 License: MIT Imports: 10 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 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

View Source
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

func Discover(repoRoots []string) []string

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

func Import(path string, fromOffset, maxBytes int64) ([]observe.Record, int64, error)

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.

Types

type Importer

type Importer struct{}

Importer is the zero-value observe.Adapter implementation — stateless, every method a pure function of its arguments.

func (Importer) Discover

func (Importer) Discover(repoRoots []string) []string

func (Importer) Import

func (Importer) Import(path string, fromOffset, maxBytes int64) ([]observe.Record, int64, error)

func (Importer) Source

func (Importer) Source() string

Jump to

Keyboard shortcuts

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