AI PM 10X / CORE SKILLS

Context Engineering

The practice of curating everything that goes into a model's context window so it does the task reliably. It is the broader discipline that prompt engineering sits inside.

Overview

Context engineering is the practice of managing the whole working set a model sees so it can do the task reliably. Prompt engineering is about writing the instruction. Context engineering is the wider job of assembling everything around that instruction, including the system rules, retrieved knowledge, tool definitions and their outputs, the conversation history, and any running state. The context window is finite working memory, so the work is choosing what to put in, what to leave out, and what to summarise or drop.

For product managers it is where a feature stops being a clever prompt and starts being a system. Retrieval is one source of context, which is why RAG lives inside this discipline. Agents make it sharper still, because they must manage context across many turns without the window filling up or drifting off course. Get it right and the model stays grounded and reliable. Get it wrong and you meet the failure modes, where too much irrelevant context distracts the model, a bad fact poisons later turns, and reliability rots as the window grows.

Why It Matters for PMs

The window is the product

What a feature can do is bounded by what you put in front of the model. The context window is finite working memory, and curating it is the highest-leverage place a PM can shape behaviour once a feature gets non-trivial.

Prompting sits inside it

Prompt engineering writes the instruction. Context engineering manages the whole set the model sees, including retrieved knowledge, tool outputs, and history. The second is the broader job, and the one that decides whether agents stay reliable.

More is rarely better

Stuffing the window with everything that might help usually hurts. Irrelevant tokens distract the model and bury the signal. Choosing what to leave out is as important as choosing what to put in.

Key Concepts

Three ideas that hold the discipline together. What the window is, what fills it, and how you keep it relevant over time

1

The context window as working memory

Finite · Shared

A model only sees what fits in its context windowcontext windowThe fixed span of text a model can read and reason over in one pass, measured in tokens. Everything you send and everything the model generates competes for that same budget. Once it is full, something has to be dropped or summarised.Anthropic on context windows, a fixed budget measured in tokenstokensThe chunks a model reads text in, roughly three quarters of a word in English. Window sizes and pricing are both counted in tokens, so token budget is the real constraint behind every context decision.OpenAI tokenizer. Instructions, retrieved documents, tool results, and the running conversation all draw from one shared pool. When it fills up, you have to decide what stays.

2

What goes in the window

Instructions · Knowledge · State

The working set is more than the user's question. It includes the system promptsystem promptThe standing instructions and persona set before the user's request, for example 'You are a support agent for a banking app. Never give financial advice.' It frames every response in the session.Anthropic on system prompts, retrieved knowledgeretrieved knowledgeInformation pulled in from outside the model at request time, such as documents fetched by retrieval. It grounds the answer in your own data rather than the model's training. RAG is the most common way to supply it.Prompting Guide on RAG, the tool definitions and outputstool definitions and outputsThe descriptions of the tools a model can call and the results those calls return. Each definition and each output spends tokens, so a sprawling tool set can crowd out the rest of the context.Anthropic on tool use, and the conversation so far. The job is fitting the right mix into a budget that is always too small.

3

Managing context over time

Long tasks · Agents

Over a long task the history grows past the budget, so you have to actively curate it. The main moves are summarisationsummarisationReplacing a long stretch of conversation or tool output with a shorter summary that keeps the essentials. It frees up the window without losing the thread of a long task.Anthropic on context engineering, compactioncompactionCollapsing the running history of an agent into a compact form once it nears the limit, then continuing from that compacted state. Common in coding agents that run for many turns.LangChain on compaction, and pulling in fresh material on demand through retrievalretrievalFetching only the documents relevant to the current step and dropping them once done, rather than holding everything in the window. It keeps the working set small and on-topic.RAG paper (Lewis et al.). Done well, the window stays small and relevant across hundreds of turns.

Core techniques to know

Hover over any technique for a plain-English explanation and a link to go deeper.

Sources

Where context comes from

System promptSystem promptThe standing instructions, persona, and rules set before the user request. It is the most stable part of the context and frames every response in the session.Anthropic on system promptsRetrieval / RAGRetrieval / RAGPulling relevant documents from your own data at request time and placing them in the window so the answer is grounded in current, specific facts rather than the model's training.Prompting Guide on RAGTool resultsTool resultsThe outputs returned when the model calls a tool, such as a search result or an API response. They become context for the next step, and they can be large enough to crowd the window.Anthropic on tool use
Selection

Choose what gets in

RelevanceRelevanceFiltering candidate context down to what actually bears on the current task. The win comes from leaving out near-misses, which distract the model and waste budget.Schmid on context engineeringChunkingChunkingSplitting source documents into passages small enough to retrieve and rank precisely. Chunk too large and you waste budget, too small and you lose the meaning that spans them.LlamaIndex on context techniquesRankingRankingOrdering retrieved candidates so the strongest go in first and the weakest get dropped. Position matters because models attend unevenly across a long window.Lost in the Middle (arXiv)
Compression

Make the window last

SummarisationSummarisationReplacing a long passage or stretch of history with a shorter version that keeps the essentials. The standard way to fit a long task into a finite window.Anthropic on context engineeringCompactionCompactionCollapsing an agent's running history into a compact state once it nears the limit, then continuing from there. Common in agents that run for many turns.LangChain on compactionPruningPruningDropping stale or low-value items from the window, such as old tool outputs no longer needed. It keeps the working set small without rewriting what remains.Breunig on fixing context
Failure modes

What goes wrong

Context rotContext rotThe decline in a model's reliability as the window grows longer. Performance degrades well before the hard token limit, so a bigger window carries its own cost.Chroma research on context rotContext poisoningContext poisoningWhen a wrong fact or a bad tool output enters the context and the model keeps building on it. The error compounds across later turns because the model treats it as established.Breunig on how contexts failLost in the middleLost in the middleModels attend best to the start and end of a long context and overlook material placed in the middle. Where you put a fact changes whether the model uses it.Liu et al. (arXiv)

In Practice

Four ways context engineering changes how PMs build and ship AI features

1

When an AI feature fails, look at the context first

A wrong answer is more often a context problem than a model one. The model may never have seen the fact it needed, or it saw the right fact buried under noise. Before you swap models, audit what was actually in the window for the failing case. The fix is usually to add the missing piece or remove the distracting one.

2

Treat retrieval as a context decision

RAG is one source feeding the window, and how you chunk, rank, and trim what comes back shapes the answer as much as the retrieval itself. Pulling ten passages when two would do spends budget and lowers quality. Treat retrieval quality and context quality as the same metric, because the user only sees the result.

3

Agents live or die on context management

An agent that runs for many turns will blow past its window unless something curates the history. Summarisation and compaction keep the working set small enough to stay reliable. When a long-running agent starts drifting or repeating itself, the cause is usually a bloated or poisoned context rather than a weak plan.

4

A bigger window still requires deliberate curation

It is tempting to read a larger context limit as more room to dump in. Reliability degrades as the window fills, and the model loses track of facts in the middle. Plan for a working set you keep deliberately small. Spend the budget on the few things that matter for the current step rather than everything that might.

Curated Resources

Videos

Key Takeaway

The context window is finite working memory, and what you put in it sets the ceiling on what a feature can do. Curate it deliberately, leave out as much as you let in, and manage it over time, and you keep an AI feature reliable long after a good prompt alone would have broken down.