Core concepts
Context engineering
Definition
Context engineering is the practice of deciding what information enters a model's context window and in what order. As windows grew, choosing what to include became more consequential than wording the instruction.
Prompt engineering focuses on phrasing an instruction. Context engineering focuses on assembling the whole payload: which retrieved documents, how much conversation history, which examples, which tool outputs, and in what sequence.
It matters because context is a scarce, contested resource. Every token spent on a marginally relevant document is a token unavailable for something useful, and models attend unevenly across long contexts. More context is not automatically better context.
The core disciplines are retrieval quality, summarising history rather than replaying it, ordering by relevance rather than chronology, and aggressively pruning anything that does not contribute to the current step.
Related terms
Context window
The context window is the maximum number of tokens a model can consider at once — your prompt, any attached documents, the conversation history, and the response it generates. Exceed it and the earliest content gets dropped.
RAG (Retrieval-Augmented Generation)
RAG retrieves relevant passages from your own documents and inserts them into the prompt before the model answers. It grounds responses in your data, cuts hallucination, and needs no retraining.
Lost in the middle
Lost in the middle is the tendency of models to use information at the start and end of a long context well while under-weighting material in the middle. Position affects whether the model actually uses what you provided.
Prompt engineering
Prompt engineering is the practice of designing model inputs that reliably produce the output you want. It combines clear instruction-writing, structured formatting, worked examples, and systematic testing.
Token
A token is the unit of text an AI model reads and writes — roughly four characters or three-quarters of a word in English. Models price by the token and cap context by the token, so token count determines both what you pay and what fits.
Tokenizer
A tokenizer is the component that splits text into tokens before a model processes it. Different model families use different tokenizers, which is why the same text can have different token counts on GPT versus Claude.
Put this into practice
Understanding the term is step one. Our free courses and tools let you actually use it.