multi-agent-memory
Skill2 starsChanged 51 days agoMITView on GitHub
Multi-agent shared memory patterns for AI agent coordination. Use when building shared fact logs, collaborative scratchpads, memory reconciliation, or coordinating discoveries between concurrent agents. Covers append-only fact tables, Yjs CRDT scratchpads, LLM-powered reconciliation, and session-scoped memory sharing.
- Sends data out
1 other project uses a version of this.
Adopted by
Most recently taken up by
- revealui-studio/revskillsword for word, first seen Sep 22, 2026
Other versions1 project uses a version of this.
Word for word · 1
- revealui-studio/revskills★ 2100% same
Edited · 0
None found.
Wrote their own version · 0
None found.
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository29 other files it gives its agents.
- skills/revealui-design/CLAUDE.mdCLAUDE.md
- drizzle-dbSkill
- electric-syncSkill
- exhaustive-auditSkill
- grok-bot-checkpointSkill
- knowledge-graphSkill
- mcp-serverSkill
- next-best-practicesSkill
- redundancy-scanSkill
- revealui-checkpointSkill
- revealui-cleanupSkill
- coordinateSkill
- revealui-designSkill
- revealui-design-statusSkill
- revealui-doctorSkill
- revealui-opsSkill
- revealui-pickupSkill
- revealui-recoverSkill
- revealui-rollupSkill
- revealui-skills-testSkill
- revealui-snapshotSkill
- revealui-sync-ltsSkill
- revealui-sync-rulesSkill
- revealui-trackerSkill
- revvault-resolveSkill
- security-hardeningSkill
- tailwind-v4Skill
- vitest-testingSkill
- yjs-collaborationSkill
The file
We split this skill into the rules it gives an agent
8 rules. About 0 are common, 5 are distinctive, and 3 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈5
Distinctive · estimate
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 24
All layers scope by session_id (coordination session).
- Distinctive: line 47
Write path: agent publishes via REST API -> DB insert -> Electric syncs to subscribers.
- Distinctive: line 65
Read path (React): subscribe via Electric shape.
- Distinctive: line 77
Read path (CLI agents): poll via daemon RPC or direct API call.
- Very specific: line 167
Create scope = 'reconciled' memories with source_facts references
- Distinctive: line 186
All memory is scoped by coordination session ID.
- Distinctive: line 189
All fact publications include this session ID
- Very specific: line 204
Keep these names distinct.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Multi-Agent Shared Memory
Architecture Overview
Three layers, each building on the previous:
Layer 1: Shared Fact Log — append-only discoveries, real-time sync
Layer 2: Yjs CRDT Scratchpad — collaborative working document
Layer 3: Reconciliation — LLM-powered canonical fact extractionAll layers scope by session_id (coordination session). Only agents in the same session share memory.
Layer 1: Shared Fact Log
Append-only table of agent discoveries. No CRDT, no merge — pure append.
CREATE TABLE shared_facts (
id TEXT PRIMARY KEY,
session_id TEXT NOT NULL,
agent_id TEXT NOT NULL,
content TEXT NOT NULL,
fact_type TEXT NOT NULL CHECK (fact_type IN (
'discovery', 'bug', 'decision', 'warning', 'question', 'answer'
)),
confidence REAL NOT NULL DEFAULT 1.0,
tags JSONB NOT NULL DEFAULT '[]',
source_ref JSONB,
superseded_by TEXT,
created_at TIMESTAMPTZ NOT NULL DEFAULT NOW()
);Write path: agent publishes via REST API -> DB insert -> Electric syncs to subscribers.
// Publishing a fact
await fetch('/api/sync/shared-facts', {
method: 'POST',
body: JSON.stringify({
session_id: 'coord-abc123',
agent_id: 'claude-1',
content: 'auth module has race condition in session refresh',
fact_type: 'bug',
confidence: 0.9,
tags: ['auth', 'concurrency'],
source_ref: { file: 'src/auth/session.ts', line: 42 },
}),
});Read path (React): subscribe via Electric shape.
function useSharedFacts(sessionId: string) {
const { data, isLoading } = useShape({
url: `${proxyBaseUrl}/api/shapes/shared-facts`,
params: { session_id: sessionId },
});
return { facts: data, isLoading };
}Read path (CLI agents): poll via daemon RPC or direct API call.
Layer 2: Yjs CRDT Scratchpad
Multiple agents concurrently edit a shared document. Browser agents use WebSocket Yjs collab. CLI agents submit structured patches applied server-side.
Patch Types
| Type | Description | Example |
set_key | Set root-level key to string | Title, status |
append_section | Append to Y.Text section | Add findings |
append_item | Push to Y.Array section | Add list item |
replace_section | Replace section entirely | Rewrite plan |
Structured Patch (CLI Agents)
await fetch('/api/sync/yjs-document-patches', {
method: 'POST',
body: JSON.stringify({
document_id: 'scratchpad-task-42',
agent_id: 'claude-2',
patch_type: 'append_item',
path: 'findings',
content: 'Database index missing on user_id column',
}),
});Server-side: loads Y.Doc state, applies patch, saves updated state. Electric fans out.
Server-Side Patch Application
import * as Y from 'yjs';
function applyPatch(doc: Y.Doc, patchType: string, path: string, content: string) {
const root = doc.getMap('root');
switch (patchType) {
case 'set_key':
root.set(path, content);
break;
case 'append_section': {
let section = root.get(path);
if (!(section instanceof Y.Text)) {
section = new Y.Text();
root.set(path, section);
}
section.insert(section.length, content);
break;
}
case 'append_item': {
let arr = root.get(path);
if (!(arr instanceof Y.Array)) {
arr = new Y.Array();
root.set(path, arr);
}
arr.push([content]);
break;
}
case 'replace_section': {
const text = new Y.Text();
text.insert(0, content);
root.set(path, text);
break;
}
}
}Layer 3: Reconciliation
Periodic or on-demand LLM pass that reads the fact log, resolves contradictions, deduplicates, and produces canonical memories.
Extending Existing Memory Tables
ALTER TABLE agent_memories ADD COLUMN scope TEXT DEFAULT 'private';
-- Values: 'private' (single agent), 'shared' (session-wide), 'reconciled' (LLM-verified)
ALTER TABLE agent_memories ADD COLUMN session_scope TEXT;
ALTER TABLE agent_memories ADD COLUMN source_facts JSONB DEFAULT '[]';
ALTER TABLE agent_memories ADD COLUMN reconciled_at TIMESTAMPTZ;Reconciliation Process
- Query unreconciled facts (where
superseded_by IS NULL) - Group related facts by tags, source references, semantic similarity
- LLM prompt: determine canonical truths, contradictions, duplicates
- Create
scope = 'reconciled'memories withsource_factsreferences - Mark source facts as
superseded_bythe new reconciled memory
Heuristic Fallback (No LLM)
Normalize content, deduplicate by exact match, keep highest confidence per group.
CLI vs Browser Agent Paths
| Action | Browser Agent | CLI Agent |
| Read facts | Electric shape (real-time) | API poll or daemon RPC |
| Write facts | REST POST | Daemon RPC -> REST POST |
| Edit scratchpad | WebSocket Yjs (live) | Structured patches |
| Read scratchpad | Yjs doc state | API -> decoded JSON |
| Trigger reconciliation | REST POST | Daemon RPC -> REST POST |
Session Scoping
All memory is scoped by coordination session ID. When agents start a shared task:
- Generate or reuse a session ID (e.g.,
coord-{taskId}) - All fact publications include this session ID
- Shape subscriptions filter by session ID
- Reconciliation processes one session at a time
Session order
Same shape as the control layer. A session names the native store first, then the vendor.
- Knowledge graph (
revealui.memory.v1) is the durable product memory. - The vendor adapter is a pointer. Grok
[memory], Claude~/.claudememory files, and any other vendor home do not become a second durable store. revealui-harnesses session adapter <vendor>prints that order and does not query the graph.- An operator who wants the read passes
--memory. That callsqueryDurableMemoryand continues if the graph is down. Session hooks do not pass--memory.
Durable vs working vs session facts
Keep these names distinct. Do not proxy memory_publish_fact into
kg_add_episode (that ingest is a later graph phase, not this skill).
| API | Store | Lifetime | Use |
daemon memory.store / memory.query | PGlite | Process/machine working set | Self-scoped working memory. Not shared product memory. |
memory_publish_fact (revealui-memory MCP) | shared_facts | Session | Layer-1 live discoveries. Electric shared-facts shape. |
kg_add_episode | kg_* | Durable, bi-temporal | What any in-scope agent has learned, queryable after session death. See the knowledge-graph skill. |
| Yjs kg-view / scratchpad | yjs_documents | Ephemeral overlay | Layout, annotations, session scratchpad. Flush to a manual episode to keep. |
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

