Context
Everything the model can currently see.
The information available to the model when it produces a response — the system prompt, the conversation history, retrieved documents, tool results and the current message. If it is not in context, the model does not know it.
This is the single most important mental model: the model has no memory and no access to your systems. It knows only what has been assembled into its context. Most "the AI is dumb" problems are really "the AI was not told".
The deeper point is that the model has no memory and no filesystem. Everything it can reason about had to be placed in front of it by your code, in this request. "The model forgot" always means "your code did not send it", and "the model ignored it" usually means it was crowded out.
Debugging by printing the context
Quality is inconsistent between environments and nobody can reproduce it.
Log the fully assembled request rather than the user message. The usual finding is a difference nobody intended: a stale system prompt, a retrieval index pointed at a different corpus, or three extra tool results pushed in only in production.
Assuming the model can look things up on its own. Only what is placed in context exists for it.
- docsContext windows ↗
What actually consumes the window — input, tools, thinking and output — plus context rot and compaction. Authoritative for this product, not for models generally.
- blogEffective context engineering for AI agents ↗
Defines context engineering as curating everything supplied at inference, names context rot, and covers just-in-time retrieval, compaction and keeping the window high-signal.
Context Window
The hard ceiling on how much the model can see at once.
Context Engineering
Deciding what goes in the window, in what order, at all.
System Prompt · System message
The standing instructions the user does not see.
Session
One continuous run of work with the agent, with its own accumulated history.
RAG · Retrieval-Augmented Generation
Look things up, then put what you found in the prompt.