Integration · Codex CLI

rightmodeler + Codex CLI

Codex CLI already writes every session to disk as a rollout log. rightmodeler reads those files where they sit and proves, step by step, which calls a cheaper model could have handled.

Trace source · dedicated adapter

TL;DR

rightmodeler ingests Codex CLI rollout logs straight from ~/.codex/sessions with a dedicated adapter, no export step, because the JSONL files are already on your machine. Each successful step is replayed through cheaper candidates on OpenRouter and judged against the output you already accepted, so everyday Codex sessions become the evidence for which model each kind of step really needs.

How it works with Codex CLI

01 · Locate

Your sessions are already on disk

Codex CLI writes each session to ~/.codex/sessions/YYYY/MM/DD/rollout-*.jsonl as you work. There is nothing to export and nothing to instrument; choose one rollout, a day's folder, or the whole directory.

02 · Ingest

Autodetected, then normalized

The ingester recognizes a rollout by its {timestamp, type, payload} lines. It takes the model from turn_context, folds message payloads into LLM steps, and pairs every function_call with its function_call_output by call_id, so the flat log becomes one per-step schema.

03 · Replay + judge

Cheaper candidates, judged against what you accepted

Each successful single-shot step is re-run on cheaper OpenRouter candidates using the exact inputs from the rollout, and a cross-family judge scores every candidate against the answer Codex already gave, holding a 0.90 quality floor by default. Steps that called tools or looped are confirmed by executing real pipeline code end-to-end in a throwaway git worktree.

04 · Approve

A report, and the call stays yours

The report itemizes each proposed swap with evidence and confidence, and the interactive TUI steps you through approve, reject, or hold, one step at a time. Thin evidence means abstain, and high-risk families like auth and secrets are flagged, not swapped.

Setup

Install once, then hand the skill a rollout file or the whole sessions directory. Nothing connects to your OpenAI account; the audit runs on files Codex already wrote.

# install the rightmodeler skill

# list your most recent Codex rollouts

# inside Claude Code, point the skill at your sessions

What rightmodeler reads from Codex CLI

Every run is folded into one per-step schema, the same one the replay and the judge run on.

normalized schema ← Codex CLI
step kindpayload.type
modelturn_context.model
input messagespayload.content[]
tool callsfunction_call
tool resultsfunction_call_output (call_id)
token usageevent_msg.token_count.usage
success signalstatus / approval
cost baselinederived from model + usage via OpenRouter pricing

autodetected by: timestamp · type · payload.type

Use cases

Audit a month of coding sessions

Rollouts accumulate under one dated tree, so the audit can take a day, a week, or the whole directory in one pass, and show which step families genuinely earned the model they ran on, across everything you did.

Evidence before you change the default model

Instead of flipping your Codex model config and watching for regressions, replay the sessions you already ran and read the per-step verdicts first. The decision gets made on evidence from your own work, not a leaderboard.

Put a dollar figure on your rollouts

Codex logs token counts, not cost. The audit derives a per-step baseline from the logged model and usage via OpenRouter's pricing table, then shows which proven swaps would change it, an itemized bill for your agent coding.

The honest part

  • It reads rollout files from disk. It does not hook into Codex, watch live sessions, or change your Codex configuration; acting on the report stays your move.
  • Steps where Codex called tools (shell commands, patches, file edits) are not judged from the log alone. They are confirmed by re-running real pipeline code end-to-end, and when a session cannot be re-run that way, the audit abstains on those steps.
  • Rollouts do not record the set of tools Codex had available, so candidates are filtered on what each step actually did rather than the full declared tool surface.
  • Codex does not log dollar cost. The baseline is derived from the model and token counts via OpenRouter pricing: a sound estimate, but not your invoice.
  • It is a report, not a gateway. Nothing sits between Codex and its provider, and there is no rightmodeler server to see your sessions.

Frequently asked questions

Where does Codex CLI keep its session logs?

In ~/.codex/sessions/YYYY/MM/DD/rollout-*.jsonl, one JSONL file per session, written as you work. Hand the skill a single rollout, a day's folder, or the whole directory; the format is autodetected from the {timestamp, type, payload} line shape.

Do I need to export anything before running the audit?

No. Codex already writes its rollouts to local disk, so there is no dashboard to visit and no export API to call. The only key involved is your own OPENROUTER_API_KEY, used to run the replays.

Does rightmodeler change which model Codex uses?

No. It produces a per-step report and an approve/reject/hold TUI; updating your Codex configuration afterwards is your call. Nothing hooks into Codex or intercepts its traffic.

Does my session data leave my machine?

Only during replay, when step inputs go to candidate models through OpenRouter under your own key, the same class of call Codex made to produce the log in the first place. There is no rightmodeler server and no account.

Will it always find a cheaper model?

No, and that is the point. When the judge cannot establish equivalence, or a step touches auth, secrets, deploys, or similar, the audit abstains and the current model stays. A tool that always finds a swap is not measuring anything.

What about steps where Codex ran commands or edited files?

Those are tool steps, and they are never judged from the log alone. They are confirmed by re-running real pipeline code end-to-end in a throwaway git worktree with the candidate model injected; where that re-run is not possible, the audit abstains.

Run the audit on your own traces

The skill is free on GitHub. One command installs it; your Codex CLI traces do the rest.

View on GitHub