← back to the archiveCover illustration for “Agent memory: how AI agents remember across sessions”
TERM8mo ago·Published · Updated ·by Andy Padia

Agent memory: how AI agents remember across sessions

In short: Agent memory is how an AI agent keeps facts beyond one context window, using notes, files, summaries or a store that the harness loads back in.

Agent memory is any mechanism that lets an AI agent keep information beyond a single context window, so it can recall preferences, past decisions or project facts in later sessions. The model carries nothing over between calls, so the harness stores memory and loads it back in. Anthropic's September 2025 guide describes one form: notes the agent writes and persists outside the context window.

Agent memory in plain words

The model has no memory of yesterday. Memory is the notebook it is handed at the start of each day, plus the habit of writing in it before going home.

How it works

A common way to describe it uses three layers:

  1. Working memory: what is in the current context window.
  2. Session summaries: older turns compressed so the window does not overflow.
  3. Long-term memory: facts written to files or a store and retrieved when relevant, by rule, by search or by the agent choosing to read them.

The MemGPT paper from October 2023 framed this as virtual context management, borrowing the operating-system idea of moving data between fast and slow memory tiers. The hard parts are deciding what to write, when to retrieve it and when to forget it.

Example

Claude Code reads a CLAUDE.md file at the start of each session. A line such as "Use pnpm, never npm; run pnpm test before committing" is project memory: written once, applied every session. Its memory documentation, read in November 2026, also describes auto memory: notes Claude writes itself, with the first 200 lines of MEMORY.md loaded at the start of every conversation.

Where you'll meet it

  • Instruction files such as CLAUDE.md and AGENTS.md
  • Chat assistants with saved memories
  • Agent frameworks with memory modules or vector stores
  • Customer-facing agents that recall account history

What it changes for you

Memory turns one-off sessions into compounding work, but it also stores mistakes. For developers, keep memory files short, current and reviewed like code. For teams, memory can hold personal data, so it needs retention rules, deletion paths and access control.

Agent memory vs RAG

RAG retrieves from a document corpus you curate. Agent memory is what the agent itself writes and reads back about its own work and its user.

Common mistake

My view: letting memory grow forever. A long, stale memory file is worse than none, because the agent follows outdated rules with full confidence. Prune it.

Context window · Context engineering · AGENTS.md · Retrieval-augmented generation · Context rot

From the archive: Agent memory is a control plane, not a vector replacement · Deleting a memory needs a test against the source transcript

Prune agent memory like code, because a stale note gets followed with full confidence.

#field-guide#agents#memory#context

Sources

  1. anthropic.com/engineering/effective-context-engineering-for-ai-agents
  2. arxiv.org/abs/2310.08560
  3. code.claude.com/docs/en/memory
← older drop
Lethal trifecta: the agent setup that leaks your data
newer drop →
Open-weights model: an AI model you can download and run

related drops

explore all 557 drops →
← back to the archiveday 175