<?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: Maksim Grosskopf</title>
    <description>The latest articles on DEV Community by Maksim Grosskopf (@grosskopf).</description>
    <link>https://dev.to/grosskopf</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%2F4260061%2Fcdda2ada-3b9d-421f-be27-cdf2d6f03ffa.jpg</url>
      <title>DEV Community: Maksim Grosskopf</title>
      <link>https://dev.to/grosskopf</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/grosskopf"/>
    <language>en</language>
    <item>
      <title>How We Built Editable Memory for an AI Companion</title>
      <dc:creator>Maksim Grosskopf</dc:creator>
      <pubDate>Mon, 23 Nov 2026 09:36:08 +0000</pubDate>
      <link>https://dev.to/mentavita/how-we-built-editable-memory-for-an-ai-companion-252p</link>
      <guid>https://dev.to/mentavita/how-we-built-editable-memory-for-an-ai-companion-252p</guid>
      <description>&lt;p&gt;Editable AI memory lets an assistant carry context across conversations and gives a person a way to correct what the assistant can recall.&lt;/p&gt;

&lt;p&gt;A conversation can hold two versions of the same fact. In one chat a person says they prefer a Sunday check-in. A week later they change it to Friday. The next conversation needs the Friday preference, even if the original Sunday message is still in their history.&lt;/p&gt;

&lt;p&gt;That small example captures the design problem behind editable AI memory in Mentavita. Updating a field is straightforward. Making the update survive retrieval, cached context, and background summarization takes more care.&lt;/p&gt;

&lt;h2&gt;
  
  
  Give a saved memory its own lifecycle
&lt;/h2&gt;

&lt;p&gt;Conversation history records what was said. A saved memory represents something that can carry forward into another conversation. Giving the memory its own record lets the person inspect and correct what the assistant will use later.&lt;/p&gt;

&lt;p&gt;A correction updates that record. The edit path invalidates cached context, schedules a refresh of the derived user profile, and queues a refresh when the text changes. Those steps matter because the edited row is only one of the places the old wording could have reached. A regression test should cover the warm-cache case, where a previous turn has already assembled context from the Sunday version.&lt;/p&gt;

&lt;p&gt;The public feature description shows the controls this design supports. &lt;a href="https://mentavita.app/en/features#memory" rel="noopener noreferrer"&gt;Mentavita’s conversation memory controls&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Apply visibility before ranking
&lt;/h2&gt;

&lt;p&gt;Cross-session retrieval asks two questions in order. Is this material eligible to be used here? Of the eligible candidates, which ones help answer this turn?&lt;/p&gt;

&lt;p&gt;Mentavita uses a shared visibility layer where memory is read. The reader’s purpose and the person’s settings determine which records are eligible. A session-only item, for example, stays out of cross-session retrieval. The context compiler can then select and fit eligible material to a prompt budget.&lt;/p&gt;

&lt;p&gt;Here is the shape of that flow in pseudocode.&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="n"&gt;access&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;resolve_memory_access&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;user&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;purpose&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"chat"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;eligible&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;readable_memory_items&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;user&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;access&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;access&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;ranked&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;rank_for_turn&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;eligible&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;message&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;context&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;fit_to_budget&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;ranked&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;budget&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The ordering matters. An obsolete detail can be highly relevant to a query about check-ins. A better ranker would make it more likely to win unless the access and lifecycle rules exclude it first.&lt;/p&gt;

&lt;h2&gt;
  
  
  Treat pause as a time interval
&lt;/h2&gt;

&lt;p&gt;A pause toggle has to work for events that reach a worker late. Suppose someone pauses memory at 11:00, writes a message at 11:05, and resumes at 11:10. A worker processing that message at 11:15 sees memory enabled. It needs the message timestamp and the recorded pause interval to decide whether it can derive memory from the event.&lt;/p&gt;

&lt;p&gt;In Mentavita, pausing stops cross-session recall and new derived memory. We record the pause interval so later processing still excludes content written during it. History can continue to show the original message. That separation gives pause a consistent meaning across live and background work.&lt;/p&gt;

&lt;h2&gt;
  
  
  Follow a forgotten item through its derived copies
&lt;/h2&gt;

&lt;p&gt;The forget action marks an item so it is excluded from future memory use. The original conversation has its own lifecycle. A summary, a derived profile, or cached prompt context may already contain a version of the detail, so checking the primary memory row alone leaves part of the job untested.&lt;/p&gt;

&lt;p&gt;The useful assertion is at each reader’s output. After forgetting the Sunday preference, reassemble context for a related question and check whether the detail reaches the model. Where the application also uses memory for reports or other outputs, exercise those readers with the same fixture. That turns the shape of the system into a list of concrete checks.&lt;/p&gt;

&lt;h2&gt;
  
  
  A regression checklist for LLM memory
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Scenario&lt;/th&gt;
&lt;th&gt;What to check&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Edit after a warm read&lt;/td&gt;
&lt;td&gt;Build context once, change Sunday to Friday, then build context for the same question in a new session. The current preference should come through.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Delayed work after a pause&lt;/td&gt;
&lt;td&gt;Process a source message created during the pause after memory resumes. The worker should skip deriving a memory from it.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Forget after summarization&lt;/td&gt;
&lt;td&gt;Assemble context after forgetting a fact that appeared in an earlier summary. The forgotten detail should stay out of eligible context.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;A session-only preference&lt;/td&gt;
&lt;td&gt;Ask a similar question in a different session. The preference should stay scoped to its original session.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;I’d keep these tests focused on the final context built for each reader. A generated reply can vary across runs or happen to omit an old detail. The assembled context tells you whether the model received that detail in the first place.&lt;/p&gt;

&lt;p&gt;If you build stateful assistants, which part of your system tends to hold on to an old fact the longest?&lt;/p&gt;

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