AI Agents & GovernanceAI Agent Memory

AI Agent Memory: What Should an Agent Remember and Forget?

Hand writing a checklist in a notebook beside a laptop
Photo by Jakub Żerdzicki on Unsplash.

TL;DR

An AI agent needs memory when its work continues beyond one chat session. It may need to retain an approved preference, a past decision, an open task, or a workflow that worked before.

It should not save everything.

A well-designed memory system stores information only when there is a clear reason to keep it. Each item needs a source, access rule, and retention period. Old details should expire. Sensitive information should not be stored without a reason. People should be able to correct or remove personal information.

The rule is simple:

Remember less. Keep clear records. Let people correct what the agent keeps.

Why Agents Need Memory

A short chatbot conversation can end without leaving anything behind. The user asks a question, gets an answer, and moves on.

An agent often handles work that continues over time. It may need to:

  • Continue a task started yesterday
  • Remember an approved user preference
  • Track the status of a request
  • Follow a recurring process
  • Recall a previous decision
  • Avoid repeating a failed step
  • Follow rules for a specific team or project

Without memory, the agent starts from zero each time. Users have to repeat themselves. The agent may lose track of a request or ignore a decision made earlier.

Agent memory is the part of the system that stores and retrieves useful information across tasks or sessions. This can include current task details, long-term facts, past events, and approved process steps.

RAG, Memory, and Context Do Different Jobs

These terms are often used together, but they are not the same thing.

Context

Context is what the agent needs for the task happening now.

It may include the user’s question, current location, role, selected project, recent messages, and tool results.

Much of this information can disappear after the task ends.

RAG

RAG searches an approved knowledge source when the user asks a question.

For example, the system might retrieve a policy, product manual, price sheet, or project report. It does not need to turn that document into permanent memory just because it used it once.

RAG answers:

What does the source material say?

Memory

Memory stores information that may still matter later.

Examples include:

  • A user prefers concise answers
  • A project manager approved a deadline change
  • A maintenance request is still open
  • A tool sequence failed during a previous task
  • A user does not want reminders after 8 PM

Memory answers:

What happened before, and what should carry forward?

RAG retrieves from an existing knowledge source when needed. Memory stores information that survives across sessions. They can work together, but they should not be treated as one system.

The Main Types of Agent Memory

Working memory

Working memory holds details for the task in progress.

It can include the current goal, recent messages, tool outputs, and temporary calculations.

It should usually disappear when the task is finished.

Short-term memory

Short-term memory covers a recent session or a limited period.

For example, it may retain an open support issue until the issue is resolved or the session expires.

Long-term memory

Long-term memory stores details that remain useful across sessions.

Examples include:

  • A customer’s preferred contact method
  • A project’s approved naming convention
  • A user’s accessibility preference
  • A recurring business rule

Long-term memory needs an owner and a way to update, correct, or delete it.

Episodic memory

Episodic memory records a specific event.

For example:

  • A deployment failed on July 2 and was rolled back.
  • A customer declined a proposed appointment time.
  • A technician completed an inspection at a site.

It helps the agent understand what happened before.

Semantic memory

Semantic memory stores facts.

Examples include:

  • The finance team approves invoices.
  • A property belongs to a certain portfolio.
  • A customer uses an enterprise plan.

Facts can become outdated. The system needs a way to replace or review them.

Procedural memory

Procedural memory stores how a task should be done.

Examples include:

  • The steps for handling a refund request
  • A process for preparing a monthly report
  • The approval path for a maintenance work order

This should come from an approved workflow, not an unreviewed agent guess.

What an Agent Should Remember

Before saving a memory, ask:

  • Will this matter in a later task?
  • Do we know where it came from?
  • Is it accurate enough to keep?
  • Would the user expect the agent to remember it?
  • Is there someone responsible for updating it?
  • Can it be corrected or deleted?

Good candidates include:

  • Preferences that help future interactions
  • Open tasks and their status
  • Approved decisions and commitments
  • Project-specific rules
  • Verified facts with a known source
  • Past failures that help prevent the same mistake
  • Workflows approved by the responsible team

Each saved item should carry more than plain text. It should include:

  • Its source
  • The date it was created
  • The person or system that supplied it
  • Its scope, such as one user, team, project, or organization
  • Confidence level
  • Retention date
  • Permission level

What an Agent Should Forget

Saving every message causes privacy, cost, and accuracy problems.

An agent should avoid retaining:

  • Full chat transcripts by default
  • Passwords, API keys, and access tokens
  • Sensitive details that are not needed
  • Unverified claims
  • Temporary information with no future purpose
  • Information copied from an unrelated conversation
  • Old preferences that no longer apply
  • Information a user asked to remove

Memory should expire when it no longer serves a purpose.

A booking preference may be useful for months. A delivery instruction may matter for one day. A project update may become wrong after a new decision.

Every memory type needs a rule for how long it remains valid.

When an Agent Must Ask Permission

An agent should ask before saving information that a reasonable person would not expect it to keep.

This can include:

  • Preferences used in future sessions
  • Health, financial, or sensitive personal information
  • Exact location history
  • Details from a private work conversation
  • Long-term records from customer interactions
  • Data used to personalize future recommendations

The request should explain what will be saved and why.

Weak request:

Can I remember this conversation?

Better request:

You said you prefer maintenance updates by SMS. May I save that preference for future service requests?

The user should be able to decline without losing access to the main service.

Memory Needs Scope, Source, Expiry, and Access Rules

A memory system needs rules before it needs a vector database.

Each memory item should answer four questions.

Scope

Who does this memory belong to?

It may belong to one user, one team, one project, one property, or the whole organization. A memory from one customer should never appear in another customer’s chat.

Source

Where did it come from?

The system should record whether it came from a user, approved document, connected business system, or human reviewer.

Expiry

How long should it remain valid?

Some items can expire automatically. Others need a scheduled review. A three-year-old preference should not be treated as current without checking.

Access

Who can view or change it?

A user may be allowed to update their own preferences. A manager may be able to see project decisions. Only authorized systems should update approved workflows.

A vector search can find text that appears similar to a question. It cannot decide whether the text is current, permitted, or reliable.

A memory system needs filters for:

  • User or tenant
  • Role and permission
  • Project or location
  • Date and expiry
  • Source quality
  • Confidence level
  • Memory type

For example, an agent should not retrieve one customer’s contact preference for another customer just because the wording is alike.

Similarity search finds possible matches. The policy layer decides whether the agent can use that memory.

How to Test Agent Memory

Do not only test whether the agent can remember a fact.

Test whether it remembers the right fact for the right person at the right time.

Useful tests include:

  • Does it retain an approved user preference?
  • Does it avoid saving a sensitive detail without permission?
  • Does it remove expired information?
  • Can a user correct a false memory?
  • Can a user ask for deletion?
  • Does the memory stay within the correct user, team, and project?
  • Can it distinguish a past event from a current fact?
  • Does it avoid repeating a known failed workflow?
  • Can it show the source of a stored decision?

Review failures often. A wrong memory can affect later conversations and actions.

Frequently Asked Questions

What is AI agent memory?

AI agent memory is the part of an AI system that stores and retrieves useful information across tasks or sessions. It can include preferences, decisions, task state, past events, and approved workflows.

Is AI agent memory the same as RAG?

No. RAG retrieves information from a knowledge base when the system needs it. Memory stores information that should continue from one interaction to another.

Can agent memory increase hallucinations?

Yes. Problems happen when an agent stores unverified or outdated information. Source records, expiry rules, review processes, and correction tools help reduce that risk.

Can users delete what an agent remembers?

They should be able to correct or remove personal information stored about them. The process depends on the system’s purpose and the privacy rules that apply.

Does every agent need long-term memory?

No. An agent that handles one short task may only need working memory. Long-term memory is useful when users return, work continues over time, or the agent needs to carry forward an approved decision.

Is a vector database enough for agent memory?

No. A vector database stores and searches text by similarity. It does not decide what should be saved, who can see it, when it expires, or how a user can correct it.

Remember Less, Prove More

Memory can make an AI agent more helpful over time. It can also cause privacy, cost, and trust problems when it is poorly managed.

The answer is not to save every message. Save only information the system has a valid reason to keep.

Record the source. Set a scope and expiry date. Ask permission when the information affects a person. Give users a way to correct or remove their data.

An agent that remembers carefully is easier to trust.

Sources