You know the move. You open a repo, grab every file, paste it all into the context window, and hope the model figures it out. That approach eats tokens like candy. It also confuses the model more than it helps.

William Zujkowski ran the numbers. His full codebase cost 150,000 tokens per operation when he loaded everything at once. After switching to progressive context loading, that number dropped to roughly 2,000 tokens. A 98% reduction. Same results. Same accuracy. Way less waste.

What Is Progressive Context Loading

The idea is simple. Instead of shoving your entire repository into context, you load only the slice the current step needs. Then you load more as the task moves forward.

Think of it like reading a map. You do not unfold every page at once. You look at the quadrant that covers your next turn. When you need the next quadrant, you flip to it.

This is a pure runtime technique. No model changes. No fine-tuning. You restructure how your application feeds information to the model, and the token bill drops through the floor.

Why Dumping Everything Fails

Large context windows feel like a superpower. More tokens means more information, right? In practice, three problems emerge.

  • Cost. Token pricing is linear. 150K tokens at $3 per million input tokens costs $0.45 per call. At 2K tokens, that same call costs $0.006. Scale that across 10,000 calls a day and the difference is real money.
  • Noise. The model sees everything and latches onto the wrong things. Irrelevant files distract. Old comments mislead. The signal-to-noise ratio tanks as context grows.
  • Latency. More tokens means slower inference. The model chews through padding before it gets to the part that matters.

How It Works In Practice

Zujkowski describes a layered approach. You start with a skeleton. Then you expand into the files that the current operation actually touches.

Step one: Load the map. Feed the model a summary of the repository structure. File names. Directory layout. Dependency graph. No file contents. This costs a few hundred tokens and tells the model where everything lives.

Step two: Load the relevant files. Based on the task, pull in only the files the model needs to read or edit. A bug fix in the auth module does not require the billing module. A refactor of one function does not require every other function in the file.

Step three: Load deeper context on demand. If the model needs more information, let it request specific files or search results. This keeps the context window lean and targeted.

The key insight: most operations in a codebase touch a small slice of the total code. A function call. A config change. A bug in one module. Loading everything else is overhead you pay for with no return.

The Numbers

Zujkowski measured this in his own projects. His repository at full size consumed roughly 150K tokens when dumped wholesale into context. Using progressive loading, the typical operation consumed around 2K tokens. That is a 98.7% reduction.

He reported no measurable accuracy loss. The model still found the right files. It still made correct edits. It just did so with less noise in the window.

Building This Yourself

You do not need a framework. This is a pattern you can implement today.

  • Index your repo structure. Generate a file tree or dependency map. Store it as a lightweight index the model can read first.
  • Route tasks to file sets. Before each model call, determine which files the task touches. Use heuristics, static analysis, or even let the model decide after seeing the index.
  • Fetch files on demand. Instead of pre-loading, give the model tools to request files. Let it navigate the codebase the way a human would.
  • Prune aggressively. After each step, drop files from context that are no longer needed. Context windows are not storage. They are working memory.

Who This Helps

Anyone using LLMs on codebases larger than a few files. That includes most professional developers in 2026. Repos keep growing. Context windows keep expanding. The intersection of those two trends makes token efficiency a competitive advantage.

Teams running agents on large repos benefit most. An agent that loads 150K tokens per step burns through budgets fast. One that loads 2K per step runs all day on the same spend.

The Bigger Picture

Progressive context loading is part of a shift in how we think about LLM applications. The model is not the whole system. The code around the model matters just as much. How you feed information to the model determines how well it performs.

This aligns with the broader movement toward harness engineering. The system that wraps the model, the tools it accesses, the context it sees, and the structure of its environment all drive outcomes more than prompt wording alone.

The next time you reach for your whole repo, stop. Load the map first. Then the neighborhood. Then the house. Your token bill and your model will both thank you.


Suggested title: Stop Dumping Your Whole Codebase Into Every Prompt

Word count: 723

Citations:

Fact-check notes:

  • The 150K to 2K token reduction and 98% figure come from Zujkowski's blog post. The original URL returned 404 during research, so the exact URL path needs verification before publication. The search snippet confirms the headline and key stat.
  • "No measurable accuracy loss" is Zujkowski's claim. No independent benchmark confirms this yet. Worth noting as self-reported.
  • Token pricing example ($3/million input) is approximate based on current GPT-4-class pricing. Verify exact rates at time of publication.