Warm Up the Context Window
Did your agent ever suggest an API that no longer exists? That happens because the model predicts from training weights (compressed priors).
How do we solve this model limitation?
Warm up the context window before writing code by starting every task with clear research.
My tools of choice are:
- DeepWiki MCP
- Perplexity MCP
Think like the agent
Put yourself in the shoes of the agent.
You run codex --yolo (yeah, we are all loving the risk), and the agent wakes up. It does not know your codebase. It does not know your task context. It does not know the architecture decisions you care about. It does not know the APIs of the technologies that you are using.
It is basically a very smart, very hard-working new employee on day one.
Would you ask a new engineer to ship production code in the first 10 minutes? Probably not. You would onboard them first.
Same thing here.
If you had infinite time, what would you do?
I would:
- Read all relevant docs.
- Explore the most successful open source projects in that area.
- Read enough source code to understand what works.
- Only then start implementation.
The great news is that agents are fast readers and absurdly patient. So they kind of have infinite time.
DeepWiki MCP: your open source research engine
DeepWiki MCP lets your agent query a GraphRAG over open source repositories.
That means your agent can quickly understand:
- architecture
- key modules
- conventions
- implementation patterns
- latest APIs
I strongly prefer plain vanilla conversation for this phase. No fancy command wrappers, no rigid skill templates. Just ask the agent to investigate deeply and teach you as it goes.
That has two benefits:
- You warm up the model.
- You warm up yourself.
This is where subagents shine too. Send subagents to investigate different codebases, then merge findings.
Perplexity MCP: your documentation / blog post radar
Perplexity MCP is great for querying public docs and web knowledge fast.
Think of it as a high-speed doc + web RAG layer:
- faster than manually jumping between docs
- useful for latest changes, release notes, and edge-case behavior
DeepWiki gives you grounded understanding from codebases. Perplexity gives you broad and current coverage from the public web.
What “warmed up” looks like in practice
After DeepWiki + Perplexity research, your context window is no longer cold.
Now your agent is much more likely to:
- use up-to-date APIs
- follow patterns that exist in successful codebases
- avoid naive first-draft architecture
- produce better first-pass code
In other words: fewer retries, less vibe debugging, better throughput.
Warming up is not only for the beginning of a project. Do it repeatedly, whenever you enter a new sub-problem, dependency, or unfamiliar area. Treat it as a regular quality loop that levels up your agents over time.
What if your context window is almost full
This is a valid concern. Agents are aware of their context window filling up. The closer they are to filling it up, the more they panic. So better to keep the context window at 30-40% full.
Some techniques that help me achieve that sweet spot are:
- In Claude Code use sub-agents to investigate. They will do it faster in parallel and come back with a summary of their findings that compresses the information into fewer tokens.
- You can do that manually by compacting the context window and saying you want to keep all the research information, just in fewer tokens.
The key is to rewrite the research into fewer tokens, so you keep the information compressed. It is useful to specify that you want to keep links and pointers to the information. That will help agents use the links in case they need more information in the future.
Bonus: build DeepWiki for your own codebase
If your repository is private, you can still create a DeepWiki view using Devin MCP integrations.
That gives your agents a much better bird’s-eye view of your internal codebase, not just external dependencies.
Stay warm
Warm up the context window first. Then ship.