ai-memory  /  essays  /  brass tacks 03
Brass tacks · 03 of 03 · about a 7 minute read

Why ai-memory beats vector-DB-only.

With measured numbers. Vector databases solve text-similarity search; they do not solve the eight other things an autonomous AI Non-Human Identity agent needs from its substrate. Here are those eight things, each one a real surface in ai-memory, each one absent from "Postgres + a vector column" alone.

This essay is not anti-vector-DB. ai-memory uses one (HNSW over MiniLM embeddings, blended with FTS5 keyword score, in the recall pipeline). The argument is narrower: if all you have is similarity search, you do not have a substrate. Eight things you also need.

01. Typed memory_kind taxonomy

A vector DB stores text + a vector. ai-memory stores text + a vector + a kind: Observation, Reflection, Persona, Concept, Entity, Claim, Relation, Event, Conversation, Decision (the Batman Form-6 vocabulary, v0.7.0). Plus free-form tags for project-specific taxonomies.

Why this matters: an agent recalling "what policies apply here" is a different query from "what did I observe last Tuesday." Without typed kinds, you smear them together and the LLM has to disambiguate every time. With typed kinds, you filter at SQL.

Source of truth
src/models/memory.rs — the 26-field Memory struct, kind is a first-class column

02. Knowledge graph with temporal validity

Memories link to other memories with typed directional edges: related_to, supersedes, contradicts, derived_from, reflects_on, derives_from (six variants at v0.7.0). Each edge carries optional valid_from / valid_until so the substrate can answer "what was true on date X" instead of just "what is in the DB now."

Backends: in-process SQL for T1; Apache AGE for T3+. The same Cypher-shaped query surface in both.

Source of truth
src/models/link.rs::MemoryLinkRelation + docs/knowledge-graph.html

03. Ed25519-signed links (attest_level)

When the autonomous tier writes a link, it signs the link with the agent's Ed25519 key. The link's attest_level field records the signing strength — unsigned, self_signed, peer_attested, signed_by_peer, daemon_signed. The verifier replays the signature on read; tampering breaks verification; the substrate refuses to surface a tampered edge in a high-attest query.

A plain vector DB has no notion of "who said this link is true and can I cryptographically verify it."

04. Operator-signed substrate rules (L1–L6)

The substrate ships with six rule layers, L1 through L6, each Ed25519-signed by the operator's key. Examples: L1 identity rules (every memory carries agent_id), L3 audit rules (every state change emits a signed event), L5 governance rules (per-agent permission scopes). The operator's pubkey lives at operator.key.pub on disk; the env-var override (AI_MEMORY_OPERATOR_PUBKEY) is documented as override-authority.

An agent cannot rewrite the rules. The operator can. That separation is the whole point.

Surface
ai-memory governance check-action (CLI, #863), the governance HTTP endpoint, and the memory_check_agent_action MCP tool

05. HMAC-required subscriptions + SSRF gate

The hook pipeline fires on 25 named substrate events. External subscribers (webhooks) must register an HMAC secret at subscription time; events are POSTed with an X-AI-Memory-Signature header; unsigned subscriptions are refused at registration. Loopback URLs are refused unless AI_MEMORY_ALLOW_LOOPBACK_WEBHOOKS=1 — an SSRF gate (issue #628, H11) so a compromised agent cannot pivot to localhost services.

06. Autonomous tier (LLM consolidate / contradict / auto-tag)

When you wire in an LLM (local Ollama, OpenAI-compatible endpoint, whatever), the substrate runs:

Measured note: on gemma4:e4b Q4_K_M on an M4 Mac Mini, the curator's auto-tag + contradiction passes hit a p50 wall of ~2.9 s for an 80-token completion at 31 tok/sec. Speculative-decoding (MTP) gating on the same host is currently a no-op pending a GGUF-converted drafter; details and reproduction in docs/v0.7.0/mtp-bench-2026-05-17.md.

07. NHI agent_id semantics

Every memory carries metadata.agent_id. Resolution ladder, preservation invariants, validation regex, special-key reservations — all documented in the developer audience page and in docs/agent-identity.html. The substrate preserves agent_id across update, dedup, MCP memory_update, HTTP PUT, import, sync, and consolidate — enforced at the caller layer and again at the SQL layer (json_set CASE clauses in db::insert and db::insert_if_newer) so a single-layer bug cannot leak.

08. Append-only signed audit chain

Every store, update, link, reflection, consolidation, promotion writes a signed event into an append-only chain. The chain replays deterministically; the verifier catches tampering; the operator can audit who did what at any prior point in time. v0.7.0 names this signed-events v4; the spec is docs/signed-events-v4.md.


The honest counter-cases

Where a vector-DB-only setup wins:

Where you want ai-memory:

The argument is not "vector DB bad." The argument is: similarity search is one feature out of nine. If you need the other eight, you need a substrate, and ai-memory is the open-source one designed around the AI NHI agent as the load-bearing user.


Reproducing the claims