Lesson 04.01 · Phase 04 · Memory & Context Engineering

Context is the program

The model only knows what is in the window right now. Choosing what goes in, in what order, and what gets dropped is the real program you are writing.

Learning objectives

  • Explain why a model's answer is a function of its context window, and why "memory" always means "something put back into that window".
  • Implement a context builder that assembles named sections with a priority and a position, and fits them into a token budget.
  • Predict which section a budget will drop, and what the answer loses when it goes.
  • Design an experiment that measures how a real model's answer changes with the context.

A customer told your support agent last week that she is allergic to nickel. Today she asks which kettle to buy. The agent recommends the stainless-steel one.

Loading the full lesson…