OpenAI Codex CLI hits the same wall Claude Code does: you're making real progress, then you hit a token or usage limit that feels disconnected from how much you actually typed. The cause is the same too — Codex is an agentic coding tool, and agentic tools spend most of their tokens on tool output, not on your messages.
Why Codex token usage adds up fast
Like any agent built on a stateless API, Codex resends the full conversation on every turn — there's no persistent memory between requests, so history has to travel with every new message. On top of that, Codex reads files, runs commands, and inspects output on your behalf, and all of that becomes part of the context it resends going forward. A single verbose build or test run early in a session keeps costing you tokens on every later turn, not just the turn it happened on.
An AGENTS.md (or equivalent project instructions file) adds to this the same way CLAUDE.mddoes for Claude Code — it's loaded on every request regardless of whether it's relevant to the current step, so a bloated one is a standing tax on your usage.
Fixes that work
Start fresh sessions per task
Don't let one Codex session sprawl across unrelated work. Starting a new session when you move to a new task keeps history from accumulating context you no longer need — the same principle as /clear in Claude Code.
Ask for targeted output, not full dumps
Request the specific function or section instead of a whole file. Prefer quiet or summary flags on commands over defaults that print everything. Avoid having the agent re-read files it's already seen this session unless they've changed.
Keep your instructions file lean
Trim your AGENTS.md the way you would any hot-path config: keep behavior-changing instructions, cut stale sections from finished work, and move long reference material somewhere the agent reads on demand rather than on every single turn.
Match model choice to task difficulty
Mechanical steps — boilerplate, straightforward edits, renames — don't need your most expensive model. Reserving the top-tier model for genuinely hard reasoning steps and using something cheaper for the rest stretches your usage further without giving up quality where it counts.
Compress tool output automatically
The manual habits above all target the same thing: tool output being the biggest driver of token spend. Doing it by hand on every command, every session, is easy to skip under deadline pressure. TokenPincher automates it — add it as an MCP server and it compresses large tool output and logs before they hit the model, lossless by default, so you get the benefit without having to remember to do anything by hand.
npx tokenpincher initThe full picture
These dynamics — full-history resend, tool-output bloat, bloated instruction files — apply across agentic coding tools, not just Codex. For the deepest version of this guide, written for Claude Code but applicable either way, see how to reduce Claude Code token usage, or check out the Codex overview.