On each turn the model sees one window, and the code around it decides the contents. The prompt is the instruction in that window, and context engineering selects and orders the other material so this task fits. Memory engineering starts when you move text to an external store and pull it back on a later turn by ID.
Richmond Alake, Director of AI Developer Experience at Oracle, drew that boundary in April 2026. Jerry Liu, co-founder and CEO of LlamaIndex, talked about context and memory in June 2026. Aishwarya Srinivasan, then Head of AI Developer Relations at Fireworks AI, talked about the shift off a single prompt in October 2025.
What is the difference between prompt, context, and memory engineering?
Prompt engineering writes the instruction. Context engineering fills and fits the window for one task. Memory engineering owns what lives outside that window.
Richmond wants the split so the work is clear when you hire and when you describe the role. The early picture of prompting was magic words that make a model behave. The work he saw was RAG pipelines, evaluations of those pipelines, and tools he named, including LangChain and LlamaIndex. With reasoning models, less of the job is wording. His definition of context engineering is the systematic selection of information for the window, aware of the model's constraints. Calling the third job memory engineering says you care whether the system can remember and adapt.
We are expecting that this LLM is going be the magic box where we're going to ask it any sort of questions, follow ups, and it's going to get us the end product. And I think that has quickly changed where people have realized that, hey, it's way more of a software engineering challenge rather than just a model building challenge.
Aishwarya Srinivasan, then Head of AI Developer Relations at Fireworks AI, on Chain of Thought ep 42
How do you choose what the model sees for one task?
Decide before the call. Load the blocks this task needs, and leave the rest in the store.
Jerry's context layer is anything surrounding the model: services, tools, and external data. When the LlamaIndex framework started, models had a 4000 token context window, and a company knowledge base would not fit, which pushed teams toward retrieval-augmented generation. Preparing for a customer call, in his example, means the previous 5 to 10 transcripts and the recent email thread.
The four labels are Richmond's memory types. Working memory is the window or a scratch pad. Semantic memory is the knowledge base. Episodic memory is timestamped interaction, such as conversations. Procedural memory is routines, including skill markdown files. In the agent Richmond showed, each part of the window states the purpose of that memory type, then the content. Before the loop the code mostly reads those stores in. Inside the loop it mostly writes, including steps the agent took, so the next run has them.
Yeah, I think memory is basically just a form of I guess like persistent context.
Jerry Liu, co-founder and CEO of LlamaIndex, on Chain of Thought ep 61
When does shrinking the window become memory engineering?
If you shrink text so this window fits, that is context engineering. If you keep the full text in an external store under an ID, that is memory engineering.
On a long chat that compacts, Richmond split reduction into summarization and storing a chunk outside. Summarization discards the prior window and writes a summary back into it. Moving the uncompressed text out, with an ID and maybe a paragraph description, lets the agent retrieve the original later.
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.
Richmond Alake, Director of AI Developer Experience at Oracle, on Chain of Thought ep 53
Jerry treats that store as persistent context: a database entry, or a pool of files an agent can update and read. He has not spent much time on graphs or synthesized summaries. Richmond says files are enough for a demo you have to show quickly. Once the system is in front of customers and writes can conflict, he wants a database.
How do you pack one turn under a token budget?
Place the system prompt and the task, then the memory file, then retrieved documents. Skip any block that would pass the budget, and keep its ID.
A minimal sketch to adapt, not a drop-in library.
def assemble_turn(task, budget, reserve_output=256):
window = [
{"role": "system", "content": load_system_prompt(task)},
{"role": "user", "content": task},
]
used = count_tokens(repr(window)) + reserve_output
if used > budget:
raise ValueError("budget too small for the instruction, task, and output")
deferred = [] # ids left in the store for a later turn
candidates = [("memory.md", read_memory_file("memory.md")), *retrieve(task)]
for block_id, text in candidates:
block = {"role": "user", "content": text}
cost = count_tokens(repr(block))
if used + cost > budget:
deferred.append(block_id)
continue
window.append(block)
used += cost
return window, deferred
count_tokens and retrieve are placeholders, and retrieve returns (id, text) pairs. A block that does not fit stays in the store, and its ID goes in deferred. Resolving that ID later is memory engineering. A summary you create only to fit this call is context engineering.
FAQ
Is the system prompt context engineering?
The wording is prompt engineering. Richmond places prompt techniques in the window beside token budgeting and composition, which he calls context engineering.
Do files count as memory?
They do when a later turn retrieves them. Jerry uses a pool of files as a simple first memory. Richmond counts files as memory engineering, and he wants a database once the system is in front of customers and writes can conflict.
How should old memories lose priority?
Lower a score instead of deleting the unit. Richmond cited the 2023 Generative Agents paper from Stanford: relevance, recency, and importance. Recency comes from a timestamp, relevance is semantic similarity, and importance might reflect how many other memory units relate to or call that unit. He said there is no industry standard for this.
Takeaway
- Keep the instruction in its own block.
- Name the memory notes, documents, recent turns, and tools you will load on this call.
- If text will not fit, store the original under an ID or put a summary in the window, and record which you did.
- Start each memory type with a purpose line, then the content.
- Rank stored units by relevance, recency, and importance so stale items sink and the record stays.
The longer explainer, with the episode clips, is on Chain of Thought. It draws on this episode.
Subscribe to the Chain of Thought newsletter for new episodes and write-ups like this one.
Drafted with AI assistance from the episode transcripts.
Top comments (0)