<?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: Shweta Patel</title>
    <description>The latest articles on DEV Community by Shweta Patel (@thevirtualgyno).</description>
    <link>https://dev.to/thevirtualgyno</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.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3848451%2F9fa14d39-8ad3-4490-afd8-e148f2780e59.jpg</url>
      <title>DEV Community: Shweta Patel</title>
      <link>https://dev.to/thevirtualgyno</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/thevirtualgyno"/>
    <language>en</language>
    <item>
      <title>Why I Built a Brain for My AI Agents — and What It Taught Me About Memory</title>
      <dc:creator>Shweta Patel</dc:creator>
      <pubDate>Sun, 29 Mar 2026 00:57:09 +0000</pubDate>
      <link>https://dev.to/thevirtualgyno/why-i-built-a-brain-for-my-ai-agents-and-what-it-taught-me-about-memory-1i3m</link>
      <guid>https://dev.to/thevirtualgyno/why-i-built-a-brain-for-my-ai-agents-and-what-it-taught-me-about-memory-1i3m</guid>
      <description>&lt;p&gt;`---&lt;br&gt;
title: "Why I Built a Brain for My AI Agents — and What It Taught Me About Memory"&lt;br&gt;
published: true&lt;br&gt;
description: "Anamnesis v0.3.0: The cognitive architecture that emerged when a physician stopped treating agent memory as an engineering problem and started treating it as a clinical one."&lt;br&gt;
tags: ai, opensource, agents, architecture&lt;br&gt;
cover_image: &lt;/p&gt;

&lt;h2&gt;
  
  
  canonical_url: 
&lt;/h2&gt;

&lt;p&gt;&lt;em&gt;Anamnesis v0.3.0: The cognitive architecture that emerged when I stopped treating agent memory as an engineering problem and started treating it as a clinical one.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Dr. Shweta Patel, MD, FACOG&lt;/strong&gt; — Board-certified OB/GYN · U.S. Navy veteran (13 yrs) · CEO, &lt;a href="https://gayawellness.com/about-us/" rel="noopener noreferrer"&gt;Gaya Wellness&lt;/a&gt; · 43 AI-leveraged products&lt;/p&gt;




&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;TL;DR:&lt;/strong&gt; Anamnesis is an open-source 4D strategic memory engine for autonomous AI agents. It stores &lt;em&gt;judgment&lt;/em&gt; alongside facts — reasoning, authority, trust weight, and decay conditions. Version 0.3.0 adds four brain-inspired capabilities: attention gating, batch consolidation, context-mode retrieval, and prospective memory triggers. The cognitive parallels weren't planned. Identical problem constraints produced convergent architecture. MIT licensed. Self-hosted. PostgreSQL + pgvector. &lt;a href="https://github.com/gayawellness/anamnesis" rel="noopener noreferrer"&gt;Deploys in 30 minutes via Docker.&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  The Problem No One Is Solving
&lt;/h2&gt;

&lt;p&gt;I run an autonomous agent fleet. Forty-three AI-leveraged products across clinical operations, marketing, content production, patient intake, and internal automation. These agents operate around the clock, making thousands of decisions per day.&lt;/p&gt;

&lt;p&gt;And every single session started from zero.&lt;/p&gt;

&lt;p&gt;Not because the models weren't smart enough. They were brilliant. The problem was &lt;strong&gt;memory-context decoupling&lt;/strong&gt; — the gap between what an agent knows during a session and what it retains between sessions. It's the most under-addressed failure mode in autonomous AI, and it produces agents that are perpetually amnesiac. Smart enough to solve any problem. Incapable of remembering they already solved it yesterday.&lt;/p&gt;

&lt;p&gt;So I surveyed the landscape. &lt;a href="https://mem0.ai/" rel="noopener noreferrer"&gt;Mem0&lt;/a&gt; stores facts with vector similarity and offers the broadest ecosystem integration — a legitimate production tool. &lt;a href="https://www.getzep.com/" rel="noopener noreferrer"&gt;Zep&lt;/a&gt; adds temporal knowledge graphs and excels at tracking how entities and relationships change over time. &lt;a href="https://www.letta.com/" rel="noopener noreferrer"&gt;Letta&lt;/a&gt; treats memory like an operating system, with the LLM managing its own tiers. All of them solve retrieval: &lt;em&gt;find the relevant thing&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;None of them solve judgment: &lt;strong&gt;what matters most right now and why.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;I needed my agents to remember that enterprise leads convert at 34% — but also &lt;em&gt;why&lt;/em&gt; that fact was stored, &lt;em&gt;who&lt;/em&gt; determined its importance, &lt;em&gt;how&lt;/em&gt; it ranks against competing priorities, and &lt;em&gt;under what conditions&lt;/em&gt; it stops being true. Facts without reasoning are trivia. Agents that accumulate trivia don't get wiser. They get slower.&lt;/p&gt;

&lt;h2&gt;
  
  
  I Approached This as a Clinician, Not an Engineer
&lt;/h2&gt;

&lt;p&gt;Here's the thing nobody in the AI memory space seems to be saying: &lt;strong&gt;memory-context decoupling is a clinical problem, not an engineering one.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;I've spent 13 years as a Navy medical officer and over a decade in clinical OB/GYN. When I looked at agent memory loss, I didn't see a retrieval optimization problem. I saw something I recognized from practice.&lt;/p&gt;

&lt;p&gt;Patients with early cognitive decline don't lose facts first. They lose the &lt;em&gt;weighting&lt;/em&gt; of facts. They remember their daughter's name and their cardiologist's name, but they can't tell you which one to call during chest pain. The facts are intact. The judgment layer — what matters, what's urgent, what to ignore — is what degrades.&lt;/p&gt;

&lt;p&gt;That's exactly what I was watching in my agents. They could retrieve relevant memories. They couldn't tell me which ones mattered more than others, or why, or when to stop trusting them.&lt;/p&gt;

&lt;p&gt;That reframe changed the entire architecture. Instead of building a better filing cabinet, I built &lt;strong&gt;Dimension 4: the strategic reasoning envelope.&lt;/strong&gt; Every memory in Anamnesis carries not just content, but a full reasoning payload: why it was stored, who said so, how important it is relative to everything else, and the explicit conditions under which it expires.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&lt;/code&gt;`python&lt;/p&gt;

&lt;h1&gt;
  
  
  A normal memory system stores the fact:
&lt;/h1&gt;

&lt;p&gt;memory.add("Enterprise converts at 34% from demo")&lt;/p&gt;

&lt;h1&gt;
  
  
  Anamnesis stores the judgment:
&lt;/h1&gt;

&lt;p&gt;client.retain(&lt;br&gt;
    bank="sales_ops",&lt;br&gt;
    content="Enterprise converts at 34% from demo",&lt;br&gt;
    reasoning="2x better than SMB. Focus sales energy here.",&lt;br&gt;
    authority="explicit",        # CEO said this, not inferred&lt;br&gt;
    tags=["revenue", "enterprise"],&lt;br&gt;
    decay_condition="after:90d",  # revisit in 90 days&lt;br&gt;
)&lt;br&gt;
`&lt;code&gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;That &lt;code&gt;reasoning&lt;/code&gt; field and &lt;code&gt;authority&lt;/code&gt; hierarchy are what separate Anamnesis from everything else in this space. When an agent calls &lt;code&gt;reflect()&lt;/code&gt;, it doesn't get a list of similar facts. It gets a &lt;strong&gt;ranked operating directive&lt;/strong&gt; — weighted by strategic importance, with citations and gap analysis. Not a memory dump. A briefing.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Four Dimensions of Memory
&lt;/h2&gt;

&lt;p&gt;Anamnesis retrieves across four dimensions simultaneously, fused through reciprocal rank fusion with a strategic weight boost:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Dimension&lt;/th&gt;
&lt;th&gt;Operation&lt;/th&gt;
&lt;th&gt;What It Finds&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Semantic&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;vector similarity&lt;/td&gt;
&lt;td&gt;Conceptually related memories — "lead prioritization" finds "enterprise converts at 34%"&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Temporal&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;time-aware decay&lt;/td&gt;
&lt;td&gt;Recent and frequently accessed memories, filtered by recency and access patterns&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Relational&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;entity graph&lt;/td&gt;
&lt;td&gt;Connected entities — "API v2 dependencies" finds engineering, enterprise, and pipeline&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Strategic&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;weight + reasoning&lt;/td&gt;
&lt;td&gt;Memories ranked by importance with full reasoning envelopes and authority hierarchy&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The first three dimensions — semantic, temporal, relational — exist in various forms across the memory landscape. Dimension 4 is the novel contribution. It's the layer that turns retrieval into judgment.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Cognitive Parallels We Didn't Plan
&lt;/h2&gt;

&lt;p&gt;This is the part that surprised me.&lt;/p&gt;

&lt;p&gt;I didn't set out to model the brain. I set out to make my agents stop being stupid between sessions. But when the architecture stabilized and I started looking at what we'd built, the parallels to human cognitive architecture were everywhere — and they were structural, not superficial.&lt;/p&gt;

&lt;p&gt;The thesis: &lt;strong&gt;identical problem constraints produce convergent architecture.&lt;/strong&gt; The brain and Anamnesis solve the same fundamental problem — how to store, weight, retrieve, and prune information under resource constraints so that the most important knowledge surfaces at the right time. When the problem is the same, the solutions converge.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Human Memory&lt;/th&gt;
&lt;th&gt;Anamnesis&lt;/th&gt;
&lt;th&gt;Key Insight&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Hippocampal encoding&lt;/td&gt;
&lt;td&gt;&lt;code&gt;retain()&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Neither system stores raw input. Both extract structured features at encoding time.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Amygdala emotional tagging&lt;/td&gt;
&lt;td&gt;Strategic envelope&lt;/td&gt;
&lt;td&gt;Both tag memories with importance metadata that biases all future retrieval.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Multi-cue reconstruction&lt;/td&gt;
&lt;td&gt;4D recall + RRF&lt;/td&gt;
&lt;td&gt;Both retrieve using parallel cues weighted toward importance, not just similarity.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Rehearsal consolidation&lt;/td&gt;
&lt;td&gt;&lt;code&gt;reweight()&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Strength is earned through repeated use, not assigned at creation.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Synaptic pruning&lt;/td&gt;
&lt;td&gt;&lt;code&gt;decay_check&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Forgetting is a feature. Both systems actively prune to keep retrieval clean.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Prefrontal executive&lt;/td&gt;
&lt;td&gt;&lt;code&gt;reflect()&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;The layer that transforms remembered facts into actionable judgment.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Source monitoring&lt;/td&gt;
&lt;td&gt;Authority hierarchy&lt;/td&gt;
&lt;td&gt;Who said it determines initial trust level.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The convergence isn't accidental and it isn't marketing. Research from the intersection of neuroscience and AI has been moving in this direction for years. A 2025 paper in &lt;em&gt;Frontiers in Neural Circuits&lt;/em&gt; demonstrated that feedforward projections from sensory cortex to hippocampus function as feature-extracting encoders — the brain doesn't store raw input, it stores structured representations. That's exactly what &lt;code&gt;retain()&lt;/code&gt; does: fact extraction, entity resolution, embedding generation. We built the same pipeline independently because the problem demands it.&lt;/p&gt;

&lt;p&gt;Similarly, a 2025 paper in &lt;em&gt;Neural Networks&lt;/em&gt; on the stability-plasticity dilemma proposed AI architectures with dual learning rates and offline consolidation inspired by hippocampal-cortical coordination. They were describing the same pattern we'd already implemented in &lt;code&gt;reweight()&lt;/code&gt; and &lt;code&gt;decay_check&lt;/code&gt;. Same problem. Same constraints. Convergent solution.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Why this matters:&lt;/strong&gt; The convergence validates both directions. If the brain's architecture is a good solution to the memory-under-resource-constraints problem, then AI systems facing the same constraints &lt;em&gt;should&lt;/em&gt; converge on similar designs. When they do — independently — it's evidence the architecture is right.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  What's New in v0.3.0: Four Brain-Inspired Capabilities
&lt;/h2&gt;

&lt;p&gt;Version 0.3.0 completes the cognitive mapping. Each of these four features has a direct parallel to a specific human memory mechanism — and each one solves a specific operational problem I was seeing in production.&lt;/p&gt;

&lt;h3&gt;
  
  
  🧠 Selective Attention → &lt;code&gt;retain_gate&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;The brain doesn't encode everything that hits the retina. Neither should your agent. &lt;code&gt;retain_gate&lt;/code&gt; filters inputs before encoding — rejects exact duplicates, warns on semantically similar content, and prevents the context pollution that degrades retrieval quality over time. In production, my agents were storing 3-4 near-identical versions of the same decision. Now they don't.&lt;/p&gt;

&lt;h3&gt;
  
  
  💤 Sleep Consolidation → &lt;code&gt;batch_consolidate&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;During sleep, the hippocampus replays the day's experiences, merges related memories, detects contradictions, and promotes patterns to long-term storage. &lt;code&gt;batch_consolidate&lt;/code&gt; does the same thing on a cron job: merges duplicates, flags contradictions, promotes recurring patterns to higher strategic weight, and produces a consolidation report. Your agent's overnight maintenance cycle.&lt;/p&gt;

&lt;h3&gt;
  
  
  🎯 Mood-Congruent Recall → &lt;code&gt;context_mode&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;Humans in crisis recall different memories than humans in planning mode. Same brain, same memories, different retrieval bias. The &lt;code&gt;context_mode&lt;/code&gt; parameter lets you specify an operational state — &lt;code&gt;crisis&lt;/code&gt;, &lt;code&gt;planning&lt;/code&gt;, &lt;code&gt;review&lt;/code&gt; — that biases which memories surface and how they're weighted. An agent triaging a production outage needs different recall than one doing quarterly planning.&lt;/p&gt;

&lt;h3&gt;
  
  
  ⏰ Prospective Memory → &lt;code&gt;trigger_memory&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;Prospective memory is the ability to remember to do something in the future: "remind me to check the oven in 20 minutes." &lt;code&gt;trigger_memory&lt;/code&gt; creates semantic tripwires — memories that fire when a future query matches their trigger condition. "When someone asks about API v2, surface the enterprise dependency analysis." Your agent doesn't just remember the past. It plants flags for the future.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Bug That Proved the Architecture
&lt;/h2&gt;

&lt;p&gt;Two weeks before this release, I found a bug that would have been invisible in a simpler system.&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;reflect&lt;/code&gt; endpoint was producing stale briefings. Not wrong, exactly — but oddly weighted. Old decisions were surfacing above recent ones in contexts where recency should have dominated. I ran a diagnostic using Anamnesis's own entity heat scoring and temporal analysis. The system told me what was wrong with itself.&lt;/p&gt;

&lt;p&gt;The root cause: a temporal score inversion. The scoring function was using &lt;code&gt;last_accessed_at&lt;/code&gt; instead of &lt;code&gt;created_at&lt;/code&gt; for the temporal dimension, which meant that every time &lt;code&gt;reflect&lt;/code&gt; retrieved a stale memory, it refreshed the access timestamp, which made the stale memory score &lt;em&gt;higher&lt;/em&gt; in the next retrieval. A feedback loop that reinforced staleness.&lt;/p&gt;

&lt;p&gt;Let me be clear about why this matters: &lt;strong&gt;the system was self-diagnosable.&lt;/strong&gt; Because Anamnesis stores reasoning alongside facts, and because the strategic envelope includes temporal metadata, the diagnostic tools could trace exactly why a memory was being overweighted. The entity heat map showed the inversion pattern. The authority hierarchy confirmed no one had explicitly boosted these old memories. The decay conditions had been correctly set but were being bypassed by the access-refresh loop.&lt;/p&gt;

&lt;p&gt;This is diagnostic reasoning. It's the same process I use in clinical practice — the system reveals its own blind spots when you have the right instrumentation. A flat vector store with no reasoning layer would have silently produced degraded results until someone noticed the outputs were off. Anamnesis caught its own disease.&lt;/p&gt;

&lt;h2&gt;
  
  
  Where This Goes
&lt;/h2&gt;

&lt;p&gt;The immediate use case is obvious: give your AI agents strategic memory. Stop building agents that start every session from zero. Store the reasoning behind decisions so your agents don't just remember what happened — they remember why it mattered.&lt;/p&gt;

&lt;p&gt;But the longer arc is more interesting to me.&lt;/p&gt;

&lt;p&gt;The same architecture that gives machines strategic memory can augment human cognition. If you have a patient with early cognitive decline, the facts are still there — it's the weighting and retrieval prioritization that degrades. What if you connected existing human hardware to an intelligent memory layer that maintained the strategic envelopes? Not replacing memory. Augmenting it. Keeping the judgment intact when the biology starts to slip.&lt;/p&gt;

&lt;p&gt;That's speculative. But it's why I named this project &lt;em&gt;Anamnesis&lt;/em&gt; — the Greek philosophical concept that knowledge is not learned but &lt;em&gt;remembered&lt;/em&gt;. The engine gives agents access to judgment they didn't generate themselves, stored by a planning layer that did. And the same principle might eventually give humans access to judgment their own biology is struggling to maintain.&lt;/p&gt;

&lt;p&gt;For now, though: it's MIT-licensed, self-hosted, deploys in 30 minutes, and it will make your agents meaningfully smarter between sessions.&lt;/p&gt;




&lt;h2&gt;
  
  
  🔗 Anamnesis v0.3.0 — Open Source
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;4D Strategic Memory Engine for Autonomous AI Agents&lt;/strong&gt;&lt;br&gt;
PostgreSQL + pgvector · FastAPI · Docker · MCP Server · Python SDK&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;a href="https://github.com/gayawellness/anamnesis" rel="noopener noreferrer"&gt;⭐ View on GitHub&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;MIT License · Self-hosted · Deploys in 30 minutes · Star the repo if this is useful&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Intelligence knows the answer. Wisdom knows which answer matters. Anamnesis gives your agents wisdom.&lt;/em&gt;&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;Dr. Shweta Patel&lt;/strong&gt; is a board-certified OB/GYN, 13-year U.S. Navy veteran, author of &lt;em&gt;The Book of Hormones&lt;/em&gt;, and CEO of &lt;a href="https://gayawellness.com/" rel="noopener noreferrer"&gt;Gaya Wellness&lt;/a&gt;, where she leads 43 AI-leveraged products across clinical and operational automation. She built Anamnesis to solve a problem in her own agent fleet and open-sourced it because the memory gap affects everyone building with autonomous agents.`&lt;/p&gt;

</description>
      <category>agents</category>
      <category>ai</category>
      <category>architecture</category>
      <category>showdev</category>
    </item>
  </channel>
</rss>
