Agent memory is the set of mechanisms that let an artificial intelligence (AI) agent retain information beyond a single exchange: facts about a user, instructions, earlier decisions, the results of past tasks. It exists because the large language models (LLMs) underneath agents are stateless. A model reads whatever text is placed in its context window for one request, produces an answer and keeps nothing. Every apparent act of remembering is engineering around the model.

The term covers two layers. Short-term memory is what sits inside the context window during a session. Long-term memory is what persists outside it, in files or databases, and is retrieved when needed.

How agent memory works

Most designs follow the same loop of four steps.

Capture. During or after a conversation, the system decides what is worth keeping. In some products the user asks explicitly ("remember that I work in euros"). In others a model extracts candidates automatically.

Storage. Memories are written somewhere durable. The simplest store is a set of plain-text files. Richer systems use a database, often with vector embeddings, numerical representations of meaning that allow a search for "budget pacing" to find a note about "daily spend limits".

Retrieval. At the start of a new task, or when the agent judges it relevant, stored memories are searched and the best matches are copied into the context window. This is a form of retrieval-augmented generation (RAG) applied to the agent's own history rather than to external documents.

Maintenance. Memories conflict and go stale. Systems update, supersede or expire entries, or summarise many entries into one.

Researchers borrow vocabulary from cognitive science. A September 2023 framework from Princeton University, "Cognitive Architectures for Language Agents", split agent memory into working memory (the current context), episodic memory (records of past events), semantic memory (facts about the world or the user) and procedural memory (how to do things, held in code or instructions).

File-based memory

The most transparent approach stores memory as files the agent reads and edits. Anthropic's memory tool, announced on September 29, 2025, gives Claude a /memories directory and six commands: view, create, str_replace, insert, delete and rename, according to Anthropic's documentation. The tool runs client-side. Claude requests a file operation, and the developer's application carries it out against its own storage, which may be a folder per user or rows in a database. Anthropic reported that, in an internal agentic search evaluation, the memory tool combined with automatic clearing of old tool results improved performance by 39% over a baseline; clearing alone added 29%.

Coding agents use the same idea. Claude Code loads instruction files named CLAUDE.md from user, project and organisation-wide locations at launch, and keeps an auto memory directory per project whose index file, MEMORY.md, is loaded each session up to its first 200 lines or 25 kilobytes, according to Claude Code's documentation. Memory, in other words, competes for the same limited context it is meant to relieve.

Database and managed memory

Cloud providers sell memory as a service. Amazon Web Services' AgentCore Memory stores raw conversation events as short-term memory, retained by default for 30 days, and builds long-term memory through configurable "strategies" named SEMANTIC, USER_PREFERENCE, SUMMARIZATION and EPISODIC, according to AWS documentation. Cloudflare put Agent Memory into private beta in April 2026. Its pipeline extracts four kinds of memory - facts, events, instructions and tasks - and retrieves them through five parallel searches, including full-text, exact key lookup and vector search, merged by a ranking method called Reciprocal Rank Fusion, according to InfoQ's report of the launch.

Consumer assistants

In chat products the mechanics are hidden but the split is similar. OpenAI's ChatGPT distinguishes saved memories, details a user asked it to remember, from chat history, which OpenAI describes as insights "ChatGPT gathers from past chats to improve future ones". Google's Gemini stores saved info under a "Personal context" setting and can reference past chats. Anthropic's Claude creates a separate memory for each project and shows users an editable memory summary. All three offer a temporary or incognito mode that neither reads nor writes memory.

From research prototypes to product features

The engineering problem predates the products. In April 2023 researchers at Stanford University and Google published "Generative Agents", in which 25 simulated characters kept a memory stream of observations in natural language and retrieved entries scored by recency, importance and relevance, periodically condensing them into higher-level "reflections". In October 2023 a team at the University of California, Berkeley, released MemGPT, which treated the context window like a computer's main memory and paged information in and out of slower storage, borrowing from operating-system design.

OpenAI began testing memory in ChatGPT on February 13, 2024, extended it to Free, Plus, Team and Enterprise users on September 5, 2024, and on April 10, 2025 made it reference all past conversations, according to OpenAI. A lighter version reached free users on June 3, 2025. One PPC Land article dates OpenAI's memory features to December 2024; OpenAI's own announcement gives the earlier dates. Google switched on past-chat personalisation in Gemini on August 13, 2025, by default, with a Temporary Chat mode that keeps conversations for up to 72 hours. Anthropic brought memory to Claude's Team and Enterprise plans on September 11, 2025, Pro and Max on October 23, 2025, and free users on March 2, 2026, alongside a tool to import memories from rival assistants, according to MacRumors.

By mid-2025 developers described memory as one part of context engineering, whose four strategies - write, select, compress and isolate - include saving information outside the context window.

Why it matters for marketers

Memory changes what an AI system knows about a person when an ad is chosen. In the United States, ChatGPT's ad system starts from the current conversation, but for users who enable personalised ads it can draw on past chats, memory and previous ad interactions. In Europe, where ads arrived for Free and Go users in August 2026, OpenAI said past chats and memories are excluded from initial ad selection, with personalisation to follow behind an opt-in, and a separate toggle for whether memory feeds ad relevance. Meta took a different route: from December 16, 2025 it began using conversations with Meta AI to personalise content and ads, without an opt-out, excluding sensitive topics.

Memory also matters on the buy side. Agents that manage campaigns need to recall budgets, brand rules and what worked before. Smartly introduced Smartly Synapse on June 22, 2026 as an orchestration and memory layer for agents managing more than $7 billion in ad spend, so that, in the company's words, an insight from one campaign can inform budget allocation on another. Smartly did not say whether that learning stays within each client account.

Privacy, security and other limitations

Data protection. Memory is personal data processing by another name. The European Union's General Data Protection Regulation (GDPR) requires data minimisation and storage limitation under Article 5, both awkward for a system that improves the more it keeps. Prompts can reveal health, religion or sexuality, which Article 9 treats as special category data. On September 17, 2026 the Cologne Regional Court barred Snap from using My AI chat content for advertising without a legal basis, with fines of up to €250,000 per breach, rejecting Snap's argument that such ads were merely contextual. Deletion is also incomplete in places: OpenAI notes that deleting a chat does not erase memories derived from it.

Defaults and consent. Gemini's past-chat memory and model training on a sample of chats were switched on by default in 2025, and EU, UK and Swiss users were excluded at launch. Critics argue that opt-out memory shifts the burden onto users who may not know it exists.

Memory poisoning. Because memory is written partly from untrusted content, an attacker can plant instructions that persist. Security researcher Johann Rehberger demonstrated in 2024 that a malicious document could write false memories into ChatGPT that survived across sessions, an extension of prompt injection. File-based tools add their own risk: Anthropic's documentation warns that a path such as /memories/../../secrets.env can escape the memory directory unless every path is validated.

Quality. Retrieval can surface the wrong memory, outdated preferences can linger, and more loaded memory consumes tokens and can degrade answers, a problem developers call "context rot".

Context window. The fixed amount of text a model can read in one request. It functions as short-term memory but is wiped after each call; long-term memory is what survives outside it.

Context caching. A billing and latency optimisation that reuses processed prompt text across requests. It stores computation, not knowledge about a user.

Model training and fine-tuning. Changing a model's weights, sometimes called parametric memory. Agent memory leaves the model unchanged and works by adding text to the prompt, so it can be inspected and deleted in a way trained knowledge cannot.

Retrieval-augmented generation. The general technique of fetching documents into a prompt. Agent memory is one application of it, aimed at the agent's own history.

Recent developments

Through 2026 memory became a competitive and regulatory front at once. Vendors packaged memory for developers and campaign agents while advertising arrived in assistants that remember. The Cologne judgment against Snap and OpenAI's decision to keep memory out of initial European ad selection show regulators and platforms drawing a line between what an assistant remembers to help a user and what it may use to sell to them. As of November 2026 no regulator has issued guidance specific to agent memory.


Timeline

  • April 7, 2023 - Stanford and Google researchers publish "Generative Agents", with a memory stream and reflection
  • September 2023 - Princeton researchers publish "Cognitive Architectures for Language Agents", defining working, episodic, semantic and procedural memory for agents
  • October 12, 2023 - UC Berkeley researchers publish MemGPT, applying operating-system memory paging to LLMs
  • February 13, 2024 - OpenAI begins testing memory in ChatGPT with a small share of Free and Plus users
  • September 5, 2024 - ChatGPT memory extends to Free, Plus, Team and Enterprise users
  • 2024 - Johann Rehberger demonstrates persistent false memories planted in ChatGPT through prompt injection
  • April 10, 2025 - ChatGPT memory begins referencing all past conversations for Plus and Pro users
  • June 3, 2025 - Lighter memory improvements reach ChatGPT free users
  • August 13, 2025 - Gemini turns on past-chat personalisation by default and adds Temporary Chat
  • September 11, 2025 - Anthropic brings memory to Claude Team and Enterprise plans
  • September 29, 2025 - Anthropic releases the memory tool and context editing in public beta for developers
  • October 23, 2025 - Claude memory rolls out to Pro and Max subscribers
  • December 16, 2025 - Meta begins using Meta AI conversations to personalise content and ads
  • March 2, 2026 - Claude memory reaches free users, with a memory import tool
  • April 2026 - Cloudflare launches Agent Memory in private beta
  • June 22, 2026 - Smartly introduces Smartly Synapse memory layer at Cannes Lions
  • August 15, 2026 - OpenAI tells European users ads are coming, with memory excluded from initial selection
  • September 17, 2026 - Cologne Regional Court bars Snap from using My AI chats for ads without a legal basis

Summary

Who. Model developers including OpenAI, Google, Anthropic and Meta, which build memory into assistants; infrastructure providers such as AWS and Cloudflare, which sell it to developers; ad-tech vendors such as Smartly, which build it into campaign agents; and regulators and courts deciding how remembered conversations may be used.

What. The capture, storage, retrieval and maintenance of information an AI agent keeps beyond one request, split between short-term memory in the context window and long-term memory in files or databases.

When. Research prototypes appeared in 2023; ChatGPT memory was tested from February 2024, with Gemini and Claude following in 2025 and developer memory services in 2025 and 2026.

Where. Inside consumer assistants, coding tools and enterprise agents, on infrastructure the developer controls or a cloud provider manages, with consumer rollouts often reaching Europe later than the United States.

Why. Language models forget everything between requests, and agents that carry out multi-step or recurring work need continuity. For marketers, memory determines how much an assistant knows when it selects an ad, raises data protection questions about retention and sensitive data, and introduces security risks when remembered content can be manipulated.