<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Architecture Design on ByF (BaiFan) · Daily Deep Think</title><link>https://blog.baifan.site/en/tags/architecture-design/</link><description>Recent content in Architecture Design on ByF (BaiFan) · Daily Deep Think</description><generator>Hugo -- gohugo.io</generator><language>en</language><managingEditor>blog@baifan.site (ByF (BaiFan))</managingEditor><webMaster>blog@baifan.site (ByF (BaiFan))</webMaster><copyright>CC BY-NC 4.0</copyright><lastBuildDate>Wed, 12 Aug 2026 14:55:05 +0800</lastBuildDate><atom:link href="https://blog.baifan.site/en/tags/architecture-design/index.xml" rel="self" type="application/rss+xml"/><item><title>Multi-Agent Collaboration: Value From Structure, Not Concurrency</title><link>https://blog.baifan.site/en/multi-agent-technical-core/</link><pubDate>Wed, 12 Aug 2026 14:33:59 +0800</pubDate><author>blog@baifan.site (ByF (BaiFan))</author><guid>https://blog.baifan.site/en/multi-agent-technical-core/</guid><description>&lt;p&gt;Conclusion first: the value of multi-agent doesn&amp;rsquo;t come from more models; it comes from the right structure. Multi-agent without structure is just more expensive concurrency — burn 2 to 3 times the tokens to watch a group of models nod at each other. Multi-agent with structure is an execution system that can delegate, parallelize, and verify.&lt;/p&gt;&#10;&lt;!-- more --&gt;&#10;&#10;&lt;h2 class="relative group"&gt;Why a Single Agent Fails at Long Tasks&#10; &lt;div id="why-a-single-agent-fails-at-long-tasks" class="anchor"&gt;&lt;/div&gt;&#10; &#10; &lt;span&#10; class="absolute top-0 w-6 transition-opacity opacity-0 -start-6 not-prose group-hover:opacity-100 select-none"&gt;&#10; &lt;a class="text-primary-300 dark:text-neutral-700 !no-underline" href="#why-a-single-agent-fails-at-long-tasks" aria-label="Anchor"&gt;#&lt;/a&gt;&#10; &lt;/span&gt;&#10; &#10;&lt;/h2&gt;&#10;&lt;p&gt;Diagnosis first. A single agent executing complex tasks has five structural defects — blame the execution structure, not the model&amp;rsquo;s intelligence:&lt;/p&gt;</description></item><item><title>3,000 vs 500K Lines: The Architectural Abyss From Toy to Product</title><link>https://blog.baifan.site/en/claude-code-3000-vs-500k-lines/</link><pubDate>Thu, 02 Jul 2026 09:00:00 +0800</pubDate><author>blog@baifan.site (ByF (BaiFan))</author><guid>https://blog.baifan.site/en/claude-code-3000-vs-500k-lines/</guid><description>&lt;!-- more --&gt;&#10;&lt;p&gt;The &lt;a href="https://github.com/saoudrizwan/claude-code-from-scratch" target="_blank" rel="noreferrer"&gt;claude-code-from-scratch&lt;/a&gt; project implements a &amp;ldquo;mini Claude Code&amp;rdquo; in roughly 3,000 lines of TypeScript. It has the Think-Act-Observe loop, a tool system, a system prompt, permission control, memory, Skills, multi-agent, MCP — every core concept we tore down over the previous ten posts.&lt;/p&gt;&#10;&lt;p&gt;And the official Claude Code source? Roughly 500K lines of TypeScript/TSX.&lt;/p&gt;&#10;&lt;p&gt;&lt;strong&gt;That&amp;rsquo;s a 100x+ gap between 3,000 lines and 500K.&lt;/strong&gt; What&amp;rsquo;s in it?&lt;/p&gt;&#10;&lt;p&gt;The gap isn&amp;rsquo;t &amp;ldquo;number of features&amp;rdquo;. from-scratch already covers every core concept. The gap is &lt;strong&gt;the road each concept travels from &amp;ldquo;it runs&amp;rdquo; to &amp;ldquo;it&amp;rsquo;s usable&amp;rdquo;&lt;/strong&gt; — that road is called productionization.&lt;/p&gt;</description></item><item><title>The Discrete State Machine of Plan Mode: Decision Tree Pruning, Backtracking Costs, and Diminishing Returns</title><link>https://blog.baifan.site/en/claude-code-plan-mode/</link><pubDate>Tue, 16 Jun 2026 09:00:00 +0800</pubDate><author>blog@baifan.site (ByF (BaiFan))</author><guid>https://blog.baifan.site/en/claude-code-plan-mode/</guid><description>&lt;p&gt;Autoregressive large language models operating in unconstrained environments suffer from an inherent tendency toward myopic mutation and runaway divergence. Claude Code&amp;rsquo;s Plan Mode attaches an external discrete Finite State Machine (FSM) that projects the action space onto a strictly side-effect-free subset, using an interactive human barrier to prune catastrophic physical backtracking branches from the decision tree.&lt;/p&gt;&#10;&lt;!-- more --&gt;&#10;&lt;p&gt;In disciplined software engineering, experienced developers instinctively value structural planning: mapping dependency graphs, deriving type signatures, and scoping blast radiuses before modifying a single line of code. Large language models possess no such innate restraint. Shaped by reinforcement learning to generate immediate answers, an agent granted unrestrained write permissions will instinctively mutate files without global context, precipitating an architectural cascade across complex repositories.&lt;/p&gt;</description></item><item><title>Multi-Agent Architecture: The Art of Fork-Join Collaboration</title><link>https://blog.baifan.site/en/claude-code-multi-agent-architecture/</link><pubDate>Tue, 09 Jun 2026 09:00:00 +0800</pubDate><author>blog@baifan.site (ByF (BaiFan))</author><guid>https://blog.baifan.site/en/claude-code-multi-agent-architecture/</guid><description>&lt;!-- more --&gt;&#10;&lt;p&gt;There&amp;rsquo;s a counterintuitive phenomenon: take the same model, split it into multiple independent instances, and have them collaborate — the result is often better than a single instance.&lt;/p&gt;&#10;&lt;p&gt;Not more compute (three instances burn more total tokens than one), not more capability (every instance is the same model). The gain comes from &lt;strong&gt;role separation&lt;/strong&gt; — when each agent attends to only one facet of the problem, it works with more focus and more depth than a &amp;ldquo;do-everything agent&amp;rdquo;.&lt;/p&gt;</description></item><item><title>Tools Are Capability: AI Agent Tool System Design Philosophy</title><link>https://blog.baifan.site/en/claude-code-tool-system-design/</link><pubDate>Tue, 12 May 2026 09:00:00 +0800</pubDate><author>blog@baifan.site (ByF (BaiFan))</author><guid>https://blog.baifan.site/en/claude-code-tool-system-design/</guid><description>&lt;!-- more --&gt;&#10;&lt;p&gt;Last time we talked about the Think-Act-Observe loop — the skeleton of an AI coding assistant. A skeleton can&amp;rsquo;t work on its own; it needs muscle. In Claude Code, that muscle is &lt;strong&gt;tools&lt;/strong&gt;.&lt;/p&gt;&#10;&lt;p&gt;Without tools, the loop loses the Act between Think and Observe and degenerates into plain Q&amp;amp;A. With tools, the model can touch the real world: read your code, change your configs, run your tests.&lt;/p&gt;</description></item><item><title>The Soul of an AI Coding Assistant: The Think-Act-Observe Loop</title><link>https://blog.baifan.site/en/claude-code-think-act-observe-loop/</link><pubDate>Thu, 07 May 2026 09:00:00 +0800</pubDate><author>blog@baifan.site (ByF (BaiFan))</author><guid>https://blog.baifan.site/en/claude-code-think-act-observe-loop/</guid><description>&lt;!-- more --&gt;&#10;&lt;p&gt;If you dig through the Claude Code source, you will discover a counterintuitive fact:&lt;/p&gt;&#10;&lt;p&gt;&lt;strong&gt;The core of the entire program is a while loop.&lt;/strong&gt;&lt;/p&gt;&#10;&lt;p&gt;Not a complex state machine, not an elaborate pipeline, not distributed coordination — just a plain &lt;code&gt;while&lt;/code&gt; loop that does three things over and over: let the model think, let the model act, feed the results back.&lt;/p&gt;&#10;&lt;div class="highlight-wrapper"&gt;&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;&#10;&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1&#10;&lt;/span&gt;&lt;span class="lnt"&gt;2&#10;&lt;/span&gt;&lt;span class="lnt"&gt;3&#10;&lt;/span&gt;&lt;span class="lnt"&gt;4&#10;&lt;/span&gt;&lt;span class="lnt"&gt;5&#10;&lt;/span&gt;&lt;span class="lnt"&gt;6&#10;&lt;/span&gt;&lt;span class="lnt"&gt;7&#10;&lt;/span&gt;&lt;span class="lnt"&gt;8&#10;&lt;/span&gt;&lt;span class="lnt"&gt;9&#10;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&#10;&lt;td class="lntd"&gt;&#10;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-text" data-lang="text"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;while (user hasn&amp;#39;t quit) {&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; thinking = callLLM(conversation history + tool definitions)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; if (thinking.wants to call a tool) {&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; result = executeTool(thinking.toolCall)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; conversationHistory.push(result)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; } else {&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; output(thinking.reply)&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; }&#10;&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;&#10;&lt;/div&gt;&#10;&lt;/div&gt;&lt;/div&gt;&#10;&lt;p&gt;That&amp;rsquo;s it? The entire secret of an AI coding assistant lives in this loop?&lt;/p&gt;</description></item></channel></rss>