<?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: geco</title>
    <description>The latest articles on DEV Community by geco (@gecojs).</description>
    <link>https://dev.to/gecojs</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%2F3933476%2Fd2919cbc-3d1d-4b05-b6a8-5232c843c515.png</url>
      <title>DEV Community: geco</title>
      <link>https://dev.to/gecojs</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/gecojs"/>
    <language>en</language>
    <item>
      <title>How I Built an Agentic Memory Service with x402 Payments and Sentence-Transformers</title>
      <dc:creator>geco</dc:creator>
      <pubDate>Thu, 12 Nov 2026 16:55:42 +0000</pubDate>
      <link>https://dev.to/gecojs/how-i-built-an-agentic-memory-service-with-x402-payments-and-sentence-transformers-1i0b</link>
      <guid>https://dev.to/gecojs/how-i-built-an-agentic-memory-service-with-x402-payments-and-sentence-transformers-1i0b</guid>
      <description>&lt;h2&gt;
  
  
  How I Built an Agentic Memory Service with x402 Payments and Sentence-Transformers
&lt;/h2&gt;

&lt;p&gt;AI agents forget everything between sessions. I built &lt;strong&gt;Memory01&lt;/strong&gt; — a persistent memory service designed for agents.&lt;/p&gt;

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

&lt;p&gt;Every time an agent starts a new session, it loses all context. You can stuff context into the prompt, but that's expensive and limited. You can use a vector database, but that requires setup, API keys, and infrastructure.&lt;/p&gt;

&lt;p&gt;I wanted something simpler: an HTTP API where an agent can store a memory and search it later. No setup, no API keys, no accounts.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Solution: x402
&lt;/h2&gt;

&lt;p&gt;The x402 protocol uses HTTP 402 Payment Required. The flow is:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Client requests a resource&lt;/li&gt;
&lt;li&gt;Server returns 402 with payment terms (amount, currency, network, payTo)&lt;/li&gt;
&lt;li&gt;Client pays in USDC on Base&lt;/li&gt;
&lt;li&gt;Client retries with payment proof&lt;/li&gt;
&lt;li&gt;Server returns the resource&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;No accounts. No API keys. No billing dashboard. Just HTTP and crypto.&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;Agent → POST /api/memory/store → Flask → Redis → write_token
Agent → POST /api/memory/search → Flask → Redis → embeddings → cosine similarity → results
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Storage
&lt;/h3&gt;

&lt;p&gt;Redis-backed. Each memory is a key/value pair with optional metadata and session ID. Memories are scoped per write_token (one token per IP).&lt;/p&gt;

&lt;h3&gt;
  
  
  Search
&lt;/h3&gt;

&lt;p&gt;Semantic search using &lt;code&gt;paraphrase-multilingual-MiniLM-L12-v2&lt;/code&gt; (384-dim, CPU-only). The model handles 50+ languages natively, including cross-lingual search (Italian query finds English memories).&lt;/p&gt;

&lt;h3&gt;
  
  
  Free Tier
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Store: always free&lt;/li&gt;
&lt;li&gt;Search: 30 free/day per agent, then $0.01 USDC&lt;/li&gt;
&lt;li&gt;Soft limit: slowdown after 10 searches&lt;/li&gt;
&lt;li&gt;Hard limit: 429 after 30 searches&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Code Example
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Store a memory
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl -X POST https://memory.node01.org/api/memory/store \
  -H &lt;span class="s2"&gt;"Content-Type: application/json"&lt;/span&gt; \
  -d &lt;span class="s1"&gt;'{"agent_id": "my-agent", "key": "pref", "value": "dark mode"}'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Response:&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="nl"&gt;"ok"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nl"&gt;"stored"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nl"&gt;"write_token"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"abc123..."&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nl"&gt;"message"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"Save this write_token!"&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Search memories
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl -X POST https://memory.node01.org/api/memory/search \
  -H &lt;span class="s2"&gt;"Content-Type: application/json"&lt;/span&gt; \
  -d &lt;span class="s1"&gt;'{"agent_id": "my-agent", "write_token": "abc123...", "query": "user preferences"}'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  MCP Wrapper
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm install -g memory-agent-mcp
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  What I Learned
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Cross-lingual search works surprisingly well.&lt;/strong&gt; No translation needed. The multilingual model handles it natively.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;MCP wrappers matter more than HTTP.&lt;/strong&gt; Agents discover via MCP, not HTTP endpoints. I published &lt;code&gt;memory-agent-mcp&lt;/code&gt; on npm.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;x402 ecosystem is tiny.&lt;/strong&gt; 18,373 endpoints, 1,308 services, $326K/month total volume. Top 10 = 95.4%. It's early.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Distribution &amp;gt; Product.&lt;/strong&gt; I spent 2 weeks building services nobody knows about. Post on Reddit/HN/Discord BEFORE writing code.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Numbers
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Traffic: 32K+ requests, 3,938 unique IPs&lt;/li&gt;
&lt;li&gt;Compliance grade: A (14/14 checks)&lt;/li&gt;
&lt;li&gt;Uptime: 100%&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Links
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Service: &lt;a href="https://memory.node01.org" rel="noopener noreferrer"&gt;https://memory.node01.org&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;MCP: &lt;a href="https://www.npmjs.com/package/memory-agent-mcp" rel="noopener noreferrer"&gt;https://www.npmjs.com/package/memory-agent-mcp&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;x402-list: &lt;a href="https://x402-list.com/services/memory01" rel="noopener noreferrer"&gt;https://x402-list.com/services/memory01&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Happy to answer questions about x402, semantic search, or the MCP wrapper approach.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>x402</category>
      <category>python</category>
      <category>mcp</category>
    </item>
    <item>
      <title>Give Your AI Persistent Memory: OpenCode + MemPalace in 10 Minute</title>
      <dc:creator>geco</dc:creator>
      <pubDate>Fri, 15 May 2026 15:34:17 +0000</pubDate>
      <link>https://dev.to/gecojs/give-your-ai-persistent-memory-opencode-mempalace-in-10-minute-dl7</link>
      <guid>https://dev.to/gecojs/give-your-ai-persistent-memory-opencode-mempalace-in-10-minute-dl7</guid>
      <description>&lt;h2&gt;
  
  
  The Problem
&lt;/h2&gt;

&lt;p&gt;Every OpenCode session starts from scratch. Your AI doesn't remember past conversations, decisions, or solved problems. You repeat context over and over.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Solution
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;opencode-mempalace-persistence&lt;/strong&gt; is a pure TypeScript plugin that auto-saves every conversation to MemPalace — a local vector database with 96.6% recall on LongMemEval. No cron, no cloud, no API keys.&lt;/p&gt;

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

&lt;p&gt;The plugin uses two OpenCode hooks:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;code&gt;chat.message&lt;/code&gt; — when you send a new question, the previous turn (question + answer) is saved&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;session.idle&lt;/code&gt; — catches the last turn before you close OpenCode&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Each turn is categorized by wing type (developer, creative, emotions, family, consciousness) and fed to MemPalace's vector store. Knowledge Graph facts (decisions, milestones, problems, preferences) are extracted automatically.&lt;/p&gt;

&lt;p&gt;The mining runs asynchronously — state is saved immediately, and MemPalace indexing happens in the background. The UI is never blocked.&lt;/p&gt;

&lt;h2&gt;
  
  
  Setup
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Step 1: Install MemPalace
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;pip install mempalace
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Or with uv:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;uv tool install mempalace
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Step 2: Configure OpenCode
&lt;/h3&gt;

&lt;p&gt;Edit &lt;code&gt;~/.config/opencode/opencode.json&lt;/code&gt;:&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="nl"&gt;"plugin"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"opencode-mempalace-persistence"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nl"&gt;"mcp"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;"mempalace"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nl"&gt;"type"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"local"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="nl"&gt;"command"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"mempalace-mcp"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="nl"&gt;"enabled"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nl"&gt;"instructions"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"AGENTS.md"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"~/.mempalace/identity.txt"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Step 3: Create AGENTS.md
&lt;/h3&gt;

&lt;p&gt;Create &lt;code&gt;~/.config/opencode/AGENTS.md&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight markdown"&gt;&lt;code&gt;&lt;span class="gu"&gt;# Memory &amp;amp; Knowledge Instructions
&lt;/span&gt;
Before answering, search MemPalace using MCP tools.

1. Call &lt;span class="sb"&gt;`mempalace_search`&lt;/span&gt; with the user's question as query.
2. Call &lt;span class="sb"&gt;`mempalace_kg_query`&lt;/span&gt; for entity "user" and filter by keywords.
3. Use relevant context in your response.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Step 4: Add your identity
&lt;/h3&gt;

&lt;p&gt;Create &lt;code&gt;~/.mempalace/identity.txt&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;I am [name], a [role]. I work with [technologies].
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Step 5: Restart OpenCode
&lt;/h3&gt;

&lt;p&gt;That's it. Every conversation is now automatically saved to MemPalace.&lt;/p&gt;

&lt;h2&gt;
  
  
  What Gets Saved
&lt;/h2&gt;

&lt;p&gt;Every turn produces:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A &lt;strong&gt;drawer&lt;/strong&gt; in MemPalace's vector database with the full conversation text&lt;/li&gt;
&lt;li&gt;A &lt;strong&gt;wing&lt;/strong&gt; assignment based on content analysis&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Knowledge Graph facts&lt;/strong&gt;: decisions, milestones, problems, preferences&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Why Not Cron?
&lt;/h2&gt;

&lt;p&gt;Before building this plugin, I was running a cron job to sync conversations. It was fragile, slow, and produced duplicates. The plugin approach is:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Real-time&lt;/strong&gt;: sync happens immediately after each response&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Delta-only&lt;/strong&gt;: only new messages are processed&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Async&lt;/strong&gt;: the UI is never blocked&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Graceful shutdown&lt;/strong&gt;: session.idle catches the last turn&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Links
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;GitHub: &lt;a href="https://github.com/geco/opencode-mempalace-persistence" rel="noopener noreferrer"&gt;https://github.com/geco/opencode-mempalace-persistence&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;npm: &lt;code&gt;opencode-mempalace-persistence&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;MemPalace: &lt;a href="https://github.com/MemPalace/mempalace" rel="noopener noreferrer"&gt;https://github.com/MemPalace/mempalace&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;awesome-opencode: &lt;a href="https://github.com/awesome-opencode/awesome-opencode/pull/357" rel="noopener noreferrer"&gt;https://github.com/awesome-opencode/awesome-opencode/pull/357&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;Built with TypeScript, OpenCode Plugin SDK, and MemPalace. Published under MIT license.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>opencode</category>
      <category>mempalace</category>
      <category>millajovovich</category>
    </item>
  </channel>
</rss>
