Skip to content

Codex

Codex runs the Token Optimizer engine through its own hook API. Quality scoring, cost tracking, the dashboard, and session continuity all work. A few Claude Code features are approximated or unavailable because the Codex hook API exposes less than Claude Code’s, and each gap is named below with its upstream cause.

Codex CLI and Codex Desktop share one adapter. There is no separate Desktop install. The aggressive default includes silent Bash PostToolUse bookkeeping; telemetry installs only that bookkeeping and Stop. Neither profile promises visible Desktop rows.

  • Codex CLI is the primary surface.
  • Codex Desktop loads the same ~/.codex/hooks.json and behaves identically.

Install from the Codex (CLI) or Codex (Desktop) page. The full capability grid is at /reference/capability-matrix/.

Every Token Optimizer command on Codex carries the runtime prefix:

Terminal window
TOKEN_OPTIMIZER_RUNTIME=codex python3 skills/token-optimizer/scripts/measure.py <command>

This selects the Codex adapter, the Codex dashboard port, and Codex pricing. Omitting it falls back to the Claude Code defaults.

Codex uses different config and memory conventions, and the adapter follows them.

ConceptClaude CodeCodex
Config fileCLAUDE.mdAGENTS.md
Memory systemMEMORY.md plus project memory dirs~/.codex/memories/**/*.md
Model routing adviceOpus, Sonnet, Haiku per agentIntelligence levels plus GPT-5.x model selection
Hook installAuto on plugin install, 11 eventscodex-install command, global by default, 4 profiles, 1 to 6 events before optional flags
Compact lifecyclePreCompact and PostCompact capture and restoreCompact-prompt guidance plus Stop checkpoints
Tool result archivePostToolUse archives immediatelyStop-time backfill from JSONL, plus Bash PostToolUse on telemetry/aggressive profiles
Dashboard refreshSessionEnd hook plus daemon at 24842Stop hook plus daemon at 24843

The Token Coach reads AGENTS.md and the Codex memory directories, and its routing advice speaks in GPT-5.x intelligence levels and model choices rather than the Claude model tiers.

Codex hooks install through codex-install. The default is aggressive; profiles select event coverage, not visible Desktop noise. Compact-prompt guidance is installed separately on every profile unless you pass --skip-compact-prompt.

Bash command rewriting remains off on every profile. Add --enable-bash-compression to install a Bash PreToolUse hook; it uses updatedInput and is inert on builds that ignore that field. --enable-prompt-hooks, --enable-hot-path-hooks, and --enable-subagent-hooks add coverage to a smaller profile; --no-subagent-hooks omits subagent hooks even on balanced/aggressive.

ProfileEvents installedBehavior
aggressive (default)SessionStart, UserPromptSubmit, SubagentStart, SubagentStop, PostToolUse (Bash), StopSilent by default, 6 events
balancedSessionStart, UserPromptSubmit, SubagentStart, SubagentStop, Stop5 events
quietStop1 event
telemetryPostToolUse (Bash), StopSilent bookkeeping, 2 events
Terminal window
TOKEN_OPTIMIZER_RUNTIME=codex python3 skills/token-optimizer/scripts/measure.py codex-install --profile quiet
CapabilityStatus on Codex
Quality scoring (7 signals, dual composite, GPT-5.x curves)Yes
S/A/B/C/D/F gradesYes
Session continuity and checkpointsYes
Dashboard (port 24843) and bookmarkable daemonYes
Cost tracking (GPT-5.x pricing)Yes
Fleet Auditor (cross-system, includes Codex sessions)Yes
Token Coach (adapted for AGENTS.md)Yes
Memory and config audit (AGENTS.md plus memories)Yes
Proactive context nudgeYes
Per-prompt quality steering (via UserPromptSubmit)Yes
FeatureBehavior on CodexUpstream cause
Smart CompactionApproximated through compact-prompt guidance plus Stop checkpointsNo PreCompact or PostCompact hook in Codex
Crash recoveryApproximated with Stop plus the compact promptNo StopFailure hook in Codex
Bash output compressionExperimental opt-in onlyCommand rewriting requires explicit --enable-bash-compression; host must honor updatedInput
Cache-write TTL breakdownCached input shown, no 1h or 5m splitCodex logs do not expose cache-write TTL fields
Skill usage telemetryPartial, from limited log signalsCodex logs do not expose every skill invocation event
FeatureUpstream cause
Delta read substitutionCodex PreToolUse Read hook does not support updatedInput
Structure-map substitutionSame updatedInput gap
Keep-Warm automationSee below
Terminal window
TOKEN_OPTIMIZER_RUNTIME=codex python3 skills/token-optimizer/scripts/measure.py codex-doctor --project "$PWD"

A healthy install reports 0 FAIL.

The Codex dashboard serves at http://localhost:24843/token-optimizer. The Claude Code dashboard on 24842 can run at the same time without conflict. The file fallback lives at ~/.codex/_backups/token-optimizer/dashboard.html.

Terminal window
TOKEN_OPTIMIZER_RUNTIME=codex python3 skills/token-optimizer/scripts/measure.py setup-daemon

For LAN access, set TOKEN_OPTIMIZER_DASHBOARD_HOST=0.0.0.0 before setup-daemon. The setting is sticky and independent per runtime.

Token Optimizer tracks these Codex model prices for cost figures.

ModelInput ($/1M)Cached ($/1M)Output ($/1M)
GPT-5.6 Sol (promotion before 2026-11-21 UTC)$4.00$0.40$20.00
GPT-5.6 Sol (standard from 2026-11-21 UTC)$5.00$0.50$30.00
GPT-5.6 Terra$2.00$0.20$12.00
GPT-5.6 Luna$0.20$0.02$1.20
GPT-5.5$5.00$0.50$30.00
GPT-5.4$2.50$0.25$15.00
GPT-5.4-Mini$0.75$0.075$4.50
GPT-5.3-Codex$1.75$0.175$14.00
GPT-5.2$1.75$0.175$14.00

These are shipped engine API-equivalent estimates, not ChatGPT subscription credits or plan limits. Bundled price cards can update the table; Sol has a date-gated promotion. The engine applies long-context cards per request above 272K prompt tokens where a card exists, rather than pricing a whole session at that rate.

Codex auto-upgrades Git-backed marketplaces on startup with git ls-remote. Force an upgrade with codex plugin marketplace upgrade.