Zum Inhalt springen
Logosoftware-architecture.ai
AI Agents8 min read

How to give your AI agent the right context without overloading it

Illustration: How to give your AI agent the right context without overloading it

You know the feeling. You hand your AI agent a task, and what comes back is almost right. But only almost. Either it missed the point. Or it did three things you never asked for.

The first reflex is always the same. Next time I will give it more context. More info, more background, the whole project on top. And that is exactly where the thinking goes wrong.

The good news first: you do not have to give your AI agent everything. You actually should not give it everything. How you give your AI agent context matters more for the result than the sheer amount. Less, but well sorted, beats more. And the sorting costs you no tool and no budget, just a different way of thinking.

Many pieces on this topic start by explaining what an AI agent even is. I will skip that question. I care about the one that actually hurts in daily work: more context often makes AI agents worse, not better. The lever is not the amount. It is the dose.

Why does more context make an AI agent worse?

Because a language model has a finite attention budget. Every extra token draws on it, even when the token is relevant. This is not a hunch, it is measured.

Anthropic coined an apt term for it in 2025: context rot. Despite huge context windows, 200,000 tokens and more, models lose focus as length grows. Attention is a finite resource with diminishing returns. Source: Anthropic, 2025. Picture a person you keep putting more notes in front of. At some point they cannot find the important one anymore.

A widely cited study by Liu and colleagues from 2024 shows a U-shaped curve: models use information at the beginning and the end of the context best. In the middle, worst. The longer the context, the deeper the middle drops. Source: Liu et al., TACL, 2024.

And in 2025 a paper at EMNLP drove the point home hard. Length alone hurts. Even when the relevant information sits in the best spot and all distractions are removed, performance drops simply because the input is longer. Source: EMNLP Findings, 2025. So more context is not neutral. It costs.

Which leads to one sentence worth keeping: most failures of AI agents today are no longer model failures. They are context failures.

More context, less quality. The middle disappears first.

How much context does an AI agent really need?

Just enough to understand the task inside the right system. And not one sentence more. Graded by closeness to the task.

Context is not a bucket you pour full. Context is a dose. And the good dose is graded: sharp up close, only rough further out, not at all very far out.

Think of a new freelancer on day one. You give them the task in full. You explain the project the task sits in. You tell them in two sentences what the whole thing is about. But you do not dump the entire company wiki on their desk. And you say one decisive thing: this is so you understand where you are. Not so you rebuild it. That is exactly the craft with an AI agent. Except many people forget it there, even though they get it instinctively right with humans.

This has a name. It is called context engineering. Anthropic defined the discipline cleanly in 2025, Andrej Karpathy made the term well known, and the people behind the coding agent Devin call it the number one job when building AI agents. Source: Digital Applied, 2026. It is one tier among several on the same scale: prompt, context, harness, habitat engineering. I lay out that ordering in “Habitat Engineering”. The concrete pattern I am talking about here I call Graduated Context Resolution. It sounds clunky, it simply means graded context resolution. The right dose of context, staggered by closeness to the task.

A small honest aside, because precision matters to me. Computer science already has an old, similar-sounding term: Context Tree Weighting, from information theory, dating to 1995. That is something entirely different, namely data compression. I only borrow the intuition of weighting by tree depth. I deliberately do not take the name itself, because it is taken. Source: Wikipedia, Context Tree Weighting.

How do you structure context for an AI agent?

In four rungs, graded by closeness: the task and its direct surroundings in full, the big goal as a summary only, neighbour topics not at all. Plus one clear boundary on top.

Rung 1, full: the task itself. What exactly should come out, how do you measure that it is done. Complete, no shortcuts.

Rung 2, full: the direct surroundings. The project or larger step the task belongs to. Also complete, because this is where the terms, the architecture, the constraints that shape the task live.

Rung 3, summary only: the big goal. What the whole thing is ultimately for. But not in detail. Two, three sentences that set the direction. More only distracts.

Rung 4, not at all: the neighbour topics. The other tasks running in parallel. They do not belong in here. That is a sequencing question, not a context question.

And above all of it sits one rule that prevents most of the wandering off.

The big picture is context to understand. Not a mandate to build.

You show the AI the big picture so it fits the system, not so it rebuilds half the system. This, by the way, is not to be confused with the question of which documents the AI gets to see at all. That is retrieval, which I wrote about in “RAG explained”. Here we look at the other axis: not which context, but how much of it.

The context ladder

You can dose every layer around a task: full, as a summary, or off. Play through the rungs and watch when the AI hits and when it drifts.

1 · The task

What exactly should be built

2 · The direct surroundings

Project / parent ticket

3 · The bigger goal

The epic behind it

4 · Neighbouring tasks

What runs in parallel

Hits the task?Hits the task

Sweet spot

Task and surroundings in full depth, the bigger goal as a summary, neighbours off. Exactly the graduated dose that lets the AI build the right thing.

Token load and scope-drift risk
Token loadhigh
Drift risklow
Context ≠ assignment

More context does not mean more assignment. The upper layer informs, it does not command.

That this is not some theory tower shows in how the big providers actually build. Anthropic released a format called Agent Skills in late 2025 that works on exactly this principle. At startup the system reads only name and description, around 80 words. The full text loads only when a skill is genuinely needed. Helper files only during execution. Three rungs of resolution, depending on closeness to the current step. Source: Towards AI, 2026.

Same thing when exploring. At re:Invent 2025 Anthropic shared that an agent burns through 70,000 to 100,000 tokens just orienting itself in a project before it even starts the work. The fix is a helper agent that explores, fills its own window, and reports back only a short summary, 1,000 to 2,000 tokens. The main agent keeps working with a clean head. Source: Anthropic, AWS re:Invent, 2025. That is rung 3 in its purest form: the far-away comes in as a summary only.

What I bring from my own work is exactly this pattern. I am currently building an agent that works through tasks from a task board on its own, overnight. The first thing it does before touching anything: it resolves the context tree of the task. The task itself it reads in full. The parent task it reads in full. The big project goal it takes only as a rough summary. The neighbour tasks it leaves out entirely. And the rule I hard-wired into it is the one from above: the higher level is context, not a mandate. Since that rule, it stopped wandering off.

What does this mean for your next prompt?

You write four short blocks instead of pouring everything into one paragraph. That is the whole exercise.

  • TASK: what exactly should come out, in full here.
  • PROJECT CONTEXT (to understand): the direct surroundings, in full here.
  • BIG GOAL: what it is for, two sentences only.
  • DO NOT: the neighbour topics that stay out.

That sounds like extra work. It is not. It is actually a relief, because you sort once instead of patching up three times.

The better dose beats the bigger model

The context ladder costs you no tool and no budget. It costs you one minute of sorting before the prompt. And it gives you two things back: less rework, because the AI hits the point. And control, because you decide what is context and what is a mandate.

And that is the real point. An AI that does exactly the right thing does not take the decision off your hands. It takes the correcting off your hands. The time you would otherwise spend cleaning up afterwards, you get back for the work where your judgment really counts. You stay the person who decides what gets built.

So on your next AI task: four blocks. Task. Surroundings. Goal in two sentences. And a clear do not. That is the start. And the more your AI works across many steps inside real systems, the more this will make the difference. Not the bigger model. The better dose.

If your AI creates more rework than real work, it is rarely the model. Write to me and I will look at your concrete case.

Related to This Topic

Get the free Getting Started Guide: 10 concrete ways to start using AI productively tomorrow.

Did this article spark an idea? Let's find out which Sinnvampire can disappear for you.