<?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: Muhammad Muavia</title>
    <description>The latest articles on DEV Community by Muhammad Muavia (@muhammad_muavia).</description>
    <link>https://dev.to/muhammad_muavia</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%2F4033398%2Ff60b7a08-0e1a-4868-b58a-9ce3c7242b64.png</url>
      <title>DEV Community: Muhammad Muavia</title>
      <link>https://dev.to/muhammad_muavia</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/muhammad_muavia"/>
    <language>en</language>
    <item>
      <title>AI Agents Don’t Need More Memory. They Need Memory Governance.</title>
      <dc:creator>Muhammad Muavia</dc:creator>
      <pubDate>Fri, 17 Jul 2026 07:58:58 +0000</pubDate>
      <link>https://dev.to/muhammad_muavia/ai-agents-dont-need-more-memory-they-need-memory-governance-15ej</link>
      <guid>https://dev.to/muhammad_muavia/ai-agents-dont-need-more-memory-they-need-memory-governance-15ej</guid>
      <description>&lt;p&gt;Most AI assistants are impressive until the conversation ends.&lt;/p&gt;

&lt;p&gt;Start a new session and the context disappears. Keep adding history and the&lt;br&gt;
opposite problem appears: the model sees too much, including old decisions,&lt;br&gt;
irrelevant details, and information the user no longer wants remembered.&lt;/p&gt;

&lt;p&gt;That led me to a question that changed how I thought about agent memory:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;What if the difficult part is not remembering more, but governing what is&lt;br&gt;
remembered?&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;I built &lt;strong&gt;MemoPilot IQ&lt;/strong&gt; to explore that question for the&lt;br&gt;
&lt;a href="https://www.qwencloud.com/challenge/hackathon" rel="noopener noreferrer"&gt;Qwen Cloud Global AI Hackathon&lt;/a&gt;,&lt;br&gt;
Track 1: MemoryAgent. It is an auditable memory layer that turns conversations&lt;br&gt;
into structured records, retrieves the right records inside a hard context&lt;br&gt;
budget, retires stale information without destroying the audit trail, and&lt;br&gt;
explains every memory it uses or skips.&lt;/p&gt;

&lt;p&gt;This article is the engineering story behind the project: the failure modes I&lt;br&gt;
designed for, how Qwen Cloud fits into the architecture, what I learned while&lt;br&gt;
building MemoryOS, and how I am testing claims that are easy to make but much&lt;br&gt;
harder to prove.&lt;/p&gt;
&lt;h2&gt;
  
  
  The real problem: memory can make an agent confidently wrong
&lt;/h2&gt;

&lt;p&gt;Imagine that I tell a project assistant:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Use React and Vite for the frontend.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;A week later, in another session, I make a new decision:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;We are switching to Next.js.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;A basic vector database can retrieve both statements because both are&lt;br&gt;
semantically relevant to a question about the frontend stack. If the older&lt;br&gt;
statement happens to score higher, the assistant may recommend React and Vite&lt;br&gt;
again. The system remembered correctly and still produced the wrong result.&lt;/p&gt;

&lt;p&gt;I found five recurring failure modes:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Amnesia:&lt;/strong&gt; useful preferences and constraints disappear between sessions.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Context flooding:&lt;/strong&gt; raw history consumes tokens without adding equivalent
value.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Stale recall:&lt;/strong&gt; an old decision competes with the decision that replaced
it.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Opaque retrieval:&lt;/strong&gt; the user cannot see why a memory influenced an answer.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Irreversible storage:&lt;/strong&gt; users cannot meaningfully inspect, correct, export,
or erase what the agent remembers.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;These are lifecycle and governance problems, not only retrieval problems.&lt;/p&gt;
&lt;h2&gt;
  
  
  From chat history to structured memory
&lt;/h2&gt;

&lt;p&gt;MemoPilot IQ does not treat every message as permanent memory. A Qwen-powered&lt;br&gt;
&lt;strong&gt;Memory Editor&lt;/strong&gt; extracts candidate records and lifecycle actions from a turn.&lt;br&gt;
Each record has an explicit type, status, source, confidence, importance,&lt;br&gt;
timestamps, tags, privacy level, and optional expiration or supersession links.&lt;/p&gt;

&lt;p&gt;The schema supports 12 memory categories, including preferences, project facts,&lt;br&gt;
decisions, constraints, deadlines, mistakes, learning goals, tasks, critical&lt;br&gt;
rules, and temporary information.&lt;/p&gt;

&lt;p&gt;A simplified supersession result looks like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"decision"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"status"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"superseded"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"content"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Use React + Vite for the frontend"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"superseded_by"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"mem_nextjs"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The replacement stays active:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"memory_id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"mem_nextjs"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"decision"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"status"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"active"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"content"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"Use Next.js for the frontend"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"supersedes"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"mem_react_vite"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The old record is not silently deleted. It remains visible in the timeline for&lt;br&gt;
accountability, but lifecycle filtering prevents it from entering future model&lt;br&gt;
context.&lt;/p&gt;

&lt;p&gt;That distinction became one of the core ideas in the project:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Preserve history for auditability; select only current truth for reasoning.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h2&gt;
  
  
  Architecture: three focused roles for Qwen Cloud
&lt;/h2&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%2F9seav4y3ex4uv548lvx8.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%2F9seav4y3ex4uv548lvx8.png" alt="MemoPilot IQ architecture showing the React frontend, FastAPI backend, MemoryOS, Qwen Cloud, Tablestore, OSS, and Alibaba deployment targets" width="800" height="528"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;MemoPilot IQ separates the language model from the memory-governance logic.&lt;br&gt;
When cloud credentials are configured, Qwen Cloud serves three focused roles:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Answer generation:&lt;/strong&gt; &lt;code&gt;qwen-plus&lt;/code&gt; reasons over the current question and the
assembled, budgeted memory context.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Structured extraction:&lt;/strong&gt; a JSON-only Memory Editor identifies new records,
updates, supersession, archival, and forgetting actions.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Semantic retrieval:&lt;/strong&gt; &lt;code&gt;text-embedding-v3&lt;/code&gt; embeds queries and memory content
for dense similarity search.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The rest is application logic I can test independently:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;a React and Vite interface for chat, traces, memory controls, timeline,
analytics, evaluation, and a live memory graph;&lt;/li&gt;
&lt;li&gt;a FastAPI service that owns orchestration and API boundaries;&lt;/li&gt;
&lt;li&gt;MemoryOS components for extraction, scoring, retrieval, context assembly,
forgetting, reflection, and trace generation;&lt;/li&gt;
&lt;li&gt;SQLite and in-process vectors for local development;&lt;/li&gt;
&lt;li&gt;Alibaba Cloud Tablestore and OSS adapters for cloud persistence and redacted
snapshots;&lt;/li&gt;
&lt;li&gt;container and deployment configuration targeting Alibaba Cloud compute.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Local mode deliberately includes a deterministic offline fallback. That lets a&lt;br&gt;
contributor clone the project, exercise the complete workflow, and run the test&lt;br&gt;
suite without receiving my credentials or spending API credit. It does &lt;strong&gt;not&lt;/strong&gt;&lt;br&gt;
pretend to be final model evidence; the final deployed Qwen-backed evaluation is&lt;br&gt;
a separate release gate.&lt;/p&gt;
&lt;h2&gt;
  
  
  What happens when a user asks a question?
&lt;/h2&gt;

&lt;p&gt;The request path is designed to keep model context small and explainable.&lt;/p&gt;
&lt;h3&gt;
  
  
  1. Scope the candidates
&lt;/h3&gt;

&lt;p&gt;Memory retrieval begins inside the current user and project boundary. Records&lt;br&gt;
that are deleted, expired, or superseded are ineligible for injection. This&lt;br&gt;
prevents a high semantic score from reviving information that lifecycle policy&lt;br&gt;
has already retired.&lt;/p&gt;
&lt;h3&gt;
  
  
  2. Retrieve with more than vector similarity
&lt;/h3&gt;

&lt;p&gt;The retriever combines dense similarity with sparse keyword and tag overlap,&lt;br&gt;
then applies structured filters. This matters for exact technical tokens,&lt;br&gt;
deadlines, names, and project-specific vocabulary that semantic similarity may&lt;br&gt;
not rank reliably on its own.&lt;/p&gt;
&lt;h3&gt;
  
  
  3. Score with interpretable components
&lt;/h3&gt;

&lt;p&gt;Each candidate receives a score built from semantic relevance, importance,&lt;br&gt;
recency, confidence, usage, project match, criticality, and explicit penalties.&lt;br&gt;
The current formula is intentionally visible:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;score = 0.40*semantic + 0.20*importance + 0.15*recency
      + 0.10*confidence + 0.10*usage + 0.15*project_match
      + 0.20*critical_bonus
      - 0.30*outdated - 0.25*privacy - 0.50*superseded
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The weights are configuration and engineering choices, not universal truths.&lt;br&gt;
Exposing them makes the system debuggable and gives future evaluation something&lt;br&gt;
specific to challenge.&lt;/p&gt;

&lt;h3&gt;
  
  
  4. Enforce a hard context budget
&lt;/h3&gt;

&lt;p&gt;The context builder has a default memory budget of 2,500 tokens. Critical and&lt;br&gt;
pinned records are prioritized, but priority never overrides the configured&lt;br&gt;
limit. The objective is to deliver the smallest useful set of memories, not to&lt;br&gt;
dump the database into the prompt.&lt;/p&gt;

&lt;h3&gt;
  
  
  5. Return the answer and the evidence
&lt;/h3&gt;

&lt;p&gt;The API returns the answer together with memory actions and a &lt;strong&gt;Memory Trace&lt;/strong&gt;.&lt;br&gt;
The trace shows:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;which memories were included;&lt;/li&gt;
&lt;li&gt;which candidates were skipped;&lt;/li&gt;
&lt;li&gt;the score components and selection reason;&lt;/li&gt;
&lt;li&gt;approximate token cost and remaining budget;&lt;/li&gt;
&lt;li&gt;the active runtime and provider mode.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In the React-to-Next.js scenario, the user can see the active Next.js decision&lt;br&gt;
in the included set and the older React + Vite decision marked as superseded in&lt;br&gt;
the timeline. The interface turns a hidden retrieval decision into something a&lt;br&gt;
person can inspect.&lt;/p&gt;

&lt;h2&gt;
  
  
  Forgetting should be a feature, not a failure
&lt;/h2&gt;

&lt;p&gt;“Persistent memory” can sound like “store everything forever.” I think that is&lt;br&gt;
the wrong product goal.&lt;/p&gt;

&lt;p&gt;MemoPilot IQ treats forgetting as a lifecycle transition:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;temporary memories and deadlines can expire;&lt;/li&gt;
&lt;li&gt;low-value stale records can be archived;&lt;/li&gt;
&lt;li&gt;contradictory decisions can be superseded non-destructively;&lt;/li&gt;
&lt;li&gt;users can pin, archive, delete, export, or erase project memory;&lt;/li&gt;
&lt;li&gt;a reflection pass can consolidate duplicates and derive higher-level
insights without claiming to retrain the model.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Before persistence, text passes through pattern-based secret detection and&lt;br&gt;
redaction. The same boundary applies to stored turn snapshots. This is a useful&lt;br&gt;
guardrail, not a promise that pattern matching catches every possible secret;&lt;br&gt;
the safer rule remains not to paste credentials into a conversation.&lt;/p&gt;

&lt;h2&gt;
  
  
  Testing the claim instead of marketing it
&lt;/h2&gt;

&lt;p&gt;Memory products are easy to demo selectively. A single successful recall says&lt;br&gt;
very little about stale-memory leakage, budget discipline, or behavior across&lt;br&gt;
different scenarios.&lt;/p&gt;

&lt;p&gt;I built a 24-scenario diagnostic that runs both a memory-enabled path and a&lt;br&gt;
no-memory baseline. It reports:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;strict answer checks;&lt;/li&gt;
&lt;li&gt;whether the target fact reached assembled context;&lt;/li&gt;
&lt;li&gt;outdated-memory and privacy failures;&lt;/li&gt;
&lt;li&gt;context reduction compared with replaying history;&lt;/li&gt;
&lt;li&gt;retrieval and end-to-end latency.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The evaluation dashboard reads the report generated by the running build. It&lt;br&gt;
does not display fixed “AI improvement” numbers. I also added an automated&lt;br&gt;
backend suite, frontend production build, dependency audits, Docker validation,&lt;br&gt;
and GitHub Actions CI.&lt;/p&gt;

&lt;p&gt;One lesson arrived through a failed scenario. A fixture intended to test theme&lt;br&gt;
preference contained the phrase “never dark mode.” A strict evaluator treated&lt;br&gt;
the word “dark” as a leaked stale preference even though it appeared inside a&lt;br&gt;
negation. The result looked like a model failure, but the fixture itself was&lt;br&gt;
ambiguous. I replaced it with an unambiguous positive preference and added a&lt;br&gt;
regression assertion for zero outdated-memory errors.&lt;/p&gt;

&lt;p&gt;That small bug reinforced a larger point: an evaluation harness is also&lt;br&gt;
software. Its labels, fixtures, and graders require the same skepticism as the&lt;br&gt;
system being evaluated.&lt;/p&gt;

&lt;h2&gt;
  
  
  Current status and the evidence I will publish next
&lt;/h2&gt;

&lt;p&gt;At the time of writing, the complete local flow, persistent SQLite mode,&lt;br&gt;
automated tests, offline diagnostic, Docker configuration, and CI are working.&lt;br&gt;
The Qwen client and Alibaba Cloud Tablestore/OSS adapters are implemented.&lt;/p&gt;

&lt;p&gt;The remaining release gate is operational evidence: deploy the exact final&lt;br&gt;
commit on Alibaba Cloud, verify Qwen and storage status through the public&lt;br&gt;
health endpoint, test persistence across a restart, and generate the final&lt;br&gt;
model-backed report from that deployment.&lt;/p&gt;

&lt;p&gt;I am stating that boundary plainly because “implemented,” “tested locally,” and&lt;br&gt;
“proven in the submitted cloud environment” are different claims.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why this can matter beyond one hackathon
&lt;/h2&gt;

&lt;p&gt;Agent memory is becoming infrastructure. Coding assistants, learning tools,&lt;br&gt;
customer-support agents, and team copilots all need continuity, but continuity&lt;br&gt;
without governance creates risk.&lt;/p&gt;

&lt;p&gt;A reusable memory layer should answer more than “what is similar to this&lt;br&gt;
query?” It should also answer:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Is this memory still active?&lt;/li&gt;
&lt;li&gt;Did a newer decision replace it?&lt;/li&gt;
&lt;li&gt;Is it relevant to this user and project?&lt;/li&gt;
&lt;li&gt;Is it important enough to spend context tokens on?&lt;/li&gt;
&lt;li&gt;Is it safe to persist?&lt;/li&gt;
&lt;li&gt;Can the user inspect and reverse the decision?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;MemoPilot IQ is my attempt to make those questions first-class. I designed it&lt;br&gt;
as infrastructure rather than a chatbot skin: a service API, a Python SDK,&lt;br&gt;
pluggable storage, observable decisions, and an evaluation path that can be&lt;br&gt;
rerun against the submitted build.&lt;/p&gt;

&lt;h2&gt;
  
  
  Try it, inspect it, challenge it
&lt;/h2&gt;

&lt;p&gt;The project is open source under the MIT License:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Repository:&lt;/strong&gt; &lt;a href="https://github.com/MaharMuavia/memopilot-iq" rel="noopener noreferrer"&gt;github.com/MaharMuavia/memopilot-iq&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The README includes local setup, architecture, API documentation, testing, the&lt;br&gt;
MemoryOS scoring model, and the judge-demo flow.&lt;/p&gt;

&lt;p&gt;I would especially value feedback on one question:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;What should an AI assistant be allowed to remember—and what must it be&lt;br&gt;
designed to forget?&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;If you build agents, retrieval systems, or AI safety tooling, I would love to&lt;br&gt;
hear how you approach that boundary.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;MemoPilot IQ is being built for the Qwen Cloud Global AI Hackathon, Track 1:&lt;br&gt;
MemoryAgent. Final cloud and model-backed evaluation evidence will be linked&lt;br&gt;
after it is generated from the submitted deployment.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>agents</category>
      <category>qwen</category>
      <category>opensource</category>
    </item>
  </channel>
</rss>
