AN-07 L2 Conformance level: Memory Cluster: Knowledge

Agent Memory

Notes you can read and edit are the truth. Indexes are a cache you can throw away.

Definition

Agent Memory = notes you can read and edit + indexes you can throw away at any time. Every note cites its sources; indexes (full-text, vector, graph, outline) are only derivatives of the notes; and background maintenance jobs only propose edits and never rewrite the raw journal.

v0.2 Draft specification Updated

The problem

Memory frameworks put memory in opaque databases: you cannot inspect, diff, migrate or correct it, deleting it reliably is hard, and the index and the embedding model are locked in. And memory itself is an attack surface: in one 2026 study persistent-memory poisoning reached an average attack success rate of 50.46% across two agents, and another study used one carefully crafted email to succeed against both file-system and vector memory backends.

Meanwhile, “which memory architecture is best” is nowhere near settled: benchmarks contradict each other. A design that bets on no particular retrieval algorithm is the one that can survive three years of change.

How it works

  • Notes are the truth. Markdown with YAML frontmatter: kind (episodic, semantic, procedural, preference), subject, sources, confidence, valid_from, valid_to, supersedes, origin, reviewed.
  • Update, do not overwrite. A new fact supersedes the old one; valid time and record time are kept apart, because facts change and common benchmarks barely test that.
  • Indexes are a cache. BM25 (for example SQLite FTS5), vectors (several can coexist) and an optional graph; every derivative carries its recipe and inputs. Changing the embedding model is a background recomputation, and the old index is kept until the new one meets the golden recall tests.
  • Two kinds of derivation. Deterministic ones (chunking, BM25, embeddings from a fixed model) are reproducible; generative ones (LLM summaries, extracted facts) can only be “regenerated and compared”, so they are marked generated: true and never serve as the only copy.
  • Write path. nas_remember writes a note (with sources) to the current branch, and taint is inherited. A note from a session with external taint goes into quarantine, marked unreviewed: it can be recalled but is not autoloaded and does not enter MEMORY.md.
  • Read path. nas_recall = search, candidates, a budgeted view plus evidence pointers, and it shows each note’s source and review state.
  • Maintenance jobs (overnight or when idle): deduplicate, consolidate episodes into semantic facts, flag contradictions, retire outdated facts, rebuild indexes. Jobs produce proposals on a branch for a person or an agent to review; they never delete the raw journal; the “regret rate” (the share of proposals that get rolled back) is measured.
  • Golden recall tests. For each Home, a set of “question, expected note” pairs that run automatically when the model or the indexer changes.

Start small

  • memory/notes/*.md with frontmatter, and SQLite FTS5 for search.
  • Run ten golden questions in CI.
  • Vector indexes and maintenance jobs can come later; get “provenance” and “only reviewed notes autoload” right first.

Interface sketch

Illustrative only. Field names may change before specification v0.3.

memory/notes/customer-acme.md
---
id: mem_4kq2
kind: semantic
subject: customer/acme
valid_from: 2026-10-02
valid_to: null
confidence: 0.8
origin: agent
reviewed: true
sources:
  - nas://home-box/agents/cleo/journal/2026-10-02.md@9f2c1de#L12-L18
supersedes: [mem_1xa9]
---
Acme renewed for 24 months; the champion moved from Dana to Luis.

What the specification asks for

  • Notes MUST be readable without the Memory layer (they are plain files in the Store).
  • Every derivative MUST carry its recipe and inputs; an index MUST be disposable and rebuildable.
  • Notes written by a tainted session MUST NOT be autoloaded before they are reviewed.
  • A new fact MUST replace an old one with supersedes instead of overwriting.
  • Maintenance jobs MUST work on a branch and only propose; they MUST NOT delete the raw journal.
  • Every Home SHOULD carry golden recall tests and run them whenever the model or the indexer changes.

Borrowed, and what is new

What follows is all established thinking, and OpenClaw’s memory architecture already does provenance labels, per-tier quarantine and taint propagation during consolidation. What is new: OpenClaw does it inside one runtime; we propose doing it in shared storage so any runtime benefits, and demoting the index to a disposable cache so the retrieval algorithm can change without losing memory.

Honest limits

  • Generative derivatives can never be reproduced bit for bit.
  • A maintenance job can “harden” a mistake into a fact, which is why it only proposes and never edits directly.
  • Which memory architecture is best remains unsettled.

Open questions

  • When should an agent write memory itself, and when should a maintenance job?
  • What is the regression standard across model versions?

Questions

Why files rather than a vector database?

Files are the truth you can read, edit, diff and take with you; a vector index is a derived cache that can coexist in several versions and be rebuilt at any time. Letta’s benchmark showed that an agent with just grep and file tools is competitive, but benchmarks contradict each other, so the design does not bet on one retrieval algorithm.

How is memory poisoning prevented?

It cannot be guaranteed that nothing bad is ever written, but the consequences can be bounded: content from outside carries the external label; notes written by a tainted session go to quarantine and are not autoloaded; merges are reviewed; and when something goes wrong you can follow the provenance chain to the affected notes and roll back.

Do I have to migrate memory when I change the embedding model?

No. The notes do not change; only the indexes are recomputed in the background with the new recipe, and the old index is kept until the new one meets the golden recall tests.

Cite this page

Stable addresses and a suggested citation for people, search engines and agents.

Suggested citation
Agent NAS project. “Agent Memory.” agentnas.com, 2026-11-11. https://agentnas.com/concepts/agent-memory/