---
title: "What is long-term memory in AI agents?"
description: "Long-term memory gives an AI agent knowledge that persists across sessions: what belongs in it, how recall works, and why it needs dates."
canonical: https://past.dev/glossary/long-term-memory
last-updated: 2026-09-02
---
# Long-term memory

Source: https://past.dev/glossary/long-term-memory

Long-term memory is information an agent keeps outside the context window so it remains available across sessions and over time. In AI systems it is the umbrella term for everything stored beyond the current call: episodic events, semantic facts, and procedures. A long-term store gives an agent continuity: a user described in January is still known in September, with dates and sources attached to what is known.

## What belongs in long-term memory

Long-term memory is the umbrella over every store that outlives the context window. Three kinds of content belong in it, and they answer different questions:

- **Episodic events**: what happened and when. A complaint call on March 12 stays recallable in September. See [episodic memory](/glossary/episodic-memory).
- **Semantic facts**: what is true now and what was true before. A plan change on May 3 supersedes the old plan. See [semantic memory](/glossary/semantic-memory).
- **Procedures**: how recurring tasks are done, with effective dates. See [procedural memory](/glossary/procedural-memory).

## Long-term memory and the context window

The context window is capacity for one call. It is not storage. A model retains nothing between calls, so continuity has to be engineered: within one conversation it is [session memory](/glossary/session-memory), and between conversations it is [cross-session memory](/glossary/cross-session-memory), which only exists if something is written to a store and recalled later. Long-term memory names that store. For how the pieces fit together, see [what agent memory is](/what-is-agent-memory).

## Why long-term memory is hard

Three problems separate a working long-term memory from a pile of stored text. First, staleness: facts change, so each one needs a [validity window](/glossary/validity-window) and supersession when replaced, or the store fills with outdated values. Second, retrieval: the store is only useful if [recall](/glossary/recall) returns the few records that matter for a query. Third, trust: a recalled answer needs dates and sources attached, or it cannot be verified.

Long-horizon suites listed under [benchmarks](/benchmarks) evaluate long-term memory by asking about information introduced many sessions earlier. [past.dev](/docs/memory-api/quickstart) is a memory API for this layer: it stores records with their original timestamps and returns current and previous facts with dated evidence.

## Related concepts

- **[Working memory](/glossary/working-memory)**: the in-window counterpart, held only while a task runs.
- **[Session memory](/glossary/session-memory)**: continuity within one conversation.
- **[Cross-session memory](/glossary/cross-session-memory)**: continuity between conversations, built on a long-term store.
- **[Memory decay](/glossary/memory-decay)**: policies for aging and pruning long-term content.
- **[Context window](/glossary/context-window)**: the per-call limit long-term memory works around.

## Frequently asked questions

### What is long term memory in AI?

Long term memory is information an AI system stores outside the model's context window so it can be used in later sessions. It covers past events, standing facts, and learned procedures.

### Do AI agents have long term memory by default?

No. A model forgets everything when the context window is cleared. Long term memory has to be added as storage plus a recall step that brings relevant records back into the window.

### What is the difference between long term memory and RAG?

RAG retrieves from an existing document corpus. Long term memory stores what the agent itself experienced and learned, keeps facts updated as they change, and returns them with dates and sources.

## Related

- [Session memory](https://past.dev/glossary/session-memory)
- [Cross-session memory](https://past.dev/glossary/cross-session-memory)
- [Working memory](https://past.dev/glossary/working-memory)
- [What is agent memory](https://past.dev/what-is-agent-memory)
- [Memory API quickstart](https://past.dev/docs/memory-api/quickstart)