Kape Tools

Context Engineering

Choosing what the AI gets to see while it answers

Prompt engineering is writing your question well. Context engineering is everything else in front of the AI at that moment: your files, your notes, the chat so far, whatever a tool just returned. It is the bigger lever, and almost nobody thinks about it.

The thing nobody tells you

When you send a message, the AI does not only see your message. It sees a whole pile of other material you probably never chose on purpose: the standing instructions, your project files, the entire chat up to now, and whatever any tool just handed back.

All of that has to fit in one fixed space, called the context window. Context engineering is just deciding what goes in it.

A bar showing one context window filled by the system prompt, an instructions file, retrieved documents, memory, tool output and the chat so far, with a tiny slice at the end labelled as your actual question, above two columns comparing stuffing the window with choosing what goes in
Notice the size of the last slice. Your actual question is usually the smallest thing in there.Open full size

Why more is not better

This is the part that surprises people. Adding more context does not keep making answers better. Past a point it makes them worse.

The smart zone and the dumb zone

Here is the part that catches almost everyone. The window has a size and you can watch it fill. Quality does not wait for it to be full: it starts slipping well before that, and nothing on your screen says when.

A window bar split into a smart zone where answers stay sharp, a slipping middle, and a dumb zone at the end, with the four signs you are past the good stretch
The bar is not the warning. By the time it looks full, you are already deep into the bad half.Open full size

Three stretches. Early on it is sharp: it remembers, follows your rules, stays on the thing you asked for. Past the middle it slips, still sounding exactly the same. Near the end it forgets, repeats itself and contradicts what it told you an hour ago.

Where the good stretch ends differs by model and moves with every release, so a number here would be stale before you read it. You do not need the number. You need the four tells.

The three moves

  1. Put in. Give it the real material, not your summary of it. The actual thread, the actual file, the actual error.
  2. Leave out. Do not attach the whole handbook to ask one question. Ask for the pages you need.
  3. Clear out. One task, one chat. When the task is done, start a new one. Use /compact if you must keep going.

Where the context actually comes from

WhatWhere it comes fromWho decides
System promptThe tool itselfNot you, usually
Instructions fileYour CLAUDE.md or project instructionsYou, once
Retrieved documentsA search over your filesThe search, tuned by you
MemorySaved facts from beforeYou, over time
Tool outputWhatever a tool just returnedNobody, and it can be huge
Chat so farThis conversationYou, by starting fresh or not

Look at the fifth row. Tool output is the one that catches people out: one command returning a wall of text can eat half your window in a single step, and nobody chose that.

Four typed words trigger a tool that returns 900 rows, filling most of the window in one step and staying there for every turn after
Four words in. Most of the window gone, and it stays gone.Open full size

A freelancer example

You want a proposal. Two ways to set it up:

Stuffing it
  Paste the rate card, the brand guide, three old proposals,
  the client's whole email thread, and your notes app export.
  Then ask for the proposal.
  -> It quotes an old price from proposal number two.

Choosing it
  Rate card and brand guide live in the project, so they load
  every time and stay current.
  Paste only THIS client's thread.
  Start a new chat for this proposal.
  -> It quotes today's price, because yesterday's is not in the room.

How this relates to the other words

People often talk about these as three fashions that replaced each other. They did not. Each one is a bigger box around the one before it.

Common mistakes

More words

See all 11 explanations