85 agentic tools audited for security incidents · Talk to the lab →
MotionticBook a call
Glossary

What is long-term memory in AI agents?

Long-term memory in an AI agent is information stored outside any single session, such as user preferences, past decisions or learned facts, that the agent writes deliberately and recalls in later sessions.

Short-term memory is the session: the history and state of one conversation or run, trimmed or summarised to fit the window. Long-term memory is what survives after that session closes, so the next one starts knowing something.

The labs split the two the same way. Google's ADK documentation calls session state short-term memory during one chat and the memory service a searchable long-term store. OpenAI's cookbooks treat trimming and summarisation as short-term tactics and a separate notes store as long-term memory. Anthropic's memory tool exists to carry learning across sessions.

Short-term and long-term memory

  • Short-term

    One session's messages, tool calls and state. Managed by trimming, summarisation, compaction and context editing. Discarded or archived when the session ends.

  • Long-term

    Selected facts promoted out of sessions into a durable store: files, a database, or a vector or keyword index. Recalled into later sessions when relevant.

  • The boundary

    The hard design question is what crosses from one to the other. Storing whole transcripts is easy; storing the right facts, deduplicated and up to date, is the work.

Writing memories

Google's memory service ingests finished sessions; its managed Memory Bank uses a model to extract meaningful information and consolidate it with existing memories, while simpler services keep full conversations. OpenAI's personalization cookbook stages candidate notes during a session and consolidates them at the end, removing duplicates and letting the most recent update win conflicts.

The same cookbook sets write rules worth copying: store only what the user stated explicitly, never inferences, never instruction-like text, and never sensitive data such as payment details or account numbers.

Recalling memories

  • Reactive

    The agent calls a memory tool when it recognises a gap, as with ADK's load memory tool or Anthropic's memory tool.

  • Proactive

    The harness searches memory against the latest input and injects matches before the model runs, as with ADK's preload memory tool.

  • State injection

    A compact profile and notes are rendered into the prompt at the start of every run, the approach OpenAI's personalization cookbook prefers when continuity matters more than breadth.

Where it fails

  • Stale facts recalled with confidence

    The cookbook calls forgetting essential: without pruning, a store fills with superseded preferences. Recency weighting, confidence scores and expiry dates are the suggested remedies.

  • Over-influence

    A remembered preference can override what the user is asking for now. The cookbook's precedence rule puts the latest user message above everything stored, and asks the agent to clarify on conflict.

  • Memory poisoning

    Anything written to memory is replayed into future prompts, so instruction-like content stored once can steer every later session.

How Motiontic's engineers apply it

Motiontic's engineers treat long-term memory as a data product with an owner: a schema, write rules, retention limits, an audit trail and a way for users to see and delete what is stored. Memory has its own evals, covering what gets written, what gets recalled and whether recall changes the answer for the better.

Ways to recall long-term memory

Ways to recall long-term memory
Reactive tool callProactive preloadState injection
Who decidesThe modelThe harness, by searchThe harness, always
Token costOnly when usedEvery turn, for matchesEvery run, for the whole profile
RiskModel forgets to lookIrrelevant matches crowd the promptProfile grows stale or too large
FitsLarge, rarely needed storesPersonal assistants and supportSmall, high-value preference sets

Common questions

What is the difference between short-term and long-term memory in AI agents?

Short-term memory is the history and state of one session, trimmed or summarised to fit the context window. Long-term memory is selected information kept after sessions end and recalled in later ones.

How do AI agents store long-term memory?

In files, databases or search indexes outside the model. Memories are written by the agent or extracted from finished sessions, then recalled by a tool call, a search before each turn, or injection at the start of a run.

How do agents forget outdated memories?

Through consolidation that removes duplicates and lets newer facts replace older ones, plus expiry dates, recency weighting and user-facing deletion. Without these, stale facts accumulate.

Running agents that have to hold up?

Describe the agent, the systems it touches and what it must never get wrong. The first call is with a lab engineer, who will say plainly whether it is ready for production, and whether Motiontic is the right team.