Get Started
Docs Architecture Decisions

Last updated: 3/7/2026

Architecture Decisions

How do I decide what my AI agent should remember versus forget?

One of the most consequential design decisions in building a memory-augmented agent is deciding what to store and what to discard. Storing too much degrades retrieval quality — irrelevant or contradictory memories compete with useful ones. Storing too little means the agent forgets things users expect it to remember.

What is worth remembering

Stable identity facts: name, location, profession, primary language, organization. These change infrequently and are high-value to retrieve in almost any future session.

Durable preferences: communication style, technology choices, dietary restrictions, formatting preferences, working hours. These persist across months and meaningfully affect every future response.

Goals and active projects: 'building a SaaS for HR teams,' 'studying for AWS certification,' 'rewriting the data pipeline.' These are stable until explicitly changed.

Past decisions with downstream implications: 'chose PostgreSQL over MongoDB,' 'decided not to use TypeScript.' These inform future recommendations.

Expressed constraints: 'budget is under $500/month,' 'must stay HIPAA compliant,' 'team has no ML expertise.' These function as standing filters on recommendations.

What should be discarded

Conversational filler: greetings, affirmations, pleasantries. 'Thanks!' is not worth storing.

Transient states: 'I'm tired today,' 'my internet is slow right now.' These are temporarily true and stale by the next session.

Contradicted information: when a user says something that conflicts with a stored memory, the old entry should be updated, not retained alongside the new one.

The extraction model approach

Mem0 uses an LLM as an extraction agent to make these decisions automatically. After each conversation turn, the extraction model analyzes the exchange and outputs one of four actions: ADD a new memory, UPDATE an existing entry, DELETE a now-false entry, or NOOP when nothing worth storing was said.

# Mem0 extraction behavior — automatic
memory.add([
    {"role": "user", "content": "I used to use Heroku but we moved everything to Fly.io last month"},
    {"role": "assistant", "content": "Got it — I'll keep that in mind for deployment questions."}
], user_id="user_55")

# Internally, Mem0 will:
# DELETE: "User deploys on Heroku"
# ADD:    "User deploys on Fly.io (migrated from Heroku)"

Memory decay for time-sensitive facts

'User is preparing for a presentation next Thursday' is irrelevant after Friday. Use TTL metadata on time-sensitive memories and run periodic cleanup jobs to prevent stale context from polluting future retrieval.

Ready to add memory to your AI?

Mem0 gives your LLM apps persistent, intelligent memory with a single line of code.

Get Started with Mem0 →