Does AI have memory and can agents dream?
The AI Glossary
In our classes, we often pause to explain the ideas behind AI and the language used to describe it. These posts grew out of those conversations. They’re for anyone who would like to understand AI better, with no technical background assumed.
I appreciate that to ask whether artificial intelligence has memory, and whether software agents can dream, is to invite a certain amount of anthropomorphic confusion. The short answer to the first question is a qualified yes; to the second, in any conscious or human sense, flatly no. Yet over the past year, the functional architecture of both memory and sleep has quietly become one of the central preoccupations of modern AI engineering. Machines do not experience the surreal theater of human REM sleep, nor do they reminisce. Still, some of the most useful cognitive work that dreaming performs for the human brain—stepping back from the noise of the day, auditing mistaken impressions against what actually occurred, and distilling scattered episodes into durable knowledge—can now be engineered into software agents, with striking practical effects. That shift is the subject of a study published this month by engineers at Anthropic examining how long-running AI agents build and maintain memory. The authors open not with computer science, but with the nineteenth-century Danish philosopher Søren Kierkegaard, who observed in his journals that while life must be lived forward, it can only be understood backward. For the engineers building modern AI systems, Kierkegaard’s aphorism is no longer an abstract reflection; it is an immediate design problem. While an AI agent is acting in the present—answering questions, searching databases or coordinating a workflow—it must decide what is worth writing down before it knows what future tasks will actually require.
Human beings solve this problem through biology, separating fast daily recording from slower consolidation during sleep. As we move through the day, a brain structure called the hippocampus rapidly captures immediate experiences so we can function in the moment. Yet we do not store every passing detail permanently; when we sleep, the hippocampus replays those daily traces back to the neocortex, which gradually extracts lasting patterns, clears away noise and integrates what matters into long-term knowledge. AI engineers are now building a similar two-stage process for software agents. In an earlier post, we separated using a model in a workflow from changing its internal numerical weights—the fixed parameters a model learns during training. In everyday agentic operations, an organization uses a pre-trained model whose weights are already frozen, running it across many separate work sessions. In this setting, agent memory refers to the experiential knowledge an agent saves between sessions as readable notes and files outside its weights, while dreaming describes an offline process in which an idle agent uses background computing time to review its past interaction logs, fix errors in its notes and reorganize context before the next session begins.
At its core, taking a note is a prediction about the future. Whether a scientist is writing in a laboratory notebook or an AI agent is saving a text file to a working directory, recording an observation is a bet that a future version of ourselves will need to rely on that exact insight without starting over from scratch. Early language models were remarkably poor at making those bets, behaving less like strategists and more like compulsive hoarders. When Anthropic tested different generations of its Claude models playing the classic video game Pokémon Red over tens of thousands of steps with access to a folder for saving notes, an older model, Claude Sonnet 3.7, created 413 separate files across 225 folders. It logged rapidly outdated screen statistics, item counts and minor battle details, at one point stalling for 17 consecutive turns just to create and delete files without taking a single action in the game, and ultimately earned only one gym badge. By contrast, a newer model, Fable 5, recognized that current health points or screen coordinates could simply be read off the live screen when needed. It kept just nine strategic topic files alongside a brief overview index—recording high-level navigation paths and practical fixes for recurring obstacles—and earned four badges, while a successor model, Claude Opus 5.5, used an equally lean notebook to finish the entire game.
What changed between those generations was not just tidiness, but the ability to close the learning loop. On a sequential database benchmark where agents had to answer thirty questions across separate sessions, earlier models jotted down untested guesses about why an answer failed and rarely checked their own notes unless prompted. Newer models such as Claude Opus 5 and 5.5 evolved to test their hypotheses against outcomes, record verified rules alongside proof of why they worked, and leave explicit warnings about traps they had uncovered in the data. For anyone who works in clinical medicine or public health, this distinction is immediately familiar. In electronic health records, copying forward every raw laboratory value and unedited template creates bloated charts that obscure what is actually happening to a patient and paralyze clinical decision-making. In epidemiological surveillance just as in bedside care, logging every raw variable without synthesis is not institutional memory; real operational intelligence comes from distilling verified rules that drive action and warn the next clinician on shift about known pitfalls.
Even a concise notebook, however, introduces a serious vulnerability when an agent writes down something inaccurate in the moment and then blindly trusts its own note. During its Pokémon run, Claude entered a maze-like cave called Mt. Moon, where a one-way ledge near the entrance drops careless players back to the approach route. Trying to orient itself during live gameplay, the model mistakenly wrote in its notes that the landmark building outside the entrance was on the east side of the mountain rather than the west. In a session that relied directly on those in-the-moment notes, Claude trusted its flawed coordinate, walked straight off the ledge, and spent the rest of its run trapped in an endless loop without ever making it past the mountain. When researchers introduced an offline dreaming step between sessions, the outcome changed. Rather than taking its summary notes at face value, the idle agent checked its flawed memory against the raw session transcript of what had actually happened step by step, caught the east-west discrepancy, corrected its note and successfully navigated through the cave to Cerulean City.
Beyond auditing individual mistakes, offline dreaming allows agents to turn scattered files into structured maps of knowledge. When Anthropic ran 128 dreaming sessions across a corporate repository of 350,000 files, Claude gradually organized its observations into a linked wiki of 222 pages and nearly 13,000 cross-references. Using that wiki raised accuracy on complex questions from 13% to 48% on its own—and to 61% when combined with direct file search—while saving roughly 20,000 tokens of reading per query. Dreaming also allowed the agent to look across separate legal sessions to detect and repair nine broken links pointing to pages that did not yet exist. Yet building memory maps carries its own trap. On one legal benchmark involving ten source documents, the agent copied so much raw text into its wiki instead of abstracting the core ideas that the wiki grew to 1.77 times the size of the original files. As the researchers observed, when a summary grows larger than the source material, it becomes as unhelpful as the map in Jorge Luis Borges’s famous fable—drawn on a one-to-one scale so vast that it covered the entire empire it was meant to represent.
When leaders see an AI system hoarding files or generating bloated summaries, the natural instinct is to micromanage it with strict rules dictating what it may save. Remarkably, Anthropic found that telling advanced models what memory is for works far better than imposing rigid rules. When engineers forced Claude Opus 5 to follow a strict instruction to “record only failures,” the constraint stripped away most of its performance gains from memory, because the model could no longer record confirmed rules and verified schemas that actually worked. Instead of micromanaging individual notes, effective systems protect the agent’s attention at the top of the memory hierarchy. Because loading bloated instruction files at the start of every task dilutes focus and carries any single mistake into every conversation, Anthropic’s coding harness caps its top-level MEMORY.md index at just 200 lines, relying on offline dreaming to keep that front page concise while filing detailed notes underneath. And where high-stakes work demands exact precision—such as a contract merger test where multiple agents initially overwrote a shared summary table and captured only 72% of key facts—allowing the system to reflect on its workflow produced a decisive structural change: giving each contract its own page and quoting clauses word for word raised accuracy to 100%.
Stepping back from any single benchmark, these experiments point toward a broader set of principles for how organizations should think about agentic memory. Today, most institutions are presented with a false choice between two flawed approaches. On one side is standard document search, which retrieves passages from past files by keyword or similarity but suffers from a kind of temporal and epistemic blindness: if a team spends forty-five minutes debating an option it ultimately rejects and thirty seconds agreeing on the final course, a search months later will dutifully surface the long debate rather than the brief decision, treating a passing brainstorm, a failed trial and a binding policy as equivalent blocks of text. On the other side are black-box “user profile” memory banks built to personalize consumer chat—systems that silently overwrite older facts, cannot prove where a claim originated, and were never designed to hold shared institutional knowledge across a team.
In my experience, building trustworthy organizational memory—independent of any particular software vendor—rests on four foundational principles. First, derived memory must remain anchored to verbatim provenance: rather than trusting a model to paraphrase what happened, every recorded rule or decision should link back to an exact, verifiable quote in the underlying transcript or source record. Second, a reliable system requires epistemic quarantine: speculative ideas or unverified proposals explored while brainstorming with an AI in a working session must be kept strictly separate from verified institutional facts, lest an agent inadvertently contaminate its own future context. Third, when a team tests an idea or changes direction, memory should preserve that lineage rather than overwriting it—distinguishing between a hypothesis that was genuinely disproven and a trial that merely failed in execution, scoping lessons to the specific conditions under which they held true, and surfacing decisions that overturned earlier assumptions when orienting a new session. Finally, institutional memory must respect the lifecycle of its sources: when an underlying record is corrected, retracted or deleted, any higher-level summaries or wiki pages built upon it must update or retract automatically rather than lingering as orphaned facts.
For health leaders deploying agents in real organizations, these findings and principles underscore a central operational trade-off between real-time knowledge generation and offline consolidation. Pausing to write detailed notes in the middle of a live workflow distracts the model from the immediate task, whereas waiting to consolidate memories offline during dreaming requires additional computing power and means newly distilled lessons are not available until the current session pauses. Even so, the public health implications of well-governed agentic memory and offline dreaming are substantial in my opinion and at the time of writing, underrecognized. Offline auditing passes could periodically check clinical handoff summaries against primary encounter transcripts and laboratory records to catch a misrecorded detail before it propagates across shifts, or help public health teams synthesize vast repositories of policy guidance and outbreak research into linked knowledge bases without drifting from the primary sources. In the end, Kierkegaard’s observation holds as true for artificial agents as it does for human institutions. Whether we are stewarding a health system or designing the software agents that support it, effective intelligence depends less on how much raw data we log while living forward, and more on how carefully we reflect, audit our errors and refine our maps when the work pauses and we look backward.
Sources: Martin — The components of agent memory (2026); McClelland, McNaughton and O’Reilly — Why there are complementary learning systems in the hippocampus and neocortex: insights from the successes and failures of connectionist models of learning and memory (1995); Lin, Snell and colleagues — Sleep-time Compute: Beyond Inference Scaling at Test-time (2025); Borges — On Exactitude in Science (1946); Kierkegaard — Journalen JJ:167 (1843)
To learn more, take a look at the AI in Health Care Certificate of Specialization from the Advanced Learning Academy at Harvard T.H. Chan School of Public Health. You can take an individual course or work toward the full certificate.
AI is a fast-moving field. This explanation reflects our class discussions and related material at the time of writing. Terminology, capabilities and tools may change.
For suggested additions or corrections, please email me at tpanch@hsph.harvard.edu.
Dr. Trishan Panch
Program Director, AI in Health Care
Harvard T.H. Chan School of Public Health — Advanced Learning Academy
Lead with AI in Health Care
The AI Pragmatist is a monthly newsletter from ALA faculty, with new explainers & essays from the Advanced Learning Academy