---
title: "Prompting and context"
type: "topic"
url: "https://aifordevs.org/topics/context"
markdown: "https://aifordevs.org/topics/context.md"
publisher: "AI for Devs"
license: "https://aifordevs.org/reuse"
attribution: "Credit AI for Devs and link to https://aifordevs.org/topics/context"
---

# Prompting and context

What goes into the context window and in what order. System prompts, examples, retrieved data, tool results, and memory.

## Articles

- [Context engineering: budget and order the context window](https://aifordevs.org/articles/context-engineering.md): Context engineering is choosing what a model reads on each call. Size each section, order it for prompt caching, trim inputs, and test every layout change. (2026-11-08)

## Glossary terms

- [Context engineering](https://aifordevs.org/glossary/context-engineering.md): Context engineering is the practice of choosing what goes into a model's context window for each call, and in what order: instructions, examples, retrieved documents, tool results, and memory. You treat the window as a limited budget and spend it on what the next step needs.
- [Context window](https://aifordevs.org/glossary/context-window.md): A context window is the maximum number of tokens a model can handle in one request, usually counting the prompt and the output together. Everything the model has to work with for that request has to fit inside it.
- [Prompt caching](https://aifordevs.org/glossary/prompt-caching.md): Prompt caching is a hosted API feature that reuses the processed state of a repeated prompt prefix, such as a long system prompt or a document, across calls. Providers that offer it bill cached input tokens at a discount and return the first token sooner.
- [System prompt](https://aifordevs.org/glossary/system-prompt.md): A system prompt is a set of instructions placed before the conversation that sets the model's role, rules, and output format for every turn. Keeping it stable makes it a good candidate for prompt caching.
- [Temperature](https://aifordevs.org/glossary/temperature.md): Temperature is a sampling setting that divides the model's logits before they are converted to token probabilities. Lower values make output more deterministic, and higher values make it more varied.
- [Top-p](https://aifordevs.org/glossary/top-p.md): Top-p, or nucleus sampling, is a sampling method that keeps only the smallest set of most likely tokens whose probabilities add up to at least p, then samples from that set. The candidate count adapts to how concentrated the distribution is at each step.
