Context and memory · about 15 minutes of study

Context engineering

Context engineering selects and organizes the instructions, evidence, state and tool information supplied to a model for a particular task.

Before you start: Review Tool calling first. Python-like examples use variables, lists and functions.

Guided concept walkthrough

Follow the mechanism

Inventory

List task, instructions, state and sources.

1 / 4

A conceptual animation, not a live model trace. Play advances every five seconds and stops at the final stage.

Start with an everyday explanation

Preparing an exam desk means bringing the right pages rather than every book you own. Relevance, order and available space matter.

See a concrete example

A 4,000-token evidence budget might include a policy clause and claim record while excluding an unrelated renewal email. Preserve the sources of included facts.

A claim to question

More context is not automatically better context.

Try before revealing the answer

Rank five candidate documents by relevance, authority and freshness. Explain what you would drop first.

Show the worked answer

Drop irrelevant or duplicate material before essential authorized evidence. Preserve instructions and enough provenance to verify citations; report when the remaining budget cannot support a reliable answer.

Now explain the idea to someone else using your own example. If you cannot explain a stage, revisit it before moving on.

Your explanation and revision notes

Loading local notes…

Read the primary reference

Lost in the Middle

The explanation and exercises are original teaching material. The linked source provides background; examples and assumed numbers here are not claims about a particular company.