This site is in beta and I'm collecting feedback: LinkedIn or genaivikas@gmail.com.

learn-genai.inBeta

Context engineering · Lesson 1 of 9 · 4 min read

Why a clever prompt is not enough

You write a careful prompt. It starts with “You are an expert”, and it works well in a demo.

Then you build a real application around it, and the answers get worse. The prompt did not change. So what did?

The prompt is one block

Every time you call a model, it reads a context window. The context window is everything the model can see in that one call.

In a demo, your prompt is almost the whole window. In a real application, the window also holds the system prompt, the tool definitions, the documents you retrieved and the conversation so far. Your prompt is one block among them.

A hand drawing. On the left, a circle holds the prompt 'You are an expert'. On the right, a tall box labelled context window holds five blocks: system prompt, tools, documents, history, and your prompt at the bottom. A note beside it says fixed token budget.
Your prompt goes into the window as one block. The other blocks travel with it.

The window has a fixed budget

The window has a fixed size. The size is counted in tokens. A token is a piece of a word that the model reads. As a rough guide, one token is about three quarters of a word.

Everything has to fit inside that budget, and all of it is sent again on every call. So a clever sentence in your prompt cannot help much when the rest of the window is full of things the model does not need.

A bigger window does not fix it

It is tempting to get a bigger window and put everything in it.

Researchers tested how models use long contexts. A model used the information at the start and at the end of a long context well. It missed more of what sat in the middle. The paper calls this “lost in the middle”.

Check yourself

Your agent's answers got worse after you started adding ten more documents to every call. What is the more likely cause?

Try it at work

Open Claude Code after a long session and type /context. It shows how full the window is and what is using the space.

Find the largest block. Then find your own prompt.

Takeaway: Your prompt is one block. The model reads the whole window.

Prove it yourself

Lost in the middle, tested

A notebook that hides one fact at different places in a long context, asks a model to find it, and records how often it succeeds.

Notebook being prepared
A page of Vikas's handwritten notes that this lesson is written from.

This lesson is written from my handwritten notes. Read all 22 pages.