Your coding agent is burning context you will never get back

· Empirical ·

4 min read Original article ↗

Static instruction files load into every turn whether they are relevant or not. Switching to on-demand memory retrieval gives the same 5-hour window 22-45% more range.

Dark fuel gauge with needle near empty and a red warning light, representing a coding session context window running out before the task is done

Imagine driving a packed car. Every stop, more bags get thrown in the back. The car gets heavier, the mileage drops, and you're pulling into the gas station earlier each time. Not because anything broke, just because you're carrying more than you need.

Coding agents work the same way. Your context window is the tank. Static instruction files (AGENTS.md, CLAUDE.md, skill READMEs) ride along for every turn whether the current task needs them or not. Always loaded. Almost never fully relevant.

The problem with static context

Here is what one real project loads before a single line of code gets written:

LayerTokens
Copilot system prompt + tools~10,249
AGENTS.md~857
CLAUDE.md (root)~6,554
CLAUDE.md (subdirectory)~5,521
5 skill instruction READMEs~2,472
Static files subtotal~16,400
Total turn 1 context~26,649 of 128k

That 16,400 tokens of static context is 61% of your Turn 1 payload, carried on every turn that follows.

4.2k

Average AGENTS.md size, in tokens, across the repos we sampled

38×

Median turns per coding agent session in our telemetry

$1,920

Annualized cost of that file alone, per heavy user, at current Anthropic rates

The experiment

Keep only guardrails in AGENTS.md (~200 tokens). At the start of each task, fire one Empirical query that pulls the 3-4 most relevant memories (~365 tokens). That is the whole change.

Across 10 real production tasks (lead scoring, mailer templates, enrichment pipelines, billing) that single change averaged 59% fewer tokens per turn.

The results

I scanned CompactionProcessor readings from 1,978 real Copilot CLI sessions. Every session logs how much of the 128k window it consumed at startup. Two clusters fell out:

  • Lean sessions (on-demand context): ~26,424 tokens at session start
  • Heavy sessions (full CLAUDE.md + skills loaded): up to 48,625 tokens

Same project. Same 128k window. One engineer hauling a loaded trunk, one traveling light.

ComparisonTokens savedReduction
Same-day lean vs partial migration7,86022.9%
Lean vs peak heavy sessions22,20145.7%

That gap is not a projection. It is the actual difference between two engineers on the same codebase, same day, same window.

The agent isn't smarter when it has more context. It's smarter when it has the right context.

Why it matters

  • Codex: More messages inside the rolling 5-hour window before you hit the cap
  • Copilot: More headroom before your session or 7-day token limit kicks in and forces a model downgrade to Auto
  • Claude Code: Lower token spend per session. Costs average ~$13/active dev/day, so every token reclaimed is real money back

If your project has CLAUDE.md files and skill READMEs that haven't been touched in months, you are probably near the 45% end of that range the day you switch.

How to try this

  • Audit your static files. Tokenize AGENTS.md, CLAUDE.md, skill READMEs. Add them up.
  • Gut AGENTS.md to guardrails only. Hard rules, format constraints. If it is context rather than constraint, it belongs in Empirical.

Prompt Used

text

Review my AGENTS.md and help me separate guardrails from context.

Guardrails stay in AGENTS.md: hard rules, format constraints, and non-negotiables
the agent must always follow.

Context moves to Empirical: architecture decisions, service conventions, team
knowledge, past decisions — anything that is "good to know" rather than "must follow."

For each piece of context you identify, create one Empirical memory with a clear
summary using the record_graph_memory tool.

When done, show me the slimmed-down AGENTS.md for review.
  • Move durable knowledge to Empirical. Architecture decisions, service conventions, team policies. One memory per concept.
  • Start each task with one query. Pull the 3-5 memories most relevant to the current work.

The tank is fixed. What you pack in the trunk before you leave is up to you.

What we didn't test

This writeup is focused on coding-agent workflows. We have early signals that the same pattern carries into research agents, support assistants, and long-running operator tasks, but we have not published a clean benchmark set for those categories yet.

This is also not a zero-markdown argument. A short, stable AGENTS.md with hard constraints is still useful. The waste comes from large static instruction files that keep growing and are injected on every turn whether they are relevant or not.

Make the switch. Gain up to 45% more context window

All Empirical blog posts