C.W.K.
Stream
Lesson 04 of 05 · published

Structured Memory: Facts, Preferences, Procedures

~28 min · sql, facts, preferences

Level 0Observer
0 XP0/40 lessons0/12 achievements
0/100 XP to next level100 XP to go0% complete

Some memories want tables

Embeddings are good for fuzzy recall. They are bad at exact constraints. User preferences, project statuses, permissions, deadlines, and durable procedures often belong in structured storage.

Structured memory lets the agent query facts instead of hoping similarity search returns the right paragraph.

Use different stores for different truths

A preference can be a key-value record. A project can be a row with status and owner. A procedure can be a markdown document with a version. A conversation episode can be an event record linked to sources.

The point is not to build a fancy database immediately. The point is to stop pretending one vector store is the universal answer to memory. It isn't.

Code

SQLite facts table·sql
CREATE TABLE agent_facts (
  subject TEXT NOT NULL,
  predicate TEXT NOT NULL,
  object TEXT NOT NULL,
  confidence REAL NOT NULL DEFAULT 1.0,
  source TEXT NOT NULL,
  updated_at TEXT NOT NULL,
  PRIMARY KEY (subject, predicate)
);

External links

Exercise

Choose five facts your agent should store exactly. Decide whether each belongs in key-value, SQL, markdown, or vector memory.
Hint
If stale data is dangerous, structured storage usually wins.

Progress

Progress is local-only — sign in to sync across devices.
Spotted a bug or have feedback on this page?Report an Issue

Comments 0

🔔 Reply notifications (sign in)
Sign inPlease sign in to comment.

No comments yet — be the first.