--- title: "Agent swarms with a shared memory get better on each run" description: "Team caffeinated built agent swarms that share one memory on past.dev. Notes for each run, lessons for all runs, and 1 current status for each idea." canonical: https://past.dev/blog/agent-swarms-shared-memory date: 2026-11-23 last-updated: 2026-11-23 category: Engineering authors: The past.dev team --- # Agent swarms with a shared memory get better on each run On November 14 and 15, 2026, we sponsored the Iterate AI Research Hackathon in San Francisco. One of our favorite projects came from team caffeinated: Ariel Anders, Jialin Feng, Neeraj Shah and Masha Baidachna. They built a swarm of AI agents that do research. And they started from a problem that people who run agent swarms know well. Research swarms get stuck. When an idea gets a good score, the agents keep trying small changes to that same idea. They keep going, even when the score stops improving. A human researcher would get bored at that point, and try something else. So the team gave the swarm a way to do the same. They called it the Boredom Meter. It is a simple score. It goes up when the recent ideas are all similar, and when the results stop improving. When the score is high, most of the agents have to try something new. When it is very high, all of them have to start over with a completely different idea. But there is a catch. To try something new, each agent has to know what the other agents already tried. And by default, it does not. ![Top row, without a shared memory: run 1, run 2 and run 3 each start empty, and each run loses its results at the end. Bottom row, with a shared memory: each run saves to one memory. Under run 1 the memory holds facts. Under run 2, facts and failed ideas. Under run 3, facts, failed ideas and lessons. Run 2 starts with the notes of run 1, and run 3 starts with the notes of runs 1 and 2.](/blog/agent-swarms/runs.svg) ## By default, agents in a swarm do not share anything Each agent works in its own context window. And each window starts empty. So when an agent finds something, it stays with that agent. When an agent rejects an idea, only that agent has the reason. And when the run ends, all of it is gone. The next run starts from zero again. Nicholas Carlini, at Anthropic, hit this problem at a much bigger scale. He built a C compiler with parallel Claude agents. At first, in his words, "every agent would hit the same bug, fix that bug, and then overwrite each other's changes" ([Anthropic, 2026](https://www.anthropic.com/research/building-c-compiler)). Adding more agents did not help. They were all solving the same problem. The usual fix is to have the agents send messages to each other. But each message is only a summary, so a few details get lost every time. We think there is a better fix: one memory, where every agent writes and reads. ![Top: agent 1 sends a task to agent 2. Agent 2 finds 4 facts and sends a summary to the critic, and the critic gets 1 of the 4 facts. Bottom: agent 1 saves its plan and agent 2 saves its 4 facts in one shared memory, and the critic reads all 4 facts with their author.](/blog/agent-swarms/relay.svg) ## How the caffeinated swarm shares its memory In the caffeinated swarm, every agent saves its work to past.dev, under its own name: - Most agents propose ideas. They save each idea and its result. - 1 agent, the critic, checks each new best score. It saves a short lesson each time. - Before an agent tries a new idea, it checks the memory: what did the other agents already try, and what are they testing right now? And it works. In one run, every single time that an agent checked the memory, it got back notes from the other agents. The smart part is how they split the memory in two: - **Notes for this run:** the ideas and results of the current run. Only this run can read them. - **Lessons for all runs:** what worked and what failed, and why. Every later run of the same task can read them. This way, a new run gets all the lessons of the old runs, but none of their noise. They also had 2 test setups: the swarm with the Boredom Meter, and the swarm without it. They kept the two fully apart, so neither one could read the other's notes. That is what you need, if you want to compare them fairly. ## Each idea needs 1 current status Each idea in the swarm has a status, and that status changes over time. First it is "being tested". Then it is "worked", "failed" or "crashed". Now, if an agent reads an old status, it can test a failed idea again. That is exactly what the team wanted to stop. Their first approach saved each new status as a new note. With that, about 1 read in 4 came back with an old status. The better approach is to keep 1 note per idea, and update it each time. That is what the swarm does now. Other teams hit the same problem. Take deer-flow, the open-source agent for research from ByteDance. Its to-do list showed up during a run, then disappeared at the end. Why? A later step saved its state without the list, and that erased it. There was no error, anywhere ([deer-flow, 2026](https://github.com/bytedance/deer-flow/pull/3180); [Khan, 2026](https://arxiv.org/abs/2606.17182)). There are 2 ways to keep 1 current version of something: - **If you only care about the latest version:** give it 1 fixed id. Save each change with that same id. The new version then replaces the old one. - **If you also want the history:** save each change as a new note, with its date. past.dev then marks the older notes as replaced. ![Left: a note with the id hypothesis-17 has the status being tested. A new note with the same id replaces it with the status refuted, and a read returns only refuted. Right: a budget of 40,000 dollars from March 2 is marked as replaced when a newer budget of 32,000 dollars arrives on June 9.](/blog/agent-swarms/versions.svg) ## Keeping swarms out of each other's data The caffeinated team kept their 2 test setups apart. In a real product, you need the same thing for your customers. Many products run 1 swarm per customer. If those swarms share the same files or the same prompt, every agent can read everything. And this leaks more than people think. In one benchmark, private data leaked in the messages between agents in about 2 out of 3 cases. That happened even when the final answer passed the privacy checks ([El Yagoubi et al., 2026](https://arxiv.org/abs/2602.11510)). So checking the final answers is not enough. ![2 bars. Messages between agents leaked private data in 68.8% of the traces. Final outputs leaked in 27.2% of the traces. Source: AgentLeak benchmark, 2026.](/blog/agent-swarms/leaks.svg) In past.dev, each note names who can read it. An agent only gets back the notes that it is allowed to see. So many swarms can share 1 memory, and none of them gets the data of another. ![5 agents, agent 1 to agent 4 and a critic, each have their own name. Agents 2, 3 and 4 save notes to one shared memory. Each note has an id, an author, a date and who can read it. A hypothesis note shows its current status, an attempt note shows why it was rejected, and a fact note shows that it replaces an earlier version. The critic reads with its own name, and gets only the notes it is allowed to see.](/blog/agent-swarms/overview.svg) ## Going back in time The caffeinated swarm saves a checkpoint after each round. Sometimes, a run restarts from an earlier checkpoint. When that happens, the rounds after it do not count anymore. So the swarm deletes their notes from the memory. If it did not, an agent could later read results from rounds that officially never happened. You have the same problem with backtests and audits. You need to know what information the swarm had at a given moment, and nothing from after. You cannot fix this in the prompt. Telling the model "do not use anything after this date" does not work. In one study, even a stricter prompt did not help at all ([Li et al., 2026](https://arxiv.org/abs/2605.24564)). With past.dev, every note has a date. So you can ask the memory for only what existed before a given day. One limit to keep in mind: this controls what the memory gives back. It does not change what the model already learned in training. ![A timeline of 14 weekly dates from January 7 to April 8, with notes at each date. A read of the memory as of March 4 returns the notes dated on or before March 4, and not the notes from later dates.](/blog/agent-swarms/replay.svg) ## The results from the hackathon The swarm did well. It placed second in the past.dev challenge of the hackathon, and it was a finalist in the track "Build your own autoresearch framework". On its Ig Nobel task, its best idea was "The Brazil Nut Canary: A Snack-Sized Early-Warning System for Granular Avalanches". We love that one. The team also tested how well the agents can find their notes. With a large memory, that is what matters most: an agent can only use a note if it finds it. They wrote 40 questions, each one in different words from the note that it had to find. For example, take the question "Are weightier automobiles less fuel-efficient in town?". It had to find this note: "Do heavier cars get fewer city miles per gallon?". The results: - past.dev found the right note first 65% of the time. A simple keyword search did it 30% of the time. That is more than twice as often. - past.dev had the right note in its first 8 results 95% of the time. The keyword search: 82.5%. This is the advantage of semantic search: your agents do not have to use the same words as the note to find it. A few things to keep in mind when you build your own swarm: - **Keep your notes short.** Each read adds text to the prompt. Set a limit on how much the memory can send back. - **Use the right tool for each lookup.** A search takes about half a second. If you only need one note by its exact id, a local index is faster. The memory is the right tool when you need search, history or access rules. - **Pick tasks that split into parallel parts.** In a Google study, a swarm did much better on these tasks. On tasks that have to happen step by step, a single agent did better ([Google Research, 2026](https://research.google/blog/towards-a-science-of-scaling-agent-systems-when-and-why-agent-systems-work/)). Next, we would love to see results for the same swarm on the same task, with and without the memory. If you try it, send us your results. ## Try it yourself Here is the whole loop in Python. First, create a group of agents for the run. Then, save each attempt. And before each new idea, check the memory. ```Python import os, requests API = "https://api.past.dev/api/v1" H = {"Authorization": f"Bearer {os.environ['PAST_API_KEY']}"} requests.put( # 1. The agents that can read this run's notes f"{API}/audiences/run-42", headers=H, json={ "kind": "fixed", "identities": ["agent-1", "agent-2", "critic"]}) requests.post( # 2. An agent saves an attempt f"{API}/ingest", headers=H, json={ "id": "attempt-parser-cache", # same id: replaces it "content": "Cache before the parser: rejected, 3% slower.", "label": "attempt: parser cache", "timestamp": "2026-11-18T09:12:00Z", "identity": "agent-1", "audience": "run-42"}) page = requests.post( # 3. Before a new idea, check what was tried f"{API}/recall", headers=H, json={ "query": "What was tried on parser speed, and why?", "identity": "critic", "maxTokens": 2000}).json() ``` For lessons for later runs, do what the caffeinated team did: save them to a second group that every run can read. ## Getting started 1. Read the [quickstart of the Memory API](/docs/memory-api/quickstart). 2. Read [access control](/docs/memory-api/access-control) to see how to choose who can read what. 3. Look at [memory.py](https://github.com/arii/caffeinated/blob/main/memory.py) from team caffeinated, or watch their [live lab replay](https://arii.github.io/caffeinated). Thanks to Ariel, Jialin, Neeraj and Masha for building with past.dev, and for sharing their results with us. ## Further reading - [Cognition: multi-agent systems that work](https://cognition.com/blog/multi-agents-working) - [OpenAI: harness engineering with Codex](https://openai.com/index/harness-engineering/) - [Cursor: scaling agents](https://cursor.com/blog/scaling-agents) - [ReasoningBank: memory from successes and failures](https://arxiv.org/abs/2509.25140) - [Lulla et al.: AGENTS.md and the runtime of coding agents](https://arxiv.org/abs/2601.20404) - [Gloaguen et al.: when AGENTS.md does not help](https://arxiv.org/abs/2602.11988) - [Khan: silent errors of last-write-wins in LangGraph](https://arxiv.org/abs/2606.17182) - [Yang et al.: cross-user contamination in a shared agent state](https://arxiv.org/abs/2604.01350) - [El Lahib et al.: date filters on web searches leak the future](https://arxiv.org/abs/2602.00758) - [Wang et al.: provenance in LLM agents, a survey](https://arxiv.org/abs/2606.04990) - [IMDA: framework for agentic AI](https://www.imda.gov.sg/-/media/imda/files/about/emerging-tech-and-research/artificial-intelligence/mgf-for-agentic-ai.pdf) - [Yu et al.: memory consistency between agents](https://arxiv.org/abs/2603.10062) - [Parakhin: MESI for artifacts shared by agents](https://arxiv.org/abs/2603.15183)