Persistent, shared, and governed memory for OpenClaw agent systems.
mem9.ai · Built on TiDB

1
From single-agent prototype to production fleet — the architectural gap that file-based memory cannot cross.

2
File-based memory cannot cross the prototype-to-fleet boundary.
One agent · local file · works
✓ Works
Multi-session · files diverge · context lost
Multi-tenant · no sharing · architecture collapses

3
Without shared infrastructure, context stays local — agents repeatedly rebuild what others already learned.
Local notes · no reliable transfer · isolated per agent
No shared context across agents
No queryable knowledge base
↑ Facts should flow upward — but never do
↓ Org knowledge should flow down — but is inaccessible

4
Fast to set up for a single agent. Not production memory.

5
Every failure mode is silent — no error, no alert, no recovery.
Agent omits write → fact lost permanently
Vague fact persists · no validation
Index bloat · recall quality degrades
Two agents contradict · no reconciliation
Failure mode comparison


6
Compaction manages the context window. mem9 manages what the agent knows — permanently.

7
How mem9 captures, processes, types, and stores every agent interaction — server-side, asynchronously, without blocking the agent.

8
One plugin change routes OpenClaw memory through mem9 — no agent retraining required.
Runs normally
before_prompt_build · agent_end
Ingest · Extract · Reconcile · Store
Retrieve + inject relevant memory into prompt
Flush completed turn batch · wait only for ACK

9
What happens at each hook — and what the agent never has to wait for.
before_prompt_build fires. mem9 returns ranked memory for this agent and context.
Relevant facts are prepended to the prompt. Raw session context is excluded.
Agent executes with enriched context. No memory writes occur during the turn.
agent_end fires. Plugin POSTs the completed turn batch. Server ACKs; agent is unblocked.

10
Five server-side stages — all off the agent's critical path.
Agent released immediately
Remove injected context
LLM identifies atomic facts
Match or archive existing Insights
Write with full provenance
Off Path · All stages run asynchronously — zero agent wait
Durable · Every turn becomes structured memory with lineage

11
Only atomic facts become durable memory — everything else is dropped or stored as fallback.
Prevents re-extracting known facts.
Long sessions chunked by token budget.
Malformed extraction discarded · not stored.

12
Candidate facts are compared against existing Insights. Superseded memories are archived, not erased.
Atomic fact + embedding enters reconciliation.
BM25 + vector search finds related Insights.
New → ADD · Contradiction → UPDATE · Equivalent → No-op
ADD appends new Insight. UPDATE archives old + appends replacement. Provenance stays attached.

13
mem9 resolves stale facts, isolates project context, and prioritizes personal memory before inherited memory.



Pinned facts are AI-immutable — agents cannot overwrite operator-approved ground truth.

14
Three types. Explicit semantics, mutation rules, and lifecycle for each.

15
How mem9 retrieves the right memory at the right time — and proves it can be trusted.

16
mem9 runs keyword and semantic search in parallel, fuses both rankings, then returns a candidate set for confidence evaluation.
CANDIDATE SET QUALITY
BM25 catches exact IDs, names, and recent strings. Vector catches intent and paraphrases.
RRF dedupes overlaps and reduces single-signal bias before ranking.
Candidates carry type, provenance, metadata, and chain_source into Confidence Policy.
Next: Confidence Policy →

17
After hybrid retrieval returns candidates, mem9 turns evidence into an action: inject, fallback to Session, or suppress.
Keyword + vector agreement across both search signals.
Literal answer, source type, and provenance metadata.
Recency, appId, Space, and chain_source alignment.
Score
Combined signal weight
The policy layer evaluates all signals and emits a single decision.
Source Prior
Pinned > Insight > Session
High-confidence Insight enters the prompt context.
Raw Session used when exact evidence is required.
Low-confidence or stale match is withheld entirely.

18
Insights surface first. Raw Session provides full-fidelity fallback when precision matters.
Reconciled atomic facts · Deduplicated · Searched first · Best for: preferences · background · current state
Verbatim records · Append-only · Searched when Insights don't satisfy · Best for: exact recall · time-based · verbatim evidence

19
Set by the server at write time — not by the agent. Travels with the object through its lifecycle.
Written at Ingest · server stamps agent_id, session_id, appId, metadata, and timestamps
Travels with the Object · visible in Explorer and preserved on archive/supersede history
chain_source on Chain Recalls · adds chain_id, node_position, tenant_id, external_space_id

20
The isolation, inheritance, and routing model that makes mem9 safe for multi-tenant, multi-app, and multi-team deployments.

21
A Space is the fundamental memory unit — one tenant, one API key, one governed context.
One Space = one tenant · appId provides finer partitioning within
Each Space accessed via API key · Keys rotatable and revocable
BM25 + vector hybrid · filterable by type · state · appId · agent · tags
Explicit creation/deletion · active/archived states · retention policies per Space

22
appId scopes memory/session writes and read filters within one Space; it is not a separate tenant.
— Write Rules
Writes belong to the support sub-space
Writes belong to the default/global appId
Permissions, quota, and billing do not change regardless of appId
— Query Rules
Searches across all appIds under the API key
Searches only that exact sub-space
Searches only the default/global appId
Use non-empty appId for app isolation; omit appId only when broad cross-app recall is intended.

23
An ordered linear sequence of Spaces accessed via a single chain_ key — not a graph.
Default ADD target · Recall starts here · No routing policy
Searched after Node 0 · Natural-language routing policy · Write or webhook-only
Broadest scope · Routing policy · chain_source identifies this node
Recall searches nodes in sequence · high-confidence early stop ends search
Searches all nodes · reranks aggregate · chain_source on every result
Distinct from Space API keys · encodes ordered node list + traversal config

24
Two modes control the precision-vs-coverage tradeoff. Both return chain_source provenance on every result.
Stops at first node with high-confidence result · fastest path · chain_source included
Searches all nodes regardless of confidence · aggregate reranked · chain_source on every result

25
ADD goes to the first active node. UPDATE and DELETE locate the owning node by ID — no broadcast.
All new writes via chain_ key go to Node 0 · most specific Space in the chain
Server finds the object across chain nodes · writes only to owning node
Routing policies on non-first nodes control ingest-time routing · not direct writes

26
After extraction, each fact is evaluated against non-first node policies — write, webhook-only, or no match.
Classified facts with confidence scores.
Each is a routing candidate.
Candidate evaluated against Node 0 memory.
ADD / UPDATE+archive / No-op · Node 0 is the default target and has no routing policy.
memory.added fires only when a new object is written.
Natural-language prompt per node.
Write · Webhook-only · No match
Write: fact stored in target Space; memory.added fires when ADD creates a memory.
Webhook-only: space_chain.fact_routed emitted.
No match: not routed.

27
The operator interface for governing, inspecting, analyzing, and automating mem9 — without writing a single API call.

28
Four levels. Each with a distinct scope and responsibility.

29
The operator's primary workspace — live metrics, import tooling, and direct memory management.
bulk import via CSV · JSON · or API · typed + provenance-stamped
browse · search · filter · bulk archive · pin · export
operator identity · timestamp · operation type per object

30
Full-text search and multi-dimension filtering — all within the Console, no API calls.
Full-text across content + metadata · ranked by relevance
Pinned · Insight · Session · combinable
Active or archived · archived objects remain queryable
Tags · appId · multi-select · scope to specific partition

31
Both run off the hot path. All recommendations require explicit operator action.
categorizes objects by topic + entity type · filterable in Memories Explorer
identifies near-duplicate Insights · operator reviews + archives · no auto-delete
operator-initiated · generates insight reports: knowledge gaps · stale facts · summary Insights
advisory only · operator decides which recommendations to act on

32
Signed JSON over HTTPS. Push, not pull. Three event types. No polling required.
events delivered to your endpoint when they occur · no polling · no Recall API quota
signing_secret provided once at creation or rotation · HMAC verified per delivery
failed deliveries retried with exponential backoff · full delivery history in Console

33
The signing_secret is provided once — store it securely. All steps visible in the Console.

34
Three supported event types. Each payload carries the event type, timestamp, and the relevant memory or routing data.
Trigger: Direct writes · pinned writes · smart ingest ADD · successful routed target writes
Note: Smart ingest UPDATE-only reconciliation does not emit memory.added
Trigger: Single-memory or batch delete succeeds
Note: Hard delete only · archive does not fire
Trigger: Non-first-node routing policy matches a fact
Note: Emitted for routed writes and webhook-only routing; failed/quota-denied target writes do not emit a routed-write event
Only these 3 event types are supported. There is no memory.updated event; UPDATE-only reconciliation archives/supersedes internally and does not emit memory.added or memory.deleted.

35
How mem9 deploys, what makes it different, and why the architecture matters for production agent fleets.

36
Four planes. One complete memory infrastructure. Agent touches only the Runtime.
Go server · TiDB (SQL + vector) · Ingest · Smart Pipeline · Hybrid Recall · Provenance on every write
API key management · Space config · Space Chain · Webhook config · signing_secret rotation
Memories Explorer · Space detail · Memory Analysis · Deep Analysis reports
Taxonomy · Duplicate detection · Deep Analysis jobs · All outputs advisory · operator approval required
Control · Visualization · Analysis are operator-facing only
Never on the hot path · never blocks agent recall

37
Runs wherever your agents run — self-hosted, managed, or hybrid. No vendor lock-in.
pluggable models · no vendor lock-in on vector layer
drop-in replacement · one config change · no agent retraining
every capability via REST API · integrate with any framework or stack
REST API works with any agent framework · not OpenClaw-specific

38
OpenClaw Native vs mem9 — production readiness across 12 dimensions.

39
Typed writes · Pinned facts · Provenance on every object
Space-level tenant isolation · appId-level app isolation
Space Chains · Cross-session continuity · Cold-start solved
mem9.ai · Built on TiDB

40

41