SynapCores v1.8.5 — Agent memory as three SQL functions
If you've shipped an agent on SynapCores, you've written this code at least once:
CREATE TABLE IF NOT EXISTS my_agent_memory (
id TEXT PRIMARY KEY,
content TEXT,
embedding VECTOR(384),
metadata JSONB,
created_at TIMESTAMP DEFAULT NOW(),
accessed_at TIMESTAMP DEFAULT NOW()
);
CREATE INDEX ... USING HNSW (embedding);
-- … then every memory write becomes EMBED() + INSERT,
-- every recall becomes EMBED() + COSINE_SIMILARITY() + ORDER BY + LIMIT + UPDATE accessed_at,
-- every plugin re-implements all of it.
OpenClaw did it. synapcores-agent did it. Two implementations of the same thing, two places to break, two places where embedding-model defaults drifted.
v1.8.5 collapses that into three first-class SQL functions.
-- Store text in a namespace, returns a memory id
SELECT MEMORY_STORE('default', 'I prefer Python over Java') AS memory_id;
-- Semantically retrieve similar memories (table-valued)
SELECT id, content, similarity
FROM MEMORY_RECALL('default', 'what languages do I like', 5);
-- Hard-delete a memory by id, returns BOOLEAN
SELECT MEMORY_FORGET('default', 'mem_abc123') AS deleted;
That's it. No DDL. No index management. No embedding-model wiring. The engine owns the table layout, the embedding call, the cosine ranking, and the accessed_at bump. Per-tenant scoped via the standard storage path.
Why this is a release, not a recipe
Three reasons we moved this into the engine instead of leaving it as documentation:
1. It removes ~150 LOC of plumbing per plugin. The new MEMORY_STORE / RECALL / FORGET replaces hand-rolled CREATE TABLE + EMBED + HNSW + cosine ranking + bookkeeping. We migrated @synapcores/openclaw-memory v0.4.0 to use it — the plugin shrank, the contract got typed, and the embedding-model default is now whatever the engine is configured with.
2. It gives every agent a portable contract. Once MEMORY_* is in the SQL surface, every plugin that wants long-term memory has one function to call. The MCP sql_manual tool lists the three primitives with examples, so LLMs introspecting your engine can discover them at runtime.
3. It ships with three SDK companions. The release isn't just engine — the surfaces went out together:
@synapcores/sdk@0.5.0(Node) exposesclient.memory.store / recall / forgetsynapcores 0.5.0(Python) exposes the same surface@synapcores/openclaw-memory@0.4.0is the first plugin migrated to it
Same memory namespace, same row layout, regardless of which SDK or plugin writes to it.
Try it in 60 seconds
After upgrading, against any running engine:
-- Persist three preferences
SELECT MEMORY_STORE('user_42', 'Prefers Python over Java for systems work');
SELECT MEMORY_STORE('user_42', 'On a low-carb diet');
SELECT MEMORY_STORE('user_42', 'Strong opinions about Postgres vs MySQL');
-- Ask for what they like programming-wise
SELECT id, content, similarity
FROM MEMORY_RECALL('user_42', 'what programming language', 3);
-- → row 1: "Prefers Python over Java..." similarity ~0.45
-- → row 2: "Strong opinions about Postgres..." similarity ~0.20
-- → row 3: "On a low-carb diet" similarity ~0.05
MEMORY_STORE auto-creates a per-namespace backing table _memory_<namespace> on the first call, embeds the content via your configured embedding model (default all-minilm:latest, dim 384), and returns a sortable id (mem_<base32 ts>_<6 alphanum>). MEMORY_RECALL is a table-valued function — it scans the namespace, computes cosine similarity per row, and returns the top top_k rows ordered by similarity DESC. MEMORY_FORGET returns BOOLEAN; the backing row is gone.
Namespaces must match ^[A-Za-z_][A-Za-z0-9_]*$ and are per-tenant — the same default namespace in two tenants stores in different RocksDB columns.