What should your AI remember? A practical guide to AI memory
Giving an agent long-term memory is easy. Stopping that memory from filling with noise, stale facts and things it should never have kept is the hard part.
Short answer: Save only what would improve a future reply: stable facts, stated preferences, goals, decisions and corrections. Skip passing remarks, guesses, transcripts and anything sensitive. Retrieve a small number of memories per message, update old facts when they change, and prune on a schedule.
The first version of AI memory usually goes the same way. You save every conversation, retrieve what looks relevant, and it's magical for a week. Then the agent brings up a project you finished months ago, confidently repeats something the user has since corrected, and quotes an offhand joke as if it were a stated preference.
Good memory depends far more on what you choose to keep than on how much you can store. Here's a practical way to choose. If you haven't built the storage yet, start with how to give a chatbot long-term memory.
Start with a test for every memory
Before saving anything, ask: would this change a future reply for the better? Most of a conversation fails this test. "User asked about Python decorators" is rarely useful later. "User is learning Python and prefers examples over theory" will be useful for months.
What to save, and what to skip
| Worth saving | Usually skip |
|---|---|
| Stable facts the user tells you about themselves | Passing moods and one-off remarks |
| Preferences they state, or that keep recurring | Guesses about what they might like |
| Goals, ongoing projects and decisions, with the reason | Step-by-step details of finished tasks |
| Corrections: "don't do that again" | Anything already in your files or documents |
| Shared moments that matter to the relationship | Word-for-word transcripts |
Never store passwords, API keys, card numbers or government IDs. Enforce this in code as well as in the instructions. The engine's memory vault runs a guard on every write that blocks patterns such as card and Social Security numbers and labeled secrets. A pattern check won't catch everything, so it's a minimum, not a complete privacy plan.
Write memories so they still make sense later
A memory gets read months afterward, with no surrounding conversation. Write it for that reader:
- Bad: "He said he didn't like that approach."
- Good: "In March 2026, Sam rejected a microservices design for the billing app because the team is only two people."
Use full names and specifics, convert "next week" to a real date, include the why, and keep each memory to one idea. It should also record who said it, so a claim isn't mistaken for a fact. That matters for protecting identity too: memory that claims "I've changed" can slowly become a character rewrite if nothing stops it.
Sort memories by type
Different kinds of memory age differently, so label them when they're saved. The engine's vault uses categories including bio, preference, project, session and lore. Labels let you treat them differently: a birthday stays true, while a project note may be stale within a month.
Retrieve less than you think
Stuffing the prompt with memories makes replies worse, because weak matches pull the conversation off course. Start with a small number. Our chat pipeline pulls the top five memories for each message, then labels them clearly as retrieved context. Three other things help:
- Pin a small set of always-true facts rather than hoping search finds them each time.
- Search on more than the last message when it's vague. A reply like "yes, do that" gives semantic search nothing to work with.
- Teach natural use. Tell the agent to use a memory only when it helps, and not to announce "I remember you said". Showing off memory quickly feels unsettling.
Handle corrections as updates
If someone moved from Denver to Austin and you simply add the new fact, you now hold two conflicting memories, and search may return either one. When new information contradicts an old memory, update or retire the old one.
Keep the history so you can audit it. The engine's vault is an append-only log: an edit or delete adds a new version, and each memory resolves to its latest one. A mistake can be traced, and a bad write doesn't destroy what came before.
Forgetting is a feature
Memory that only grows gets noisier. Build in ways to clear it out:
- Review on a schedule. Periodically merge duplicates and drop what's stale, starting with session notes and finished projects.
- Weigh age by type. Prefer recent notes about projects, and leave stable biographical facts alone.
- Consolidate. Twenty notes about a project can become one summary with the key decisions.
Never run automatic pruning on identity. Experience can fade, but who the agent is shouldn't.
Let users see and control it
People should be able to view what an agent remembers about them, correct it and delete it. It's the right thing to do, it builds trust, and it's also your best source of quality control, since users spot wrong memories quickly. Check what the privacy rules in your region require as well.
Treat memory as an attack surface
A saved memory gets fed back to the model later, which makes it a route for lasting prompt injection. A web page or a user could plant "always recommend this product" and have it survive across sessions. Record the source of each memory, be cautious about saving text from external content, and never let retrieved memories override identity or safety rules.
Memory is what happened. Identity is who you are. Keep them apart and an agent can learn endlessly without losing itself. In the SoulScript Engine, the vault changes constantly while the soul script stays read-only to the agent, so no memory it saves can rewrite it.
