<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: LOVA KUSH</title>
    <description>The latest articles on DEV Community by LOVA KUSH (@lovakush).</description>
    <link>https://dev.to/lovakush</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3988915%2F1006d68d-7b5d-4bef-b757-85c0492e9d92.png</url>
      <title>DEV Community: LOVA KUSH</title>
      <link>https://dev.to/lovakush</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/lovakush"/>
    <language>en</language>
    <item>
      <title>Agent Memory Is Not a Vector Database. It's a Forgetting System.</title>
      <dc:creator>LOVA KUSH</dc:creator>
      <pubDate>Sat, 19 Sep 2026 11:42:16 +0000</pubDate>
      <link>https://dev.to/lovakush/agent-memory-is-not-a-vector-database-its-a-forgetting-system-453p</link>
      <guid>https://dev.to/lovakush/agent-memory-is-not-a-vector-database-its-a-forgetting-system-453p</guid>
      <description>&lt;p&gt;Ask someone to sketch memory for an LLM app and you'll usually get one arrow.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;user message -&amp;gt; embed -&amp;gt; vector DB -&amp;gt; search later
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That's the demo version. It works for a weekend project. It also hides most of the problem.&lt;/p&gt;

&lt;p&gt;This post is about the part the arrow leaves out: deciding what gets stored in the first place. The short version is that a good memory system spends most of its effort on forgetting.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Before we start:&lt;/strong&gt; I haven't built this yet. This is a design walkthrough from studying how a ChatGPT-style memory system could be put together, not a report from production. I say "ChatGPT-style" on purpose. I can't see OpenAI's internals, so I'm not describing them. This is reasoning about how you'd design something that behaves like it.&lt;/p&gt;

&lt;h2&gt;
  
  
  The one problem memory solves
&lt;/h2&gt;

&lt;p&gt;Imagine an assistant with no memory. In one chat you say you like short answers. In the next you ask it to help plan your startup, and it has forgotten all of it. You explain who you are, what you want and how you like to be spoken to. Again.&lt;/p&gt;

&lt;p&gt;Memory exists to solve exactly one problem: &lt;strong&gt;information loss across interactions.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;That sentence has a consequence people skip. If the goal is to reduce loss, the goal is not to store everything. A database stores everything. A memory system stores only what improves future behavior. Memory is selective retention.&lt;/p&gt;

&lt;p&gt;Hold onto the word "selective". It means the first thing in front of your store isn't a write. It's a decision about whether to write at all.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why one arrow is the wrong picture
&lt;/h2&gt;

&lt;p&gt;A production memory system breaks into six parts. Each has its own job and its own ways to fail.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F438oxomktmkp3b5idoq3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F438oxomktmkp3b5idoq3.png" alt="The one-arrow picture (user message, embed, vector DB, search later) above the six subsystems a memory system needs: capture, evaluation, storage, retrieval, decay and governance. Only storage and retrieval appear in the one-arrow picture." width="800" height="436"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Figure 1. The one-arrow picture, and the six jobs a memory system has to do. Each box shows the job and the question it answers.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;A vector store covers, at best, storage and retrieval. That leaves four of the six out of the one-arrow picture, and those four are where a lot of the hard problems live.&lt;/p&gt;

&lt;p&gt;This post covers Capture and Evaluation, with a glance at Storage. Retrieval, decay and governance come in later posts in this series.&lt;/p&gt;

&lt;h2&gt;
  
  
  Memory comes in kinds
&lt;/h2&gt;

&lt;p&gt;Before designing a store, look at the thing you're copying. Humans don't keep everything in one bucket. They remember in kinds, and each kind has a different lifetime, different update rules and different triggers for recall. That maps well to engineering.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Kind&lt;/th&gt;
&lt;th&gt;What it holds&lt;/th&gt;
&lt;th&gt;Example&lt;/th&gt;
&lt;th&gt;Storage rule&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Episodic&lt;/td&gt;
&lt;td&gt;Events, with a time attached&lt;/td&gt;
&lt;td&gt;The user launched a startup&lt;/td&gt;
&lt;td&gt;Event log, append-only&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Semantic&lt;/td&gt;
&lt;td&gt;Stable facts&lt;/td&gt;
&lt;td&gt;The user works in ML&lt;/td&gt;
&lt;td&gt;Overwrite when the fact changes, deduplicate&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Procedural&lt;/td&gt;
&lt;td&gt;How the user likes things done&lt;/td&gt;
&lt;td&gt;Prefers first-principles explanations&lt;/td&gt;
&lt;td&gt;Small set, high retrieval priority&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Working&lt;/td&gt;
&lt;td&gt;The live conversation&lt;/td&gt;
&lt;td&gt;Everything in the current context window&lt;/td&gt;
&lt;td&gt;Not persisted by default&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Two consequences. First, your store shouldn't be one table with a &lt;code&gt;text&lt;/code&gt; column. The kind decides the rules. Second, memories move. Something said once in the live conversation, if it proves useful, gets promoted to a longer-lived kind so it survives the conversation.&lt;/p&gt;

&lt;h2&gt;
  
  
  The write path and the read path
&lt;/h2&gt;

&lt;p&gt;Memory is two pipelines: one that writes it and one that reads it back.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F6w4yx0cjf547neotmpdv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F6w4yx0cjf547neotmpdv.png" alt="The write path (user message, extractor, evaluator as the write gate, memory store) beside the read path (new message, retriever, context composer, LLM). A dashed line carries stored memories from the store to the retriever, and low-value candidates are dropped at the evaluator." width="800" height="456"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Figure 2. The write path on the left, the read path on the right. The memory store is the only thing they share.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;On the write path, the &lt;strong&gt;extractor&lt;/strong&gt; is an LLM task. It reads a conversation turn and pulls out candidate memories: preferences, goals, projects, relationships, long-term facts. Its output is structured (JSON), not a blob of text. The &lt;strong&gt;evaluator&lt;/strong&gt; decides whether each candidate is worth keeping. That's the write gate, and it gets its own section below. The &lt;strong&gt;store&lt;/strong&gt; persists whatever survives, by kind.&lt;/p&gt;

&lt;p&gt;On the read path, the &lt;strong&gt;retriever&lt;/strong&gt; finds candidate memories for the new message. The &lt;strong&gt;context composer&lt;/strong&gt; turns the best ones into a short block the model can read. The &lt;strong&gt;LLM&lt;/strong&gt; answers with that block in its context.&lt;/p&gt;

&lt;p&gt;The read path is where the system feels smart or feels broken, because the user only ever sees what you surface, never what you kept. That's the next post. For now, one rule: nothing reaches the read path unless it survived the write path.&lt;/p&gt;

&lt;h2&gt;
  
  
  The write gate
&lt;/h2&gt;

&lt;p&gt;This is where most memory systems go wrong. The naive version stores everything. That causes memory pollution: the store fills with noise, retrieval drowns in it, and every prompt gets cluttered with irrelevant facts.&lt;/p&gt;

&lt;p&gt;The fix is to score each candidate by future utility, with one question: will this improve a future conversation?&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Candidate&lt;/th&gt;
&lt;th&gt;Utility&lt;/th&gt;
&lt;th&gt;Why&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;"I use PostgreSQL"&lt;/td&gt;
&lt;td&gt;High&lt;/td&gt;
&lt;td&gt;A stable fact that shapes future technical answers. Keep it.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;"I'm building a startup"&lt;/td&gt;
&lt;td&gt;High&lt;/td&gt;
&lt;td&gt;Anchors a lot of future conversations. Keep it, high importance.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;"Today I had coffee"&lt;/td&gt;
&lt;td&gt;Low&lt;/td&gt;
&lt;td&gt;True, but it changes no future decision. Drop it.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The component that asks this question is the &lt;strong&gt;evaluator&lt;/strong&gt;. In an MVP it can be an LLM judge with a prompt like: "Should this memory improve future conversations? Answer yes or no, and give an importance from 1 to 10." At scale it should turn into a cheap deterministic classifier, because the same memory ought to score the same way every time. Either way, it sets two fields on the record: &lt;code&gt;importance&lt;/code&gt; and &lt;code&gt;confidence&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Confidence matters more than it looks. Say a user writes "I'm thinking about moving to Bangalore." A careless extractor stores "lives in Bangalore." Now any answer that depends on where the user lives can be wrong, and sound sure about it. That's the wrong-memory failure, and a confidence score is part of the fix.&lt;/p&gt;

&lt;p&gt;Here's what the gate does with three candidates:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fj2gaisv0jo5vy47wqro8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fj2gaisv0jo5vy47wqro8.png" alt="Three candidate memories enter the evaluator. " width="800" height="391"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Figure 3. The write gate on three candidates. One is stored, two are dropped, for two different reasons.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;And here's the same gate as a sketch in code. The judge is a stub with canned verdicts so the example runs. In a real system that's an LLM call.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;dataclasses&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;dataclass&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;datetime&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;datetime&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;timezone&lt;/span&gt;


&lt;span class="nd"&gt;@dataclass&lt;/span&gt;
&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Verdict&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;keep&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;bool&lt;/span&gt;          &lt;span class="c1"&gt;# will this improve a future conversation?
&lt;/span&gt;    &lt;span class="n"&gt;importance&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;int&lt;/span&gt;     &lt;span class="c1"&gt;# 1-10
&lt;/span&gt;    &lt;span class="n"&gt;confidence&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;float&lt;/span&gt;   &lt;span class="c1"&gt;# 0.0-1.0, how sure we are it is true
&lt;/span&gt;

&lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;write_gate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;candidate&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;judge&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;min_importance&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;min_confidence&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mf"&gt;0.6&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
    &lt;span class="sh"&gt;"""&lt;/span&gt;&lt;span class="s"&gt;Return a memory record if the candidate earns a place in the store, else None.&lt;/span&gt;&lt;span class="sh"&gt;"""&lt;/span&gt;
    &lt;span class="n"&gt;verdict&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;judge&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;candidate&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="n"&gt;verdict&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;keep&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="bp"&gt;None&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;verdict&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;importance&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="n"&gt;min_importance&lt;/span&gt; &lt;span class="ow"&gt;or&lt;/span&gt; &lt;span class="n"&gt;verdict&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;confidence&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="n"&gt;min_confidence&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="bp"&gt;None&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;content&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;candidate&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;importance&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;verdict&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;importance&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;confidence&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;verdict&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;confidence&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;created_at&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;datetime&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;now&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;timezone&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;utc&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;


&lt;span class="c1"&gt;# Stand-in for the LLM judge, with canned verdicts so the example runs.
&lt;/span&gt;&lt;span class="n"&gt;CANNED&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;User uses PostgreSQL&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;Verdict&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="bp"&gt;True&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;8&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mf"&gt;0.95&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;User had coffee today&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;Verdict&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="bp"&gt;False&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mf"&gt;0.99&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
    &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;User is thinking about moving to Bangalore&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;Verdict&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="bp"&gt;True&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;6&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mf"&gt;0.40&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;text&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;CANNED&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;record&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;write_gate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;text&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;CANNED&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;get&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;text&lt;/span&gt;&lt;span class="si"&gt;!r:&lt;/span&gt;&lt;span class="mi"&gt;50&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt; -&amp;gt; &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;STORED&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt; &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;record&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;dropped&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Output:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;'User uses PostgreSQL'                             -&amp;gt; STORED
'User had coffee today'                            -&amp;gt; dropped
'User is thinking about moving to Bangalore'       -&amp;gt; dropped
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The thresholds are placeholders. You'd tune them against real conversations. A real system might also keep the Bangalore item at low confidence instead of dropping it. What matters is that the number exists, and that something checks it before the memory can shape an answer.&lt;/p&gt;

&lt;h2&gt;
  
  
  The memory record
&lt;/h2&gt;

&lt;p&gt;Once the gate approves something, what lands in the store is a structured record, not a blob of text. A first cut:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;memory {
  id            unique identifier
  user_id       owner, isolates one user from another
  type          episodic | semantic | procedural
  content       the fact, in plain language
  importance    how much this should weigh        (set at write)
  confidence    how sure we are it is true         (set at write)
  source        where it came from: conversation id, document, user
  created_at    when we learned it
  updated_at    when it last changed
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Two fields do quiet work. &lt;code&gt;importance&lt;/code&gt; and &lt;code&gt;confidence&lt;/code&gt; let the system tell "is building a startup" apart from "maybe thinking about moving cities". &lt;code&gt;source&lt;/code&gt; is what lets the system answer "why do you think that?" later. Each field is there because it enables a decision further down the pipeline: ranking, decay, explaining. Decay adds two more fields (a weight and a reinforcement count), which is a later post.&lt;/p&gt;

&lt;h2&gt;
  
  
  What to keep in mind if you build this
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Name the problem before the tools.&lt;/strong&gt; The problem is information loss across conversations. If a candidate memory doesn't reduce it, don't store it.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Put the gate in front of the store.&lt;/strong&gt; Decide what gets in before you decide where it goes. Anything that accumulates state, like logs, caches or indexes, needs an admission policy.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Type your memories.&lt;/strong&gt; Events, facts and preferences have different lifetimes and update rules. One table with one text column ignores that.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Store confidence and source with every record.&lt;/strong&gt; Without them you can't catch a wrong memory, and you can't explain a right one.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Don't stop at a vector store.&lt;/strong&gt; Retrieval, decay and governance each need an owner, and each fails in its own way.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;If you want a short checklist to start from, the notes I'm working from open with a set of questions to answer before any design. The first three: What decision will this memory improve? What deserves remembering? What deserves forgetting? Answer those before you pick a database.&lt;/p&gt;

&lt;p&gt;Next in the series: retrieval. Storage is mostly a solved problem. Retrieval is where the system feels smart or feels broken.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>llm</category>
      <category>machinelearning</category>
      <category>architecture</category>
    </item>
  </channel>
</rss>
