Context Engineering
Constructing the information an agent sees: selection, compression, ordering, budgets.
The context window is the only input the model has; assembling it deliberately from instructions, request, history, retrieved knowledge, tool results, memory and state is the real program you are writing.
Decide what earns a place in the window, then shrink it: summarise history, truncate tool output, and extract facts instead of pasting raw dumps.
Models attend unevenly across the window: content at the start and end is used reliably, content in the middle is often ignored — so order the context on purpose.
Give every context section a token budget, measure real usage with the tokenizer, do the cost arithmetic before launch, and use sliding windows so history has a fixed size.
Build the context fresh at every step from state, retrieval and tool results; keep the stable prefix byte-identical for caching; and prefer code over templates once logic appears.