Context engineering
Decide what goes into the model's window at each step, because that is the real interface.
Prompting is writing one good instruction. Context engineering is curating everything the model sees: instructions, retrieved facts, tool results, conversation history and memory, and doing it again at every step of a long task. Quality drops when the window fills with noise, even before the limit is reached.
Useful tactics: keep stable instructions at the top, retrieve instead of preloading, trim bulky tool outputs to what matters, and summarise older turns once they are no longer needed verbatim. Write durable facts to external memory such as files or a database and read them back when needed.
Treat the window as a budget. For each item ask whether the next step would be worse without it. If not, remove it. Smaller, sharper context is usually cheaper, faster and more accurate.
Key points
- The window is a budget. Every token must earn its place.
- Retrieve on demand instead of stuffing everything in up front.
- Compact old history and offload durable facts to external memory.
- Trim tool output at the source.
Answer these out loud
- 1A coding agent reads 40 files and then starts forgetting early instructions. Describe a context strategy that fixes it.
- 2What belongs in long-term memory and what should be recomputed each time?
Use this from an agent
Any MCP client, including Grok, can read this lesson. See how to connect.
curl https://engineeros-delta.vercel.app/api/v1/topics/context-engineering