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.
Supported surfaces
Section titled “Supported surfaces”- Codex CLI is the primary surface.
- Codex Desktop loads the same
~/.codex/hooks.jsonand behaves identically.
Install from the Codex (CLI) or Codex (Desktop) page. The full capability grid is at /reference/capability-matrix/.
Runtime prefix
Section titled “Runtime prefix”Every Token Optimizer command on Codex carries the runtime prefix:
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.
How Codex maps to Claude Code
Section titled “How Codex maps to Claude Code”Codex uses different config and memory conventions, and the adapter follows them.
| Concept | Claude Code | Codex |
|---|---|---|
| Config file | CLAUDE.md | AGENTS.md |
| Memory system | MEMORY.md plus project memory dirs | ~/.codex/memories/**/*.md |
| Model routing advice | Opus, Sonnet, Haiku per agent | Intelligence levels plus GPT-5.x model selection |
| Hook install | Auto on plugin install, 11 events | codex-install command, global by default, 4 profiles, 1 to 6 events before optional flags |
| Compact lifecycle | PreCompact and PostCompact capture and restore | Compact-prompt guidance plus Stop checkpoints |
| Tool result archive | PostToolUse archives immediately | Stop-time backfill from JSONL, plus Bash PostToolUse on telemetry/aggressive profiles |
| Dashboard refresh | SessionEnd hook plus daemon at 24842 | Stop 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.
Hook profiles
Section titled “Hook profiles”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.
| Profile | Events installed | Behavior |
|---|---|---|
aggressive (default) | SessionStart, UserPromptSubmit, SubagentStart, SubagentStop, PostToolUse (Bash), Stop | Silent by default, 6 events |
balanced | SessionStart, UserPromptSubmit, SubagentStart, SubagentStop, Stop | 5 events |
quiet | Stop | 1 event |
telemetry | PostToolUse (Bash), Stop | Silent bookkeeping, 2 events |
TOKEN_OPTIMIZER_RUNTIME=codex python3 skills/token-optimizer/scripts/measure.py codex-install --profile quietWhat works
Section titled “What works”| Capability | Status on Codex |
|---|---|
| Quality scoring (7 signals, dual composite, GPT-5.x curves) | Yes |
| S/A/B/C/D/F grades | Yes |
| Session continuity and checkpoints | Yes |
| Dashboard (port 24843) and bookmarkable daemon | Yes |
| 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 nudge | Yes |
| Per-prompt quality steering (via UserPromptSubmit) | Yes |
What is approximated
Section titled “What is approximated”| Feature | Behavior on Codex | Upstream cause |
|---|---|---|
| Smart Compaction | Approximated through compact-prompt guidance plus Stop checkpoints | No PreCompact or PostCompact hook in Codex |
| Crash recovery | Approximated with Stop plus the compact prompt | No StopFailure hook in Codex |
| Bash output compression | Experimental opt-in only | Command rewriting requires explicit --enable-bash-compression; host must honor updatedInput |
| Cache-write TTL breakdown | Cached input shown, no 1h or 5m split | Codex logs do not expose cache-write TTL fields |
| Skill usage telemetry | Partial, from limited log signals | Codex logs do not expose every skill invocation event |
What is unavailable
Section titled “What is unavailable”| Feature | Upstream cause |
|---|---|
| Delta read substitution | Codex PreToolUse Read hook does not support updatedInput |
| Structure-map substitution | Same updatedInput gap |
| Keep-Warm automation | See below |
Doctor command
Section titled “Doctor command”TOKEN_OPTIMIZER_RUNTIME=codex python3 skills/token-optimizer/scripts/measure.py codex-doctor --project "$PWD"A healthy install reports 0 FAIL.
Dashboard
Section titled “Dashboard”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.
TOKEN_OPTIMIZER_RUNTIME=codex python3 skills/token-optimizer/scripts/measure.py setup-daemonFor LAN access, set TOKEN_OPTIMIZER_DASHBOARD_HOST=0.0.0.0 before setup-daemon. The setting is sticky and independent per runtime.
Model pricing
Section titled “Model pricing”Token Optimizer tracks these Codex model prices for cost figures.
| Model | Input ($/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.
Auto-update
Section titled “Auto-update”Codex auto-upgrades Git-backed marketplaces on startup with git ls-remote. Force an upgrade with codex plugin marketplace upgrade.
