Member-only story
Introduction #
In the rapidly evolving field of artificial intelligence, context engineering has emerged as a cornerstone discipline for building effective AI agents powered by large language models (LLMs). While prompt engineering focuses on crafting a single well-worded instruction, context engineering operates at a broader level: it governs everything an LLM sees at inference time, including system instructions, conversation history, retrieved documents, tool definitions, tool outputs, and memory. As Andrej Karpathy has described it, context engineering is the “delicate art and science of filling the context window with just the right information for the next step.”
The context window functions much like a computer’s RAM: it is the model’s limited working memory, holding everything it can actively reason over at a given moment. This is distinct from the model’s weights, which act more like long-term memory encoded during training and cannot be updated on the fly. Modern LLMs have expanded these windows considerably (Claude models, for instance, support context windows in the hundreds of thousands of tokens, with some configurations reaching beyond a million) but the space remains finite relative to the volume of documents, tool outputs, and conversational history a…