Søren Kierkegaard wrote that existence can lone be understood backward, but it must be lived forward. We’ve encountered a akin tie whenever designing recollection for AI agents.
As humans, we encode recollection continually as we go concerning our lives. The hippocampus plays a chief function in this, capturing experiences in the instant so that memories form quickly and are immediately available. But lone some experiences are consolidated into long-term knowledge.
Much of that consolidation appears to happen whenever our brains are offline. As we sleep, and during quiescent rest, the hippocampus replays our latest experiences. This is idea to gradually distill those experiences and merge them into the neocortex—the part of our brains that stores most of what we think of as knowledge.
Agent recollection can use a akin division of labor. Agents grasp much of their activity in logs or transcripts. Researchers at Letta and UC Berkeley projected sleep-time compute as a way for models to use idle period between interactions to reorganize their existing context. The identical idea can assistance agents arrange their recollection by reflecting on logs to fix mistakes or create new notes and representations. This procedure is frequently called dreaming (Figure 1).
We’ve established that dreaming has been a helpful tool for assisting us provision Claude productive memory. In this post, we portion how we’ve arrive to think concerning delegate recollection and stroll through multiple evaluations we’ve used to examine delegate memory, including the use of dreaming, and what all component contributes to recollection organization.
Memory notes
By “agent memory,” we average cognition that Claude gains from experience—including interactions alongside users and tasks it’s been assigned—and that it retains between sessions, saved as environment it can peruse later. It excludes another ways models can study or oversee context, specified as changes to their weights (the inner parameters set during training), in-context learning (knowledge gained inside a sole conversation), and compaction (summaries written by Claude that substitute its older turns so it can continue operating in a new environment window).
In the individual brain, chemic signals released before, during, or following an cognition can mark a memory as important. Marked memories lean to be replayed additional frequently than unmarked ones during offline periods. This process, called replay, helps stabilize and merge them into long-term memory.
Similarly, Claude can tag prominent events in a meeting log as they happen, so they’re easier to discover later, or it can write them to a recollection store, specified as a directory of recollection notes (Figure 2). But how can Claude inform what’s prominent in the moment, before it knows what’s coming next?
Memory can be a prediction concerning what the forthcoming volition need
Memory is, occasionally, a prediction. By penning downward a rule, an delegate predicts that the form it’s describing volition be applicable again. For instance, penning downward a verified fact is a prediction that an delegate in a forthcoming meeting volition desire to depend on that fact without double-checking it. Over time, Claude has rotate into much improved at making these kinds of predictions.
Consider a project from Continual Learning Bench (CL-Bench) 1.0, a benchmark that measures an agent’s capability to use recollection in command to tackle long-horizon tasks. One particular project asks Claude to answer a sequence of questions by looking up data in a database. After Claude gives an answer, it’s told the accurate resolution and can compose a recollection to assistance answer forthcoming questions.
Memory can assistance a learning iteration here. If Claude gets a inquiry wrong, it can document the failure, arrive up alongside theories concerning what went wrong, test those theories, and rotate what it finds into a regulation concerning how to answer in the future.
We ran the CL-Bench 1.0 project using Claude Managed Agents. Claude started all inquiry in a caller session, alongside one exception: it could recover records from a memory directory that persisted from one meeting to the next.
Different models achieved distinct levels of achievement at creating their own learning loops. Claude Sonnet 4.6 got as far as generating theories concerning why an answer was wrong. Its recollection directory contained a scattering of files, all listing multiple untested guesses.
Claude Opus 4.7 consolidated its notes into a sole citation document and began marking which facts it had checked and which were motionless unconfirmed. Claude Sonnet 5 marked all answer as confirmed following the grader had checked it, and wrote a correction whenever it had answered wrong.
Claude Opus 5 was the archetypal of these models to near the loop. Most of its entries included a regulation (and additionally how it knew the regulation was true), answers to before questions, and apparent warnings concerning traps it had discovered alongside the way (Figure 3).
Like Opus 5, Claude Opus 5.5 and Claude Sonnet 5.5 the two closed the loop, using recollection to grasp validated rules concerning how to finest answer forthcoming questions. With memory, the two scored concerning the identical as Opus 5, although their baseline achievement without recollection was slightly higher.
Claude has learned to fairness salience
We additionally evaluated Claude’s capability to perform Pokémon Red, a equivalent that challenges Claude to navigate complex long-horizon tasks, as a test of Claude’s judgement concerning what to preserve to memory. At the commencement of all run, we gave all example a directory of recollection records that it could peruse from and compose to during it played (Figure 4).
We compared the recollection folders from one run all of Claude Sonnet 3.7 and Claude Fable 5, whenever all was concerning 10,000 steps into the game. A key difference we noticed was what all example idea was value remembering. Sonnet 3.7 assumed everything power matter and wrote to recollection indiscriminately. Its recollection directory contained an archive of encounters, frequently alongside a distinct document for all battle it fought, all item it found, and all non-player character it met. Ultimately, Sonnet 3.7 wrote 413 recollection records throughout 225 folders and earned one sign (badges grade a player’s advancement through the game).
Fable 5, by comparison, wrote nine records in two folders, affirmative a sole top-level document called global.md, and earned four badges.
Sonnet 3.7’s method was a issue chiefly since the equivalent province of Pokémon changes constantly—Sonnet 3.7’s detailed document was continuously going out of date. As a result, as Claude progressed, it had to expend additional period and resources combing through its memories fairly than playing the game. Around stage 10,000, for example, Sonnet 3.7 started its fourth directory of “master” recollection files. Over the next 17 steps, it created six files, deleted nine others, and took no actions in the equivalent itself.
Fable 5’s method used recollection for things the equivalent didn’t explicitly inform it. Some of the kinds of data Sonnet 3.7 wrote to memory—such as how much prosperity the participant has or anywhere the participant is on the map—can be peruse off the display all turn, so storing it is redundant. By contrast, recollection records concerning strategy, plans, and tested rules be lone if Claude plant them out, and they disappear unless Claude writes them down.
Fable 5 organized its recollection accordingly. Its global.md document acted as a dashboard, holding the current goal, a prewritten scheme for tackling gyms (the challenges anywhere badges are won), and the model’s own rules for using memory. A locations directory held plans for navigating particular routes, and a gameplay directory held strategies according to what it had learned concerning how the equivalent works. For example, following seven Poké Balls in a row unsuccessful to capture a Magikarp (one of the easiest Pokémon to catch), Claude wrote, “If 3+ balls neglect in a row, VARY the timing (insert additional ‘wait’ presses between list steps) - the capture landed correct following doing this.”
With a much smaller recollection folder, Fable 5 progressed much additional in the equivalent than Sonnet 3.7. Opus 5.5 took a akin approach: it kept a small directory of recollection notes that tracked its current goal and next steps, rewrote them as it played, and attack the game.
Steering Claude to compose memory
We’ve established that it helps to inform Claude what recollection is for, but not how to use it. On CL-Bench, we merely told Claude that a recollection directory was available. That broad direction was adequate for Opus 4.7 and Opus 5 to use recollection effectively, and it gave the two a noticeable boost in achievement (Figure 3).
We additionally tested giving the models particular rules concerning what they should compose to memory, alongside one regulation per test. We compared how much all example gained from recollection alongside all regulation against how much it gained without it. When we set a regulation to “record lone failures,” the two Opus 5 and Opus 4.7 misplaced much of the achievement boost that recollection gave them (Figure 5, right). For stronger models, giving them liberty to fairness salience was additional productive than environment fixed rules in advance, and those rules could end up weakening performance.
We additionally noticed that steering helped older models the most. For instance, Sonnet 4.6 frequently didn’t peruse records from its recollection directory and unsuccessful to test its theories concerning why an answer was wrong.
In this case, prompting Claude to peruse its recollection records before answering—and afterward to explicitly test its theories—nearly doubled its benchmark mark (Figure 5, left). Sonnet 5 does this on its own. Without being prompted to, it peruse its recollection before answering 9 out of 10 times. By comparison, Sonnet 4.6 did this small than fractional of the time.
With frontier Claude models, we typically provision uncomplicated direction to create recollection notes whenever a individual asks them to or whenever item is plainly value remembering, and we depart that judgement up to Claude.
Dreaming can accurate memory
Since Claude writes to recollection according to what it judges to be prominent in-session, a note that’s incorrect from the commencement or that drifts as the surroundings changes can be read, and trusted, by Claude in a afterward session.
Dreaming gives Claude a way to test its notes against the first transcripts (Figure 6). We saw a affirmative example of this whenever Claude played Pokémon using Managed Agents alongside a mounted directory for its memories.
In one part of the game, the participant has to get through Mt. Moon, a cave scheme alongside its entrance on the west flank of the map and its exit on the east. Near the entrance is a trap: a one-way ledge that drops the participant onto the path they came from, alongside no apparent way to ascend rear up. Claude was using the PokéCenter, a construction at the mountain’s entrance, as a landmark, so whether it walked off the ledge depended on which flank of the mountain it idea the PokéCenter was on.
At one point, Claude wrote downward (incorrectly) that the PokéCenter was on the east side. When it walked out of the PokéCenter, it announced, “Mt Moon is rearward me,” and updated its notes: “Mt Moon DONE.” But Mt. Moon was not rearward it. A few actions later, Claude went complete the ledge and landed rear on the path it had arrive from (Figure 7). Its navigation tool didn’t display the drop, so Claude concluded, “I overshot far west,” and that it had been on the accurate flank all along. It hadn’t.
We afterward tested whether dreaming could assistance Claude evade this trap. We ran dreaming on the recollection directory that contained the incorrect location for the PokéCenter: Claude checked the note against the meeting transcript, caught its error, and rewrote it. The copy gave Claude a dirt fact to validate its recollection against. With the corrected recollection note, Claude went direct rear into Mt. Moon and eventually reached Cerulean City.
In the run alongside the uncorrected note, Claude dropped rear onto that before path three times. After the third failure, Claude seemed to provision up, writing, “I’m going to halt fairly than keep looping.” Our setup’s automatic answer instructed it to continue. So it did, all the way rear to Pewter City, the town before the mountain, anywhere it hoped to heal and restock. The run ended without Claude always reaching Cerulean City.
Dreaming can build new recollection representations
With dreaming, Claude can build representations to assistance navigate recollection (Figure 9). One category of recollection depiction it uses is called a wiki, a gathering of pages written and maintained by Claude that gathers what Claude knows concerning one topic and links it to another notes. These links efficiently provision Claude alongside a map it can use to sift through its recollection and efficiently find memories whenever they’re needed.
Representations akin wikis can assistance Claude traverse its ever-growing cognition base. We explored the advantage of wikis as a recollection depiction using a corpus of inner documents—about 350,000 files, approximately 420M tokens—from Stainless, a application business we acquired in May. We created an evaluation set of 25 questions concerning this corpus and gave Claude a hunt tool to examine it. We additionally instructed Claude to build a wiki according to these records using dreaming. Over 128 sessions, we prompted Opus 5 agents to examine the files, compose or accurate connected wiki pages, merge duplicates, and inspect claims against the sources.
Each meeting built on the advancement that agents made in previous sessions, using a shared log to coordinate work. As we scaled dreaming from two sessions to 128, achievement on the 25 questions grew from 13% to 48% of graded criteria (Figure 10).
Claude builds its wikis incrementally. After creating an first wiki, it uses consequent rounds of dreaming to add to, edit, or prune it. In the first rounds of dreaming, Claude’s cognition is akin that of a new employee, and its capability to answer questions according to the wiki solitary is limited. The additional it dreams, the richer its cognition map grows, akin that of a experienced employee. In our tests, we established that the wiki helped Claude the most whenever we additionally gave it admission to a hunt tool. When it used the two hunt and the wiki, Claude’s total mark rosy from 54% to 61% as that wiki grew, compared alongside 53% whenever it had admission to the hunt tool alone. Claude’s finest mark was 48% whenever it used lone the wiki to answer questions. Using hunt and the wiki additionally saved concerning 20,000 tokens per question.
We wanted to test which kinds of tasks benefited from Claude having a wiki. To do this, we used the Harvey LAB benchmark alongside alongside a gathering of documents concerning a merger. The benchmark gives Claude a set of documents and asks Claude to create a lawful concise according to their content. The benchmark afterward grades the concise against a catalog of criteria. While a tad small engaging, perhaps, than a Pokémon run, these evaluations provision us varied collections of documents to build wikis from.
We instructed Claude to build a wiki from the documents. We afterward asked Claude to answer questions (about the merger) or create lawful briefs (the LAB benchmark) the two from the wiki and from a straightforward document search. One test asked 24 questions concerning the merger (Figure 11, left), additional than fractional of which needed Claude to discover data throughout multiple documents, and many of which additionally needed Claude to use judgement or do math. On those items (red and orange lines), Claude scored 87% whenever it consulted the wiki, compared alongside 73% whenever it used hunt alone.
In another cases, the wiki was small useful. On one LAB project (Figure 11, right), concise criteria frequently could be retrieved alongside a content hunt from a sole document, and the wiki showed no apparent acquire in achievement related to search. On another LAB task, the wiki grew larger than the documents themselves (Figure 12). Like the mapmakers in Borges’s one-paragraph abbreviated narrative “On Exactitude in Science,” who drafted a map so detailed it was as ample as the empire it represented, Claude had made an extremely detailed wiki that efficiently distracted nothing.
Dreaming can advance notes up the recollection hierarchy
Dreaming can additionally drift notes to the top of the recollection hierarchy, and the delegate harness can preemptively burden them into Claude’s environment at the commencement of all meeting (Figure 13). This method Claude doesn’t need to hunt for them, or equal to cognize there’s item to hunt for.
Promoting memories into a new meeting (a form of context injection) must be done carefully. Injected memories use up precious tokens, and an incorrect note can be carried into all session. Loading a note additionally doesn’t justify that Claude acts on it: our records on Claude Code warns that longer education records decrease adherence. So the top tier of the recollection ranking has to remain comparatively small, and much of dreaming’s activity current is keeping it that way—by moving several particulars downward the ranking and leaving links behind.
Claude Code’s car memory keeps its injected tier small in the identical way, alongside Claude maintaining it during the session. Claude doesn’t burden all of its car recollection into all session’s environment window. It loads lone the archetypal 200 lines or 25 KB of MEMORY.md. This header serves as an index, which shows Claude what it knows and anywhere to discover it.
Dreaming can concentration recollection on a particular goal
Dreaming can additionally form how recollection grows. An aide akin Claude Duet, for example, frequently benefits from having memories that are organized about the individual it’s helping, and dreaming can be tuned to build recollection in assistance of a particular goal.
The instructions that guide how recollection grows differ by project and inform Claude what data really matters. For example, one project in the LAB benchmark simulates a business acquisition and provides a set of contracts. The concise is graded on whether it correctly describes the agreement terms.
We started alongside essential instructions for generating the wiki that didn’t inform Claude how to use the wiki. This project relied heavily on agreement terms. While the wiki was being built, multiple agents wrote to a shared array of agreement conditions at the identical period (Figure 14, left).
The outcome was a wiki that was missing key facts. When we graded a concise generated from the wiki, Claude had included lone 41 of the 57 facts (72%). When we looked at what had gone wrong, we established that the shared array summarized the agreement conditions poorly and was missing several of them altogether, since agents had overwritten one another’s work.
The agreement conditions were the most crucial part of the wiki, but the instructions didn’t say that. To discover improved instructions, we ran a iteration in which Claude reflected on its failures, projected a alter to the instructions, and rebuilt the wiki. This iteration allowed Claude to detect how crucial it was to prosecute the agreement terms, and it rewrote the instructions for construction the wiki accordingly.
Each agreement got its own leaf in the wiki, written by a sole agent, which quoted the conditions term for term fairly than summarizing them into a shared table. When we graded the concise generated from this improved wiki, 100% of the criteria could be met, up from 72%.
Dreaming can inhabit in gaps a meeting leaves behind
When Claude writes recollection notes, it sees lone the environment in that particular session. Dreaming can hunt throughout many sessions to discover average patterns or accurate average mistakes.
When construction the wikis for the LAB benchmark (as an example, see Figure 14), sometimes Claude would nexus to pages that hadn’t yet been created. A second dreaming continue closed many of these gaps. On one project (Figure 15), dreaming established nine links to a missing leaf in the wiki and repointed them to an existing leaf for the identical document. It additionally added three new pages, including an index, to enhance the wiki.
Thinking backward, looking forward
There are many open questions concerning how to scheme recollection systems for agents. One is whenever Claude should create memory. When Claude plant on a task, it can compose to a recollection shop (e.g., a folder, file, or database), capturing salience at the origin and making crucial particulars immediately accessible for forthcoming turns or sessions. But logging notes in the instant inevitably draws Claude’s notice distant from its chief task. In contrast, dreaming can shove recollection innovation to the background, but any outputs from dreaming may not be immediately accessible to Claude.
Another inquiry is how to keep recollection reliably up to date. Claude can create incorrect predictions or compose rules to recollection that are incorrect from the start. Memory can additionally drift and rotate into irrelevant as the surroundings changes. Dreaming is one way to fix these mistakes (Figure 8), but it requires compute. Directing Claude to continuously inspect all its memories power not be practical. It may be crucial alternatively to concentration dreaming on data that’s apt to alter or to carefully tune the cadence of dreaming (e.g., according to how frequently memories are accessed).
It’s additionally sensible to regard copy hunt as the basis of Claude’s memory. Combining representations (e.g., wikis) alongside hunt (Figure 10) can sometimes be effective. But Claude needs to use compute to keep recollection representations and create certain they don’t accumulate errors or hallucinations.
Even although Claude’s judgement concerning salience has improved, no example can really cognize what volition happen in forthcoming turns. Dreaming gives Claude an chance to appearance backward and use compute to arrange its memory, accurate mistakes, and keep representations that authorize forthcoming sessions to admission recollection additional readily. Memory systems volition develop as Claude gets additional capable, and we motionless have a lot to study concerning designing Claude’s recollection systems.
See our cookbooks for getting started alongside dreaming and knowledge wikis.