What context engineering means
Context engineering is the discipline of deciding what information an AI agent should have in front of it for a given task — and getting it there at the right moment. Prompting is one part; the larger part is curating memory, retrieval, and tool outputs.
As models got capable, the bottleneck shifted from 'can the model do it?' to 'does the model have the right context to do it?'. That's the problem context engineering solves.
Relevance beats volume
The biggest mistake is assuming more context is better. Dumping an entire repo into the window buries the few facts that matter and costs tokens and latency. Attention is finite; noise crowds out signal.
Curate ruthlessly: the architecture, the constraints, the specific files in play. A small, relevant context outperforms a large, generic one almost every time.
The three tools of context
Persistent memory (a maintained project file) carries durable facts across sessions. Retrieval pulls in the specific snippets a task needs on demand. Tools let the agent fetch fresh state — run a query, read a file, hit an API — instead of guessing.
Each addresses a different gap. Reaching for the wrong one (e.g. retrieval when you needed a stable convention) is a common source of agent drift.
Budget the context window
Treat the context window as a budget, not infinite space. Spend it on what changes the answer: constraints, the relevant code, recent decisions. Trim transcripts and boilerplate that no longer earn their place.
When sessions get long, summarize and re-anchor. A deliberate budget keeps the agent from quietly dropping the rule you set 200 messages ago.
Make it repeatable
Reliability comes from doing this the same way every time: a known memory file, a known retrieval strategy, known tools. Ad-hoc context produces ad-hoc results.
Document the setup so every teammate and every agent starts from the same context. That repeatability is what turns an impressive demo into a dependable workflow.