Echo
Back

Run the Numbers: How Many of the Tokens Your Agent Burns Are Pure Waste

Research noteAgent Doctorkkw-21Updated atGitHub

Most of the tokens you burn in Codex and Claude Code aren't doing any work. ✦ Echo Agent Doctor puts an exact number on it: which tokens are pushing the task forward, which are noise, and where the money went. Free, runs locally, and your data never leaves your machine. Paste this into your terminal and see your numbers:

Terminal
npm i -g @echomem/mcp@latest && echomem-mcp init

What You'll See

First, the totals: how many tokens your workspace burned over the period, how many turned into output, how many were waste, with the waste converted straight into API dollars.

Then, the diagnosis: where the noise comes from. This isn't a guess. We've torn down real sessions line by line, and the same three patterns keep showing up.

Agent Doctor workspace report example showing token waste, repeated reads, and repo-level session summary.
Erik's sample workspace. Green is Open Codex, red is Claude Code, showing how the report splits time and tokens across agents.
problem #1

Screenshots that never leave

The model keeps every screenshot: the ones you paste, and the ones it generates itself during development. Most screenshots stop being useful two turns later, but they get carried all the way to the end of the session. Each one runs about 4,000 tokens. We found one that sat in the window for 49 turns, survived 5 compactions, and was never referenced once.

problem #2

Multiple versions of the same file, stacked

Every patch leaves the old version behind. To do its next piece of work, the model has to figure out which of several conflicting copies of the code is current. Those stale versions are pure noise and the single largest waste source in our sample: 2.31M tokens in one session.

problem #3

It already read the file. It searches again anyway.

Once the window gets polluted enough, the model starts losing track of what it already has, so it searches again and reads again. The irrelevant files that come back sit in the window and dilute the intent of the next step. Noise breeds more noise.

These three patterns typically account for most of the context noise. Odds are they're in your window too. So how do we see them?

The Local Scan

Codex stores every conversation verbatim on your machine. Every instruction you type, every function_call, every token_count lives in a local database. You can check the two paths yourself:

  • ~/.codex/sessions

    The JSONL event stream. Your instructions, tool calls, message flow, and the execution record of every session.

  • ~/.codex/logs_2.sqlite

    The raw request ledger. The complete payload actually sent to the model on every call; the token counts here are the billing numbers.

Claude Code does the same thing in ~/.claude/projects. These files aren't caches; they're the original ledger. They belong to you. You've just never opened them.

Tearing Down the Payload, Frame by Frame

Every step the agent thinks through is one model call, and the payload that goes out with each call is one frame. A 70-turn session is a few hundred frames.

Agent Doctor spreads each frame open and files every item inside it: what it is (a file read / a search / a screenshot / command output), which turn it entered, how many tokens it occupies, and whether it was ever referenced again or superseded by a newer version.

Here's a real frame, turn 74:

  • Payload total: 228,649 tokens
  • New content (your instruction this turn, plus newly read material): 9,129 tokens, under 4%
  • Replayed history: 219,520 tokens: old file reads, old command output, old search results, four compaction bundles

Classify that history line by line:

  • Old screenshots: 17.2%
  • Old command output: 24.3%
  • Stale file reads: 15.1%
  • File reads still alive: just 6.4%

Filed at this granularity, every token's origin is known. Origin isn't a verdict, though: the same file read might be dead weight, or it might be exactly what this turn's commit was built on. So how do we split signal from noise?

Signal = Every Token That Contributed to the Commit

The yardstick is the diff that actually landed in your git history. Agent Doctor checks whether an item ever entered the working chain: did it support a file edit, explain the final diff, or get referenced by a later step? If read → edit → commit connects, that's healthy discovery. It counts as signal.

Re-fetching something you already had, and that hasn't changed, counts as noise. Old screenshots, old command output, superseded file versions, search results that stopped being relevant: if it didn't contribute to this turn's commit, it doesn't count as working context.

Every unit of noise lands on a specific item. A token is counted once, and anything we can't attribute with confidence is left blank, honestly. In the report, every line item opens to its original content.

The Results Were Worse Than We Expected

Of all tokens, 99.7% went to input. Output was 0.3%.

Total input10.9Mtokens
Effective tokens3.02Mactually working toward the commit
SNR27.7%worst turn: 10%

This was a 70-turn web-edit session. It wasted 7.88 million tokens, and the root causes were exactly the three patterns above.

Every one of those tokens was billed, occupied the model's attention, and cost time to re-read. Their contribution to output was zero, sometimes negative. If your agent feels slower, pricier, and dumber, it's mostly carrying this noise.

Your Turn

Free. Local. One line:

Terminal
npm i -g @echomem/mcp@latest && echomem-mcp init

Run it, share the report with your friends, and push those SNRs up together. 🚀