Quick answer
Most Codex tokens go to context that is resent on every turn, not to the answer. Start a new session per task, pass file ranges instead of whole files, keep AGENTS.md short, use a smaller model for exploration, and ask for diffs rather than full files. Those five changes usually cut consumption more than any prompt trick.
The nine changes
- Start a new session when the task changes.
- Read a range of a file rather than the whole file.
- Trim AGENTS.md to rules the model cannot infer.
- Ask for a unified diff instead of a rewritten file.
- Use a smaller model for search and planning.
- Batch related edits into one request.
- Avoid pasting long logs; point at the file and the line.
- Disable tools the task does not need.
- Stop a loop when the same error repeats twice; restate the problem.
Why context dominates
A turn that adds 200 output tokens still resends the entire conversation. After twenty turns, the input is the cost. This is why session hygiene beats clever prompting.
| Change | Typical effect | Effort |
|---|---|---|
| New session per task | Large | Low |
| File ranges | Medium to large | Low |
| Shorter AGENTS.md | Medium | One-time |
| Diff-only output | Medium | Low |
| Smaller model for exploration | Medium | Low |
Measure before and after
Pick one repeated task, run it the old way, note tokens, then run it with the new session and file-range rules. Compare input tokens, not total. If input does not fall, the context is still carrying something you did not intend.
UsageAtlas records input, cached, and output separately so the comparison is visible rather than guessed.
The three changes that move the number most
- Start a new session per task. A long thread resends its whole history on every turn, so the same prompt costs more by turn twenty.
- Point at files and ranges instead of describing the repository. Instructions that list directories are resent every turn.
- Stop a run that repeats the same failing step. Retries are charged and rarely fix an ambiguous task.
These three changes usually beat switching models, because they reduce the input on every call rather than the price of one. Measure the effect with the token report before and after a week.
Questions, answered
Does clearing the context lose useful information?
Yes, which is why you should ask for a short summary first and paste it into the new session. That summary costs far less than replaying the whole thread.
Do shorter prompts reduce token usage?
Only slightly. Input context dominates. A one-line prompt in a 100k-token session still sends 100k tokens.
Does Codex cache reduce the cost of repeated context?
Yes. A stable prefix can be served from the prompt cache, which is cheaper than fresh input. Changing the prefix at the top of every turn reduces that benefit.