Anatomy of a context
System, user, history, examples, retrieved data and tool results.
What you’ll learn
System, user, history, examples, retrieved data and tool results.
Who wrote each part, and how far to trust it.
A deliberate order, and removing what pollutes the window.
Why the prompt can’t fix it, and how systems defend in layers.
Applied exercise
Redesign an overloaded assistant context with conflicting instructions, irrelevant history and poor retrieval.
Cheat sheet · for your projects
Leave at the door
| Myth | What’s actually true |
|---|---|
| “A better prompt fixes everything.” | Most failures are what’s in the window. |
| “More context is always safer.” | Irrelevant tokens distract and mislead. |
| “The system prompt is secret and binding.” | It can leak, and users can talk around it. |
| “Ask for JSON and you’ll get it.” | Enforce a schema if you can. Validate always. |
| “One line in the prompt stops injection.” | No prompt fixes it. Limit what the system can do. |