Context Engineering 101

The hardest problem in production AI is not phrasing the question. It is deciding what information the model should see at each step.

Context engineering is the discipline of managing the information a model sees at the moment it generates a response. Context is more than the prompt. It includes the system prompt, the conversation history, examples, tool outputs, retrieved documents, and any other data the model can read. The hardest problem in production AI is not phrasing the question. It is deciding what information the model should see at each step.

The constraint is physical: the context window is finite, and dumping more information into it often makes answers worse. Models bias attention toward the start and end of the window, so material in the middle can be ignored. Long-running tasks suffer from context rot, the pattern where useful information gets buried under outdated tool outputs and stale conversation turns. Good context engineering curates the minimum useful information at each step.

The module teaches the working techniques. Retrieval strategies fall into three patterns: load everything upfront for clear questions, retrieve just in time for exploratory tasks, or combine both, which is what most production systems do. Compaction summarizes the conversation, keeps the essentials, and discards the rest when the context approaches its limit. Structured note-taking runs continuously: the agent writes goals, constraints, and decisions to a separate file that can be reloaded later. Sub-agent architectures give focused subtasks their own context windows and return condensed summaries to the main agent. Progressive disclosure starts with summaries and drills into full sources only when they look relevant, which mirrors how skilled researchers work.

The failures are recognizable. Teams stuff entire documents into the prompt and hope the model finds what matters. They run multi-hour agents without external notes and lose state when the context fills. They let one agent handle everything when sub-agents would keep each context clean. Review context management plans with the same seriousness as database schemas, and require a compression policy before approving long-running deployments.

In one paragraph

Context engineering is the discipline of managing the information a model has at the moment it generates a response. Context includes the system prompt, conversation history, examples, tool outputs, retrieved documents, and any data the model can see. The context window is finite. Dumping more information into it often makes answers worse because models bias attention toward the start and end of the window. Good context engineering curates and composes the minimum useful information at each step, compresses what is stale, preserves what is durable in external notes, and splits work across sub-agents when a single context gets overwhelmed.

This module is part of the Context and Grounding track in the free AI Learning Hub. Source material: Context Engineering 101.