01 · part 1, conceptsconcept
What the model gets to read
Context engineering means choosing, on purpose, what text you send to the model with each request, and checking that your choice works.
Why you have to choose
A model starts every request from zero:
- It remembers nothing from earlier requests.
- It can't open your files, your database or your code.
- It knows nothing about your company, your product or your customers.
So on every request, your program packs one block of text and sends it. The model reads that block and nothing else.
What goes into the block
The order matters. Step 3 shows what it costs.
- The block has a size limit. The top edge is the most it can hold: 1,200 words in this volume's labs.
- The user's question goes in first. The user chooses it, not you.
- Next comes carried text: text you attach to every request, such as your rules or a style guide. You choose it when you build the system.
- Last comes fetched text: text your code looks up for this request only, such as the help article that matches the question.
- Fetched text goes in last, so it's the first to be left out when the block is full.
| part of the block | what it is | who chooses it | when |
|---|---|---|---|
| the question | the user's request, as written | the user | when they ask |
| carried text | text attached to every request | you | when you build the system |
| fetched text | text looked up for this request only | your code | when they ask |
When it gets hard
While everything fits and nothing changes, packing the block is easy. It gets hard in either of two cases:
- You have too much text. Your material is bigger than the limit, so you have to decide what to leave out.
- Your text changes. A policy or a how-to guide gets updated. Any old copy pasted into a program is now wrong, and nothing warns you.
Both problems are silent
- The model doesn't say a document is missing.
- It doesn't say your text was cut off.
- It answers anyway, just as confidently.
You can't catch these by watching for errors, because there aren't any. You catch them by counting what went into the block.
How big the labs are
| in this volume's labs | |
|---|---|
| pieces of text per job | six |
| requests per job | 30 |
| size limit | 1,200 words |
| choices compared | every way to carry or fetch the six pieces |
Six pieces is small. It's enough to show how this works, but not enough to promise the same result with sixty. Step 12 covers that.
Try it. In the labs folder, run:
python3 lab.py
Part 1 draws the code review job's six documents as bars, and shows them inside the size limit, like the diagram above.
What to remember
- The model starts from zero. Your program builds everything it reads.
- The block holds the user's question, the text you always send, and the text you look up.
- Missing or cut-off text causes no error, so you have to count what you send.