R055 · Agent architecture › Memory and context

Relate: an embedded graph database as agent memory

Read the original

agent-memorygraph-databaseknowledge-managementagent-protocolsretrievalagent-harness

TL;DR

Relate is SQLite for property graphs: a Rust, in-process, in-memory graph engine that speaks Cypher 25, persists to one .rl file or a directory, and can be served unchanged as Bolt, HTTP and MCP. For agent memory it removes the server you would otherwise run (Neo4j, a vector DB) and adds vector, full-text and spatial search on the same graph.

Source

The post is a five-sentence note by André Lindenberg (posted 2026-11-12): agent memory does not need a server; a graph can live in one file the agent uses, and the same store can run as an MCP server; the cost is that the graph must fit in RAM and one process owns it. The repo link, relatedb/relate, is in the author's first comment, which calls it a store for "memory or transactional filesystem".

The repo is a Neo4j Labs project under Apache-2.0, mostly written by Michael Hunger with Oskar Hane and others. It accepts issues, not pull requests. It carries 500+ numbered architecture decision records and SSH-signed releases.

Architecture

One engine, embedded in the caller's process, with many front doors. The live graph is held in RAM in a typed CSR (compressed sparse row) layout for traversal. Durability is a fsync'd write-ahead log plus one snapshot codec (Parquet shards or a readable JSON file). Commits are optimistic: conflicts are detected on element IDs and on unique/key constraint values at a commit-time serialization point.

StoreWhat it isDurability
:memory:RAM onlygone at exit
Directory (default)WAL + Parquet or JSON snapshotfull (ack after WAL barrier), everysecond (can lose ~1 s), or snapshot (loses everything since the last checkpoint)
Single .rl fileWAL, snapshot and catalog in one host filesame three modes
SurfaceHow it runs
CLI and shellrelate binary; --json, --jsonl, or an envelope mode with a truncated flag
Rust, Python, Nodein-process; Python via PyO3 with zero-copy Arrow out to pandas or Polars
BrowserWASM, persisted to OPFS
Java, Go, Swiftwrappers over a C ABI
relate serveone process exposing Bolt (Neo4j drivers and browser work), HTTP Query API v2, and MCP over streamable HTTP; binds to localhost with a generated token by default

The query language is Cypher 25: quantified path patterns, path selectors, schema DDL, 80+ functions, EXPLAIN/PROFILE and LOAD CSV. On top of the graph it adds vector properties with a SEARCH clause (top-K with pre-filtering), hybrid vector plus full-text search, R-tree spatial indexes, and pull/push of subgraphs to and from Neo4j or Aura. Conformance is measured by running the openCypher TCK and Neo4j's own Cypher suites on every ready PR, reported as coverage rather than enforced as a merge gate.

Agent-native design choices

The most transferable part of Relate is not the engine but how it treats an agent as the primary client. Each choice closes a specific way agents misread tool output.

Tradeoffs and limits

The project's own limitations page is unusually candid. The ones that matter for agent memory:

LimitConsequence for agent memory
Whole graph in RAM; no paging, buffer pool or spillMemory size is bounded by the host. An optional logical cap fails growing writes with Error::Capacity rather than swapping.
One process owns the storeSeveral agents sharing memory must go through one relate serve process, which becomes the single point of failure and contention.
Optimistic commits check element IDs and unique/key values onlyTwo agents that read the same facts and write different conclusions can both commit (write skew). Invariants must be expressed as constraints.
One graph per statement; single-level transactionsNo cross-project memory joins and no nested save points.
Fixed query size, nesting and traversal-depth limitsDeep multi-hop recalls must be bounded or split.
No published benchmarksLatency and memory per million edges are unknown; measure before adopting.
Anonymous CLI telemetry on by defaultTurn it off (relate telemetry off or DO_NOT_TRACK=1) for private memory.
Experimental Labs project, one week old at v1.0API and on-disk format churn is plausible; Neo4j does not support it as a product.

Failure modes

A graph store fixes the shape of memory, not its quality. The ways a Relate-backed memory goes wrong are mostly upstream of the engine.

  1. Schema drift by the agent. An agent writing Cypher freely invents labels and relationship types (:Fact, :Memory, :Note). Without schema DDL and constraints, recall queries silently miss half the graph.

  2. Stale facts stay authoritative. Nothing in the engine ages, versions or retracts a fact. Without a provenance edge (source, run, timestamp) and a garbage-collection pass, the graph is the memory-without-reconciliation failure R002 describes.

  3. Vector recall without structure. Hybrid SEARCH makes it tempting to treat the graph as a vector store with extras. The value of the graph is multi-hop recall; if every read is top-K similarity, a flat vector index is simpler.

  4. Lost writes under relaxed durability. everysecond can drop about a second of acknowledged writes on a crash, and snapshot everything since the last checkpoint. An agent that wrote a memory and moved on will not notice.

  5. The serve process becomes shared infra anyway. Once two agents or a dashboard need the same memory, relate serve is a server you run, with one process and no replication. The "no server" claim holds only for one owner.

  6. Auto-approved writes. read_cypher is safe to auto-approve; write_cypher is not. A host that approves both lets a prompt-injected agent rewrite or delete its own memory (MATCH (n) DETACH DELETE n).

When to use it

Use Relate when one agent or one developer owns the memory, the graph fits comfortably in RAM, and recall is genuinely relational (which file calls which, which decision superseded which, who said what about whom). Prefer Markdown files plus ripgrep when memory is small and mostly prose, and a server database when several writers share memory or it must outgrow one machine.

Review checklist

EntryLink to Relate
R002 The 5 layers of agent memoryRelate is a store for the semantic and episodic layers; R002's warning that the missing step is reconciliation applies unchanged.
R028 auto-ontology-mcpSame author, same pattern: a local, file-backed store behind MCP. R028 types memory in SQLite with validation; Relate makes it a graph with a read tool that cannot write.
R040 WikiTraceWikiTrace's insight-to-run links are a natural graph; Relate could hold them, but the evidence-keeping discipline is the point, not the store.
R005 Second Brain OSR005 keeps a linked-prose wiki; Relate is the typed, queryable version of those links.
R037 Floorplanfs-to-graph and git-to-graph build the same kind of codebase map Floorplan draws, as a queryable graph.
R020 The model proposes, the harness enforcesClassifying each statement with EXPLAIN before running it is a harness-side check in R020's sense.
R054 Harness engineeringCounterweight: real coding harnesses use files and ripgrep, not databases, for memory. Relate must beat that baseline to earn a place.

Sources

Connections

See R055 on the knowledge map

Part of the Research notes on nowucca.com. Figures and claims are the source's own unless the summary says otherwise.