Local-first memory governance for AI agents

Memory your agent
can't lie about.

openclaw-mem gives any agent durable, governed memory: unified recall across lexical, vector, and graph lanes; a lifecycle that keeps memories fresh; and receipts for everything — every inclusion cited, every exclusion explained, every mutation reversible. SQLite on your machine. No cloud. No telemetry.

pip install openclaw-context-pack
Installs into Claude CodeCodexOpenClaw Gemini CLICursorWindsurf any MCP client — one command each: harness quickstarts →
v2.0.0governed core: stable APIs, explicit DB migration, converged commands
1,175 tests passingplus surface, alias, MCP, and golden-slice gates
26.8 ms recall p95lexical lane at 100k rows — fixed-seed SLO receipts in repo
MRR +33.8%composite scoring passed its 50-case gate with Recall@5 held at 1.000
The problem

Agent memory fails silently.

Long-running agents don't just forget. Their memory degrades in ways similarity search can't fix — and gets worse as retrieval gets better.

🕳️

Stale notes keep matching

Yesterday's truth outranks today's correction, long after it stopped being true.

☠️

Poisoned content retrieves well

Tool output, scraped text, injected instructions — hostile content that matches the query slips straight into the prompt.

🤷

Nobody can explain the prompt

When the agent goes wrong, nothing says why a memory was included — or what was silently left out.

The answer

Store → Pack → Observe

1 · Store

Capture agent activity into append-only JSONL and a SQLite ledger — categorized into eight deterministic kinds with a six-state lifecycle.

2 · Pack

Assemble bounded, cited ContextPack bundles: trust policy filters, category quotas, composite scoring — under an explicit token budget.

3 · Observe

Trace receipts explain every include and exclude. Mutations are checkpointed and reversible. The evidence is already on disk.

One entrypoint for agents: openclaw-mem recall "…" routes lexical / vector / hybrid / graph lanes fail-open, with routing evidence in the receipt. Architecture → · Command migration →

Receipts, not vibes

Same memory. Same query.
Governed context — with evidence.

The reproducible proof runs one query twice against the same synthetic memory. Vanilla packing selects a quarantined row because its text matches. The trust-aware pack excludes it with a written reason — while citation coverage stays intact.

Reproduce it locally
{
  "synthetic_fixture_only": true,
  "quarantined_removed": true,
  "citation_coverage_preserved": true,
  "trust_policy_explains_exclusion": true
}
What you get

Governance built in, not bolted on.

🛡️

Trust-aware packing

Quarantined and untrusted records are excluded by policy with written reasons — defense-in-depth against memory poisoning.

🔗

Citations everywhere

Every packed item traces to its source record; citation coverage is measured, not assumed.

🧬

Lifecycle & taxonomy

Eight bilingual kinds, six lifecycle states, category quotas, use-based decay with protected tiers, reversible soft-archive.

Rollback by receipt

Mutations flow through plan → checkpoint → apply → receipt. DB migration is dry-runnable, backup-first, rollbackable.

🕰️

Temporal facts

"What is currently true about X" — source-linked assertions, timelines, supersession, conflict lint.

🕸️

Graph query plane

Upstream, downstream, lineage, and impact over a SQLite-derived graph — also exposed as read-only MCP tools.

Numbers with receipts

Fast enough to sit in every turn.

Fixed-seed p95 latencies at 100k rows, committed as SLO receipts — reproduce them from the repo.

100k-row lanetargetp95
stamped connect<30 ms10.754 ms
lexical recall<50 ms26.805 ms
hybrid recall<200 ms75.397 ms
graph-auto pack<300 ms62.160 ms
sqlite-vec exact search<30 ms23.030 ms

Default install is SQLite-only; NumPy, sqlite-vec, FastEmbed, and Qdrant are optional lanes that fail open. Details and methodology: v2.0.0 release notes →

Positioning

Recall engines optimize matching.
This governs what enters the prompt.

Honest framing: mem0, supermemory, and mempalace are excellent at recall benchmarks — openclaw-mem is not trying to beat them at that game. Use them together.

Recall-focused memory layersopenclaw-mem
Primary question"Did the agent remember the right thing?""Should this memory be trusted — and can you prove why it's in the prompt?"
Inclusion logicSimilarity scores (opaque)Explicit receipts with include & exclude reasons
Untrusted contentRetrieves whenever it matchesQuarantined by trust policy; exclusion documented
Mistake recoveryDelete and hopeCheckpointed mutations with rollback receipts
Storage defaultVector DB, often cloudSQLite + JSONL, local-first
Five minutes, honestly

Init. Recall. Install into your agent.

# a governed memory, from zero
pip install openclaw-context-pack
openclaw-mem init
openclaw-mem store --category preference "Prefers Asia/Taipei for time displays."
openclaw-mem recall "timezone preference" --json

# wire it into your coding agent
openclaw-mem install --harness claude-code
openclaw-mem doctor --harness claude-code

Every harness, one command. Installers are dry-runnable and atomic, write backups, and verify themselves.

Claude Code · Codex · OpenClaw · Gemini CLI · Cursor · Windsurf · generic

Choose an install path →

Quick answers

Asked before installing

Do I need a vector database or a cloud service?

No. The default stack is SQLite + JSONL on your machine. Hybrid recall works locally; there is no hosted service and no telemetry.

Will v2 read my existing v1.x database?

Yes — v1.9.x databases stay readable, and migration is explicit: db info to inspect, db migrate --dry-run to preview, backup-first apply with a rollback receipt. Legacy commands remain callable with deprecation guidance.

Is this a recall benchmark winner?

That's not the axis it competes on. Retrieval is solid (see the SLO and gate receipts above), but the differentiated value is governance: citations, trust policies, receipts, rollback. The reality check stays candid about what is and isn't measured.

Full FAQ on GitHub →

Start with the proof.
Keep the receipts.

Local-first, inspectable, reversible — evaluate it in five minutes with synthetic data, then let it earn its way into your agent stack.

MIT OR Apache-2.0 · built sidecar-first for OpenClaw, at home in any harness · 繁體中文讀者:中文版文件