# Context Engineering

- **Canonical URL:** https://getaimath.com/dictionary/context-engineering/
- **Topics:** [Context, Memory & Retrieval](https://getaimath.com/dictionary/category/context-memory-and-retrieval/)
- **Last updated:** 2026-11-25

## What is Context Engineering?

**In one sentence:** Context engineering is the practice of carefully designing everything a model sees, like instructions, examples, retrieved documents, tools and memory, to get the best results.

It goes beyond writing one good prompt. It is about building a system that assembles the right information at the right time for each step, especially for AI agents working on long tasks.

![Context Window vs. Memory: Your Desk vs. The Filing Cabinet — Simple cartoon comparing the AI Context Window (a small desk that can only fit a few pages right now) with External Memory & Search (a big filing cabinet where a librarian grabs just the 3 pages you need).](https://getaimath.com/diagrams/context-memory-and-retrieval.png)
*Napkin Diagram (Context, Memory & Retrieval): The context window is the small desk the AI can see right now; search grabs the right pages from the filing cabinet.*

## What is an example of Context Engineering?

An agent that automatically pulls the right files, past decisions and tool results into its context before each step uses context engineering.

## Why does Context Engineering matter?

As AI systems grow more complex, what the model sees matters as much as the model itself.

## Related Concepts

- [Context Management](https://getaimath.com/dictionary/context-management/): Context management is deciding what information goes into a model's limited context window, and what stays out.
- [Context Compression](https://getaimath.com/dictionary/context-compression/): Context compression shrinks the information in a model's context so more fits or it costs less.
- [Context Overflow](https://getaimath.com/dictionary/context-overflow/): Context overflow is what happens when there is more text than fits in a model's context window.
- [Context Rot](https://getaimath.com/dictionary/context-rot/): Context rot is when a model gets worse at using information as its context gets longer and more cluttered.
- [Context Length](https://getaimath.com/dictionary/context-length/): Context length is the number of tokens a model can handle at once, or how many tokens are currently being used.
- [Long Context](https://getaimath.com/dictionary/long-context/): Long context means a model can handle very large inputs, often hundreds of thousands or millions of tokens.

---
Source: The AI Math Dictionary (https://getaimath.com/dictionary/context-engineering/)
