Module 3 · Agent Tools, Knowledge, Memory & Research Design · scripted

Exercise: The Memory Lab

45 minoutcomes: knowledge-systems, context-engineering

The goal: give a chatbot a memory — and own both halves

You know what memory really is now: files between conversations, an extractor that writes them, a recaller that brings them back. In this exercise you run all of it — a live chat whose memory system is built from two prompts that you design: the extraction prompt (what counts as a memory, and how the files are organized) and the recall prompt (the strategy for finding what matters before each reply). The machinery is real: two background agents with filesystem tools, working over a memory store you can open and read at any moment.

The lab

How the two agents work

The extractor runs in the background after each reply, receiving the full current conversation. Only one instance ever runs: if the conversation moves on while it is busy, it simply runs again when it finishes, on the newest complete transcript — so it can file several memories at once. It has the full filesystem vocabulary — list, search, read, write, and edit — so it can update and correct the memory, not just append to it.

The recaller runs when you send a message, before the assistant replies. Watch the status bubble: instead of "thinking…", you'll see its actual moves — searching for "thesis"… reading memories/projects.md… — until it commits to a list of recalled memories. Those are inserted under your message, visibly, as the chips the reply was built on.

What the model actually receives

user:Can you suggest a restaurant for Friday?
[recalled memories — from earlier conversations]
The user is vegetarian.
The user lives in Molde.

The reply feels like memory. It is prompt construction — performed by an agent, priced in tokens, and visible here.

The exercise at a glance

  1. 1
    Step 1: watch memory happen with the default prompts — extraction, forgetting, recall.
  2. 2
    Step 2: design the extraction prompt, then stress it with a correction.
  3. 3
    Step 3: design the recall prompt — then engineer its failures.

The exercise playground

For this exercise we have built an exercise playground — the Memory Lab — to help you do it: a live chat whose memory system is built from the two prompts you design, with real background agents doing the extracting and recalling.

You can also do the exercise in ChatGPT, Claude, or Gemini instead — if you're going to use one of those tools, click here for the instructions →.

How the playground works

  1. 1
    Open it: /exercises/memory-lab — or scan the QR code on the next card.
  2. 2
    The two prompts sit at the top: extraction and recall. Edit them there.
  3. 3
    Chat below — and watch the status bubble show the recaller's actual moves before each reply.
  4. 4
    Browse the memory files and every extraction run (its tool calls, reasoning, and summary) below the chat.
  5. 5
    Press "New conversation" to make the chat forget — the files survive.

Scan to open the Memory Lab

Scan to open the Memory Lab
ai-agents-seminar.vercel.app/exercises/memory-lab

Step 1 · Watch memory happen

Keep the default prompts. Have a genuinely memorable conversation — introduce yourself, your research topic, a preference or two, a decision ("let's call the study STAGE-2 from now on"). Watch the extraction runs appear and open the files they wrote. Then press New conversation — the chat forgets everything; the files survive — and ask something that deserves recall: "what should I cook for the celebration when my study gets approved?" Watch the status bubble search before the reply arrives.

Capture — end of Step 1

💾 Save this before you move on

Copy into your course document and save:

  1. 1One extraction run: what it stored, and its one-line summary.
  2. 2The recall moment: your question, the recalled chips, and one phrase in the reply that only memory can explain.

Step 2 · Design the extraction

Now replace the default extraction prompt with your own design. Decide what a memory IS for your use case, and how the store is organized — this is a containers-and-conventions decision, and the searching-recaller is your reader: name files with the words recall queries will use. Then stress it: tell the assistant something, and later correct it ("actually, the study is called STAGE-3 now"). Open the files: did the extractor edit the old fact, or append a contradiction? Does your prompt even tell it which to do?

Capture — end of Step 2

💾 Save this before you move on

Copy into your course document and save:

  1. 1Your extraction prompt, verbatim.
  2. 2The correction test: both versions of the fact as stored — or the edit that replaced one with the other.

Step 3 · Design the recall — then hunt its failures

Rewrite the recall prompt with an explicit strategy, and then try to break it both ways. Force a false positive: ask something harmless and see whether irrelevant memories get dragged in anyway — does the reply bend toward them? Force a miss: ask about something you know is stored, phrased in words that don't appear in any file — synonyms are the classic hole. Each failure is a design lesson: the false positive is a relevance-threshold problem in your prompt; the miss is a naming problem in your files.

Capture — end of Step 3

💾 Save this before you move on

Copy into your course document and save:

  1. 1Your recall prompt, verbatim.
  2. 2One failure you engineered: the question, what was recalled (or missed), and what it did to the reply.
  3. 3The fix — a prompt clause or a file rename — and the rerun.

Before we regroup

💾 Save this before you move on

Copy your three captures into your course document and save — the comparison looks at extraction prompts side by side (what counted as "worth remembering"?), the correction-test results (edit versus append is the relay's staleness debate replayed in one afternoon), and the engineered failures — this exercise's real product, because every commercial "memory" feature has exactly these failure modes, invisibly.

Copy into your course document and save:

  1. 1All three captures above, in your course document.

Be ready to discuss:

  • What did your extractor store that it SHOULDN'T have? Where is the line between remembering and surveilling — and who sets it?
  • A recalled memory arrives with total confidence, even when it's stale or wrong. How would you make the main assistant appropriately uncertain about its own memory?
  • The recall chips make retrieval visible. Products hide them. What does that hiding buy, and what does it cost the user?
  • Your whole memory system is two prompts and five file tools. What would you need to add before you'd trust it for a year of conversations?