<?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>Forem: MOHAMMAD SAQUIB DAIYAN</title>
    <description>The latest articles on Forem by MOHAMMAD SAQUIB DAIYAN (@saquib34).</description>
    <link>https://forem.com/saquib34</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%2F1346443%2Ffd44605b-2b91-4341-b395-5087ced3c58c.png</url>
      <title>Forem: MOHAMMAD SAQUIB DAIYAN</title>
      <link>https://forem.com/saquib34</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/saquib34"/>
    <language>en</language>
    <item>
      <title>How I Built a Persistent Memory Layer for AI Coding Assistants Using MCP</title>
      <dc:creator>MOHAMMAD SAQUIB DAIYAN</dc:creator>
      <pubDate>Tue, 10 Mar 2026 19:10:44 +0000</pubDate>
      <link>https://forem.com/saquib34/how-i-built-a-persistent-memory-layer-for-ai-coding-assistants-using-mcp-2aop</link>
      <guid>https://forem.com/saquib34/how-i-built-a-persistent-memory-layer-for-ai-coding-assistants-using-mcp-2aop</guid>
      <description>&lt;p&gt;Every time I start a new Claude or Cursor session, I have the same conversation:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"I use TypeScript with strict mode, pnpm for packages, deploy to Vercel, and prefer functional components with hooks."&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;I got tired of it. So I built &lt;strong&gt;PersistMemory&lt;/strong&gt; — a persistent memory server that plugs into any MCP-compatible AI tool.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Problem
&lt;/h2&gt;

&lt;p&gt;LLM-based coding assistants are powerful but amnesiac. They don't remember:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Your tech stack and preferences&lt;/li&gt;
&lt;li&gt;Project-specific architecture decisions&lt;/li&gt;
&lt;li&gt;Past debugging sessions and solutions&lt;/li&gt;
&lt;li&gt;Your coding conventions&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Every session is a blank slate.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Solution: MCP + Semantic Memory
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://modelcontextprotocol.io" rel="noopener noreferrer"&gt;MCP (Model Context Protocol)&lt;/a&gt; is Anthropic's open standard for connecting AI tools to external data sources. PersistMemory is an MCP server that provides 9 tools to any connected AI assistant:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Tool&lt;/th&gt;
&lt;th&gt;What it does&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;add_to_memory&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Store a piece of knowledge&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;search_memory&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Semantically search stored memories&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;create_space&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Create an isolated memory space&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;switch_space&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Switch between spaces&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;list_spaces&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;List all your spaces&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;get_current_space&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Show active space&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;publish_message&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Send a message to a space&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;fetch_messages&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Retrieve message history&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;authenticate&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;OAuth login&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  Setup: One Config Line
&lt;/h2&gt;

&lt;p&gt;For Claude Desktop, add this to your config:&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;"mcpServers"&lt;/span&gt;&lt;span class="p"&gt;:&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;span class="nl"&gt;"persistmemory"&lt;/span&gt;&lt;span class="p"&gt;:&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;span class="nl"&gt;"url"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"https://mcp.persistmemory.com/sse"&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;span class="p"&gt;}&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;That's it. No API keys — authentication happens via OAuth when Claude first connects.&lt;/p&gt;

&lt;p&gt;Works the same way for Cursor, VS Code/Copilot, Windsurf, and Cline (see &lt;a href="https://persistmemory.com/docs" rel="noopener noreferrer"&gt;docs&lt;/a&gt; for each client's config).&lt;/p&gt;

&lt;h2&gt;
  
  
  How Semantic Search Works
&lt;/h2&gt;

&lt;p&gt;When you tell your AI "remember that I use Neon Postgres with Drizzle ORM", PersistMemory:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Embeds&lt;/strong&gt; the text using &lt;code&gt;bge-large-en-v1.5&lt;/code&gt; (1024-dimension vectors)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Stores&lt;/strong&gt; the vector in Cloudflare Vectorize with metadata (space, type, timestamp)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Saves&lt;/strong&gt; the raw text in Neon Postgres&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;When you later ask "what's my database setup?", PersistMemory:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Embeds your query&lt;/li&gt;
&lt;li&gt;Performs vector similarity search&lt;/li&gt;
&lt;li&gt;Returns the top matching memories&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;No keyword matching needed. "Database setup" finds "Neon Postgres with Drizzle ORM" because they're semantically close.&lt;/p&gt;

&lt;h2&gt;
  
  
  Spaces: Context Isolation
&lt;/h2&gt;

&lt;p&gt;Spaces let you organize memories by project or context:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;startup-app&lt;/strong&gt; — your startup's stack, architecture decisions, deployment config&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;freelance-client-x&lt;/strong&gt; — client-specific requirements and preferences&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;personal&lt;/strong&gt; — your general coding preferences&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;When your AI is in the "startup-app" space, it only searches memories from that space. No accidental context bleed.&lt;/p&gt;

&lt;h2&gt;
  
  
  Architecture
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;┌─────────────────┐     MCP/SSE      ┌──────────────────────┐
│  Claude/Cursor/  │ ◄──────────────► │   PersistMemory      │
│  Copilot/etc.    │                  │   (CF Workers)       │
└─────────────────┘                  │                      │
                                      │  ┌────────────────┐  │
                                      │  │ Vectorize      │  │
                                      │  │ (embeddings)   │  │
                                      │  └────────────────┘  │
                                      │  ┌────────────────┐  │
                                      │  │ Neon Postgres  │  │
                                      │  │ (memory store) │  │
                                      │  └────────────────┘  │
                                      │  ┌────────────────┐  │
                                      │  │ Workers AI     │  │
                                      │  │ (BGE-large)    │  │
                                      │  └────────────────┘  │
                                      └──────────────────────┘
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Stack:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Cloudflare Workers&lt;/strong&gt; — serverless backend, globally distributed&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Neon Postgres&lt;/strong&gt; — persistent storage via serverless driver&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Drizzle ORM&lt;/strong&gt; — type-safe database access&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cloudflare Vectorize&lt;/strong&gt; — vector database for semantic search&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Workers AI&lt;/strong&gt; — embedding generation (BGE-large-en-v1.5)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cloudflare R2&lt;/strong&gt; — file storage for uploaded documents&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Next.js on Vercel&lt;/strong&gt; — web dashboard&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  What's Next
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Meeting bot integration&lt;/strong&gt; — automatically capture and store context from meetings&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Auto-memory&lt;/strong&gt; — AI proactively stores important context without being told&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Memory sharing&lt;/strong&gt; — share spaces with team members&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Webhooks&lt;/strong&gt; — trigger actions when memories are added&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Try It
&lt;/h2&gt;

&lt;p&gt;Free tier available: &lt;a href="https://persistmemory.com" rel="noopener noreferrer"&gt;persistmemory.com&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Docs: &lt;a href="https://persistmemory.com/docs" rel="noopener noreferrer"&gt;persistmemory.com/docs&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Setup takes 30 seconds. I'd love feedback from anyone using AI coding tools daily.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>opensource</category>
      <category>productivity</category>
      <category>openai</category>
    </item>
  </channel>
</rss>
