简体中文
The context problem is a monolith problem. Preload the map — a directory tree plus bidirectional links — and let the agent navigate like a developer in an IDE.文章 · standmeet2026.10.15 · 文章
2026.10.15·3 分钟阅读#essay#agents

Give the Agent a Map, Not the Code

The context problem is a monolith problem. Preload the map — a directory tree plus bidirectional links — and let the agent navigate like a developer in an IDE.

When a developer opens a session in a large codebase and gives the agent a task, the first question is what goes into the context at the start. My answer: the map goes in, the code stays out — a file enters only when the agent navigates to it.

The context problem is really a monolith problem.

If the codebase is microservices, there is mostly no problem to solve. One service is small. The whole service fits in the window, and the agent can simply read it. A monolith never fits — and stuffing more of it into the context does not make the agent smarter. It makes it slower, more expensive, and easier to distract.

So for the monolith case, I do not preload code. I give the agent a map.

In my own system, retrieval runs on two structures, and no embeddings. The first is a tree: an index organized by directory, the way files actually sit on disk. The second is links: entries point at each other in both directions, the way a wiki does. The agent starts from the map and walks.

Code has the same two shapes. The directory tree, and the connections inside the code — who calls whom, what implements what.

The second shape is the one people keep trying to reinvent, and the IDEs solved it decades ago. Go to definition. Find the callers. Jump, look, jump back. Those are navigation operations, built for humans with hotkeys. Give the agent the same operations as tools and it can navigate a codebase the way a developer does.

What goes into the context at the start is the map, not the territory. A file enters when the agent navigates to it. Everything else stays out — deliberately. What you leave out is most of the design.

And when the window fills anyway, the last two years have converged on one step: compress the earlier conversation into a summary and continue from it. My own visitor sessions are short by design, so this is not where my difficulty lives. The hard part is not the compression. It is knowing the agent still behaves correctly afterwards — and that is an eval problem, answered by repeated runs against checks, never by reading one transcript and nodding.

Context is not a bucket to fill. It is a place the agent should be able to find things in.

就这篇文章向 AI 提问·上下文:“give the agent a map, not the code”
›