Context Engineering
Context engineering is the discipline of designing information that reaches a large language model's context window. It encompasses selecting relevant content, compressing verbose inputs, managing multi-turn conversation history, and positioning critical information where models attend most effectively. The goal is providing the model exactly what it needs to complete a task accurately, without exceeding token limits or degrading performance through information overload.
itArtificial intelligence and machine learning | OpenSkills.info
Course pathWalk it in order
Look it upDip in anytime
Go furtherLeaves this page
Don't Panic
Don't Panic — Context Engineering
Context engineering is the art of deciding what a language model gets to see before it starts talking. This sounds like arranging a few words. It is actually closer to packing for a trip on an aircraft with a very strict baggage allowance and an alarming interest in the order of your socks.
A context window is the model's finite space for system instructions, conversation history, retrieved documents, tool outputs, and the response it still has to produce. Before this discipline had a name, systems often kept adding material until the request was crowded, slow, or rejected. The useful replacement is not larger piles. It is a budget: reserve room for the answer, then choose the information that must shape it.
Two ideas carry most of the weight. First, information density means useful facts per token. A verified table or a short state record can earn its place; navigation chrome, duplicate search results, and old conversation turns usually cannot. Second, position matters. Models pay more attention at the beginning and end of a long context than in its middle, so a vital rule buried under a mountain of almost-relevant documents has taken a holiday from being useful.
This is why retrieval-augmented generation, where a system fetches external documents for a question, needs more than a search box. Documents need meaningful chunks, clear boundaries, and deduplication before they join the payload. The surprise is that a system can technically fit the answer in its window and still miss it. Capacity is a ceiling, not a guarantee of attention.
Long conversations and agents add their own small administrative weather system. A sliding window keeps recent turns and drops old ones. Summarization keeps a compact account of decisions and open questions. Dynamic pruning removes material that has expired or stopped helping. Tool schemas and raw tool results need the same treatment, because an agent can collect context with the enthusiasm of a squirrel collecting cables.
Start with the Intro for the full map: components, position bias, RAG, and agent context. Use the Cheatsheet when you need budget allocations, payload order, and diagnostic signals. Field Notes is for the parts that become expensive only after a system has been running long enough to remember too much.
Where this skill leads
Relevant careers
See how this topic contributes to broader role-level skill maps.
Sources
- https://arxiv.org/abs/2309.02427
Supports
- Language-model performance can vary with the position of relevant information in long contexts.
- https://docs.anthropic.com/claude/docs/context-windows
Supports
- A model context window limits the prompt and output tokens available to one interaction.
- https://www.anthropic.com/engineering/claude-context
Supports
- Context engineering selects, structures, and maintains the information supplied to an AI system.
- https://arxiv.org/abs/1706.03762
Supports
- The Transformer architecture uses attention mechanisms and made sequence length a practical architectural consideration.
- https://arxiv.org/abs/1810.04805
Supports
- BERT pre-trains bidirectional language representations using left and right context.
- https://arxiv.org/abs/2004.05150
Supports
- Longformer combines local-window and global attention for long-document processing with linear scaling.
- https://arxiv.org/abs/2005.11401
Supports
- Retrieval-augmented generation combines a pre-trained generator with an external dense vector index.
- https://arxiv.org/abs/2210.03629
Supports
- ReAct interleaves language-model reasoning with actions that obtain external information.
- https://www.anthropic.com/engineering/contextual-retrieval
Supports
- Contextual Retrieval adds concise document-specific context to chunks before embedding and indexing them.
- https://www.anthropic.com/news/model-context-protocol
Supports
- Model Context Protocol was introduced as an open standard for connecting AI assistants to data and tools.
- https://www.anthropic.com/engineering/effective-context-engineering-for-ai-agents
Supports
- Agent context requires deliberate management of system instructions, tools, external data, and message history.
- https://www.langchain.com/
Supports
- LangChain provides application components for prompts, models, tools, retrieval, and structured outputs.
- https://www.llamaindex.ai/
Supports
- LlamaIndex provides data and retrieval tooling for LLM applications.
- https://www.pinecone.io/
Supports
- Pinecone provides managed vector search for AI application retrieval.
- https://weaviate.io/
Supports
- Weaviate provides vector search and filtering capabilities for AI applications.
- https://www.trychroma.com/
Supports
- Chroma provides vector database tooling for AI application retrieval experiments.
- https://unstructured.io/
Supports
- Unstructured provides document preparation for downstream retrieval and AI workflows.
