{No thinking needed}Hand this tutorial to your agent in one click

A key section of this article is locked, and an agent opening the link cannot see it either. Unlock it first, then copy the full text for your agent in one click.

Tutorial/Nov 28, 202610 min

Advanced: Let your agent team learn from past sessions

Share

Advanced tutorial: when several AI agents share one memory, split it into read-only organisation, project and scratchpad tiers and load it on demand, make every write quote the fingerprint of the version it read and re-read and merge on a mismatch, then periodically let an orchestrator hand past sessions to several reviewer sub-agents to find knowledge gaps, tool mistakes, stale memory and style drift, count them and turn them into proposals with quoted evidence that you approve before anything is written. Covers Claude Managed Agents and a shared local folder. Includes 1 prompt you can copy.

Machine translation. Read the original

What you'll get

When several AI agents share one memory (user preferences, tool notes, project conventions), two things go wrong sooner or later. Two agents edit the same file at once and the later save wipes out the earlier one. And the memory slowly turns into a junk drawer: the same mistake gets corrected again and again and keeps coming back. This tutorial adds two safeguards. During the day, every write first proves it is based on the latest version. Every so often, an agent rereads past sessions, turns repeated mistakes into change proposals backed by real evidence, and nothing is written until you approve. There is one prompt you can copy that installs the whole setup with a skill from this site.

The split of work is simple: agents and scripts do the repetitive reading, writing and counting. Your only job is to read each proposal and say yes or no.

Safe by day, smarter by night: small files, hash-checked writes, a dream pass, proposals, review

The whole loop in one line: split memory into tiers and one small file per topic, make every agent quote the fingerprint of the version it read when it saves, re-read and merge on a mismatch, and periodically let a dream agent review past sessions and write proposals whose numbers come from an actual scan, merged only after review.

Why it works

Lamis Mukta of Anthropic's applied AI team made the case at AI Native DevCon 2026. Models keep getting smarter, but that intelligence only compounds when agents carry your organisation's own context. Letting an agent maintain its memory inside the same session it uses for the user's task has two built-in problems. It is distracted: it has to do the work and curate memory at once, and both get slower. And it can't see the whole picture: sessions are isolated, so a mistake that happens once in each of forty sessions is invisible to every one of them. So curation moves out of band, to a separate time with its own compute, reading many sessions at once.

Claude Managed Agents already exposes both halves as APIs. A memory update can carry the content fingerprint as a precondition and is refused if it no longer matches. A dream reads a memory store plus a batch of past sessions and produces a new, reorganized store while leaving the original untouched. If you don't use Managed Agents, the skill gives a shared folder the same mechanism.

Three things to hold on to:

  • Nothing disappears quietly. On a write conflict the agent re-reads and retries; a later save never simply overwrites an earlier one.
  • Numbers are counted, not guessed. "How many sessions hit this error" must come from a scan, not a plausible-looking percentage from the model.
  • You decide what gets learned. A dream only produces proposals or a new copy of the memory; the live memory stays as it is until you approve.

Step 1: Split memory into three tiers and small files, and load it on demand

Start by deciding who may change what:

Tier What goes there Who writes
Organisation Rules and knowledge the whole company follows Read-only for task agents; changed only through approved proposals
Project Conventions for one project or business area The roles that own that project
Scratchpad Each agent's working notes The agent itself, freely

Now an agent that learns something wrong can only dirty its own scratchpad, never the company-wide rules. On Managed Agents, use a separate store per tier and attach the organisation store as read_only. With a local folder, a small permissions file states which roles may write each tier, and any other write is refused.

Within each tier, keep one topic per file: preferences/writing-style.md, tools/currency-convert.md. Smaller files mean two agents rarely collide. When reading, don't pour everything into context: look at the index or each file's header first, search for keywords, and open only the files this task needs.

Step 2: Make every write quote the version it saw

The fingerprint is a SHA-256 hash of the file's content: change one character and it is completely different. There is one rule: read before you write and keep the fingerprint; send it along when you save, and if it no longer matches, the save is refused.

A refusal isn't an error. It means another agent just changed the file. The agent re-reads the latest content, re-applies its own edit and saves again, doubling the wait before each retry and stopping to report after a few failed attempts. The key is that it re-applies its own edit, not the whole old file it remembers.

We tested this locally with 8 processes each adding a line to the same file at once. Every one got its line in after a few retries, no line was lost, and every successful write left an entry in the audit log.

Step 3: Let a team of agents dream over past sessions

First, keep a full record of every session: what the user said, which tools the agent called, with what arguments, and what errors came back, one file per session named by its session id. Dreaming depends entirely on these logs; if they are incomplete, it finds nothing.

Then pick a schedule, say every night or after every batch of sessions, and let an orchestrator agent run the dream. It splits the period's sessions into batches and hands them to several reviewer sub-agents in parallel. Each reviewer works from the same checklist and looks for four kinds of problems:

  • Knowledge gaps: things the agent didn't know, so it kept asking the user or guessed.
  • Tool mistakes: the same parameter, unit or format passed wrong again and again.
  • Stale or conflicting memory: memory that contradicts what actually happened, or two entries that disagree.
  • Style drift: repeatedly breaking a format or convention that is already written down.

The orchestrator collects a report from every batch, merges the same problem found in different batches, drops one-offs, and keeps only findings backed by at least 3 sessions. It then counts each one across all sessions with the scan script: of the sessions that used that tool, how many hit the error. Anything that doesn't show up in the count is dropped before it becomes a proposal.

On Managed Agents you can also call the official dreams API: one memory store plus 1 to 100 sessions, done in minutes to a few hours, billed at normal token rates. It is a research preview, so you need to request access. It produces a new store; the skill's diff script lists what it added, removed and changed, and that goes through the same review.

Step 4: Review proposals and merge only what you approve

Each proposal changes one file. It names the file and the fingerprint it had before the change, attaches the scan result and quotes from two or three sessions, then gives the full new text and who might be affected. Run the checker before sending it for review. It blocks proposals with missing sections, numbers that aren't in the scan, or citations of sessions that don't exist, and it asks for a fresh proposal if the file changed in the meantime.

Who does what: writes, rereading and counting are automatic; approving or rejecting is your call

When you review, ask three questions. Do the quotes really show the mistake? Would the new text have prevented it? Does it clash with another rule? If all three pass, approve, and the agent merges it with the same fingerprint-checked write. If not, reject with one line of reasoning so the next dream doesn't raise it again. At volume you can auto-approve narrow cases, such as "changes under ten lines, seen in at least N sessions, in files on a low-risk list", and send everything else to a person.

Hand this to your AI agent and it will install the skill and set up the four steps above:

Sign in to unlock this key section

New accounts get 10 free credits, plus 1 more each day you sign in (none on days you don't). Spend 1 credit to unlock and it stays open for you.

The prompt asks where the memory lives first because the two setups use completely different commands. It stops for you at steps 2 and 5 because splitting files and merging memory change how every agent behaves from then on.

Step 5: How to check it after launch

  • No lost writes. Skim the audit log now and then: every successful write has an entry showing who changed what, when and why.
  • Fewer repeat mistakes. After you approve a proposal, run the next dream pass with the same scan pattern. The number of sessions hitting that error should drop clearly. If it doesn't, the new text didn't work; note it and propose again.
  • Easy rollback. The folder setup keeps every old version, and Managed Agents keeps memory versions for 30 days. If a change goes wrong, take the old version and write it back with the fingerprint check.

Watch out for

  • Dreams are a research preview that needs an access request, and API details follow the official docs. Memory stores are also in beta, and the beta headers change between versions.
  • The folder setup is only reliable on one machine (or a network drive that supports file locks). For several machines sharing one memory, use Managed Agents or put a small service in front.
  • Memory is plain text and keeps versions, so never store keys, passwords or personal data in it.
  • Dreams are billed by tokens and cost more with more and longer sessions. Start with a small batch and scale up once you like the results.

References

Done with this one? Mark it to track your path.Sign in
Save it for laterSign in
Questions about this piece?Ask AI about this

Comments (0)

No comments yet. Start the conversation.

Sign in to join the discussion.Sign in