<?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: Diego RV</title>
    <description>The latest articles on DEV Community by Diego RV (@diego_rv_62b04411f224eda8).</description>
    <link>https://dev.to/diego_rv_62b04411f224eda8</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%2F4037402%2F852e4038-598c-4a4f-afcd-1f303d4ecedd.png</url>
      <title>DEV Community: Diego RV</title>
      <link>https://dev.to/diego_rv_62b04411f224eda8</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/diego_rv_62b04411f224eda8"/>
    <language>en</language>
    <item>
      <title>Shipping a MemoryAgent on Qwen in a weekend: build notes</title>
      <dc:creator>Diego RV</dc:creator>
      <pubDate>Mon, 20 Jul 2026 06:32:46 +0000</pubDate>
      <link>https://dev.to/diego_rv_62b04411f224eda8/shipping-a-memoryagent-on-qwen-in-a-weekend-build-notes-2aa7</link>
      <guid>https://dev.to/diego_rv_62b04411f224eda8/shipping-a-memoryagent-on-qwen-in-a-weekend-build-notes-2aa7</guid>
      <description>&lt;p&gt;&lt;strong&gt;Hilo — the agent you never re-explain your project to.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Every AI chat starts with amnesia. Use an assistant across a multi-day project and you pay a re-explanation tax at the start of every session: pasting context, restating decisions, re-answering questions you already answered. For the Global AI Hackathon with Qwen Cloud (Track 1: MemoryAgent), I built the smallest agent that removes that tax entirely.&lt;/p&gt;

&lt;h2&gt;
  
  
  The design bet: one loop, one file of memory
&lt;/h2&gt;

&lt;p&gt;Hilo is deliberately tiny: a session loop (&lt;code&gt;agent.py&lt;/code&gt;) and a memory engine (&lt;code&gt;memory.py&lt;/code&gt;). Brief it once. When you leave — &lt;code&gt;/quit&lt;/code&gt;, or even Ctrl+C — one extra Qwen call distills the whole transcript into structured memory:&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;"facts"&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="s2"&gt;"Hilo is a memory agent for the Qwen Cloud hackathon, Track 1 MemoryAgent."&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"preferences"&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;"open_threads"&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="s2"&gt;"Which Qwen model gives the fastest demo latency?"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"session_count"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;1&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 next session injects that block — not the transcripts — and opens with "Welcome back — session 2. Where we left off: …".&lt;/p&gt;

&lt;p&gt;The track asks for three things, and each maps to one design decision. &lt;em&gt;Efficient memory storage and retrieval&lt;/em&gt;: distillation compresses a whole session into at most 40 structured items with a single call. &lt;em&gt;Timely forgetting of outdated information&lt;/em&gt;: resolved threads are dropped at distill time, stale facts get rewritten instead of appended, and a hard 40-item cap prunes oldest-first. &lt;em&gt;Recalling critical memories within limited context windows&lt;/em&gt;: session start costs hundreds of tokens of memory, never a context window of history.&lt;/p&gt;

&lt;h2&gt;
  
  
  Building on Qwen / Alibaba Cloud: what actually happened
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;The Beijing trap.&lt;/strong&gt; Alibaba Cloud has two consoles. The Beijing one (&lt;code&gt;bailian.console.*&lt;/code&gt;) demands Chinese real-name authentication and issues keys that don't work internationally. The Singapore console (&lt;code&gt;modelstudio.console.alibabacloud.com/ap-southeast-1&lt;/code&gt;) with the &lt;code&gt;dashscope-intl&lt;/code&gt; endpoint is the one international builders want. I lost a session to this; the fix is retyping the ap-southeast-1 URL.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;OpenAI-compatible mode is real.&lt;/strong&gt; The whole integration is the standard &lt;code&gt;openai&lt;/code&gt; Python SDK pointed at &lt;code&gt;https://dashscope-intl.aliyuncs.com/compatible-mode/v1&lt;/code&gt;. No custom SDK, no special cases. Distillation and chat both worked on the first green smoke test.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Model catalogs rotate.&lt;/strong&gt; Hackathon guides age fast; the model name in a week-old tutorial may already be retired. I stopped hardcoding: my smoke test tries the configured model, then a fallback list, and prints the exact &lt;code&gt;QWEN_MODEL=&lt;/code&gt; line to paste into &lt;code&gt;.env&lt;/code&gt;. That turned a potential demo-day failure into a 10-second fix.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Memory must be unbreakable.&lt;/strong&gt; A memory agent that can corrupt its memory is worse than no memory agent. Hilo writes atomically (temp file + rename), quarantines corrupt files instead of crashing, and treats a failed distillation as "memory unchanged", never "memory lost". The demo video deliberately kills a session mid-sentence with Ctrl+C — restart, and it still remembers.&lt;/p&gt;

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

&lt;p&gt;Code: ~400 lines total, two modules, zero frameworks. Cost: distillation is one extra call per session on qwen-turbo; the whole build ran on new-user free quota — effectively $0. Latency: the resume greeting is instant (computed locally, zero API calls at startup); distillation at quit takes a few seconds; the live smoke test answered in 1.1s from CI and 2.5s from a home connection in Chile.&lt;/p&gt;

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

&lt;p&gt;Multi-project memory namespaces, semantic retrieval over long memories, and shared team memory — so a whole team never re-explains the project either.&lt;/p&gt;

&lt;p&gt;Repo: &lt;a href="https://github.com/phazon2/hilo" rel="noopener noreferrer"&gt;github.com/phazon2/hilo&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Built solo, on Qwen via Alibaba Cloud Model Studio, in a weekend.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>hackathon</category>
      <category>learning</category>
      <category>development</category>
    </item>
  </channel>
</rss>
