Memory lets an Agent stay consistent. But whatever it remembers might be user data, so you need to decide what gets stored, for how long, and who can see it.
Let's think about it this way for a moment
Keep three kinds of memory in mind. Short-term is the messages in this current conversation. Working memory is a temporary note for this particular goal. Long-term is user preferences or past work. Send everything into the model's context, and you'll burn through tokens and risk leaking confidential information along with it. The good pattern is to include only what's needed. Never store passwords, API keys, phone numbers, or full exam scores in memory.
Let's connect this to everyday life
For a study helper, short-term memory is "which subject was asked about today." Long-term is just a preference like "prefers short, direct points." Never store a full answer key from last week's exam. If you're saving memory to a file, split it into folders too. Never commit logs to git. If a user says "delete what you've remembered about me," design it so that's actually possible.
Let's try it out together
Keep
- preferred language: mm
- last topic: photosynthesis
- today goal: 3 review questions
Never store
- passwords, API keys, phone numbers
- full exam answers
- other people's notes without permissionYou'll be able to sort what an Agent's memory should and shouldn't store.5-minute try-it
Write a memory card for your Agent. Include 3 short-term items, 2 long-term items, and 3 never-store items.
A quick word of caution
Push a memory file to GitHub by mistake, and a user's notes can end up public. Add a .gitignore entry before you start experimenting.