← Exercises

Giving your agent a memory

35 minutes

How this works

Agents wake up every chat with no memory of what happened before. They are an amnesiac genius: brilliant, and starting from zero every time. A big part of making an agent effective is giving it a memory of who you are and what you are working on. The simplest way to give your agent a memory is to create a place on your computer where your agent can read and write notes about who you are, and what you're working on.

1. Context Dungeon

You are about to be the agent. In the Context Dungeon you have no memory of anything before this moment. The only way to figure out what the user needs is to move through the folders and read the files you find while you complete their tasks.

Play until you beat it or the timer runs out. Raise your hand when you win.

Open the Context Dungeon (opens in a new tab)

5:00

Post-game questions

1. What made it easier or harder to finish a task as the agent?

2. Did you find information where you expected it?

3. How would you change the folders and files to make the game easier to beat?

2. Create your personal OS

Now switch sides. You are going to create the folder your agents will use to remember who you are and what you are working on. We call this folder your personal OS.

The Context Dungeon showed you why it matters: the better organized your personal OS is, the faster an agent can get in sync with you. Today it starts as one folder with a few notes. Over the course it grows into everything your agents know about you.

1. Create a folder on your computer. Name it personal-os.

2. Open that folder as a project in Codex.

3. Start a new thread in that folder by selecting the folder in the new chat window.

4. Send the prompt below, then open test.md in the Codex preview and read what Codex wrote. This confirms that your agents can read and write to and from your personal OS.

Prompt: Test your personal OS

Write a short poem about starting something new and save it in a new file called test.md in this folder.

3. Create the first agent memories

Your personal OS is empty. Let's give it its first memories: three notes about you, written by your agent.

Start three new threads in your project, one prompt each. Prompts 1 and 2 run on their own. Prompt 3 is a conversation: answer its questions for the rest of the section.

Prompt 1: Scan my computer

Explore my computer and write a document that explains what I work on, what I care about, and who you think I am. Drop that note inside of computer-scan.md.

Prompt 2: Scan my inbox

Explore my inbox and write a document that explains what the majority of my emails deal with. Notice patterns in frequency and content. Infer what you can about who I am and what kind of work I do based on these patterns. If you need to connect to my inbox, prompt me to go through the setup steps to make the connection. Drop that note inside of inbox-scan.md.

Prompt 3: Interview me

Interview me about my life, my work, and my most important projects. Ask me about the problems in my life, what I care the most about accomplishing in the next six weeks of class, and what I hope my most important outcome will be from taking this class. Continue to ask me questions, one at a time, until I tell you that we're done. Once I tell you that we're done, write everything you've learned about me in class-interview.md.

10:00

4. Reflect

Read

Open computer-scan.md, inbox-scan.md, and class-interview.md in the Codex preview and read all three.

3:00

Share

Get into a group of three with the people around you. Each person gets about a minute:

1. Did the agent seem to understand you from these scans? Why or why not?

2. What did it get right? What did it miss?

3. What kinds of questions did it ask you about yourself?

4:00

5. Wrap up

Your personal OS is now your main agent memory for the rest of the class.

1. Keep notes on everything you are working on here, along with any code and files you create.

2. Your agents can help you clean up and structure your personal OS. Ask them.

3. The better organized and centralized your notes are, the faster your agents get up to speed on your projects.

4. Open Codex threads inside your personal OS and they will read and remember the notes you have put there.