Documentation
¶
Overview ¶
Package codexcli implements the Codex model adapter via `codex exec --output-schema`. Prompts are piped via stdin per ADR 0007.
Index ¶
- Constants
- type Adapter
- func (a *Adapter) Name() string
- func (a *Adapter) Preflight(_ context.Context) error
- func (a *Adapter) Review(ctx context.Context, input *review.ReviewInput) (*review.ModelReviewResult, error)
- func (a *Adapter) SetInputBudget(bytes int)
- func (a *Adapter) Synthesize(ctx context.Context, input *review.ReviewInput, ...) (*review.ModelReviewResult, error)
Constants ¶
const DefaultInputBudgetBytes = 1024 * 1024
DefaultInputBudgetBytes caps the prompt size sent to codex. Originally calibrated by spike S9 at 256 KiB against 26 real public PRs; raised to 1 MiB (diffsmith-uc1) so realistic medium PRs — including ones the GitHub files-API fallback (diffsmith-5n4) makes reachable — fit without an explicit --input-budget override. Codex/Claude/Antigravity all advertise 200K+ token context windows (~600KB-3MB of text); 1 MiB sits comfortably below the tightest of those while leaving real PRs reviewable. Users can still tighten via --input-budget when hitting quota or quality cliffs. See docs/model-adapters.md § Diff Size and Context Budget for the rationale; spikes/s9-input-budget/ main.go is the measurement tool — re-run when models change or the prompt scaffold grows.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Adapter ¶
type Adapter struct {
// contains filtered or unexported fields
}
Adapter implements the model.Model interface against the Codex CLI.
func New ¶
New constructs an Adapter. Passing nil uses provider.DefaultRunner; lookPath defaults to exec.LookPath. Tests override fields directly (the package is internal-only).
func (*Adapter) Name ¶
Name returns the model identifier surfaced to users via --model and attached to validated findings.
func (*Adapter) Preflight ¶
Preflight verifies the codex binary is on PATH. The model is never invoked when this fails; the user sees an actionable install hint instead of a stack trace from os/exec.
func (*Adapter) Review ¶
func (a *Adapter) Review(ctx context.Context, input *review.ReviewInput) (*review.ModelReviewResult, error)
Review invokes codex with an --output-schema path. Stdin piping, schema temp-file writing, and output parsing are added by subsequent TDD cycles as their tests drive them.
func (*Adapter) SetInputBudget ¶ added in v0.1.7
SetInputBudget overrides the default prompt-size cap for this adapter. Values <= 0 are ignored so a missing/zeroed --input-budget flag can't silently disable enforcement and let an arbitrarily large prompt slip through.
func (*Adapter) Synthesize ¶
func (a *Adapter) Synthesize(ctx context.Context, input *review.ReviewInput, results []*review.ModelReviewResult) (*review.ModelReviewResult, error)
Synthesize runs codex against the synthesis prompt that combines the diff with N other reviewers' findings. Output is parsed and validated identically to Review.