convert

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Overview

Package convert converts Codex CLI rollouts into the Agent Session Format. docs/formats/codex.md is the mapping and lists every finding code it reports.

Index

Constants

View Source
const Harness = "codex"

Harness is the harness name converted sessions record.

View Source
const Source = "codex"

Source is the format name and the namespace of every extension member and custom entry this converter writes.

Variables

This section is empty.

Functions

func Convert

func Convert(f *codex.File, opts Options) (*agentimport.Result, error)

Convert converts a rollout into a session and, with an index, each sub-agent it spawned that the index holds into one of its own, at any depth: the main session first, every other after its parent's. One report covers them all; a sub-agent's findings name its file. Only the main rollout's failure fails the conversion: a sub-agent that cannot be read or converted is a finding, and its own sub-agents are converted still.

func ConvertFile

func ConvertFile(path string, opts Options) (*agentimport.Result, error)

ConvertFile reads the rollout at path and converts it, with the sub-agents it spawned that the tree holding it has: the sessions tree when Codex filed it there, sessions/YYYY/MM/DD/, else its own directory (see codex.SessionsRoot). An index that cannot be built, or that left rollouts out, is reported.

func IndexFindings

func IndexFindings(x *codex.Index) []agentimport.Finding

IndexFindings reports what an index left out: each rollout whose session meta could not be read and each directory that could not be walked. A sub-agent among them is not converted with its parent.

Types

type Options

type Options struct {
	// Slim drops what the model never saw and the session format has
	// no member for, rather than keeping it in namespaced members: item
	// and line members the conversion does not map, harness metadata,
	// rate limits, the session meta's other members. Each drop is still
	// reported. Custom entries, the format's own place for records it
	// does not define, are kept.
	Slim bool
	// Derive writes the entries the module's derivation rules infer
	// from the converted path, each marked agentimport:derived: a shell
	// call's published refs (docs/plans/agentimport.md).
	Derive bool
	// Index finds the rollouts of the threads a thread spawned, which
	// are converted with it, each its own session after its parent's.
	// ConvertFile indexes the tree the rollout is in when it is nil
	// (codex.IndexFor); Convert converts the one rollout. A family's
	// sessions are all held in the result, so a thread with hundreds of
	// sub-agents holds hundreds of sessions at once.
	Index *codex.Index
	// Alone converts the rollout without its sub-agents, whatever Index
	// holds, and ConvertFile indexes nothing.
	Alone bool
}

Options tune a conversion. The zero value keeps everything.

Jump to

Keyboard shortcuts

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