Korely

Blog Agent memory · Multi-agent

Multi-agent shared memory: how our own agents use it

I built Korely to give my agents one memory. When the agents that help me build it moved their own memory in, Korely crossed out more than a hundred of their facts on the first evening, and only one had really changed.

On this page
Five hand-drawn agents, the coordinator, the builder, the skeptic, the tester and the docs writer, write into one memory for the whole team. Inside it, the fact about the deploy of the previous version is crossed out in red by the fact about the deploy of the new version. A person looks at it and says: both happened.
The new deploy crossed out the old one, as if a deploy could undo another.

Where it started

The evening our own agents moved into Korely

I had a lot of agents, not only in Claude Code but also in Hermes Agent and in Grok. I wanted one memory for all of them, so I built Korely.

A team of AI agents helps me build Korely. Each one has a job: a coordinator, a builder, a skeptic who tries to break what the builder made, a tester, one who writes the docs. They shared what they knew through markdown files: decisions with their dates, procedures, lessons learned. One evening the coordinator loaded that memory into Korely too, part as facts the agents wrote themselves, part as notes in plain text for Korely to read.

When a fact stops being true, Korely closes it: it crosses it out with a date and keeps it readable. A model, which we call the judge, reads each new fact next to the old ones and decides when two of them clash.

The coordinator asked the memory some of the questions the team really asks in its daily work, on our team's memory on Korely Cloud, and the answers were right. That only tests the facts those questions touch. So it also checked what Korely had closed among the facts the agents wrote themselves. There were more than a hundred. We read them one by one, by hand, and only one had really changed. One of the wrong ones: "We deployed the new version on 5 November" had closed "We deployed the previous version on 2 November". Two deploys. Both happened.

It was past midnight in Rome. We already had an agent that hunts for defects in our code without being asked (Claude Code tends to add code where a shorter rewrite would do, and fewer lines are fewer tokens too). So we treated the memory like the code and wrote down every defect.

If you build a support bot and a billing bot, you have the same setup in small: several writers on one memory, and facts that change under them.

The judge

The judge reads only the facts about the same thing

Every fact has a subject, the thing it's about. "The deploy of one version" is one subject, "the deploy of the next" another. The judge used to get up to ten earlier facts that sounded close in meaning, about any subject, and it was told that two subjects worded differently might be the same thing. Two deploys sound alike, so it closed one. Nearly all the closures between two facts the agents wrote themselves were between two different subjects.

Now, for a fact an agent writes itself, the judge sees only the earlier facts about the same subject, and the ones that link the same two things the other way round ("Anna works for Acme" and "Acme employs Anna"). Then we replayed that first evening with the new rule, keeping the judge's own verdicts. Measured before: 119 facts were crossed out, and 118 of them had not changed. Estimated by the replay: with the new rule, 6 would be crossed out, each one by a fact about the same thing. A replay is an estimate, because nobody asked the judge again.

A hand-drawn bar chart of the facts our agents wrote themselves, the first evening. Before the change, 119 were crossed out: 1 had really changed, and the other 118, in red, had not, so they were crossed out by mistake. After the change, replaying the same evening with the same verdicts, 6 are crossed out, each one by a fact about the same thing.
Red is a fact that hadn't changed. We found each one by reading the cross-outs by hand. Tap to enlarge.

The notes

A team's notes are read as a team's notes

The notes went through extraction: a model reads each note and writes short facts out of it. Its instructions were written for one person's memory, a person it calls "user". Our notes belong to no person, only to a team's procedures and decisions.

So the model did what it was told. A deploy procedure came back as "user follows procedure deploy". Our delegation rules have three levels, and they came back as one person with three levels in a row: GREEN, then YELLOW, then RED. Same subject, same relation, so the judge closed the first two. Many of the facts read from our notes had "user" in them, and none of those was right.

A memory written with an agent's name (agent_id) and no person's name (user_id) is now read as that agent's own notes. The instructions say it belongs to no person, and "I" is the agent that wrote it. We counted by hand, on our own notes, how many facts came out right, an informal count and not a benchmark: about half before the change, about eight in ten after it.

Licenses

Two licenses, two repositories

We reloaded the memory the next day, every note written with the name of the agent that wrote it. Korely closed 32 facts, and when we read all 32 by hand, two in three were wrong. "The SDK repository has license MIT" was closed by "the license is currently Apache 2.0", which was about another repository. Both licenses were true. Same with the two warning levels for a full disk. Nearly all the pairs had reached the judge only because they sounded alike.

For a team's notes, the judge now sees only the facts about the same thing, not the ones that just sound alike. Replayed with the same verdicts, most of the 32 closures were gone. A model still makes the call, and the measured numbers are on the Known limits page.

The stricter rule trades fewer false closures for more dependence on consistent names. On your side, watch them. If one agent writes "Cloud" and another writes "Korely Cloud", those are two subjects, and a new version of one doesn't close the old version of the other. Declare one name an alias of the other (POST /admin/aliases), with the agent_id of each agent that writes it.

The rule

Every writer says who it is

We then ran the judge three times on a version of our memory written with no names at all. A third of the wrong closures had the same cause. With no name, the writer was stored as "user", so rules written by different agents shared one subject and closed each other.

So I made it a rule. When anyone writes into our memory, they say who they are. Every write carries an agent_id, the name of the agent that did the work. The builder writes as the builder, the skeptic as the skeptic. Korely asks every write through the API to say whose memory it is: a write that names neither a person (user_id) nor an agent (agent_id) is refused and stores nothing.

Over MCP, an open standard for connecting AI apps to tools, a write with no ids is kept under the name the assistant gave when it connected. If your agents share one memory through MCP, have each one pass its agent_id anyway. Reads leave the agent_id out, so each agent sees what the others wrote. The first piece of this series explains why, in the label that hides the answer.

# write: always with the name of the agent that did the work
korely add --agent-id coordinator \
"Decision: blog drafts stay on their branch until the founder approves them."
# read: without agent_id, so the block covers every agent
korely context "blog drafts, approval" --token-budget 1500

When we ran it again with names, the "user" mix-ups went away, and so did the closures between two different subjects. When a change matters, we say it out loud and correct the fact (PATCH /v1/facts/{id}, or korely_correct_fact over MCP). A correction ends the fact you name, and an agent that had read it under its own name is told at its next context read, with agent notices.

Conclusions

What I took home

The answers we asked for that first evening were right. The defects were underneath, in facts nobody had asked about yet. We only saw them because Korely keeps what it closes, so we could read them one by one.

  • A defect in the memory gets written down, like a defect in the code.
  • Every writer says who it is, and every read leaves the agent_id out. That's the rule I gave the team. You can copy it today.
  • We still write every decision twice, once in a markdown file and once in Korely. The day we decided, I said: "I wouldn't stop writing in the MD files, as we do now. I'd keep them in parallel anyway, because that way we actually know what works and what doesn't." When the two disagree, that's one more defect to write down.

The two deploys from that first evening both happened. Since then, the judge weighs a fact about one deploy only against facts about the same deploy. To try it with your own support bot and billing bot, start with the Quickstart. It gets you a key and a first write.

Read next

One more piece

Agent notices: telling an agent what changed since it last read. An agent that names itself when it reads gets told, next time, which of its facts have ended.

FAQ

Questions about a team's shared memory

Should every agent in a team write with its own agent_id?

Yes. Korely asks every write through the API to say whose memory it is, with a user_id, an agent_id or both: a write with neither is refused with 422 identity_required and stores nothing. A memory written with an agent_id and no user_id is read as that agent's own notes. Leave the agent_id out when you read, so each agent sees what the others wrote.

How should an agent read a team's memory at the start of a task?

With one context read of the whole team, without agent_id. Our agents use a budget of 1,500 tokens (the size of the block Korely hands back), and doubling it added almost nothing.

How do I make sure a change in a team's memory is recorded?

State it. Correct the fact by its id (PATCH /v1/facts/{id}, or korely_correct_fact over MCP). A correction ends the fact you name, and any agent that read it under its own name is told at its next context read.

Can the agents of one team keep a memory apart from another team's?

Yes. Give each team its own project. A key reads and changes only the memories and facts of its own project, so a key of another project does not read the team's memory. Keep admin keys, the ones that manage projects and keys, out of anything your agents run.

Back to top