{"course":{"slug":"context-engineering","title":"Context Engineering","url":"https://addaly.com/learn/context-engineering","level":"advanced","track":"build"},"lesson":{"slug":"what-context-engineering-is","title":"Nobody typed this","url":"https://addaly.com/learn/context-engineering/what-context-engineering-is","position":2,"of":87,"minutes":9,"answer":"Context engineering starts the moment a program, not a person, assembles what the model reads, and the questions that matter become selection, order, cost, provenance and proof rather than wording.","keyIdea":"Context engineering starts the moment a program, not a person, assembles what the model reads, and the questions that matter become selection, order, cost, provenance and proof rather than wording."},"body":{"format":"markdown","text":"## A request nobody wrote\n\nAt 03:14 a support assistant answers a question about a delayed refund. The request that reached the model was 9,800 tokens long. A human typed fourteen of them.\n\nHere is where the rest came from, in the order the code appended it:\n\n- **620 tokens** of system prompt, written by a product manager in March and edited twice since.\n- **1,150 tokens** of tool definitions: six functions, their JSON schemas serialised into the prompt by the SDK.\n- **2,900 tokens** of conversation history, four earlier turns from the same customer.\n- **4,100 tokens** of retrieved material: nine passages pulled from a help centre by a vector search that ran forty milliseconds earlier.\n- **14 tokens** of what the customer actually asked.\n- **1,000 tokens** held back so the answer has room to exist.\n\nNo person read that request before it was sent. No person will read it afterwards unless something goes wrong. It was built by a function, from parts, most of which change on every call.\n\nThat function is the thing this course is about.\n\n## Prompting ends where assembly begins\n\nPrompt engineering is what you do when you are the one typing. It is real work, and it has a ceiling: you can only tune the words you personally control. The moment your system starts inserting material you have never read (a customer's earlier messages, a passage from a document somebody uploaded this morning, the output of a tool that returned 40,000 characters of JSON) the words stop being the interesting variable.\n\nWhat matters then is:\n\n- **What got selected**, out of everything that could have been selected.\n- **In what order**, because order changes whether a fact is used.\n- **At what cost**, because every token is billed, and prefill time scales with how many there are.\n- **From where**, because material has a provenance and some of it is hostile.\n- **How you would prove** that yesterday's change was an improvement.\n\nThose five questions are not answered by better wording. They are answered by code, budgets and measurement. That is why the discipline has a different name.\n\n## What is engineering about it\n\nCall it engineering when these things become true of your context:\n\n1. **It has a budget.** A number, written down, that the assembled request must not exceed, with a reserve for output.\n2. **It is deterministic.** Given the same inputs, the assembler produces the same bytes. If it does not, you cannot debug it.\n3. **It is testable.** You can call the assembler in a unit test without calling a model, and assert on what came out.\n4. **It is versioned.** The whole call (instructions, retrieval settings, model id, sampling parameters) has an identifier, and a log line carries it.\n5. **It has failure modes you can name.** Overflow, truncation, a cache miss, a poisoned passage, a tool result that swallowed the instructions.\n\nIf none of those are true, you do not have a context problem yet. You have a prompt, and prompt-level thinking will serve you fine.\n\n## The honest limit\n\nContext engineering does not make a model correct. It changes what the model has to work with, and nothing more. A model given the right passage can still misread it; a model given a perfect budget can still invent a number.\n\nThe mechanism is worth stating plainly, because it sets the ceiling on everything else in this course. A language model produces a distribution over next tokens conditioned on the tokens in front of it. Better context shifts that distribution, sometimes dramatically. It does not add a verification step, a memory of what is true, or a refusal to guess. Those have to be built around the call, not inside the window.\n\nSo the honest claim is narrow and still worth a course: most production failures blamed on the model are failures of what the model was given. The passage was not retrieved. The instruction was 8,000 tokens above the question. The tool returned a wall of JSON and the schema at the top fell out of the window. You can fix all three without touching the model.\n\n## What you need to follow along\n\nEverything measurable in this course is measurable for free, on a laptop, without a GPU:\n\n- `tiktoken` (pip install tiktoken) counts tokens for OpenAI-family tokenisers offline.\n- Hugging Face `transformers` gives you the exact tokeniser and chat template of any open-weights model, again offline.\n- `llama.cpp` or Ollama runs a 3B to 8B model locally so you can run position and ordering experiments without a bill.\n- Anthropic exposes a free, rate-limited token-counting endpoint (its count is a close estimate that can differ slightly from the billed figure), and OpenAI exposes `POST /v1/responses/input_tokens`, which returns the exact count (OpenAI's docs do not state its price).\n\nThe paid path exists (hosted evaluation platforms, managed vector databases, observability suites) and none of it is required to learn any of this. A Python file, a JSON file of test cases and a text editor will take you through every lesson here.\n\n## Where this course goes\n\nNine modules, in the order the problem actually appears: what is in the window and what it costs; choosing what earns a place; the retrieval pipeline that fills it; position and ordering; cache and latency; conversation and memory; tools and agents; trust boundaries; and finally how to prove a change helped and ship it so it can be rolled back.\n\nThe first thing to do is stop calling it a prompt."},"check":{"question":"A team's assistant sends 9,800-token requests of which the user typed 14 tokens. They spend a week rewording the 620-token system prompt and see no improvement. What does this most likely indicate?","options":[{"text":"The system prompt is too short relative to the request and should be expanded until it is a larger share of the window.","correct":false,"tempting":"Treats influence as proportional to token share; a longer instruction block competes for the same attention and costs more, without addressing which material was selected."},{"text":"The model is too small for the task and the fix is a larger model.","correct":false,"tempting":"Jumps to the model when 94% of the request was assembled by code that has not been examined; a larger model reading the same wrong passage answers wrongly more fluently."},{"text":"The variable 94% of the request (retrieval, history, tool definitions) is where the behaviour is being decided, and it has not been touched.","correct":true},{"text":"Rewording cannot help any request, because instructions are ignored once the context exceeds a few thousand tokens.","correct":false,"tempting":"Overgeneralises from one failed experiment into a false mechanism; instructions are followed at long context, they are just competing with far more material."}]},"prev":{"slug":"the-window-is-a-budget","title":"The window is a budget, not a container","url":"https://addaly.com/learn/context-engineering/the-window-is-a-budget"},"next":{"slug":"the-four-kinds-of-context","title":"Four kinds of context, four different problems","url":"https://addaly.com/learn/context-engineering/the-four-kinds-of-context"},"authorship":"Founder and series editor: Dr Mustafa Mun. Written by AI models to a written standard. Exam keys checked blind by a second model: 3,665 of 3,666 agreed. Academic review invited.","review":{"status":"Draft, open for academic review"},"cite":"Addaly (2026) 'Nobody typed this', in Context Engineering. Edited by M. Mun. Addaly. Available at: https://addaly.com/learn/context-engineering/what-context-engineering-is (Accessed: 13 October 2026).","licence":{"name":"CC BY-NC-SA 4.0","url":"https://creativecommons.org/licenses/by-nc-sa/4.0/"},"reader":{"schema":1,"title":"Nobody typed this","courseTitle":"Context Engineering","module":{"index":1,"slug":"the-window-as-a-surface","title":"The window as an engineering surface"},"answer":null,"keyIdea":"Context engineering starts the moment a program, not a person, assembles what the model reads, and the questions that matter become selection, order, cost, provenance and proof rather than wording.","hero":{"kind":"plate","image":null,"alt":null,"caption":null},"blocks":[{"t":"h2","id":"a-request-nobody-wrote","runs":[{"text":"A request nobody wrote"}]},{"t":"p","runs":[{"text":"At 03:14 a support assistant answers a question about a delayed refund. The request that reached the model was 9,800 tokens long. A human typed fourteen of them."}]},{"t":"p","runs":[{"text":"Here is where the rest came from, in the order the code appended it:"}]},{"t":"ul","items":[[{"text":"620 tokens","b":true},{"text":" of system prompt, written by a product manager in March and edited twice since."}],[{"text":"1,150 tokens","b":true},{"text":" of tool definitions: six functions, their JSON schemas serialised into the prompt by the SDK."}],[{"text":"2,900 tokens","b":true},{"text":" of conversation history, four earlier turns from the same customer."}],[{"text":"4,100 tokens","b":true},{"text":" of retrieved material: nine passages pulled from a help centre by a vector search that ran forty milliseconds earlier."}],[{"text":"14 tokens","b":true},{"text":" of what the customer actually asked."}],[{"text":"1,000 tokens","b":true},{"text":" held back so the answer has room to exist."}]]},{"t":"p","runs":[{"text":"No person read that request before it was sent. No person will read it afterwards unless something goes wrong. It was built by a function, from parts, most of which change on every call."}]},{"t":"p","runs":[{"text":"That function is the thing this course is about."}]},{"t":"h2","id":"prompting-ends-where-assembly-begins","runs":[{"text":"Prompting ends where assembly begins"}]},{"t":"p","runs":[{"text":"Prompt engineering is what you do when you are the one typing. It is real work, and it has a ceiling: you can only tune the words you personally control. The moment your system starts inserting material you have never read (a customer’s earlier messages, a passage from a document somebody uploaded this morning, the output of a tool that returned 40,000 characters of JSON) the words stop being the interesting variable."}]},{"t":"p","runs":[{"text":"What matters then is:"}]},{"t":"ul","items":[[{"text":"What got selected","b":true},{"text":", out of everything that could have been selected."}],[{"text":"In what order","b":true},{"text":", because order changes whether a fact is used."}],[{"text":"At what cost","b":true},{"text":", because every token is billed, and prefill time scales with how many there are."}],[{"text":"From where","b":true},{"text":", because material has a provenance and some of it is hostile."}],[{"text":"How you would prove","b":true},{"text":" that yesterday’s change was an improvement."}]]},{"t":"p","runs":[{"text":"Those five questions are not answered by better wording. They are answered by code, budgets and measurement. That is why the discipline has a different name."}]},{"t":"h2","id":"what-is-engineering-about-it","runs":[{"text":"What is engineering about it"}]},{"t":"p","runs":[{"text":"Call it engineering when these things become true of your context:"}]},{"t":"ol","start":1,"items":[[{"text":"It has a budget.","b":true},{"text":" A number, written down, that the assembled request must not exceed, with a reserve for output."}],[{"text":"It is deterministic.","b":true},{"text":" Given the same inputs, the assembler produces the same bytes. If it does not, you cannot debug it."}],[{"text":"It is testable.","b":true},{"text":" You can call the assembler in a unit test without calling a model, and assert on what came out."}],[{"text":"It is versioned.","b":true},{"text":" The whole call (instructions, retrieval settings, model id, sampling parameters) has an identifier, and a log line carries it."}],[{"text":"It has failure modes you can name.","b":true},{"text":" Overflow, truncation, a cache miss, a poisoned passage, a tool result that swallowed the instructions."}]]},{"t":"p","runs":[{"text":"If none of those are true, you do not have a context problem yet. You have a prompt, and prompt-level thinking will serve you fine."}]},{"t":"h2","id":"the-honest-limit","runs":[{"text":"The honest limit"}],"role":"limit"},{"t":"p","runs":[{"text":"Context engineering does not make a model correct. It changes what the model has to work with, and nothing more. A model given the right passage can still misread it; a model given a perfect budget can still invent a number."}]},{"t":"p","runs":[{"text":"The mechanism is worth stating plainly, because it sets the ceiling on everything else in this course. A language model produces a distribution over next tokens conditioned on the tokens in front of it. Better context shifts that distribution, sometimes dramatically. It does not add a verification step, a memory of what is true, or a refusal to guess. Those have to be built around the call, not inside the window."}]},{"t":"p","runs":[{"text":"So the honest claim is narrow and still worth a course: most production failures blamed on the model are failures of what the model was given. The passage was not retrieved. The instruction was 8,000 tokens above the question. The tool returned a wall of JSON and the schema at the top fell out of the window. You can fix all three without touching the model."}]},{"t":"h2","id":"what-you-need-to-follow-along","runs":[{"text":"What you need to follow along"}]},{"t":"p","runs":[{"text":"Everything measurable in this course is measurable for free, on a laptop, without a GPU:"}]},{"t":"ul","items":[[{"text":"tiktoken","code":true},{"text":" (pip install tiktoken) counts tokens for OpenAI-family tokenisers offline."}],[{"text":"Hugging Face "},{"text":"transformers","code":true},{"text":" gives you the exact tokeniser and chat template of any open-weights model, again offline."}],[{"text":"llama.cpp","code":true},{"text":" or Ollama runs a 3B to 8B model locally so you can run position and ordering experiments without a bill."}],[{"text":"Anthropic exposes a free, rate-limited token-counting endpoint (its count is a close estimate that can differ slightly from the billed figure), and OpenAI exposes "},{"text":"POST /v1/responses/input_tokens","code":true},{"text":", which returns the exact count (OpenAI’s docs do not state its price)."}]]},{"t":"p","runs":[{"text":"The paid path exists (hosted evaluation platforms, managed vector databases, observability suites) and none of it is required to learn any of this. A Python file, a JSON file of test cases and a text editor will take you through every lesson here."}]},{"t":"h2","id":"where-this-course-goes","runs":[{"text":"Where this course goes"}]},{"t":"p","runs":[{"text":"Nine modules, in the order the problem actually appears: what is in the window and what it costs; choosing what earns a place; the retrieval pipeline that fills it; position and ordering; cache and latency; conversation and memory; tools and agents; trust boundaries; and finally how to prove a change helped and ship it so it can be rolled back."}]},{"t":"p","runs":[{"text":"The first thing to do is stop calling it a prompt."}]}],"check":{"question":[{"text":"A team’s assistant sends 9,800-token requests of which the user typed 14 tokens. They spend a week rewording the 620-token system prompt and see no improvement. What does this most likely indicate?"}],"options":[{"text":[{"text":"The system prompt is too short relative to the request and should be expanded until it is a larger share of the window."}],"correct":false,"tempting":[{"text":"Treats influence as proportional to token share; a longer instruction block competes for the same attention and costs more, without addressing which material was selected."}]},{"text":[{"text":"The model is too small for the task and the fix is a larger model."}],"correct":false,"tempting":[{"text":"Jumps to the model when 94% of the request was assembled by code that has not been examined; a larger model reading the same wrong passage answers wrongly more fluently."}]},{"text":[{"text":"The variable 94% of the request (retrieval, history, tool definitions) is where the behaviour is being decided, and it has not been touched."}],"correct":true,"tempting":null},{"text":[{"text":"Rewording cannot help any request, because instructions are ignored once the context exceeds a few thousand tokens."}],"correct":false,"tempting":[{"text":"Overgeneralises from one failed experiment into a false mechanism; instructions are followed at long context, they are just competing with far more material."}]}],"order":[1,2,0,3],"why":null},"prev":{"slug":"the-window-is-a-budget","title":"The window is a budget, not a container","minutes":8},"next":{"slug":"the-four-kinds-of-context","title":"Four kinds of context, four different problems","minutes":8}}}