<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>AI &#8211; LarryLai</title>
	<atom:link href="https://larrylai.com/category/it/ai/feed/" rel="self" type="application/rss+xml" />
	<link>https://larrylai.com</link>
	<description>兼聽則明 偏聽則暗</description>
	<lastBuildDate>Mon, 08 Jun 2026 11:11:28 +0000</lastBuildDate>
	<language>en-GB</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	

<image>
	<url>https://larrylai.com/wp-content/uploads/2017/03/larrylai_com-favicon.png</url>
	<title>AI &#8211; LarryLai</title>
	<link>https://larrylai.com</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Hybrid AI Protocol: Orchestrating Cloud and Local AI</title>
		<link>https://larrylai.com/hybrid-ai-protocol-orchestrating-cloud-and-local-ai/</link>
					<comments>https://larrylai.com/hybrid-ai-protocol-orchestrating-cloud-and-local-ai/#respond</comments>
		
		<dc:creator><![CDATA[larry]]></dc:creator>
		<pubDate>Sun, 07 Jun 2026 18:36:59 +0000</pubDate>
				<category><![CDATA[AI]]></category>
		<guid isPermaLink="false">https://larrylai.com/hybrid-ai-protocol-orchestrating-cloud-and-local-ai/</guid>

					<description><![CDATA[<p>Background I am not going to define or describe what AI agents are, as all of us can easily find relevant information on the web. I would like to share a framework I developed to balance the cognitive power of cloud AI with the cost-efficiency of local execution. While powerful cloud models like Opus 4.x [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://larrylai.com/hybrid-ai-protocol-orchestrating-cloud-and-local-ai/">Hybrid AI Protocol: Orchestrating Cloud and Local AI</a> appeared first on <a rel="nofollow" href="https://larrylai.com">LarryLai</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p><strong>Background</strong><br />
I am not going to define or describe what AI agents are, as all of us can easily find relevant information on the web. I would like to share a framework I developed to balance the cognitive power of cloud AI with the cost-efficiency of local execution.</p>
<p>While powerful cloud models like Opus 4.x can be integrated to manage local files and interact with my computer, running all tasks—no matter if they are complex, basic, or recurring—unnecessarily consumes expensive tokens. Even though there are several pricing tiers of cloud models to choose from, constantly switching between them during rapid implementation cycles is inconvenient. Local open-source models are fantastic for handling basic, repetitive tasks for free, but they are strictly bound by the hardware they run on.</p>
<p><strong>Config</strong><br />
* <strong>Mac hardware:</strong> Mac mini M2 Pro with 32GB Unified Memory.<br />
* <strong>Local Agent:</strong> &#8220;Hermes&#8221; framework running the <code>gemma4:26b-mlx</code> model.<br />
* <strong>Cloud Agent:</strong> Claude running Opus 4.x.</p>
<p><strong>Issue</strong><br />
Due to the hardware limitation of my Mac&#8217;s 32GB of memory (unlike a Mac Studio which can be configured with up to 512GB of unified memory), the relatively small <code>gemma4:26b-mlx</code> model frequently truncated complex Python scripts mid-generation. It would abruptly cut off critical logic right after the <code>import</code> statements and variable declarations.</p>
<p>To be clear, this truncation is due to the physical hardware constraints and the local model size, not a limitation or flaw in the Hermes agent framework itself. However, it meant the local agent could not be trusted to reliably write structural code.</p>
<p><strong>Solution</strong><br />
To solve this, I built the <strong>Hybrid AI Orchestration Protocol</strong>: a directory-isolated, dual-agent &#8220;Walkie-Talkie&#8221; Blackboard architecture. The agents never speak directly; they coordinate via a single <code>state.json</code> file inside a <code>.handover/</code> directory. This file separates <em>liveness</em> from <em>intent</em> (tracking the <code>holder</code> and the <code>purpose</code>).</p>
<p>To prevent file conflicts and token waste, the protocol enforces strict roles:<br />
1. <strong>The Client (Me):</strong> Initiates the Product Requirements Document (PRD), answers questions, and gives final sign-off.<br />
2. <strong>Claude (The Architect &amp; QA):</strong> Handles structural planning, complex coding, and final QA. Claude is also the sole <strong>Version Control Manager</strong>—Hermes is strictly locked out of autonomous Git operations so a truncated script never overwrites the repository.<br />
3. <strong>Hermes (The Executor):</strong> Restricted from structural coding. It reads Claude&#8217;s scripts, checks paths, installs <code>pip</code> dependencies, executes terminal tests, and reports errors back to Claude.</p>
<p><strong>Tricks</strong><br />
What makes this system genuinely robust are three specific guardrails implemented to prevent common multi-agent failure modes:<br />
* <strong>The DRILL-ME Phase:</strong> Before any code is written, Claude must interrogate me about the PRD. Crucially, Claude must ask operational questions <em>on behalf of Hermes</em> (e.g., confirming the exact macOS path for credentials). This ensures the local execution environment is mapped beforehand.<br />
* <strong>Anti-Infinite-Loop:</strong> Agents can easily get stuck in an endless loop of failing a test and rewriting broken code. The state file tracks an <code>attempt_count</code>. If a script fails 5 times, it triggers an <code>ABORTED</code> state, forcing a human review.<br />
* <strong>Append-Only Logs:</strong> During testing, failures are saved as append-only numbered logs (<code>log_001.txt</code>, <code>log_002.txt</code>) instead of overwriting the terminal output. This preserves the complete debugging history for Claude to analyze.</p>
<p>The post <a rel="nofollow" href="https://larrylai.com/hybrid-ai-protocol-orchestrating-cloud-and-local-ai/">Hybrid AI Protocol: Orchestrating Cloud and Local AI</a> appeared first on <a rel="nofollow" href="https://larrylai.com">LarryLai</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://larrylai.com/hybrid-ai-protocol-orchestrating-cloud-and-local-ai/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
