Skip to content

Context engineering

Context engineering is choosing what goes into an AI model's context window at each step (instructions, files, tool results, history) so it has what it needs and little else.

Select any words here to ask your Maestro about them.

Two runs of the same agent, same data, same task. One read a CLAUDE.md with the team's rules; the other didn't. Both passed all their tests. In how many of the four regions do the totals differ?

Two real Claude Code runs building the same table from a fictional coffee roaster's data, July to September. Both passed every dbt test.

What it is: a model only knows what's in its context window at that moment. Context engineering is deciding what goes in there at each step: instructions, an instructions file like CLAUDE.md, the files it reads, what its tools return and the conversation.

Vs. prompt engineering: writing a good prompt is one part of it. In an AI agent that works over many steps, the context changes every turn, and getting it right is ongoing work, not one sentence.

More isn't better: every token competes for the model's attention. The goal is the least it needs to do the step well.

Practice it in the course Data Modeling for AI Agents, where the same agent runs with and without its notes.

How it's used

What goes into its context

The agent's context, at one step

  1. The system instructions and the tools it can useThe harness sets them; they rarely change.
  2. marked: CLAUDE.md: the rules the data doesn't sayThis is where "@ridgelinecoffee.com accounts are tests" lives.
  3. The files and tables it read for this taskOnly the ones it needs, not the whole folder.
  4. What its commands printedA 5,000-line output takes the room of everything else.
  5. The conversation so farIt grows with every turn.
Context engineering is deciding which of these go in, how much and in what order. What isn't in the context, the model doesn't know.

When to look closer

Give it everything

If you give it everything

  1. marked: All 40 documented tables, the wiki and every past conversation

Why not give the agent everything you have, just in case?

Ask your Maestro about Context engineering

It answers from the free course page closest to this word, the way it answers while you study.

Example

You: What does "Context engineering" mean, in plain words?

Your Maestro: I'll explain it with a case of yours: it sticks better than a definition. Which rule at work isn't written down in any data?

Asking about: Answers from the page "How do I get the top 3 in each group in SQL, ties included?"

Only this browser keeps what you ask here. How it works

Learn more

  • Context window

    Everything a language model has in front of it at a given moment: your instruction, the files it has read and the results of its tools. What isn't in the context, the model can't use.

  • Agent instructions file

    A text file in your project that the agent's harness loads at the start of every session, so the agent knows from the start what it always needs to know: rules, facts about the data and how to check its work.

  • Prompt

    A prompt is what you write to an AI model to ask it for something: the question or instruction, plus everything you give it to work with, like data, examples or the format you want back.

  • Token (in AI)

    A token is the piece of text a language model reads and writes in: sometimes a whole word, sometimes part of a word, a number or a punctuation mark. Models count their limits and their cost in tokens.

The whole glossary