First message in fresh session consumes ~100k input tokens immediatly, no matter how trivial the input

Resolved 💬 6 comments Opened Apr 19, 2026 by afolkest Closed Apr 24, 2026
💡 Likely answer: A maintainer (github-actions[bot], contributor) responded on this thread — see the highlighted reply below.

What version of Codex CLI is running?

0.121.0

What subscription do you have?

Pro

Which model were you using?

gpt-5.4 xhigh and gpt-5.3-codex-spark high

What platform is your computer?

Darwin 24.6.0 arm64 arm

What terminal emulator and version are you using (if applicable)?

iTerm2

What issue are you seeing?

Whenever I open a fresh Codex session and send a simple message, it consumes about 102k-105k tokens immediately.

What steps can reproduce the bug?

Input:
codex exec "Say hello world"

Output:

OpenAI Codex v0.121.0 (research preview)
--------
workdir: <redacted>
model: gpt-5.4
provider: openai
approval: never
sandbox: workspace-write [workdir, /tmp, $TMPDIR, /Users/<redacted>/.codex/memories]
reasoning effort: xhigh
reasoning summaries: none
session id: 019da3a1-d1d5-7a22-950b-3839f72b8e20
--------
user
Say hello world
codex
hello world
tokens used
105,156

<img width="1191" height="376" alt="Image" src="https://github.com/user-attachments/assets/5a2155b4-2d2a-4f46-b80e-2cde4b9c67cd" />

What is the expected behavior?

_No response_

Additional information

_No response_

View original on GitHub ↗

6 Comments

github-actions[bot] contributor · 3 months ago

Potential duplicates detected. Please review them and close your issue if it is a duplicate.

  • #18498
  • #17496
  • #18345

Powered by Codex Action

etraut-openai contributor · 3 months ago

You must have a very large AGENTS.md or a large number of MCPs. You should look at the rollout file (you can ask codex to find it for you under ~/.codex/sessions).

When I try to repro the problem (with relatively few MCPs and a minimal AGENTS.md file), I see a value of about 22K tokens usage for the first prompt.

afolkest · 3 months ago

I reproduced this issue in a freshly initialized empty repo with no AGENTS.md and with my MCPs removed from Codex.
I went ahead and downgraded Codex to 0.115 and the problem is gone. Looking at the rollout file I see nothing corresponding to 100k tokens.

The issue showed up immediately after upgrade to 0.121 with no other changes in my setup.

quark-zju · 3 months ago

Could it be the "memories" feature? I noticed that after enabling "memories", codex tries to summarize past sessions into memories, which consumed a lot of tokens. The raw_memories.md is also 3.4k+ lines, which seems to be too long to be injected in context. I have to disable the memories feature entirely.

etraut-openai contributor · 2 months ago

@afolkest, are you still seeing this with the latest version of the CLI? We did discover a regression that made it in to 0.121 that could have explained what you were seeing. We fixed it shortly after, and the fix was in 0.122.0 and all subsequent versions.

afolkest · 2 months ago

@etraut-openai It appears to be fixed now! Many thanks for getting back to me.