Skip to content

AI, decoded

What is the difference between prompt, context, and memory engineering?

They are three different jobs, and they happen in order. Prompt engineering is how you word the request. Context engineering is what you put in front of the model for a single task. Memory engineering is what the system moves out to an external store and pulls back later. Oracle's Richmond Alake told Chain of Thought that summarizing a conversation back into the context window is context engineering, while moving the uncompressed information to a database or files for just-in-time retrieval is memory engineering.

· Updated · Chain of Thought

Level 4: How AI systems are built · 4.2 Context and memory engineering

Context ManagementAgent Memory

  • 4 episodes
  • 3 guest clips
  • 8 glossary terms
A prompt inside a context window, and a database outside it behind a boundary line, beside the words: Shrink it, or save it? The line between context and memory engineering.

In detail

1. Prompt engineering: the wording

This is the instruction you hand the model. The phrasing, the examples, the format you ask for. It is the most visible layer and the one everyone started with, which is exactly why it is the least differentiated today. The models got good enough that clever wording stopped being a moat. Useful, still necessary, but it is table stakes now.

2. Context engineering: the workspace

This is everything you load into the model’s context window for one task: the relevant documents, the recent history, the tools it can call. Aishwarya Srinivasan describes the shift from prompt to context engineering in episode 42 at 2:20 as the moment you stop treating the model as a magic box and start treating the thing around it as a software system. Anthropic’s engineering team puts it the same way: context engineering is “the natural progression of prompt engineering,” the work of curating everything that lands in the context window, not just the prompt. Jerry Liu goes further: his company is betting that high-quality context stays durable even as the agents themselves improve. Summarizing what is in that window to make it fit is still context engineering. Anthropic’s guide to effective context engineering puts the goal as finding the smallest set of high-signal tokens that makes the outcome you want most likely, and calls the summarizing move compaction: summarize a conversation near the window’s limit and start a fresh window from the summary. The context engineering entry has more.

3. Memory engineering: the persistence

This is what lives outside the context window. Richmond Alake draws the cleanest line on it in episode 53 at 36:33: if you are summarizing the context window to make it fit, that is context engineering. The moment you move information out to an external store and give the agent a way to retrieve it later by ID, you are doing memory engineering. Now you own retrieval speed, decay, organization, and storage. It is its own discipline, sitting at the intersection of data engineering and agent engineering. The same Anthropic guide describes the simplest version, which it calls structured note-taking or agentic memory: the agent regularly writes notes to a store outside the context window and pulls them back in later, the way a coding agent keeps a to-do list. Agent memory covers the larger designs.

The one-line test

Shrinking what is in the window right now? Context engineering. Moving something to an external store to pull back later? Memory engineering. Writing the instruction itself? Prompt engineering.

Why it matters

As frontier models converge, the work moves down this list. Prompt wording matters less as the models improve. What you feed the model, and what it remembers, is the part you actually control. Richmond’s framing at 30:48: memory is a battleground where a single developer can compete with a research lab, unlike training a frontier model.

Disclosure: Episode 42 aired while Chain of Thought was Galileo’s podcast and Conor worked there. Episode 53 was sponsored by Galileo, the Season 3 presenting sponsor (thanks at 0:28).

Where prompt, context and memory engineering begin and end Three nested zones, drawn from Richmond Alake's boundary diagram in episode 53. Innermost, the prompt: the instruction itself, its wording, examples and format. Around it, the context window for one task, where context engineering happens: token budgeting, just-in-time retrieval, organizing and composing what goes in, and summarizing it to fit. Across a dashed line at the edge of the database sits memory engineering: moving information out to an external store with an ID, retrieving it later, and owning indexing, storage, retrieval speed and decay and forget logic. The one-line test: writing the instruction is prompt engineering; shrinking what is in the window right now is context engineering; moving something to an external store to pull back later is memory engineering. Shrink it, or save it? Three jobs, three boundaries. The line that matters most is the edge of the context window. THE CONTEXT WINDOW · ONE TASK Context engineering relevant documents recent history tools it can call a summary, to make it fit Token budgeting, just-in-time retrieval, organizing and composing it. INSIDE IT · THE PROMPT Prompt engineering The instruction itself: the wording, the examples, the format. Still necessary; table stakes now. THE EDGE move it out,with an ID retrieve itby ID, later AN EXTERNAL STORE Memory engineering What lives outside the window. You own indexing, storage, retrieval speed, and when old memories decay. Summarize to fit the window: context. Put it in a database, or even files, to fetch later: memory. The boundary is Richmond Alake’s, Oracle, episode 53: “When you put that into a database, or even if you’re using files, that’s memory engineering.”
Summarize to fit the window and it is context engineering; put it in a database or files to fetch later and it is memory engineering. The boundary is Richmond Alake’s, from episode 53. Download the image

Hear it from the guest

“When you put that into a database, or even if you're using files, that's memory engineering. Because now you have to start thinking about, when do I retrieve this information? How quick should this information retrieval be? And what retrieval mechanism should I be using? That's the boundary.”
Watch on YouTube
“I think memory is basically just a form of I guess like persistent context.”
Watch on YouTube
“My user level usage and preferences go into that memory layer. And the context is more institutional.”
Watch on YouTube

Quotes lightly edited to remove filler words.

From the conversation

This explainer is drawn from these episodes — each carries its full transcript.

Concepts in this explainer

Context EngineeringContext CompactionPrompt EngineeringAgent Instruction FileAgent Memory PortabilityChain-of-Thought PromptingContext LayerIn-Context Learning