<?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: Huan Antonio</title>
    <description>The latest articles on DEV Community by Huan Antonio (@huanantonio77lgtm).</description>
    <link>https://dev.to/huanantonio77lgtm</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%2F4169003%2F09e07e0e-476c-4345-b6a7-7f35cdda5e20.png</url>
      <title>DEV Community: Huan Antonio</title>
      <link>https://dev.to/huanantonio77lgtm</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/huanantonio77lgtm"/>
    <language>en</language>
    <item>
      <title>Building an autonomous agent that maintains itself: 200 sessions of ai-hub</title>
      <dc:creator>Huan Antonio</dc:creator>
      <pubDate>Wed, 07 Oct 2026 13:43:35 +0000</pubDate>
      <link>https://dev.to/huanantonio77lgtm/building-an-autonomous-agent-that-maintains-itself-200-sessions-of-ai-hub-713</link>
      <guid>https://dev.to/huanantonio77lgtm/building-an-autonomous-agent-that-maintains-itself-200-sessions-of-ai-hub-713</guid>
      <description>&lt;h2&gt;
  
  
  The bet: self-maintenance before features
&lt;/h2&gt;

&lt;p&gt;Two hundred sessions ago, ai-hub was going to be an arbitrage bot. Today it's something else: an autonomous system that heals, diagnoses, and updates itself, with DEX data feeds running in the background.&lt;/p&gt;

&lt;p&gt;This is a short engineering retrospective. What worked, what I'd do differently.&lt;/p&gt;

&lt;h3&gt;
  
  
  Why self-maintenance first
&lt;/h3&gt;

&lt;p&gt;The single decision that shaped everything: &lt;strong&gt;spend the first fifty sessions on internal mechanisms, not user-facing features.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Concretely, that meant four axes:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Autonomy&lt;/strong&gt; - a persistent daemon on macOS (launchd, PPID=1), REST feeds to eight DEX venues.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Self-service&lt;/strong&gt; - twenty-seven healers that detect and repair their own failure modes.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Self-diagnosis&lt;/strong&gt; - a blindness audit that lists what the agent cannot see, plus a signed CORE manifest (&lt;code&gt;sign_core&lt;/code&gt; - 14/14 files valid, DRIFT=0).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Self-learning&lt;/strong&gt; - autonomous lesson extraction from every session.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The alternative - build features first, add self-repair later - has a hidden cost: every new feature adds failure modes that the self-repair system has to catch up with. Starting from self-repair means each new feature is born into a system that already knows how to keep itself alive.&lt;/p&gt;

&lt;h3&gt;
  
  
  Axis 1: Autonomy
&lt;/h3&gt;

&lt;p&gt;The agent runs two launchd services: &lt;code&gt;self_daemon&lt;/code&gt; (every two hours) and &lt;code&gt;agent_daemon&lt;/code&gt; (every 120 seconds). Both are true daemons - PPID=1, KeepAlive=true, RunAtLoad=true.&lt;/p&gt;

&lt;p&gt;Every cycle, &lt;code&gt;self_daemon&lt;/code&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;runs an arbitrage scan against eight DEX venues&lt;/li&gt;
&lt;li&gt;appends to &lt;code&gt;ARBITRAGE_STATS.jsonl&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;once a day, pulls new papers from arXiv / OpenAlex / Crossref&lt;/li&gt;
&lt;li&gt;once a day, rolls 30-day stats into &lt;code&gt;SELF_TRADING.md&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Eight DEX venues today: Hyperliquid, dYdX v4, Paradex, Orca, Raydium, GMX, Injective, Curve. All read-only - &lt;code&gt;place_order&lt;/code&gt; is a deliberate no-op. Fees are accounted for in the net-profit check; AMM fee is zero in the scanner to avoid double-counting.&lt;/p&gt;

&lt;h3&gt;
  
  
  Axis 2: Self-service (27 healers)
&lt;/h3&gt;

&lt;p&gt;Healers are small scripts, each with one job. Examples:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;disk_janitor&lt;/code&gt; - archives old session artifacts&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;lessons_hygiene&lt;/code&gt; - detects garbage blocks in the lesson log&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;secrets_audit&lt;/code&gt; - checks file permissions under &lt;code&gt;.secrets/&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;family_audit&lt;/code&gt; - flags modules that lack matching tests&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The healers are not clever individually. What matters is the invariant: if something is fixable, some healer should already be trying to fix it. Adding a new failure mode is an invitation to write a new healer - not a reason to page a human.&lt;/p&gt;

&lt;h3&gt;
  
  
  Axis 3: Self-diagnosis
&lt;/h3&gt;

&lt;p&gt;Two mechanisms here.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;code&gt;sign_core&lt;/code&gt;&lt;/strong&gt; - fourteen core files are signed with an Ed25519 key. Every session, &lt;code&gt;verify_core()&lt;/code&gt; confirms nothing has drifted. If a signature is invalid, the session stops. This paranoia has paid off more than once.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Blindness audit&lt;/strong&gt; - a periodic self-report of &lt;em&gt;what the agent cannot see&lt;/em&gt;. Not "what's broken" but "what we're not even looking at." This is the axis with the least tooling today; if there's a blind spot we're not detecting, we won't learn it from metrics.&lt;/p&gt;

&lt;h3&gt;
  
  
  Axis 4: Self-learning
&lt;/h3&gt;

&lt;p&gt;Every session produces events (&lt;code&gt;EVENTS.jsonl&lt;/code&gt;). A five-layer pipeline turns raw events into lessons:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Capture&lt;/strong&gt; - the daemon and the curator emit events&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Filter&lt;/strong&gt; - only events with actionable shape survive&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Draft&lt;/strong&gt; - candidates get written to &lt;code&gt;lesson_suggest_s20N.json&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Curate&lt;/strong&gt; - the human approves or rejects each draft&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Persist&lt;/strong&gt; - approved lessons go to &lt;code&gt;lessons.md&lt;/code&gt; and are indexed + embedded&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Current counts: 9,335 lessons, 303 in the search index, 304 embeddings. The "suggest five pending lessons" loop has been stable for six sessions in a row.&lt;/p&gt;

&lt;p&gt;The point is not the number. It's that the agent gets better at its own job without being told what to learn.&lt;/p&gt;

&lt;h3&gt;
  
  
  What I'd do differently
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Lesson quality over quantity.&lt;/strong&gt; 9,335 looks nice on a dashboard, but most of the index growth is routine session noise. If I started over, I would cap the daily intake at three lessons and require a stronger novelty signal before persisting.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Cap features until healers exist.&lt;/strong&gt; A feature without a healer is a debt you pay later.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Read-only phase one was right.&lt;/strong&gt; DEX integration tempts you to add &lt;code&gt;place_order&lt;/code&gt; on day one. Don't. Get the data plumbing right first - orders come last.&lt;/p&gt;

&lt;h3&gt;
  
  
  Numbers today
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;163 features, 167 checks, 163 alive&lt;/li&gt;
&lt;li&gt;27 healers, 0 regressions in the last 13 sessions&lt;/li&gt;
&lt;li&gt;221/221 tests passing&lt;/li&gt;
&lt;li&gt;8 DEX venues, all read-only&lt;/li&gt;
&lt;li&gt;Docker + compose included, self-hosting works&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Links
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;GitHub: &lt;a href="https://github.com/huanantonio77-lgtm/ai-hub" rel="noopener noreferrer"&gt;https://github.com/huanantonio77-lgtm/ai-hub&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>ai</category>
      <category>python</category>
      <category>opensource</category>
      <category>agents</category>
    </item>
  </channel>
</rss>
