<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>Posts on AI Brew</title>
    <link>https://aibrew.ai/posts/</link>
    <description>Recent content in Posts on AI Brew</description>
    <generator>Hugo</generator>
    <language>en-us</language>
    <lastBuildDate>Mon, 25 May 2026 00:00:00 +0000</lastBuildDate>
    <atom:link href="https://aibrew.ai/posts/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Hello, World</title>
      <link>https://aibrew.ai/2026/05/hello-world/</link>
      <pubDate>Mon, 25 May 2026 00:00:00 +0000</pubDate>
      <guid>https://aibrew.ai/2026/05/hello-world/</guid>
      <description>&lt;h2 id=&#34;welcome-to-mybrew&#34;&gt;Welcome to MyBrew&lt;/h2&gt;
&lt;p&gt;This is the first post. More coming soon.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Tool Reviews&lt;/strong&gt; — hands-on testing&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Tutorials&lt;/strong&gt; — step-by-step AI guides&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Comparisons&lt;/strong&gt; — side-by-side breakdowns&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Roundups&lt;/strong&gt; — curated collections&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Everything tested. No hype.&lt;/p&gt;</description>
      <content:encoded><![CDATA[<h2 id="welcome-to-mybrew">Welcome to MyBrew</h2>
<p>This is the first post. More coming soon.</p>
<ul>
<li><strong>Tool Reviews</strong> — hands-on testing</li>
<li><strong>Tutorials</strong> — step-by-step AI guides</li>
<li><strong>Comparisons</strong> — side-by-side breakdowns</li>
<li><strong>Roundups</strong> — curated collections</li>
</ul>
<p>Everything tested. No hype.</p>
]]></content:encoded>
    </item>
    <item>
      <title>Huawei&#39;s τ-Scaling Law: A Real Read of the Paper Behind the Hype</title>
      <link>https://aibrew.ai/2026/05/huaweis-%CF%84-scaling-law-a-real-read-of-the-paper-behind-the-hype/</link>
      <pubDate>Mon, 25 May 2026 00:00:00 +0000</pubDate>
      <guid>https://aibrew.ai/2026/05/huaweis-%CF%84-scaling-law-a-real-read-of-the-paper-behind-the-hype/</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;TL;DR&lt;/strong&gt; — Huawei&amp;rsquo;s τ (Tao) Scaling Law, announced at IEEE ISCAS 2026, reframes Moore&amp;rsquo;s Law: instead of shrinking transistors, optimize a time constant τ across the entire computing stack. The paper is real, the production data is concrete, but the &amp;ldquo;first scaling law since Dennard&amp;rdquo; claim deserves scrutiny. This is mostly a solid 3D-integration engineering paper wrapped in a strategic narrative about how China builds high-performance chips without leading-edge lithography.&lt;/p&gt;</description>
      <content:encoded><![CDATA[<blockquote>
<p><strong>TL;DR</strong> — Huawei&rsquo;s τ (Tao) Scaling Law, announced at IEEE ISCAS 2026, reframes Moore&rsquo;s Law: instead of shrinking transistors, optimize a time constant τ across the entire computing stack. The paper is real, the production data is concrete, but the &ldquo;first scaling law since Dennard&rdquo; claim deserves scrutiny. This is mostly a solid 3D-integration engineering paper wrapped in a strategic narrative about how China builds high-performance chips without leading-edge lithography.</p>
</blockquote>
<hr>
<h2 id="what-was-announced">What Was Announced</h2>
<p>On May 25, 2026, at the IEEE International Symposium on Circuits and Systems (ISCAS) in Shanghai, He Tingbo — President of Huawei&rsquo;s Semiconductor Business — delivered a keynote titled <em>&ldquo;Exploration and Practice of a New Semiconductor Path.&rdquo;</em> The headline: a new scaling principle Huawei calls <strong>τ (Tao) Scaling</strong>, marketed as China&rsquo;s first systematic semiconductor industry law.</p>
<p>The paper, <em>&ldquo;A Time Scaling Theory for Multi-Layer Electronic Systems,&rdquo;</em> was simultaneously posted to ChinaXiv as a preprint (<a href="https://chinaxiv.org/abs/202605.00224">ChinaXiv:202605.00224</a>). Within hours it had over 30,000 reads and 13,000 downloads — unusual for a preprint server.</p>
<p>This is worth taking seriously precisely because it&rsquo;s published, not a marketing deck.</p>
<hr>
<h2 id="the-core-reframe">The Core Reframe</h2>
<p>For 60 years, Moore&rsquo;s Law has driven semiconductor progress by shrinking transistor dimensions. The paper opens with the industry consensus:</p>
<blockquote>
<p><em>&ldquo;For six decades, Moore&rsquo;s geometric scaling drove progress in semiconductors&hellip; returns from pure dimensional shrinking have flattened, leading-edge design budgets exceed one billion dollars per chip, and cost-per-transistor at the most advanced nodes is no longer falling.&rdquo;</em></p>
</blockquote>
<p>So what&rsquo;s the successor principle? The paper&rsquo;s pivot is the key insight:</p>
<blockquote>
<p><em>&ldquo;Spatial scaling served merely as the instrument for compressing time.&rdquo;</em></p>
</blockquote>
<p>In other words: Moore&rsquo;s Law was never really about transistor area — it was about reducing the time it takes for a system to do something. Users don&rsquo;t care that their chip is 3nm. They care that their app opens in 200ms instead of 300ms.</p>
<p>If time was always the underlying goal, <strong>why not measure progress in time directly?</strong> That&rsquo;s τ scaling: a single characteristic time constant τ as the unifying optimization target across the entire computing stack — from picosecond transistor switching to multi-second AI workload latency, spanning twelve orders of magnitude.</p>
<p>The paper&rsquo;s strongest methodological claim:</p>
<blockquote>
<p><em>&ldquo;τ scaling is the first scaling principle since Dennard to establish a shared optimization target across the entire computing stack.&rdquo;</em></p>
</blockquote>
<p>This is a big claim. We&rsquo;ll revisit it.</p>
<hr>
<h2 id="how-τ-works-four-layers">How τ Works: Four Layers</h2>
<p>The framework decomposes τ into four stack layers, each with its own optimization target:</p>
<table>
  <thead>
      <tr>
          <th>Layer</th>
          <th>What τ measures</th>
          <th>Optimization technique</th>
      </tr>
  </thead>
  <tbody>
      <tr>
          <td><strong>Device</strong></td>
          <td>Transistor switching delay</td>
          <td>Lower resistance, parasitic capacitance</td>
      </tr>
      <tr>
          <td><strong>Circuit</strong></td>
          <td>Signal RC delay along wires</td>
          <td><strong>LogicFolding</strong> — vertical 3D stacking</td>
      </tr>
      <tr>
          <td><strong>Chip</strong></td>
          <td>Compute + memory access delay</td>
          <td>Full-stack co-design</td>
      </tr>
      <tr>
          <td><strong>System</strong></td>
          <td>Inter-chip + inter-rack communication</td>
          <td><strong>Unified Bus + Hi-ONE optical I/O</strong></td>
      </tr>
  </tbody>
</table>
<p>The interesting move is that the paper treats <em>frequency, latency, bandwidth, throughput</em> as all being governed by τ at their respective layers. One framework, twelve orders of magnitude.</p>
<hr>
<h2 id="production-demo-1-kirin-2026-soc">Production Demo #1: Kirin 2026 SoC</h2>
<p>This is the most concrete part of the paper. The Kirin 2026 chip — launching this autumn — is the first commercial product using LogicFolding.</p>
<h3 id="what-logicfolding-actually-does">What LogicFolding Actually Does</h3>
<blockquote>
<p><em>&ldquo;LogicFolding is a design methodology that partitions digital, analog, and memory circuits across vertically stacked active tiers.&rdquo;</em></p>
</blockquote>
<p>In plain terms: instead of laying out logic in a single 2D plane, split the design across multiple active silicon layers connected by high-density hybrid bonding. Some signal paths that previously had to traverse long horizontal distances now travel short vertical ones.</p>
<p>The promise:</p>
<blockquote>
<p><em>&ldquo;Signal wires become substantially shorter, parasitic RC decreases sharply, clock skew tightens, and the chip operates at a higher clock frequency at the same device node.&rdquo;</em></p>
</blockquote>
<p>Crucially: <strong>at the same device node</strong>. This isn&rsquo;t a process shrink. It&rsquo;s a structural reorganization that recovers performance from the interconnect, not the transistor.</p>
<h3 id="the-numbers-from-the-paper">The Numbers (from the paper)</h3>
<p>Measured on Kirin 2026:</p>
<table>
  <thead>
      <tr>
          <th>Metric</th>
          <th>Improvement</th>
      </tr>
  </thead>
  <tbody>
      <tr>
          <td>Transistor density</td>
          <td><strong>155 → 238 MTr/mm² (+55%)</strong></td>
      </tr>
      <tr>
          <td>P-core power efficiency</td>
          <td><strong>+41%</strong></td>
      </tr>
      <tr>
          <td>Peak frequency</td>
          <td><strong>2.75 → 3.1 GHz (+13%)</strong></td>
      </tr>
      <tr>
          <td>SRAM operating frequency</td>
          <td><strong>+40%</strong></td>
      </tr>
      <tr>
          <td>Clock buffer count</td>
          <td><strong>−50%</strong></td>
      </tr>
      <tr>
          <td>Clock skew</td>
          <td><strong>−25%</strong></td>
      </tr>
      <tr>
          <td>Critical wire length</td>
          <td><strong>−30%</strong></td>
      </tr>
  </tbody>
</table>
<p>If these hold up under independent measurement, this is a genuine engineering achievement — not just a process node bump.</p>
<hr>
<h2 id="production-demo-2-ai-data-centers">Production Demo #2: AI Data Centers</h2>
<p>The harder test for any scaling principle: does it work at gigawatt scale?</p>
<blockquote>
<p><em>&ldquo;Whether a principle developed in the milliwatt smartphone regime survives translation to the gigawatt regime of AI training and inference.&rdquo;</em></p>
</blockquote>
<p>The paper&rsquo;s answer: yes, but only if you treat τ as a system-level target, not a per-accelerator optimization.</p>
<h3 id="the-bottleneck-reframe">The Bottleneck Reframe</h3>
<p>The paper&rsquo;s most important industry observation:</p>
<blockquote>
<p><em>&ldquo;Modern AI systems are dominated by data, not by compute. Over 80% of energy in large AI clusters is spent on data movement, and over 70% of system cost goes to data storage.&rdquo;</em></p>
</blockquote>
<p>This is the unspoken truth of AI infrastructure: TOPS numbers on chip datasheets are mostly irrelevant when 80% of energy goes to moving bytes between chips, racks, and storage tiers.</p>
<h3 id="three-solutions">Three Solutions</h3>
<p><strong>1. Unified Bus</strong> (灵衢总线) — A memory-semantic fabric eliminating protocol conversions between PCIe / NVLink / RDMA / Ethernet / InfiniBand layers. The claim:</p>
<blockquote>
<p><em>&ldquo;Conversion-free, peer-to-peer transmission.&rdquo;</em></p>
</blockquote>
<p>Measured impact: end-to-end remote access latency from <strong>tens of microseconds to ~100ns</strong> — a roughly <strong>500× reduction</strong> in system τ on the main communication path.</p>
<p><strong>2. Hi-ONE</strong> (High-density Optical-interconnect-Node Engine) — Near-package optical I/O. At multi-Tb/s per chip, copper becomes physically impractical:</p>
<blockquote>
<p><em>&ldquo;At multi-Tb/s per chip, copper becomes physically impractical.&rdquo;</em></p>
</blockquote>
<p>Hi-ONE delivers <strong>8 Tb/s per module</strong>, extends face-to-face distance to <strong>100m</strong>, and matches the chip&rsquo;s UB bandwidth over a single optical link.</p>
<p><strong>3. 3D Folding</strong> — The fan-out dilemma: compute scales with chip area (N²), but I/O and power scale with chip perimeter (N). Solution: fold I/O and power into vertical stack instead of crowding the edge.</p>
<p><strong>Projection</strong>: more than <strong>100× growth in hardware integration by 2035</strong>.</p>
<hr>
<h2 id="the-honest-caveat">The Honest Caveat</h2>
<p>Buried in the paper is one of the most important sentences for understanding what τ scaling is <em>not</em>:</p>
<blockquote>
<p><em>&ldquo;τ is a time law, not a joule law.&rdquo;</em></p>
</blockquote>
<p>Translation: τ scaling solves <em>time</em>, not <em>energy</em>. If you make an AI cluster 10× faster but it also draws 10× more power, you&rsquo;ve just moved the bottleneck from latency to electricity, cooling, and dollars.</p>
<p>The paper acknowledges this and gestures at the obvious complements: protocol overhead reduction, lower per-bit transmission energy, near-memory computing, backside power delivery, dynamic voltage/frequency scaling. But the framework itself doesn&rsquo;t solve energy. Anyone evaluating τ scaling should remember this.</p>
<p>It&rsquo;s worth noting that He Tingbo explicitly acknowledges this in the paper — unlike most marketing-driven &ldquo;new law&rdquo; announcements, which tend to gloss over their boundaries.</p>
<hr>
<h2 id="earned-credit-vs-marketing">Earned Credit vs. Marketing</h2>
<h3 id="what-stands-up">What stands up</h3>
<ul>
<li><strong>Real paper, real data.</strong> ISCAS keynote + ChinaXiv preprint with concrete production numbers. Not a slide deck.</li>
<li><strong>Honest about limits.</strong> The &ldquo;τ is not a joule law&rdquo; caveat shows genuine engineering humility.</li>
<li><strong>Strategically sound.</strong> Without access to leading-edge EUV lithography, China needs a path to high-performance chips that doesn&rsquo;t depend on 2nm or 1nm process nodes. 3D integration plus system-level optimization is that path. The framework gives it a name and a measurable target.</li>
<li><strong>Kirin 2026 ships this autumn.</strong> Verifiable claims have a verification date.</li>
</ul>
<h3 id="what-deserves-scrutiny">What deserves scrutiny</h3>
<p><strong>&ldquo;First scaling principle since Dennard&rdquo;</strong> is a load-bearing claim. But:</p>
<ul>
<li>3D integration has been studied for years. TSMC&rsquo;s CoWoS, Intel&rsquo;s Foveros, AMD&rsquo;s chiplet packaging, Samsung&rsquo;s X-Cube — these are all forms of vertical integration.</li>
<li>HBM is essentially a 3D-folded memory stack.</li>
<li>Imec&rsquo;s CFET research aims at gate-level 3D folding.</li>
</ul>
<p>The paper differentiates LogicFolding from existing 3D IC and chiplets by arguing they operate at the <em>packaging</em> layer, while LogicFolding operates at the <em>circuit topology</em> layer inside the chip. That&rsquo;s a legitimate distinction — but it&rsquo;s an incremental one, not a paradigm break.</p>
<p><strong>&ldquo;1.4nm equivalent density by 2031&rdquo;</strong> is a density target, not a process node. The paper is careful about this — but the surrounding press has not been. Equivalent density via 3D stacking is real; it is not the same as fabricating a true 1.4nm node, and shouldn&rsquo;t be conflated.</p>
<p><strong>&ldquo;381 chips in 6 years using τ scaling&rdquo;</strong> is post-hoc framing. Huawei has been shipping chips for years; retroactively grouping them under a unified principle is good narrative but doesn&rsquo;t validate the principle as predictive.</p>
<p><strong>No public benchmarks against the competition.</strong> TSMC N2, Intel 18A, Samsung 3GAP — where do they sit on this τ chart? The paper doesn&rsquo;t say. Until independent measurement compares apples to apples, the &ldquo;100× by 2035&rdquo; projection is a roadmap, not a result.</p>
<hr>
<h2 id="why-this-matters-strategically">Why This Matters Strategically</h2>
<p>Strip the &ldquo;scaling law&rdquo; framing and what&rsquo;s left is a coherent industry argument:</p>
<blockquote>
<p><em>&ldquo;You don&rsquo;t need the most advanced lithography to build competitive high-performance chips, if you reorganize circuits in 3D and treat the entire system as a single optimization target.&rdquo;</em></p>
</blockquote>
<p>This is the technical case for a China-led semiconductor strategy that doesn&rsquo;t depend on access to ASML&rsquo;s EUV machines. It&rsquo;s also a vision for how AI infrastructure could be built differently — interconnect-centric, system-co-designed, optical at the edges rather than copper everywhere.</p>
<p>Whether or not τ scaling becomes &ldquo;the next Moore&rsquo;s Law,&rdquo; it&rsquo;s a real-world demonstration that the post-Moore era has multiple paths. The question is which path delivers on its claims.</p>
<hr>
<h2 id="what-to-watch">What to Watch</h2>
<ul>
<li><strong>Kirin 2026 launch (Autumn 2026):</strong> Are the 41% efficiency and 55% density gains independently measurable?</li>
<li><strong>ISCAS 2026 paper full text:</strong> Independent review of LogicFolding&rsquo;s claimed RC reductions vs alternative explanations.</li>
<li><strong>Industry response:</strong> Do TSMC, Intel, Samsung adopt τ-style framing? Or counter with their own &ldquo;scaling principle&rdquo; branding?</li>
<li><strong>Energy data:</strong> Since τ doesn&rsquo;t solve energy, what&rsquo;s the actual J/op for AI workloads on Huawei&rsquo;s Ascend silicon vs NVIDIA&rsquo;s latest?</li>
<li><strong>Beyond Kirin:</strong> Does LogicFolding land in Ascend AI chips next? The paper claims AI-system applicability but the production demo is mobile SoC.</li>
</ul>
<hr>
<h2 id="bottom-line">Bottom Line</h2>
<p>The τ Scaling paper is <strong>a solid engineering paper with an oversized strategic narrative wrapped around it.</strong> The technical core — LogicFolding, Unified Bus, Hi-ONE, 3D Folding — is real work with measurable claims. The framing as &ldquo;the next Moore&rsquo;s Law&rdquo; oversells what is, methodologically, an incremental extension of well-known 3D integration techniques combined with system-level co-design.</p>
<p>That&rsquo;s not a criticism. Most real engineering progress is incremental. The marketing layer is what funds the engineering. What matters is whether the Kirin 2026 ships this autumn with the numbers the paper claims. If it does, China just published a credible technical roadmap for high-performance chips that doesn&rsquo;t depend on access to leading-edge lithography. That&rsquo;s a much bigger deal than &ldquo;the next Moore&rsquo;s Law.&rdquo;</p>
<hr>
<p><em>References</em></p>
<ul>
<li><em><a href="https://chinaxiv.org/abs/202605.00224">Tingbo He — A Time Scaling Theory for Multi-Layer Electronic Systems (ChinaXiv preprint)</a></em></li>
<li><em><a href="https://www.huawei.com/cn/news/2026/5/ieee-iscas-tau-scaling">Huawei official announcement — ISCAS 2026 τ scaling</a></em></li>
<li><em><a href="https://www.eefocus.com/article/2019984.html">EEFocus — Deep read of He Tingbo&rsquo;s &ldquo;Time Scaling&rdquo; paper</a></em></li>
<li><em><a href="https://www.gizmochina.com/2026/05/25/huawei-proposes-tao-law-as-alternative-to-moores-law-first-logic-folding-chip-arrives-this-autumn/">Gizmochina — Huawei proposes Tao Law as alternative to Moore&rsquo;s Law</a></em></li>
<li><em><a href="https://www.21jingji.com/article/20260525/herald/1573642c437a5e4e76a15fc1c40f0a35.html">21 Economic Net — What is the Tao Law and how is it different from Moore&rsquo;s Law</a></em></li>
</ul>
]]></content:encoded>
    </item>
    <item>
      <title>RAG vs Agents: When to Use Which (With Real Examples from Our Stack)</title>
      <link>https://aibrew.ai/2026/05/rag-vs-agents-when-to-use-which-with-real-examples-from-our-stack/</link>
      <pubDate>Mon, 25 May 2026 00:00:00 +0000</pubDate>
      <guid>https://aibrew.ai/2026/05/rag-vs-agents-when-to-use-which-with-real-examples-from-our-stack/</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;TL;DR&lt;/strong&gt; — RAG answers from documents. Agents take actions. Most real systems use both: RAG provides context, agents act on it. The hard part isn&amp;rsquo;t picking one — it&amp;rsquo;s knowing which layer of your problem belongs to which pattern.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;hr&gt;
&lt;h2 id=&#34;why-this-comparison-matters-right-now&#34;&gt;Why This Comparison Matters Right Now&lt;/h2&gt;
&lt;p&gt;Two things happened in the last six months that make this comparison less academic than it used to be.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;First&lt;/strong&gt;: coding agents crossed a quality threshold around November 2025. Simon Willison&amp;rsquo;s &lt;a href=&#34;https://simonwillison.net/2026/May/19/5-minute-llms/&#34;&gt;five-minute PyCon talk&lt;/a&gt; describes it as the moment agents went from &amp;ldquo;often-work&amp;rdquo; to &amp;ldquo;mostly-work&amp;rdquo; — usable as daily drivers, not just demos. The &amp;ldquo;best model&amp;rdquo; title changed hands five times between Anthropic, OpenAI, and Google in a single month.&lt;/p&gt;</description>
      <content:encoded><![CDATA[<blockquote>
<p><strong>TL;DR</strong> — RAG answers from documents. Agents take actions. Most real systems use both: RAG provides context, agents act on it. The hard part isn&rsquo;t picking one — it&rsquo;s knowing which layer of your problem belongs to which pattern.</p>
</blockquote>
<hr>
<h2 id="why-this-comparison-matters-right-now">Why This Comparison Matters Right Now</h2>
<p>Two things happened in the last six months that make this comparison less academic than it used to be.</p>
<p><strong>First</strong>: coding agents crossed a quality threshold around November 2025. Simon Willison&rsquo;s <a href="https://simonwillison.net/2026/May/19/5-minute-llms/">five-minute PyCon talk</a> describes it as the moment agents went from &ldquo;often-work&rdquo; to &ldquo;mostly-work&rdquo; — usable as daily drivers, not just demos. The &ldquo;best model&rdquo; title changed hands five times between Anthropic, OpenAI, and Google in a single month.</p>
<p><strong>Second</strong>: the model labs themselves are pivoting. Greg Brockman: <em>&ldquo;the model alone is no longer the product.&rdquo;</em> AI21 shuttered its model team to focus on agents. DeepSeek spun up its first &ldquo;Harness team.&rdquo; <a href="https://www.latent.space/p/ainews-all-model-labs-are-now-agent">Latent Space called this</a> <em>&ldquo;all model labs are now agent labs.&rdquo;</em></p>
<p>When the people who train the models start saying the model isn&rsquo;t the product, the question of <em>how</em> you wire models into systems becomes the actual engineering work. RAG and agents are the two dominant answers. They solve different problems, and getting the choice wrong wastes a lot of tokens.</p>
<hr>
<h2 id="the-mental-model">The Mental Model</h2>
<h3 id="rag-retrieve-then-generate">RAG: Retrieve, then Generate</h3>
<p>RAG is a fixed four-step pipeline:</p>
<pre tabindex="0"><code>User query
   │
   ▼
Embedding model → vector
   │
   ▼
Vector DB / search index → top-K relevant chunks
   │
   ▼
Chunks injected into the LLM prompt as context
   │
   ▼
LLM writes one answer, grounded in the retrieved text
</code></pre><p>One retrieval. One generation. Cheap, deterministic, easy to debug.</p>
<h3 id="agent-reason-then-act-then-reason-again">Agent: Reason, then Act, then Reason Again</h3>
<p>Agent is a reasoning loop:</p>
<pre tabindex="0"><code>User goal
   │
   ▼
┌──────────────────────────────────────────┐
│   LLM reads the goal                      │
│   ↓                                       │
│   Picks a tool (Read, Edit, Bash, ...)    │
│   ↓                                       │
│   Runtime executes the tool               │
│   ↓                                       │
│   Result feeds back to the LLM            │
│   ↓                                       │
│   LLM reasons about what to do next       │
│   ↓                                       │
│   Picks the next tool                     │
│   ↓                                       │
│   ...loop until task is done              │
└──────────────────────────────────────────┘
</code></pre><p>Every iteration burns tokens. Every step can fail. Errors compound across the loop.</p>
<hr>
<h2 id="a-concrete-example-of-each">A Concrete Example of Each</h2>
<h3 id="rag-in-action-semantic-wiki-search">RAG in Action: Semantic Wiki Search</h3>
<p>We run a personal knowledge base — about 60 markdown files covering project notes, design decisions, and conversation transcripts. Plain <code>grep</code> doesn&rsquo;t cut it because the question and the answer rarely share keywords.</p>
<p>The solution is an MCP server that wraps a vector search:</p>
<pre tabindex="0"><code>MCP server: wiki-search
  Backend: bge-m3 embedding model
  Storage: cosine similarity index over 60+ markdown files
  Input:   natural-language query (English or Chinese)
  Output:  file path + section title + similarity score
</code></pre><p>When I ask Claude Code <em>&ldquo;what did we decide about the auto-pipeline last month?&rdquo;</em>, this happens:</p>
<ol>
<li>Claude Code recognizes it needs to search the wiki and invokes <code>search_wiki(&quot;auto-pipeline decision&quot;)</code></li>
<li>The query gets embedded into a 1024-dim vector</li>
<li>Cosine similarity returns the top 5 matching sections</li>
<li>The matching chunks get injected into Claude&rsquo;s context</li>
<li>Claude answers, grounded in the actual files — no hallucination</li>
</ol>
<p>This is RAG end-to-end. The wiki is <strong>passive</strong>. It gets queried; it doesn&rsquo;t act.</p>
<h3 id="agent-in-action-claude-code-editing-files">Agent in Action: Claude Code Editing Files</h3>
<p>Same Claude Code instance. Different problem: <em>&ldquo;Update the baseURL in mybrew/hugo.yaml to aibrew.ai and add a note in TODO.md.&rdquo;</em></p>
<pre tabindex="0"><code>Iteration 1:
  LLM reasoning: &#34;I need to see the current config first.&#34;
  Tool: Read(&#34;mybrew/hugo.yaml&#34;)
  Result: file contents shown

Iteration 2:
  LLM reasoning: &#34;baseURL is on line 1. I&#39;ll edit it.&#34;
  Tool: Edit(old=&#34;https://mybrew.cc/&#34;, new=&#34;https://aibrew.ai/&#34;)
  Result: edit succeeded

Iteration 3:
  LLM reasoning: &#34;Now update TODO.md to mark this done.&#34;
  Tool: Read(&#34;hugo/TODO.md&#34;)
  Result: file contents shown

Iteration 4:
  LLM reasoning: &#34;Need to add the entry under &#39;Domain config&#39;.&#34;
  Tool: Edit(...)
  Result: edit succeeded

Task complete.
</code></pre><p>Four iterations. Four tool calls. Multiple reasoning steps. The agent decided <em>what</em> to do, <em>how</em> to do it, and <em>when</em> it was done — all on its own.</p>
<h3 id="a-higher-stakes-agent-game-server-control">A Higher-Stakes Agent: Game Server Control</h3>
<p>We also run an agent that controls a Terraria game server through MCP — the bridge exposes ~40 tools (give items, teleport, ban players, spawn bosses, restart server).</p>
<pre tabindex="0"><code>Player in chat: &#34;@ai give me a Zenith&#34;
  → terra_item_lookup(&#34;Zenith&#34;) → resolves to ID 4956
  → terra_give_item(player=&#34;kali&#34;, item=&#34;Zenith&#34;) → SUCCESS
  → Item appears in player&#39;s inventory
</code></pre><p>Compare to a destructive operation:</p>
<pre tabindex="0"><code>Player: &#34;@ai end the world&#34;
  → terra_world_hardmode(confirm=true) requires explicit authorization
  → Refuses without confirmation
  → If confirmed: world permanently enters hardmode (irreversible)
</code></pre><p>This is where the agent pattern gets dangerous. The LLM is now in the driver&rsquo;s seat of a real system. <strong>The blast radius of a wrong tool call is no longer &ldquo;wrong answer&rdquo; — it&rsquo;s &ldquo;wrecked world.&rdquo;</strong> Permission boundaries become first-class design.</p>
<hr>
<h2 id="the-decision-framework">The Decision Framework</h2>
<p>The one-line rule:</p>
<blockquote>
<p><strong>Use RAG when the answer lives in your documents. Use an agent when the answer requires action.</strong></p>
</blockquote>
<p>Here&rsquo;s the longer version:</p>
<table>
  <thead>
      <tr>
          <th>Dimension</th>
          <th>RAG</th>
          <th>Agent</th>
      </tr>
  </thead>
  <tbody>
      <tr>
          <td><strong>Goal</strong></td>
          <td>Answer a question</td>
          <td>Complete a task</td>
      </tr>
      <tr>
          <td><strong>Interaction model</strong></td>
          <td>One-shot</td>
          <td>Multi-turn loop</td>
      </tr>
      <tr>
          <td><strong>Token cost</strong></td>
          <td>Low (1× retrieval + 1× generation)</td>
          <td>High (N× reasoning + N× tool calls)</td>
      </tr>
      <tr>
          <td><strong>Latency</strong></td>
          <td>~1–3 seconds</td>
          <td>Seconds to minutes</td>
      </tr>
      <tr>
          <td><strong>Determinism</strong></td>
          <td>High — same query → similar answer</td>
          <td>Low — same goal → different paths</td>
      </tr>
      <tr>
          <td><strong>Debuggability</strong></td>
          <td>Inspect retrieval results</td>
          <td>Trace each reasoning step</td>
      </tr>
      <tr>
          <td><strong>Failure mode</strong></td>
          <td>Wrong/missing context → bad answer</td>
          <td>Tool error compounds → drift</td>
      </tr>
      <tr>
          <td><strong>Blast radius</strong></td>
          <td>Limited to wrong answer</td>
          <td>Touches real systems</td>
      </tr>
      <tr>
          <td><strong>Best for</strong></td>
          <td>Q&amp;A, search, summarization</td>
          <td>Coding, ops, automation, workflows</td>
      </tr>
  </tbody>
</table>
<h3 id="when-you-definitely-want-rag">When You Definitely Want RAG</h3>
<ul>
<li><em>&ldquo;What does our internal API documentation say about rate limits?&rdquo;</em></li>
<li><em>&ldquo;Summarize last week&rsquo;s customer feedback.&rdquo;</em></li>
<li><em>&ldquo;What did the design discussion conclude about authentication?&rdquo;</em></li>
</ul>
<h3 id="when-you-definitely-want-an-agent">When You Definitely Want an Agent</h3>
<ul>
<li><em>&ldquo;Run the test suite and fix any failures.&rdquo;</em></li>
<li><em>&ldquo;Pull yesterday&rsquo;s unread RSS items, pick the three most interesting, and draft a roundup post.&rdquo;</em></li>
<li><em>&ldquo;Refactor this directory to use the new logging API.&rdquo;</em></li>
</ul>
<h3 id="when-you-need-both-most-real-systems">When You Need Both (Most Real Systems)</h3>
<ul>
<li><em>&ldquo;Find the related design doc, then propose a code change consistent with it.&rdquo;</em>
→ RAG to retrieve the doc, agent to make the change.</li>
<li><em>&ldquo;Look up how Pinterest handled MCP auth, then design our auth layer.&rdquo;</em>
→ RAG to gather references, agent to write code.</li>
</ul>
<hr>
<h2 id="hybrid-patterns-rag-powered-agents">Hybrid Patterns: RAG-Powered Agents</h2>
<p>Here&rsquo;s the thing most &ldquo;RAG vs Agent&rdquo; comparisons gloss over: <strong>inside any real agent, RAG is happening at multiple layers</strong>.</p>
<p>A Claude Code session, simplified:</p>
<pre tabindex="0"><code>Session start:
  └─ Load CLAUDE.md into context ............... RAG-on-startup
  └─ Load relevant MEMORY.md files ............. RAG-on-startup

User query:
  └─ Agent reasons about the goal
       │
       ├─ Tool call: search_wiki(&#34;...&#34;) ........ RAG-on-demand
       ├─ Tool call: searxng_web_search(&#34;...&#34;) . RAG-on-demand
       ├─ Tool call: Read(&#34;config.yaml&#34;) ....... Deterministic retrieval
       └─ Tool call: Edit(...) ................. Action
</code></pre><p>The agent loop is the outer shell. RAG calls happen <em>inside</em> the loop, on demand, whenever the agent decides it needs more grounding.</p>
<p>This matches what Pinterest engineers describe in their MCP rollout: the agent surfaces (chat, IDE, CLI) all talk to a common set of MCP servers, some of which are pure retrieval (Presto query, doc search) and some of which are actions (file a ticket, restart a job). The agent decides at runtime which to call.</p>
<hr>
<h2 id="production-case-study-pinterests-mcp-ecosystem">Production Case Study: Pinterest&rsquo;s MCP Ecosystem</h2>
<p>ByteByteGo&rsquo;s writeup of <a href="https://blog.bytebytego.com/p/how-pinterest-built-a-production">Pinterest&rsquo;s MCP rollout</a> is one of the few public production stories.</p>
<h3 id="the-nm-problem">The N×M Problem</h3>
<p>Pinterest engineers work across many systems daily — Presto for data, Spark for batch jobs, Airflow for workflows, internal docs, ticketing. They wanted AI agents that could reach into these systems directly.</p>
<p>The brute-force math:</p>
<pre tabindex="0"><code>5 agent surfaces × 10 internal tools = 50 bespoke integrations
</code></pre><p>Every new surface or new tool multiplied the work. Plus 50 auth flows, 50 token lifecycles, 50 sets of plumbing.</p>
<h3 id="the-mcp-bet">The MCP Bet</h3>
<p>The Model Context Protocol promised to flatten this:</p>
<pre tabindex="0"><code>5 clients + 10 servers = 15 standardized integrations
</code></pre><p>One protocol, used in both directions. Build a client per surface. Wrap each tool in a server. They all speak the same language.</p>
<h3 id="what-mcp-doesnt-solve">What MCP Doesn&rsquo;t Solve</h3>
<p>Pinterest&rsquo;s hard-won lesson: the protocol is the easy part. The real engineering went into the <em>surrounding</em> infrastructure:</p>
<table>
  <thead>
      <tr>
          <th>Concern</th>
          <th>Pinterest&rsquo;s Solution</th>
      </tr>
  </thead>
  <tbody>
      <tr>
          <td><strong>Discovery</strong></td>
          <td>Central registry of MCP servers — name, version, owner, endpoint</td>
      </tr>
      <tr>
          <td><strong>Auth (Layer 1)</strong></td>
          <td>Service identity — which agent runtime is making this call</td>
      </tr>
      <tr>
          <td><strong>Auth (Layer 2)</strong></td>
          <td>User identity — whose permissions is the agent acting under</td>
      </tr>
      <tr>
          <td><strong>Deployment</strong></td>
          <td>Unified CI/CD pipeline for all MCP servers</td>
      </tr>
      <tr>
          <td><strong>Observability</strong></td>
          <td>Tool-call metrics from day one — usage, latency, error rate</td>
      </tr>
  </tbody>
</table>
<p>The takeaway: <strong>the more capable your agents become, the more your permission and observability layers matter.</strong> A protocol that lets any agent call any tool is also a protocol that lets any compromised agent call any tool.</p>
<p>This is also why our smaller setup (3 MCP servers: <code>searxng</code>, <code>wiki-search</code>, <code>terra_llm_bridge</code>) puts hard <code>confirm=true</code> gates on destructive operations like banning players, restarting the world, or enabling hardmode. Three servers don&rsquo;t need a registry — but they do need authorization.</p>
<hr>
<h2 id="architecture-comparison-claude-code-vs-openclaw">Architecture Comparison: Claude Code vs OpenClaw</h2>
<p>Two of the most popular agent harnesses today take very different stances. ByteByteGo&rsquo;s <a href="https://blog.bytebytego.com/p/ep214-claude-code-vs-openclaw-5-design">EP214</a> breaks them down on five dimensions:</p>
<h3 id="1-system-scope">1. System Scope</h3>
<table>
  <thead>
      <tr>
          <th></th>
          <th>Claude Code</th>
          <th>OpenClaw</th>
      </tr>
  </thead>
  <tbody>
      <tr>
          <td>Lifetime</td>
          <td>Short-lived process</td>
          <td>Long-running daemon</td>
      </tr>
      <tr>
          <td>Trigger</td>
          <td>User runs CLI</td>
          <td>WebSocket from Discord/Slack/WhatsApp</td>
      </tr>
      <tr>
          <td>Exit</td>
          <td>After task complete</td>
          <td>Never</td>
      </tr>
  </tbody>
</table>
<p>Claude Code is a workhorse you summon. OpenClaw is a butler that&rsquo;s always listening.</p>
<h3 id="2-agent-runtime">2. Agent Runtime</h3>
<ul>
<li><strong>Claude Code</strong>: single async loop — <code>Think → Tool Call → Observe → Repeat</code>. One task at a time per process.</li>
<li><strong>OpenClaw</strong>: per-session queues. The Gateway demultiplexes incoming messages and dispatches them to separate runtime queues.</li>
</ul>
<h3 id="3-extension-model">3. Extension Model</h3>
<ul>
<li><strong>Claude Code</strong>: Four extension primitives, all hooking into the same agent loop:
<ul>
<li><strong>MCP</strong> (external tool servers)</li>
<li><strong>Plugins</strong> (bundled tool sets)</li>
<li><strong>Skills</strong> (named procedures the model can invoke)</li>
<li><strong>Hooks</strong> (event-driven shell commands)</li>
</ul>
</li>
<li><strong>OpenClaw</strong>: Manifest-first plugins. All plugins go through a central Registry before being made available to the Agent.</li>
</ul>
<h3 id="4-memory">4. Memory</h3>
<ul>
<li><strong>Claude Code</strong>: <code>CLAUDE.md</code> loaded into context at session start. Subdirectories have their own <code>CLAUDE.md</code> that gets appended when you <code>cd</code> into them.</li>
<li><strong>OpenClaw</strong>: <code>MEMORY.md</code> separated from daily notes. Hybrid vector + keyword search across structured sections.</li>
</ul>
<h3 id="5-multi-agent-topology">5. Multi-Agent Topology</h3>
<ul>
<li><strong>Claude Code</strong>: Lead → subagent pattern. Main agent delegates work to spawned subagents.</li>
<li><strong>OpenClaw</strong>: Route-and-delegate. Inbound channels route to dedicated agents that hand off to shared subagents.</li>
</ul>
<p>The deeper pattern: <strong>Claude Code optimizes for &ldquo;one session, one task.&rdquo;</strong> OpenClaw optimizes for &ldquo;many concurrent conversations, ambient presence.&rdquo; Both are correct for their respective use cases. Don&rsquo;t pick the wrong one for yours.</p>
<hr>
<h2 id="failure-modes-and-anti-patterns">Failure Modes and Anti-Patterns</h2>
<h3 id="rag-failure-modes">RAG Failure Modes</h3>
<p><strong>1. Retrieval misses the relevant chunk.</strong> Your embedding model thinks the question and the answer are semantically distant when they aren&rsquo;t. Mitigation: hybrid search (vector + keyword), reranking, query expansion.</p>
<p><strong>2. Retrieval returns too many irrelevant chunks.</strong> Context window fills with noise. Mitigation: stricter top-K, similarity threshold, post-retrieval filtering.</p>
<p><strong>3. The answer isn&rsquo;t actually in your corpus.</strong> RAG can&rsquo;t fabricate truth — if the knowledge isn&rsquo;t indexed, the model still doesn&rsquo;t know. Mitigation: a confidence check, or a fallback to web search.</p>
<p><strong>4. Chunking destroyed the structure.</strong> You split a markdown file mid-table, mid-code-block, mid-argument. Mitigation: structure-aware chunking (by heading, by paragraph, by semantic unit).</p>
<h3 id="agent-failure-modes">Agent Failure Modes</h3>
<p><strong>1. Reasoning drift.</strong> The agent gets stuck in a loop, repeatedly trying variations of the same failed approach. Mitigation: max-step limits, distinct-tool-call constraints, explicit &ldquo;what have I tried&rdquo; memory.</p>
<p><strong>2. Permission overreach.</strong> The agent does too much. It was asked to fix one test, it refactored half the file. Mitigation: explicit scope in the prompt, narrow tool permissions, human-in-the-loop for destructive ops.</p>
<p><strong>3. Tool-call cascade failure.</strong> A single bad tool call (e.g., a malformed path) gets followed by five reasoning steps trying to &ldquo;fix&rdquo; the symptom rather than the root cause. Mitigation: clear error messages from tools, &ldquo;try once then escalate&rdquo; tool design.</p>
<p><strong>4. Spending money on the wrong thing.</strong> A 20-step agent loop costs 20× a single LLM call. If RAG would have answered the question, you just paid 20× to get a worse answer. Mitigation: ask &ldquo;could this be a single retrieval?&rdquo; before going to agent mode.</p>
<h3 id="the-worst-anti-pattern-agent-when-rag-works">The Worst Anti-Pattern: Agent-When-RAG-Works</h3>
<p>The single most expensive mistake teams make: building an agent for a problem that&rsquo;s actually a search problem.</p>
<p>If your users are asking <em>&ldquo;where in the docs does it say…&rdquo;</em>, you don&rsquo;t need an agent. You need a search box wired to a vector index. Stop spending tokens on multi-step reasoning to find something a single retrieval call would surface.</p>
<hr>
<h2 id="what-this-means-for-builders">What This Means for Builders</h2>
<p>A practical checklist if you&rsquo;re starting a new AI feature:</p>
<ol>
<li><strong>Frame the problem as a verb.</strong> <em>&ldquo;Answer questions about X&rdquo;</em> → RAG. <em>&ldquo;Do X on behalf of the user&rdquo;</em> → agent.</li>
<li><strong>If you can answer it with one retrieval, do.</strong> Cheaper, faster, more predictable.</li>
<li><strong>If you go agent, design permissions on day one.</strong> Not day fifty. Pinterest&rsquo;s two-layer auth wasn&rsquo;t a feature — it was a survival requirement.</li>
<li><strong>Plan for hybrid.</strong> Real agents will need RAG-style retrieval inside their loop. Pick a protocol (MCP is the obvious default) and stick to it.</li>
<li><strong>Instrument everything.</strong> Tool call counts, retrieval hit rates, drift indicators. You can&rsquo;t tune what you can&rsquo;t see.</li>
<li><strong>Set a budget per task.</strong> Both in tokens and in iterations. Agents without budgets find creative ways to spend forever on the wrong thing.</li>
</ol>
<hr>
<h2 id="closing-thought">Closing Thought</h2>
<p>The RAG-versus-agent framing made sense in 2023, when these were two distinct paradigms competing for the same job. In 2026, they&rsquo;re complementary layers of the same system.</p>
<p>The interesting question isn&rsquo;t <em>which one to use</em>. It&rsquo;s <em>which slice of your problem belongs in which layer</em>. Get that division right and you ship something useful. Get it wrong and you&rsquo;ll spend a quarter rebuilding it.</p>
<p>For most teams shipping today, the answer looks like this:</p>
<pre tabindex="0"><code>                ┌───────────────────────────────┐
                │      Agent loop (outer)        │
                │   reasoning + tool selection   │
                └──────────┬────────────────────┘
                           │
        ┌──────────────────┼──────────────────┐
        │                  │                  │
        ▼                  ▼                  ▼
   RAG retrieval     Action tools       Computation
   (knowledge)       (mutate state)     (math, code)
</code></pre><p>Agent decides. RAG informs. Tools act. That&rsquo;s the whole stack.</p>
<hr>
<p><em>References</em></p>
<ul>
<li><em><a href="https://blog.bytebytego.com/p/ep216-rags-vs-agents">ByteByteGo EP216 — RAGs vs Agents</a></em></li>
<li><em><a href="https://blog.bytebytego.com/p/how-pinterest-built-a-production">ByteByteGo — How Pinterest Built a Production MCP Ecosystem</a></em></li>
<li><em><a href="https://blog.bytebytego.com/p/ep214-claude-code-vs-openclaw-5-design">ByteByteGo EP214 — Claude Code vs. OpenClaw: 5 Design Dimensions</a></em></li>
<li><em><a href="https://simonwillison.net/2026/May/19/5-minute-llms/">Simon Willison — The Last Six Months in LLMs in Five Minutes</a></em></li>
<li><em><a href="https://www.latent.space/p/ainews-all-model-labs-are-now-agent">Latent.Space — All Model Labs Are Now Agent Labs</a></em></li>
</ul>
]]></content:encoded>
    </item>
  </channel>
</rss>
