// blueprint · working codeest. 2026 · no ads · no tracking
Blueprint · intermediate · 7 steps

Give Your Agent Long-Term Memory

Build the memory layer that survives the session-15 test — a local SQLite fact store with temporal validity, LLM fact extraction, rolling summaries, and embedding recall, all offline via Ollama. Companion build to the Agent Long-Term Memory drip.

← All blueprintsSource code on GitHub →
Your progress0 / 7 steps· 0%

All steps

01Step 1: What We're BuildingA local memory layer for an agent — a SQLite fact store with temporal validity, LLM fact extraction, rolling summaries, and embedding-based recall — that passes the "session-15 test": remembers what you told it, and gets a *changed* fact right.3 min02Step 2: The StoreA single SQLite file with two tables — `facts` (with validity intervals so facts can be retired) and `summaries` — plus the connection helper the rest of the build imports.2 min03Step 3: Embeddings & RecallEmbed text with Ollama, store vectors as blobs, and recall the top-k facts by cosine similarity — searching only the rows that are currently valid.2 min04Step 4: The Write PathPull durable facts out of a user turn with the local model, then upsert them — closing any prior value for the same `(subject, predicate)` so a changed fact retires the old one instead of piling up next to it.2 min05Step 5: Rolling SummariesCompress each finished session into a couple of durable sentences, so the transcript can roll off without losing the thread — the cheap, lossy memory layer that rides alongside the structured facts.2 min06Step 6: The Memory ManagerA thin layer between the agent and the store that runs the four operations from the drip — select on the way in, write on the way out — so the agent itself stays simple.2 min07Step 7: The Session-15 TestRun the exact scenario from the drip — six facts, one change, fifteen sessions later — and watch the memory pass both the recall question and the update question. Then: where to take it next.3 min