<?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: WAYLAND ZHANG</title>
    <description>The latest articles on DEV Community by WAYLAND ZHANG (@waylandz).</description>
    <link>https://dev.to/waylandz</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%2F3965490%2F879f18ec-5ee7-4a93-bb75-131485598495.png</url>
      <title>DEV Community: WAYLAND ZHANG</title>
      <link>https://dev.to/waylandz</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/waylandz"/>
    <language>en</language>
    <item>
      <title>I built a persistent memory graph for my Mac AI agent — here's the architecture</title>
      <dc:creator>WAYLAND ZHANG</dc:creator>
      <pubDate>Wed, 03 Jun 2026 00:41:12 +0000</pubDate>
      <link>https://dev.to/waylandz/i-built-a-persistent-memory-graph-for-my-mac-ai-agent-heres-the-architecture-47fd</link>
      <guid>https://dev.to/waylandz/i-built-a-persistent-memory-graph-for-my-mac-ai-agent-heres-the-architecture-47fd</guid>
      <description>&lt;p&gt;I've been working on a Mac-native agent framework for about a year. One of the hardest problems: making the agent actually remember context across sessions in a way that's &lt;strong&gt;useful&lt;/strong&gt;, not just "here's your last 10 messages."&lt;/p&gt;

&lt;p&gt;What I ended up with is a knowledge graph — entities (people, projects, tools, decisions) with typed relations, stored locally, updated automatically as you interact.&lt;/p&gt;

&lt;p&gt;When you say "draft the Q3 report like last time," it knows:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;What "last time" looks like (the template, the tone, who received it)&lt;/li&gt;
&lt;li&gt;Who the stakeholders are&lt;/li&gt;
&lt;li&gt;Which files are relevant&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  The rough architecture
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Agent loop&lt;/strong&gt; runs locally on macOS (Swift daemon + Go backend)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;LLM-agnostic&lt;/strong&gt;: Claude, GPT-4o, Gemini, Ollama all work&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Memory tier 1&lt;/strong&gt;: SQLite graph with embedding-based fuzzy retrieval&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Memory tier 2&lt;/strong&gt;: Standard &lt;code&gt;MEMORY.md&lt;/code&gt; files per project&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Memory tier 3&lt;/strong&gt;: Nightly-trained personal memory model, updated while you sleep&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Tools&lt;/strong&gt;: file ops, browser (Playwright), calendar, terminal, screen&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;IM bridge&lt;/strong&gt;: agent can push updates to Slack/LINE/Feishu while you're away&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  The part that surprised me most
&lt;/h2&gt;

&lt;p&gt;The memory graph changed how I use the agent more than any LLM upgrade did.&lt;/p&gt;

&lt;p&gt;When an agent has persistent structured context, you stop re-explaining everything and start delegating actual work. The shift from "AI as search box" to "AI as coworker" isn't about the model — it's about memory architecture.&lt;/p&gt;

&lt;h2&gt;
  
  
  What broke along the way
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Auto-approval for filesystem ops&lt;/strong&gt; — lost a config file on day 3. Everything destructive now requires a human confirm step.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Trying to be a general assistant from day one&lt;/strong&gt; — it works way better when you give it a specific workflow to own first. I started with "write and send my weekly status report."&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Ignoring the LLM choice&lt;/strong&gt; — for agentic tasks with tool chains, Claude Sonnet/Opus vs GPT-4o makes a meaningful difference in error recovery rate.&lt;/p&gt;

&lt;h2&gt;
  
  
  The project
&lt;/h2&gt;

&lt;p&gt;I turned this into &lt;strong&gt;Kocoro&lt;/strong&gt; (open-sourced the core runtime: &lt;a href="https://github.com/Kocoro-lab/ShanClaw" rel="noopener noreferrer"&gt;github.com/Kocoro-lab/Kocoro&lt;/a&gt;). It's a Mac-native AI agent — local-first, memory graph built in, IM notifications, LLM-agnostic.&lt;/p&gt;

&lt;p&gt;Just opened a closed beta — drop a comment if you want an invite.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What are others using for persistent agent memory on local setups?&lt;/strong&gt;&lt;/p&gt;

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