Back to glossary

Term

Context Engineering

Context engineering is the discipline of deliberately curating and maintaining everything inside the LLM context window — system prompt, tool definitions, RAG hits, memory, conversation history.

Context Engineering — explained in more detail

Prompt engineering optimises the instruction sent to the model. Context engineering steps up one level and treats the whole context window as a scarce resource: which system prompts, tool descriptions, retrieved documents, notes and prior turns does the model see, and when? Anthropic defines it as an iterative strategy for managing all available tokens — selection does not happen once, but at every step of an agent. With longer agentic runs and 1M-token windows, the question “what belongs in, what doesn’t” matters more than “how do I phrase the prompt”.

Example / Practical context

In Claude Code you can watch context engineering in action: the agent writes a TODO list to external storage rather than keeping it in context; tool outputs are deliberately trimmed; files are loaded “just in time” with Read instead of all up front. Anthropic’s guidance: keep system prompts at the right level of abstraction (neither too rigid nor too vague), design tools to be self-explanatory and robust (every unclear tool description pollutes context on every call), and offload memory outside context, loading it only on demand.

Prompt engineering optimises input phrasing — context engineering curates the whole context across multiple steps. Retrieval-augmented generation (RAG) is a tool within context engineering: a way to selectively pull external content into context. Memory management overlaps heavily but focuses on long-lived state stores across sessions.

Entdecke mehr

Themenuebersicht