<?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: Evan Lin</title>
    <description>The latest articles on DEV Community by Evan Lin (@evanlin).</description>
    <link>https://dev.to/evanlin</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%2F409957%2Fc150d4a7-cb20-469d-a230-bac27232c577.jpeg</url>
      <title>DEV Community: Evan Lin</title>
      <link>https://dev.to/evanlin</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/evanlin"/>
    <language>en</language>
    <item>
      <title>[Herdr Hands-on] Building Kalamos: A Typora-style macOS Markdown Editor in 3 Days with Claude Code as PM, Parallel Development,</title>
      <dc:creator>Evan Lin</dc:creator>
      <pubDate>Sun, 22 Nov 2026 00:29:16 +0000</pubDate>
      <link>https://dev.to/gde/herdr-hands-on-building-kalamos-a-typora-style-macos-markdown-editor-in-3-days-with-claude-code-9bn</link>
      <guid>https://dev.to/gde/herdr-hands-on-building-kalamos-a-typora-style-macos-markdown-editor-in-3-days-with-claude-code-9bn</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fewsvkw7u0trpf3fig3na.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fewsvkw7u0trpf3fig3na.png" alt="Kalamos Multi-Agent Collaborative Development Architecture: Human and Claude Code PM on the left, multiple independent Herdr worktree Panes on the right, GitHub Actions CI and release pipeline below" width="800" height="520"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Previously
&lt;/h1&gt;

&lt;p&gt;In the previous three Herdr practical articles (&lt;a href="https://dev.to/herdr-claude-code-agy-collab/"&gt;First time using Herdr&lt;/a&gt;, &lt;a href="https://dev.to/record2gif-macos-screen-to-gif/"&gt;Using two agy Panes for record2gif&lt;/a&gt;, &lt;a href="https://dev.to/herdr-review-queue-mod/"&gt;Writing my own Herdr mod: review-queue&lt;/a&gt;), I went from a single backend Code Review all the way to creating a macOS screen-to-GIF tool in one day, and even wrote a dedicated Herdr queue panel for my own workflow.&lt;/p&gt;

&lt;p&gt;After validating the rhythm of "Claude Code as PM on the left, multiple Panes writing code in parallel on the right," this time I wanted to take a &lt;strong&gt;real-world, high-complexity topic used daily&lt;/strong&gt; to stress-test this process:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Following a complete &lt;code&gt;docs/PRD.md&lt;/code&gt;, build a Typora-style, single-window What-You-See-Is-What-You-Mean (WYSIWYM) macOS Markdown editor.&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;I named it &lt;strong&gt;Kalamos&lt;/strong&gt; (Ancient Greek &lt;em&gt;κάλαμος&lt;/em&gt;, a reed pen used for writing on papyrus)—the interface is like a quiet piece of paper, hiding Markdown syntax symbols when the cursor leaves. It is completely free, offline, requires no account, has no telemetry, and saves as clean standard GFM.&lt;/p&gt;

&lt;p&gt;As a result, from starting work on 2026-11-19 to 2026-11-21, I completed &lt;strong&gt;all M1–M3 milestones&lt;/strong&gt; within three days, accumulating &lt;strong&gt;33 Issues and 38 merged PRs&lt;/strong&gt;. I went from the project skeleton all the way to MIT open source, launched a four-language product page, and officially released &lt;strong&gt;&lt;code&gt;v0.1.1&lt;/code&gt;&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;The results first:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;GitHub Repo: &lt;a href="https://github.com/kkdai/Kalamos" rel="noopener noreferrer"&gt;kkdai/Kalamos&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Four-language Product Page: &lt;a href="https://kkdai.github.io/Kalamos/" rel="noopener noreferrer"&gt;kkdai.github.io/Kalamos&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Official Release Download: &lt;a href="https://github.com/kkdai/Kalamos/releases/tag/v0.1.1" rel="noopener noreferrer"&gt;Release v0.1.1&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F9kbxue1mtw9vezimn8fn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F9kbxue1mtw9vezimn8fn.png" alt="Kalamos Traditional Chinese Real-time Preview (Papyros Papyrus Light Theme)" width="800" height="583"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h1&gt;
  
  
  I. What did Kalamos do? Tech Stack and M1–M3 Milestones
&lt;/h1&gt;

&lt;p&gt;Before starting, I defined the tech stack, keeping the principles consistent with the PRD: &lt;strong&gt;Local-first, standard GFM, CJK-friendly, and fully offline.&lt;/strong&gt;&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Layer&lt;/th&gt;
&lt;th&gt;Tech Stack&lt;/th&gt;
&lt;th&gt;Description&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Desktop Framework&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Tauri 2 (Rust)&lt;/td&gt;
&lt;td&gt;Lightweight macOS native shell, file system monitoring, secure saving, native PDFKit export&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Frontend Core&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Vite + TypeScript&lt;/td&gt;
&lt;td&gt;Fast builds, combined with in-memory IPC mock for running dev and E2E directly in the browser&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Editing Engine&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;CodeMirror 6 + &lt;code&gt;@lezer/markdown&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;GFM base with custom math, CJK emphasis, front matter, and footnote syntax extensions&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Math &amp;amp; Diagrams&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;MathJax 3 + Mermaid (&lt;code&gt;strict&lt;/code&gt; + DOMPurify)&lt;/td&gt;
&lt;td&gt;Fully offline SVG rendering; supports &lt;code&gt;flow&lt;/code&gt; and &lt;code&gt;sequence&lt;/code&gt; in addition to Mermaid&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Other Components&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;gemoji&lt;/code&gt; + Pandoc (Optional)&lt;/td&gt;
&lt;td&gt;Offline &lt;code&gt;:emoji&lt;/code&gt; autocomplete; supports exporting/importing DOCX / EPUB / LaTeX if Pandoc is installed&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Following the priorities in &lt;code&gt;docs/PRD.md&lt;/code&gt;, the entire product was pushed through three milestones, eventually completing M1–M3:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Milestone&lt;/th&gt;
&lt;th&gt;Covered Features&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;M1 (Core Editing)&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Single-window real-time preview and source code mode (&lt;code&gt;Cmd+/&lt;/code&gt;), lists and checkable task lists, links and heading bookmarks, GFM visual tables, 100+ language code blocks, offline MathJax formulas, inline image display and drag-and-drop paste, sidebar (file tree / file list / outline), Papyros / Melan themes and custom CSS, atomic saving (temp + rename) and crash recovery&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;M2 (Delivery)&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Native PDF export (including nested heading bookmarks, math, and diagram rendering), Pandoc multi-format export and import (DOCX / ODT / LaTeX / MediaWiki / EPUB), Mermaid / flowchart / sequence diagrams, image resizing and static blog root directory, YAML Front Matter / footnotes / &lt;code&gt;[TOC]&lt;/code&gt;, Ataraxia focus mode (&lt;code&gt;F8&lt;/code&gt;) and Stichos typewriter mode (&lt;code&gt;F9&lt;/code&gt;), word count and selection statistics&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;M3 (Optimization)&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Offline Emoji autocomplete, auto-pairing for CJK brackets and Markdown symbols, custom CLI image uploader (restricted to config file for security)&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fvwop3exqzi9mk7611djb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fvwop3exqzi9mk7611djb.png" alt="Offline real-time rendering of MathJax formulas and Mermaid flowcharts" width="800" height="583"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F6r83pscg6hgl4m5awh01.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F6r83pscg6hgl4m5awh01.png" alt="Melan Dark Theme and Custom CSS Variable Example" width="800" height="583"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h1&gt;
  
  
  II. Multi-Agent Collaboration Mode: PM, Dual Worktrees, and "Seamless Switching when Quota is Exhausted"
&lt;/h1&gt;

&lt;p&gt;The collaboration architecture this time followed the methods polished in previous articles but with stricter discipline, incorporating my own &lt;code&gt;/herdr-pm&lt;/code&gt; and &lt;code&gt;/herdr-coder&lt;/code&gt; skills:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Left is Claude Code (PM / Reviewer)&lt;/strong&gt;: Reads PRD, breaks down Issues, defines interface contracts, reviews diffs, adds tests, runs validation. &lt;strong&gt;Only the PM touches git&lt;/strong&gt; (create branch → commit → open PR → wait for CI → squash merge).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Right has two coder Panes in Herdr (&lt;code&gt;kalamos-a&lt;/code&gt;, &lt;code&gt;kalamos-b&lt;/code&gt;)&lt;/strong&gt;: Each is bound to an independent git worktree (&lt;code&gt;Kalamos.wt/a&lt;/code&gt;, &lt;code&gt;Kalamos.wt/b&lt;/code&gt;). Files are completely isolated, using &lt;code&gt;hc send&lt;/code&gt; / &lt;code&gt;hc wait&lt;/code&gt; for asynchronous task assignment and reporting.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Added a hygiene rule&lt;/strong&gt;: This time I specifically required the PM to "&lt;strong&gt;Close the Pane once the work is done&lt;/strong&gt;." After each task is merged into &lt;code&gt;main&lt;/code&gt;, the PM executes &lt;code&gt;hc kill&lt;/code&gt; + &lt;code&gt;hc rm&lt;/code&gt; to clear the corresponding Pane, preventing the screen from becoming cluttered.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Practical Episode: What to do when the agy quota runs out?
&lt;/h2&gt;

&lt;p&gt;When developing a large project halfway, a realistic problem is bound to occur: initially, both coder Panes were running &lt;strong&gt;agy (Gemini)&lt;/strong&gt;. After several rounds of major features, an &lt;strong&gt;&lt;code&gt;Individual quota reached&lt;/code&gt;&lt;/strong&gt; error popped up.&lt;/p&gt;

&lt;p&gt;In a traditional single-tool workflow, you'd probably have to stop and wait for the quota to recover or restart the entire conversation context. But in Herdr, because the &lt;strong&gt;worktree is still there, the Issue specs are still there, and the PM's grasp of progress is still there&lt;/strong&gt;, the PM simply replaced the exhausted coder with &lt;strong&gt;Claude Code (&lt;code&gt;claude --permission-mode auto&lt;/code&gt;)&lt;/strong&gt; in the same worktree to take over. The entire development pipeline continued without interruption.&lt;/p&gt;

&lt;p&gt;This again validates the advantage of the &lt;strong&gt;TTT (Terminal Text Tool, AI Terminal Editor) pipeline&lt;/strong&gt; discussed in the &lt;a href="https://dev.to/herdr-claude-code-agy-collab/"&gt;first article&lt;/a&gt;: &lt;strong&gt;Agents are swappable execution units; the process and state remain in the worktree, Issues, and the PM's hands.&lt;/strong&gt;&lt;/p&gt;




&lt;h1&gt;
  
  
  III. The First Batch of "Landmines" Caught During User Testing (#49, #54, #56)
&lt;/h1&gt;

&lt;p&gt;Just like with record2gif, after all features were done and unit tests were green, the real test was "me personally opening it to type a few words." Typing immediately caught three critical issues:&lt;/p&gt;

&lt;h2&gt;
  
  
  1. WYSIWYM was "not Typora-like enough" (#49, #54)
&lt;/h2&gt;

&lt;p&gt;When I tried typing, I immediately complained: "A WYSIWYG editor should show Markdown effects directly. For example, &lt;code&gt;-&lt;/code&gt; should immediately display as a list, and &lt;code&gt;*test*&lt;/code&gt; should immediately become italic!"&lt;/p&gt;

&lt;p&gt;The original implementation was too conservative; as long as the cursor was on a line, the syntax markers for the entire line were exposed. It felt similar to a dual-pane editor. After receiving the report, the PM &lt;strong&gt;didn't rush to create Issues based on imagination, but first used a Playwright script with a real keyboard to type and capture screenshots to reproduce the behavior&lt;/strong&gt;. After confirming the exact behavior, it was split into two P0 Issues:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;#49 (Block Markers)&lt;/strong&gt;: &lt;code&gt;-&lt;/code&gt;, &lt;code&gt;1.&lt;/code&gt;, &lt;code&gt;- []&lt;/code&gt;, &lt;code&gt;##&lt;/code&gt;, &lt;code&gt;&amp;gt;&lt;/code&gt; render into lists/headings/quotes immediately after typing a space. &lt;strong&gt;The source code is only exposed if the cursor is actually on the marker itself&lt;/strong&gt;; pressing Enter on an empty list item or Backspace after a marker naturally exits the list or quote.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;#54 (Inline Markers)&lt;/strong&gt;: &lt;code&gt;*italic*&lt;/code&gt;, &lt;code&gt;**bold**&lt;/code&gt;, &lt;code&gt;code&lt;/code&gt; render and hide symbols the moment the closing character is typed. &lt;strong&gt;The source code only expands if the cursor is strictly inside the span&lt;/strong&gt;; pressing Backspace behind a rendered span &lt;strong&gt;expands the syntax first before deleting&lt;/strong&gt;, fully restoring the Typora feel.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  2. Occasional CI Error: &lt;code&gt;RangeError&lt;/code&gt; after IME Composition (#56)
&lt;/h2&gt;

&lt;p&gt;Before and after adding GitHub Actions CI (#53), tests occasionally threw a tricky error:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;RangeError: Position 55 is out of range for changeset of length 53
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Tracing into the &lt;code&gt;mapPos&lt;/code&gt; in &lt;code&gt;blocks.ts&lt;/code&gt; revealed the root cause: in the &lt;code&gt;StateField&lt;/code&gt; handling for footnotes, diagrams, and math, the &lt;strong&gt;IME composition branch was directly copying the old &lt;code&gt;parsedTo&lt;/code&gt; instead of applying &lt;code&gt;changes.mapPos&lt;/code&gt; to it&lt;/strong&gt;. If the input method composition shortened the document length, the old position would exceed the end of the document, causing the next transaction's &lt;code&gt;mapPos&lt;/code&gt; to explode.&lt;/p&gt;

&lt;p&gt;The fix was solid: besides adding correct mapping to all three composition branches, I extracted &lt;code&gt;src/editor/positions.ts&lt;/code&gt; so that all stored positions in the project follow the same protection layer:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;clampPos&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;pos&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;number&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;length&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;number&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;number&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="nb"&gt;Number&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;isFinite&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;pos&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="n"&gt;pos&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;pos&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;length&lt;/span&gt; &lt;span class="o"&gt;?&lt;/span&gt; &lt;span class="n"&gt;length&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;pos&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;mapPosClamped&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;changes&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;ChangeDesc&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;pos&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;number&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;assoc&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;number&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nf"&gt;clampPos&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;changes&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;mapPos&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;clampPos&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;pos&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;changes&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;length&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;assoc&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;changes&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;newLength&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Furthermore, the PM required the coder to &lt;strong&gt;first write a regression test that failed on the old code&lt;/strong&gt; (3 cases each for vitest and e2e, then repeated with Playwright &lt;code&gt;--repeat-each 20&lt;/code&gt;) to confirm the fix was green before allowing the merge.&lt;/p&gt;




&lt;h1&gt;
  
  
  IV. The Big Projects: The Reed Pen Icon and Splitting "Table WYSIWYM" into Parallel Halves
&lt;/h1&gt;

&lt;p&gt;Once the core experience was stable, I threw in two requirements I cared about most: one was the "face" of the app (App Icon), and the other was the "final boss" of Markdown editors (Visual Tables).&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Hand-written SVG Reed Pen App Icon (#58)
&lt;/h2&gt;

&lt;p&gt;I wanted a beige-toned reed pen icon echoing the name Kalamos. Instead of installing extra image conversion packages, I had the coder follow a clean pipeline:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Directly write a vector SVG: beige squircle base, diagonally placed bamboo pen barrel, slanted nib, and a drop of ink from the tip.&lt;/li&gt;
&lt;li&gt;Use the project's existing Playwright Chromium (&lt;code&gt;scripts/render-icon.mjs&lt;/code&gt;) to render the SVG into a 1024×1024 transparent PNG.&lt;/li&gt;
&lt;li&gt;Run &lt;code&gt;npx tauri icon&lt;/code&gt; to produce the macOS &lt;code&gt;.icns&lt;/code&gt; and all sizes at once.&lt;/li&gt;
&lt;li&gt;The PM personally reviewed the 32px (Dock/small icon recognizability) and 512px previews before merging.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fmgkxicdx4k32dqp8lr4f.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fmgkxicdx4k32dqp8lr4f.png" alt="Kalamos Reed Pen App Icon (beige squircle, diagonal bamboo barrel, and a drop of ink)" width="512" height="512"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Table WYSIWYM (#59, P0): Design Assessment First, then Split into A/B Parallel Development
&lt;/h2&gt;

&lt;p&gt;The original tables (#7) could render into HTML tables, but as soon as the mouse clicked in, the entire table reverted to &lt;code&gt;| a | b |&lt;/code&gt; plain text source code, which was very jarring.&lt;/p&gt;

&lt;p&gt;This requirement was large, so the PM split it into two sub-tasks with clear boundaries, assigned to &lt;code&gt;kalamos-a&lt;/code&gt; and &lt;code&gt;kalamos-b&lt;/code&gt; in parallel:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Part&lt;/th&gt;
&lt;th&gt;Responsible Pane&lt;/th&gt;
&lt;th&gt;Content and Contract&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Part A (#61)&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;kalamos-b&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Direct in-cell editing, &lt;code&gt;updateDOM&lt;/code&gt; in-place updates, IME-safe write-back, keyboard navigation; &lt;strong&gt;Exports &lt;code&gt;getActiveTableCell&lt;/code&gt; / &lt;code&gt;focusTableCell&lt;/code&gt;&lt;/strong&gt; for Part B to call&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Part B (#62)&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;kalamos-a&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;Cmd+Opt+T&lt;/code&gt; insert dialog (with grid picker), `&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h3&gt;
  
  
  Part A: Let the coder assess the technical solution before starting
&lt;/h3&gt;

&lt;p&gt;I particularly liked one action by the PM: before writing the first line of code in {% raw %}&lt;code&gt;kalamos-b&lt;/code&gt;, it was asked to evaluate: "&lt;strong&gt;Should in-cell editing use &lt;code&gt;contenteditable&lt;/code&gt; spans or a nested CodeMirror &lt;code&gt;EditorView&lt;/code&gt; for each cell?&lt;/strong&gt;"&lt;/p&gt;

&lt;p&gt;The coder eventually chose &lt;strong&gt;&lt;code&gt;contenteditable&lt;/code&gt; spans&lt;/strong&gt; for very clear reasons:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;CodeMirror automatically ignores DOM mutations inside widgets, preventing interference.&lt;/li&gt;
&lt;li&gt;Native browser &lt;code&gt;contenteditable&lt;/code&gt; makes CJK IME composition incredibly smooth; text is only written back to the underlying Markdown on &lt;code&gt;compositionend&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;All editing and structural operations go directly through the main editor's history, &lt;strong&gt;integrating Undo/Redo naturally&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;A 10×5 table would require 50 nested &lt;code&gt;EditorView&lt;/code&gt; instances, which is too heavy for performance and memory.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Combined with &lt;code&gt;updateDOM&lt;/code&gt; for in-place updates of non-focused cells, the entire table doesn't rebuild while typing, focus doesn't jump, and escapes for &lt;code&gt;|&lt;/code&gt; ↔ &lt;code&gt;\|&lt;/code&gt; and newlines ↔ &lt;code&gt;&amp;lt;br&amp;gt;&lt;/code&gt; are handled correctly.&lt;/p&gt;

&lt;h3&gt;
  
  
  Part B: Pure function structural operations and shortcut conflicts caught by E2E
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;kalamos-a&lt;/code&gt; wrote all column/row insertion/deletion, alignment, and table deletion as &lt;code&gt;table-ops.ts&lt;/code&gt; pure functions. Each operation is a single transaction (&lt;strong&gt;one &lt;code&gt;Cmd+Z&lt;/code&gt; reverts the whole step&lt;/strong&gt;). When writing back, it even calculates CJK full-width characters to auto-align the Markdown pipes.&lt;/p&gt;

&lt;p&gt;A real-world episode occurred during development: the alignment shortcuts were initially set to &lt;code&gt;Cmd+Opt+Shift+L / C / R&lt;/code&gt;. It turned out &lt;code&gt;Cmd+Opt+Shift+R&lt;/code&gt; conflicted with the previously made "Clear Image Root" shortcut. Fortunately, the existing Playwright E2E tests caught this conflict immediately, and it was changed to the intuitive &lt;code&gt;Cmd+Opt+Shift+← / ↑ / →&lt;/code&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Three "Devils in the Details" caught during Review
&lt;/h3&gt;

&lt;p&gt;The two PRs for tables (#61, #62) caught three issues during the Review phase that are classic examples of "things you wouldn't think of just looking at specs, but only expose during testing":&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Typing &lt;code&gt;&amp;lt;br&amp;gt;&lt;/code&gt; literally in a cell became a newline&lt;/strong&gt;: The PM wrote a round-trip test and found that if someone wanted to write the instructional text "&lt;code&gt;&amp;lt;br&amp;gt;&lt;/code&gt; tag" in a table, it actually broke the line when saved and reloaded! This was fixed so literal &lt;code&gt;&amp;lt;br&amp;gt;&lt;/code&gt; is saved as &lt;code&gt;&amp;amp;lt;br&amp;gt;&lt;/code&gt;. A boundary condition where "an odd number of &lt;code&gt;\&lt;/code&gt; at the end of a cell escapes the pipe &lt;code&gt;|&lt;/code&gt;" was also fixed by adding a space.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Row drag handles pushed the first column out of alignment&lt;/strong&gt;: Originally, the row drag handle took up layout width, causing the first column's content to be indented relative to the header. This was changed to absolute positioning, appearing only on mouse hover, making the table's vertical alignment instantly clean.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Floating toolbar covered the heading above the table&lt;/strong&gt;: When clicking into a table, the toolbar floating above it pressed directly against the previous line's heading. The fix was to dynamically reserve &lt;strong&gt;38px&lt;/strong&gt; of space above the table when active and synchronize &lt;strong&gt;scroll compensation&lt;/strong&gt; to prevent the screen from jumping or the active cell from shifting.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fg3s6h1ab8oqxrgiol3zw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fg3s6h1ab8oqxrgiol3zw.png" alt="Kalamos Visual Table Editing: Direct in-cell editing, floating toolbar that doesn't block text, and auto-alignment" width="800" height="583"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;By the time the tables were merged, the project had accumulated &lt;strong&gt;353 vitest and 137 e2e tests&lt;/strong&gt;, and the input latency for a 10,000-line benchmark &lt;strong&gt;p95 was 17–18 ms&lt;/strong&gt;, well below the 50 ms budget set in the PRD.&lt;/p&gt;




&lt;h1&gt;
  
  
  V. Doc Writer Online, Catching a CSS Bug via Screenshots (#63), and "Why Not Open Another Writer?"
&lt;/h1&gt;

&lt;p&gt;With the features complete, it was time to prepare the "face" of the product: I opened an independent &lt;strong&gt;&lt;code&gt;doc-writer&lt;/code&gt; Pane&lt;/strong&gt; (running &lt;strong&gt;agy + Gemini 4 Neon&lt;/strong&gt;, attached to the &lt;code&gt;Kalamos.wt/docs&lt;/code&gt; worktree) and assigned four tasks:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Rewrite the four-language README (English, Traditional Chinese, Japanese, Korean).&lt;/li&gt;
&lt;li&gt;Create the four-language static product page &lt;code&gt;site/&lt;/code&gt; (referencing Typora's whitespace and large screenshot rhythm, but with original text, colors, layout, and images).&lt;/li&gt;
&lt;li&gt;Write a Playwright IPC mock script to capture screenshots directly from the rendered App.&lt;/li&gt;
&lt;li&gt;Add a GitHub Pages deployment workflow.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The PM reviewed two rounds and caught several flaws hidden in the details:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The feature and shortcut tables in the README were cross-checked against the code one by one.&lt;/li&gt;
&lt;li&gt;In the HTML source code, newlines in the middle of Chinese sentences for layout caused &lt;strong&gt;an extra half-width space after CJK full-width punctuation&lt;/strong&gt; in the browser; these were all cleaned up.&lt;/li&gt;
&lt;li&gt;The GitHub Pages workflow added &lt;code&gt;paths&lt;/code&gt; filtering to avoid redeploying the site every time the Rust code changed.&lt;/li&gt;
&lt;li&gt;The hero screenshot on the homepage was changed to four versions (EN/ZH/JA/KO), so even the demo article in the screenshot changes with the language.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Unexpected Gain: Catching an App Layout Bug via Screenshots (#63)
&lt;/h2&gt;

&lt;p&gt;The most interesting part was when &lt;code&gt;doc-writer&lt;/code&gt; used Playwright to capture the first batch of App screenshots—I immediately saw something wrong: &lt;strong&gt;the text in the editing area was flush against the left edge of the window, and the sidebar covered the text when opened!&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;But &lt;code&gt;editor.css&lt;/code&gt; clearly had &lt;code&gt;.cm-content { margin: 0 auto; }&lt;/code&gt;? Checking the DOM solved the mystery:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;CodeMirror 6's base theme dynamically injects &lt;code&gt;.ͼ1 .cm-content { margin: 0; padding: 4px 0; }&lt;/code&gt; (CSS specificity &lt;strong&gt;&lt;code&gt;0,2,0&lt;/code&gt;&lt;/strong&gt;), and it injects later than our own stylesheet, overriding our &lt;code&gt;.cm-content&lt;/code&gt; which only had &lt;code&gt;0,1,0&lt;/code&gt;!&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The solution was clean: instead of using the ugly &lt;code&gt;!important&lt;/code&gt;, I increased the selector specificity to &lt;strong&gt;&lt;code&gt;0,3,0&lt;/code&gt;&lt;/strong&gt; and ensured that when the sidebar is open, its width is subtracted from the outer container, allowing the paper column to center automatically in the remaining space:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="cm"&gt;/* .ͼ1 .cm-content (0,2,0) injected later overrides simple .cm-content */&lt;/span&gt;
&lt;span class="cm"&gt;/* Use 0,3,0 to beat CodeMirror base theme without !important */&lt;/span&gt;
&lt;span class="nc"&gt;.cm-editor&lt;/span&gt; &lt;span class="nc"&gt;.cm-scroller&lt;/span&gt; &lt;span class="nc"&gt;.cm-content&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="kt"&gt;%&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;max-width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nf"&gt;var&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;--k-max-width&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;720px&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;margin&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="n"&gt;auto&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;padding-block&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;56px&lt;/span&gt; &lt;span class="mi"&gt;120px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;padding-inline&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nf"&gt;var&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nv"&gt;--k-content-padding-x&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;32px&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After PR #64 fixed this bug and added &lt;code&gt;center-content.spec.ts&lt;/code&gt;, &lt;code&gt;doc-writer&lt;/code&gt; re-captured all 9 images, and the interface immediately gained the "quiet piece of paper" vibe.&lt;/p&gt;

&lt;h2&gt;
  
  
  Management Decision: Should I open another Writer to share the load?
&lt;/h2&gt;

&lt;p&gt;Writing four-language documentation and the product page took some time. Halfway through, I asked the PM: "Should we open a second writer to share the load?"&lt;/p&gt;

&lt;p&gt;After assessment, the PM decisively said &lt;strong&gt;no&lt;/strong&gt;, for very practical reasons:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;The work was entering the final stages.&lt;/li&gt;
&lt;li&gt;Two writers modifying the same set of README and &lt;code&gt;site/&lt;/code&gt; files simultaneously would only create massive merge conflicts.&lt;/li&gt;
&lt;li&gt;A new writer would have to re-read the entire codebase; the cost of re-familiarization was higher than just letting the original one finish.&lt;/li&gt;
&lt;li&gt;The tone and terminology across the four languages would become inconsistent.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Multi-Agent collaboration isn't "the more Panes, the better." &lt;strong&gt;Parallelize only when you can cut clean interface boundaries (like Table Part A/B); highly coupled finishing work is faster with a single dedicated Agent.&lt;/strong&gt;&lt;/p&gt;




&lt;h1&gt;
  
  
  VI. Pitfalls: PM Errors, Open Source Checks, macOS Signing, and Final Bugs Caught Writing Blogs
&lt;/h1&gt;

&lt;p&gt;Entering the open-source and official packaging phase, a series of pitfalls emerged that you "absolutely won't encounter unless you walk the last mile."&lt;/p&gt;

&lt;h2&gt;
  
  
  Pitfall 1: PM's own error—&lt;code&gt;gh pr checks --watch&lt;/code&gt; disconnection fooled the merge gate
&lt;/h2&gt;

&lt;p&gt;When merging Table Part A (#61), the PM followed the habit of using &lt;code&gt;gh pr checks --watch&lt;/code&gt; to wait for GitHub Actions. Mid-way, a network &lt;code&gt;connection reset&lt;/code&gt; occurred. &lt;code&gt;--watch&lt;/code&gt; terminated early, and the PM didn't notice the CI was still running and clicked merge!&lt;/p&gt;

&lt;p&gt;Although the &lt;code&gt;main&lt;/code&gt; CI was green afterward and no disaster occurred, this was a process loophole. The PM changed habits on the spot: &lt;strong&gt;Never trust the exit code of &lt;code&gt;--watch&lt;/code&gt; again; instead, use a loop with &lt;code&gt;gh run view&lt;/code&gt; to explicitly check that &lt;code&gt;status == completed&lt;/code&gt; and the conclusion is &lt;code&gt;success&lt;/code&gt; before allowing a merge.&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Pitfall 2: Transitioning from Private to Public Open Source and GitHub Pages
&lt;/h2&gt;

&lt;p&gt;The repo was originally private. When preparing for GitHub Pages, we hit a GitHub free plan limit: private repos can't have Pages. The PM listed three options:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Make the original repo public.&lt;/li&gt;
&lt;li&gt;Create a separate public repo just for the product page.&lt;/li&gt;
&lt;li&gt;Upgrade to GitHub Pro.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;I chose to make the repo public. Before doing so, the PM scanned the entire git history (all 67 commits across branches):&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Confirmed no API tokens, keys, or certificates.&lt;/li&gt;
&lt;li&gt;Verified that test paths were fictional and didn't leak local environment info.&lt;/li&gt;
&lt;li&gt;The only thing I had to approve was that the &lt;strong&gt;commit author email would be public along with the history&lt;/strong&gt;. I confirmed it was fine, made it public, added the MIT License (#66), and deployed the four-language product page via GitHub Actions.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Pitfall 3: v0.1.0 → v0.1.1 and the macOS ad-hoc signature "Damaged" crisis
&lt;/h2&gt;

&lt;p&gt;The first time I installed the packaged &lt;code&gt;Kalamos.app&lt;/code&gt; into &lt;code&gt;/Applications&lt;/code&gt;, running &lt;code&gt;codesign -v&lt;/code&gt; immediately threw an error:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;code has no resources but signature indicates they must be present
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;With such an incomplete ad-hoc signature, when others download the &lt;code&gt;.dmg&lt;/code&gt;, macOS might jump straight to "The application is damaged and cannot be opened," not even allowing a right-click to open. Therefore, before releasing the &lt;strong&gt;&lt;code&gt;v0.1.0&lt;/code&gt; pre-release&lt;/strong&gt;, I added re-signing and re-packaging the &lt;code&gt;.dmg&lt;/code&gt; to the release process:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;codesign --force --deep -s - Kalamos.app
&lt;span class="c"&gt;# Then use hdiutil to repackage into .dmg&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When fixing #67 and #69 for the &lt;strong&gt;&lt;code&gt;v0.1.1&lt;/code&gt;&lt;/strong&gt; release, I used the same re-signing process. After confirming it worked, I deleted the old &lt;code&gt;v0.1.0&lt;/code&gt; pre-release and set &lt;code&gt;v0.1.1&lt;/code&gt; as the Latest.&lt;/p&gt;

&lt;h2&gt;
  
  
  Pitfall 4: When opening an &lt;code&gt;.md&lt;/code&gt; from Finder, Kalamos was greyed out (#67)
&lt;/h2&gt;

&lt;p&gt;After dragging the app into &lt;code&gt;/Applications&lt;/code&gt;, I tried right-clicking an &lt;code&gt;.md&lt;/code&gt; file in Finder and selecting "Open With," but &lt;strong&gt;Kalamos was greyed out and unselectable&lt;/strong&gt;!&lt;/p&gt;

&lt;p&gt;There were two reasons:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;code&gt;tauri.conf.json&lt;/code&gt; didn't have &lt;code&gt;fileAssociations&lt;/code&gt; set, so the packaged &lt;code&gt;Info.plist&lt;/code&gt; lacked &lt;code&gt;CFBundleDocumentTypes&lt;/code&gt; and the Markdown UTI declaration. macOS didn't know it could open &lt;code&gt;.md&lt;/code&gt; files.&lt;/li&gt;
&lt;li&gt;Even if selectable, the Rust side hadn't handled the macOS &lt;code&gt;RunEvent::Opened&lt;/code&gt; event, so double-clicking from Finder or cold-starting would result in nothing happening.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;PR #68 fixed both: registered seven extensions (&lt;code&gt;md&lt;/code&gt;, &lt;code&gt;markdown&lt;/code&gt;, &lt;code&gt;mdown&lt;/code&gt;, &lt;code&gt;mkd&lt;/code&gt;, &lt;code&gt;mkdn&lt;/code&gt;, &lt;code&gt;mdwn&lt;/code&gt;, &lt;code&gt;mdtxt&lt;/code&gt;) and the imported UTI &lt;code&gt;net.daringfireball.markdown&lt;/code&gt;. When Rust receives an open event, if the frontend isn't initialized, it queues the event and processes it once the frontend is ready. Cold-starting with &lt;code&gt;open -a Kalamos file.md&lt;/code&gt; was verified to work.&lt;/p&gt;

&lt;h2&gt;
  
  
  Pitfall 5: Using Kalamos to open "this blog" immediately caught broken &lt;code&gt;../images/&lt;/code&gt; (#69)
&lt;/h2&gt;

&lt;p&gt;The final bug felt particularly karmic. I finally used Kalamos to open the &lt;strong&gt;previous post on this blog&lt;/strong&gt; (&lt;code&gt;_posts/2026-11-15-herdr-review-queue-mod.md&lt;/code&gt;), and all &lt;code&gt;../images/xxx.png&lt;/code&gt; images showed "&lt;strong&gt;Failed to load image&lt;/strong&gt;"!&lt;/p&gt;

&lt;p&gt;The reason was that Tauri's &lt;code&gt;asset&lt;/code&gt; protocol scope, for security, only allowed the folder where the document is located (i.e., &lt;code&gt;_posts/&lt;/code&gt;). Jekyll blogs typically put posts in &lt;code&gt;_posts/&lt;/code&gt; and images in a parallel &lt;code&gt;images/&lt;/code&gt; folder. The path &lt;code&gt;../images/&lt;/code&gt; was blocked.&lt;/p&gt;

&lt;p&gt;But the fix couldn't be lazy by "allowing the entire parent folder" (if a user opens a file in their home directory, it exposes the whole folder to the WebView). PR #70 took a restrained approach:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Added an &lt;code&gt;allow_asset_file&lt;/code&gt; command in Rust: uses &lt;code&gt;fs::canonicalize&lt;/code&gt; to resolve &lt;code&gt;..&lt;/code&gt; and symlinks, confirms it's a real file, and checks if the extension is in the image whitelist.&lt;/li&gt;
&lt;li&gt;After passing checks, &lt;strong&gt;only that specific image file is added to the &lt;code&gt;asset_protocol_scope&lt;/code&gt;&lt;/strong&gt;, never the entire parent folder.&lt;/li&gt;
&lt;li&gt;Before the frontend loads a local image not in the document directory, it calls &lt;code&gt;allow_asset_file&lt;/code&gt; (with caching and a retry on failure).
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight rust"&gt;&lt;code&gt;&lt;span class="cp"&gt;#[tauri::command]&lt;/span&gt;
&lt;span class="k"&gt;pub&lt;/span&gt; &lt;span class="k"&gt;fn&lt;/span&gt; &lt;span class="nf"&gt;allow_asset_file&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;app&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;tauri&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nc"&gt;AppHandle&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kt"&gt;String&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="kt"&gt;Result&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;AppError&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;use&lt;/span&gt; &lt;span class="n"&gt;tauri&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nc"&gt;Manager&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="n"&gt;requested&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Path&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;new&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;path&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="n"&gt;canonical&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;check_asset_file&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;requested&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;?&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// canonicalize + file check + image extension whitelist&lt;/span&gt;
    &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="n"&gt;scope&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;asset_protocol_scope&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="n"&gt;to_err&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt;&lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;tauri&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nc"&gt;Error&lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="nc"&gt;AppError&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nf"&gt;new&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;crate&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="n"&gt;error&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nc"&gt;ErrorKind&lt;/span&gt;&lt;span class="o"&gt;::&lt;/span&gt;&lt;span class="nc"&gt;Io&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;to_string&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="n"&gt;scope&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;allow_file&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;canonical&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;map_err&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;to_err&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;?&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;requested&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="n"&gt;canonical&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;scope&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;allow_file&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;requested&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;map_err&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;to_err&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;?&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="kc"&gt;Ok&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After the fix, the PM verified it using the packaged App with the same &lt;code&gt;_posts/ + ../images/&lt;/code&gt; structure. Images loaded successfully, and I finally felt safe cutting the official &lt;code&gt;v0.1.1&lt;/code&gt; release.&lt;/p&gt;




&lt;h1&gt;
  
  
  VII. Final Acceptance Numbers and the Multi-Agent Collaboration Checklist Learned This Time
&lt;/h1&gt;

&lt;p&gt;As of &lt;code&gt;v0.1.1&lt;/code&gt; (latest &lt;code&gt;main&lt;/code&gt;), all automated defenses and benchmarks are green:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Check Item&lt;/th&gt;
&lt;th&gt;Result&lt;/th&gt;
&lt;th&gt;Description&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Vitest Unit Tests&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;369 passed&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Covers parser, table-ops, positions, export, image logic&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Playwright E2E&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;145 passed&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Includes real keyboard typing, tables, centering, IME stress tests&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Rust &lt;code&gt;cargo test&lt;/code&gt;&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;86 passed&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Atomic saves, file association queue, asset scope whitelist, and symlink protection&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Rust Clippy&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;0 warnings&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;cargo clippy --all-targets -- -D warnings&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;GitHub Actions CI&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;All Green (&lt;code&gt;macos-latest&lt;/code&gt;)&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Auto-runs &lt;code&gt;tsc&lt;/code&gt; / &lt;code&gt;vitest&lt;/code&gt; / &lt;code&gt;build&lt;/code&gt; / &lt;code&gt;cargo test&lt;/code&gt; / &lt;code&gt;clippy&lt;/code&gt; / Playwright on every PR&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Input Latency p95&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;17–18 ms&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;10,000-line long text benchmark, far below the 50 ms goal&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;I've summarized the experience of running a large project over these three days into an advanced Herdr Collaboration Checklist:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;[ ] &lt;strong&gt;1. Let the coder do a design assessment before writing code for complex features&lt;/strong&gt;: Like comparing &lt;code&gt;contenteditable&lt;/code&gt; vs. nested &lt;code&gt;EditorView&lt;/code&gt; for tables, saving the cost of going down the wrong path.&lt;/li&gt;
&lt;li&gt;[ ] &lt;strong&gt;2. Split large requirements into "Interface Contract + Dual Worktree Parallelism"&lt;/strong&gt;: Part A exports &lt;code&gt;getActiveTableCell&lt;/code&gt; / &lt;code&gt;focusTableCell&lt;/code&gt;, allowing Part B to start simultaneously with almost zero merge conflicts.&lt;/li&gt;
&lt;li&gt;[ ] &lt;strong&gt;3. No need to stop when the quota is exhausted; switch models in the same worktree&lt;/strong&gt;: When agy hit &lt;code&gt;Individual quota reached&lt;/code&gt;, I immediately switched to &lt;code&gt;claude --permission-mode auto&lt;/code&gt; to take over.&lt;/li&gt;
&lt;li&gt;[ ] &lt;strong&gt;4. Don't force a second Agent for finishing work&lt;/strong&gt;: For highly coupled tasks like translation and product page finishing, a single dedicated writer is faster and more consistent in tone.&lt;/li&gt;
&lt;li&gt;[ ] &lt;strong&gt;5. Don't just trust &lt;code&gt;gh pr checks --watch&lt;/code&gt;&lt;/strong&gt;: Network interruptions can cause it to end early. Use &lt;code&gt;gh run view&lt;/code&gt; to explicitly check &lt;code&gt;status == completed&lt;/code&gt; before merging.&lt;/li&gt;
&lt;li&gt;[ ] &lt;strong&gt;6. Close the Pane when the task is merged&lt;/strong&gt;: Develop the habit of using &lt;code&gt;hc kill&lt;/code&gt; + &lt;code&gt;hc rm&lt;/code&gt; to keep the Herdr window from being cluttered with idle terminals.&lt;/li&gt;
&lt;li&gt;[ ] &lt;strong&gt;7. Write a "fails on old code" regression test before fixing a bug&lt;/strong&gt;: Like the IME out-of-bounds in #56 and the &lt;code&gt;&amp;lt;br&amp;gt;&lt;/code&gt; round-trip in #59; it's only fixed when it turns from red to green.&lt;/li&gt;
&lt;li&gt;[ ] &lt;strong&gt;8. Screenshots and "opening your own real project" are the strongest acceptance tests&lt;/strong&gt;: Screenshots caught the CSS specificity issue in #63; opening my own blog caught #67 and #69.&lt;/li&gt;
&lt;li&gt;[ ] &lt;strong&gt;9. Always check &lt;code&gt;codesign&lt;/code&gt; and &lt;code&gt;Info.plist&lt;/code&gt; before a macOS release&lt;/strong&gt;: Verify the ad-hoc signature is complete and that file association UTIs and &lt;code&gt;RunEvent::Opened&lt;/code&gt; are all connected.&lt;/li&gt;
&lt;/ul&gt;




&lt;h1&gt;
  
  
  Summary
&lt;/h1&gt;

&lt;p&gt;Looking back at the evolution of these four Herdr practical articles, it's quite interesting:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;From fixing bugs to building a complete product&lt;/strong&gt;: The first article fixed an existing backend, the second made a small tool, the third wrote a mod for the workflow, and the fourth took a complete desktop editor PRD (M1–M3) from zero to MIT open source and &lt;code&gt;v0.1.1&lt;/code&gt; in three days.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Models are just slots; the process is the asset&lt;/strong&gt;: When the agy quota ran out halfway through development, switching to Claude Code in the same worktree allowed for a seamless continuation. As long as the specs, contracts, tests, and git discipline are in the PM's hands, any model can take over.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Beyond "all tests passed," you always need a real user's hands&lt;/strong&gt;: If I hadn't typed personally, hadn't asked doc-writer to take screenshots, and hadn't used it to open the previous post on this blog, the issues in #49, #54, #63, #67, and #69—which most affect the user experience—would never have been caught by CI alone.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The tool is finally back in my hands&lt;/strong&gt;: Kalamos can now open the &lt;code&gt;.md&lt;/code&gt; files of this blog directly from Finder and correctly load screenshots from &lt;code&gt;../images/&lt;/code&gt;. From now on, I can write articles using the editor I built together with the Agents.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Feel free to download and try it out, or visit the repo to browse or give it a star:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;GitHub Repo: &lt;a href="https://github.com/kkdai/Kalamos" rel="noopener noreferrer"&gt;kkdai/Kalamos&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Product Page: &lt;a href="https://kkdai.github.io/Kalamos/" rel="noopener noreferrer"&gt;https://kkdai.github.io/Kalamos/&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Official Release Download: &lt;a href="https://github.com/kkdai/Kalamos/releases/tag/v0.1.1" rel="noopener noreferrer"&gt;Release v0.1.1&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Previous articles in this series:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://dev.to/herdr-claude-code-agy-collab/"&gt;[Herdr Practical] First time using Herdr: Let Claude Code be the Reviewer and agy be the Implementer&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://dev.to/record2gif-macos-screen-to-gif/"&gt;[Herdr Practical] Using Herdr to open two agy Panes for parallel development: record2gif in one day&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://dev.to/herdr-review-queue-mod/"&gt;[Herdr Practical] Writing my own Herdr mod: Using labels to create a "pending review" queue&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>ai</category>
      <category>claude</category>
      <category>programming</category>
      <category>showdev</category>
    </item>
    <item>
      <title>[Herdr in Action] Parallel Development with Two Panes: Building record2gif in One Day</title>
      <dc:creator>Evan Lin</dc:creator>
      <pubDate>Thu, 19 Nov 2026 13:22:07 +0000</pubDate>
      <link>https://dev.to/gde/herdr-in-action-parallel-development-with-two-panes-building-record2gif-in-one-day-5619</link>
      <guid>https://dev.to/gde/herdr-in-action-parallel-development-with-two-panes-building-record2gif-in-one-day-5619</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fejvrrvknc22sio4jdau8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fejvrrvknc22sio4jdau8.png" alt="image-20261114210541819" width="800" height="724"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Prequel
&lt;/h1&gt;

&lt;p&gt;When writing blog posts or replying to Issues, I often need to record a short clip of screen operations. The built-in QuickTime (or ⌘⇧5) in macOS records in &lt;code&gt;.mov&lt;/code&gt; format, which always requires using another tool to convert to GIF and adjust dimensions, which is very troublesome.&lt;/p&gt;

&lt;p&gt;So I wanted a very simple tool:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;An interface like QuickTime's "New Screen Recording" that can record the entire desktop or a selected area, directly generate a GIF after recording, and allow choosing the GIF resolution.&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Coincidentally, I used &lt;a href="https://dev.to/herdr-claude-code-agy-collab/"&gt;Herdr for the first time&lt;/a&gt; and it went very smoothly, so this time I decided to scale up the experiment:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Claude Code as PM&lt;/strong&gt;: Create remote GitHub repo, write SPEC, open Issues, review, commit, and push.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;agy as coder, with two Panes open at once&lt;/strong&gt;: Solve two Issues simultaneously.&lt;/li&gt;
&lt;li&gt;Each coder must report back to Claude Code upon completion; commits are only made after the review passes.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The result is here: &lt;a href="https://github.com/kkdai/record2gif" rel="noopener noreferrer"&gt;kkdai/record2gif&lt;/a&gt;. It took about one day from creating the repo to successfully saving a GIF to the desktop.&lt;/p&gt;




&lt;h1&gt;
  
  
  I. What does record2gif do?
&lt;/h1&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Feature&lt;/th&gt;
&lt;th&gt;Description&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;QuickTime-style Control Bar&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;A small floating window: Record Entire Screen / Record Selection, Options, Red Record button&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Selection Area&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Full-screen semi-transparent mask, drag a box, displays pixel dimensions, can be adjusted before recording&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;During Recording&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Control bar automatically hides (won't be recorded), menu bar displays ⏹ + &lt;code&gt;mm:ss&lt;/code&gt;, click or press &lt;strong&gt;⌃⌘Esc&lt;/strong&gt; to stop&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Export Window&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Looping preview, &lt;strong&gt;Resolution&lt;/strong&gt; (Original / 1280 / 960 / 640 / 480 / 320 px / Custom width, maintains aspect ratio, never upscales), &lt;strong&gt;Frame Rate&lt;/strong&gt; (5–30 fps), &lt;strong&gt;Infinite Loop&lt;/strong&gt; toggle, estimated output size&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Saving&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Defaults to Desktop, filename &lt;code&gt;Recording 2026-11-14 at 15.13.43.gif&lt;/code&gt;, includes progress bar, can be canceled, can show in Finder after saving&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Technical choices were intentionally kept simple, with &lt;strong&gt;absolutely no third-party packages&lt;/strong&gt;:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Component&lt;/th&gt;
&lt;th&gt;Technology&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Project&lt;/td&gt;
&lt;td&gt;Swift Package Manager (no &lt;code&gt;.xcodeproj&lt;/code&gt;), macOS 14+&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;UI&lt;/td&gt;
&lt;td&gt;SwiftUI + AppKit (&lt;code&gt;NSPanel&lt;/code&gt;, &lt;code&gt;NSStatusItem&lt;/code&gt;, mask window)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Recording&lt;/td&gt;
&lt;td&gt;
&lt;strong&gt;ScreenCaptureKit&lt;/strong&gt; (&lt;code&gt;SCStream&lt;/code&gt;) → &lt;code&gt;AVAssetWriter&lt;/code&gt; writing H.264 &lt;code&gt;.mov&lt;/code&gt; temporary file&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;GIF Conversion&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;AVAssetReader&lt;/code&gt; frame-by-frame decoding + &lt;strong&gt;ImageIO&lt;/strong&gt; (&lt;code&gt;CGImageDestination&lt;/code&gt;) encoding&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Global Shortcut&lt;/td&gt;
&lt;td&gt;Carbon &lt;code&gt;RegisterEventHotKey&lt;/code&gt; (no accessibility permissions required)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Testing&lt;/td&gt;
&lt;td&gt;Swift Testing, 19 tests&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Recording is always done at &lt;strong&gt;native pixel resolution&lt;/strong&gt; (points × scale). Downscaling only happens during GIF export, so the same recording can be exported in multiple sizes.&lt;/p&gt;




&lt;h1&gt;
  
  
  II. PM's Job: Write the SPEC first, then break down Issues
&lt;/h1&gt;

&lt;p&gt;When two coders write code in parallel, the biggest fear is "each writing their own way, and failing to integrate at the end." Therefore, the first thing Claude Code did was not to start the coders, but to write a &lt;code&gt;SPEC.md&lt;/code&gt;. The two most important things in it were:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Fixed Directory Structure&lt;/strong&gt;: Which Issue can only modify which folder (e.g., only #4 can modify &lt;code&gt;Recording/&lt;/code&gt;, only #5 can modify &lt;code&gt;Export/&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Interface Contract between Issues&lt;/strong&gt;: Write the public APIs for &lt;code&gt;ScreenRecorder&lt;/code&gt;, &lt;code&gt;GIFExporter&lt;/code&gt;, and &lt;code&gt;GIFSizing&lt;/code&gt; directly into the SPEC first.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight swift"&gt;&lt;code&gt;&lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="kd"&gt;final&lt;/span&gt; &lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;GIFExporter&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;Sendable&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;init&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="nf"&gt;export&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;video&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="no"&gt;URL&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;to&lt;/span&gt; &lt;span class="n"&gt;output&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="no"&gt;URL&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;options&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;GIFExportOptions&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                       &lt;span class="n"&gt;progress&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nd"&gt;@escaping&lt;/span&gt; &lt;span class="nd"&gt;@Sendable&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;Double&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="kt"&gt;Void&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="k"&gt;throws&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;With the contract in place, the coder working on the UI doesn't need to wait for the recording engine to be finished to know what to call.&lt;/p&gt;

&lt;p&gt;Then it was broken down into 5 Issues, divided into three rounds:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;#&lt;/th&gt;
&lt;th&gt;Issue&lt;/th&gt;
&lt;th&gt;Dependency&lt;/th&gt;
&lt;th&gt;Round&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;Project skeleton, App shell, build script&lt;/td&gt;
&lt;td&gt;–&lt;/td&gt;
&lt;td&gt;Round 1&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;td&gt;ScreenCaptureKit recording engine&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;Round 2 (Pane A)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;3&lt;/td&gt;
&lt;td&gt;GIF Export (Resolution / fps)&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;Round 2 (Pane B)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;4&lt;/td&gt;
&lt;td&gt;QuickTime-style recording UI&lt;/td&gt;
&lt;td&gt;1, 2&lt;/td&gt;
&lt;td&gt;Round 3 (Pane A)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;5&lt;/td&gt;
&lt;td&gt;Export window: Resolution selection, preview, saving&lt;/td&gt;
&lt;td&gt;1, 3&lt;/td&gt;
&lt;td&gt;Round 3 (Pane B)&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;h1&gt;
  
  
  III. Parallel Development with Two agy Panes
&lt;/h1&gt;

&lt;h2&gt;
  
  
  1. One git worktree per coder
&lt;/h2&gt;

&lt;p&gt;If two agy instances modify files in the same folder at the same time, they will definitely clash. Therefore, a separate git worktree / branch was opened for each Issue, and coders only worked within their own worktree:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git worktree add ../record2gif-wt/issue-2 -b issue-2
git worktree add ../record2gif-wt/issue-3 -b issue-3
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  2. Opening coder Panes
&lt;/h2&gt;

&lt;p&gt;The &lt;code&gt;agy&lt;/code&gt; startup method learned from the previous post was reused:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;hc run --bg --outlive-parent --name coder-a --cwd ../record2gif-wt/issue-2 \
  agy --dangerously-skip-permissions -i &lt;span class="s2"&gt;"$TASK"&lt;/span&gt;
herdr-app &lt;span class="k"&gt;do&lt;/span&gt; terminal.keep --terminal &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;ID&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; --place right &lt;span class="c"&gt;# First one on the right&lt;/span&gt;
herdr-app &lt;span class="k"&gt;do&lt;/span&gt; terminal.keep --terminal &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;ID&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; --place down &lt;span class="c"&gt;# Second one stacked below&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The screen then looked like this: Claude Code (PM) on the left, and two agy coders on the right (top and bottom).&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fdier79ms8e82ltgtvsaf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fdier79ms8e82ltgtvsaf.png" alt="Herdr Three Panes: Claude Code (PM) on the left, two agy coders (Gemini 1.5 Argon) on the right reading SPEC and organizing Issues #2 and #3" width="800" height="502"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;A few small changes this time:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Item&lt;/th&gt;
&lt;th&gt;Description&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;&lt;code&gt;-i&lt;/code&gt;&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;agy "prompt"&lt;/code&gt; will exit 2 directly; use &lt;code&gt;agy -i "..."&lt;/code&gt; instead&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;&lt;code&gt;--dangerously-skip-permissions&lt;/code&gt;&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;In the last post, I wrote a driver script to authorize permissions one by one; this time, coders are confined to their own worktrees and cannot commit/push, so I chose to skip permissions directly to avoid the Panes getting stuck on permission dialogs&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Trust Dialog&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Opening agy in a new folder for the first time still asks for trust; handled with &lt;code&gt;hc keys &amp;lt;t&amp;gt; enter&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Waiting for Reports&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;hc wait --children any&lt;/code&gt;: Review whichever coder finishes first&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  3. Review Process
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sequenceDiagram
    participant PM as Claude Code (PM)
    participant A as agy Pane A
    participant B as agy Pane B
    participant GH as GitHub

    PM-&amp;gt;&amp;gt;A: Issue #2 + SPEC path + worktree
    PM-&amp;gt;&amp;gt;B: Issue #3 + SPEC path + worktree
    par Parallel Implementation
        A-&amp;gt;&amp;gt;A: Implement + swift build + swift test
    and
        B-&amp;gt;&amp;gt;B: Implement + swift build + swift test
    end
    B-&amp;gt;&amp;gt;PM: hc send: Completed #3
    PM-&amp;gt;&amp;gt;PM: git diff, swift test, check against SPEC
    PM-&amp;gt;&amp;gt;B: Feedback (if any)
    A-&amp;gt;&amp;gt;PM: hc send: Completed #2
    PM-&amp;gt;&amp;gt;GH: Merge to main, commit, close Issue
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The benefit of &lt;code&gt;hc wait --children any&lt;/code&gt; is that while A is still writing, the PM can review B first without them blocking each other.&lt;/p&gt;




&lt;h1&gt;
  
  
  IV. The real work begins after &lt;code&gt;make run&lt;/code&gt;
&lt;/h1&gt;

&lt;p&gt;All 5 Issues were merged, all 19 tests passed, and &lt;code&gt;make app&lt;/code&gt; successfully packaged &lt;code&gt;build/record2gif.app&lt;/code&gt;. However, when I actually ran it:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;#&lt;/th&gt;
&lt;th&gt;Symptom&lt;/th&gt;
&lt;th&gt;Root Cause&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;6&lt;/td&gt;
&lt;td&gt;Control bar window became a 900×450 large white frame&lt;/td&gt;
&lt;td&gt;Default SwiftUI &lt;code&gt;Window&lt;/code&gt; size&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;7&lt;/td&gt;
&lt;td&gt;Clicking Record makes the App disappear&lt;/td&gt;
&lt;td&gt;The last window was hidden, and SwiftUI automatically terminated the App&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;8&lt;/td&gt;
&lt;td&gt;Screen recording permissions don't work no matter what&lt;/td&gt;
&lt;td&gt;Ad-hoc signature changes with every build&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;9&lt;/td&gt;
&lt;td&gt;No seconds displayed in the menu bar during recording&lt;/td&gt;
&lt;td&gt;Race condition in object connection order&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;10&lt;/td&gt;
&lt;td&gt;GIF export failed&lt;/td&gt;
&lt;td&gt;Screen recording produces &lt;strong&gt;Variable Frame Rate&lt;/strong&gt; video&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Passing all tests is a far cry from "actually working."&lt;/strong&gt; These 5 bugs were also opened as Issues, assigned to coders to fix, and reviewed by the PM. Let's go through them one by one.&lt;/p&gt;

&lt;h2&gt;
  
  
  Bug #6: Control bar became 900×450
&lt;/h2&gt;

&lt;p&gt;If a SwiftUI &lt;code&gt;Window&lt;/code&gt; scene isn't specifically configured, it gives a default size. For a small control bar like QuickTime's, you need to add:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Window("record2gif", id: "main") { ... }
    .windowResizability(.contentSize)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This makes the window fit the content size.&lt;/p&gt;

&lt;h2&gt;
  
  
  Bug #7: Clicking Record "crashes" the App
&lt;/h2&gt;

&lt;p&gt;I initially thought it was a crash, but there were no &lt;code&gt;.ips&lt;/code&gt; files in &lt;code&gt;~/Library/Logs/DiagnosticReports&lt;/code&gt;. Checking the unified log revealed the App was &lt;strong&gt;terminating normally on its own&lt;/strong&gt;.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Pro tip: In my zsh, &lt;code&gt;log&lt;/code&gt; is overridden by the shell; use &lt;code&gt;/usr/bin/log show --predicate 'process == "Record2Gif"'&lt;/code&gt;.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The reason: During recording, the control bar must be hidden (so it isn't recorded), and &lt;strong&gt;a SwiftUI App with only one &lt;code&gt;Window&lt;/code&gt; will automatically terminate when the last window disappears&lt;/strong&gt;. The fix is to disable this behavior in the AppDelegate:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight swift"&gt;&lt;code&gt;&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="nf"&gt;applicationShouldTerminateAfterLastWindowClosed&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;_&lt;/span&gt; &lt;span class="n"&gt;sender&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nc"&gt;NSApplication&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="kt"&gt;Bool&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kc"&gt;false&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This trap was actually set by the PM: during the review of #4, Claude Code asked the coder to change &lt;code&gt;WindowGroup&lt;/code&gt; to a single &lt;code&gt;Window&lt;/code&gt; (to avoid opening multiple control bars), but didn't anticipate this side effect.&lt;/p&gt;

&lt;h2&gt;
  
  
  Bug #8: Screen recording permissions are useless
&lt;/h2&gt;

&lt;p&gt;This was the most annoying part of the project. After enabling record2gif in "System Settings → Privacy &amp;amp; Security → Screen Recording," permissions were lost again after a rebuild.&lt;/p&gt;

&lt;p&gt;The reason: &lt;strong&gt;macOS TCC permissions are tied to the App's code signature (Designated Requirement)&lt;/strong&gt;. Initially, the build script used ad-hoc signing (&lt;code&gt;codesign -s -&lt;/code&gt;), so the CDHash changed with every build, and macOS treated it as a "different App."&lt;/p&gt;

&lt;p&gt;The solution is to create a &lt;strong&gt;locally self-signed code signing certificate&lt;/strong&gt;. If &lt;code&gt;scripts/build-app.sh&lt;/code&gt; finds it, it uses it for signing:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Only needs to be done once per machine; full instructions in README&lt;/span&gt;
&lt;span class="c"&gt;# cert.conf sets CN = record2gif Local Signing, extendedKeyUsage = codeSigning&lt;/span&gt;
openssl req -x509 -newkey rsa:2048 -nodes -days 3650 -config cert.conf ...
openssl pkcs12 -export -legacy ... -out cert.p12
security import cert.p12 -k ~/Library/Keychains/login.keychain-db -T /usr/bin/codesign

&lt;span class="c"&gt;# Clear old ad-hoc records, repackage, authorize once&lt;/span&gt;
tccutil reset ScreenCapture com.kkdai.record2gif
make app &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; open build/record2gif.app
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After this, the Designated Requirement is fixed to &lt;code&gt;identifier "com.kkdai.record2gif" and certificate leaf = H"..."&lt;/code&gt;, and permissions persist through rebuilds. The build script also prints the &lt;code&gt;codesign -dr -&lt;/code&gt; result for easy verification.&lt;/p&gt;

&lt;h2&gt;
  
  
  Bug #9: No seconds in the menu bar
&lt;/h2&gt;

&lt;p&gt;During recording, the menu bar should display the elapsed time like ⏹ &lt;code&gt;00:12&lt;/code&gt;. The code seemed correct, but it wouldn't appear.&lt;/p&gt;

&lt;p&gt;The cause was the &lt;strong&gt;connection order&lt;/strong&gt; of two objects in the AppDelegate: &lt;code&gt;AppModel&lt;/code&gt; would notify &lt;code&gt;StatusItemController&lt;/code&gt; when the recording state changed, but at the moment of notification, &lt;code&gt;statusItemController&lt;/code&gt; hadn't been set yet, so the message was dropped. The fix was to connect them in the &lt;code&gt;didSet&lt;/code&gt; of both sides, ensuring they connect regardless of which is created first, and making the &lt;code&gt;didSet&lt;/code&gt; of &lt;code&gt;phase&lt;/code&gt; and &lt;code&gt;recorder.$elapsed&lt;/code&gt; the sole sources for updating the menu bar.&lt;/p&gt;

&lt;h2&gt;
  
  
  Bug #10: GIF export failed
&lt;/h2&gt;

&lt;p&gt;The final hurdle: after recording and clicking Save GIF, an error popped up:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;GIF export failed: The operation couldn't be completed. (Record2GifCore.GIFExportError error 1.)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;First, a complaint about the error message: &lt;code&gt;error 1&lt;/code&gt; is completely meaningless to the user, so I had &lt;code&gt;GIFExportError&lt;/code&gt; implement &lt;code&gt;LocalizedError&lt;/code&gt; to provide readable messages.&lt;/p&gt;

&lt;p&gt;The real reason: &lt;strong&gt;ScreenCaptureKit records Variable Frame Rate (VFR) video&lt;/strong&gt;. When the screen doesn't change, it doesn't send new frames, so the timestamps are irregular. The original method used &lt;code&gt;AVAssetImageGenerator.images(for:)&lt;/code&gt; to request a batch of frames at fixed time points, which fails with VFR video.&lt;/p&gt;

&lt;p&gt;I changed it to use &lt;code&gt;AVAssetReader&lt;/code&gt; to &lt;strong&gt;decode sequentially from start to finish&lt;/strong&gt;. For each GIF time point &lt;code&gt;t = i / fps&lt;/code&gt;, it takes the "last frame where timestamp ≤ t":&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight dot"&gt;&lt;code&gt;&lt;span class="n"&gt;flowchart&lt;/span&gt; &lt;span class="no"&gt;LR&lt;/span&gt;
    &lt;span class="no"&gt;V&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"VFR .mov&amp;lt;br/&amp;gt;Irregular frame timing"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;--&amp;gt;&lt;/span&gt; &lt;span class="no"&gt;R&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"AVAssetReader&amp;lt;br/&amp;gt;Sequential BGRA decoding"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
    &lt;span class="no"&gt;R&lt;/span&gt; &lt;span class="o"&gt;--&amp;gt;&lt;/span&gt; &lt;span class="no"&gt;P&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;"For each GIF time t = i/fps&amp;lt;br/&amp;gt;Take last frame with PTS ≤ t"&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="no"&gt;P&lt;/span&gt; &lt;span class="o"&gt;--&amp;gt;&lt;/span&gt; &lt;span class="no"&gt;S&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"Scale to selected resolution&amp;lt;br/&amp;gt;(No upscaling, even dimensions)"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
    &lt;span class="no"&gt;S&lt;/span&gt; &lt;span class="o"&gt;--&amp;gt;&lt;/span&gt; &lt;span class="no"&gt;G&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"CGImageDestination&amp;lt;br/&amp;gt;Write to GIF"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This way, regardless of how irregular the original video frames are, the output GIF has a fixed frame rate. I also added tests for VFR.&lt;/p&gt;

&lt;p&gt;This trap was also set by the PM: during the review of #3, Claude Code suggested the coder switch to the batch &lt;code&gt;images(for:)&lt;/code&gt; API. Since the test videos at the time were all constant frame rate, the tests passed.&lt;/p&gt;

&lt;p&gt;After the fix: &lt;strong&gt;"It works! GIF successfully saved to desktop."&lt;/strong&gt; 🎉&lt;/p&gt;




&lt;h1&gt;
  
  
  V. PMs make mistakes too
&lt;/h1&gt;

&lt;p&gt;Looking back at these 10 Issues, two bugs (#7, #10) were actually &lt;strong&gt;caused by modification suggestions made by the PM during review&lt;/strong&gt;. This is worth noting:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Reviewer suggestions also need verification&lt;/strong&gt;. The previous post said "Reviewer conclusions must also be reviewed"; this time it's the opposite: modifications proposed by the Reviewer can introduce bugs.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Unit tests cannot catch these two types of problems&lt;/strong&gt;. App lifecycle (closing the last window) and the characteristics of real recording files (VFR) can only be discovered by actually running the app.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Humans must test it once&lt;/strong&gt;. All 5 of these bugs were discovered during my actual operation. No matter how careful the review between Agents is, it cannot replace manual testing.&lt;/li&gt;
&lt;/ul&gt;




&lt;h1&gt;
  
  
  VI. Parallel Multi-Agent Development Checklist
&lt;/h1&gt;

&lt;ul&gt;
&lt;li&gt; &lt;strong&gt;1. Write the SPEC first and lock down the interface contract&lt;/strong&gt;: public APIs, directory structure, which Issue can modify which folder.&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;2. Divide rounds by dependency&lt;/strong&gt;: Issues in the same round must not depend on each other.&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;3. One git worktree per coder&lt;/strong&gt;: Avoid modifying the same folder simultaneously.&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;4. Coders do not commit or push&lt;/strong&gt;: Handled uniformly by the PM after review. This is also the prerequisite for safely using &lt;code&gt;--dangerously-skip-permissions&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;5. &lt;code&gt;hc wait --children any&lt;/code&gt;&lt;/strong&gt;: Review whoever finishes first.&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;6. After all tests pass, you must package and operate the app manually&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;7. For macOS Apps requiring permissions, handle signing on day one&lt;/strong&gt;: Otherwise, you'll have to re-authorize after every rebuild.&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;8. Error types should implement &lt;code&gt;LocalizedError&lt;/code&gt;&lt;/strong&gt;: Otherwise, users will only see &lt;code&gt;error 1&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;9. Reviewer suggestions can be a source of bugs&lt;/strong&gt;: Especially suggestions involving framework behavior (App lifecycle, video formats).&lt;/li&gt;
&lt;/ul&gt;




&lt;h1&gt;
  
  
  Summary
&lt;/h1&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;SPEC + Interface Contract is the key to parallel development&lt;/strong&gt;: Two agy Panes wrote the recording engine and GIF export simultaneously, and there were almost no conflicts during merging.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Herdr makes "one PM, two coders" visible&lt;/strong&gt;: You can see the PM assigning tasks and reviewing on the left, and what the two coders are doing on the right in real-time.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;"Tests passed" is just the beginning&lt;/strong&gt;: 5 bugs appeared only when actually running the app, 2 of which were planted by the PM during review.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;macOS Nuances&lt;/strong&gt;: Screen recording permissions are tied to code signatures, SwiftUI Apps with one window terminate themselves, and ScreenCaptureKit outputs VFR.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;record2gif is now open source at &lt;a href="https://github.com/kkdai/record2gif" rel="noopener noreferrer"&gt;kkdai/record2gif&lt;/a&gt;. You can package it yourself with &lt;code&gt;make app&lt;/code&gt;. From now on, I'll probably use it to record all the operation GIFs for my blog.&lt;/p&gt;

</description>
      <category>productivity</category>
      <category>sideprojects</category>
      <category>softwaredevelopment</category>
      <category>tools</category>
    </item>
    <item>
      <title>[Herdr in Practice] Build Your Own Herdr Mod: Create a "Pending Review" Queue with Labels to Instantly Track Unread Reports</title>
      <dc:creator>Evan Lin</dc:creator>
      <pubDate>Thu, 19 Nov 2026 13:21:38 +0000</pubDate>
      <link>https://dev.to/gde/herdr-in-practice-build-your-own-herdr-mod-create-a-pending-review-queue-with-labels-to-5b83</link>
      <guid>https://dev.to/gde/herdr-in-practice-build-your-own-herdr-mod-create-a-pending-review-queue-with-labels-to-5b83</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Flasxwu5u1is3pu1fn6gi.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Flasxwu5u1is3pu1fn6gi.png" alt="review-queue panel: In the middle is the pending review queue, two agy coders just reported using hc-review ready" width="800" height="502"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Recap
&lt;/h1&gt;

&lt;p&gt;The previous two posts (&lt;a href="https://dev.to/herdr-claude-code-agy-collab/"&gt;First time using Herdr&lt;/a&gt;, &lt;a href="https://dev.to/record2gif-macos-screen-to-gif/"&gt;Using two agy Panes for record2gif&lt;/a&gt;) followed the same pattern:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Left side: &lt;strong&gt;Claude Code as PM / Reviewer&lt;/strong&gt;, opening issues, reviewing, and committing.&lt;/li&gt;
&lt;li&gt;Right side: &lt;strong&gt;agy as coder&lt;/strong&gt;, reporting via &lt;code&gt;hc send&lt;/code&gt; when finished.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;After using it for a while, there's a practical issue: coder reports are typed directly into the PM's input box. After opening two or three coders and going through several rounds, it's hard for me (the human) to answer:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Which coders have reported now? Which ones have I seen, and which ones haven't I?&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The &lt;code&gt;done&lt;/code&gt; status in the Herdr sidebar doesn't help because as soon as you glance at that Pane, it reverts to &lt;code&gt;idle&lt;/code&gt;. "Seeing" is not the same as "reviewed."&lt;/p&gt;

&lt;p&gt;While searching online for the previous post, I also found that &lt;strong&gt;writing your own Herdr mod is a topic almost no one in the Chinese-speaking community has written about&lt;/strong&gt;. So this time, I'll make one myself:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;A "Pending Review" queue panel: listing which coders have reported and haven't been seen yet.&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Result: &lt;a href="https://github.com/kkdai/herdr-review-queue" rel="noopener noreferrer"&gt;kkdai/herdr-review-queue&lt;/a&gt;&lt;/p&gt;




&lt;h1&gt;
  
  
  1. Discovery before starting: &lt;code&gt;hc send&lt;/code&gt; is invisible
&lt;/h1&gt;

&lt;p&gt;My original idea was intuitive: have the mod listen for &lt;code&gt;hc send&lt;/code&gt; messages. If someone sends a message to the reviewer, add it to the queue.&lt;/p&gt;

&lt;p&gt;But I actually tested &lt;code&gt;hc events&lt;/code&gt; (the real-time event stream of herdr-core):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;hc run --bg --name probe-target cat
hc run --bg --name probe -- sh -c &lt;span class="s1"&gt;'hc events --json'&lt;/span&gt;
hc send probe-target &lt;span class="s2"&gt;"probe message"&lt;/span&gt;
hc label probe-target &lt;span class="nv"&gt;review&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;ready

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It turns out the events contain &lt;code&gt;foreground&lt;/code&gt;, &lt;code&gt;title&lt;/code&gt;, &lt;code&gt;labels&lt;/code&gt;... &lt;strong&gt;but no &lt;code&gt;send&lt;/code&gt;&lt;/strong&gt;. Messages only appear in the recipient's input box and cannot be observed by outsiders.&lt;/p&gt;

&lt;p&gt;However, this experiment also found a way out: &lt;strong&gt;label changes appear in events in real-time&lt;/strong&gt;, and the mod API's &lt;code&gt;terminals()&lt;/code&gt; also brings up the labels for each terminal in real-time.&lt;/p&gt;

&lt;p&gt;So the design shifted to:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Instead of peeking at messages, let the coder "incidentally" stick a label on their own terminal when reporting.&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h1&gt;
  
  
  2. Label contract: The agreement between coder and reviewer
&lt;/h1&gt;

&lt;p&gt;Labels are placed on the &lt;strong&gt;coder's own terminal&lt;/strong&gt; (&lt;code&gt;hc label &amp;lt;t&amp;gt; k=v&lt;/code&gt;, where &lt;code&gt;k=&lt;/code&gt; means removal):&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Label&lt;/th&gt;
&lt;th&gt;Value&lt;/th&gt;
&lt;th&gt;Set by&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;review&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;ready&lt;/code&gt; or &lt;code&gt;seen&lt;/code&gt; (none = not in queue)&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;ready&lt;/code&gt;: coder; &lt;code&gt;seen&lt;/code&gt;: reviewer&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;review.summary&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;One-line summary, max 200 chars&lt;/td&gt;
&lt;td&gt;coder&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;review.at&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Time when it became ready (ms)&lt;/td&gt;
&lt;td&gt;coder&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;review.to&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Reviewer's address (e.g., &lt;code&gt;t15&lt;/code&gt;)&lt;/td&gt;
&lt;td&gt;coder&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;review.seen_at&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Time when marked as seen&lt;/td&gt;
&lt;td&gt;reviewer&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;By the way, I confirmed two things: label keys can contain &lt;code&gt;.&lt;/code&gt;, and values can handle Chinese and full-width punctuation without issues.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sequenceDiagram
    participant C as agy coder (t1k)
    participant H as herdr-core
    participant M as review-queue mod
    participant R as Claude Code (t15)

    C-&amp;gt;&amp;gt;H: hc-review ready "Summary"&amp;lt;br/&amp;gt;→ hc label t1k review=ready ...
    C-&amp;gt;&amp;gt;R: hc send t15 "[review-ready] Summary"
    H--&amp;gt;&amp;gt;M: terminals() Real-time update
    M-&amp;gt;&amp;gt;M: Queue +1, pop-up notification
    R-&amp;gt;&amp;gt;H: Click Seen → hc label t1k review=seen
    H--&amp;gt;&amp;gt;M: Queue -1, move to Seen area

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This table was written directly into the SPEC, becoming the sole interface between the two issues.&lt;/p&gt;




&lt;h1&gt;
  
  
  3. PM Workflow: One SPEC, 3 Issues, two Panes
&lt;/h1&gt;

&lt;p&gt;The workflow is the same as in the record2gif post:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;#&lt;/th&gt;
&lt;th&gt;Issue&lt;/th&gt;
&lt;th&gt;Who&lt;/th&gt;
&lt;th&gt;Round&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;hc-review&lt;/code&gt; CLI + Tests&lt;/td&gt;
&lt;td&gt;agy Pane A&lt;/td&gt;
&lt;td&gt;Round 1&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;review-queue&lt;/code&gt; Herdr mod&lt;/td&gt;
&lt;td&gt;agy Pane B&lt;/td&gt;
&lt;td&gt;Round 1 (Simultaneous with #1)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;3&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;install.sh&lt;/code&gt;, README, Screenshots&lt;/td&gt;
&lt;td&gt;agy Pane A&lt;/td&gt;
&lt;td&gt;Round 2&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Since the label contract was hardcoded in the SPEC, #1 and #2 didn't have to wait for each other at all and could start simultaneously. Each issue had its own git worktree; coders didn't commit or push, as everything was handled by Claude Code after review.&lt;/p&gt;

&lt;p&gt;Both coders were &lt;strong&gt;agy (Antigravity CLI) running Gemini 4 Argon&lt;/strong&gt;.&lt;/p&gt;




&lt;h1&gt;
  
  
  4. &lt;code&gt;hc-review&lt;/code&gt;: A small CLI for coders
&lt;/h1&gt;

&lt;p&gt;The command for coders is simple, written in POSIX sh, and only depends on &lt;code&gt;hc&lt;/code&gt; and &lt;code&gt;jq&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;hc-review ready "&amp;lt;summary&amp;gt;" [--to &amp;lt;t&amp;gt;] [--no-send] # coder reports
hc-review seen &amp;lt;t&amp;gt; # reviewer marks as seen
hc-review clear &amp;lt;t&amp;gt; # clears all review labels
hc-review ls [--all] [--json] # terminal version of the queue

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;ready&lt;/code&gt; will:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Find its own parent from &lt;code&gt;hc get $HC_TERMINAL_ID --json&lt;/code&gt; to use as the default reviewer.&lt;/li&gt;
&lt;li&gt;Attach &lt;code&gt;review=ready&lt;/code&gt;, summary, time, and reviewer to itself.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;hc send&lt;/code&gt; a &lt;code&gt;[review-ready] &amp;lt;summary&amp;gt;&lt;/code&gt; message to the reviewer.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;So the prompt for the coder just needs one more sentence:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;When finished, run hc-review ready "&amp;lt;one-sentence summary: what changed, test results&amp;gt;" to report.

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h1&gt;
  
  
  5. How to write a Herdr mod
&lt;/h1&gt;

&lt;p&gt;This is the part I want to share the most. Herdr mods are located in &lt;code&gt;~/.config/herdr-app/mods/&amp;lt;name&amp;gt;/&lt;/code&gt;, consisting of a &lt;code&gt;main.js&lt;/code&gt; and a &lt;code&gt;mod.json&lt;/code&gt;:&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="nl"&gt;"place"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"right"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nl"&gt;"size"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;340&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nl"&gt;"title"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"Review queue"&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;main.js&lt;/code&gt; is JavaScript, which default exports a class inheriting from &lt;code&gt;View&lt;/code&gt;. The UI is built using a GPUI-style chained builder (no HTML/CSS). Key concepts:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Concept&lt;/th&gt;
&lt;th&gt;Description&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;&lt;code&gt;terminals()&lt;/code&gt;&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;All terminals (including labels), &lt;strong&gt;real-time&lt;/strong&gt;: when data changes, &lt;code&gt;render()&lt;/code&gt; reruns automatically; no need to poll manually.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;&lt;code&gt;hc([...])&lt;/code&gt;&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Run &lt;code&gt;hc&lt;/code&gt; commands directly within the mod, e.g., calling &lt;code&gt;hc label&lt;/code&gt; when clicking Seen.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;&lt;code&gt;run("agent.focus", …)&lt;/code&gt;&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Execute Herdr commands, e.g., jumping to that coder's Pane.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;&lt;code&gt;notify({...})&lt;/code&gt;&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Pop up a notification; clicking it can execute a command.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;&lt;code&gt;theme()&lt;/code&gt;&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Use theme colors; both dark and light themes will adapt.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;&lt;code&gt;nextCommand()&lt;/code&gt;&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Receive shortcut commands, e.g., &lt;code&gt;review-queue:next&lt;/code&gt;.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The simplified skeleton looks something like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight tsx"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nc"&gt;View&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;div&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="s2"&gt;"gpui-kit"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;v_flex&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;h_flex&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="s2"&gt;"gpui-base"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;terminals&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;hc&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;run&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;notify&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;theme&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="s2"&gt;"herdr"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;ReviewQueue&lt;/span&gt; &lt;span class="k"&gt;extends&lt;/span&gt; &lt;span class="nc"&gt;View&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nf"&gt;render&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;t&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;theme&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="n"&gt;pending&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;terminals&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
      &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;filter&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;labels&lt;/span&gt;&lt;span class="o"&gt;?&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;review&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="s2"&gt;"ready"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
      &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;sort&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nb"&gt;Number&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;labels&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"review.at"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="nb"&gt;Number&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;b&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;labels&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"review.at"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nf"&gt;v_flex&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;size_full&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;bg&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;t&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;chrome&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;children&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
      &lt;span class="n"&gt;pending&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;map&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt;
        &lt;span class="nf"&gt;h_flex&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;id&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sb"&gt;`rq-${x.address}`&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;gap&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;8&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
          &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;on_click&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nf"&gt;run&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"agent.focus"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="n"&gt;terminal&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;address&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
          &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;child&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;div&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;child&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt; &lt;span class="o"&gt;??&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;address&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
          &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;child&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;div&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;text_color&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;t&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;muted&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;child&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;labels&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"review.summary"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;??&lt;/span&gt; &lt;span class="s2"&gt;""&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
          &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;child&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;div&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;id&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sb"&gt;`seen-${x.address}`&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;child&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Seen"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
            &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;on_click&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;_e&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;cx&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
              &lt;span class="n"&gt;cx&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;stop_propagation&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
              &lt;span class="n"&gt;cx&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;spawn&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
                &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;hc&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"label"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;address&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;"review=seen"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sb"&gt;`review.seen_at=${Date.now()}`&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
              &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
            &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The actual version includes: a Seen area (collapsible, up to 10 entries), Reopen / Clear, relative time, status dots, error messages displayed on the row for 5 seconds, and &lt;strong&gt;notifications only for new reports&lt;/strong&gt; (no notifications for items already in the queue when the mod starts).&lt;/p&gt;

&lt;p&gt;A few rules for writing mods (all documented in Herdr's &lt;code&gt;AGENTS.md&lt;/code&gt;, and the coder followed them):&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Don't poll &lt;code&gt;terminals()&lt;/code&gt;&lt;/strong&gt;: it is inherently real-time. The only timer is for updating relative times like "3m, 2h" every 30 seconds.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Don't retain &lt;code&gt;cx&lt;/code&gt;&lt;/strong&gt;: each callback receives its own &lt;code&gt;cx&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Use theme colors only&lt;/strong&gt;; don't hardcode colors.&lt;/li&gt;
&lt;li&gt;Run &lt;code&gt;herdr-app check mods/review-queue&lt;/code&gt; after every change.&lt;/li&gt;
&lt;/ul&gt;




&lt;h1&gt;
  
  
  6. Issues caught during Review
&lt;/h1&gt;

&lt;h2&gt;
  
  
  #1: 13 tests passed, but running with real &lt;code&gt;hc&lt;/code&gt; resulted in an empty table
&lt;/h2&gt;

&lt;p&gt;The CLI delivered by coder A was beautiful, passing all 13 tests. But when I tested it with real &lt;code&gt;hc&lt;/code&gt; in a temporary terminal:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight console"&gt;&lt;code&gt;$ hc-review ready &lt;span class="s2"&gt;"e2e test"&lt;/span&gt; --no-send
&lt;span class="o"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;"address"&lt;/span&gt;:&lt;span class="s2"&gt;"t1n"&lt;/span&gt;,&lt;span class="s2"&gt;"argv"&lt;/span&gt;:&lt;span class="o"&gt;[&lt;/span&gt;...huge blob of JSON...&lt;span class="o"&gt;]&lt;/span&gt;&lt;span class="o"&gt;}&lt;/span&gt;
$ hc-review ls
ADDRESS NAME AGE SUMMARY

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Two issues:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;ls&lt;/code&gt; was always empty&lt;/strong&gt;. The reason is that the real &lt;code&gt;hc ls --json&lt;/code&gt; only returns a summary (&lt;code&gt;address&lt;/code&gt;, &lt;code&gt;agent&lt;/code&gt;, &lt;code&gt;status&lt;/code&gt;...), and &lt;strong&gt;doesn't include &lt;code&gt;labels&lt;/code&gt; or &lt;code&gt;name&lt;/code&gt; at all&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;hc label&lt;/code&gt; prints the entire terminal JSON to stdout, so the user sees a huge blob.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;So why did the tests pass? Because &lt;strong&gt;the fake &lt;code&gt;hc&lt;/code&gt; used for testing was written by the coder&lt;/strong&gt;, and it made &lt;code&gt;ls --json&lt;/code&gt; return data containing labels. The fake was different from the real thing; the tests were just validating their own assumptions.&lt;/p&gt;

&lt;p&gt;The fix: &lt;code&gt;ls&lt;/code&gt; now fetches the address list first, then runs &lt;code&gt;hc get --json&lt;/code&gt; for each address to get full data; &lt;code&gt;hc label&lt;/code&gt;'s stdout is redirected to &lt;code&gt;/dev/null&lt;/code&gt;, printing a single line &lt;code&gt;ready: t1k → t15&lt;/code&gt; instead; the fake &lt;code&gt;hc&lt;/code&gt; for testing was updated to simulate real output formats.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;This is the same takeaway as the record2gif post: &lt;strong&gt;passing all tests is not the same as being actually usable&lt;/strong&gt;. This time, "fake dependencies" fooled the tests.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  #2: Passed on the first try, but &lt;code&gt;check&lt;/code&gt; only verified half
&lt;/h2&gt;

&lt;p&gt;The mod passed &lt;code&gt;herdr-app check&lt;/code&gt; on the first try. However, &lt;code&gt;check&lt;/code&gt; only renders once with empty data, so &lt;strong&gt;the rows that only appear when there is data were never executed&lt;/strong&gt;. Therefore, I manually verified that every builder method used in the rows (&lt;code&gt;text_ellipsis&lt;/code&gt;, &lt;code&gt;line_height&lt;/code&gt;, &lt;code&gt;border_l&lt;/code&gt;...) existed in &lt;code&gt;gpui-kit.d.ts&lt;/code&gt; before approving. The actual UI was left for real-world testing after installation.&lt;/p&gt;

&lt;h2&gt;
  
  
  #3: Installed, but not visible on screen
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;install.sh&lt;/code&gt; used a symlink to install the mod into &lt;code&gt;~/.config/herdr-app/mods/review-queue&lt;/code&gt;. &lt;code&gt;check&lt;/code&gt; passed, but &lt;strong&gt;the panel didn't appear&lt;/strong&gt;. &lt;code&gt;mod.json&lt;/code&gt; specified &lt;code&gt;"place": "right"&lt;/code&gt;, but Herdr didn't automatically add it to the layout. I suspect the symlinked folder wasn't detected as a new mod.&lt;/p&gt;

&lt;p&gt;The solution was to manually open a Pane:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;herdr-app do pane.split --direction right --mod review-queue

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I also asked the coder to add this step to the README.&lt;/p&gt;




&lt;h1&gt;
  
  
  7. A real run-through
&lt;/h1&gt;

&lt;p&gt;After installation, I asked two coders to each run &lt;code&gt;hc-review ready&lt;/code&gt;:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;The PM's input box received two &lt;code&gt;&amp;lt;hc from="t1k rq-coder-a"&amp;gt;[review-ready] ...&amp;lt;/hc&amp;gt;&lt;/code&gt; messages.&lt;/li&gt;
&lt;li&gt;The panel immediately showed &lt;strong&gt;Review queue 2&lt;/strong&gt;, with two cards containing names, summaries, times, and Open / Seen buttons (as seen in the top image).&lt;/li&gt;
&lt;li&gt;After executing &lt;code&gt;hc-review seen&lt;/code&gt;, the panel updated to &lt;strong&gt;0&lt;/strong&gt; without a refresh, and the two entries moved to &lt;strong&gt;Seen 2&lt;/strong&gt;:&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F3ug1ahzpw8itabr42rng.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F3ug1ahzpw8itabr42rng.png" alt="After clicking Seen: Queue returns to zero, two entries moved to the Seen area" width="800" height="502"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;A small tip: &lt;code&gt;herdr-app shot&lt;/code&gt; saves the "last frame drawn" of the window. If Herdr isn't in the foreground, it might be an old frame. I encountered old screenshots twice; calling the window to the front with &lt;code&gt;open -a Herdr&lt;/code&gt; before capturing fixed it.&lt;/p&gt;

&lt;p&gt;Not yet verified: I haven't actually clicked the buttons on the panel with a mouse (Herdr's guideline is to avoid pointer automation on real screens, so Seen was tested via CLI; both send the same &lt;code&gt;hc label&lt;/code&gt;); notifications for new reports and the &lt;code&gt;review-queue:next&lt;/code&gt; shortcut haven't been tested yet either.&lt;/p&gt;




&lt;h1&gt;
  
  
  8. Checklist for writing Herdr mods
&lt;/h1&gt;

&lt;ul&gt;
&lt;li&gt; &lt;strong&gt;1. Read &lt;code&gt;~/.config/herdr-app/AGENTS.md&lt;/code&gt; and &lt;code&gt;herdr.d.ts&lt;/code&gt; first&lt;/strong&gt;: The APIs are all there. Built-in mods (&lt;code&gt;agents&lt;/code&gt;, &lt;code&gt;toast&lt;/code&gt;, &lt;code&gt;terminals-pane&lt;/code&gt;) are the best examples.&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;2. Confirm data availability first&lt;/strong&gt;: If I had started by listening for &lt;code&gt;send&lt;/code&gt;, the whole round would have been wasted. A few minutes of testing with &lt;code&gt;hc events&lt;/code&gt; revealed this.&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;3. Use labels for state between agents&lt;/strong&gt;: &lt;code&gt;hc label&lt;/code&gt; is real-time, visible to mods, and queryable via CLI.&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;4. Don't poll real-time data&lt;/strong&gt;: &lt;code&gt;terminals()&lt;/code&gt;, &lt;code&gt;agents()&lt;/code&gt;, and &lt;code&gt;spaces()&lt;/code&gt; trigger a re-render when they change.&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;5. &lt;code&gt;herdr-app check&lt;/code&gt; only verifies empty states&lt;/strong&gt;: Code that only runs when data is present must be verified separately.&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;6. Fake dependencies must simulate real output&lt;/strong&gt;: Run the real &lt;code&gt;hc&lt;/code&gt; once and copy the actual JSON format into the fake.&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;7. Symlink installation won't auto-dock&lt;/strong&gt;: Open it using &lt;code&gt;pane.split --mod &amp;lt;name&amp;gt;&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;8. Bring Herdr to the foreground before taking screenshots&lt;/strong&gt;, otherwise &lt;code&gt;herdr-app shot&lt;/code&gt; might capture an old frame.&lt;/li&gt;
&lt;/ul&gt;




&lt;h1&gt;
  
  
  Summary
&lt;/h1&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Herdr mods are easier to write than expected&lt;/strong&gt;: Just one &lt;code&gt;main.js&lt;/code&gt;, data is real-time, and it reloads on save. This time, a complete panel was built in 451 lines.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Verify data sources before designing&lt;/strong&gt;: &lt;code&gt;hc events&lt;/code&gt; lacks &lt;code&gt;send&lt;/code&gt; events. This discovery shifted the design from "listening to messages" to a "label contract," allowing the CLI and mod to be developed in parallel.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The most valuable part of a review is "running it for real"&lt;/strong&gt;: A CLI that passed 13 tests resulted in an empty table when run with real &lt;code&gt;hc&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Tools are starting to help my own workflow&lt;/strong&gt;: Now, when a coder reports by running &lt;code&gt;hc-review ready&lt;/code&gt;, I can see at a glance on the panel who is waiting for me.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The repo is at &lt;a href="https://github.com/kkdai/herdr-review-queue" rel="noopener noreferrer"&gt;kkdai/herdr-review-queue&lt;/a&gt;. You can install it with &lt;code&gt;./install.sh&lt;/code&gt;. Feel free to use it.&lt;/p&gt;

</description>
      <category>productivity</category>
      <category>programming</category>
      <category>softwaredevelopment</category>
      <category>tools</category>
    </item>
    <item>
      <title>[AI in Action] First Time Using Herdr: Collaborating with Claude Code and agy for Go Backend Code Review, Issue Fixes, and Cloud</title>
      <dc:creator>Evan Lin</dc:creator>
      <pubDate>Thu, 12 Nov 2026 14:44:41 +0000</pubDate>
      <link>https://dev.to/gde/ai-in-action-first-time-using-herdr-collaborating-with-claude-code-and-agy-for-go-backend-code-4jga</link>
      <guid>https://dev.to/gde/ai-in-action-first-time-using-herdr-collaborating-with-claude-code-and-agy-for-go-backend-code-4jga</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fbft2ejikoge352kp6o39.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fbft2ejikoge352kp6o39.png" alt="Herdr: Claude Code on the left assigning tasks, Antigravity (agy) on the right executing" width="800" height="502"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Background
&lt;/h1&gt;

&lt;p&gt;&lt;strong&gt;song-lingo&lt;/strong&gt; is a small tool I made for learning Japanese songs: paste a YouTube MV link, and Gemini helps me transcribe the lyrics, label Romanization (Romaji), provide Traditional Chinese translation and grammar notes, and then uses Gemini TTS to generate a "teacher demonstration audio." After I record myself shadowing the song, Gemini transcribes my pronunciation and provides a word-by-word score.&lt;/p&gt;

&lt;p&gt;A few days ago, in a single Claude Code session, I rewrote the entire backend from &lt;strong&gt;Python + Next.js API routes to Go 1.26&lt;/strong&gt; (Issues #44–#49, Tracking Issue #50, PR #51–#56). The architecture after the rewrite looks like this:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Next.js is only for the frontend&lt;/strong&gt;, using a rewrite to forward &lt;code&gt;/api&lt;/code&gt; to the Go server in the same container (&lt;code&gt;127.0.0.1:8081&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;Deployed on &lt;strong&gt;Cloud Run (&lt;code&gt;asia-east1&lt;/code&gt;)&lt;/strong&gt;, data stored in a Cloud Storage bucket mounted via &lt;strong&gt;gcsfuse at &lt;code&gt;/data&lt;/code&gt;&lt;/strong&gt;; learning progress stored in &lt;strong&gt;Firestore&lt;/strong&gt;; protected by &lt;strong&gt;IAP&lt;/strong&gt; so only I can log in.&lt;/li&gt;
&lt;li&gt;Key points of the Go version: &lt;code&gt;genai&lt;/code&gt; SDK, Gemini REST (voices / interactions), Firestore transactions, &lt;code&gt;kagome&lt;/code&gt; for tokenization and conversion to Hiragana, a custom Hepburn Romanization table, and a port of Python's &lt;code&gt;difflib.SequenceMatcher&lt;/code&gt; to Go (aligned with &lt;strong&gt;400 sets of golden tests produced by Python&lt;/strong&gt;).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The rewrite was done, it worked, and tests passed. But "writing and reviewing your own code" always has blind spots. I happened to want to try &lt;strong&gt;Herdr&lt;/strong&gt;—a tool that allows multiple AI Agents to collaborate in the same window, each occupying a Pane. So, I conducted an experiment:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Let Claude Code be the controller and Reviewer on the left, and the Antigravity CLI (&lt;code&gt;agy&lt;/code&gt;) be the implementer on the right. The two Agents communicate via Herdr, taking the song-lingo Go backend from Code Review all the way to Cloud Run deployment.&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h1&gt;
  
  
  1. What is Herdr? First-time Usage Notes
&lt;/h1&gt;

&lt;h2&gt;
  
  
  1. Two Executables: &lt;code&gt;herdr-app&lt;/code&gt; and &lt;code&gt;herdr-core&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;Herdr is divided into two layers:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Component&lt;/th&gt;
&lt;th&gt;Role&lt;/th&gt;
&lt;th&gt;Description&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;&lt;code&gt;herdr-app&lt;/code&gt;&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Desktop App&lt;/td&gt;
&lt;td&gt;Manages the layout of &lt;strong&gt;spaces &amp;gt; tabs &amp;gt; panes&lt;/strong&gt;. You can split panes left/right and run programs directly in a new pane.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;strong&gt;&lt;code&gt;herdr-core&lt;/code&gt;&lt;/strong&gt; (CLI called &lt;code&gt;hc&lt;/code&gt;)&lt;/td&gt;
&lt;td&gt;Terminal Core&lt;/td&gt;
&lt;td&gt;Responsible for running " &lt;strong&gt;terminals that don't die when the window is closed&lt;/strong&gt;," providing commands like run / send / wait / read / keys / get for Agents to operate other terminals.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;A small side note: I initially told Claude Code to "use &lt;code&gt;herdr --skill&lt;/code&gt; to learn first," but the &lt;code&gt;herdr&lt;/code&gt; command couldn't be found—the actual executables are &lt;code&gt;~/.local/bin/herdr-app&lt;/code&gt; and &lt;code&gt;~/.local/bin/herdr-core&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. &lt;code&gt;--skill&lt;/code&gt;: An Instruction Manual for AI Agents
&lt;/h2&gt;

&lt;p&gt;I think Herdr's smartest design is that &lt;strong&gt;both CLIs have a &lt;code&gt;--skill&lt;/code&gt; parameter&lt;/strong&gt;. Running &lt;code&gt;herdr-app --skill&lt;/code&gt; and &lt;code&gt;herdr-core --skill&lt;/code&gt; prints an "instruction manual for AI Agents."&lt;/p&gt;

&lt;p&gt;So, Claude Code's first step wasn't to blindly try commands, but to &lt;strong&gt;read both manuals before starting&lt;/strong&gt;. The manuals contain many sensible guidelines, such as: background Agents must use &lt;code&gt;--bg&lt;/code&gt;, provide a name and clear scope, don't let sub-agents spawn more sub-agents, and use &lt;code&gt;hc wait&lt;/code&gt; instead of &lt;strong&gt;sleep polling&lt;/strong&gt; when waiting.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Core Command Cheat Sheet
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Command&lt;/th&gt;
&lt;th&gt;Purpose&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;$HC_TERMINAL_ID&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Every terminal has an address; Claude Code itself is &lt;strong&gt;&lt;code&gt;t4&lt;/code&gt;&lt;/strong&gt;.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;hc run --bg --name xxx &amp;lt;agent&amp;gt; "&amp;lt;task&amp;gt;"&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Start a named Agent in the background and assign a task.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;herdr-app do pane.split --direction right --pane &amp;lt;id&amp;gt; --argv [...]&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Split the pane to the right on the screen and run a program in the new pane.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;hc send &amp;lt;t&amp;gt; "..."&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Paste text and press Enter; used to assign tasks or provide Review feedback.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;hc wait &amp;lt;t&amp;gt;&lt;/code&gt; / &lt;code&gt;hc wait --children all&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;Wait for the other party to finish (replaces sleep polling).&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;hc read &amp;lt;t&amp;gt; --lines 0&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Read the other party's entire current screen.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;hc keys &amp;lt;t&amp;gt; enter&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Send a keystroke, such as answering a permission dialog.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;hc get &amp;lt;t&amp;gt;&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Check status: &lt;code&gt;idle&lt;/code&gt; / &lt;code&gt;working&lt;/code&gt; / &lt;code&gt;blocked&lt;/code&gt; / &lt;code&gt;done&lt;/code&gt;; when &lt;code&gt;blocked&lt;/code&gt;, it includes a &lt;code&gt;msg&lt;/code&gt;, e.g., &lt;code&gt;Approve RunCommand: ...&lt;/code&gt;.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  4. Agent-to-Agent Communication Channel
&lt;/h2&gt;

&lt;p&gt;This is the most critical piece of the collaboration. When assigning a task, I would require agy: "When finished, please run &lt;code&gt;herdr-core send t4 '...'&lt;/code&gt; to report back." After agy finishes, that message &lt;strong&gt;appears directly in Claude Code's input&lt;/strong&gt;, looking like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;hc&lt;/span&gt; &lt;span class="na"&gt;from&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"t7"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;ready for review #57 ...&lt;span class="nt"&gt;&amp;lt;/hc&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In other words, Claude Code doesn't need to keep staring at the right screen; agy will "knock on the door" when done. Reporting is asynchronous, and every message carries a source address for tracking.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. Layout Configuration
&lt;/h2&gt;

&lt;p&gt;The first time I had Claude Code open agy, it used &lt;code&gt;hc run --bg&lt;/code&gt; to run it in the background—it worked functionally, but I couldn't see what agy was doing. So, the second time, I specifically requested "&lt;strong&gt;in a pane on the right&lt;/strong&gt;," and Claude Code used &lt;code&gt;herdr-app do pane.split&lt;/code&gt; to open agy on the right. The final configuration was:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight dot"&gt;&lt;code&gt;&lt;span class="n"&gt;flowchart&lt;/span&gt; &lt;span class="no"&gt;LR&lt;/span&gt;
    &lt;span class="n"&gt;subgraph&lt;/span&gt; &lt;span class="nc"&gt;Herdr&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"Herdr Window (Same Tab)"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
        &lt;span class="n"&gt;direction&lt;/span&gt; &lt;span class="no"&gt;LR&lt;/span&gt;
        &lt;span class="no"&gt;CC&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"Left Pane: Claude Code (t4)&amp;lt;br/&amp;gt;Controller / Reviewer&amp;lt;br/&amp;gt;Opens Issues, views diffs, runs go test -race, approves"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
        &lt;span class="no"&gt;AGY&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"Middle Pane: agy (t7)&amp;lt;br/&amp;gt;Implementer&amp;lt;br/&amp;gt;Code Review, modifies code, runs tests, commit/push"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
        &lt;span class="no"&gt;BLOG&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"Right Pane: Claude Code&amp;lt;br/&amp;gt;Blog Writer&amp;lt;br/&amp;gt;(The one writing this article)"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
    &lt;span class="n"&gt;end&lt;/span&gt;
    &lt;span class="nc"&gt;Human&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"Me (Human)&amp;lt;br/&amp;gt;Can see every Pane, can intervene anytime"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="no"&gt;CC&lt;/span&gt; &lt;span class="o"&gt;--&amp;gt;|&lt;/span&gt;&lt;span class="s2"&gt;"hc send: Assign tasks / Review feedback"&lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="no"&gt;AGY&lt;/span&gt;
    &lt;span class="no"&gt;AGY&lt;/span&gt; &lt;span class="o"&gt;--&amp;gt;|&lt;/span&gt;&lt;span class="s2"&gt;"herdr-core send t4: ready for review #N"&lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="no"&gt;CC&lt;/span&gt;
    &lt;span class="no"&gt;CC&lt;/span&gt; &lt;span class="o"&gt;--&amp;gt;|&lt;/span&gt;&lt;span class="s2"&gt;"hc keys: Grant read-only permissions"&lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="no"&gt;AGY&lt;/span&gt;
    &lt;span class="no"&gt;CC&lt;/span&gt; &lt;span class="o"&gt;--&amp;gt;|&lt;/span&gt;&lt;span class="s2"&gt;"hc send: Write blog"&lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="no"&gt;BLOG&lt;/span&gt;
    &lt;span class="no"&gt;BLOG&lt;/span&gt; &lt;span class="o"&gt;--&amp;gt;|&lt;/span&gt;&lt;span class="s2"&gt;"herdr-core send t4: blog draft ready"&lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="no"&gt;CC&lt;/span&gt;
    &lt;span class="nc"&gt;Human&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="no"&gt;CC&lt;/span&gt;
    &lt;span class="nc"&gt;Human&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="no"&gt;AGY&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h1&gt;
  
  
  2. Round One: Let agy be the Reviewer
&lt;/h1&gt;

&lt;p&gt;The first task was simple: ask agy to review the Go code under &lt;code&gt;backend/&lt;/code&gt;, &lt;strong&gt;read-only, no subagents&lt;/strong&gt;, and write the results to a file, reporting back with &lt;code&gt;hc send t4&lt;/code&gt; when finished.&lt;/p&gt;

&lt;p&gt;agy's interface showed it was running &lt;strong&gt;Claude Sonnet 5.5 (plan mode)&lt;/strong&gt;, and it eventually produced &lt;strong&gt;17 issues, sorted by importance&lt;/strong&gt;. Claude Code helped me organize them into three categories:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Category&lt;/th&gt;
&lt;th&gt;Issues found by agy&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Concurrency and Data Integrity&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;During Re-annotate (one Gemini call can take up to 5 mins), if I modify lyrics on the proofreading page, the write-back will be overwritten—the two sides use &lt;strong&gt;different mutexes&lt;/strong&gt;; &lt;code&gt;EditLine&lt;/code&gt;'s global lock spans across Firestore calls; &lt;code&gt;WriteAtomic&lt;/code&gt;'s temporary filename is fixed as &lt;code&gt;.tmp&lt;/code&gt;.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Resource Limits and Leaks&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;TTS generation has no concurrency limit (this is a paid API); the failure cache only grows and stores duplicates; 429 errors without &lt;code&gt;Retry-After&lt;/code&gt; have no rate limiting at all; &lt;code&gt;TeacherVoice&lt;/code&gt; re-reads &lt;code&gt;voices.json&lt;/code&gt; every time and holds a global lock during network calls; request bodies lack &lt;code&gt;MaxBytesReader&lt;/code&gt;; background jobs use &lt;code&gt;context.Background()&lt;/code&gt;, so they aren't cancelled on shutdown.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Performance and Structure&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;listSongs&lt;/code&gt; parses all songs sequentially and reads progress for each; demonstration audio is read entirely into memory before being returned; the same Error type exists in 3–4 places; CLI &lt;code&gt;speak&lt;/code&gt; and &lt;code&gt;tts.Service&lt;/code&gt; logic are redundant.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Here is a detail I really liked: &lt;strong&gt;Claude Code did not accept everything blindly&lt;/strong&gt;. Before opening an Issue, it first used grep to verify the most important one—"re-annotate and review use different mutexes"—and only after confirming it was true did it start opening Issues. The Reviewer's conclusions also need to be Reviewed.&lt;/p&gt;




&lt;h1&gt;
  
  
  3. Round Two: Open Issue → agy Fixes → Claude Code Reviews → Commit only if passed
&lt;/h1&gt;

&lt;p&gt;My instructions to Claude Code were:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"Open issues and fix them sequentially. Mainly let the agy pane on the right do the modifications. You are responsible for reviewing and giving feedback. Only after you approve should agy commit and push."&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  1. Consolidating 17 items into 5 Issues
&lt;/h2&gt;

&lt;p&gt;Claude Code consolidated the 17 items into &lt;strong&gt;5 Issues (#57–#61)&lt;/strong&gt;, all performed on the same branch &lt;code&gt;go-review-fixes&lt;/code&gt;, with &lt;strong&gt;one commit per Issue&lt;/strong&gt;, and commit messages including &lt;code&gt;Fixes #N&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Collaboration Workflow for Each Round
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sequenceDiagram
    participant CC as Claude Code (t4)&amp;lt;br/&amp;gt;Reviewer
    participant AGY as agy (t7)&amp;lt;br/&amp;gt;Implementer
    participant GH as GitHub

    CC-&amp;gt;&amp;gt;AGY: hc send: Issue #N task + implementation points + "do not commit"
    AGY-&amp;gt;&amp;gt;AGY: Implementation + gofmt -l . &amp;amp;&amp;amp; go vet ./... &amp;amp;&amp;amp; go test ./...
    AGY-&amp;gt;&amp;gt;CC: herdr-core send t4 'ready for review #N'
    CC-&amp;gt;&amp;gt;CC: git diff + run go test -race personally
    alt Has issues
        CC-&amp;gt;&amp;gt;AGY: hc send: Review feedback
        AGY-&amp;gt;&amp;gt;CC: Report back again after fix
    end
    CC-&amp;gt;&amp;gt;AGY: Approved, you may commit &amp;amp; push
    AGY-&amp;gt;&amp;gt;GH: git commit (Fixes #N) + push
    AGY-&amp;gt;&amp;gt;CC: Report commit sha
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  3. What did the Review actually catch?
&lt;/h2&gt;

&lt;p&gt;This is the part I want to share the most. Out of the 5 Issues, &lt;strong&gt;3 required a second round of fixes, and 2 passed on the first try&lt;/strong&gt;:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Issue&lt;/th&gt;
&lt;th&gt;Topic&lt;/th&gt;
&lt;th&gt;Review Result&lt;/th&gt;
&lt;th&gt;Commit&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;#57&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Per-song lock&lt;/td&gt;
&lt;td&gt;Design correct, but &lt;strong&gt;no tests written&lt;/strong&gt; → requested them&lt;/td&gt;
&lt;td&gt;&lt;code&gt;e5df5f4&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;#58&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;TTS concurrency limit and failure cache&lt;/td&gt;
&lt;td&gt;Caught &lt;strong&gt;error message regression&lt;/strong&gt; → requested fix and tests&lt;/td&gt;
&lt;td&gt;&lt;code&gt;d67ec5a&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;#59&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Request limits, timeout, graceful shutdown&lt;/td&gt;
&lt;td&gt;Caught &lt;strong&gt;shutdown sequence and time budget errors&lt;/strong&gt; → redesigned&lt;/td&gt;
&lt;td&gt;&lt;code&gt;de38741&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;#60&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Song list concurrency, demo audio streaming&lt;/td&gt;
&lt;td&gt;✅ Passed first try&lt;/td&gt;
&lt;td&gt;&lt;code&gt;bc1615a&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;#61&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Unified error types, CLI refactor, signal handling&lt;/td&gt;
&lt;td&gt;✅ Passed first try&lt;/td&gt;
&lt;td&gt;&lt;code&gt;deb1fb7&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h3&gt;
  
  
  #57: Design was right, but where are the tests?
&lt;/h3&gt;

&lt;p&gt;agy's per-song lock design was correct. Claude Code also specifically confirmed one thing: manual translations and the &lt;code&gt;reviewed&lt;/code&gt; flag are both written into the transcript, so "comparing the entire transcript before writing back" indeed catches all edits.&lt;/p&gt;

&lt;p&gt;But agy didn't write tests. So Claude Code requested extracting the logic into &lt;code&gt;saveAnnotation&lt;/code&gt; and adding two cases: &lt;strong&gt;normal write when unchanged&lt;/strong&gt;, and &lt;strong&gt;return conflict and no write when edited&lt;/strong&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  #58: Delete one map, and the frontend doesn't know why it failed
&lt;/h3&gt;

&lt;p&gt;While cleaning up the failure cache, agy deleted the server-side &lt;code&gt;recentErrors&lt;/code&gt;. All tests passed, but Claude Code caught a regression:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;When the TTS quota is exhausted, &lt;strong&gt;"other sentences that have never been generated"&lt;/strong&gt; checking &lt;code&gt;?error&lt;/code&gt; would get &lt;code&gt;{error: null}&lt;/code&gt;—the frontend then couldn't display the reason "quota exhausted."&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The fix was to make &lt;code&gt;LastError&lt;/code&gt; &lt;strong&gt;return a still-valid quota error when there is no failure record for that sentence&lt;/strong&gt;, and add a test.&lt;/p&gt;

&lt;h3&gt;
  
  
  #59: Cloud Run gives you about 10s, but you scheduled 20s
&lt;/h3&gt;

&lt;p&gt;This was the most valuable bug catch in my opinion. The graceful shutdown agy wrote was: &lt;code&gt;srv.Shutdown&lt;/code&gt; waits 10s, then background jobs wait another 10s. There were two problems:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Cloud Run only gives about 10s after sending SIGTERM&lt;/strong&gt;, so the two segments combined exceeded the budget.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Re-analysis runs synchronously within the HTTP request&lt;/strong&gt;. &lt;code&gt;srv.Shutdown&lt;/code&gt; would wait for it to finish, but its context hadn't been cancelled yet—it was essentially waiting for itself.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Claude Code requested changing it to a &lt;strong&gt;single 9-second deadline&lt;/strong&gt; and adjusting the sequence:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Single deadline, leaving a bit of buffer for Cloud Run's SIGTERM grace period&lt;/span&gt;
&lt;span class="n"&gt;ctx&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;cancel&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;context&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;WithTimeout&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;context&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Background&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;9&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;time&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Second&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;defer&lt;/span&gt; &lt;span class="nf"&gt;cancel&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="n"&gt;runner&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Cancel&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;// 1. Cancel background and ongoing analysis work first&lt;/span&gt;
&lt;span class="n"&gt;srv&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Shutdown&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;ctx&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;// 2. Then shut down HTTP server (sync analysis already cancelled, won't hang)&lt;/span&gt;
&lt;span class="n"&gt;runner&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Wait&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;ctx&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="c1"&gt;// 3. Finally wait for jobs to wrap up within the same deadline&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;(The above is illustrative of the sequence and single-deadline concept.)&lt;/p&gt;

&lt;h3&gt;
  
  
  #60, #61: Passed first try
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;#60&lt;/strong&gt;: Song list changed to &lt;strong&gt;bounded concurrency 8&lt;/strong&gt;, so a single song progress read failure won't drag down the whole list; generated demo audio now uses &lt;code&gt;*os.File&lt;/code&gt; + &lt;code&gt;ModTime&lt;/code&gt; handed to &lt;code&gt;http.ServeContent&lt;/code&gt; for streaming (getting Range and Last-Modified for free).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;#61&lt;/strong&gt;: Unified error types to &lt;code&gt;apierr.Error&lt;/code&gt;, CLI &lt;code&gt;speak&lt;/code&gt; now uses &lt;code&gt;tts.Service.GenerateAll&lt;/code&gt;, switched to &lt;code&gt;signal.NotifyContext&lt;/code&gt;, and daily quota checks now use type fields instead of string comparisons.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Looking back at these three rejected Issues, there's a common theme: &lt;strong&gt;they were all "tests pass, but it hurts in production" problems&lt;/strong&gt;—test gaps, frontend error message regressions, and shutdown sequences. This is exactly the greatest value of "one writing, one reviewing."&lt;/p&gt;




&lt;h1&gt;
  
  
  4. Round Three: PR, Merge, Deployment, and Verification
&lt;/h1&gt;

&lt;p&gt;After all 5 commits passed, &lt;strong&gt;PR #62&lt;/strong&gt; was opened and merged, and #57–#61 were automatically closed. Then, a new revision was deployed using &lt;code&gt;gcloud run deploy --source .&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Post-deployment verification was completed by Claude Code running &lt;code&gt;fetch&lt;/code&gt; directly through a &lt;strong&gt;Chrome instance logged into IAP&lt;/strong&gt;:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Verification Item&lt;/th&gt;
&lt;th&gt;Result&lt;/th&gt;
&lt;th&gt;Corresponding Change&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Homepage &lt;code&gt;/api/songs&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;200&lt;/code&gt; (10 songs)&lt;/td&gt;
&lt;td&gt;#60 Concurrent reading&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Learning page&lt;/td&gt;
&lt;td&gt;&lt;code&gt;200&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;—&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Generated demo audio&lt;/td&gt;
&lt;td&gt;&lt;code&gt;200 audio/wav&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;#60 Streaming&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Demo audio Range request&lt;/td&gt;
&lt;td&gt;&lt;code&gt;206&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;#60 &lt;code&gt;http.ServeContent&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;With &lt;code&gt;If-Modified-Since&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;304&lt;/code&gt; (&lt;strong&gt;New feature&lt;/strong&gt;: now has &lt;code&gt;Last-Modified&lt;/code&gt;)&lt;/td&gt;
&lt;td&gt;#60 &lt;code&gt;ModTime&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;PATCH with 70 KB&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;413&lt;/code&gt; "Request content too large."&lt;/td&gt;
&lt;td&gt;#59 &lt;code&gt;MaxBytesReader&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Cloud Logging&lt;/td&gt;
&lt;td&gt;Only two WARNINGs, both from the test requests themselves&lt;/td&gt;
&lt;td&gt;—&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The previous revision was also kept, allowing for an immediate rollback if needed.&lt;/p&gt;




&lt;h1&gt;
  
  
  5. Six "Devil in the Details" Moments from Using Herdr for the First Time
&lt;/h1&gt;

&lt;h2&gt;
  
  
  Detail 1: &lt;code&gt;agy "prompt"&lt;/code&gt; will exit with code 2
&lt;/h2&gt;

&lt;p&gt;Intuitively, you might start agy like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="n"&gt;agy&lt;/span&gt; &lt;span class="s2"&gt;"Please review the Go code in backend/..."&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The result is an immediate error and exit (exit 2):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Prompts are read only from -p/--print, -i/--prompt-interactive, or stdin
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The correct way is &lt;strong&gt;&lt;code&gt;agy -i "..."&lt;/code&gt;&lt;/strong&gt;—interactive startup with an initial task. The Herdr manual also warns &lt;strong&gt;not to use &lt;code&gt;-p&lt;/code&gt; one-off mode&lt;/strong&gt;, because the Agent needs to remain "observable and follow-upable" to conduct the Review back-and-forth.&lt;/p&gt;

&lt;h2&gt;
  
  
  Detail 2: Trust dialog on first entering a folder
&lt;/h2&gt;

&lt;p&gt;The first time you start agy in a folder, it pops up "&lt;strong&gt;Do you trust the contents of this project?&lt;/strong&gt;". At this point, the &lt;code&gt;hc get&lt;/code&gt; status becomes &lt;code&gt;blocked (auth)&lt;/code&gt;. Claude Code just needs to use &lt;code&gt;hc keys go-review enter&lt;/code&gt; to confirm.&lt;/p&gt;

&lt;h2&gt;
  
  
  Detail 3: A prompt that looks unsent has actually arrived
&lt;/h2&gt;

&lt;p&gt;After opening agy with &lt;code&gt;pane.split&lt;/code&gt;, the screen looks idle, and the initial prompt seems unsent. Claude Code tried to resend it with &lt;code&gt;hc send&lt;/code&gt;, but was blocked by &lt;code&gt;hc&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;t7 is blocked (permission)... typing would answer its dialog; read its screen first
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It turns out the task had already arrived, and agy was just stuck waiting for permission. &lt;strong&gt;This protection mechanism in &lt;code&gt;hc&lt;/code&gt; prevents accidentally typing a task description into a permission dialog&lt;/strong&gt;—if that actually happened, the result could be an unintended approval or rejection of a command.&lt;/p&gt;

&lt;h2&gt;
  
  
  Detail 4: Plan mode can only look, not modify
&lt;/h2&gt;

&lt;p&gt;When agy is in plan mode (read-only research), it can only analyze. To have it start modifying code, you must press &lt;code&gt;shift+tab&lt;/code&gt; to switch modes; Claude Code used &lt;code&gt;hc keys t7 shift+tab&lt;/code&gt; to switch it. The first round of Code Review was perfect for plan mode, and it only switched out when modifications were needed in the second round.&lt;/p&gt;

&lt;h2&gt;
  
  
  Detail 5: Permission Driver—Evolving from "checking status bar" to "reading the whole screen"
&lt;/h2&gt;

&lt;p&gt;Every shell command in agy requires permission. Pressing Enter for each one is too tedious, so Claude Code wrote a small driver script with the following logic:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight dot"&gt;&lt;code&gt;&lt;span class="n"&gt;flowchart&lt;/span&gt; &lt;span class="no"&gt;TD&lt;/span&gt;
    &lt;span class="no"&gt;A&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"hc wait t7"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;--&amp;gt;&lt;/span&gt; &lt;span class="no"&gt;B&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"hc get t7 Check status"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
    &lt;span class="no"&gt;B&lt;/span&gt; &lt;span class="o"&gt;--&amp;gt;|&lt;/span&gt;&lt;span class="s2"&gt;"idle / done"&lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="no"&gt;Z&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"End, wait for agy report"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
    &lt;span class="no"&gt;B&lt;/span&gt; &lt;span class="o"&gt;--&amp;gt;|&lt;/span&gt;&lt;span class="s2"&gt;"blocked"&lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="no"&gt;C&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"hc read Read full permission screen"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
    &lt;span class="no"&gt;C&lt;/span&gt; &lt;span class="o"&gt;--&amp;gt;&lt;/span&gt; &lt;span class="no"&gt;D&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;"Contains dangerous command?&amp;lt;br/&amp;gt;rm -rf / git reset / git checkout&amp;lt;br/&amp;gt;--force / curl / gcloud write operations…"&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="no"&gt;D&lt;/span&gt; &lt;span class="o"&gt;--&amp;gt;|&lt;/span&gt;&lt;span class="s2"&gt;"Yes"&lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="no"&gt;H&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"Stop, let human decide"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
    &lt;span class="no"&gt;D&lt;/span&gt; &lt;span class="o"&gt;--&amp;gt;|&lt;/span&gt;&lt;span class="s2"&gt;"No"&lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="no"&gt;E&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;"Is it git commit / push?"&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="no"&gt;E&lt;/span&gt; &lt;span class="o"&gt;--&amp;gt;|&lt;/span&gt;&lt;span class="s2"&gt;"Yes, and no ALLOW_GIT=1"&lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="no"&gt;H&lt;/span&gt;
    &lt;span class="no"&gt;E&lt;/span&gt; &lt;span class="o"&gt;--&amp;gt;|&lt;/span&gt;&lt;span class="s2"&gt;"No, or Reviewer approved"&lt;/span&gt;&lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="no"&gt;F&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"hc keys t7 enter Grant permission"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
    &lt;span class="no"&gt;F&lt;/span&gt; &lt;span class="o"&gt;--&amp;gt;&lt;/span&gt; &lt;span class="no"&gt;A&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This script was refined several times during the process, each time providing a practical lesson:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Status bar &lt;code&gt;msg&lt;/code&gt; gets truncated&lt;/strong&gt;: Initially, it only looked at the status msg returned by &lt;code&gt;hc get&lt;/code&gt;, but it would be truncated with "...". The truncated part might hide a second command. Changed to &lt;strong&gt;&lt;code&gt;hc read&lt;/code&gt; the entire permission screen&lt;/strong&gt; for judgment.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;gcloud A; gcloud deploy&lt;/code&gt; single-line grep misses&lt;/strong&gt;: Changed to splitting combined commands and &lt;strong&gt;judging each one for read-only status&lt;/strong&gt; (&lt;code&gt;describe&lt;/code&gt; / &lt;code&gt;list&lt;/code&gt; / &lt;code&gt;read&lt;/code&gt; / &lt;code&gt;ls&lt;/code&gt; / &lt;code&gt;du&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Fixing false positives&lt;/strong&gt;: &lt;code&gt;gcloud storage ls&lt;/code&gt; and &lt;code&gt;gcloud storage du&lt;/code&gt; are actually read-only; they were blocked initially but later added to the allowlist.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Detail 6: Boundaries of Permission Granting
&lt;/h2&gt;

&lt;p&gt;The line for automated granting was drawn like this:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Read-only commands&lt;/strong&gt;: Automatically granted.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;git commit&lt;/code&gt; / &lt;code&gt;push&lt;/code&gt;&lt;/strong&gt;: Blocked by default, &lt;strong&gt;only granted with &lt;code&gt;ALLOW_GIT=1&lt;/code&gt; after Claude Code Review passes&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Commands requiring external APIs&lt;/strong&gt; (e.g., agy wanting to use an access token to call the Google Developer Knowledge API for documentation): Stop and let the human decide.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Agents can trust each other enough to say "you can run tests," but "writing to git, writing to the cloud, making external requests" must go through a Reviewer or a human.&lt;/p&gt;




&lt;h1&gt;
  
  
  六、Multi-Agent Collaboration Checklist
&lt;/h1&gt;

&lt;p&gt;If you also want to use Herdr (or similar tools) to have two Agents write and review, you can refer to this checklist:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt; &lt;strong&gt;1. Read the manual before starting&lt;/strong&gt;: Have the controller Agent run &lt;code&gt;herdr-app --skill&lt;/code&gt; and &lt;code&gt;herdr-core --skill&lt;/code&gt; first to confirm actual executable paths.&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;2. Open sub-agents in visible Panes&lt;/strong&gt;: Use &lt;code&gt;pane.split&lt;/code&gt; to open the implementer Agent alongside, so a human can see and intervene at any time.&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;3. Start in interactive mode&lt;/strong&gt;: &lt;code&gt;agy -i "..."&lt;/code&gt;, don't use positional arguments, and don't use &lt;code&gt;-p&lt;/code&gt; one-off mode.&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;4. Clear task scope&lt;/strong&gt;: Specify read-only or not, no sub-agents, "do not commit," and report back using &lt;code&gt;herdr-core send &amp;lt;controller address&amp;gt;&lt;/code&gt; when finished.&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;5. Use &lt;code&gt;hc wait&lt;/code&gt;, not sleep polling&lt;/strong&gt;; before sending text, if the other party is &lt;code&gt;blocked&lt;/code&gt;, &lt;code&gt;hc read&lt;/code&gt; the screen first.&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;6. Verify Reviewer conclusions&lt;/strong&gt;: Before opening an Issue, use grep to confirm the most important findings are true.&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;7. Reviewer runs tests personally&lt;/strong&gt;: For example, &lt;code&gt;go test -race&lt;/code&gt;, don't just rely on the implementer's report.&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;8. Permission Driver reads the whole screen&lt;/strong&gt;: Don't rely on the status bar which can be truncated; judge combined commands individually.&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;9. Gatekeeping for Git and Cloud writes&lt;/strong&gt;: Only allow commit/push after Review passes; leave external API calls to humans.&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;10. Verify new behavior after deployment&lt;/strong&gt;: Don't just look for 200s; verify new limits (413), new headers (304 / 206), and keep the previous revision.&lt;/li&gt;
&lt;/ul&gt;




&lt;h1&gt;
  
  
  7. Next Step: Let agy analyze Cloud Run performance
&lt;/h1&gt;

&lt;p&gt;As I finish writing this, agy on the right is already running the next task: using its GCP skill to analyze song-lingo's performance on Cloud Run—service settings, cold starts, gcsfuse, Firestore, etc.—proposing 5–8 solutions, each with evidence, expected benefits, monthly costs, and risks, for Claude Code to decide which to implement. This part is still ongoing; I'll share more later.&lt;/p&gt;




&lt;h1&gt;
  
  
  Summary
&lt;/h1&gt;

&lt;p&gt;My biggest takeaway from using Herdr for the first time is: &lt;strong&gt;Multi-Agent collaboration is finally "visible."&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;One writing and one reviewing catches blind spots better than doing both yourself&lt;/strong&gt;: 3 out of 5 Issues were rejected, catching "tests pass, production hurts" problems—test gaps, error message regressions, and Cloud Run shutdown sequences.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Agent-to-Agent messaging makes collaboration async and trackable&lt;/strong&gt;: &lt;code&gt;herdr-core send t4 'ready for review #N'&lt;/code&gt; lets the implementer "knock on the door," and the Reviewer uses &lt;code&gt;hc wait&lt;/code&gt; to wait without polling.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Panes keep humans in the loop&lt;/strong&gt;: I can see exactly what commands agy is running in real-time on the right and intervene if necessary.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Permission granting must be measured&lt;/strong&gt;: Read-only can be automated, but writing to git, writing to the cloud, and making external requests must go through Review or a human.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;And this article itself was written by Claude Code in the rightmost Pane of Herdr—after finishing, it will use &lt;code&gt;herdr-core send t4&lt;/code&gt; to report back to the controller on the left.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>backend</category>
      <category>claude</category>
      <category>go</category>
    </item>
    <item>
      <title>[AI Hands-on] Refactoring LINE Business Card Assistant: Python to Go with Antigravity Remote Agent, Google ADK, and Firestore -</title>
      <dc:creator>Evan Lin</dc:creator>
      <pubDate>Sun, 08 Nov 2026 13:39:03 +0000</pubDate>
      <link>https://dev.to/gde/ai-hands-on-refactoring-line-business-card-assistant-python-to-go-with-antigravity-remote-agent-2db9</link>
      <guid>https://dev.to/gde/ai-hands-on-refactoring-line-business-card-assistant-python-to-go-with-antigravity-remote-agent-2db9</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fope9m0q6bm1e1fdd8hlw.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fope9m0q6bm1e1fdd8hlw.jpg" alt="LINE Bot Namecard: Python (FastAPI) → Go 1.27 + Google ADK + Firestore Architecture" width="800" height="447"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Background
&lt;/h1&gt;

&lt;p&gt;Recently, I've been rewriting several of my daily core services from Python to Go. This time, it was the turn of my LINE bot for organizing business cards: &lt;strong&gt;&lt;a href="https://github.com/kkdai/linebot-namecard-python" rel="noopener noreferrer"&gt;&lt;code&gt;kkdai/linebot-namecard-python&lt;/code&gt;&lt;/a&gt;&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;This bot has evolved through several iterations: from the initial &lt;a href="https://dev.to/gde/python-line-bot-contact-manager-evolution-generate-vcard-qr-codes-1mm3"&gt;Gemini Vision recognition + vCard QR Code import&lt;/a&gt;, moving to &lt;a href="https://dev.to/gde/gcp-in-action-migrating-a-line-bot-from-ai-studio-to-vertex-ai-to-solve-429-errors-47jo"&gt;Vertex AI to bypass quota limits&lt;/a&gt;, introducing &lt;a href="https://dev.to/gde/gcp-upgrading-a-line-bot-with-vertex-ai-adk-tools-for-smart-business-cards-and-backup-search-3dpe"&gt;Python ADK dynamic closure Tools&lt;/a&gt;, all the way to adding &lt;a href="https://dev.to/gde/gcp-practical-line-business-card-bot-d46"&gt;Structured Output with disambiguation lists&lt;/a&gt; and &lt;a href="https://dev.to/gde/gcp-in-action-line-business-card-bot-evolution-dual-side-recognition-and-merging-with-gemini-2220"&gt;dual-side business card merging and recognition&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;However, for this refactor to the Go version (&lt;a href="https://github.com/kkdai/linebot-namecard-go" rel="noopener noreferrer"&gt;&lt;code&gt;kkdai/linebot-namecard-go&lt;/code&gt;&lt;/a&gt;), I wanted to challenge a different workflow: &lt;strong&gt;First, hand over the architecture rewrite and unit testing to Google Antigravity's Remote Agent to run automatically in the cloud. Once I returned to my computer, the local &lt;code&gt;agy&lt;/code&gt; CLI would take over to deploy to Cloud Run and switch the LINE Webhook.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;After a full run-through, the results were impressive—the Remote Agent completed the entire Go 1.27 + &lt;code&gt;google.golang.org/adk&lt;/code&gt; + Firestore architecture and tests in the cloud in just 17 minutes and pushed it to GitHub. At the same time, I verified a critical boundary limitation: &lt;strong&gt;You can use &lt;code&gt;agy&lt;/code&gt; to call a Remote Agent, but you "cannot" switch that same Remote Agent conversation to a local Agent to continue.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The first half of this article explains the usage of &lt;strong&gt;Antigravity Remote Agents&lt;/strong&gt;, the reasons for cloud-local isolation, and two practical solutions. The second half provides a complete breakdown of the system architecture upgrade from &lt;code&gt;linebot-namecard-python&lt;/code&gt; to &lt;code&gt;linebot-namecard-go&lt;/code&gt; and the actual handoff deployment troubleshooting record.&lt;/p&gt;




&lt;h1&gt;
  
  
  1. Understanding Antigravity Remote Agents: Handing Heavy Lifting to Cloud Isolated VMs
&lt;/h1&gt;

&lt;p&gt;According to the Google Antigravity official documentation (&lt;a href="https://antigravity.google/docs/remote-agents/" rel="noopener noreferrer"&gt;Remote Agents&lt;/a&gt;), the core concept of &lt;strong&gt;Remote Agents&lt;/strong&gt; is to move autonomous development tasks from your local laptop to a &lt;strong&gt;Google-managed Cloud Sandbox VM&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;This is extremely useful for long-running refactors, large-scale testing, or cross-language rewrites:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Asynchronous Offline Execution&lt;/strong&gt;: Tasks run in a cloud VM. Even if you close your laptop, the computer sleeps, or you lose internet, the Agent continues writing code, running tests, and modifying files.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cross-Device Monitoring and Unlocking&lt;/strong&gt;: You can assign a task from your desktop or CLI and then head out. Mid-way, you can use a mobile browser to open &lt;code&gt;antigravity.google.com&lt;/code&gt; to check progress, approve permissions, or add instructions, eventually receiving a complete GitHub Commit / PR.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Remote Resources&lt;/strong&gt;: Since the Agent runs in a cloud sandbox, file access is handled via three mounting methods: 

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;GitHub Repositories&lt;/strong&gt;: Automatically cloned and mounted into the remote project environment via OAuth authorization.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Google Drive&lt;/strong&gt;: Directly read Google Docs, Sheets, Slides, PDFs, and folders within the conversation.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Local File Upload&lt;/strong&gt;: Upload files directly to the remote project (8 MiB limit per file, max 50 files / 100 MiB per project, 2 GiB total account limit). Files are persistently mounted at &lt;code&gt;/home/antigravity/upload&lt;/code&gt;.&lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Can I call a Remote Agent using the &lt;code&gt;agy&lt;/code&gt; CLI?
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Yes.&lt;/strong&gt; According to the &lt;a href="https://antigravity.google/docs/remote-agents/" rel="noopener noreferrer"&gt;Remote Agents official documentation&lt;/a&gt;, two conditions must be met:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;CLI Version&lt;/strong&gt;: &lt;code&gt;agy&lt;/code&gt; CLI &lt;strong&gt;v1.4.12 or higher&lt;/strong&gt; (my local &lt;code&gt;agy&lt;/code&gt; is currently &lt;code&gt;1.5.3&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Account Eligibility&lt;/strong&gt;: Must be logged into a personal Google account with a &lt;strong&gt;Google AI Pro&lt;/strong&gt; or &lt;strong&gt;Google AI Ultra&lt;/strong&gt; subscription (&lt;strong&gt;Free version, Google AI Plus, and Google Workspace / Cloud enterprise accounts are not supported&lt;/strong&gt;).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Common commands are as follows:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="c"&gt;# Start a remote conversation&lt;/span&gt;
agy &lt;span class="nt"&gt;--remote-agent&lt;/span&gt;

&lt;span class="c"&gt;# Specify an existing remote project or create a brand new one&lt;/span&gt;
agy &lt;span class="nt"&gt;--remote-agent&lt;/span&gt; &lt;span class="nt"&gt;--project&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"Project Name or ID"&lt;/span&gt;
agy &lt;span class="nt"&gt;--remote-agent&lt;/span&gt; &lt;span class="nt"&gt;--new-project&lt;/span&gt;

&lt;span class="c"&gt;# Continue a previous remote conversation&lt;/span&gt;
agy &lt;span class="nt"&gt;--remote-agent&lt;/span&gt; &lt;span class="nt"&gt;-c&lt;/span&gt;
agy &lt;span class="nt"&gt;--remote-agent&lt;/span&gt; &lt;span class="nt"&gt;--conversation&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&amp;lt;conversation_id&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Once in a remote conversation, you can also use &lt;code&gt;/projects&lt;/code&gt; to switch remote projects, or attach GitHub repositories, Google Drive files, and upload local files.&lt;/p&gt;




&lt;h1&gt;
  
  
  2. Key Limitation: Why "Cannot" Switch a Remote Agent Conversation to a Local Agent?
&lt;/h1&gt;

&lt;p&gt;Many developers, when first using &lt;code&gt;--remote-agent&lt;/code&gt;, have an intuitive thought: "&lt;em&gt;I'll let the Remote Agent finish writing the code in the cloud, then when I'm back at my computer, I'll switch the same conversation to a local Agent so it can use my local &lt;code&gt;gcloud&lt;/code&gt; permissions to deploy it!&lt;/em&gt;"&lt;/p&gt;

&lt;p&gt;After testing and consulting the official documentation, the conclusion is: &lt;strong&gt;The execution environments and conversation records of the two are completely isolated. You cannot switch from cloud to local within the same conversation.&lt;/strong&gt; There are three hard reasons for this:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Strict Session Mode Isolation&lt;/strong&gt;: The official documentation explicitly states: a CLI started with &lt;code&gt;--remote-agent&lt;/code&gt; &lt;strong&gt;only opens remote conversations&lt;/strong&gt;; a CLI without &lt;code&gt;--remote-agent&lt;/code&gt; &lt;strong&gt;only opens local conversations&lt;/strong&gt;. Conversation records are stored in different locations (remote conversations are in the cloud remote project, not on the local disk). Currently, there is no command to migrate or continue an ongoing remote session to a local Agent.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Environment and Filesystem Isolation&lt;/strong&gt;: Remote Agents run in a Google-managed cloud isolated environment and can only operate on resources mounted to the remote project (GitHub repo, Google Drive, files uploaded to &lt;code&gt;/home/antigravity/upload&lt;/code&gt;). &lt;strong&gt;They cannot touch your local folders, uncommitted local changes, nor can they use locally installed MCP servers, plugins, skills, or your already logged-in &lt;code&gt;gcloud&lt;/code&gt; / &lt;code&gt;kubectl&lt;/code&gt; / SSH credentials.&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cannot Transfer via &lt;code&gt;/fork&lt;/code&gt;&lt;/strong&gt;: In local conversations, we can use &lt;code&gt;/fork &amp;lt;project_id&amp;gt;&lt;/code&gt; to branch a conversation to another project. However, &lt;code&gt;/fork&lt;/code&gt; is currently on the &lt;strong&gt;list of unsupported features for Remote Agents&lt;/strong&gt; (which also includes &lt;code&gt;/diff&lt;/code&gt;, &lt;code&gt;/rewind&lt;/code&gt;, &lt;code&gt;/btw&lt;/code&gt;, &lt;code&gt;--print&lt;/code&gt;, and &lt;code&gt;!&lt;/code&gt; for executing local commands). Therefore, you cannot fork an ongoing remote conversation back to a local project.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Two Practical Alternatives
&lt;/h2&gt;

&lt;p&gt;Since you cannot directly switch the same conversation, you can choose one of the following two paths based on your workflow:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Comparison Item&lt;/th&gt;
&lt;th&gt;Option A: Remote Agent + GitHub Handoff (Used in this post)&lt;/th&gt;
&lt;th&gt;Option B: &lt;a href="https://antigravity.google/docs/remote-control/" rel="noopener noreferrer"&gt;Remote Control&lt;/a&gt;
&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Startup Method&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;agy --remote-agent&lt;/code&gt; (or &lt;code&gt;antigravity.google.com&lt;/code&gt;)&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;agy --remote-control&lt;/code&gt; / &lt;code&gt;/remote-control&lt;/code&gt; in chat / &lt;code&gt;agy remote-control start&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Agent Execution Location&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Google Cloud Isolated VM&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;Your own local computer&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Can the computer be off/sleeping?&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;
&lt;strong&gt;Yes&lt;/strong&gt; (Continues in the cloud)&lt;/td&gt;
&lt;td&gt;
&lt;strong&gt;No&lt;/strong&gt; (Host must remain on and connected)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Access local files / &lt;code&gt;gcloud&lt;/code&gt; / MCP?&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;No (Remote mounted resources only)&lt;/td&gt;
&lt;td&gt;
&lt;strong&gt;Yes&lt;/strong&gt; (Native use of local toolchain and credentials)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Can continue same chat at computer?&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;No (Must open new local &lt;code&gt;agy&lt;/code&gt; chat and &lt;code&gt;git pull&lt;/code&gt;)&lt;/td&gt;
&lt;td&gt;
&lt;strong&gt;Yes&lt;/strong&gt; (Remote control via phone/browser is the local chat)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Best Scenario&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Out and about / Before bed, offload heavy refactoring to cloud; push to GitHub when done&lt;/td&gt;
&lt;td&gt;Away from desk but want to remotely trigger local tests/deployments, or need local secret env vars/permissions&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Want to "Go offline/shutdown, let cloud run first, then resume locally" → Handoff code via GitHub&lt;/strong&gt;: Bind a GitHub repository to the remote project. Have the Remote Agent commit/push changes and a handoff guide (e.g., a &lt;code&gt;HANDOFF.md&lt;/code&gt;) to a remote branch or open a PR. Once back at your computer, &lt;code&gt;git clone&lt;/code&gt; / &lt;code&gt;git pull&lt;/code&gt; that branch locally, then open a new local &lt;code&gt;agy&lt;/code&gt; conversation (without &lt;code&gt;--remote-agent&lt;/code&gt;) to take over deployment.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Want to "Control from outside, return to computer and seamlessly continue same environment/chat" → Use &lt;a href="https://antigravity.google/docs/remote-control/" rel="noopener noreferrer"&gt;Remote Control&lt;/a&gt;&lt;/strong&gt;: Run the local Agent from the start and use &lt;code&gt;agy --remote-control&lt;/code&gt;, enter &lt;code&gt;/remote-control&lt;/code&gt; in the chat, or use &lt;code&gt;agy remote-control start&lt;/code&gt; as a background service. This way, the Agent always runs on your own computer, and you can monitor/command it via phone or browser (&lt;code&gt;antigravity.google.com&lt;/code&gt;), continuing seamlessly in the same local conversation when you return.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For this &lt;code&gt;linebot-namecard-go&lt;/code&gt; refactor, I chose &lt;strong&gt;Option A&lt;/strong&gt;: Let the cloud Remote Agent focus on writing the entire Go project and handoff documentation to GitHub, then use the local &lt;code&gt;agy&lt;/code&gt; CLI to complete the Cloud Run deployment and LINE Webhook switch.&lt;/p&gt;




&lt;h1&gt;
  
  
  3. Architecture Comparison: &lt;code&gt;linebot-namecard-python&lt;/code&gt; vs. &lt;code&gt;linebot-namecard-go&lt;/code&gt;
&lt;/h1&gt;

&lt;p&gt;Before diving into implementation details, let's look at the architectural differences between the &lt;strong&gt;Python + FastAPI&lt;/strong&gt; version and the &lt;strong&gt;Go 1.27 + Google ADK + Cloud Firestore&lt;/strong&gt; version:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Comparison Item&lt;/th&gt;
&lt;th&gt;Original Python Version (&lt;a href="https://github.com/kkdai/linebot-namecard-python" rel="noopener noreferrer"&gt;&lt;code&gt;linebot-namecard-python&lt;/code&gt;&lt;/a&gt;)&lt;/th&gt;
&lt;th&gt;New Go Version (&lt;a href="https://github.com/kkdai/linebot-namecard-go" rel="noopener noreferrer"&gt;&lt;code&gt;linebot-namecard-go&lt;/code&gt;&lt;/a&gt;)&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Language &amp;amp; Web Framework&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Python + FastAPI + &lt;code&gt;AsyncLineBotApi&lt;/code&gt; (&lt;code&gt;aiohttp&lt;/code&gt;)&lt;/td&gt;
&lt;td&gt;
&lt;strong&gt;Go 1.27.3&lt;/strong&gt; (&lt;code&gt;cmd/server&lt;/code&gt;) + Standard &lt;code&gt;net/http&lt;/code&gt; + &lt;code&gt;line-bot-sdk-go/v8&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Container Base Image&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Python Image (includes Pillow, etc.)&lt;/td&gt;
&lt;td&gt;Multi-stage &lt;code&gt;golang:1.27-bookworm&lt;/code&gt; → &lt;strong&gt;&lt;code&gt;gcr.io/distroless/static-debian12&lt;/code&gt;&lt;/strong&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;ADK Agent &amp;amp; Runner Lifecycle&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;
&lt;strong&gt;Every message received&lt;/strong&gt; dynamically recreates closures, &lt;code&gt;Agent&lt;/code&gt;, and &lt;code&gt;Runner&lt;/code&gt; in &lt;code&gt;handle_smart_query&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;
&lt;strong&gt;Singleton resident at startup&lt;/strong&gt; shared &lt;code&gt;llmagent.New&lt;/code&gt; + &lt;code&gt;runner.New&lt;/code&gt;, with 5 strongly-typed &lt;code&gt;functiontool&lt;/code&gt;s&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;ADK Session &amp;amp; Memory&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Every request &lt;code&gt;new&lt;/code&gt;s a temporary &lt;code&gt;InMemorySessionService()&lt;/code&gt; (&lt;strong&gt;Forgotten after request&lt;/strong&gt;, no cross-chat memory)&lt;/td&gt;
&lt;td&gt;
&lt;strong&gt;Dual-layer common memory + Cloud Firestore persistence&lt;/strong&gt;: &lt;code&gt;FirestoreSessionService&lt;/code&gt; (&lt;code&gt;adk_sessions&lt;/code&gt;, supports cold start Hydrate) + &lt;code&gt;FirestoreMemoryService&lt;/code&gt; (&lt;code&gt;adk_memories&lt;/code&gt;)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Multi-step Interaction State (&lt;code&gt;UserState&lt;/code&gt;)&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Global Python &lt;code&gt;dict&lt;/code&gt; (&lt;code&gt;user_states = {}&lt;/code&gt;), lost immediately on container restart or multi-instance&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;UserStateStore&lt;/code&gt; (&lt;code&gt;sync.RWMutex&lt;/code&gt; memory cache + Firestore &lt;code&gt;user_states&lt;/code&gt; collection + 300s TTL auto-cleanup &lt;code&gt;SweepExpiredStates&lt;/code&gt;)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Business Card DB Strategy&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Supports Firebase Realtime Database only (&lt;code&gt;namecard/{user_id}&lt;/code&gt;)&lt;/td&gt;
&lt;td&gt;
&lt;strong&gt;Dual Database Compatibility (&lt;code&gt;CardRepository&lt;/code&gt;)&lt;/strong&gt;: Supports read/write for both existing Firebase RTDB and Cloud Firestore (&lt;code&gt;namecards/{user_id}/cards/{card_id}&lt;/code&gt;), zero-migration compatibility&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Gemini Vision OCR&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;google-genai&lt;/code&gt; (Python) + &lt;code&gt;NAMECARD_SCHEMA&lt;/code&gt; + Pillow&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;google.golang.org/genai&lt;/code&gt; (&lt;code&gt;BackendVertexAI&lt;/code&gt;, &lt;code&gt;gemini-3-flash-preview&lt;/code&gt;) + &lt;code&gt;NamecardSchema()&lt;/code&gt; + Go standard &lt;code&gt;image/jpeg&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Deployment &amp;amp; Rollback&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Manual &lt;code&gt;gcloud run deploy&lt;/code&gt;, manual Webhook URL update&lt;/td&gt;
&lt;td&gt;One-click script &lt;a href="https://github.com/kkdai/linebot-namecard-go/blob/main/scripts/deploy_and_switch_webhook.sh" rel="noopener noreferrer"&gt;&lt;code&gt;scripts/deploy_and_switch_webhook.sh&lt;/code&gt;&lt;/a&gt; auto-copies env vars, switches and tests LINE Webhook, supports &lt;code&gt;--rollback&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;h1&gt;
  
  
  4. First Leg (Cloud Remote Agent): Rewrite and Handoff Design Completed in 17 Minutes
&lt;/h1&gt;

&lt;p&gt;Looking at the GitHub Commit history for this cloud Remote Agent session, the pace was nothing short of "aggressive":&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;16:21&lt;/code&gt;: Created empty &lt;code&gt;kkdai/linebot-namecard-go&lt;/code&gt; (Initial commit)&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;16:38&lt;/code&gt;: &lt;strong&gt;In just 17 minutes&lt;/strong&gt;, submitted 22 files, &lt;strong&gt;4,432 lines&lt;/strong&gt; of Go code, complete unit tests, &lt;a href="https://github.com/kkdai/linebot-namecard-go/blob/main/ROADMAP.md" rel="noopener noreferrer"&gt;ROADMAP.md&lt;/a&gt;, and &lt;code&gt;Dockerfile&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;16:45&lt;/code&gt;: Added deployment and LINE Webhook switching script &lt;code&gt;scripts/deploy_and_switch_webhook.sh&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;16:56&lt;/code&gt;: Wrote the &lt;a href="https://github.com/kkdai/linebot-namecard-go/blob/main/HANDOFF.md" rel="noopener noreferrer"&gt;&lt;code&gt;HANDOFF.md&lt;/code&gt;&lt;/a&gt; specifically for the local &lt;code&gt;agy&lt;/code&gt; CLI to take over.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Beyond a 100% feature port, the Remote Agent helped fix three architectural debts left over from the Python version:&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Ending Python's "Amnesia per Message": &lt;code&gt;FirestoreSessionService&lt;/code&gt; + &lt;code&gt;FirestoreMemoryService&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;Looking back at the old Python &lt;code&gt;app/line_handlers.py&lt;/code&gt;, the ADK integration was written like this to get it working quickly:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="c1"&gt;# ❌ Old Python way: Recreates a brand new InMemorySessionService every time a message is received
&lt;/span&gt;&lt;span class="n"&gt;runner&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Runner&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;app_name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;namecard_bot_app&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;agent&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;agent&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;session_service&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nc"&gt;InMemorySessionService&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This led to a glaring issue: &lt;strong&gt;When a user asked "Help me find John Doe" and followed up with "What is his phone number?", the Agent had no memory of who was being discussed in the previous turn&lt;/strong&gt; (because the &lt;code&gt;InMemorySessionService&lt;/code&gt; was garbage collected at the end of the previous request).&lt;/p&gt;

&lt;p&gt;In the Go version &lt;a href="https://github.com/kkdai/linebot-namecard-go/blob/main/internal/memory/memory.go" rel="noopener noreferrer"&gt;&lt;code&gt;internal/memory/memory.go&lt;/code&gt;&lt;/a&gt;, we implemented the official &lt;code&gt;google.golang.org/adk/session.Service&lt;/code&gt; and &lt;code&gt;memory.Service&lt;/code&gt; interfaces, creating a &lt;strong&gt;dual-layer common memory + Cloud Firestore persistence&lt;/strong&gt; architecture:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Hot Path Memory R/W&lt;/strong&gt;: Normal operations hit &lt;code&gt;session.InMemoryService()&lt;/code&gt; directly, maintaining millisecond latency.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Sync Changes to Firestore&lt;/strong&gt;: After every &lt;code&gt;Create&lt;/code&gt; or &lt;code&gt;AppendEvent&lt;/code&gt;, conversation events and State are synced to the &lt;code&gt;adk_sessions&lt;/code&gt; collection. At the end of each turn, &lt;code&gt;FirestoreMemoryService&lt;/code&gt; syncs summaries to &lt;code&gt;adk_memories&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cold Start Hydration&lt;/strong&gt;: When Cloud Run scales to 0 and cold starts with empty memory, any &lt;code&gt;Get&lt;/code&gt; miss in memory automatically triggers &lt;code&gt;hydrateFromFirestoreIfNeeded&lt;/code&gt; to pull history and State from Firestore, enabling continuous follow-up questions across sessions and cold starts.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Test-Friendly Design&lt;/strong&gt;: When &lt;code&gt;DocumentStore&lt;/code&gt; is &lt;code&gt;nil&lt;/code&gt; (e.g., running &lt;code&gt;go test&lt;/code&gt; locally without cloud connection), it automatically runs in pure memory mode, allowing full process testing without Mock Servers.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="c"&gt;// internal/memory/memory.go: Automatically restore ADK Session from Firestore on cold start&lt;/span&gt;
&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;s&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;FirestoreSessionService&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="n"&gt;Get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;ctx&lt;/span&gt; &lt;span class="n"&gt;context&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Context&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;req&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;session&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;GetRequest&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;session&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;GetResponse&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;error&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;mu&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Lock&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="k"&gt;defer&lt;/span&gt; &lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;mu&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Unlock&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

    &lt;span class="n"&gt;resp&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;inMemory&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;ctx&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;req&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="no"&gt;nil&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;resp&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="no"&gt;nil&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="c"&gt;// Memory miss (e.g., Cloud Run cold start), try to restore from Firestore adk_sessions&lt;/span&gt;
    &lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;hydrateFromFirestoreIfNeeded&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;ctx&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;req&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;AppName&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;req&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;UserID&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;req&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;SessionID&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;inMemory&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;ctx&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;req&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  2. Interaction State Machine &lt;code&gt;UserStateStore&lt;/code&gt;: Memory Cache + Firestore + 300s TTL Cleanup
&lt;/h2&gt;

&lt;p&gt;The business card bot has many "cross-turn states," such as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Waiting for confirmation after sending a front-side photo: "Does this card have a back side?" (&lt;code&gt;pending_backside_confirm&lt;/code&gt;) and waiting for the back-side upload (&lt;code&gt;awaiting_backside_image&lt;/code&gt;, containing &lt;code&gt;FrontImageBytes&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;Preparing to enter a memo (&lt;code&gt;adding_memo&lt;/code&gt;) or edit a specific field (&lt;code&gt;editing_field&lt;/code&gt;) after a button click.&lt;/li&gt;
&lt;li&gt;Safety confirmation before an AI tool triggers an update (&lt;code&gt;pending_update&lt;/code&gt;).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In the Python version, these were all stuffed into a global &lt;code&gt;user_states = {}&lt;/code&gt; dictionary. The Go version &lt;a href="https://github.com/kkdai/linebot-namecard-go/blob/main/internal/memory/memory.go" rel="noopener noreferrer"&gt;&lt;code&gt;UserStateStore&lt;/code&gt;&lt;/a&gt; uses a &lt;code&gt;sync.RWMutex&lt;/code&gt; protected memory cache paired with a Firestore &lt;code&gt;user_states&lt;/code&gt; collection. It triggers &lt;code&gt;SweepExpiredStates&lt;/code&gt; on every Webhook entry to automatically clear front-side image buffers that haven't been completed within 300 seconds.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Upgrading from "Closure per Request" to "Resident Singleton ADK Runner + 5 Strongly-Typed &lt;code&gt;functiontool&lt;/code&gt;s"
&lt;/h2&gt;

&lt;p&gt;To isolate business card data for different LINE users, the Python version had to call &lt;code&gt;make_adk_tools(user_id, found_card_ids)&lt;/code&gt; every time a text message was received to generate 5 closure functions to wrap into a new &lt;code&gt;Agent&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;In the Go version &lt;a href="https://github.com/kkdai/linebot-namecard-go/blob/main/internal/agent/agent.go" rel="noopener noreferrer"&gt;&lt;code&gt;internal/agent/agent.go&lt;/code&gt;&lt;/a&gt;, we create &lt;strong&gt;one set of resident shared &lt;code&gt;llmagent.New&lt;/code&gt; (&lt;code&gt;gemini-3-flash-preview&lt;/code&gt;) and &lt;code&gt;runner.New&lt;/code&gt;&lt;/strong&gt; at startup in &lt;code&gt;main.go&lt;/code&gt;, registering 5 strongly-typed &lt;code&gt;functiontool&lt;/code&gt;s:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;get_all_namecards&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;get_namecard_by_id&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;display_namecard&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;update_namecard_memo&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;update_namecard_field&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;When tools execute, they use &lt;code&gt;tctx.UserID()&lt;/code&gt; from the ADK-provided &lt;code&gt;adkagent.ToolContext&lt;/code&gt; to isolate user data. It also automatically triggers &lt;code&gt;FallbackKeywordSearch&lt;/code&gt; for local keyword backup search if Vertex AI or the network fails.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Dual DB Compatibility &lt;code&gt;CardRepository&lt;/code&gt; + Forced &lt;code&gt;GOOGLE_CLOUD_LOCATION=global&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;To ensure existing users' business cards don't disappear during the switch, the &lt;code&gt;StoreRepository&lt;/code&gt; in &lt;a href="https://github.com/kkdai/linebot-namecard-go/blob/main/internal/storage/storage.go" rel="noopener noreferrer"&gt;&lt;code&gt;internal/storage/storage.go&lt;/code&gt;&lt;/a&gt; supports both &lt;strong&gt;Firebase Realtime Database (&lt;code&gt;namecard/{user_id}&lt;/code&gt;)&lt;/strong&gt; and &lt;strong&gt;Cloud Firestore (&lt;code&gt;namecards/{user_id}/cards/{card_id}&lt;/code&gt;)&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Queries prioritize compatibility with existing Firebase RTDB data while supporting Firestore reads. New entries and updates are synced to both.&lt;/li&gt;
&lt;li&gt;In &lt;a href="https://github.com/kkdai/linebot-namecard-go/blob/main/internal/config/config.go" rel="noopener noreferrer"&gt;&lt;code&gt;internal/config/config.go&lt;/code&gt;&lt;/a&gt;, the first line of &lt;code&gt;Load()&lt;/code&gt; explicitly sets &lt;code&gt;_ = os.Setenv("GOOGLE_CLOUD_LOCATION", "global")&lt;/code&gt; to prevent regional variables copied from old services from overriding the &lt;code&gt;global&lt;/code&gt; endpoint required by &lt;code&gt;gemini-3-flash-preview&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  5. The Essence of Cloud-Local Handoff: Remote Agent Writing a "Copy-Paste Handoff Document"
&lt;/h2&gt;

&lt;p&gt;Because the Remote Agent is well aware it is in a cloud sandbox without &lt;code&gt;gcloud&lt;/code&gt; or LINE API permissions, it proactively produced two key handoff items in its final commit:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;a href="https://github.com/kkdai/linebot-namecard-go/blob/main/scripts/deploy_and_switch_webhook.sh" rel="noopener noreferrer"&gt;&lt;code&gt;scripts/deploy_and_switch_webhook.sh&lt;/code&gt;&lt;/a&gt;: Automates extracting env vars from the old service, deploying to Cloud Run, checking &lt;code&gt;GET /&lt;/code&gt; Health Check, and calling the LINE Messaging API to update and test the Webhook (with a &lt;code&gt;--rollback&lt;/code&gt; parameter).&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://github.com/kkdai/linebot-namecard-go/blob/main/HANDOFF.md" rel="noopener noreferrer"&gt;&lt;code&gt;HANDOFF.md&lt;/code&gt;&lt;/a&gt;: Organized progress, GCP permissions to verify, and a &lt;strong&gt;startup Prompt that can be directly copied and pasted into the local &lt;code&gt;agy&lt;/code&gt; CLI&lt;/strong&gt;.&lt;/li&gt;
&lt;/ol&gt;




&lt;h1&gt;
  
  
  5. Second Leg (Local &lt;code&gt;agy&lt;/code&gt; CLI): Handling the Handoff, Troubleshooting, and Zero-Downtime Launch
&lt;/h1&gt;

&lt;p&gt;Back at my computer, I opened the local &lt;code&gt;agy&lt;/code&gt; CLI (without &lt;code&gt;--remote-agent&lt;/code&gt;, using local Agent mode) and pasted the handoff Prompt from &lt;code&gt;HANDOFF.md&lt;/code&gt;. The local Agent took over to complete verification, deployment, and switching. During this process, it caught several "details only visible when looking at the real GCP environment locally":&lt;/p&gt;

&lt;h2&gt;
  
  
  Detail 1: The old service didn't use &lt;code&gt;GOOGLE_APPLICATION_CREDENTIALS_JSON&lt;/code&gt;, but relied on ADC
&lt;/h2&gt;

&lt;p&gt;The handoff document originally assumed we needed to extract &lt;code&gt;GOOGLE_APPLICATION_CREDENTIALS_JSON&lt;/code&gt; from the old service. However, after the local &lt;code&gt;agy&lt;/code&gt; used &lt;code&gt;gcloud run services describe &amp;lt;OLD_CLOUD_RUN_SERVICE&amp;gt;&lt;/code&gt; to inspect the live settings, it found the env var list looked like this:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;ChannelAccessToken&lt;/code&gt;, &lt;code&gt;ChannelSecret&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;FIREBASE_URL&lt;/code&gt;, &lt;code&gt;FIREBASE_STORAGE_BUCKET&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;PROJECT_ID: &amp;lt;YOUR_GCP_PROJECT_ID&amp;gt;&lt;/code&gt;, &lt;code&gt;LOCATION: global&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;GOOGLE_CLOUD_PROJECT: &amp;lt;YOUR_GCP_PROJECT_ID&amp;gt;&lt;/code&gt;, &lt;code&gt;GOOGLE_CLOUD_LOCATION: &amp;lt;YOUR_GCP_REGION&amp;gt;&lt;/code&gt;, &lt;code&gt;GOOGLE_GENAI_USE_VERTEXAI: True&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The old service didn't have a JSON Key; it used the Cloud Run service account &lt;code&gt;&amp;lt;PROJECT_NUMBER&amp;gt;-compute@developer.gserviceaccount.com&lt;/code&gt; via &lt;strong&gt;Application Default Credentials (ADC)&lt;/strong&gt;! We checked the IAM roles for that service account and confirmed it already had &lt;code&gt;roles/datastore.user&lt;/code&gt;, &lt;code&gt;roles/aiplatform.user&lt;/code&gt;, &lt;code&gt;roles/firebase.admin&lt;/code&gt;, and &lt;code&gt;roles/storage.admin&lt;/code&gt;. Furthermore, the &lt;code&gt;(default)&lt;/code&gt; Firestore (Native mode, in the same region) was already established.&lt;/p&gt;

&lt;p&gt;Also, note that the old service env vars included &lt;strong&gt;&lt;code&gt;GOOGLE_CLOUD_LOCATION: &amp;lt;YOUR_GCP_REGION&amp;gt;&lt;/code&gt;&lt;/strong&gt;. This could easily cause &lt;code&gt;gemini-3-flash-preview&lt;/code&gt; to fail to find the model in other unhandled code. Fortunately, the Go version's &lt;code&gt;config.Load()&lt;/code&gt; forces &lt;code&gt;GOOGLE_CLOUD_LOCATION&lt;/code&gt; to &lt;code&gt;global&lt;/code&gt; at startup, perfectly avoiding this potential trap!&lt;/p&gt;

&lt;h2&gt;
  
  
  Detail 2: macOS &lt;code&gt;mktemp&lt;/code&gt; Suffix Trap &amp;amp; Old Webhook Hidden Behind Firebase Hosting
&lt;/h2&gt;

&lt;p&gt;Before running the deployment script, two things were checked:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;macOS BSD &lt;code&gt;mktemp&lt;/code&gt; Behavior Difference&lt;/strong&gt;: Line 46 of the script used &lt;code&gt;mktemp /tmp/cloudrun_env.XXXXXX.yaml&lt;/code&gt;. While this works with Linux GNU &lt;code&gt;mktemp&lt;/code&gt;, in macOS BSD &lt;code&gt;mktemp&lt;/code&gt;, &lt;strong&gt;if &lt;code&gt;XXXXXX&lt;/code&gt; is followed by a &lt;code&gt;.yaml&lt;/code&gt; extension, it won't be replaced by random characters&lt;/strong&gt;. It would consistently produce &lt;code&gt;/tmp/cloudrun_env.XXXXXX.yaml&lt;/code&gt;. Although the script has &lt;code&gt;trap 'rm -f "${ENV_FILE}"' EXIT&lt;/code&gt; to clean up, it's better to use suffix-less &lt;code&gt;mktemp /tmp/cloudrun_env.XXXXXX&lt;/code&gt; or Python's &lt;code&gt;tempfile.NamedTemporaryFile&lt;/code&gt; for cross-platform scripts.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Check the actual LINE Webhook Endpoint before switching&lt;/strong&gt;: A &lt;code&gt;GET https://api.line.me/v2/bot/channel/webhook/endpoint&lt;/code&gt; revealed that the original Webhook didn't point directly to the old Python Cloud Run &lt;code&gt;.run.app&lt;/code&gt; URL. Instead, it pointed to &lt;strong&gt;&lt;code&gt;https://&amp;lt;YOUR_FIREBASE_APP&amp;gt;.firebaseapp.com&lt;/code&gt;&lt;/strong&gt; (rewritten via Firebase Hosting to the Python Cloud Run), with a status of &lt;code&gt;"active": true&lt;/code&gt;. Knowing the original state helps if a recovery is needed (while the script's &lt;code&gt;--rollback&lt;/code&gt; would switch back to the direct URL of the old Python Cloud Run).&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Detail 3: One-click Cloud Build Deployment of &lt;code&gt;golang:1.27-bookworm&lt;/code&gt; and Webhook Switch
&lt;/h2&gt;

&lt;p&gt;After running &lt;code&gt;./scripts/deploy_and_switch_webhook.sh&lt;/code&gt; locally:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Env Var Export&lt;/strong&gt;: Automatically exported all settings from the old Python Cloud Run service to a temporary YAML.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cloud Build Compilation &amp;amp; Deployment&lt;/strong&gt;: &lt;code&gt;FROM golang:1.27-bookworm AS builder&lt;/code&gt; in the &lt;code&gt;Dockerfile&lt;/code&gt; successfully pulled and statically compiled (&lt;code&gt;CGO_ENABLED=0 GOOS=linux&lt;/code&gt;) into &lt;code&gt;gcr.io/distroless/static-debian12&lt;/code&gt;. The new Go Cloud Run service was successfully created (with &lt;code&gt;100%&lt;/code&gt; traffic shifted to the new revision).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Health Check &amp;amp; LINE API Verification&lt;/strong&gt;: 

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;GET https://&amp;lt;YOUR_CLOUD_RUN_SERVICE_URL&amp;gt;/&lt;/code&gt; → &lt;code&gt;{"status":"ok"}&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;PUT /v2/bot/channel/webhook/endpoint&lt;/code&gt; → &lt;code&gt;{}&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;POST /v2/bot/channel/webhook/test&lt;/code&gt; → &lt;code&gt;{"success":true,"statusCode":200,"reason":"OK","detail":"200"}&lt;/code&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Finally, checking &lt;code&gt;gcloud run services logs read&lt;/code&gt; and &lt;code&gt;gcloud logging read&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;2026-11-08T09:08:26.864683Z 2026/11/08 09:08:26 Cloud Firestore &amp;amp; Firebase Admin SDK initialized successfully.
2026-11-08T09:08:26.868408Z 2026/11/08 09:08:26 Starting LINE Bot Namecard Go + ADK server on port 8080...
2026-11-08T09:08:26.879115Z Default STARTUP TCP probe succeeded after 1 attempt for container "&amp;lt;NEW_CLOUD_RUN_SERVICE&amp;gt;-1" on port 8080.
2026-11-08T09:08:29.410974Z INFO GET 200
2026-11-08T09:08:30.147730Z INFO POST 200
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Everything went smoothly with zero errors! Now, sending messages or business card photos in the LINE chat hits the Go + ADK + Firestore bot.&lt;/p&gt;




&lt;h1&gt;
  
  
  6. Remote Agent Cloud-to-Local Handoff &amp;amp; Painless Migration Checklist
&lt;/h1&gt;

&lt;p&gt;If you also want to use &lt;strong&gt;Antigravity Remote Agent + local &lt;code&gt;agy&lt;/code&gt; CLI&lt;/strong&gt; to refactor and switch live services, follow this checklist to avoid common pitfalls:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;[ ] &lt;strong&gt;1. Choose the right remote work mode&lt;/strong&gt;: Use &lt;strong&gt;&lt;code&gt;agy --remote-agent&lt;/code&gt;&lt;/strong&gt; if you want to shut down your computer and let the AI refactor and PR on its own (requires Google AI Pro/Ultra personal account, &lt;code&gt;agy &amp;gt;= 1.4.12&lt;/code&gt;). Use &lt;strong&gt;&lt;code&gt;agy --remote-control&lt;/code&gt;&lt;/strong&gt; if you want to remotely trigger &lt;code&gt;gcloud&lt;/code&gt; deployments from your phone or continue the same conversation.&lt;/li&gt;
&lt;li&gt;[ ] &lt;strong&gt;2. Don't expect to switch the same conversation directly&lt;/strong&gt;: Remote and local Agents are isolated in terms of chat history, filesystems, and toolchains. Remote Agents don't support &lt;code&gt;/fork&lt;/code&gt;, &lt;code&gt;/diff&lt;/code&gt;, &lt;code&gt;/rewind&lt;/code&gt;, &lt;code&gt;/btw&lt;/code&gt;, &lt;code&gt;--print&lt;/code&gt;, or &lt;code&gt;!&lt;/code&gt; local commands. Treat &lt;strong&gt;"GitHub + &lt;code&gt;HANDOFF.md&lt;/code&gt;"&lt;/strong&gt; as your standard handoff interface from the start.&lt;/li&gt;
&lt;li&gt;[ ] &lt;strong&gt;3. Have the Remote Agent produce an actionable handoff Prompt and deployment script&lt;/strong&gt;: When wrapping up in the cloud, ask it to include test commands, environment requirements, a one-click deployment script (with &lt;code&gt;--rollback&lt;/code&gt;), and a "Prompt for the next local Agent" in &lt;code&gt;HANDOFF.md&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;[ ] &lt;strong&gt;4. Verify IAM, Firestore, and regional variables after taking over&lt;/strong&gt;: Don't blindly assume the old service uses &lt;code&gt;GOOGLE_APPLICATION_CREDENTIALS_JSON&lt;/code&gt;. Use &lt;code&gt;gcloud run services describe&lt;/code&gt; and &lt;code&gt;gcloud projects get-iam-policy&lt;/code&gt; to confirm if the default service account has &lt;code&gt;roles/datastore.user&lt;/code&gt; and &lt;code&gt;roles/aiplatform.user&lt;/code&gt;. If using preview models like &lt;code&gt;gemini-3-flash-preview&lt;/code&gt;, ensure the code handles &lt;code&gt;GOOGLE_CLOUD_LOCATION=global&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;[ ] &lt;strong&gt;5. Watch for cross-platform script issues and original Webhook paths&lt;/strong&gt;: Note that macOS BSD &lt;code&gt;mktemp&lt;/code&gt; doesn't support randomizing template suffixes. Before switching the LINE Webhook, call &lt;code&gt;GET /v2/bot/channel/webhook/endpoint&lt;/code&gt; to record the original endpoint (check if it goes through Firebase Hosting or API Gateway) to ensure you have a baseline for verification and rollback.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The complete Go code, dual-layer common memory implementation, and deployment scripts are open-sourced on GitHub: &lt;strong&gt;&lt;a href="https://github.com/kkdai/linebot-namecard-go" rel="noopener noreferrer"&gt;&lt;code&gt;kkdai/linebot-namecard-go&lt;/code&gt;&lt;/a&gt;&lt;/strong&gt;. The original Python version is also preserved at &lt;strong&gt;&lt;a href="https://github.com/kkdai/linebot-namecard-python" rel="noopener noreferrer"&gt;&lt;code&gt;kkdai/linebot-namecard-python&lt;/code&gt;&lt;/a&gt;&lt;/strong&gt; for architectural comparison. Feel free to reference and discuss!&lt;/p&gt;

</description>
      <category>ai</category>
      <category>architecture</category>
      <category>go</category>
      <category>python</category>
    </item>
    <item>
      <title>[AI in Action] Rewriting a Daily LINE Bot from Python to Go 1.26 on Cloud Run: 1/4 Resource Usage, Google ADK v1.9.0, and Zero-D</title>
      <dc:creator>Evan Lin</dc:creator>
      <pubDate>Tue, 03 Nov 2026 13:29:47 +0000</pubDate>
      <link>https://dev.to/gde/ai-in-action-rewriting-a-daily-line-bot-from-python-to-go-126-on-cloud-run-14-resource-usage-2o62</link>
      <guid>https://dev.to/gde/ai-in-action-rewriting-a-daily-line-bot-from-python-to-go-126-on-cloud-run-14-resource-usage-2o62</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Feeinkseadxf4b4hjpdxu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Feeinkseadxf4b4hjpdxu.png" alt="LINE Bot Helper: Python to Go 1.26 &amp;amp; Cloud Run Architecture (ADK v1.9.0)" width="800" height="447"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Background
&lt;/h1&gt;

&lt;p&gt;I have a primary LINE Bot that I use heavily every day: &lt;strong&gt;&lt;a href="https://github.com/kkdai/linebot-helper-python" rel="noopener noreferrer"&gt;&lt;code&gt;kkdai/linebot-helper-python&lt;/code&gt;&lt;/a&gt;&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Initially, it was just a small tool where you could "drop a URL and get a Traditional Chinese summary," but over the past year and a half, I've gradually integrated various new Gemini capabilities into it:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Multi-source Content Loading and Document Conversion&lt;/strong&gt;: A three-layer web crawler Fallback Chain (HTTP $\rightarrow$ Firecrawl $\rightarrow$ SingleFile Headless Chromium), YouTube video summaries, automatic conversion of PDF / Word / PPT / Excel / EPUB to Markdown, and one-click generation of FB / LinkedIn / Threads viral social media copy Carousels.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Bookmarks and Grounding Deep Research Reports&lt;/strong&gt;: &lt;code&gt;/save&lt;/code&gt;, &lt;code&gt;/list&lt;/code&gt;, and &lt;code&gt;/search&lt;/code&gt; bookmark management. Clicking "📄 Detailed Research Report" on a card combines Google Search Grounding to write a complete Markdown report, rendered as an independent HTML page (&lt;code&gt;/reports/{id}&lt;/code&gt;) and permanently saved in Cloud Firestore.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Google Maps Grounding and Gemini Batch API Gourmet Big Data Analysis&lt;/strong&gt;: Send LINE location coordinates to search for nearby gas stations, parking lots, and restaurants. It can also pull 50+ latest reviews for specific restaurants and feed them into the &lt;strong&gt;Gemini Batch API&lt;/strong&gt; (enjoying a 50% cost discount) for deep analysis of signature dishes and pitfalls, pushed back to LINE via Webhook or background polling.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Agentic Vision Visual Annotation&lt;/strong&gt;: After uploading an image, &lt;code&gt;gemini-3-flash-preview&lt;/code&gt; writes Python code to draw bounding boxes, which are then saved as images and pushed back to the chat room.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;LINE Voice Message TTS and LIFF Real-time Two-way Voice Assistant&lt;/strong&gt;: Voice messages are automatically transcribed and paired with &lt;code&gt;gemini-3.1-flash-tts-preview&lt;/code&gt; + &lt;code&gt;ffmpeg&lt;/code&gt; to generate M4A voice readings. Opening LIFF allows two-way streaming of &lt;code&gt;gemini-3.1-flash-live-preview&lt;/code&gt; via WebSocket, supporting hands-free VAD, Barge-in interruption, and Live Tool Calling.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The features are great, but the cost is obvious: &lt;strong&gt;the resident memory for Python + FastAPI + a large number of document parsing and AI packages kept increasing&lt;/strong&gt;. To ensure background tasks and multi-concurrency didn't lag, this Cloud Run service was unknowingly scaled up to &lt;strong&gt;4 vCPU / 4 GiB Memory&lt;/strong&gt; (with &lt;code&gt;--no-cpu-throttling&lt;/code&gt; enabled).&lt;/p&gt;

&lt;p&gt;As someone who has been writing Go for a long time, seeing a personal daily assistant consume 4 vCPU / 4 GiB was becoming hard to stomach. So, I decided to do one thing: &lt;strong&gt;rewrite the entire &lt;code&gt;linebot-helper-python&lt;/code&gt; 100% into the latest Go 1.26 version (&lt;a href="https://github.com/kkdai/linebot-helper-go" rel="noopener noreferrer"&gt;&lt;code&gt;kkdai/linebot-helper-go&lt;/code&gt;&lt;/a&gt;), deploy it to Cloud Run in the same GCP project, and ensure it shares Firestore data with the old version for zero-downtime switching at any time.&lt;/strong&gt;&lt;/p&gt;




&lt;h1&gt;
  
  
  1. Setting Rules Before Rewriting: Breaking Down 11 Milestones with GitHub Issues
&lt;/h1&gt;

&lt;p&gt;Moving a nearly 90KB &lt;code&gt;main.py&lt;/code&gt; plus a dozen modules from Python to Go can easily result in an unmaintainable maze if boundaries aren't defined and testing isn't done along the way.&lt;/p&gt;

&lt;p&gt;Therefore, after creating &lt;strong&gt;&lt;a href="https://github.com/kkdai/linebot-helper-go" rel="noopener noreferrer"&gt;&lt;code&gt;kkdai/linebot-helper-go&lt;/code&gt;&lt;/a&gt;&lt;/strong&gt;, the first task wasn't writing code, but mapping out all features from the Python version. I opened &lt;strong&gt;&lt;a href="https://github.com/kkdai/linebot-helper-go/issues/12" rel="noopener noreferrer"&gt;Tracking Issue #12&lt;/a&gt;&lt;/strong&gt; and &lt;strong&gt;11 sub-task Issues (&lt;a href="https://github.com/kkdai/linebot-helper-go/issues/1" rel="noopener noreferrer"&gt;#1&lt;/a&gt; ~ &lt;a href="https://github.com/kkdai/linebot-helper-go/issues/11" rel="noopener noreferrer"&gt;#11&lt;/a&gt;)&lt;/strong&gt; on GitHub, with each Issue corresponding to an independent package and complete unit tests:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Milestone Issue&lt;/th&gt;
&lt;th&gt;Corresponding Go Package&lt;/th&gt;
&lt;th&gt;Core Responsibilities and Compatibility Highlights&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;&lt;a href="https://github.com/kkdai/linebot-helper-go/issues/1" rel="noopener noreferrer"&gt;#1&lt;/a&gt; Project Skeleton and Dockerfile&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;main.go&lt;/code&gt;, &lt;code&gt;internal/config&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;Go 1.26 &lt;code&gt;net/http&lt;/code&gt;, 100% environment variable compatibility with Python version, Multi-stage Dockerfile (integrating Chromium / &lt;code&gt;single-file&lt;/code&gt; / &lt;code&gt;ffmpeg&lt;/code&gt;)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;&lt;a href="https://github.com/kkdai/linebot-helper-go/issues/2" rel="noopener noreferrer"&gt;#2&lt;/a&gt; Gemini Dual-channel Client&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;internal/gemini&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Supports both &lt;strong&gt;Vertex AI (ADC)&lt;/strong&gt; and &lt;strong&gt;Gemini Developer API (&lt;code&gt;GOOGLE_AI_API_KEY&lt;/code&gt;)&lt;/strong&gt;, covering Grounding, Code Execution, and TTS&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;&lt;a href="https://github.com/kkdai/linebot-helper-go/issues/3" rel="noopener noreferrer"&gt;#3&lt;/a&gt; Firestore Persistence Layer&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;internal/firestore&lt;/code&gt;, &lt;code&gt;internal/services&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;Fully compatible with Python version's &lt;code&gt;chat_sessions&lt;/code&gt;, &lt;code&gt;bookmarks&lt;/code&gt;, &lt;code&gt;reports&lt;/code&gt;, and &lt;code&gt;batch_jobs&lt;/code&gt; collection schemas; auto-downgrades to in-memory storage without credentials&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;&lt;a href="https://github.com/kkdai/linebot-helper-go/issues/4" rel="noopener noreferrer"&gt;#4&lt;/a&gt; LINE Messaging API and Flex&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;internal/line&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;HMAC-SHA256 signature verification, Reply / Push / Loading Animation, Social copy and Bookmark Flex Carousel assembly&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;&lt;a href="https://github.com/kkdai/linebot-helper-go/issues/5" rel="noopener noreferrer"&gt;#5&lt;/a&gt; URL Crawler and Multi-format Doc Conversion&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;internal/loader&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;HTTP (including PTT &lt;code&gt;over18=1&lt;/code&gt;) $\rightarrow$ Firecrawl $\rightarrow$ SingleFile three-layer time-budget Fallback, and PDF / DOCX / PPTX / XLSX / EPUB / ODF to Markdown&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;&lt;a href="https://github.com/kkdai/linebot-helper-go/issues/6" rel="noopener noreferrer"&gt;#6&lt;/a&gt; AI Toolset&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;internal/ai&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Summaries, viral social copy, Grounding research reports, YouTube analysis, Agentic Vision, GitHub Issues aggregation, Maps search&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;&lt;a href="https://github.com/kkdai/linebot-helper-go/issues/7" rel="noopener noreferrer"&gt;#7&lt;/a&gt; ADK Orchestrator and Specialized Agents&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;internal/agents&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Integrates official &lt;code&gt;google.golang.org/adk v1.9.0&lt;/code&gt;, establishing a Root &lt;code&gt;Orchestrator&lt;/code&gt; and 5 specialized Agents: &lt;code&gt;Chat&lt;/code&gt; / &lt;code&gt;Content&lt;/code&gt; / &lt;code&gt;Location&lt;/code&gt; / &lt;code&gt;Vision&lt;/code&gt; / &lt;code&gt;GitHub&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;&lt;a href="https://github.com/kkdai/linebot-helper-go/issues/8" rel="noopener noreferrer"&gt;#8&lt;/a&gt; Asynchronous Webhook and Postback&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;internal/handlers&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Webhook returns &lt;code&gt;200 OK&lt;/code&gt; instantly, background Goroutines handle events, 9 types of Postback dispatching, and &lt;code&gt;/reports/{id}&lt;/code&gt;, &lt;code&gt;/images/{id}&lt;/code&gt;, &lt;code&gt;/audio/{id}&lt;/code&gt; endpoints&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;&lt;a href="https://github.com/kkdai/linebot-helper-go/issues/9" rel="noopener noreferrer"&gt;#9&lt;/a&gt; Gemini Batch API Gourmet Analysis&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;internal/services/batch_service.go&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;JSONL batch job upload, Static HMAC Webhook, Dynamic RS256 JWKS Webhook verification, and 60s background polling&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;&lt;a href="https://github.com/kkdai/linebot-helper-go/issues/10" rel="noopener noreferrer"&gt;#10&lt;/a&gt; LIFF Real-time Voice Assistant&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;internal/voice&lt;/code&gt;, &lt;code&gt;static/liff&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;/ws/voice/{session_id}&lt;/code&gt; two-way WebSocket Relay, Push-to-Talk / hands-free VAD, Barge-in, Session Resumption, and Live Tool Calling&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;&lt;a href="https://github.com/kkdai/linebot-helper-go/issues/11" rel="noopener noreferrer"&gt;#11&lt;/a&gt; Cloud Run Deployment and Verification&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Cloud Run (&lt;code&gt;us-central1&lt;/code&gt;)&lt;/td&gt;
&lt;td&gt;Deployed using existing Python version environment variables, stress tested, and container resource specs downsized&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The overall architecture is shown in the diagram below:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight dot"&gt;&lt;code&gt;&lt;span class="nv"&gt;flowchart&lt;/span&gt; &lt;span class="nv"&gt;TB&lt;/span&gt;
    &lt;span class="k"&gt;subgraph&lt;/span&gt; &lt;span class="nv"&gt;Client&lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"LINE Client and LIFF"&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;
        &lt;span class="nv"&gt;LINE&lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"LINE App Chatroom\n(Text / URL / Image / Voice / Location / Postback)"&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;
        &lt;span class="nv"&gt;LIFF&lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"LIFF Real-time Voice Assistant\n(/liff/ + WebSocket PCM 16kHz/24kHz)"&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;
    &lt;span class="nv"&gt;end&lt;/span&gt;

    &lt;span class="k"&gt;subgraph&lt;/span&gt; &lt;span class="nv"&gt;CloudRun&lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"Google Cloud Run: linebot-helper-go (Go 1.26, 1 vCPU / 1 GiB)"&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;
        &lt;span class="nv"&gt;Mux&lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"Go 1.26 net/http Server\n(HMAC Verification + Immediate 200 OK)"&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;
        &lt;span class="nv"&gt;VoiceRelay&lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"internal/voice\nGemini Live BidiGenerateContent Relay"&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;
        &lt;span class="nv"&gt;Orch&lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"internal/agents (google.golang.org/adk v1.9.0)\nRoot Orchestrator + 5 Sub-Agents"&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;
        &lt;span class="nv"&gt;Loader&lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"internal/loader\nHTTP -&amp;gt; Firecrawl -&amp;gt; SingleFile\n+ PDF/Office/EPUB to Markdown"&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;
        &lt;span class="nv"&gt;BatchSvc&lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"internal/services/batch_service\nGemini Batch API + JWKS/HMAC Webhook + 60s Poller"&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;
    &lt;span class="nv"&gt;end&lt;/span&gt;

    &lt;span class="k"&gt;subgraph&lt;/span&gt; &lt;span class="nv"&gt;GCP&lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"Google Cloud &amp;amp; AI Backend"&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;
        &lt;span class="nv"&gt;Vertex&lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"Vertex AI / Gemini Developer API\n(Search Grounding / Maps / Vision / TTS / Live)"&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;
        &lt;span class="nv"&gt;FS&lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="err"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Cloud Firestore\nchat_sessions | bookmarks\nreports | batch_jobs"&lt;/span&gt;&lt;span class="err"&gt;)&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;
    &lt;span class="nv"&gt;end&lt;/span&gt;

    &lt;span class="nv"&gt;LINE&lt;/span&gt; &lt;span class="o"&gt;--&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;|&lt;/span&gt;&lt;span class="s2"&gt;"POST /"&lt;/span&gt;&lt;span class="err"&gt;|&lt;/span&gt; &lt;span class="nv"&gt;Mux&lt;/span&gt;
    &lt;span class="nv"&gt;LIFF&lt;/span&gt; &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;--&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;&lt;span class="err"&gt;|&lt;/span&gt;&lt;span class="s2"&gt;"GET /ws/voice/{id}"&lt;/span&gt;&lt;span class="err"&gt;|&lt;/span&gt; &lt;span class="nv"&gt;VoiceRelay&lt;/span&gt;
    &lt;span class="nv"&gt;Mux&lt;/span&gt; &lt;span class="o"&gt;--&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;&lt;/span&gt; &lt;span class="nv"&gt;Orch&lt;/span&gt;
    &lt;span class="nv"&gt;Mux&lt;/span&gt; &lt;span class="o"&gt;--&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;&lt;/span&gt; &lt;span class="nv"&gt;Loader&lt;/span&gt;
    &lt;span class="nv"&gt;Mux&lt;/span&gt; &lt;span class="o"&gt;--&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;&lt;/span&gt; &lt;span class="nv"&gt;BatchSvc&lt;/span&gt;
    &lt;span class="nv"&gt;VoiceRelay&lt;/span&gt; &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;--&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;&lt;span class="err"&gt;|&lt;/span&gt;&lt;span class="s2"&gt;"WebSocket"&lt;/span&gt;&lt;span class="err"&gt;|&lt;/span&gt; &lt;span class="nv"&gt;Vertex&lt;/span&gt;
    &lt;span class="nv"&gt;VoiceRelay&lt;/span&gt; &lt;span class="err"&gt;-.&lt;/span&gt;&lt;span class="o"&gt;-&amp;gt;&lt;/span&gt;&lt;span class="err"&gt;|&lt;/span&gt;&lt;span class="s2"&gt;"delegate_to_orchestrator"&lt;/span&gt;&lt;span class="err"&gt;|&lt;/span&gt; &lt;span class="nv"&gt;Orch&lt;/span&gt;
    &lt;span class="nv"&gt;Orch&lt;/span&gt; &lt;span class="o"&gt;--&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;&lt;/span&gt; &lt;span class="nv"&gt;Vertex&lt;/span&gt;
    &lt;span class="nv"&gt;Orch&lt;/span&gt; &lt;span class="o"&gt;--&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;&lt;/span&gt; &lt;span class="nv"&gt;Loader&lt;/span&gt;
    &lt;span class="nv"&gt;Orch&lt;/span&gt; &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;--&lt;span class="p"&gt;&amp;gt;&lt;/span&gt; &lt;span class="nv"&gt;FS&lt;/span&gt;
    &lt;span class="nv"&gt;BatchSvc&lt;/span&gt; &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;--&lt;span class="p"&gt;&amp;gt;&lt;/span&gt; &lt;span class="nv"&gt;Vertex&lt;/span&gt;
    &lt;span class="nv"&gt;BatchSvc&lt;/span&gt; &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;--&lt;span class="p"&gt;&amp;gt;&lt;/span&gt; &lt;span class="nv"&gt;FS&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h1&gt;
  
  
  2. Five Engineering Designs Particularly Noteworthy During the Rewriting Process
&lt;/h1&gt;

&lt;h2&gt;
  
  
  1. Dual-track Gemini Client for Vertex AI and Developer API
&lt;/h2&gt;

&lt;p&gt;In this LINE Bot, not all features use the same Gemini endpoint:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;General Chat, Grounding Search, Google Maps Grounding, Image Analysis&lt;/strong&gt;: Uses &lt;strong&gt;Vertex AI&lt;/strong&gt; (using Application Default Credentials of the Cloud Run service account, no API Key required).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Native TTS Voice Synthesis (&lt;code&gt;gemini-3.1-flash-tts-preview&lt;/code&gt;), Gemini Batch API, and Gemini Live API WebSocket&lt;/strong&gt;: Uses &lt;strong&gt;Gemini Developer API&lt;/strong&gt; (using &lt;code&gt;GOOGLE_AI_API_KEY&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Agentic Vision (&lt;code&gt;gemini-3-flash-preview&lt;/code&gt; + Code Execution)&lt;/strong&gt;: Prioritizes Developer API, with automatic Fallback to Vertex AI if no Key is set.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In the Go version's &lt;a href="https://github.com/kkdai/linebot-helper-go/blob/main/internal/gemini/client.go" rel="noopener noreferrer"&gt;&lt;code&gt;internal/gemini/client.go&lt;/code&gt;&lt;/a&gt;, we converged these two paths under the same &lt;code&gt;gemini.Client&lt;/code&gt;. Even converting the Raw PCM (&lt;code&gt;24kHz, 16-bit, mono&lt;/code&gt;) returned by TTS into LINE-supported &lt;code&gt;audio/mp4&lt;/code&gt; (&lt;code&gt;.m4a&lt;/code&gt;) via &lt;code&gt;ffmpeg&lt;/code&gt; and calculating audio milliseconds is handled seamlessly within the same module.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. 100% Firestore Schema Compatibility with the Python Version (Key to Zero-Downtime Switching)
&lt;/h2&gt;

&lt;p&gt;The biggest fear when rewriting a service is that "after switching, user chat history, half-saved bookmarks, or previously generated research report URLs will all become invalid."&lt;/p&gt;

&lt;p&gt;To prevent this, we strictly aligned the 4 Firestore Collection names and field structures in &lt;a href="https://github.com/kkdai/linebot-helper-go/tree/main/internal/firestore" rel="noopener noreferrer"&gt;&lt;code&gt;internal/firestore&lt;/code&gt;&lt;/a&gt; and &lt;a href="https://github.com/kkdai/linebot-helper-go/tree/main/internal/services" rel="noopener noreferrer"&gt;&lt;code&gt;internal/services&lt;/code&gt;&lt;/a&gt; with the Python version:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;chat_sessions&lt;/code&gt;: Stores multi-turn chat history and the last GPS coordinates sent by the user (&lt;code&gt;last_location&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;bookmarks&lt;/code&gt;: Stores &lt;code&gt;/save&lt;/code&gt; bookmarks, viral social copy candidate bookmarks (&lt;code&gt;status: candidate&lt;/code&gt; $\rightarrow$ &lt;code&gt;saved&lt;/code&gt;), and 7-day cached &lt;code&gt;report_id&lt;/code&gt; and &lt;code&gt;report_generated_at&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;reports&lt;/code&gt;: Stores the fully rendered HTML of Grounding deep research reports (supporting permanent retrieval via &lt;code&gt;/reports/{report_id}&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;batch_jobs&lt;/code&gt;: Stores the mapping between Gemini Batch API task IDs and LINE &lt;code&gt;user_id&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This means &lt;strong&gt;the Python version and Go version can simultaneously read and write to the same Firestore online&lt;/strong&gt;. The moment the LINE Webhook is pointed to the new version, all old bookmarks and report links remain completely unaffected; if I ever want to switch back to the Python version, I only need to change one line of the Webhook URL.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Native Go Implementation for Multi-format Document to Markdown Conversion (Saying Goodbye to Heavy Python Packages)
&lt;/h2&gt;

&lt;p&gt;The Python version used packages like &lt;code&gt;anydoc&lt;/code&gt; to convert PDF, DOCX, PPTX, XLSX, ODT, EPUB, CSV, and RTF to Markdown before feeding them to Gemini for summarization. These packages in Python often pull in a long list of C extensions and dependencies.&lt;/p&gt;

&lt;p&gt;In the Go version &lt;a href="https://github.com/kkdai/linebot-helper-go/blob/main/internal/loader/doc_converter.go" rel="noopener noreferrer"&gt;&lt;code&gt;internal/loader/doc_converter.go&lt;/code&gt;&lt;/a&gt;, since &lt;code&gt;.docx&lt;/code&gt;, &lt;code&gt;.pptx&lt;/code&gt;, &lt;code&gt;.xlsx&lt;/code&gt;, &lt;code&gt;.odt&lt;/code&gt;, and &lt;code&gt;.epub&lt;/code&gt; are essentially &lt;strong&gt;ZIP-packaged XML files&lt;/strong&gt;, we used the Go standard library's &lt;code&gt;archive/zip&lt;/code&gt; + &lt;code&gt;encoding/xml&lt;/code&gt; along with a lightweight PDF text extractor. With less than a few hundred lines of pure Go code, we can cleanly convert all mainstream office documents and e-book formats into structured Markdown. It compiles fast and has almost zero extra memory overhead at runtime!&lt;/p&gt;




&lt;h1&gt;
  
  
  3. Facing the Architecture Honestly: Python Version's "Conceptual ADK" vs. Go Version's Actual Implementation of &lt;code&gt;google.golang.org/adk v1.9.0&lt;/code&gt;
&lt;/h1&gt;

&lt;p&gt;While checking the code, we found an interesting historical trace:&lt;/p&gt;

&lt;p&gt;If you open the beginning of the original Python version's &lt;a href="https://github.com/kkdai/linebot-helper-python/blob/main/agents/orchestrator.py" rel="noopener noreferrer"&gt;&lt;code&gt;agents/orchestrator.py&lt;/code&gt;&lt;/a&gt;, you'll see a comment saying:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;code&gt;Orchestrator Agent - Main control Agent based on Google ADK&lt;/code&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;But if you look at the Python version's &lt;code&gt;requirements.txt&lt;/code&gt; and the entire source code, you'll find that &lt;strong&gt;&lt;code&gt;google-adk&lt;/code&gt; isn't actually installed&lt;/strong&gt;, and there isn't a single line of &lt;code&gt;from google.adk import ...&lt;/code&gt;! The Python version at that time merely "borrowed the hierarchical concept of ADK," manually creating &lt;code&gt;Orchestrator&lt;/code&gt;, &lt;code&gt;ChatAgent&lt;/code&gt;, &lt;code&gt;ContentAgent&lt;/code&gt;, etc., using pure Python classes, with the underlying layer calling &lt;code&gt;google-genai&lt;/code&gt; directly.&lt;/p&gt;

&lt;p&gt;For this Go rewrite, we decided to do it for real—directly introducing the latest official Google &lt;strong&gt;&lt;code&gt;google.golang.org/adk v1.9.0&lt;/code&gt;&lt;/strong&gt; in &lt;a href="https://github.com/kkdai/linebot-helper-go/blob/main/go.mod" rel="noopener noreferrer"&gt;&lt;code&gt;go.mod&lt;/code&gt;&lt;/a&gt; (paired with &lt;code&gt;google.golang.org/genai v1.57.0&lt;/code&gt;):&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Comparison Item&lt;/th&gt;
&lt;th&gt;Original Python Version (&lt;code&gt;linebot-helper-python&lt;/code&gt;)&lt;/th&gt;
&lt;th&gt;New Go Version (&lt;code&gt;linebot-helper-go&lt;/code&gt;)&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;ADK Package Dependency&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;❌ None (not installed)&lt;/td&gt;
&lt;td&gt;✅ &lt;strong&gt;&lt;code&gt;google.golang.org/adk v1.9.0&lt;/code&gt;&lt;/strong&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Agent Definition&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Custom Python Class&lt;/td&gt;
&lt;td&gt;Uses &lt;code&gt;llmagent.New(llmagent.Config{...})&lt;/code&gt; to create &lt;code&gt;agent.Agent&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Sub-Agents Hierarchy&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Manual object attributes&lt;/td&gt;
&lt;td&gt;Root &lt;code&gt;orchestrator&lt;/code&gt; mounts 5 specialized sub-agents via &lt;code&gt;SubAgents: []agent.Agent{...}&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Tools Binding&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Manual method calls&lt;/td&gt;
&lt;td&gt;Uses &lt;code&gt;functiontool.New()&lt;/code&gt; to register type-safe Go function tools (&lt;code&gt;load_url_content&lt;/code&gt;, &lt;code&gt;summarize_youtube_video&lt;/code&gt;, &lt;code&gt;search_nearby_places&lt;/code&gt;)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Model Interface&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Direct call to &lt;code&gt;google.genai.Client&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;Implements &lt;code&gt;google.golang.org/adk/model.LLM&lt;/code&gt; and &lt;code&gt;adkgemini.NewModel&lt;/code&gt; (Vertex AI Backend)&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h3&gt;
  
  
  Next Step: From "Building an ADK Agent Tree" to "Fully Driven by ADK Runner" (&lt;a href="https://github.com/kkdai/linebot-helper-go/issues/13" rel="noopener noreferrer"&gt;Issue #13&lt;/a&gt;)
&lt;/h3&gt;

&lt;p&gt;To ensure the first migration version passes all existing test cases 100%, &lt;code&gt;ProcessText&lt;/code&gt; currently retains the original fast intent routing. However, we have already planned the following 5 exciting ADK upgrades in &lt;strong&gt;&lt;a href="https://github.com/kkdai/linebot-helper-go/issues/13" rel="noopener noreferrer"&gt;Issue #13 (&lt;code&gt;[RFC] Google ADK (v1.9.0) Deep Integration and Architecture Evolution Proposal&lt;/code&gt;)&lt;/a&gt;&lt;/strong&gt;:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Replace Hardcoded Regex Routing with &lt;code&gt;runner.Runner&lt;/code&gt; + &lt;code&gt;SubAgents&lt;/code&gt; / &lt;code&gt;agenttool&lt;/code&gt;&lt;/strong&gt;: When a user enters a composite command in LINE (e.g., "Help me find the restaurant mentioned in this article and save it to bookmarks"), ADK will automatically transfer or call multiple Sub-Agents in parallel.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Add &lt;code&gt;BookmarkAgent&lt;/code&gt; and Research Report &lt;code&gt;functiontool&lt;/code&gt;&lt;/strong&gt;: Users won't need to remember &lt;code&gt;/save&lt;/code&gt; or &lt;code&gt;/search&lt;/code&gt; slash commands; they can simply say "Find the bookmark about MCP I saved last time and make a research report" to trigger it.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Implement &lt;code&gt;adk/session.Service&lt;/code&gt; for Cloud Firestore&lt;/strong&gt;: Wrap the existing &lt;code&gt;firestore.KVStore&lt;/code&gt; into a standard &lt;code&gt;session.Service&lt;/code&gt;, allowing ADK Runner to natively manage multi-turn conversation events and states.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Introduce &lt;code&gt;workflowagents&lt;/code&gt; (&lt;code&gt;sequentialagent&lt;/code&gt; / &lt;code&gt;parallelagent&lt;/code&gt;)&lt;/strong&gt;: Deconstruct deep research reports into a sequential workflow of "Extraction $\rightarrow$ Google Search Verification $\rightarrow$ Report Writing"; change viral copy for FB / LinkedIn / Threads to parallel Sub-Agents for simultaneous output.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Connect LIFF Real-time Voice Assistant's &lt;code&gt;delegate_to_orchestrator&lt;/code&gt; directly to ADK Runner&lt;/strong&gt;.&lt;/li&gt;
&lt;/ol&gt;




&lt;h1&gt;
  
  
  4. Cloud Run Deployment and Slimming Down: Machine Specs Cut Directly to 1/4!
&lt;/h1&gt;

&lt;p&gt;After completing all 10 core packages and unit tests (&lt;code&gt;go vet ./... &amp;amp;&amp;amp; go test ./...&lt;/code&gt; all passed), we deployed &lt;code&gt;linebot-helper-go&lt;/code&gt; directly to Cloud Run.&lt;/p&gt;

&lt;p&gt;Let's look at the container resource configuration comparison between the Python and Go versions on the same GCP project:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Cloud Run Service&lt;/th&gt;
&lt;th&gt;Runtime Environment&lt;/th&gt;
&lt;th&gt;CPU&lt;/th&gt;
&lt;th&gt;Memory&lt;/th&gt;
&lt;th&gt;Concurrency&lt;/th&gt;
&lt;th&gt;CPU Allocation Mode&lt;/th&gt;
&lt;th&gt;Relative Resource Cost&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;&lt;code&gt;linebot-helper-python&lt;/code&gt;&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Python 3.11 + FastAPI&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;4 vCPU&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;4 GiB&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;80&lt;/td&gt;
&lt;td&gt;Always allocated (&lt;code&gt;--no-cpu-throttling&lt;/code&gt;)&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;100%&lt;/code&gt; (Baseline)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;&lt;code&gt;linebot-helper-go&lt;/code&gt;&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;Go 1.26 Native Compilation&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;1 vCPU&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;1 GiB&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;160&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Always allocated (&lt;code&gt;--no-cpu-throttling&lt;/code&gt;)&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;&lt;code&gt;25%&lt;/code&gt; (75% Savings)&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;You might ask: &lt;strong&gt;The resident memory of the Go compiled executable is only 20–30 MB, why not just use &lt;code&gt;512 MiB&lt;/code&gt; instead of &lt;code&gt;1 vCPU / 1 GiB&lt;/code&gt;?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Both numbers have practical engineering considerations behind them:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Why &lt;code&gt;1 vCPU&lt;/code&gt;?&lt;/strong&gt; Because the LINE Bot needs to return &lt;code&gt;200 OK&lt;/code&gt; instantly upon receiving a Webhook and continue running Gemini generation and research report rendering in background Goroutines. Plus, there's a background Ticker polling the Gemini Batch API every 60 seconds. Therefore, &lt;code&gt;--no-cpu-throttling&lt;/code&gt; (CPU always allocated) must be enabled. In Cloud Run specifications, the minimum CPU threshold for enabling &lt;code&gt;--no-cpu-throttling&lt;/code&gt; is &lt;code&gt;1 vCPU&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Why &lt;code&gt;1 GiB Memory&lt;/code&gt;?&lt;/strong&gt; The Go program itself is indeed under 30 MB, but don't forget our 3rd layer Fallback for the URL crawler has &lt;strong&gt;&lt;code&gt;single-file&lt;/code&gt; + Headless Chromium&lt;/strong&gt; installed in the container (used to deal with dynamic rendering sites that even Firecrawl blocks), plus voice message synthesis requires calling &lt;code&gt;ffmpeg&lt;/code&gt;. When Headless Chromium is occasionally awakened, it instantly consumes 300–400 MB of memory. Keeping &lt;code&gt;1 GiB&lt;/code&gt; ensures Chromium never OOMs (Out of Memory) upon startup while cutting machine costs to &lt;strong&gt;1/4&lt;/strong&gt; of the original Python version!&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The deployment command is very clean:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;gcloud run deploy linebot-helper-go &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--source&lt;/span&gt; &lt;span class="nb"&gt;.&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--project&lt;/span&gt; &amp;lt;YOUR_GCP_PROJECT_ID&amp;gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--region&lt;/span&gt; us-central1 &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--cpu&lt;/span&gt; 1 &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--memory&lt;/span&gt; 1Gi &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--allow-unauthenticated&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;--no-cpu-throttling&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h1&gt;
  
  
  5. Seven Devilish Details Most Likely to be Tripped Over or Missed in Cloud Deployment
&lt;/h1&gt;

&lt;p&gt;Moving a LINE Bot from local testing to Cloud Run, or switching from an old Python service to a new Go service, "successful compilation" often only accounts for 60% of the work. The real traps are usually hidden in Cloud Run's runtime lifecycle, network proxies, container sandboxing, and external endpoint settings.&lt;/p&gt;

&lt;p&gt;Here are the &lt;strong&gt;7 key blind spots&lt;/strong&gt; most easily overlooked during this deployment process:&lt;/p&gt;

&lt;h2&gt;
  
  
  Omission 1: Forgot to add &lt;code&gt;--no-cpu-throttling&lt;/code&gt;, or passed &lt;code&gt;r.Context()&lt;/code&gt; into a background Goroutine
&lt;/h2&gt;

&lt;p&gt;LINE Webhook specifications require the server to return &lt;code&gt;200 OK&lt;/code&gt; quickly after receiving an event. Our heavy tasks (such as Grounding deep research reports taking 1–2 minutes, Agentic Vision writing code to draw, voice transcription plus TTS, and the Gemini Batch API Poller polling every 60 seconds) all return &lt;code&gt;200 OK&lt;/code&gt; first, then run &lt;code&gt;go func()&lt;/code&gt; in the background and use &lt;code&gt;PushMessage&lt;/code&gt; to push the result.&lt;/p&gt;

&lt;p&gt;There are two traps here that both beginners and experts are extremely likely to fall into:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Cloud Run "freezes the CPU" by default the moment the HTTP Response is sent&lt;/strong&gt;: If you don't add &lt;code&gt;--no-cpu-throttling&lt;/code&gt;, as soon as &lt;code&gt;handleWebhookCallback&lt;/code&gt; returns &lt;code&gt;200 OK&lt;/code&gt;, Cloud Run will drop the container CPU to near 0 within tens of milliseconds. Your background Goroutine will be stuck in mid-air like it was paused, only moving a few steps when the next HTTP request comes in minutes later. The user will never receive the push!&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Background Goroutines must never use &lt;code&gt;r.Context()&lt;/code&gt;&lt;/strong&gt;: In Go's &lt;code&gt;net/http&lt;/code&gt;, &lt;code&gt;r.Context()&lt;/code&gt; is triggered as &lt;code&gt;Canceled&lt;/code&gt; the moment the HTTP Handler ends (sends &lt;code&gt;200 OK&lt;/code&gt;)! If you casually write &lt;code&gt;go s.handleMessageEvent(r.Context(), event)&lt;/code&gt;, background requests calling Vertex AI or Firestore will die directly with a &lt;code&gt;context canceled&lt;/code&gt; error.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="c"&gt;// ❌ Incorrect: r.Context() will be canceled the moment 200 OK is returned; background tasks will fail.&lt;/span&gt;
&lt;span class="k"&gt;go&lt;/span&gt; &lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;handleMessageEvent&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Context&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt; &lt;span class="n"&gt;eventCopy&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c"&gt;// ✅ Correct: Detach from the HTTP Request lifecycle, use an independent Background Context (set Timeout internally).&lt;/span&gt;
&lt;span class="k"&gt;go&lt;/span&gt; &lt;span class="n"&gt;s&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;handleMessageEvent&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;context&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Background&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt; &lt;span class="n"&gt;eventCopy&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Omission 2: Vertex AI &lt;code&gt;GOOGLE_CLOUD_LOCATION=global&lt;/code&gt; Domain Concatenation Trap
&lt;/h2&gt;

&lt;p&gt;When reusing old environment variables, we saw &lt;code&gt;GOOGLE_CLOUD_LOCATION=global&lt;/code&gt; (because many Gemini 3.x Preview models in Vertex AI are under the &lt;code&gt;global&lt;/code&gt; location).&lt;/p&gt;

&lt;p&gt;If you write a Vertex AI REST Client in Go and follow the habit for general regions by using &lt;code&gt;fmt.Sprintf("https://%s-aiplatform.googleapis.com", location)&lt;/code&gt;, when &lt;code&gt;location&lt;/code&gt; is &lt;code&gt;"global"&lt;/code&gt;, the resulting URL becomes:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;❌ &lt;code&gt;https://global-aiplatform.googleapis.com&lt;/code&gt; (&lt;strong&gt;This domain doesn't exist in GCP; DNS lookup will fail!&lt;/strong&gt;)&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;In Vertex AI specifications, only regional endpoints (like &lt;code&gt;us-central1&lt;/code&gt;, &lt;code&gt;asia-east1&lt;/code&gt;) have a prefix; when the Location is &lt;code&gt;global&lt;/code&gt;, you must switch to the prefix-less &lt;code&gt;https://aiplatform.googleapis.com&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;c&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;Client&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="n"&gt;vertexEndpointBase&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;c&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;VertexBaseURL&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="s"&gt;""&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;strings&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;TrimRight&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;c&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;VertexBaseURL&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"/"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;c&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Location&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="s"&gt;""&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="n"&gt;c&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Location&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="s"&gt;"global"&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s"&gt;"https://aiplatform.googleapis.com"&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;fmt&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Sprintf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"https://%s-aiplatform.googleapis.com"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;c&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Location&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Omission 3: Moving Environment Variables Using &lt;code&gt;--set-env-vars&lt;/code&gt; Leading to Character Truncation or Secret Leakage
&lt;/h2&gt;

&lt;p&gt;When moving over a dozen environment variables from &lt;code&gt;linebot-helper-python&lt;/code&gt; to &lt;code&gt;linebot-helper-go&lt;/code&gt;, never manually string together &lt;code&gt;--set-env-vars="KEY1=VAL1,KEY2=VAL2..."&lt;/code&gt;:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;If any Token or Prompt string contains a comma &lt;code&gt;,&lt;/code&gt; or equals sign &lt;code&gt;=&lt;/code&gt;, &lt;code&gt;gcloud&lt;/code&gt;'s parameter parsing will split at the wrong position or even error out.&lt;/li&gt;
&lt;li&gt;Putting environment variables directly in the command line parameters leaves the entire Secret string in the terminal history or conversation logs.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;The safest way&lt;/strong&gt;: Directly export the temporary &lt;code&gt;/tmp/env.yaml&lt;/code&gt; locally using &lt;code&gt;gcloud run services describe --format=json&lt;/code&gt;, feed it in during deployment using &lt;code&gt;--env-vars-file=/tmp/env.yaml&lt;/code&gt;, and &lt;code&gt;rm -f /tmp/env.yaml&lt;/code&gt; immediately after deployment. This way, no Secrets are printed, and all special characters are 100% preserved.&lt;/p&gt;

&lt;h2&gt;
  
  
  Omission 4: Ignoring Cloud Run Reverse Proxy's &lt;code&gt;X-Forwarded-Proto&lt;/code&gt;, Leading to LINE Rejecting Images and Audio
&lt;/h2&gt;

&lt;p&gt;This LINE Bot needs to dynamically assemble "public URLs pointing to its own server" in four places:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Research report page: &lt;code&gt;https://&amp;lt;host&amp;gt;/reports/{report_id}&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Agentic Vision annotated image: &lt;code&gt;https://&amp;lt;host&amp;gt;/images/{image_id}&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;TTS voice synthesis audio file: &lt;code&gt;https://&amp;lt;host&amp;gt;/audio/{audio_id}&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Gemini Batch API Dynamic Webhook: &lt;code&gt;https://&amp;lt;host&amp;gt;/api/gemini-callback/dynamic&lt;/code&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Note: &lt;strong&gt;LINE Messaging API's &lt;code&gt;ImageMessage&lt;/code&gt; and &lt;code&gt;AudioMessage&lt;/code&gt; strictly require URLs to be &lt;code&gt;https://&lt;/code&gt;&lt;/strong&gt;. In the Cloud Run architecture, HTTPS TLS is terminated at the outer Google Front End (GFE), so &lt;code&gt;r.TLS&lt;/code&gt; is &lt;code&gt;nil&lt;/code&gt; when it reaches the Go &lt;code&gt;http.Request&lt;/code&gt; inside the container. If you don't read the &lt;code&gt;X-Forwarded-Proto&lt;/code&gt; and &lt;code&gt;X-Forwarded-Host&lt;/code&gt; headers, the assembled &lt;code&gt;http://&lt;/code&gt; URL will be rejected by the LINE Push API!&lt;/p&gt;

&lt;h2&gt;
  
  
  Omission 5: Pursuing Minimalist Go Images (&lt;code&gt;scratch&lt;/code&gt; / &lt;code&gt;distroless&lt;/code&gt;) but Forgetting External Executables and Chromium Sandbox Restrictions
&lt;/h2&gt;

&lt;p&gt;When writing Go services, we often use &lt;code&gt;FROM gcr.io/distroless/static&lt;/code&gt; to compress the Docker Image to under 20MB. But doing this for this multi-functional LINE Bot will immediately hit a wall:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Missing &lt;code&gt;ffmpeg&lt;/code&gt;&lt;/strong&gt;: After receiving PCM from Gemini for TTS synthesis, calling &lt;code&gt;exec.Command("ffmpeg", ...)&lt;/code&gt; to convert to &lt;code&gt;.m4a&lt;/code&gt; will report &lt;code&gt;executable file not found&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Missing Headless Chromium, Chinese Fonts, and Container Sandbox Flags&lt;/strong&gt;: The 3rd layer Fallback of the crawler uses &lt;code&gt;single-file&lt;/code&gt; to drive Headless Chromium. In Cloud Run's container sandbox environment, if you don't add &lt;code&gt;--no-sandbox&lt;/code&gt;, &lt;code&gt;--disable-gpu&lt;/code&gt;, and &lt;code&gt;--disable-dev-shm-usage&lt;/code&gt; (because the container's default &lt;code&gt;/dev/shm&lt;/code&gt; shared memory is small) to Chromium, or if the base image doesn't have &lt;code&gt;fonts-noto-cjk&lt;/code&gt; installed (resulting in garbled text on captured Chinese web pages) and &lt;code&gt;ca-certificates&lt;/code&gt; (HTTPS certificate verification failure), the crawler will silently crash in the cloud.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Therefore, our &lt;a href="https://github.com/kkdai/linebot-helper-go/blob/main/Dockerfile" rel="noopener noreferrer"&gt;&lt;code&gt;Dockerfile&lt;/code&gt;&lt;/a&gt; uses &lt;code&gt;golang:1.26-bookworm&lt;/code&gt; for compilation, and the Runtime stage uses &lt;code&gt;debian:bookworm-slim&lt;/code&gt; with explicit installation of &lt;code&gt;ca-certificates&lt;/code&gt;, &lt;code&gt;ffmpeg&lt;/code&gt;, &lt;code&gt;chromium&lt;/code&gt;, &lt;code&gt;fonts-noto-cjk&lt;/code&gt;, and &lt;code&gt;@single-file/cli&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Omission 6: State Splitting Between In-Memory Caching and Cloud Run Auto-scaling (Multi-Instance)
&lt;/h2&gt;

&lt;p&gt;Although we have persisted the four core states—chat history, bookmarks, research reports, and Batch Job mappings—to Cloud Firestore, some binary data with a "lifecycle of only 5 minutes" is stored in a Go in-memory map:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Images just uploaded by users, waiting for the "Identify Image / Agentic Vision" Quick Reply selection (&lt;code&gt;imageTempStore&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;PNGs just drawn with bounding boxes, waiting for the LINE server to pull them (&lt;code&gt;/images/{image_id}&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;M4A audio files just synthesized, waiting for the LINE server to pull them (&lt;code&gt;/audio/{audio_id}&lt;/code&gt;).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;This works perfectly under a single instance, but once Cloud Run scales to 2 or more instances due to a burst in traffic, state splitting occurs&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;User sends an image to &lt;strong&gt;Instance A&lt;/strong&gt; (image stored in A's memory).&lt;/li&gt;
&lt;li&gt;3 seconds later, the user clicks the "Agentic Vision" button, and the Webhook hits &lt;strong&gt;Instance B&lt;/strong&gt; $\rightarrow$ B can't find the image and replies "⚠️ Image expired, please resend!"&lt;/li&gt;
&lt;li&gt;Or &lt;strong&gt;Instance A&lt;/strong&gt; generates &lt;code&gt;/audio/{id}&lt;/code&gt; and calls the LINE Reply API, but when the LINE media server comes to download the audio, it hits &lt;strong&gt;Instance B&lt;/strong&gt;, gets a &lt;code&gt;404&lt;/code&gt;, and the user only sees an unplayable voice bubble in the chat room.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Solution&lt;/strong&gt;: Since a single Go instance can easily handle high concurrency (we set &lt;code&gt;containerConcurrency&lt;/code&gt; to &lt;code&gt;160&lt;/code&gt;), for personal or small-to-medium assistants, it's recommended to limit &lt;code&gt;--max-instances&lt;/code&gt; to &lt;code&gt;1&lt;/code&gt; (if multi-instance high availability is needed in the future, the caching for &lt;code&gt;/images&lt;/code&gt; and &lt;code&gt;/audio&lt;/code&gt; must be rewritten to Cloud Storage or Firestore).&lt;/p&gt;

&lt;h2&gt;
  
  
  Omission 7: Only Changing the Messaging API Webhook During Switching, but Missing Firebase Hosting WebSocket Restrictions and LIFF Endpoint
&lt;/h2&gt;

&lt;p&gt;When preparing to switch from the old service to the new one, the following three peripheral settings are most commonly missed:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Checkpoint&lt;/th&gt;
&lt;th&gt;Why is it easily missed?&lt;/th&gt;
&lt;th&gt;Actual Impact and Correct Practice&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;1. Is the existing Webhook hidden behind Firebase Hosting?&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;When querying existing settings via LINE API (&lt;code&gt;GET /v2/bot/channel/webhook/endpoint&lt;/code&gt;), we found the original Webhook pointed to &lt;code&gt;*.firebaseapp.com&lt;/code&gt; (rewritten to Cloud Run by &lt;code&gt;firebase.json&lt;/code&gt;).&lt;/td&gt;
&lt;td&gt;
&lt;strong&gt;Firebase Hosting does not support WebSocket proxying!&lt;/strong&gt; If the LIFF voice assistant (&lt;code&gt;/ws/voice/{id}&lt;/code&gt;) goes through the Firebase Hosting domain, the WebSocket handshake will fail. Therefore, when switching, point directly to the Cloud Run URL or ensure LIFF uses a direct connection.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;2. LIFF Endpoint URL of the LINE Login Channel&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;LIFF App settings are not in the Messaging API Channel but in the &lt;strong&gt;LINE Login Channel&lt;/strong&gt; tab under the same Provider.&lt;/td&gt;
&lt;td&gt;If you only change the Webhook and not the LIFF Endpoint, the chat room text will be handled by the new Go version, but opening the voice assistant will still connect back to the old Python version.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;3. Gemini Batch API Static Webhook / Eventarc&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;If Eventarc or a project-level static Webhook is set in GCP to point to &lt;code&gt;/api/gemini-callback/static&lt;/code&gt;.&lt;/td&gt;
&lt;td&gt;Remember to update the target URL as well (while the Dynamic Webhook &lt;code&gt;/api/gemini-callback/dynamic&lt;/code&gt; will automatically capture the Host of the incoming request, requiring no manual modification).&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;h1&gt;
  
  
  6. Inventory Before Switching: Identifying Three "Zombie Endpoints" from GCP Logs and Planning to Incorporate &lt;code&gt;n8n&lt;/code&gt; Schedules!
&lt;/h1&gt;

&lt;p&gt;While writing the "Switching from Python Version" steps in the README, I originally listed:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"Change external schedules calling &lt;code&gt;/hn&lt;/code&gt;, &lt;code&gt;/hf&lt;/code&gt;, and &lt;code&gt;/urls&lt;/code&gt; to point to the new service."&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;But then I thought: &lt;strong&gt;Wait, are these three endpoints actually still being called by my &lt;code&gt;n8n&lt;/code&gt;?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;We immediately used &lt;code&gt;gcloud logging read&lt;/code&gt; to pull execution records for the &lt;code&gt;linebot-helper-python&lt;/code&gt; and &lt;code&gt;n8n&lt;/code&gt; services in the GCP project, and found a big surprise:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;/hn&lt;/code&gt;, &lt;code&gt;/hf&lt;/code&gt;, and &lt;code&gt;/urls&lt;/code&gt; were endpoints written in the first version in &lt;strong&gt;November 2024&lt;/strong&gt;, intended for external schedules to POST URL arrays for the LINE Bot to summarize and push.&lt;/li&gt;
&lt;li&gt;But the &lt;code&gt;n8n&lt;/code&gt; service currently in the cloud (running four active workflows: &lt;strong&gt;"RSS to Sheet"&lt;/strong&gt;, &lt;strong&gt;"Daily Tasks (Fetch Papers/Share Videos)"&lt;/strong&gt;, &lt;strong&gt;"Daily LINE Sender"&lt;/strong&gt;, and &lt;strong&gt;"AI Trends Automated Newsletter"&lt;/strong&gt;) had already been changed to &lt;strong&gt;run Firecrawl internally in &lt;code&gt;n8n&lt;/code&gt;, call Gemini for summaries, assemble Flex JSON, and directly hit &lt;code&gt;https://api.line.me/v2/bot/message/push&lt;/code&gt;&lt;/strong&gt;!&lt;/li&gt;
&lt;li&gt;In other words, the number of calls to &lt;code&gt;/hn&lt;/code&gt;, &lt;code&gt;/hf&lt;/code&gt;, and &lt;code&gt;/urls&lt;/code&gt; on &lt;code&gt;linebot-helper-python&lt;/code&gt; from &lt;code&gt;n8n&lt;/code&gt; over the past few months &lt;strong&gt;was 0&lt;/strong&gt;!&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Even more interestingly, while checking &lt;code&gt;n8n&lt;/code&gt;'s Debug Logs, we accidentally caught &lt;code&gt;n8n&lt;/code&gt; failing to push YouTube new video summaries at 6 AM because of word count or thumbnail format issues in the Flex Carousel assembled by the Javascript node, with the LINE API returning:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Workflow execution finished with error: A message (messages[0]) in the request body is invalid
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This discovery led us to make two immediate decisions:&lt;/p&gt;

&lt;h3&gt;
  
  
  Decision 1: Immediately remove &lt;code&gt;/hn&lt;/code&gt;, &lt;code&gt;/hf&lt;/code&gt;, and &lt;code&gt;/urls&lt;/code&gt; from &lt;code&gt;linebot-helper-go&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;Since no external services are calling them, keeping them on the public Cloud Run only adds three attack surfaces without signature protection. After removing them from &lt;code&gt;server.go&lt;/code&gt; and redeploying, hitting &lt;code&gt;/hn&lt;/code&gt;, &lt;code&gt;/hf&lt;/code&gt;, or &lt;code&gt;/urls&lt;/code&gt; online returns &lt;code&gt;404 Not Found&lt;/code&gt;. When switching, I only need to change the &lt;strong&gt;Webhook URL&lt;/strong&gt; and &lt;strong&gt;LIFF Endpoint URL&lt;/strong&gt; in the LINE Developers Console!&lt;/p&gt;

&lt;h3&gt;
  
  
  Decision 2: Open &lt;a href="https://github.com/kkdai/linebot-helper-go/issues/14" rel="noopener noreferrer"&gt;Issue #14&lt;/a&gt; ~ &lt;a href="https://github.com/kkdai/linebot-helper-go/issues/19" rel="noopener noreferrer"&gt;Issue #19&lt;/a&gt; to incorporate &lt;code&gt;n8n&lt;/code&gt; workflows into &lt;code&gt;linebot-helper-go&lt;/code&gt;!
&lt;/h3&gt;

&lt;p&gt;Since &lt;code&gt;linebot-helper-go&lt;/code&gt; is already a high-speed Go server always resident at &lt;code&gt;1 vCPU / 1 GiB&lt;/code&gt; (&lt;code&gt;--no-cpu-throttling&lt;/code&gt;), and it has a built-in three-layer crawler &lt;code&gt;loader.Loader&lt;/code&gt;, strongly-typed LINE Flex Builder, Gemini Batch API, Firestore &lt;code&gt;BookmarkService&lt;/code&gt;, and &lt;code&gt;ReportStore&lt;/code&gt;, why maintain a separate &lt;code&gt;n8n&lt;/code&gt; + Postgres database?&lt;/p&gt;

&lt;p&gt;More importantly—&lt;strong&gt;if these daily schedules are all moved to &lt;code&gt;linebot-helper-go&lt;/code&gt; and pushed through the same LINE Official Account, a perfect closed loop of "Push $\rightarrow$ Interaction" can be achieved&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;&lt;a href="https://github.com/kkdai/linebot-helper-go/issues/14" rel="noopener noreferrer"&gt;Issue #14 (&lt;code&gt;Batch Task 1/5&lt;/code&gt;)&lt;/a&gt;&lt;/strong&gt;: Establish a protected &lt;code&gt;POST /api/tasks/{task_name}&lt;/code&gt; schedule endpoint and a Firestore &lt;code&gt;feed_items&lt;/code&gt; deduplication queue (replacing the old method of comparing rows in Google Sheets), unifying pushes using the main official account.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;a href="https://github.com/kkdai/linebot-helper-go/issues/15" rel="noopener noreferrer"&gt;Issue #15 (&lt;code&gt;Batch Task 2/5&lt;/code&gt;)&lt;/a&gt;&lt;/strong&gt;: Fetch &lt;strong&gt;Hugging Face Daily Papers&lt;/strong&gt; every day at 10:00. When pushing paper summary cards, directly attach &lt;strong&gt;"🔖 Save Bookmark"&lt;/strong&gt; and &lt;strong&gt;"📄 Detailed Research Report"&lt;/strong&gt; buttons, allowing one-click generation of Grounding deep web reports for good papers.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;a href="https://github.com/kkdai/linebot-helper-go/issues/16" rel="noopener noreferrer"&gt;Issue #16 (&lt;code&gt;Batch Task 3/5&lt;/code&gt;)&lt;/a&gt;&lt;/strong&gt;: Inspect &lt;strong&gt;YouTube subscription channel new videos&lt;/strong&gt; every day at 06:00. Use Go's strongly-typed Flex Builder to completely solve &lt;code&gt;n8n&lt;/code&gt;'s &lt;code&gt;400 Invalid Request Body&lt;/code&gt; issue, and attach a &lt;strong&gt;"📝 Detailed Summary"&lt;/strong&gt; Postback button directly to the card.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;a href="https://github.com/kkdai/linebot-helper-go/issues/17" rel="noopener noreferrer"&gt;Issue #17 (&lt;code&gt;Batch Task 4/5&lt;/code&gt;)&lt;/a&gt;&lt;/strong&gt;: Integrate multi-source RSS inspection from HN, Hatena IT, Google Dev Blog, LY Blog, Steam, etc., with daily 06:00 featured pushes.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;a href="https://github.com/kkdai/linebot-helper-go/issues/18" rel="noopener noreferrer"&gt;Issue #18 (&lt;code&gt;Batch Task 5/5&lt;/code&gt;)&lt;/a&gt;&lt;/strong&gt;: Aggregate weekly featured content and bookmarks every Friday at 17:00, rendering them directly into a beautiful &lt;code&gt;/reports/{id}&lt;/code&gt; web version &lt;strong&gt;AI Trends Weekly&lt;/strong&gt; pushed to LINE.&lt;/li&gt;
&lt;/ul&gt;




&lt;h1&gt;
  
  
  7. One Last Security Reminder: Don't Leave Real Cloud Run URLs in Public Git History
&lt;/h1&gt;

&lt;p&gt;After writing the deployment records and switching tutorial, I did one very important cleanup task: &lt;strong&gt;replaced all occurrences of &lt;code&gt;.run.app&lt;/code&gt; real service URLs, GCP Project Numbers, and LIFF IDs in &lt;code&gt;README.md&lt;/code&gt; and GitHub Issue comments with &lt;code&gt;&amp;lt;YOUR_CLOUD_RUN_SERVICE_URL&amp;gt;&lt;/code&gt; placeholders, and rewrote the Git Commit history to eliminate traces.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The reason is simple: The LINE Bot's Cloud Run service must be set to &lt;code&gt;--allow-unauthenticated&lt;/code&gt; to receive Webhooks from the LINE platform. Although our &lt;code&gt;POST /&lt;/code&gt; has strict &lt;code&gt;X-Line-Signature&lt;/code&gt; verification (requests without a Channel Secret signature are blocked with a &lt;code&gt;400&lt;/code&gt;), writing the real &lt;code&gt;.run.app&lt;/code&gt; URL directly in a public GitHub Repo's README still easily attracts unnecessary automated crawler scans and traffic noise.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Sharing architecture and implementation with public code while keeping real endpoints only in your own configuration backend&lt;/strong&gt; is the most reassuring way to maintain a personal AI assistant in the long run.&lt;/p&gt;




&lt;h1&gt;
  
  
  8. Cloud Run Deployment and Migration Self-Checklist
&lt;/h1&gt;

&lt;p&gt;If you also plan to rewrite an existing Python LINE Bot into Go and move it to Cloud Run, you can use this checklist to tick off items before switching traffic:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt; &lt;strong&gt;1. CPU Throttling Setting&lt;/strong&gt;: As long as there are background Goroutines (Webhook returns &lt;code&gt;200 OK&lt;/code&gt; followed by background push, or background periodic Ticker), be sure to add &lt;code&gt;--no-cpu-throttling&lt;/code&gt; (and set CPU to at least &lt;code&gt;1&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;2. Context Lifecycle Decoupling&lt;/strong&gt;: Background Goroutines are prohibited from passing in &lt;code&gt;r.Context()&lt;/code&gt;; always use &lt;code&gt;context.Background()&lt;/code&gt; with an independent &lt;code&gt;context.WithTimeout&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;3. Vertex AI &lt;code&gt;global&lt;/code&gt; Domain Judgment&lt;/strong&gt;: If &lt;code&gt;GOOGLE_CLOUD_LOCATION=global&lt;/code&gt;, confirm the Endpoint Base URL is &lt;code&gt;https://aiplatform.googleapis.com&lt;/code&gt; instead of &lt;code&gt;global-aiplatform.googleapis.com&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;4. External Binary Tools and Fonts&lt;/strong&gt;: If &lt;code&gt;ffmpeg&lt;/code&gt;, &lt;code&gt;single-file&lt;/code&gt;, or Headless Chromium are called inside the container, confirm the final stage Docker Image includes the corresponding executables, &lt;code&gt;ca-certificates&lt;/code&gt;, &lt;code&gt;fonts-noto-cjk&lt;/code&gt;, and Chromium's &lt;code&gt;--no-sandbox --disable-dev-shm-usage&lt;/code&gt; parameters.&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;5. Reverse Proxy HTTPS Headers&lt;/strong&gt;: When dynamically generating &lt;code&gt;/images/{id}&lt;/code&gt;, &lt;code&gt;/audio/{id}&lt;/code&gt;, and &lt;code&gt;/reports/{id}&lt;/code&gt; URLs, prioritize reading &lt;code&gt;X-Forwarded-Proto&lt;/code&gt; and &lt;code&gt;X-Forwarded-Host&lt;/code&gt; to ensure media URLs sent to LINE are always &lt;code&gt;https://&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;6. In-Memory Caching and Instance Count&lt;/strong&gt;: If there are short-lived memory maps (like cached images/audio), it's recommended to set &lt;code&gt;--max-instances=1&lt;/code&gt; and increase &lt;code&gt;concurrency&lt;/code&gt;, or switch to GCS / Firestore to avoid state splitting across multiple instances.&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;7. Dual-channel LINE Setting Synchronization&lt;/strong&gt;: In addition to updating the &lt;strong&gt;Messaging API&lt;/strong&gt; Webhook URL, don't forget to update the &lt;strong&gt;LIFF Endpoint URL&lt;/strong&gt; of the &lt;strong&gt;LINE Login Channel&lt;/strong&gt; under the same Provider, and confirm the WebSocket path is not intercepted by a CDN / Firebase Hosting that doesn't support WS.&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;8. Clean Up Obsolete Endpoints and Public Information&lt;/strong&gt;: Confirm useless old endpoints (like &lt;code&gt;/hn&lt;/code&gt;, &lt;code&gt;/hf&lt;/code&gt;, &lt;code&gt;/urls&lt;/code&gt;) from Cloud Logging and remove them, and ensure the public Repo and Git history do not contain real &lt;code&gt;.run.app&lt;/code&gt; URLs and keys.&lt;/li&gt;
&lt;/ul&gt;




&lt;h1&gt;
  
  
  Summary and Open Source Project Links
&lt;/h1&gt;

&lt;p&gt;From this rewriting journey from &lt;strong&gt;&lt;a href="https://github.com/kkdai/linebot-helper-python" rel="noopener noreferrer"&gt;&lt;code&gt;kkdai/linebot-helper-python&lt;/code&gt;&lt;/a&gt;&lt;/strong&gt; to &lt;strong&gt;&lt;a href="https://github.com/kkdai/linebot-helper-go" rel="noopener noreferrer"&gt;&lt;code&gt;kkdai/linebot-helper-go&lt;/code&gt;&lt;/a&gt;&lt;/strong&gt;, here are the most valuable takeaways:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Open Issues Before Writing Code&lt;/strong&gt;: 11 milestone Issues made the large-scale language rewrite highly controllable, with each module independently passing unit tests before being layered.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Shared Data Layer is the Foundation for Zero-Downtime Migration&lt;/strong&gt;: As long as the Firestore Collection Schemas are aligned, services in the two languages can be switched painlessly at any time.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Go's Resource Efficiency on Cloud Run is Extremely High&lt;/strong&gt;: Even with Headless Chromium and &lt;code&gt;ffmpeg&lt;/code&gt; mounted, switching from Python's &lt;code&gt;4 vCPU / 4 GiB&lt;/code&gt; to Go's &lt;code&gt;1 vCPU / 1 GiB&lt;/code&gt; cut the bill to 25%, with even faster response times.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Check Cloud Logging Before Switching&lt;/strong&gt;: Real traffic logs don't lie; you can see at a glance which endpoints are already retired and which external &lt;code&gt;n8n&lt;/code&gt; workflows are actually better suited to be incorporated into the same service.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The complete source code and subsequent ADK v1.9.0 / Batch Tasks evolution plans are all open-sourced on GitHub: &lt;strong&gt;&lt;a href="https://github.com/kkdai/linebot-helper-go" rel="noopener noreferrer"&gt;&lt;code&gt;kkdai/linebot-helper-go&lt;/code&gt;&lt;/a&gt;&lt;/strong&gt;. Feel free to refer to it and exchange ideas!&lt;/p&gt;

</description>
      <category>ai</category>
      <category>backend</category>
      <category>cloud</category>
      <category>go</category>
    </item>
    <item>
      <title>[AI in Practice] Rewriting a LINE Research Bot from Python Managed Agents to Go ADK v1.9.0: From Sandbox Files to Session State,</title>
      <dc:creator>Evan Lin</dc:creator>
      <pubDate>Tue, 03 Nov 2026 13:28:58 +0000</pubDate>
      <link>https://dev.to/gde/ai-in-practice-rewriting-a-line-research-bot-from-python-managed-agents-to-go-adk-v190-from-4c50</link>
      <guid>https://dev.to/gde/ai-in-practice-rewriting-a-line-research-bot-from-python-managed-agents-to-go-adk-v190-from-4c50</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fgz8wlbx0imdo4ue58z5i.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fgz8wlbx0imdo4ue58z5i.png" alt="LINE Research Bot: Managed Agents (Python) → ADK for Go v1.9.0 on Cloud Run" width="800" height="447"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Recap
&lt;/h1&gt;

&lt;p&gt;In the &lt;a href="https://dev.to/gde/geminiagent-google-managed-agents-api-4e43"&gt;previous post "Comprehensive Analysis of Managed Agents API"&lt;/a&gt;, I created an open-source LINE Research Planner Bot: &lt;strong&gt;&lt;a href="https://github.com/kkdai/line-research-bot" rel="noopener noreferrer"&gt;&lt;code&gt;kkdai/line-research-bot&lt;/code&gt;&lt;/a&gt;&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;How it works is simple:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Send " &lt;strong&gt;Research the selection of SOTA open-source vector databases&lt;/strong&gt; " to the LINE Bot. The Bot will sequentially run through three stages: &lt;strong&gt;PLAN → SEARCH_COMPARE → WRITE_REPORT&lt;/strong&gt;. First, it designs 4–8 sets of search keywords, then uses Google Search + URL Context to read real web pages and cross-compare "consensus / disagreement / gaps," and finally writes a Traditional Chinese Markdown report with footnote citations.&lt;/li&gt;
&lt;li&gt;The report is rendered into HTML by Cloud Run and uploaded to Cloud Storage. LINE receives a Flex card with a summary, main sources, and a "Read Full Report" button.&lt;/li&gt;
&lt;li&gt;If you later send " &lt;strong&gt;Go deeper into Chapter 2, add Japanese sources&lt;/strong&gt; ", the Bot will deepen the same report, increment the version number by +1, and automatically save the old version as a snapshot.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The first version used &lt;strong&gt;Python 3.11 + FastAPI + &lt;code&gt;google-genai&lt;/code&gt; (&lt;code&gt;enterprise=True&lt;/code&gt;)&lt;/strong&gt; to call the Pre-GA &lt;strong&gt;Managed Agents API&lt;/strong&gt;. It relied on the official sandbox's &lt;strong&gt;persistent filesystem&lt;/strong&gt;: &lt;code&gt;/workspace/plan.json&lt;/code&gt;, &lt;code&gt;/workspace/sources.json&lt;/code&gt;, and &lt;code&gt;/workspace/report.md&lt;/code&gt; survived across turns under the same &lt;code&gt;environment_id&lt;/code&gt;, allowing the Agent to read the files itself when deepening the research.&lt;/p&gt;

&lt;p&gt;It was fun, but after running it for a while, a few things kept me uneasy:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Pre-GA, no SLA&lt;/strong&gt;: Names like &lt;code&gt;base_agent: antigravity-preview-05-2026&lt;/code&gt; clearly indicate they will change one day.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;gsutil&lt;/code&gt; in the sandbox is mocked&lt;/strong&gt; (Pitfall #2 from the previous post). As a result, after writing the report, the Agent still had to stuff the entire Markdown back into a JSON for Cloud Run to upload. The value of the sandbox filesystem was essentially reduced to "remembering three files across turns."&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Must use &lt;code&gt;background=True&lt;/code&gt; + manual polling loop&lt;/strong&gt;: If Stage 2/3 was slow, the timeout had to be adjusted (I once tuned it from 240 seconds all the way to 600 seconds).&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So this time, I decided: &lt;strong&gt;Rewrite the entire service in Go, use Google's official &lt;a href="https://github.com/google/adk-go" rel="noopener noreferrer"&gt;ADK for Go&lt;/a&gt; (&lt;code&gt;google.golang.org/adk&lt;/code&gt; v1.9.0) for everything Agent-related, and deploy it back to the original Cloud Run service using the exact same environment variables.&lt;/strong&gt; I recorded the entire process in the original repo's &lt;a href="https://github.com/kkdai/line-research-bot/issues/1" rel="noopener noreferrer"&gt;Issue #1&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;After completing the rewrite, I separated the Go version into a new repo so that the Python version cited in the previous article remains unchanged. The two versions can be directly compared:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Repo&lt;/th&gt;
&lt;th&gt;Content&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;&lt;a href="https://github.com/kkdai/line-research-bot" rel="noopener noreferrer"&gt;&lt;code&gt;kkdai/line-research-bot&lt;/code&gt;&lt;/a&gt;&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Original Python 3.11 + FastAPI + Managed Agents version (example from the previous article), and the &lt;a href="https://github.com/kkdai/line-research-bot/issues/1" rel="noopener noreferrer"&gt;Issue #1&lt;/a&gt; record of this migration&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;&lt;a href="https://github.com/kkdai/line-research-bot-go" rel="noopener noreferrer"&gt;&lt;code&gt;kkdai/line-research-bot-go&lt;/code&gt;&lt;/a&gt;&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;The protagonist of this post: Go 1.27 + ADK for Go v1.9.0, currently running on Cloud Run&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;h1&gt;
  
  
  I. Clarification: It wasn't actually "Python ADK" before
&lt;/h1&gt;

&lt;p&gt;Many people (including myself initially) mix up Managed Agents and ADK, but they are two different things:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Comparison Item&lt;/th&gt;
&lt;th&gt;Original Python Version&lt;/th&gt;
&lt;th&gt;New Go Version&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Agent Execution Location&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Google-managed sandbox (Managed Agents API)&lt;/td&gt;
&lt;td&gt;Within your own Cloud Run container (ADK Runner)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;SDK&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;google-genai&lt;/code&gt; (&lt;code&gt;enterprise=True&lt;/code&gt;), &lt;strong&gt;not&lt;/strong&gt; using &lt;code&gt;google-adk&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;
&lt;strong&gt;&lt;code&gt;google.golang.org/adk v1.9.0&lt;/code&gt;&lt;/strong&gt; + &lt;code&gt;google.golang.org/genai&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Agent Definition&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;deploy/create-agent.sh&lt;/code&gt; uses curl to call REST API to create a &lt;code&gt;research-planner&lt;/code&gt; resource&lt;/td&gt;
&lt;td&gt;In-code &lt;code&gt;llmagent.New(llmagent.Config{...})&lt;/code&gt; × 3&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Tools&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;code_execution&lt;/code&gt;, &lt;code&gt;filesystem&lt;/code&gt;, &lt;code&gt;google_search&lt;/code&gt;, &lt;code&gt;url_context&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;geminitool.GoogleSearch{}&lt;/code&gt; + &lt;code&gt;url_context&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Cross-turn State&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Sandbox filesystem (&lt;code&gt;environment_id&lt;/code&gt;)&lt;/td&gt;
&lt;td&gt;ADK Session State + Firestore &lt;code&gt;line_bot_workspaces&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Structured Output&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Prompt says "Return ONLY the JSON" + manual code fence stripping&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;OutputSchema&lt;/code&gt; (ADK automatically injects &lt;code&gt;set_model_response&lt;/code&gt;)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Invocation Method&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;interactions.create(background=True)&lt;/code&gt; + polling every 3s&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;runner.Run()&lt;/code&gt; returns Go 1.23+ iterator, synchronous event consumption&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;So this time, rather than "Python ADK → Go ADK," it's more accurate to say: &lt;strong&gt;Replacing the hosted Managed Agent with a self-controlled ADK Agent&lt;/strong&gt;. The benefit is that you no longer have to worry about mocked &lt;code&gt;gsutil&lt;/code&gt; in the sandbox, background polling modes, or Pre-GA uncertainty.&lt;/p&gt;




&lt;h1&gt;
  
  
  II. Setting Rules Before Rewriting: One Issue, Feasibility Verification First
&lt;/h1&gt;

&lt;p&gt;This project is much smaller than the previous &lt;code&gt;linebot-helper&lt;/code&gt; (Python version ~1,400 lines, Go version ~2,000 lines, excluding tests), so instead of splitting it into 11 issues, I opened one &lt;a href="https://github.com/kkdai/line-research-bot/issues/1" rel="noopener noreferrer"&gt;Tracking Issue #1&lt;/a&gt;. I wrote a checklist covering "Current Status Audit → Design → Feasibility Verification → Rewriting → Testing → Deployment → Verification," commenting on the issue as each section was completed.&lt;/p&gt;

&lt;p&gt;Before writing a single line of Go, I did two things:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;gcloud run services describe&lt;/code&gt; to pull the online service configuration&lt;/strong&gt; (Service Account, 11 environment variables, Secret Manager bindings, memory, timeout) to ensure a 1:1 migration.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Wrote a 30-line probe program&lt;/strong&gt; to confirm if ADK for Go on Vertex AI could enable " &lt;strong&gt;Google Search + URL Context + OutputSchema all at once&lt;/strong&gt; ". This was the key to whether the design would work; the results are discussed in Section IV.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Once confirmed feasible, the Go version (module path &lt;code&gt;github.com/kkdai/line-research-bot-go&lt;/code&gt;) was split into the following modules:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;cmd/server/ main: Dependency injection, HTTP server, graceful shutdown
internal/research/ ADK for Go: Three llmagents + runner + session state
  prompts/ plan / search_compare / write_report (go:embed)
internal/worker/ PLAN → SEARCH_COMPARE → WRITE_REPORT → publish, deepen, retry
internal/server/ /webhook, /tasks/run-research, /readyz
internal/state/ Firestore (users / reports compatible + new workspaces)
internal/publisher/ goldmark (GFM + footnote) → HTML → GCS (including snapshots)
internal/linebot/ line-bot-sdk-go v8 + HMAC verification
internal/tasks/ Cloud Tasks (OIDC)
internal/intent, flex/ Intent classification, Flex cards
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The overall data flow is as follows:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight dot"&gt;&lt;code&gt;&lt;span class="nv"&gt;flowchart&lt;/span&gt; &lt;span class="nv"&gt;LR&lt;/span&gt;
    &lt;span class="nv"&gt;LINE&lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"LINE App"&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt; &lt;span class="o"&gt;--&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;|&lt;/span&gt;&lt;span class="s2"&gt;"POST /webhook&amp;lt;br/&amp;gt;(HMAC)"&lt;/span&gt;&lt;span class="err"&gt;|&lt;/span&gt; &lt;span class="nv"&gt;WH&lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"internal/server&amp;lt;br/&amp;gt;Intent classification + Locking"&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;
    &lt;span class="nv"&gt;WH&lt;/span&gt; &lt;span class="o"&gt;--&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;|&lt;/span&gt;&lt;span class="s2"&gt;"enqueue"&lt;/span&gt;&lt;span class="err"&gt;|&lt;/span&gt; &lt;span class="nv"&gt;CT&lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="err"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Cloud Tasks&amp;lt;br/&amp;gt;research-jobs"&lt;/span&gt;&lt;span class="err"&gt;)&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;
    &lt;span class="nv"&gt;CT&lt;/span&gt; &lt;span class="o"&gt;--&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;|&lt;/span&gt;&lt;span class="s2"&gt;"POST /tasks/run-research&amp;lt;br/&amp;gt;(OIDC token)"&lt;/span&gt;&lt;span class="err"&gt;|&lt;/span&gt; &lt;span class="nv"&gt;WK&lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"internal/worker"&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;
    &lt;span class="nv"&gt;WK&lt;/span&gt; &lt;span class="o"&gt;--&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;|&lt;/span&gt;&lt;span class="s2"&gt;"seed / save"&lt;/span&gt;&lt;span class="err"&gt;|&lt;/span&gt; &lt;span class="nv"&gt;FS&lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="err"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Firestore&amp;lt;br/&amp;gt;line_bot_workspaces"&lt;/span&gt;&lt;span class="err"&gt;)&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;
    &lt;span class="nv"&gt;WK&lt;/span&gt; &lt;span class="o"&gt;--&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;|&lt;/span&gt;&lt;span class="s2"&gt;"runner.Run()"&lt;/span&gt;&lt;span class="err"&gt;|&lt;/span&gt; &lt;span class="nv"&gt;ADK&lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"ADK for Go&amp;lt;br/&amp;gt;plan / search_compare / write_report"&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;
    &lt;span class="nv"&gt;ADK&lt;/span&gt; &lt;span class="o"&gt;--&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;|&lt;/span&gt;&lt;span class="s2"&gt;"Google Search + URL Context"&lt;/span&gt;&lt;span class="err"&gt;|&lt;/span&gt; &lt;span class="nv"&gt;VX&lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"Vertex AI&amp;lt;br/&amp;gt;gemini-3.8-flash"&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;
    &lt;span class="nv"&gt;WK&lt;/span&gt; &lt;span class="o"&gt;--&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;|&lt;/span&gt;&lt;span class="s2"&gt;"goldmark → HTML"&lt;/span&gt;&lt;span class="err"&gt;|&lt;/span&gt; &lt;span class="nv"&gt;GCS&lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="err"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Cloud Storage"&lt;/span&gt;&lt;span class="err"&gt;)&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;
    &lt;span class="nv"&gt;WK&lt;/span&gt; &lt;span class="o"&gt;--&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;|&lt;/span&gt;&lt;span class="s2"&gt;"Push Progress + Flex Card"&lt;/span&gt;&lt;span class="err"&gt;|&lt;/span&gt; &lt;span class="nv"&gt;LINE&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h1&gt;
  
  
  III. From Managed Agents to ADK for Go: Four Core Rewrites
&lt;/h1&gt;

&lt;h2&gt;
  
  
  1. From "REST Agent Resource Creation" to "In-code &lt;code&gt;llmagent.New&lt;/code&gt;"
&lt;/h2&gt;

&lt;p&gt;In the Python version, the Agent was created via REST API using a shell script. The system instructions for the three stages were concatenated into one large block, relying on a stage tag (&lt;code&gt;PLAN&lt;/code&gt; / &lt;code&gt;SEARCH_COMPARE&lt;/code&gt; / &lt;code&gt;WRITE_REPORT&lt;/code&gt;) in the first line of every input for the Agent to find the correct section:&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;"id"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"research-planner"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"base_agent"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"antigravity-preview-05-2026"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"tools"&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="nl"&gt;"code_execution"&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="p"&gt;{&lt;/span&gt;&lt;span class="nl"&gt;"filesystem"&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="p"&gt;{&lt;/span&gt;&lt;span class="nl"&gt;"google_search"&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="p"&gt;{&lt;/span&gt;&lt;span class="nl"&gt;"url_context"&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;"system_instruction"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"...concatenated instructions for three stages..."&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 Go version uses three distinct &lt;code&gt;llmagent&lt;/code&gt; instances (&lt;a href="https://github.com/kkdai/line-research-bot-go/blob/main/internal/research/agents.go" rel="noopener noreferrer"&gt;&lt;code&gt;internal/research/agents.go&lt;/code&gt;&lt;/a&gt;). Prompts are stored in &lt;a href="https://github.com/kkdai/line-research-bot-go/tree/main/internal/research/prompts" rel="noopener noreferrer"&gt;&lt;code&gt;internal/research/prompts/&lt;/code&gt;&lt;/a&gt; using &lt;code&gt;go:embed&lt;/code&gt;, and tools are only provided to the stages that need them (the planning stage doesn't need internet access):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="n"&gt;urlContextTool&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="n"&gt;tool&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Tool&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;geminitool&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;New&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"url_context"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"Reads the content of web pages by URL."&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;genai&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Tool&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="n"&gt;URLContext&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;genai&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;URLContext&lt;/span&gt;&lt;span class="p"&gt;{}})&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="n"&gt;ag&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;llmagent&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;New&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;llmagent&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Config&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;Name&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="s"&gt;"research_planner_search_compare"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;Description&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="s"&gt;"Searches the web and cross-compares sources."&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;Model&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="n"&gt;llm&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="c"&gt;// gemini.NewModel(ctx, cfg.GeminiModel, &amp;amp;genai.ClientConfig{Backend: genai.BackendVertexAI, ...})&lt;/span&gt;
    &lt;span class="n"&gt;Instruction&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="n"&gt;searchPrompt&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;Tools&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[]&lt;/span&gt;&lt;span class="n"&gt;tool&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Tool&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="n"&gt;geminitool&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;GoogleSearch&lt;/span&gt;&lt;span class="p"&gt;{},&lt;/span&gt; &lt;span class="n"&gt;urlContextTool&lt;/span&gt;&lt;span class="p"&gt;()},&lt;/span&gt;
    &lt;span class="n"&gt;OutputSchema&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="n"&gt;searchSchema&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;OutputKey&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="s"&gt;"search_output"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;})&lt;/span&gt;
&lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;runner&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;New&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;runner&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Config&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="n"&gt;AppName&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="n"&gt;appName&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;Agent&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="n"&gt;ag&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;SessionService&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="n"&gt;sessions&lt;/span&gt;&lt;span class="p"&gt;})&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;ADK for Go currently only has &lt;code&gt;geminitool.GoogleSearch&lt;/code&gt; built-in. &lt;strong&gt;URL Context must be wrapped manually using &lt;code&gt;geminitool.New&lt;/code&gt; with a &lt;code&gt;genai.Tool&lt;/code&gt;&lt;/strong&gt;, which I discovered by digging through the &lt;code&gt;tool/geminitool&lt;/code&gt; source code. Additionally, I kept the &lt;code&gt;AGENT_ID&lt;/code&gt; environment variable but repurposed it as the ADK &lt;code&gt;AppName&lt;/code&gt; and agent name prefix, so the online environment variables didn't need to change.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. From &lt;code&gt;background=True&lt;/code&gt; + Polling to &lt;code&gt;runner.Run()&lt;/code&gt; Iterator
&lt;/h2&gt;

&lt;p&gt;The most tedious part of the Python version was this: Managed Agents didn't support synchronous mode, so you had to &lt;code&gt;create&lt;/code&gt; and then &lt;code&gt;get&lt;/code&gt; every 3 seconds until &lt;code&gt;completed&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;created&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;_client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;interactions&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;create&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;agent&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;_agent_id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nb"&gt;input&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;instruction&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;environment&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;env_arg&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;stream&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;False&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;background&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;True&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;store&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;True&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;while&lt;/span&gt; &lt;span class="n"&gt;time&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;monotonic&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="n"&gt;deadline&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;polled&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;_client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;interactions&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;created&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nb"&gt;id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;include_input&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;False&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;polled&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;status&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;completed&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nc"&gt;AgentResponse&lt;/span&gt;&lt;span class="p"&gt;(...)&lt;/span&gt;
    &lt;span class="n"&gt;time&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;sleep&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;_poll_interval&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;ADK for Go's &lt;code&gt;runner.Run()&lt;/code&gt; directly returns a Go 1.23 &lt;code&gt;iter.Seq2[*session.Event, error]&lt;/code&gt;. The Agent runs in its own process, events flow out one by one, and timeout is handled by &lt;code&gt;context.WithTimeout&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;ev&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="k"&gt;range&lt;/span&gt; &lt;span class="n"&gt;st&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;runner&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Run&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;ctx&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;userID&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;sid&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;genai&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;NewContentFromText&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;input&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;genai&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;RoleUser&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="n"&gt;agent&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;RunConfig&lt;/span&gt;&lt;span class="p"&gt;{})&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="no"&gt;nil&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="s"&gt;""&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;invocationID&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;fmt&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Errorf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"%w: %s: %v"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;ErrAgent&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;st&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="n"&gt;invocationID&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;ev&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;InvocationID&lt;/span&gt;
    &lt;span class="c"&gt;// Use final response text as fallback; read formal result from OutputKey&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I changed the &lt;code&gt;last_interaction_id&lt;/code&gt; stored in Firestore to ADK's &lt;code&gt;InvocationID&lt;/code&gt;. The field name remains the same, making it just as useful for log cross-referencing.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Sandbox &lt;code&gt;/workspace&lt;/code&gt; Files → ADK Session State + Firestore (The Most Critical Step)
&lt;/h2&gt;

&lt;p&gt;The biggest selling point of Managed Agents was the cross-turn persistent sandbox filesystem. ADK has no sandbox, so when a user asks to "go deeper into Chapter 2," where does the Agent find the previous sources and report?&lt;/p&gt;

&lt;p&gt;The answer is &lt;strong&gt;ADK Session State + Instruction Templates&lt;/strong&gt;. ADK's &lt;code&gt;Instruction&lt;/code&gt; replaces &lt;code&gt;{key}&lt;/code&gt; with the value from session state, and &lt;code&gt;{key?}&lt;/code&gt; means "it's okay if it doesn't exist":&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight markdown"&gt;&lt;code&gt;&lt;span class="gu"&gt;## Cross-compared sources (JSON)&lt;/span&gt;
{sources}

&lt;span class="gu"&gt;## Current report Markdown (empty for a new report)&lt;/span&gt;
{report_md?}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The mapping becomes:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Sandbox File (Python)&lt;/th&gt;
&lt;th&gt;ADK Session State (Go)&lt;/th&gt;
&lt;th&gt;Persistence Location&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/workspace/plan.json&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;{plan}&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Firestore &lt;code&gt;line_bot_workspaces/{userId}.plan&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/workspace/sources.json&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;{sources}&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;...sources&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/workspace/report.md&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;{report_md?}&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;...report_md&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;However, Cloud Run scales horizontally and can scale to 0; items in &lt;code&gt;session.InMemoryService()&lt;/code&gt; can disappear at any time. My approach: &lt;strong&gt;Every time a stage is executed, create a new ADK session, seed the initial state from the Firestore workspace, write the results back to Firestore after running, and then delete the session.&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="n"&gt;created&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;err&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;sessions&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Create&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;ctx&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;session&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;CreateRequest&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;AppName&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="n"&gt;a&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;appName&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;UserID&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="n"&gt;userID&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;State&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="k"&gt;map&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="n"&gt;any&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="n"&gt;KeySources&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="n"&gt;in&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;SourcesJSON&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;KeyReportMD&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="n"&gt;in&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ReportMD&lt;/span&gt;&lt;span class="p"&gt;},&lt;/span&gt;
&lt;span class="p"&gt;})&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This makes the Cloud Run instance completely stateless; a deepening request hours later will work on any instance. Added benefits:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;"Republishing" no longer requires the LLM&lt;/strong&gt;: The Python version's &lt;code&gt;retry_publish&lt;/code&gt; had to ask the Agent to read &lt;code&gt;report.md&lt;/code&gt; from the sandbox and return it; the Go version simply takes the Markdown from Firestore and re-renders/uploads it, saving a model call.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Handling sandbox expiration remains consistent&lt;/strong&gt;: Reports created in the old Managed Agents version cannot access their sandbox files in the Go version. I handle this as the original "environment expired" path: push a message saying "Previous research files have expired, restarting research from scratch 🔄" and rerun.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;⚠️ &lt;strong&gt;A small ADK template pitfall&lt;/strong&gt;: ADK treats all strings matching &lt;code&gt;{identifier}&lt;/code&gt; in the instruction as state variables and errors out if they aren't found. The original prompts had many JSON examples; these must be cleaned up. I wrote a unit test to scan the three prompts and only allow &lt;code&gt;{plan}&lt;/code&gt;, &lt;code&gt;{sources}&lt;/code&gt;, and &lt;code&gt;{report_md?}&lt;/code&gt; placeholders.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. "Return ONLY the JSON" → &lt;code&gt;OutputSchema&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;To get JSON in the Python version, the prompt ended with "Return ONLY the JSON. No prose, no markdown fences.", and the code required a &lt;code&gt;_parse_agent_json&lt;/code&gt; function to try the raw text,&lt;br&gt;
&lt;br&gt;
 ```&lt;code&gt;json&lt;/code&gt; fence content, or the first &lt;code&gt;{&lt;/code&gt; to the last &lt;code&gt;}&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;ADK for Go's &lt;code&gt;OutputSchema&lt;/code&gt; is much cleaner:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;When OutputSchema is set, the framework transparently injects a &lt;code&gt;set_model_response&lt;/code&gt; tool so the model can still invoke other tools (function tools, RAG, agent transfer, etc.) while producing structured output.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;In other words, &lt;strong&gt;ADK automatically injects a &lt;code&gt;set_model_response&lt;/code&gt; tool&lt;/strong&gt;. The model can use Google Search / URL Context to find data first, then call this tool to submit results matching the schema, which are then written back to session state via &lt;code&gt;OutputKey&lt;/code&gt;. I defined the output structures for all three stages using &lt;code&gt;genai.Schema&lt;/code&gt; in &lt;a href="https://github.com/kkdai/line-research-bot-go/blob/main/internal/research/schema.go" rel="noopener noreferrer"&gt;&lt;code&gt;internal/research/schema.go&lt;/code&gt;&lt;/a&gt;, keeping the original JSON parser as a fallback.&lt;/p&gt;




&lt;h1&gt;
  
  
  IV. Model Selection: Not every Gemini can do "Search + Read Web + Structured Output" simultaneously
&lt;/h1&gt;

&lt;p&gt;The probe program mentioned earlier was for this exact moment. Results from running the same program in my GCP project at location &lt;code&gt;global&lt;/code&gt;:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Model&lt;/th&gt;
&lt;th&gt;Google Search + URL Context + OutputSchema&lt;/th&gt;
&lt;th&gt;Result&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;gemini-2.5-flash&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;❌&lt;/td&gt;
&lt;td&gt;&lt;code&gt;400 INVALID_ARGUMENT: controlled generation is not supported with URL Context tool&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;gemini-3-flash-preview&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;✅&lt;/td&gt;
&lt;td&gt;Used in the first live version&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;gemini-3.1-flash&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;❌&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;404 NOT_FOUND&lt;/code&gt; (This project doesn't have this model)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;gemini-3.8-flash&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;✅&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;Current Default&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;gemini-3.8-pro&lt;/code&gt; / &lt;code&gt;-flash-preview&lt;/code&gt; / &lt;code&gt;-pro-preview&lt;/code&gt; / &lt;code&gt;-flash-lite&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;❌&lt;/td&gt;
&lt;td&gt;All &lt;code&gt;404 NOT_FOUND&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Two takeaways:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;The model list must be verified by actually calling them from your project&lt;/strong&gt;. Just because a model name exists in documentation doesn't mean your project or location has access to it; &lt;code&gt;404 Publisher model ... was not found or your project does not have access to it&lt;/code&gt; is a common response.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Model names must be environment variables&lt;/strong&gt;. The Go version adds an optional &lt;code&gt;GEMINI_MODEL&lt;/code&gt; variable; if not set, it uses the code default. This means the 11 original environment variables on the live service didn't need to change.&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  A bug caught when switching to gemini-3.8-flash
&lt;/h3&gt;

&lt;p&gt;After upgrading to &lt;code&gt;gemini-3.8-flash&lt;/code&gt;, reports became significantly longer and deeper (approx. 5k → 11–12k characters), but integration tests caught a subtle issue: when asked to deepen a non-existent "Chapter 99," it returned:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
plaintext
error="chapter_not_found_chapter_not_found" available_chapters=[]


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;The old code used &lt;code&gt;== "chapter_not_found"&lt;/code&gt; for validation; this value didn't match, so it would &lt;strong&gt;publish an empty &lt;code&gt;report_md&lt;/code&gt; as a new version&lt;/strong&gt;. I fixed this in three layers:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Changed &lt;code&gt;error&lt;/code&gt; in the schema to an &lt;strong&gt;enum&lt;/strong&gt; (only allowing &lt;code&gt;chapter_not_found&lt;/code&gt;) to restrict the model at the source.&lt;/li&gt;
&lt;li&gt;The worker now uses &lt;code&gt;strings.Contains&lt;/code&gt; for loose matching; if &lt;code&gt;available_chapters&lt;/code&gt; is empty, it &lt;strong&gt;extracts chapters from the &lt;code&gt;##&lt;/code&gt; headers in the report itself&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;If &lt;code&gt;report_md&lt;/code&gt; is empty, it never publishes and instead pushes "Deepening failed, please try again later."&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;After adding the enum and rerunning, &lt;code&gt;gemini-3.8-flash&lt;/code&gt; correctly returned &lt;code&gt;chapter_not_found&lt;/code&gt; and the full four chapters. &lt;strong&gt;Switching models isn't just about changing a string; edge cases for structured output must be re-verified with integration tests.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;To be honest about the cost: the total time for the three stages increased from about 60 seconds to 150–190 seconds. It's still within timeout, but users have to wait a bit longer.&lt;/p&gt;




&lt;h1&gt;
  
  
  V. gcloud and Cloud Run Deployment: Ten Things to Watch Out For
&lt;/h1&gt;

&lt;p&gt;After finishing the code, passing &lt;code&gt;go test ./...&lt;/code&gt;, and running integration tests against the real Vertex AI, the real challenge began. This is a bot &lt;strong&gt;serving real LINE users live&lt;/strong&gt;. Below are the points I hit (or narrowly avoided) during deployment.&lt;/p&gt;

&lt;h2&gt;
  
  
  Note 1: &lt;code&gt;describe&lt;/code&gt; the online settings first; don't trust the &lt;code&gt;deploy.sh&lt;/code&gt; in the repo
&lt;/h2&gt;

&lt;p&gt;I initially thought I could just follow the &lt;code&gt;deploy/deploy.sh&lt;/code&gt; in the repo, but a &lt;code&gt;describe&lt;/code&gt; of the live service revealed &lt;strong&gt;the two were already different&lt;/strong&gt; (I had tuned them online during previous debugging):&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Setting&lt;/th&gt;
&lt;th&gt;
&lt;code&gt;deploy.sh&lt;/code&gt; in repo&lt;/th&gt;
&lt;th&gt;Actual Live Service&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;GCS_BUCKET&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;line-reports&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;A different bucket&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Memory&lt;/td&gt;
&lt;td&gt;&lt;code&gt;1Gi&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;2Gi&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Timeout&lt;/td&gt;
&lt;td&gt;&lt;code&gt;600&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;3600&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;--min-instances&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;1&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;0&lt;/code&gt; (not set)&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;If I had just run &lt;code&gt;deploy.sh&lt;/code&gt;, reports would have gone to the wrong bucket, and long tasks would have been killed at 600 seconds. &lt;strong&gt;When rewriting a service, the "actual online state" is the specification&lt;/strong&gt;:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
shell
gcloud run services describe line-research-bot --region=asia-east1 --format=json \
  | jq '{sa: .spec.template.spec.serviceAccountName,
         env: [.spec.template.spec.containers[0].env[].name],
         resources: .spec.template.spec.containers[0].resources,
         timeout: .spec.template.spec.timeoutSeconds}'


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;h2&gt;
  
  
  Note 2: To "reuse the same environment variables," the simplest way is to &lt;strong&gt;pass nothing&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;The previous &lt;code&gt;linebot-helper&lt;/code&gt; was deployed as a &lt;strong&gt;new service&lt;/strong&gt;, so environment variables had to be converted to an &lt;code&gt;--env-vars-file&lt;/code&gt;. This time, deploying back to the &lt;strong&gt;same service&lt;/strong&gt;, there's a simpler way:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;code&gt;gcloud run deploy --source=.&lt;/code&gt; &lt;strong&gt;without&lt;/strong&gt; &lt;code&gt;--set-env-vars&lt;/code&gt; / &lt;code&gt;--update-secrets&lt;/code&gt; will cause the new revision to fully inherit the environment variables and Secret Manager bindings from the previous revision.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This ensures the LINE Channel Secret / Access Token never appear in the command line or terminal output. After deploying, I described it again to confirm the list of 11 environment variables remained the same.&lt;/p&gt;
&lt;h2&gt;
  
  
  Note 3: Use &lt;code&gt;--no-traffic --tag&lt;/code&gt; for Canary; &lt;strong&gt;tags must be at least 3 characters&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Since it's the same service, I didn't want all LINE users hitting the new version immediately. The Cloud Run way:&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
shell
gcloud run deploy line-research-bot --region=asia-east1 --source=. \
  --no-traffic --tag=golang


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;The new revision gets 0% traffic but has a dedicated tag URL for direct testing. I hit a silly snag here: I initially tried &lt;code&gt;--tag=go&lt;/code&gt;, which was blocked:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
plaintext
ERROR: (gcloud.run.deploy) service.spec.traffic[1].tag: must be at least 3 characters long.


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;After performing smoke tests (listed below) on the tag URL, I switched traffic and recorded the previous revision name as a rollback point:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
shell
gcloud run services update-traffic line-research-bot --region=asia-east1 \
  --to-revisions=&amp;lt;new revision&amp;gt;=100

# Rollback is just one line
gcloud run services update-traffic line-research-bot --region=asia-east1 \
  --to-revisions=&amp;lt;previous revision&amp;gt;=100


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Smoke Test&lt;/th&gt;
&lt;th&gt;Expected&lt;/th&gt;
&lt;th&gt;Result&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;GET /readyz&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;200&lt;/td&gt;
&lt;td&gt;✅&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;POST /webhook&lt;/code&gt; wrong signature&lt;/td&gt;
&lt;td&gt;401&lt;/td&gt;
&lt;td&gt;✅&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;POST /tasks/run-research&lt;/code&gt; no OIDC token&lt;/td&gt;
&lt;td&gt;401&lt;/td&gt;
&lt;td&gt;✅&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Model field in startup logs&lt;/td&gt;
&lt;td&gt;Expected model name&lt;/td&gt;
&lt;td&gt;✅&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  Note 4: Cloud Tasks default dispatch deadline is only 10 minutes
&lt;/h2&gt;

&lt;p&gt;This was a potential issue I found while reviewing the Python code during the rewrite. Research tasks are executed via Cloud Tasks calling back to the &lt;code&gt;/tasks/run-research&lt;/code&gt; endpoint. While Cloud Run's timeout is 3600 seconds, &lt;strong&gt;Cloud Tasks' default dispatch deadline for HTTP targets is only 10 minutes&lt;/strong&gt;. If there's no response after 10 minutes, Cloud Tasks marks it as failed and &lt;strong&gt;retries&lt;/strong&gt; (queue setting &lt;code&gt;max-attempts=3&lt;/code&gt;), causing the research to rerun and doubling the Gemini bill.&lt;/p&gt;

&lt;p&gt;In the Go version, I set the task creation in &lt;a href="https://github.com/kkdai/line-research-bot-go/blob/main/internal/tasks/dispatcher.go" rel="noopener noreferrer"&gt;&lt;code&gt;internal/tasks/dispatcher.go&lt;/code&gt;&lt;/a&gt; to the maximum 30 minutes:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
go
Task: &amp;amp;cloudtaskspb.Task{
    DispatchDeadline: durationpb.New(30 * time.Minute),
    MessageType: &amp;amp;cloudtaskspb.Task_HttpRequest{HttpRequest: &amp;amp;cloudtaskspb.HttpRequest{ /* ... */ }},
},


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Additionally, the Python version's user lock TTL was only 300 seconds, meaning a user could send another query and grab the lock before the task finished, leading to two tasks modifying the same workspace. The Go version sets the &lt;strong&gt;lock TTL to 35 minutes (greater than the dispatch deadline)&lt;/strong&gt; and actively releases it when the task finishes.&lt;/p&gt;

&lt;h2&gt;
  
  
  Note 5: Under &lt;code&gt;--allow-unauthenticated&lt;/code&gt;, Cloud Tasks endpoints must verify OIDC themselves
&lt;/h2&gt;

&lt;p&gt;The LINE Webhook must be accessible from outside, so the entire service is &lt;code&gt;--allow-unauthenticated&lt;/code&gt;. &lt;code&gt;/webhook&lt;/code&gt; is protected by &lt;code&gt;X-Line-Signature&lt;/code&gt;, but the Python version's &lt;code&gt;/tasks/run-research&lt;/code&gt; &lt;strong&gt;had no verification at all&lt;/strong&gt;: anyone who knew the URL could POST a JSON and trigger a full research task that burns Gemini credits.&lt;/p&gt;

&lt;p&gt;Cloud Tasks naturally carries an OIDC token when creating a task; the Python receiver just didn't verify it. The Go version adds this in &lt;a href="https://github.com/kkdai/line-research-bot-go/blob/main/cmd/server/main.go" rel="noopener noreferrer"&gt;&lt;code&gt;cmd/server/main.go&lt;/code&gt;&lt;/a&gt; using &lt;code&gt;google.golang.org/api/idtoken&lt;/code&gt;:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
go
func oidcVerifier(audience, saEmail string) server.TokenVerifier {
    return func(ctx context.Context, bearer string) error {
        p, err := idtoken.Validate(ctx, bearer, audience) // audience = service URL + /tasks/run-research
        if err != nil {
            return err
        }
        if email, _ := p.Claims["email"].(string); email != saEmail {
            return fmt.Errorf("unexpected token email %q", email)
        }
        return nil
    }
}


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Details to align:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Audience must match on both sides&lt;/strong&gt;: Explicitly specify &lt;code&gt;OidcToken.Audience&lt;/code&gt; when creating the task, and verify the same value on the receiving end (I use &lt;code&gt;CLOUD_RUN_SERVICE_URL + "/tasks/run-research"&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Service Account must be able to actAs itself&lt;/strong&gt;: Cloud Tasks needs to sign the OIDC token using &lt;code&gt;line-bot-sa&lt;/code&gt;. The &lt;code&gt;line-bot-sa&lt;/code&gt; needs &lt;code&gt;roles/iam.serviceAccountUser&lt;/code&gt; on itself, plus &lt;code&gt;roles/cloudtasks.enqueuer&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;CLOUD_RUN_SERVICE_URL&lt;/code&gt; is a chicken-and-egg problem&lt;/strong&gt;: You don't know the URL before the first deployment. The &lt;code&gt;deploy.sh&lt;/code&gt; strategy is to deploy first, then &lt;code&gt;gcloud run services update --update-env-vars=CLOUD_RUN_SERVICE_URL=...&lt;/code&gt;. When deploying back to the same service, this value is inherited and doesn't need resetting.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Note 6: &lt;code&gt;--no-cpu-throttling&lt;/code&gt; is &lt;strong&gt;NOT&lt;/strong&gt; needed this time; min-instances can be 0
&lt;/h2&gt;

&lt;p&gt;In the previous &lt;code&gt;linebot-helper&lt;/code&gt; post, I spent a whole section explaining how background goroutines get frozen without &lt;code&gt;--no-cpu-throttling&lt;/code&gt;. This architecture is the opposite:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;/webhook&lt;/code&gt; only does signature verification, classification, locking, and enqueueing. &lt;strong&gt;It returns 200 only after finishing synchronously&lt;/strong&gt;, with no background goroutines.&lt;/li&gt;
&lt;li&gt;The truly time-consuming research runs within the &lt;strong&gt;HTTP request sent by Cloud Tasks&lt;/strong&gt;. The request stays open from start to finish, so Cloud Run won't throttle the CPU or scale down the instance.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Thus, the default "allocate CPU only during request processing" is perfectly sufficient, and &lt;code&gt;--min-instances&lt;/code&gt; can stay at 0. Go cold starts in less than 1 second, and the LINE reply token is valid for about 1 minute, which is plenty of time. &lt;strong&gt;Whether to use &lt;code&gt;--no-cpu-throttling&lt;/code&gt; depends on whether the work is done inside or outside the request.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The only thing to watch is releasing the lock: the &lt;code&gt;r.Context()&lt;/code&gt; might already be canceled when the handler ends, so I use &lt;code&gt;context.WithoutCancel(ctx)&lt;/code&gt; to release the Firestore lock, ensuring it always gets released.&lt;/p&gt;

&lt;h2&gt;
  
  
  Note 7: Deployment is possible without local Docker; &lt;code&gt;--source=.&lt;/code&gt; uses Cloud Build
&lt;/h2&gt;

&lt;p&gt;I don't have Docker installed on my laptop. &lt;code&gt;gcloud run deploy --source=.&lt;/code&gt; sees a &lt;code&gt;Dockerfile&lt;/code&gt; in the directory and hands it to Cloud Build. Since this Bot doesn't need Chromium or ffmpeg, I can safely use the minimal distroless image:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
docker
FROM golang:1.27 AS build
WORKDIR /src
COPY go.mod go.sum ./
RUN go mod download
COPY cmd/ ./cmd/
COPY internal/ ./internal/
RUN CGO_ENABLED=0 go build -trimpath -ldflags="-s -w" -o /out/server ./cmd/server

FROM gcr.io/distroless/static-debian12:nonroot
COPY --from=build /out/server /server
USER nonroot:nonroot
ENTRYPOINT ["/server"]


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;The Go version has no external executable dependencies, and prompts are compiled into the binary using &lt;code&gt;go:embed&lt;/code&gt;, so the final image is just a static executable. No extra data files need to be copied.&lt;/p&gt;

&lt;h2&gt;
  
  
  Note 8: Same service, no need to change LINE Webhook URL, but verify with API
&lt;/h2&gt;

&lt;p&gt;After deploying, I thought about going to the LINE Developers Console to change the Webhook URL, then realized: &lt;strong&gt;The new version is deployed to the same Cloud Run service; the URL hasn't changed&lt;/strong&gt;. Instead of visually comparing in the Console, it's better to ask LINE using the Channel Access Token:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
shell
TOKEN=$(gcloud secrets versions access latest --secret=LINE_CHANNEL_ACCESS_TOKEN)

# Current webhook setting and status
curl -s -H "Authorization: Bearer $TOKEN" \
  https://api.line.me/v2/bot/channel/webhook/endpoint

# Ask LINE to actually hit the webhook
curl -s -X POST -H "Authorization: Bearer $TOKEN" -H 'Content-Type: application/json' \
  -d '{"endpoint":"&amp;lt;YOUR_SERVICE_URL&amp;gt;/webhook"}' \
  https://api.line.me/v2/bot/channel/webhook/test


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;In my script, I directly compare if &lt;code&gt;endpoint&lt;/code&gt; equals "Service URL + &lt;code&gt;/webhook&lt;/code&gt;", printing only &lt;code&gt;MATCH&lt;/code&gt; or &lt;code&gt;DIFFERENT&lt;/code&gt; so the URL itself doesn't appear in the terminal. The test API returning &lt;code&gt;{"success":true,"statusCode":200}&lt;/code&gt; means LINE traffic is already hitting the Go version.&lt;/p&gt;

&lt;h2&gt;
  
  
  Note 9: When E2E testing with a fake user, don't let LINE push failures trigger a full pipeline rerun
&lt;/h2&gt;

&lt;p&gt;Smoke tests only prove the service is alive. I also wanted to verify the entire path: &lt;strong&gt;webhook → Cloud Tasks (OIDC) → ADK → Firestore → GCS&lt;/strong&gt; in the production environment without using a real user. The trick is to use the Channel Secret from Secret Manager to correctly sign a message for a &lt;strong&gt;fake userId&lt;/strong&gt; and hit &lt;code&gt;/webhook&lt;/code&gt; directly:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
shell
SIG=$(printf '%s' "$BODY" | openssl dgst -sha256 -hmac "$SECRET" -binary | base64)
curl -X POST -H "X-Line-Signature: $SIG" -d "$BODY" "$URL/webhook"


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;LINE's reply and push will inevitably return 400 because the userId/replyToken is fake. This is expected, but it highlighted a design issue: &lt;strong&gt;If the final Flex card push fails and the worker returns an error, the handler returns 500, causing Cloud Tasks to rerun the entire 3-minute, paid research process&lt;/strong&gt;. So, the Go version logs all LINE push failures but doesn't return an error; only infrastructure errors like Firestore failures trigger a Cloud Tasks retry.&lt;/p&gt;

&lt;p&gt;The E2E test in production took about 33 seconds. Firestore reports/workspaces were correctly written, the lock was released, and the &lt;code&gt;index.html&lt;/code&gt; on GCS had the correct title and version banner. Remember to clean up the fake user's Firestore documents and GCS objects after testing.&lt;/p&gt;

&lt;h2&gt;
  
  
  Note 10: Upgrade to the latest Go patch and use &lt;code&gt;govulncheck&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;My local machine was on Go 1.26.1 during the rewrite, but the latest version was already &lt;strong&gt;1.27.3&lt;/strong&gt;. Upgrading is easy; &lt;code&gt;go get&lt;/code&gt; modifies &lt;code&gt;go.mod&lt;/code&gt; and automatically downloads the toolchain:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
shell
go get go@1.27.3 toolchain@none
go run golang.org/x/vuln/cmd/govulncheck@latest ./...


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Remember to update the &lt;code&gt;Dockerfile&lt;/code&gt; build image from &lt;code&gt;golang:1.26&lt;/code&gt; to &lt;code&gt;golang:1.27&lt;/code&gt;. &lt;code&gt;govulncheck&lt;/code&gt; reported "&lt;strong&gt;Vulnerabilities affecting your code: 0&lt;/strong&gt;", though there were 3 vulnerabilities in dependencies that weren't being called. Two in &lt;code&gt;golang.org/x/net&lt;/code&gt; were fixed by upgrading to v0.62.0; the one in &lt;code&gt;golang.org/x/crypto&lt;/code&gt; hasn't had an official fix released yet. &lt;strong&gt;&lt;code&gt;govulncheck&lt;/code&gt; distinguishes between "called" and "not called," which is much more practical than just scanning &lt;code&gt;go.mod&lt;/code&gt; version numbers.&lt;/strong&gt;&lt;/p&gt;




&lt;h1&gt;
  
  
  VI. Things Fixed Along the Way: Rewriting is a Great Time to Re-examine Design
&lt;/h1&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Item&lt;/th&gt;
&lt;th&gt;Python Version&lt;/th&gt;
&lt;th&gt;Go Version&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;code&gt;/tasks/run-research&lt;/code&gt; Verification&lt;/td&gt;
&lt;td&gt;None&lt;/td&gt;
&lt;td&gt;Cloud Tasks OIDC (audience + SA email)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Cloud Tasks Dispatch Deadline&lt;/td&gt;
&lt;td&gt;Default 10 mins (long tasks rerun)&lt;/td&gt;
&lt;td&gt;30 minutes&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;User Lock TTL&lt;/td&gt;
&lt;td&gt;300 seconds&lt;/td&gt;
&lt;td&gt;35 minutes, active release on finish&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;retry_publish&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Asks Agent to read &lt;code&gt;report.md&lt;/code&gt; again&lt;/td&gt;
&lt;td&gt;Uses Markdown from Firestore directly (no LLM)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Deepen Version Number&lt;/td&gt;
&lt;td&gt;Relies on model's &lt;code&gt;new_version&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;Calculated by code (previous + 1)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Report HTML&lt;/td&gt;
&lt;td&gt;Raw HTML from model rendered; &lt;code&gt;&amp;lt;title&amp;gt;&lt;/code&gt; not escaped&lt;/td&gt;
&lt;td&gt;goldmark doesn't render raw HTML by default; title escaped&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;LINE Push Failure&lt;/td&gt;
&lt;td&gt;Exception bubbles up → 500 → Cloud Tasks rerun&lt;/td&gt;
&lt;td&gt;Logged only; doesn't trigger rerun&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Execution Environment&lt;/td&gt;
&lt;td&gt;Python 3.11 slim&lt;/td&gt;
&lt;td&gt;Go 1.27.3 distroless/static, nonroot&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Regarding testing, the Go version has two layers:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Unit Tests&lt;/strong&gt; (&lt;code&gt;go test ./...&lt;/code&gt;, no GCP needed): Worker uses fake store / agents / LINE / publisher. Covers new research, stage failures, &lt;code&gt;retry_write&lt;/code&gt;, &lt;code&gt;retry_publish&lt;/code&gt;, deepening, &lt;code&gt;chapter_not_found&lt;/code&gt; (including model hallucination cases), and missing workspaces. Server covers signatures, locks, enqueue failure rollback, OIDC, recall / reset / small talk.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Integration Tests&lt;/strong&gt; (&lt;code&gt;go test -tags integration&lt;/code&gt;): Hits the real Vertex AI to run through all three stages, then tests deepening a non-existent chapter. When switching models or upgrading ADK, this is the only way to catch the model behavior differences mentioned earlier.&lt;/li&gt;
&lt;/ul&gt;




&lt;h1&gt;
  
  
  VII. One Last Security Reminder: Don't let Cloud Run URLs appear in public Issues
&lt;/h1&gt;

&lt;p&gt;Both repos are public, as are the Issues and PRs. I deliberately did a few things:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The first line of the Issue states: "This issue is a public record and &lt;strong&gt;will not&lt;/strong&gt; post any Cloud Run service URLs, Secret values, or internal identifiers."&lt;/li&gt;
&lt;li&gt;All &lt;code&gt;gcloud&lt;/code&gt; command outputs that would print URLs were masked using &lt;code&gt;sed -E 's#https?://[^]+#&amp;lt;url&amp;gt;#g'&lt;/code&gt;, or the URL was stored in a shell variable and only the comparison result was printed.&lt;/li&gt;
&lt;li&gt;Before sending a PR, I ran &lt;code&gt;git diff main | grep run.app&lt;/code&gt; to ensure no real URLs were in the new code or documentation (only a fake &lt;code&gt;https://x.run.app&lt;/code&gt; from a deleted Python test was caught).&lt;/li&gt;
&lt;li&gt;Before opening the new public repo, I scanned the &lt;strong&gt;entire git history&lt;/strong&gt; (&lt;code&gt;git log --all -p&lt;/code&gt;) to ensure the real service hostname never appeared once before pushing with &lt;code&gt;gh repo create --public --source=. --push&lt;/code&gt;. If a repo is public, everything in old commits is also public.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;/webhook&lt;/code&gt; has LINE signatures and &lt;code&gt;/tasks/run-research&lt;/code&gt; has OIDC, so even if the URL leaks, unauthorized access is blocked. However, a public &lt;code&gt;.run.app&lt;/code&gt; URL still attracts scanners and meaningless traffic. &lt;strong&gt;If you don't have to make it public, don't.&lt;/strong&gt;&lt;/p&gt;




&lt;h1&gt;
  
  
  VIII. Python Managed Agents → Go ADK Migration Checklist
&lt;/h1&gt;

&lt;ul&gt;
&lt;li&gt; &lt;strong&gt;1. Audit online settings first&lt;/strong&gt;: Use &lt;code&gt;gcloud run services describe&lt;/code&gt; to get the SA, env vars, Secret bindings, memory, and timeout. Don't trust outdated deploy scripts in the repo.&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;2. Feasibility verification for the model&lt;/strong&gt;: Call it from your project and location to confirm the model exists and supports your tool combination (e.g., Google Search + URL Context + OutputSchema).&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;3. Sandbox Files → Session State&lt;/strong&gt;: Map the cross-turn files from the Managed Agents sandbox to ADK &lt;code&gt;{state}&lt;/code&gt; placeholders and persist them to external storage like Firestore to keep Cloud Run stateless.&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;4. Check curly braces in instructions&lt;/strong&gt;: ADK treats &lt;code&gt;{identifier}&lt;/code&gt; as a state variable. Clean up JSON examples when moving prompts, and ideally use a test to catch them.&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;5. Use &lt;code&gt;OutputSchema&lt;/code&gt; instead of prompt constraints&lt;/strong&gt;, but keep a loose JSON parser as a fallback. Use enums for error code fields.&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;6. Use &lt;code&gt;--no-traffic --tag&lt;/code&gt; (tag ≥ 3 chars) for the same service&lt;/strong&gt;. Only &lt;code&gt;update-traffic&lt;/code&gt; after smoke tests pass, and record the revision for rollback.&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;7. Omitting &lt;code&gt;--set-env-vars&lt;/code&gt; inherits env vars and Secrets from the previous version&lt;/strong&gt;. Describe again after deployment to confirm.&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;8. Cloud Tasks&lt;/strong&gt;: Set dispatch deadline to the required length (up to 30 mins). Lock TTL must be longer than this. The receiver must verify the OIDC token.&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;9. &lt;code&gt;--no-cpu-throttling&lt;/code&gt; is only needed if work happens outside the request&lt;/strong&gt;. If work is done within the Cloud Tasks request, min-instances 0 is sufficient.&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;10. Verify webhook with LINE API&lt;/strong&gt;: &lt;code&gt;GET /v2/bot/channel/webhook/endpoint&lt;/code&gt; + &lt;code&gt;POST .../webhook/test&lt;/code&gt; is more reliable than checking the Console.&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;11. External notification failures shouldn't trigger a full pipeline retry&lt;/strong&gt;. Only return 5xx for infrastructure errors.&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;12. Upgrade to the latest Go patch and run &lt;code&gt;govulncheck&lt;/code&gt;&lt;/strong&gt;. Ensure no real service URLs remain in public repo Issues / PRs / READMEs.&lt;/li&gt;
&lt;/ul&gt;




&lt;h1&gt;
  
  
  Summary and Open Source Project Links
&lt;/h1&gt;

&lt;p&gt;Migrating &lt;strong&gt;&lt;a href="https://github.com/kkdai/line-research-bot" rel="noopener noreferrer"&gt;&lt;code&gt;kkdai/line-research-bot&lt;/code&gt;&lt;/a&gt;&lt;/strong&gt; from Python + Managed Agents to the Go + ADK for Go version &lt;strong&gt;&lt;a href="https://github.com/kkdai/line-research-bot-go" rel="noopener noreferrer"&gt;&lt;code&gt;kkdai/line-research-bot-go&lt;/code&gt;&lt;/a&gt;&lt;/strong&gt; provided several key takeaways:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Managed Agents and ADK are different trade-offs&lt;/strong&gt;: The former manages the sandbox and filesystem for you; the latter lets the Agent run within your own code. When the sandbox's value is just "remembering three files," ADK's Session State + Firestore is simpler and easier to test.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;OutputSchema&lt;/code&gt; + Built-in Tools is a powerful combo in ADK for Go&lt;/strong&gt;: &lt;code&gt;set_model_response&lt;/code&gt; allows the model to search the web first and then submit strongly-typed results, provided your chosen model supports it.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;--no-traffic --tag&lt;/code&gt; is the safest way to switch when deploying to the same service&lt;/strong&gt;: Env vars, Secrets, and Webhook URLs don't need to change, and rollback is a single line.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Rewriting is the best time to re-examine design&lt;/strong&gt;: The OIDC verification, 30-minute dispatch deadline, and push failure handling added this time were all potential issues in the Python version.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The full Go code is at &lt;strong&gt;&lt;a href="https://github.com/kkdai/line-research-bot-go" rel="noopener noreferrer"&gt;&lt;code&gt;kkdai/line-research-bot-go&lt;/code&gt;&lt;/a&gt;&lt;/strong&gt;. The step-by-step record of the rewrite is in &lt;a href="https://github.com/kkdai/line-research-bot/issues/1" rel="noopener noreferrer"&gt;Issue #1&lt;/a&gt;. Feel free to reference and discuss!&lt;/p&gt;

&lt;h2&gt;
  
  
  Further Reading
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://dev.to/gde/geminiagent-google-managed-agents-api-4e43"&gt;Comprehensive Analysis of Google Managed Agents API (Python version of this Bot)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/kkdai/line-research-bot-go" rel="noopener noreferrer"&gt;&lt;code&gt;kkdai/line-research-bot-go&lt;/code&gt;: Full Go code for this article&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/google/adk-go" rel="noopener noreferrer"&gt;ADK for Go on GitHub&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://google.github.io/adk-docs/" rel="noopener noreferrer"&gt;Official ADK Documentation&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://cloud.google.com/tasks/docs/reference/rest/v2/projects.locations.queues.tasks#Task.FIELDS.dispatch_deadline" rel="noopener noreferrer"&gt;Cloud Tasks: Dispatch deadline for HTTP targets&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://cloud.google.com/run/docs/rollouts-rollbacks-traffic-migration" rel="noopener noreferrer"&gt;Cloud Run: Testing new versions with revision tags&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>agents</category>
      <category>ai</category>
      <category>cloud</category>
      <category>go</category>
    </item>
    <item>
      <title>[AI in Practice] Same Name, Different Layer: DeepSeek Harness (DSH) Explained and Compared with Google Research Harness2</title>
      <dc:creator>Evan Lin</dc:creator>
      <pubDate>Tue, 03 Nov 2026 00:00:00 +0000</pubDate>
      <link>https://dev.to/gde/ai-in-practice-same-name-different-layer-deepseek-harness-dsh-explained-and-compared-with-4p7m</link>
      <guid>https://dev.to/gde/ai-in-practice-same-name-different-layer-deepseek-harness-dsh-explained-and-compared-with-4p7m</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmermaid.ink%2Fimg%2Fpako%3AeNqNk0uP0zAQx7_KyKddQR-bA4IKVoLdQg-tWmVzWRGQHHuamDp2sJ0-9vHdGSdbSuGCT37O_Of3Hz8yYSWyCbC1tjtRcRdgnuYGaPi2KB1vKpglX3P2xdpSI6TokTtBm9wZ9D5vx-MimQBurd6ih13FA4QKgZdoAigP-LNVTYMSdipUOfvWB49DKociKGsg-3TaXa4ySpft7EDjFjXQndZ5tUWwTVC1ekAHF6tDqKy5fF-40fXK2cZ6hLxNrt4lQMvi9-LG1vGsuzfdN-gUGhGrWGtKbd2ZniydTim1uBoOxVuo-gJhrajs4LAP4g8-YN04ihtgBGXLnXRcaQ-j7nxuTZmhqxfTxTK9pxt-o7QmTMk4eXOWjeqEweD6KWcUTbaC4BncByBu6HiHZfb9YnOZs6dOWf8SjczNX_7c3s1I9i1ic4e4OTozAe491oWmwNxIcK3xJ2f-w4hVuvxMcYlnh-ADFK2RNHkF9x8Xc2h4EOd-ptE46auYipzqgfV9oK1tCIYI-2GwNtLq5lrXL9w8KY4CyHIT_FnYqOOF1I11klrqVFij21IZHxml2T-EIjYYDLunRzu15ZKasTgAP-r883WaHR8Ex390PaIwyvXCOuwSkXG5Ya-B1eQzV5J-zyMjsHX3jySueasDe37-BR-GFr8%3D%3Ftype%3Dpng" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmermaid.ink%2Fimg%2Fpako%3AeNqNk0uP0zAQx7_KyKddQR-bA4IKVoLdQg-tWmVzWRGQHHuamDp2sJ0-9vHdGSdbSuGCT37O_Of3Hz8yYSWyCbC1tjtRcRdgnuYGaPi2KB1vKpglX3P2xdpSI6TokTtBm9wZ9D5vx-MimQBurd6ih13FA4QKgZdoAigP-LNVTYMSdipUOfvWB49DKociKGsg-3TaXa4ySpft7EDjFjXQndZ5tUWwTVC1ekAHF6tDqKy5fF-40fXK2cZ6hLxNrt4lQMvi9-LG1vGsuzfdN-gUGhGrWGtKbd2ZniydTim1uBoOxVuo-gJhrajs4LAP4g8-YN04ihtgBGXLnXRcaQ-j7nxuTZmhqxfTxTK9pxt-o7QmTMk4eXOWjeqEweD6KWcUTbaC4BncByBu6HiHZfb9YnOZs6dOWf8SjczNX_7c3s1I9i1ic4e4OTozAe491oWmwNxIcK3xJ2f-w4hVuvxMcYlnh-ADFK2RNHkF9x8Xc2h4EOd-ptE46auYipzqgfV9oK1tCIYI-2GwNtLq5lrXL9w8KY4CyHIT_FnYqOOF1I11klrqVFij21IZHxml2T-EIjYYDLunRzu15ZKasTgAP-r883WaHR8Ex390PaIwyvXCOuwSkXG5Ya-B1eQzV5J-zyMjsHX3jySueasDe37-BR-GFr8%3D%3Ftype%3Dpng" alt="DeepSeek Harness vs. Google Research Harness²: two different layers" width="1597" height="344"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;&lt;/th&gt;
&lt;th&gt;DeepSeek Harness (DSH)&lt;/th&gt;
&lt;th&gt;Google Research Harness²&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;In one sentence&lt;/td&gt;
&lt;td&gt;The agent's &lt;strong&gt;runtime&lt;/strong&gt;
&lt;/td&gt;
&lt;td&gt;An &lt;strong&gt;automatic optimizer&lt;/strong&gt; for what the agent is equipped with&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;What "harness" refers to&lt;/td&gt;
&lt;td&gt;The runtime that executes the agent&lt;/td&gt;
&lt;td&gt;The prompts, guardrails, memory, and skills wrapped around the model&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;What you change&lt;/td&gt;
&lt;td&gt;Profiles, YAML patches, plugins&lt;/td&gt;
&lt;td&gt;The &lt;code&gt;c1..c8&lt;/code&gt; file tree (though usually Harness² changes it for you)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Where it's used in this series&lt;/td&gt;
&lt;td&gt;The agent layer of the LINE research bot&lt;/td&gt;
&lt;td&gt;Self-evolution of the LINE AI business-card assistant&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h1&gt;
  
  
  Introduction: two "harnesses" in one week
&lt;/h1&gt;

&lt;p&gt;In my recent &lt;strong&gt;Harness² trilogy&lt;/strong&gt; (&lt;a href="https://dev.to/gde/agent-platform-in-action-7-when-adk-go-graph-workflow-meets-google-research-harness-part-1-28c1"&gt;Part 1&lt;/a&gt;, &lt;a href="https://dev.to/gde/agent-platform-in-action-8-when-adk-go-graph-workflow-meets-google-research-harness-part-2-nc8"&gt;Part 2&lt;/a&gt;, &lt;a href="https://dev.to/gde/agent-platform-in-action-9-when-adk-go-graph-workflow-meets-google-research-harness-part-2-1olm"&gt;Part 3&lt;/a&gt;), I connected Google Research's &lt;strong&gt;&lt;a href="https://github.com/google-research/harness2" rel="noopener noreferrer"&gt;&lt;code&gt;google-research/harness2&lt;/code&gt;&lt;/a&gt;&lt;/strong&gt; to my &lt;strong&gt;&lt;a href="https://github.com/kkdai/line-card-assistant" rel="noopener noreferrer"&gt;LINE AI business-card assistant&lt;/a&gt;&lt;/strong&gt;, letting it read OpenTelemetry traces and grow its own skill files. Accuracy climbed from &lt;code&gt;62.5%&lt;/code&gt; all the way to &lt;code&gt;100.0%&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;This week I also came across DeepSeek's open-source &lt;strong&gt;&lt;a href="https://github.com/deepseek-ai/dsh-superagent-prototype" rel="noopener noreferrer"&gt;&lt;code&gt;deepseek-ai/dsh-superagent-prototype&lt;/code&gt;&lt;/a&gt;&lt;/strong&gt;, which is built on &lt;strong&gt;&lt;a href="https://www.deepseek.com/en/harness/" rel="noopener noreferrer"&gt;DeepSeek Harness (DSH)&lt;/a&gt;&lt;/strong&gt;. I migrated the agent layer of my &lt;strong&gt;&lt;a href="https://github.com/kkdai/line-research-bot-go" rel="noopener noreferrer"&gt;LINE research bot&lt;/a&gt;&lt;/strong&gt; from ADK for Go to DSH, producing &lt;strong&gt;&lt;a href="https://github.com/kkdai/line-research-bot-dsh" rel="noopener noreferrer"&gt;&lt;code&gt;kkdai/line-research-bot-dsh&lt;/code&gt;&lt;/a&gt;&lt;/strong&gt;, which is now running in production.&lt;/p&gt;

&lt;p&gt;Both are called &lt;strong&gt;Harness&lt;/strong&gt;, and at first I assumed they were the same kind of thing. After actually using both, it turns out:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;DSH is about how the harness is assembled and strapped onto the horse so it can run; Harness² is about automatically adjusting every strap on that harness.&lt;/strong&gt; They live at different layers and can even be combined.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Because there is a lot to cover, I split this into two posts:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;This post&lt;/strong&gt;: what the DSH framework actually is (with an architecture diagram), and a point-by-point comparison with Google Harness².&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;a href="https://dev.to/gde/ai-in-practice-migrating-a-line-research-bot-from-go-adk-to-deepseek-harness-dsh-architecture-208e"&gt;The next post&lt;/a&gt;&lt;/strong&gt;: how I actually migrated the LINE research bot from ADK to DSH, plus a list of pitfalls.&lt;/li&gt;
&lt;/ol&gt;




&lt;h1&gt;
  
  
  1. Understanding DeepSeek Harness (DSH)
&lt;/h1&gt;

&lt;p&gt;Many people assume dsh-superagent is an agent SDK. In fact, it consists of two separate layers:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Layer&lt;/th&gt;
&lt;th&gt;What it is&lt;/th&gt;
&lt;th&gt;On npm&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;DeepSeek Harness (DSH)&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;An "agent runtime" that handles model calls, tools, sessions, permissions, and sandboxing, all implemented as plugins&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;@deepseek-ai/dsh&lt;/code&gt; (CLI), plus 100+ &lt;code&gt;@deepseek-ai/dsh-*&lt;/code&gt; packages&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;dsh-superagent&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;A &lt;strong&gt;bundle (plugin pack)&lt;/strong&gt; running on DSH that turns it into a proactive agent that works on a GitHub repository&lt;/td&gt;
&lt;td&gt;A Node package installed into a DSH profile via &lt;code&gt;dsh plugin add&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  1.1 Core design: everything is a Cordis plugin
&lt;/h2&gt;

&lt;p&gt;DSH is built on &lt;strong&gt;Cordis&lt;/strong&gt; (&lt;code&gt;@deepseek-ai/cordis&lt;/code&gt;), a plugin framework. Models, tools, session storage, sandboxing, even the JSON-RPC server: &lt;strong&gt;every piece is a plugin (a "plugin row")&lt;/strong&gt;, and plugins communicate through services exposed on &lt;code&gt;ctx&lt;/code&gt;, such as &lt;code&gt;ctx.llm&lt;/code&gt;, &lt;code&gt;ctx.tools&lt;/code&gt;, &lt;code&gt;ctx.fs&lt;/code&gt;, and &lt;code&gt;ctx.subprocess&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;How plugins are composed is determined by a &lt;strong&gt;Profile&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Bundle&lt;/strong&gt;: an official, pre-assembled set of plugins, e.g. &lt;code&gt;dsh-sdk-minimal&lt;/code&gt;, &lt;code&gt;dsh-base&lt;/code&gt;, &lt;code&gt;web&lt;/code&gt;, &lt;code&gt;tui&lt;/code&gt;, &lt;code&gt;headless&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Profile&lt;/strong&gt;: lives under &lt;code&gt;$DSH_HOME/profiles/&amp;lt;name&amp;gt;/&lt;/code&gt; and specifies which bundles to load.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Patch layers&lt;/strong&gt;: YAML patches layered on top of bundles. A patch can change a plugin's config, disable it with &lt;code&gt;disabled: true&lt;/code&gt;, or &lt;code&gt;insert&lt;/code&gt; your own plugins. Run &lt;code&gt;dsh --profile x --dump-config&lt;/code&gt; to see the fully resolved tree.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="c1"&gt;# Example patch: tweak model settings, disable the shell, insert a custom plugin&lt;/span&gt;
&lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;id&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;llm-deepseek&lt;/span&gt;
  &lt;span class="na"&gt;config&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;thinking&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;disabled&lt;/span&gt;
&lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;id&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;persistent-bash&lt;/span&gt;
  &lt;span class="na"&gt;disabled&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;
&lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;insert&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;id&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;line-research-tools&lt;/span&gt;
      &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;file:///app/dsh/plugin/index.js'&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  1.2 DSH architecture
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmermaid.ink%2Fimg%2Fpako%3AeNptVFFv0zAQ_iuniIcOcMP2gMQ0TZS1okC7Rk15mCiaXNttzBzbsp2Nsu2_c3ZSRLb5JXbuu-_uvjv7PmOGi-wUsq0yd6yiLsDq01oDLt9sdo7aCqaLcvVjnV2ZxgG1VklGgzQaBpXx4Wid_WzxcY2KApGXyAk5FPtQIQxdephy_A0xH7kQ1gtxQ6jMua-I5zeEKSl0ONu4_HyM5hLNU-q08H7oGj14FgsIOY987U-h-Vo_yX0ZM0d6QP8gaxEt1hmGlDAwWgAetlKJPjWXTrBU40GMuJbFRUuWcv3ljXaWES_crXApZx-4NPC1XFwSxPYYZ4vReLJE9wvjuPQwM5R3XptGcyXgDVgaWAWK7oXz_Uo_Ty67OgjdoUIobvoSZYxNJKFxGtbNyfGHE_BB2MM-GKOAUaV6hMVyMS8io98juCYoQm1b3S0GN5rCYFxOr8urcjWZX7fwvkSrxWJWdjnFICgnC7-HaXvU1SVVIFKfwoZiA3IQXMbM78Tm2gvqWIU5vjt534ZVzU5qfwpO7CTm5ASHW0mBi63UYoWsT7o_m8276ErVbWzctJFxQw7jBZRTGzqpRzpUzljJYI4DgBL62P9gmOnrU05iaR4xOAMkShJz0kwklldRmuliPsk7hM9fD-M49ElwBNJ8pu49nQQgQ-q9qDdK-OFzUDom71b7lyypAy8ZUJqXfmNRz-4J3h04Q-PDOpNaBkmV_BOv7n8DoU2Q2-7K41g-xLpaZ4wDrW-BLwTcY5vF9-XsMb89zutO3-gwKr6gmtTK4aEpQ2bqnB6akcIYfFv0_l9fCCLwPkjUJ-ZrjdQhqZu9hawWrqaS47N1n4VK1OkBw0mhjQrZ4-NfHpGC7A%3D%3D%3Ftype%3Dpng" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmermaid.ink%2Fimg%2Fpako%3AeNptVFFv0zAQ_iuniIcOcMP2gMQ0TZS1okC7Rk15mCiaXNttzBzbsp2Nsu2_c3ZSRLb5JXbuu-_uvjv7PmOGi-wUsq0yd6yiLsDq01oDLt9sdo7aCqaLcvVjnV2ZxgG1VklGgzQaBpXx4Wid_WzxcY2KApGXyAk5FPtQIQxdephy_A0xH7kQ1gtxQ6jMua-I5zeEKSl0ONu4_HyM5hLNU-q08H7oGj14FgsIOY987U-h-Vo_yX0ZM0d6QP8gaxEt1hmGlDAwWgAetlKJPjWXTrBU40GMuJbFRUuWcv3ljXaWES_crXApZx-4NPC1XFwSxPYYZ4vReLJE9wvjuPQwM5R3XptGcyXgDVgaWAWK7oXz_Uo_Ty67OgjdoUIobvoSZYxNJKFxGtbNyfGHE_BB2MM-GKOAUaV6hMVyMS8io98juCYoQm1b3S0GN5rCYFxOr8urcjWZX7fwvkSrxWJWdjnFICgnC7-HaXvU1SVVIFKfwoZiA3IQXMbM78Tm2gvqWIU5vjt534ZVzU5qfwpO7CTm5ASHW0mBi63UYoWsT7o_m8276ErVbWzctJFxQw7jBZRTGzqpRzpUzljJYI4DgBL62P9gmOnrU05iaR4xOAMkShJz0kwklldRmuliPsk7hM9fD-M49ElwBNJ8pu49nQQgQ-q9qDdK-OFzUDom71b7lyypAy8ZUJqXfmNRz-4J3h04Q-PDOpNaBkmV_BOv7n8DoU2Q2-7K41g-xLpaZ4wDrW-BLwTcY5vF9-XsMb89zutO3-gwKr6gmtTK4aEpQ2bqnB6akcIYfFv0_l9fCCLwPkjUJ-ZrjdQhqZu9hawWrqaS47N1n4VK1OkBw0mhjQrZ4-NfHpGC7A%3D%3D%3Ftype%3Dpng" alt="DeepSeek Harness (DSH) architecture" width="1009" height="1448"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Four key facts follow from this diagram:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;The agent runs in a separate process.&lt;/strong&gt; Unlike ADK's &lt;code&gt;runner.Run()&lt;/code&gt;, which runs inside your program, with DSH you spawn a &lt;code&gt;dsh&lt;/code&gt; runtime subprocess and talk to it over &lt;strong&gt;stdio JSON-RPC&lt;/strong&gt;. The TypeScript client is &lt;code&gt;@deepseek-ai/dsh-sdk-client&lt;/code&gt;; a Python SDK is also available.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The model layer only speaks the Anthropic Messages protocol.&lt;/strong&gt; The official adapter, &lt;code&gt;llm-deepseek&lt;/code&gt;, targets &lt;code&gt;https://api.deepseek.com/anthropic&lt;/code&gt; by default. You can change &lt;code&gt;baseURL&lt;/code&gt;, but the other side must be a &lt;code&gt;/v1/messages&lt;/code&gt;-compatible endpoint. &lt;strong&gt;There is no Gemini adapter.&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Tools are registered by plugins.&lt;/strong&gt; You write a Cordis plugin and call &lt;code&gt;ctx.tools.register(defineTool({...}))&lt;/code&gt; inside &lt;code&gt;apply(ctx)&lt;/code&gt;. DSH validates arguments against the parameter schema; on failure, the error is returned to the model so it can correct itself.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A session is an event stream.&lt;/strong&gt; Every &lt;code&gt;run()&lt;/code&gt; returns the full list of session events: &lt;code&gt;turn/start&lt;/code&gt;, &lt;code&gt;tool/call&lt;/code&gt;, &lt;code&gt;tool/result&lt;/code&gt;, &lt;code&gt;assistant/message&lt;/code&gt;, &lt;code&gt;turn/end&lt;/code&gt;, and so on. Both structured output extraction and debugging rely on these events.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  1.3 What dsh-superagent builds on DSH
&lt;/h2&gt;

&lt;p&gt;dsh-superagent is a prototype of a "proactive coding agent" used internally by the DeepSeek team. Its README is explicit: &lt;strong&gt;it is a research prototype, not a production product&lt;/strong&gt;. Its domain model looks like this:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmermaid.ink%2Fimg%2Fpako%3AeNpdkE1LxDAQhv_KkKuWvcuyIFpdWL3YggfrYZpMm2CblOnED7b7302zKGiu75PnfZmj0sGQugLVDeFDW2SBh6fGQ3rVS6OqEFnTtuXN7t7JPrawgTtys42NeoWi2C01u74nXqBOeG2Z0KTobKgz0aJoS2aBMhHlOw5Zh2Z08-yChwsQdtjTv29VbGfNbpKV6dAXIcoCh7XF6TeSX7zMOGpNkyTZI3qDQgk9x4ccX6eu3o_kk-N53fFJOkrgvCV4gttqDzP9LDKOSaf4CyZikL-FZ-ONRe9pWKBqvLoENRKP6Ey65VGJpTFf1VCHcRB1On0DRol2Bg%3D%3D%3Ftype%3Dpng" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmermaid.ink%2Fimg%2Fpako%3AeNpdkE1LxDAQhv_KkKuWvcuyIFpdWL3YggfrYZpMm2CblOnED7b7302zKGiu75PnfZmj0sGQugLVDeFDW2SBh6fGQ3rVS6OqEFnTtuXN7t7JPrawgTtys42NeoWi2C01u74nXqBOeG2Z0KTobKgz0aJoS2aBMhHlOw5Zh2Z08-yChwsQdtjTv29VbGfNbpKV6dAXIcoCh7XF6TeSX7zMOGpNkyTZI3qDQgk9x4ccX6eu3o_kk-N53fFJOkrgvCV4gttqDzP9LDKOSaf4CyZikL-FZ-ONRe9pWKBqvLoENRKP6Ey65VGJpTFf1VCHcRB1On0DRol2Bg%3D%3D%3Ftype%3Dpng" alt="dsh-superagent domain model" width="1437" height="232"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A &lt;strong&gt;Source&lt;/strong&gt; converts GitHub notifications and Feishu messages into &lt;strong&gt;Triggers&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Eval&lt;/strong&gt; decides whether to accept a job based on &lt;strong&gt;Policy&lt;/strong&gt; (who can issue commands, where, and with what authority). Accepted work becomes a &lt;strong&gt;Ticket&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Each Ticket is handled by an &lt;strong&gt;Executor Session&lt;/strong&gt; working in its own directory. Results flow back to the original conversation through a &lt;strong&gt;Channel&lt;/strong&gt;, e.g. by opening a PR.&lt;/li&gt;
&lt;li&gt;A web dashboard shows which items need a human decision.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Its execution model is &lt;strong&gt;a single long-running process + SQLite + a management API that listens only on 127.0.0.1&lt;/strong&gt;, and it requires a GitHub repo and an agent account. That is why, when migrating the LINE bot, I borrowed only DSH and did not fork dsh-superagent; details are in &lt;a href="https://dev.to/gde/ai-in-practice-migrating-a-line-research-bot-from-go-adk-to-deepseek-harness-dsh-architecture-208e"&gt;the next post&lt;/a&gt;.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;💡 &lt;strong&gt;Takeaway&lt;/strong&gt;: When talking about DSH, be clear whether you mean the &lt;strong&gt;runtime (the harness)&lt;/strong&gt; or &lt;strong&gt;the application built on top of it (the superagent)&lt;/strong&gt;. What most people actually want to borrow is the former.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h1&gt;
  
  
  2. Quick recap: what Google Research Harness² does
&lt;/h1&gt;

&lt;p&gt;For the full details, see &lt;a href="https://dev.to/gde/agent-platform-in-action-7-when-adk-go-graph-workflow-meets-google-research-harness-part-1-28c1"&gt;Harness² Part 1&lt;/a&gt;. Here are the highlights:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;It defines the "harness" as an editable file tree&lt;/strong&gt;: &lt;code&gt;c1..c4&lt;/code&gt; are always-loaded components (&lt;code&gt;systemprompt.md&lt;/code&gt;, &lt;code&gt;guardrails.md&lt;/code&gt;, &lt;code&gt;LongTermMEMORY.md&lt;/code&gt;, &lt;code&gt;tool_descriptions/&lt;/code&gt;) with a combined budget of &lt;strong&gt;24,000 bytes&lt;/strong&gt;; &lt;code&gt;c5..c8&lt;/code&gt; are on-demand components (&lt;code&gt;sub_agents/&lt;/code&gt;, &lt;code&gt;skills/&lt;/code&gt;, &lt;code&gt;scripts/&lt;/code&gt;, &lt;code&gt;plugin/&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;It edits this tree automatically via two-level recursion&lt;/strong&gt;:

&lt;ul&gt;
&lt;li&gt;Inner loop, &lt;strong&gt;Propose → Probe → Compose&lt;/strong&gt;: read the execution trajectories (&lt;code&gt;trajectory.md&lt;/code&gt;) of failed tasks, propose multiple candidate patches, run each once in a sandbox, and compose the ones with positive gains into the next generation $H^{(k)}$.&lt;/li&gt;
&lt;li&gt;Outer loop, &lt;strong&gt;Experience Reflector&lt;/strong&gt;: distill lessons across rounds and write them into &lt;code&gt;c3: LongTermMEMORY.md&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;It connects to your agent through a &lt;code&gt;BenchmarkAdapter&lt;/code&gt;&lt;/strong&gt;: &lt;code&gt;run()&lt;/code&gt; must answer "with this version of the harness loaded, what did the agent produce for this task, and what happened along the way?" For the business-card assistant, I wrote a Go &lt;code&gt;cmd/harness-runner&lt;/code&gt; subprocess CLI that the Python Harness² calls.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Zero-leakage barrier&lt;/strong&gt;: gold answers are hidden from both the agent and the Harvester LLM, forcing it to infer general rules from trajectories.&lt;/li&gt;
&lt;/ul&gt;




&lt;h1&gt;
  
  
  3. DSH vs. Harness²: a point-by-point comparison
&lt;/h1&gt;

&lt;h2&gt;
  
  
  3.1 "Harness" means different things on each side
&lt;/h2&gt;

&lt;p&gt;This is the single most important point of the post:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;&lt;/th&gt;
&lt;th&gt;Harness in DSH&lt;/th&gt;
&lt;th&gt;Harness in Harness²&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Refers to&lt;/td&gt;
&lt;td&gt;
&lt;strong&gt;The program that runs the agent&lt;/strong&gt;: agent loop, tool execution, model calls, sessions, permissions&lt;/td&gt;
&lt;td&gt;
&lt;strong&gt;What gets fed to the agent&lt;/strong&gt;: prompts, guardrails, memory, tool descriptions, skills&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Form&lt;/td&gt;
&lt;td&gt;A Node process (runtime)&lt;/td&gt;
&lt;td&gt;A folder (&lt;code&gt;c1..c8&lt;/code&gt; files)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Analogy&lt;/td&gt;
&lt;td&gt;How the buckles and reins of a harness are assembled&lt;/td&gt;
&lt;td&gt;How long each strap on the harness is adjusted&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Who changes it&lt;/td&gt;
&lt;td&gt;Engineers write profiles / patches / plugins&lt;/td&gt;
&lt;td&gt;Harness²'s optimizer changes it itself&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;So the two are not competing alternatives; they are &lt;strong&gt;an upper and a lower layer&lt;/strong&gt;. The file tree Harness² optimizes must eventually be loaded and executed by some runtime, and DSH is exactly such a runtime.&lt;/p&gt;

&lt;h2&gt;
  
  
  3.2 Full comparison
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Aspect&lt;/th&gt;
&lt;th&gt;DeepSeek Harness (DSH)&lt;/th&gt;
&lt;th&gt;Google Research Harness²&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Origin&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Open-sourced by DeepSeek; the foundation of dsh-superagent&lt;/td&gt;
&lt;td&gt;Open-sourced alongside a Google Research paper (arXiv:2610.14224)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Language&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;TypeScript / Node (plus a Python SDK)&lt;/td&gt;
&lt;td&gt;Python&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Role&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Agent runtime&lt;/td&gt;
&lt;td&gt;Offline optimizer for the agent's harness&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Core abstractions&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Cordis plugins, Profile, Bundle, Patch&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;c1..c8&lt;/code&gt; components, &lt;code&gt;BenchmarkAdapter&lt;/code&gt;, Recursion&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Primary output&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;The result of one agent run + session events&lt;/td&gt;
&lt;td&gt;A better harness file tree&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;When it runs&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Online, on every request&lt;/td&gt;
&lt;td&gt;Offline, over multiple rounds against an eval set&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Requires an eval set&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;No&lt;/td&gt;
&lt;td&gt;
&lt;strong&gt;Yes&lt;/strong&gt; (plus rubrics and trajectories)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Model&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Anthropic Messages-compatible endpoint (DeepSeek by default)&lt;/td&gt;
&lt;td&gt;The optimized agent can use any model; the Harvester is configured separately&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Intrusiveness for existing agents&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;High: the agent must run inside DSH&lt;/td&gt;
&lt;td&gt;Low: write an adapter and externalize config into files&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;How you observe the agent&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Session events such as &lt;code&gt;tool/call&lt;/code&gt;, &lt;code&gt;tool/result&lt;/code&gt;, &lt;code&gt;turn/end&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;trajectory.md&lt;/code&gt; (generated from OpenTelemetry spans in the business-card assistant)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Maturity&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;0.2.1-rc.5&lt;/code&gt;, pre-release; options get renamed&lt;/td&gt;
&lt;td&gt;Research code; interfaces oriented around the paper's experiments&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;In this series&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Agent layer of the LINE research bot's online service&lt;/td&gt;
&lt;td&gt;Offline self-evolution of the LINE AI business-card assistant&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  3.3 Where do Harness²'s &lt;code&gt;c1..c8&lt;/code&gt; map to in DSH?
&lt;/h2&gt;

&lt;p&gt;Since DSH also "assembles a bunch of things into an agent", we can try mapping Harness²'s eight components onto it. The table below reflects my understanding from actually using DSH; &lt;strong&gt;where there is no counterpart in my usage, I say so&lt;/strong&gt;:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Harness² component&lt;/th&gt;
&lt;th&gt;Where it lives in DSH&lt;/th&gt;
&lt;th&gt;How I used it in the LINE research bot&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;&lt;code&gt;c1&lt;/code&gt; systemprompt.md&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;The &lt;code&gt;system-prompt&lt;/code&gt; plugin; the persona can be passed via &lt;code&gt;DSH_SYSTEM_PROMPT&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;prompts/persona.md&lt;/code&gt; as the persona; each of the three stages' instructions goes in the user message&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;&lt;code&gt;c2&lt;/code&gt; guardrails.md&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Two places: &lt;strong&gt;schema validation&lt;/strong&gt; of tool arguments (&lt;code&gt;required&lt;/code&gt;, &lt;code&gt;enum&lt;/code&gt;), and patches that set dangerous tools to &lt;code&gt;disabled: true&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;enum&lt;/code&gt; on &lt;code&gt;submit_report&lt;/code&gt;'s &lt;code&gt;error&lt;/code&gt; field rejects invalid values; bash and editor are disabled&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;&lt;code&gt;c3&lt;/code&gt; LongTermMEMORY.md&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;A DSH session is &lt;strong&gt;an event stream for a single run&lt;/strong&gt;, not cross-round memory&lt;/td&gt;
&lt;td&gt;Not used; cross-stage data lives in Firestore&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;&lt;code&gt;c4&lt;/code&gt; tool_descriptions/&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;The &lt;code&gt;description&lt;/code&gt; and parameter schema in &lt;code&gt;defineTool()&lt;/code&gt;, which the model sees directly&lt;/td&gt;
&lt;td&gt;Descriptions for &lt;code&gt;web_research&lt;/code&gt; and &lt;code&gt;submit_*&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;&lt;code&gt;c5&lt;/code&gt; sub_agents/&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;DSH has a built-in &lt;code&gt;subagent&lt;/code&gt; tool (visible in the full &lt;code&gt;sdk&lt;/code&gt; profile)&lt;/td&gt;
&lt;td&gt;Not used; also disabled in &lt;code&gt;sdk-minimal&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;&lt;code&gt;c6&lt;/code&gt; skills/&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;I did not investigate an equivalent mechanism this time&lt;/td&gt;
&lt;td&gt;Not used&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;&lt;code&gt;c7&lt;/code&gt; scripts/&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Equivalent to letting the agent run a shell (&lt;code&gt;persistent-bash&lt;/code&gt; and similar tools)&lt;/td&gt;
&lt;td&gt;Deliberately disabled&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;&lt;code&gt;c8&lt;/code&gt; plugin/&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;
&lt;strong&gt;This is the core of DSH itself&lt;/strong&gt;: Cordis plugins&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;dsh/plugin/index.js&lt;/code&gt; registers the research tools&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;The most interesting finding from this mapping: &lt;strong&gt;Harness²'s &lt;code&gt;c8&lt;/code&gt; is the star in DSH&lt;/strong&gt;, while &lt;code&gt;c1..c3&lt;/code&gt;, which Harness² cares about most, get only basic attachment points in DSH. This mirrors their respective roles: DSH cares whether the &lt;em&gt;execution&lt;/em&gt; side can be assembled, while Harness² cares whether the &lt;em&gt;content&lt;/em&gt; side can evolve.&lt;/p&gt;

&lt;h2&gt;
  
  
  3.4 Common ground: both move the agent's "equipment" out of the code
&lt;/h2&gt;

&lt;p&gt;Despite operating at different layers, the two share several design instincts:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Externalize configuration into files.&lt;/strong&gt; The first step in bringing Harness² to the business-card assistant was extracting the prompts hard-coded in &lt;code&gt;.go&lt;/code&gt; files into &lt;code&gt;harness/base/&lt;/code&gt;; DSH externalizes "which plugins to load and which tools to disable" into profiles + YAML patches. Neither wants you to recompile just to change agent behavior.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Isolate via subprocesses.&lt;/strong&gt; In the business-card assistant, Harness² calls a Go &lt;code&gt;harness-runner&lt;/code&gt; subprocess; DSH itself is a subprocess spawned by the SDK. Either way, the host can be written in any language.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Both need visibility into the agent's process, not just its result.&lt;/strong&gt; Harness² relies on &lt;code&gt;trajectory.md&lt;/code&gt; for diagnosis; on DSH, I rely on session events to extract structured output and to verify that patches took effect. &lt;strong&gt;You can only optimize or debug what you can observe.&lt;/strong&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  3.5 Differences: one governs &lt;em&gt;how it runs&lt;/em&gt;, the other &lt;em&gt;what it runs&lt;/em&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;DSH's challenges are engineering problems&lt;/strong&gt;: plugin path resolution, renamed SDK options, a model layer limited to the Messages protocol. These are all about "getting it to run"; I cover ten pitfalls in &lt;a href="https://dev.to/gde/ai-in-practice-migrating-a-line-research-bot-from-go-adk-to-deepseek-harness-dsh-architecture-208e"&gt;the next post&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Harness²'s challenges are data problems&lt;/strong&gt;: a good enough eval set, rubrics, zero-leakage design, and high-resolution trajectories. These are all about "making it better".&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;DSH runs on every request&lt;/strong&gt;, so latency and cost matter; &lt;strong&gt;Harness² runs offline&lt;/strong&gt;, so it can spend more tokens to produce a better file tree, at zero cost once deployed.&lt;/li&gt;
&lt;/ul&gt;




&lt;h1&gt;
  
  
  4. Can they be combined?
&lt;/h1&gt;

&lt;p&gt;Yes, and conceptually it is quite natural. Taking the LINE research bot as an example, if I wanted it to self-evolve like the business-card assistant, it would look roughly like this:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmermaid.ink%2Fimg%2Fpako%3AeNptUl1LwzAU_SuXPE1cu48nFRmMbSgiUrr5INaHtL213dok3KSTse2_e9tOZNM8JOHee07OOWQvEp2iuAORlforySU5eA4jBbxsHX-SNDkEb--ReJSk0NqoHg7jMfSCncu16oPOsrJQeBWJjw7VrHAxY0SISU220Oo-psEkIG20RRgA3-LmnOmqqZwhp_OAkXObT1NpHJJPter9IQfPmzSjXRFVGqkLyasl0xBalJTkwCQKCXqrncFlQoVx55QPixcen2m1RfafjHw_uYFCOd0qN0hWKwnX8EPoG-l431XlubLXhmaOaJaIm1Ng_zhYhU88Z7nJ4QBuUTkLUT0e3Y7BkVxj4jTt_Cq9FNn65lfak1n--OdMmt4hEp6Xd-97aUEctuc5aTfemp1E4tCQdQhmOSFSLAv2L-MS2eqvjma8zVr0QVRIlSxS_jB74XKs2q-TYibr0onj8RtudrY_%3Ftype%3Dpng" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmermaid.ink%2Fimg%2Fpako%3AeNptUl1LwzAU_SuXPE1cu48nFRmMbSgiUrr5INaHtL213dok3KSTse2_e9tOZNM8JOHee07OOWQvEp2iuAORlforySU5eA4jBbxsHX-SNDkEb--ReJSk0NqoHg7jMfSCncu16oPOsrJQeBWJjw7VrHAxY0SISU220Oo-psEkIG20RRgA3-LmnOmqqZwhp_OAkXObT1NpHJJPter9IQfPmzSjXRFVGqkLyasl0xBalJTkwCQKCXqrncFlQoVx55QPixcen2m1RfafjHw_uYFCOd0qN0hWKwnX8EPoG-l431XlubLXhmaOaJaIm1Ng_zhYhU88Z7nJ4QBuUTkLUT0e3Y7BkVxj4jTt_Cq9FNn65lfak1n--OdMmt4hEp6Xd-97aUEctuc5aTfemp1E4tCQdQhmOSFSLAv2L-MS2eqvjma8zVr0QVRIlSxS_jB74XKs2q-TYibr0onj8RtudrY_%3Ftype%3Dpng" alt="Combining Harness² with DSH via an adapter" width="1388" height="229"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Modeled on the business-card assistant's &lt;code&gt;cmd/harness-runner&lt;/code&gt;, write a TypeScript runner CLI that accepts &lt;code&gt;--harness-dir&lt;/code&gt; and &lt;code&gt;--task-json&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;The runner converts &lt;code&gt;c1&lt;/code&gt; into &lt;code&gt;DSH_SYSTEM_PROMPT&lt;/code&gt;, writes &lt;code&gt;c4&lt;/code&gt; into the tool descriptions, and turns part of &lt;code&gt;c2&lt;/code&gt; into a patch (e.g. which tools to disable).&lt;/li&gt;
&lt;li&gt;After the run, it renders session events such as &lt;code&gt;tool/call&lt;/code&gt; / &lt;code&gt;tool/result&lt;/code&gt; into &lt;code&gt;trajectory.md&lt;/code&gt; and returns it, together with the report, to the Python-side adapter.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;I &lt;strong&gt;have not implemented this yet&lt;/strong&gt;; it simply seems feasible after putting the experience from both projects together. DSH's session events are already closer to "agent decisions" than OpenTelemetry spans, so they should work well as trajectories.&lt;/p&gt;




&lt;h1&gt;
  
  
  5. When to use which?
&lt;/h1&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Your situation&lt;/th&gt;
&lt;th&gt;Recommendation&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;You want an agent runtime that is composable, lets you disable dangerous tools, and lets you swap model endpoints&lt;/td&gt;
&lt;td&gt;
&lt;strong&gt;DSH&lt;/strong&gt; (note: it is pre-release, and the model layer only speaks Messages)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Your agent is already in production and you want prompts, skills, and memory to evolve automatically based on evaluation results&lt;/td&gt;
&lt;td&gt;
&lt;strong&gt;Harness²&lt;/strong&gt; (requires an eval set and execution trajectories)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;You already run well on ADK and just want to improve quality&lt;/td&gt;
&lt;td&gt;Start with &lt;strong&gt;Harness²&lt;/strong&gt;; no need to switch frameworks&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;You want both&lt;/td&gt;
&lt;td&gt;Use DSH as the runtime and Harness² as the offline optimizer, connected via an adapter + subprocess&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;h1&gt;
  
  
  Summary
&lt;/h1&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Despite the shared name, DSH is a runtime, while Harness² is the content a runtime loads plus an optimizer for it.&lt;/strong&gt; Once this is clear, there is no point asking "which one is better".&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;DSH's design centers on composability&lt;/strong&gt;: Cordis plugins + profile layering mean disabling, swapping, or inserting any component takes just a few lines of YAML. The trade-off is that the agent runs in a separate process and must be driven over JSON-RPC.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Harness²'s design centers on evolvability&lt;/strong&gt;: it splits the agent's equipment into budget-constrained &lt;code&gt;c1..c8&lt;/code&gt; components and uses trajectory-driven, two-level recursion to improve them.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Both tackle different facets of the same goal&lt;/strong&gt;: freeing agent behavior from code. One frees &lt;em&gt;how it runs&lt;/em&gt;; the other frees &lt;em&gt;what it runs&lt;/em&gt;.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The next post gets hands-on: &lt;strong&gt;&lt;a href="https://dev.to/gde/ai-in-practice-migrating-a-line-research-bot-from-go-adk-to-deepseek-harness-dsh-architecture-208e"&gt;Migrating a LINE Research Bot from Go ADK to DeepSeek Harness: Migration Mapping and Pitfalls&lt;/a&gt;&lt;/strong&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Further reading
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://dev.to/gde/agent-platform-in-action-7-when-adk-go-graph-workflow-meets-google-research-harness-part-1-28c1"&gt;Harness² Part 1: The two-level recursive agent harness framework and decoupling into c1..c8&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://dev.to/gde/agent-platform-in-action-8-when-adk-go-graph-workflow-meets-google-research-harness-part-2-nc8"&gt;Harness² Part 2: LineCardAdapter, the zero-leakage barrier, and behavioral trajectories&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://dev.to/gde/agent-platform-in-action-9-when-adk-go-graph-workflow-meets-google-research-harness-part-2-1olm"&gt;Harness² Part 3: From 62.5% to 100% with two-level recursion&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/deepseek-ai/dsh-superagent-prototype" rel="noopener noreferrer"&gt;&lt;code&gt;deepseek-ai/dsh-superagent-prototype&lt;/code&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.deepseek.com/en/harness/" rel="noopener noreferrer"&gt;DeepSeek Harness&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/google-research/harness2" rel="noopener noreferrer"&gt;&lt;code&gt;google-research/harness2&lt;/code&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/kkdai/line-research-bot-dsh" rel="noopener noreferrer"&gt;&lt;code&gt;kkdai/line-research-bot-dsh&lt;/code&gt;&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>ai</category>
      <category>architecture</category>
      <category>llm</category>
    </item>
    <item>
      <title>[AI in Practice] Migrating a LINE Research Bot from Go ADK to DeepSeek Harness (DSH): Architecture, Mapping, and Pitfalls</title>
      <dc:creator>Evan Lin</dc:creator>
      <pubDate>Tue, 03 Nov 2026 00:00:00 +0000</pubDate>
      <link>https://dev.to/gde/ai-in-practice-migrating-a-line-research-bot-from-go-adk-to-deepseek-harness-dsh-architecture-208e</link>
      <guid>https://dev.to/gde/ai-in-practice-migrating-a-line-research-bot-from-go-adk-to-deepseek-harness-dsh-architecture-208e</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmermaid.ink%2Fimg%2Fpako%3AeNqNVMtu2zAQ_JWFTk5b1Sl6KGA0AeSXkkaJCstoDlFh0OTaIiyRAknVMZL8e5eSW9fOodFJWi1nhjNLPgVcCwwGEKxKveUFMw6SWa6AHtss14bVBQwn03Q2eciDIa60wQHEGt5DNL4B-vQfPSvVukTgWjkmFZqzPPjZgfhHSIPcSa1gPjxUh4urNL0h1OT6bgL3uCy03kAfRqVuBMyZ3VhCgTC8pNZ737jVZoMGerE-xve_fd9zHphGEf3HWaN6Z1-Xpn8pVVgbzdES2DN1kmpC8trLsmJrVA7y5vxcfIHPbX_auLpxGS-wYm0ho6VeeuaYwxNaD9PxxlqTARkywwvypjHlwpuBj66jjW-J9QcaqkB03QLHWEkl_yKiErk6MT6aziczL3fl0Axgvqsx40bWjijGiHWGuIErZhRphB6ra6pbKZCzNyUQvT2B6DiBg5JjnuiQhLBFaMUm5KUkk9sdWyekhm9ZehfOvo-8MdFinF09tM1A0TlZod_9PrFuEWF4oypW0u5q5njR1ZtlJd3iHend4nJh0HbmO61LeyKKSPaqIuUKo2vJof_rU78iEpoB20lJEm-FdJgkt39sPAFKkr0b_8_zlPlfkYN2wfrVzIwOI-MpXg1GdxDh4sIDpqrcgSsQuiku2Y6SoROsaEMtfptqH6aUvXV0buk9HmXH-UKjuiWiJfXzlqvgAwQVmopJQTfDU0AkVXtHCFyxpnTBy8tvgn5UHg%3D%3D%3Ftype%3Dpng" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmermaid.ink%2Fimg%2Fpako%3AeNqNVMtu2zAQ_JWFTk5b1Sl6KGA0AeSXkkaJCstoDlFh0OTaIiyRAknVMZL8e5eSW9fOodFJWi1nhjNLPgVcCwwGEKxKveUFMw6SWa6AHtss14bVBQwn03Q2eciDIa60wQHEGt5DNL4B-vQfPSvVukTgWjkmFZqzPPjZgfhHSIPcSa1gPjxUh4urNL0h1OT6bgL3uCy03kAfRqVuBMyZ3VhCgTC8pNZ737jVZoMGerE-xve_fd9zHphGEf3HWaN6Z1-Xpn8pVVgbzdES2DN1kmpC8trLsmJrVA7y5vxcfIHPbX_auLpxGS-wYm0ho6VeeuaYwxNaD9PxxlqTARkywwvypjHlwpuBj66jjW-J9QcaqkB03QLHWEkl_yKiErk6MT6aziczL3fl0Axgvqsx40bWjijGiHWGuIErZhRphB6ra6pbKZCzNyUQvT2B6DiBg5JjnuiQhLBFaMUm5KUkk9sdWyekhm9ZehfOvo-8MdFinF09tM1A0TlZod_9PrFuEWF4oypW0u5q5njR1ZtlJd3iHend4nJh0HbmO61LeyKKSPaqIuUKo2vJof_rU78iEpoB20lJEm-FdJgkt39sPAFKkr0b_8_zlPlfkYN2wfrVzIwOI-MpXg1GdxDh4sIDpqrcgSsQuiku2Y6SoROsaEMtfptqH6aUvXV0buk9HmXH-UKjuiWiJfXzlqvgAwQVmopJQTfDU0AkVXtHCFyxpnTBy8tvgn5UHg%3D%3D%3Ftype%3Dpng" alt="Before / after architecture: Go ADK vs. DeepSeek Harness" width="1027" height="859"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;&lt;/th&gt;
&lt;th&gt;Before (ADK for Go)&lt;/th&gt;
&lt;th&gt;After (DeepSeek Harness)&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Where the agent runs&lt;/td&gt;
&lt;td&gt;Inside the same Go process&lt;/td&gt;
&lt;td&gt;One &lt;code&gt;dsh&lt;/code&gt; subprocess per stage&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;How it reaches Gemini&lt;/td&gt;
&lt;td&gt;Direct connection to Vertex AI&lt;/td&gt;
&lt;td&gt;DSH (Messages protocol) → LiteLLM sidecar → Vertex AI&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Structured output&lt;/td&gt;
&lt;td&gt;&lt;code&gt;OutputSchema&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;submit_*&lt;/code&gt; tools + reading session events&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Google Search&lt;/td&gt;
&lt;td&gt;ADK built-in &lt;code&gt;geminitool&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;Custom &lt;code&gt;web_research&lt;/code&gt; tool&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Cloud Run&lt;/td&gt;
&lt;td&gt;1 container&lt;/td&gt;
&lt;td&gt;2 containers (app + LiteLLM), still scales to zero&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h1&gt;
  
  
  Background
&lt;/h1&gt;

&lt;p&gt;In &lt;a href="https://dev.to/gde/ai-in-practice-rewriting-a-line-research-bot-from-python-managed-agents-to-go-adk-v190-from-4c50"&gt;my previous post&lt;/a&gt;, I rewrote my LINE research-planner bot from Python + Managed Agents to &lt;strong&gt;Go + &lt;a href="https://github.com/google/adk-go" rel="noopener noreferrer"&gt;ADK for Go&lt;/a&gt;&lt;/strong&gt;, resulting in &lt;strong&gt;&lt;a href="https://github.com/kkdai/line-research-bot-go" rel="noopener noreferrer"&gt;&lt;code&gt;kkdai/line-research-bot-go&lt;/code&gt;&lt;/a&gt;&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;The user experience is unchanged:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Send "&lt;strong&gt;Research how to choose a SOTA open-source vector database&lt;/strong&gt;" on LINE, and the bot runs three stages in sequence, &lt;strong&gt;PLAN → SEARCH_COMPARE → WRITE_REPORT&lt;/strong&gt;, then replies with a Flex card containing a summary, key sources, and a "Read full report" button.&lt;/li&gt;
&lt;li&gt;Follow up with "&lt;strong&gt;Go deeper on Chapter 2 and add Japanese sources&lt;/strong&gt;", and the same report is refined in place: the version number is bumped and the previous version is saved as a snapshot.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Around the same time, DeepSeek open-sourced &lt;strong&gt;&lt;a href="https://github.com/deepseek-ai/dsh-superagent-prototype" rel="noopener noreferrer"&gt;&lt;code&gt;deepseek-ai/dsh-superagent-prototype&lt;/code&gt;&lt;/a&gt;&lt;/strong&gt;, a "super agent" prototype built on &lt;strong&gt;&lt;a href="https://www.deepseek.com/en/harness/" rel="noopener noreferrer"&gt;DeepSeek Harness (DSH)&lt;/a&gt;&lt;/strong&gt;. I was curious what this framework would look like behind a LINE bot, so I set myself a challenge:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Keep the LINE bot features and Cloud Run setup exactly as they are, and swap only the agent framework from ADK to the dsh-superagent stack.&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;The short answer: &lt;strong&gt;it works, and it is already running in production&lt;/strong&gt;, but not in the way I originally expected. This post covers three things:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;What the DSH framework actually is&lt;/strong&gt; (with an architecture diagram), and what dsh-superagent builds on top of it.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;How to migrate from ADK&lt;/strong&gt;: concept mapping and real code.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;What goes wrong&lt;/strong&gt;: the pitfalls I actually hit, collected into a checklist.&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Repo&lt;/th&gt;
&lt;th&gt;Description&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;&lt;a href="https://github.com/kkdai/line-research-bot-go" rel="noopener noreferrer"&gt;&lt;code&gt;kkdai/line-research-bot-go&lt;/code&gt;&lt;/a&gt;&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Previous post: Go 1.27 + ADK for Go v1.9.0&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;&lt;a href="https://github.com/kkdai/line-research-bot-dsh" rel="noopener noreferrer"&gt;&lt;code&gt;kkdai/line-research-bot-dsh&lt;/code&gt;&lt;/a&gt;&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;This post: TypeScript (Node 24) + DeepSeek Harness 0.2.1-rc.5. The LINE webhook currently points here.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;h1&gt;
  
  
  1. Understanding DeepSeek Harness (DSH)
&lt;/h1&gt;

&lt;p&gt;Many people assume dsh-superagent is an agent SDK. In fact, it consists of two separate layers:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Layer&lt;/th&gt;
&lt;th&gt;What it is&lt;/th&gt;
&lt;th&gt;On npm&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;DeepSeek Harness (DSH)&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;An "agent runtime" that handles model calls, tools, sessions, permissions, and sandboxing, all implemented as plugins&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;@deepseek-ai/dsh&lt;/code&gt; (CLI), plus 100+ &lt;code&gt;@deepseek-ai/dsh-*&lt;/code&gt; packages&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;dsh-superagent&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;A &lt;strong&gt;bundle (plugin pack)&lt;/strong&gt; running on DSH that turns it into a proactive agent that works on a GitHub repository&lt;/td&gt;
&lt;td&gt;A Node package installed into a DSH profile via &lt;code&gt;dsh plugin add&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  DSH's core design: everything is a Cordis plugin
&lt;/h2&gt;

&lt;p&gt;DSH is built on &lt;strong&gt;Cordis&lt;/strong&gt; (&lt;code&gt;@deepseek-ai/cordis&lt;/code&gt;), a plugin framework. Models, tools, session storage, sandboxing, even the JSON-RPC server: &lt;strong&gt;every piece is a plugin (a "plugin row")&lt;/strong&gt;, and plugins communicate through services exposed on &lt;code&gt;ctx&lt;/code&gt;, such as &lt;code&gt;ctx.llm&lt;/code&gt;, &lt;code&gt;ctx.tools&lt;/code&gt;, &lt;code&gt;ctx.fs&lt;/code&gt;, and &lt;code&gt;ctx.subprocess&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;How plugins are composed is determined by a &lt;strong&gt;Profile&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Bundle&lt;/strong&gt;: an official, pre-assembled set of plugins, e.g. &lt;code&gt;dsh-sdk-minimal&lt;/code&gt;, &lt;code&gt;dsh-base&lt;/code&gt;, &lt;code&gt;web&lt;/code&gt;, &lt;code&gt;tui&lt;/code&gt;, &lt;code&gt;headless&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Profile&lt;/strong&gt;: lives under &lt;code&gt;$DSH_HOME/profiles/&amp;lt;name&amp;gt;/&lt;/code&gt; and specifies which bundles to load.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Patch layers&lt;/strong&gt;: YAML patches layered on top of bundles. A patch can change a plugin's config, disable it with &lt;code&gt;disabled: true&lt;/code&gt;, or &lt;code&gt;insert&lt;/code&gt; your own plugins. Run &lt;code&gt;dsh --profile x --dump-config&lt;/code&gt; to see the fully resolved tree.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="c1"&gt;# Example patch: tweak model settings, disable the shell, insert a custom plugin&lt;/span&gt;
&lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;id&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;llm-deepseek&lt;/span&gt;
  &lt;span class="na"&gt;config&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;thinking&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;disabled&lt;/span&gt;
&lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;id&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;persistent-bash&lt;/span&gt;
  &lt;span class="na"&gt;disabled&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;
&lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;insert&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;id&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;line-research-tools&lt;/span&gt;
      &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;file:///app/dsh/plugin/index.js'&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  DSH architecture
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmermaid.ink%2Fimg%2Fpako%3AeNptVFFv0zAQ_iuniIcOcMP2gMQ0TZS1okC7Rk15mCiaXNttzBzbsp2Nsu2_c3ZSRLb5JXbuu-_uvjv7PmOGi-wUsq0yd6yiLsDq01oDLt9sdo7aCqaLcvVjnV2ZxgG1VklGgzQaBpXx4Wid_WzxcY2KApGXyAk5FPtQIQxdephy_A0xH7kQ1gtxQ6jMua-I5zeEKSl0ONu4_HyM5hLNU-q08H7oGj14FgsIOY987U-h-Vo_yX0ZM0d6QP8gaxEt1hmGlDAwWgAetlKJPjWXTrBU40GMuJbFRUuWcv3ljXaWES_crXApZx-4NPC1XFwSxPYYZ4vReLJE9wvjuPQwM5R3XptGcyXgDVgaWAWK7oXz_Uo_Ty67OgjdoUIobvoSZYxNJKFxGtbNyfGHE_BB2MM-GKOAUaV6hMVyMS8io98juCYoQm1b3S0GN5rCYFxOr8urcjWZX7fwvkSrxWJWdjnFICgnC7-HaXvU1SVVIFKfwoZiA3IQXMbM78Tm2gvqWIU5vjt534ZVzU5qfwpO7CTm5ASHW0mBi63UYoWsT7o_m8276ErVbWzctJFxQw7jBZRTGzqpRzpUzljJYI4DgBL62P9gmOnrU05iaR4xOAMkShJz0kwklldRmuliPsk7hM9fD-M49ElwBNJ8pu49nQQgQ-q9qDdK-OFzUDom71b7lyypAy8ZUJqXfmNRz-4J3h04Q-PDOpNaBkmV_BOv7n8DoU2Q2-7K41g-xLpaZ4wDrW-BLwTcY5vF9-XsMb89zutO3-gwKr6gmtTK4aEpQ2bqnB6akcIYfFv0_l9fCCLwPkjUJ-ZrjdQhqZu9hawWrqaS47N1n4VK1OkBw0mhjQrZ4-NfHpGC7A%3D%3D%3Ftype%3Dpng" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmermaid.ink%2Fimg%2Fpako%3AeNptVFFv0zAQ_iuniIcOcMP2gMQ0TZS1okC7Rk15mCiaXNttzBzbsp2Nsu2_c3ZSRLb5JXbuu-_uvjv7PmOGi-wUsq0yd6yiLsDq01oDLt9sdo7aCqaLcvVjnV2ZxgG1VklGgzQaBpXx4Wid_WzxcY2KApGXyAk5FPtQIQxdephy_A0xH7kQ1gtxQ6jMua-I5zeEKSl0ONu4_HyM5hLNU-q08H7oGj14FgsIOY987U-h-Vo_yX0ZM0d6QP8gaxEt1hmGlDAwWgAetlKJPjWXTrBU40GMuJbFRUuWcv3ljXaWES_crXApZx-4NPC1XFwSxPYYZ4vReLJE9wvjuPQwM5R3XptGcyXgDVgaWAWK7oXz_Uo_Ty67OgjdoUIobvoSZYxNJKFxGtbNyfGHE_BB2MM-GKOAUaV6hMVyMS8io98juCYoQm1b3S0GN5rCYFxOr8urcjWZX7fwvkSrxWJWdjnFICgnC7-HaXvU1SVVIFKfwoZiA3IQXMbM78Tm2gvqWIU5vjt534ZVzU5qfwpO7CTm5ASHW0mBi63UYoWsT7o_m8276ErVbWzctJFxQw7jBZRTGzqpRzpUzljJYI4DgBL62P9gmOnrU05iaR4xOAMkShJz0kwklldRmuliPsk7hM9fD-M49ElwBNJ8pu49nQQgQ-q9qDdK-OFzUDom71b7lyypAy8ZUJqXfmNRz-4J3h04Q-PDOpNaBkmV_BOv7n8DoU2Q2-7K41g-xLpaZ4wDrW-BLwTcY5vF9-XsMb89zutO3-gwKr6gmtTK4aEpQ2bqnB6akcIYfFv0_l9fCCLwPkjUJ-ZrjdQhqZu9hawWrqaS47N1n4VK1OkBw0mhjQrZ4-NfHpGC7A%3D%3D%3Ftype%3Dpng" alt="DeepSeek Harness (DSH) architecture" width="1009" height="1448"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;A few facts that follow from this diagram are critical for the migration:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;The agent runs in a separate process.&lt;/strong&gt; Unlike ADK's &lt;code&gt;runner.Run()&lt;/code&gt;, which runs inside your program, with DSH you spawn a &lt;code&gt;dsh&lt;/code&gt; runtime subprocess and talk to it over &lt;strong&gt;stdio JSON-RPC&lt;/strong&gt;. The TypeScript client is &lt;code&gt;@deepseek-ai/dsh-sdk-client&lt;/code&gt;; a Python SDK is also available.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The model layer only speaks the Anthropic Messages protocol.&lt;/strong&gt; The official adapter, &lt;code&gt;llm-deepseek&lt;/code&gt;, targets &lt;code&gt;https://api.deepseek.com/anthropic&lt;/code&gt; by default. You can change &lt;code&gt;baseURL&lt;/code&gt;, but the other side must be a &lt;code&gt;/v1/messages&lt;/code&gt;-compatible endpoint. &lt;strong&gt;There is no Gemini adapter.&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Tools are registered by plugins.&lt;/strong&gt; You write a Cordis plugin and call &lt;code&gt;ctx.tools.register(defineTool({...}))&lt;/code&gt; inside &lt;code&gt;apply(ctx)&lt;/code&gt;. DSH validates arguments against the parameter schema; on failure, the error is returned to the model so it can correct itself.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;A session is an event stream.&lt;/strong&gt; Every &lt;code&gt;run()&lt;/code&gt; returns the full list of session events: &lt;code&gt;turn/start&lt;/code&gt;, &lt;code&gt;tool/call&lt;/code&gt;, &lt;code&gt;tool/result&lt;/code&gt;, &lt;code&gt;assistant/message&lt;/code&gt;, &lt;code&gt;turn/end&lt;/code&gt;, and so on. This is what you rely on later to extract structured results.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  What dsh-superagent builds on DSH
&lt;/h2&gt;

&lt;p&gt;dsh-superagent is a prototype of a "proactive coding agent" used internally by the DeepSeek team. Its README is explicit: &lt;strong&gt;it is a research prototype, not a production product&lt;/strong&gt;. Its domain model looks like this:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmermaid.ink%2Fimg%2Fpako%3AeNpdkE1LxDAQhv_KkKuWvcuyIFpdWL3YggfrYZpMm2CblOnED7b7302zKGiu75PnfZmj0sGQugLVDeFDW2SBh6fGQ3rVS6OqEFnTtuXN7t7JPrawgTtys42NeoWi2C01u74nXqBOeG2Z0KTobKgz0aJoS2aBMhHlOw5Zh2Z08-yChwsQdtjTv29VbGfNbpKV6dAXIcoCh7XF6TeSX7zMOGpNkyTZI3qDQgk9x4ccX6eu3o_kk-N53fFJOkrgvCV4gttqDzP9LDKOSaf4CyZikL-FZ-ONRe9pWKBqvLoENRKP6Ey65VGJpTFf1VCHcRB1On0DRol2Bg%3D%3D%3Ftype%3Dpng" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmermaid.ink%2Fimg%2Fpako%3AeNpdkE1LxDAQhv_KkKuWvcuyIFpdWL3YggfrYZpMm2CblOnED7b7302zKGiu75PnfZmj0sGQugLVDeFDW2SBh6fGQ3rVS6OqEFnTtuXN7t7JPrawgTtys42NeoWi2C01u74nXqBOeG2Z0KTobKgz0aJoS2aBMhHlOw5Zh2Z08-yChwsQdtjTv29VbGfNbpKV6dAXIcoCh7XF6TeSX7zMOGpNkyTZI3qDQgk9x4ccX6eu3o_kk-N53fFJOkrgvCV4gttqDzP9LDKOSaf4CyZikL-FZ-ONRe9pWKBqvLoENRKP6Ey65VGJpTFf1VCHcRB1On0DRol2Bg%3D%3D%3Ftype%3Dpng" alt="dsh-superagent domain model" width="1437" height="232"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A &lt;strong&gt;Source&lt;/strong&gt; converts GitHub notifications and Feishu messages into &lt;strong&gt;Triggers&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Eval&lt;/strong&gt; decides whether to accept a job based on &lt;strong&gt;Policy&lt;/strong&gt; (who can issue commands, where, and with what authority). Accepted work becomes a &lt;strong&gt;Ticket&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Each Ticket is handled by an &lt;strong&gt;Executor Session&lt;/strong&gt; working in its own directory. Results flow back to the original conversation through a &lt;strong&gt;Channel&lt;/strong&gt;, e.g. by opening a PR.&lt;/li&gt;
&lt;li&gt;A web dashboard shows which items need a human decision.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The design is very thorough, and it exposes a &lt;code&gt;SourceKind&lt;/code&gt; extension point (&lt;code&gt;docs/008-cookbook.md&lt;/code&gt;), so in theory you could add a LINE Source.&lt;/p&gt;




&lt;h1&gt;
  
  
  2. Feasibility: why I did not simply fork dsh-superagent
&lt;/h1&gt;

&lt;p&gt;My first instinct was to fork dsh-superagent, add a LINE Source, and deploy it to Cloud Run. After reading through the docs and code, though, it became clear that its assumptions are almost the exact opposite of Cloud Run's:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Aspect&lt;/th&gt;
&lt;th&gt;dsh-superagent&lt;/th&gt;
&lt;th&gt;Existing Cloud Run architecture&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Execution model&lt;/td&gt;
&lt;td&gt;
&lt;strong&gt;A single long-running process&lt;/strong&gt; (&lt;code&gt;scripts/dsh-superagent start&lt;/code&gt;, launched in tmux)&lt;/td&gt;
&lt;td&gt;Stateless, scales to zero&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;State&lt;/td&gt;
&lt;td&gt;
&lt;strong&gt;SQLite&lt;/strong&gt; + lock files under &lt;code&gt;stateDir&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;Firestore&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Event source&lt;/td&gt;
&lt;td&gt;
&lt;strong&gt;Actively polls&lt;/strong&gt; GitHub notifications; Feishu long-lived connection&lt;/td&gt;
&lt;td&gt;LINE &lt;strong&gt;pushes via webhook&lt;/strong&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;HTTP&lt;/td&gt;
&lt;td&gt;Management API &lt;strong&gt;listens only on 127.0.0.1&lt;/strong&gt;, with same-origin checks&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;/webhook&lt;/code&gt; must be publicly reachable&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Required config&lt;/td&gt;
&lt;td&gt;
&lt;strong&gt;A GitHub repo and an agent account are mandatory&lt;/strong&gt;; otherwise the runtime stays in "awaiting configuration"&lt;/td&gt;
&lt;td&gt;Only a LINE channel&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Agent permissions&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;danger-full-access&lt;/code&gt;, runs shell commands as the OS user&lt;/td&gt;
&lt;td&gt;Only needs web access for research&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Model&lt;/td&gt;
&lt;td&gt;Anthropic Messages (DeepSeek)&lt;/td&gt;
&lt;td&gt;Vertex AI Gemini&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Forcing a fork would mean removing the mandatory GitHub configuration, building a public, signature-verified webhook, pinning Cloud Run to &lt;code&gt;min = max = 1&lt;/code&gt; instances, and mounting Filestore for SQLite. &lt;strong&gt;In other words: giving up scale-to-zero and exposing an alpha-stage process capable of running arbitrary shell commands directly to the internet.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;So I weighed two options:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Option A: Fork dsh-superagent and add a LINE Source.&lt;/strong&gt; Keeps Eval / Ticket / dashboard, but is the most expensive and the most fragile.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Option B: Keep the Cloud Run architecture and replace only the agent layer with DSH.&lt;/strong&gt; ✅ Chosen. The LINE webhook, Cloud Tasks, Firestore, and GCS stay untouched; each of the three research stages runs its own DSH session.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;For the model, I chose to &lt;strong&gt;keep using Gemini on Vertex AI&lt;/strong&gt;, with LiteLLM in between as a protocol translator. The consequences of that decision are covered in Section 3.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;💡 &lt;strong&gt;Takeaway&lt;/strong&gt;: Before "replacing framework A with framework B", be clear about whether you are replacing the &lt;strong&gt;runtime (the harness)&lt;/strong&gt; or &lt;strong&gt;the application built on top of it (the superagent)&lt;/strong&gt;. What I actually needed here was the former.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h1&gt;
  
  
  3. Migrating from ADK to DSH: architecture and mapping
&lt;/h1&gt;

&lt;h2&gt;
  
  
  Post-migration architecture
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmermaid.ink%2Fimg%2Fpako%3AeNptkk1v2kAQhv_KaE9EqTFJe2ijKhJyyodimiimzSGu0GIPeMt6191dA1XIf-_sQqBV6oN9mXnm8TvzzApdIrsCtpB6U1TcOEgfcgX0pOOvX55y5j_Qb5qc_YAout7l7P4um0K8wXml9Qo6o0k_OcvZDh5HVG7RrNF0nf08N_G1UA6Vg0Jya8VCFNwJreAcpC5WBNwPehwFMKpfLba4g2T61MlZInVbwpTb1R5l0CI3RRX91HObs7NDczL9x8r5-ti0Knqth87d-OYgeEuCG21WQfA0__aAsIglxGD5Gn35IPMeA0Ekpw0GCykUzubazTzGNrzAv1xOoIZvFDRowDq-DLCbzKdT2gpIzol6j7PlKqqFEjWXlMqrcrfhjt6_a3l0pPYDu69cZXQjCojXF3GN1tIE60ekqV-XcJimE7CixIKbvbQuuKy0dVcfer3ekZmmHgnDCbV9R-NwC_1xaFiil4redz9GC1pd9R8NWv_sGLHTWnqDYUaoYWim3xlqvZQIWagJ3HP49pBCoukqtu5t_jWn1ZSQt5cXny5hNJ2kAZpkp3vIaBMh0TeZNy1l2xi9JCtL0wcStyEVut9csXfAajQ1FyVd-zNzFdbh7ktc8FY69vLyB5dc-ak%3D%3Ftype%3Dpng" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fmermaid.ink%2Fimg%2Fpako%3AeNptkk1v2kAQhv_KaE9EqTFJe2ijKhJyyodimiimzSGu0GIPeMt6191dA1XIf-_sQqBV6oN9mXnm8TvzzApdIrsCtpB6U1TcOEgfcgX0pOOvX55y5j_Qb5qc_YAout7l7P4um0K8wXml9Qo6o0k_OcvZDh5HVG7RrNF0nf08N_G1UA6Vg0Jya8VCFNwJreAcpC5WBNwPehwFMKpfLba4g2T61MlZInVbwpTb1R5l0CI3RRX91HObs7NDczL9x8r5-ti0Knqth87d-OYgeEuCG21WQfA0__aAsIglxGD5Gn35IPMeA0Ekpw0GCykUzubazTzGNrzAv1xOoIZvFDRowDq-DLCbzKdT2gpIzol6j7PlKqqFEjWXlMqrcrfhjt6_a3l0pPYDu69cZXQjCojXF3GN1tIE60ekqV-XcJimE7CixIKbvbQuuKy0dVcfer3ekZmmHgnDCbV9R-NwC_1xaFiil4redz9GC1pd9R8NWv_sGLHTWnqDYUaoYWim3xlqvZQIWagJ3HP49pBCoukqtu5t_jWn1ZSQt5cXny5hNJ2kAZpkp3vIaBMh0TeZNy1l2xi9JCtL0wcStyEVut9csXfAajQ1FyVd-zNzFdbh7ktc8FY69vLyB5dc-ak%3D%3Ftype%3Dpng" alt="Post-migration architecture on Cloud Run" width="1904" height="320"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;On Cloud Run this is &lt;strong&gt;one service with two containers&lt;/strong&gt;: &lt;code&gt;app&lt;/code&gt; (ingress) and a &lt;code&gt;litellm&lt;/code&gt; sidecar, communicating over localhost. The service still scales to zero.&lt;/p&gt;

&lt;h2&gt;
  
  
  ADK → DSH mapping
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Concept&lt;/th&gt;
&lt;th&gt;ADK for Go (previous post)&lt;/th&gt;
&lt;th&gt;DeepSeek Harness (this post)&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Where the agent runs&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;In-process, &lt;code&gt;runner.Run()&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;One &lt;code&gt;dsh&lt;/code&gt; runtime subprocess per stage, driven over stdio JSON-RPC&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Agent definition&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;llmagent.New(...)&lt;/code&gt; × 3&lt;/td&gt;
&lt;td&gt;One profile (&lt;code&gt;sdk-minimal&lt;/code&gt; + patch) + persona; stage instructions go in the user message&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Model&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;gemini.NewModel&lt;/code&gt;, direct to Vertex AI&lt;/td&gt;
&lt;td&gt;DSH Messages adapter → &lt;strong&gt;LiteLLM sidecar&lt;/strong&gt; → Vertex AI Gemini&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Google Search / URL Context&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;geminitool.GoogleSearch{}&lt;/code&gt; + &lt;code&gt;url_context&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;Custom plugin tool &lt;strong&gt;&lt;code&gt;web_research&lt;/code&gt;&lt;/strong&gt; (Gemini + googleSearch + urlContext)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Structured output&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;OutputSchema&lt;/code&gt; (auto-injects &lt;code&gt;set_model_response&lt;/code&gt;)&lt;/td&gt;
&lt;td&gt;Custom &lt;strong&gt;&lt;code&gt;submit_plan&lt;/code&gt; / &lt;code&gt;submit_sources&lt;/code&gt; / &lt;code&gt;submit_report&lt;/code&gt;&lt;/strong&gt; tools; arguments read back from session events&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Stage handoff&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Session State &lt;code&gt;{plan}&lt;/code&gt;, &lt;code&gt;{sources}&lt;/code&gt;, &lt;code&gt;{report_md?}&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;Firestore workspace, injected directly into the stage prompt&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Trace ID&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;ADK &lt;code&gt;InvocationID&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;DSH &lt;code&gt;sessionId&lt;/code&gt; (still stored in &lt;code&gt;last_interaction_id&lt;/code&gt;)&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Tool permissions&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Only the tools each agent needs&lt;/td&gt;
&lt;td&gt;Patch disables bash, editor, and working-directory; only research tools remain&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Language&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Go 1.27&lt;/td&gt;
&lt;td&gt;TypeScript (Node 24 runs &lt;code&gt;.ts&lt;/code&gt; directly, no build step)&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Everything on the LINE side — intent classification, Flex cards, Firestore document schema, GCS paths, the Cloud Tasks flow, deepen / retry — was &lt;strong&gt;ported 1:1&lt;/strong&gt; from Go, down to the exact message text. The real work in this migration comes down to four rewrites in the agent layer.&lt;/p&gt;

&lt;h2&gt;
  
  
  Rewrite 1: &lt;code&gt;runner.Run()&lt;/code&gt; → &lt;code&gt;DeepSeekHarness.run()&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;ADK runs the agent in-process; with DSH, each stage starts a runtime and shuts it down when done (&lt;a href="https://github.com/kkdai/line-research-bot-dsh/blob/main/src/research/agents.ts" rel="noopener noreferrer"&gt;&lt;code&gt;src/research/agents.ts&lt;/code&gt;&lt;/a&gt;):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;harness&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;DeepSeekHarness&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;profile&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;sdk-minimal&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;patches&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;patch&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="c1"&gt;// research.patch.yml, rendered at startup&lt;/span&gt;
  &lt;span class="na"&gt;dshHome&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;opts&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;dshHome&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="c1"&gt;// /tmp/dsh-home on Cloud Run&lt;/span&gt;
  &lt;span class="na"&gt;cwd&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;workdir&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="c1"&gt;// an empty temp directory per stage&lt;/span&gt;
  &lt;span class="na"&gt;provider&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;deepseek-official&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="c1"&gt;// routes through the llm-deepseek adapter&lt;/span&gt;
  &lt;span class="na"&gt;model&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;opts&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;model&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="c1"&gt;// gemini-3.8-flash, an alias LiteLLM recognizes&lt;/span&gt;
  &lt;span class="na"&gt;maxTokens&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;32&lt;/span&gt;&lt;span class="nx"&gt;_000&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;env&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="p"&gt;...&lt;/span&gt;&lt;span class="nf"&gt;runtimeEnv&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;process&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;env&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="c1"&gt;// strips LINE secrets&lt;/span&gt;
    &lt;span class="na"&gt;DEEPSEEK_BASE_URL&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;opts&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;llmBaseURL&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="c1"&gt;// http://127.0.0.1:4000&lt;/span&gt;
    &lt;span class="na"&gt;DEEPSEEK_API_KEY&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;opts&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;llmApiKey&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="c1"&gt;// LiteLLM master key&lt;/span&gt;
    &lt;span class="na"&gt;DSH_SYSTEM_PROMPT&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;PERSONA&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="p"&gt;},&lt;/span&gt;
&lt;span class="p"&gt;})&lt;/span&gt;
&lt;span class="k"&gt;try&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;harness&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;run&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;stagePrompt&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="nf"&gt;assertTurnCompleted&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;result&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;events&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nf"&gt;extractSubmission&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;result&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;events&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;submit_plan&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;finally&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;harness&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;close&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;provider: 'deepseek-official'&lt;/code&gt; looks odd — why say DeepSeek when the model is Gemini? It is simply &lt;strong&gt;the route name of the DSH adapter&lt;/strong&gt;, meaning "use the Messages protocol path". Where requests actually go is determined by &lt;code&gt;DEEPSEEK_BASE_URL&lt;/code&gt;, which points to LiteLLM.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;⚠️ &lt;strong&gt;The SDK has no mid-run cancellation.&lt;/strong&gt; The way to enforce a timeout is to &lt;code&gt;close()&lt;/code&gt; the runtime. I wired this up with an &lt;code&gt;AbortSignal&lt;/code&gt;; each stage still has a 3 / 10 / 8-minute limit.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Rewrite 2: &lt;code&gt;OutputSchema&lt;/code&gt; → &lt;code&gt;submit_*&lt;/code&gt; tools
&lt;/h2&gt;

&lt;p&gt;ADK's &lt;code&gt;OutputSchema&lt;/code&gt; is convenient, and DSH has no equivalent. But under the hood, ADK simply &lt;strong&gt;auto-injects a &lt;code&gt;set_model_response&lt;/code&gt; tool&lt;/strong&gt;, so &lt;strong&gt;I did the same thing myself&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// dsh/plugin/index.js: a Cordis plugin&lt;/span&gt;
&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;line-research-tools&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;inject&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;tools&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;apply&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;ctx&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;ctx&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;tools&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;register&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;defineTool&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
    &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;submit_plan&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;description&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Submit the research plan. Call exactly once when the plan is final.&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;parameters&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="na"&gt;topic&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;string&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;required&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt;
      &lt;span class="na"&gt;queries&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;array&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;required&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;items&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;object&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;additionalProperties&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="na"&gt;properties&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;q&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;string&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;required&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt; &lt;span class="na"&gt;source_category&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;string&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;required&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt;
                      &lt;span class="na"&gt;lang&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;string&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;required&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt;
      &lt;span class="na"&gt;source_count&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;integer&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;required&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt;
    &lt;span class="p"&gt;},&lt;/span&gt;
    &lt;span class="na"&gt;output&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;ack&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="nf"&gt;execute&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;received&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt;
  &lt;span class="p"&gt;}))&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;DSH &lt;strong&gt;validates the arguments against the schema&lt;/strong&gt; first; if validation fails, the error goes back to the model so it can fix the call and retry. On the host side, all you need is to find "the last &lt;code&gt;submit_plan&lt;/code&gt; call that was not rejected" in the session events (&lt;a href="https://github.com/kkdai/line-research-bot-dsh/blob/main/src/research/submission.ts" rel="noopener noreferrer"&gt;&lt;code&gt;src/research/submission.ts&lt;/code&gt;&lt;/a&gt;):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;for &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;e&lt;/span&gt; &lt;span class="k"&gt;of&lt;/span&gt; &lt;span class="nx"&gt;events&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;type&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;tool/call&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nx"&gt;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="nx"&gt;tool&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="nx"&gt;calls&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;set&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;callId&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;arguments&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;type&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;tool/result&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nx"&gt;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;message&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;isError&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="nx"&gt;failed&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;set&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;message&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;toolCallId&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;text&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;accepted&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[...&lt;/span&gt;&lt;span class="nx"&gt;calls&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="nf"&gt;filter&lt;/span&gt;&lt;span class="p"&gt;(([&lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="nx"&gt;failed&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;has&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;There is a nice side benefit: the issue from the previous post where the model returned malformed enum values like &lt;code&gt;chapter_not_found_chapter_not_found&lt;/code&gt; is now &lt;strong&gt;caught by DSH at the tool layer via &lt;code&gt;enum&lt;/code&gt; validation&lt;/strong&gt;, and the model is asked to resubmit.&lt;/p&gt;

&lt;h2&gt;
  
  
  Rewrite 3: a LiteLLM sidecar to connect DSH to Gemini
&lt;/h2&gt;

&lt;p&gt;DSH only speaks Anthropic Messages; Gemini on Vertex AI does not. &lt;strong&gt;&lt;a href="https://github.com/BerriAI/litellm" rel="noopener noreferrer"&gt;LiteLLM&lt;/a&gt;&lt;/strong&gt; fits neatly in between: it exposes &lt;code&gt;/v1/messages&lt;/code&gt; externally, calls &lt;code&gt;vertex_ai/gemini-3.8-flash&lt;/code&gt; internally, and authenticates with the Cloud Run service account (ADC).&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;model_list&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;model_name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;gemini-3.8-flash&lt;/span&gt;
    &lt;span class="na"&gt;litellm_params&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;model&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;vertex_ai/gemini-3.8-flash&lt;/span&gt;
      &lt;span class="na"&gt;vertex_project&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;&amp;lt;your-project&amp;gt;&lt;/span&gt;
      &lt;span class="na"&gt;vertex_location&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;global&lt;/span&gt;
&lt;span class="na"&gt;litellm_settings&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;drop_params&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;
&lt;span class="na"&gt;general_settings&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;master_key&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;os.environ/LITELLM_MASTER_KEY&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The multi-container Cloud Run service is declared in &lt;code&gt;service.yaml&lt;/code&gt;, with &lt;code&gt;container-dependencies&lt;/code&gt; so the app waits for LiteLLM to come up first:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;annotations&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;run.googleapis.com/container-dependencies&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;'&lt;/span&gt;&lt;span class="s"&gt;{"app":["litellm"]}'&lt;/span&gt;
&lt;span class="na"&gt;containers&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;app&lt;/span&gt; &lt;span class="c1"&gt;# ingress, port 8080&lt;/span&gt;
  &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;litellm&lt;/span&gt; &lt;span class="c1"&gt;# sidecar, port 4000, startupProbe: /health/liveliness&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Rewrite 4: a &lt;code&gt;web_research&lt;/code&gt; tool to preserve Google Search grounding
&lt;/h2&gt;

&lt;p&gt;This was the part I cared about most. Much of the ADK version's quality came from &lt;strong&gt;Google Search + URL Context grounding&lt;/strong&gt;. Once requests are translated to the Messages protocol by LiteLLM, these Gemini-specific tools are effectively lost.&lt;/p&gt;

&lt;p&gt;The fix is to &lt;strong&gt;keep grounding out of the translation layer&lt;/strong&gt;: a &lt;code&gt;web_research&lt;/code&gt; tool calls Vertex AI directly via &lt;code&gt;@google/genai&lt;/code&gt;, with &lt;code&gt;googleSearch&lt;/code&gt; and &lt;code&gt;urlContext&lt;/code&gt; enabled:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;res&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;ai&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;models&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;generateContent&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;model&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;researchModel&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;contents&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;prompt&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;config&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;tools&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[{&lt;/span&gt; &lt;span class="na"&gt;googleSearch&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{}&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;urlContext&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{}&lt;/span&gt; &lt;span class="p"&gt;}],&lt;/span&gt; &lt;span class="na"&gt;abortSignal&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;exec&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;signal&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt;
&lt;span class="p"&gt;})&lt;/span&gt;
&lt;span class="c1"&gt;// groundingChunks URLs are vertexaisearch redirects; one HEAD request resolves the real URL&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The result: &lt;strong&gt;Gemini (via DSH) handles reasoning and planning, while Gemini (via the tool) handles web research.&lt;/strong&gt; DSH lets the model call &lt;code&gt;web_research&lt;/code&gt; in parallel (the tool is marked &lt;code&gt;isConcurrencySafe&lt;/code&gt;), so the search stage turned out faster than I expected.&lt;/p&gt;




&lt;h1&gt;
  
  
  4. Pitfalls: what actually went wrong
&lt;/h1&gt;

&lt;p&gt;Everything below is something I &lt;strong&gt;actually ran into&lt;/strong&gt; during this migration. DSH is currently at &lt;code&gt;0.2.1-rc.5&lt;/code&gt;, and a lot of behavior is either undocumented or documented for an older version.&lt;/p&gt;

&lt;h2&gt;
  
  
  Pitfall 1: SDK options were renamed, and the old ones are silently ignored
&lt;/h2&gt;

&lt;p&gt;The README for &lt;code&gt;@deepseek-ai/dsh-sdk-client&lt;/code&gt; shows this example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;DeepSeekHarness&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="na"&gt;launch&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;command&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;node&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;args&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;lib/bin.js&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;cordis.yml&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt; &lt;span class="p"&gt;...&lt;/span&gt; &lt;span class="p"&gt;})&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Copying it, everything appeared to work and the model responded. But when I asked it to list its tools, out came &lt;code&gt;bash&lt;/code&gt;, &lt;code&gt;subagent&lt;/code&gt;, &lt;code&gt;create_goal&lt;/code&gt;, &lt;code&gt;web_search&lt;/code&gt;… &lt;strong&gt;my patch had no effect at all.&lt;/strong&gt; Digging into the SDK source revealed that rc.5 had already switched to &lt;code&gt;profile&lt;/code&gt; / &lt;code&gt;patches&lt;/code&gt; / &lt;code&gt;dshHome&lt;/code&gt; / &lt;code&gt;env&lt;/code&gt;: &lt;strong&gt;&lt;code&gt;launch&lt;/code&gt; does not raise an error — it is simply ignored, and the SDK quietly falls back to the fully loaded &lt;code&gt;sdk&lt;/code&gt; profile.&lt;/strong&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;✅ &lt;strong&gt;How to verify&lt;/strong&gt;: print &lt;code&gt;tools[].name&lt;/code&gt; from the &lt;code&gt;request/header&lt;/code&gt; event to see the exact tool list the model receives. After the fix, only &lt;code&gt;read_image, web_research, submit_*&lt;/code&gt; remained.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Pitfall 2: plugin names are resolved relative to &lt;code&gt;$DSH_HOME/profiles/&amp;lt;profile&amp;gt;/&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;The PoC worked fine, but the real integration test failed:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;AgentError: every submit_plan call was rejected: Error: unknown tool "submit_plan"

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Launching the runtime directly and reading stderr revealed the cause:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;line-research-tools: failed to import: Cannot find package 'line-research-tools'
imported from /tmp/.../profiles/sdk-minimal/

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;DSH resolves plugins by walking up from the profile directory looking for &lt;code&gt;node_modules&lt;/code&gt;.&lt;/strong&gt; In the PoC, &lt;code&gt;DSH_HOME&lt;/code&gt; happened to live inside the project directory, so resolution worked by coincidence. On Cloud Run, &lt;code&gt;DSH_HOME=/tmp/dsh-home&lt;/code&gt;, so it is guaranteed to fail.&lt;/p&gt;

&lt;p&gt;Next I tried supplying the path dynamically with &lt;code&gt;name: !!js process.env.XXX&lt;/code&gt;, which was also rejected:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;disabling profile plugin row "line-research-tools": its declared dsh requirements cannot be validated: name.startsWith is not a function

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;&lt;code&gt;name&lt;/code&gt; is checked before &lt;code&gt;!!js&lt;/code&gt; is evaluated, so it must be a literal string.&lt;/strong&gt; The final solution: at startup, render the patch template into &lt;code&gt;DSH_HOME&lt;/code&gt; with the plugin's &lt;strong&gt;absolute &lt;code&gt;file://&lt;/code&gt; URL&lt;/strong&gt; hard-coded.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;💡 This is the most important lesson of the whole migration: &lt;strong&gt;a single directory difference between PoC and production completely changed the outcome.&lt;/strong&gt; Integration tests must use the same &lt;code&gt;DSH_HOME&lt;/code&gt; location as production.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Pitfall 3: changing &lt;code&gt;apiKeyEnv&lt;/code&gt; in a patch has no effect
&lt;/h2&gt;

&lt;p&gt;I changed &lt;code&gt;apiKeyEnv&lt;/code&gt; for &lt;code&gt;llm-deepseek&lt;/code&gt; to &lt;code&gt;LITELLM_API_KEY&lt;/code&gt; in a patch, and &lt;code&gt;--dump-config&lt;/code&gt; confirmed the change, yet at runtime I still got:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;MISSING_CREDENTIAL: no API key for provider route "deepseek-official"; ... export DEEPSEEK_API_KEY

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In the end, simply passing LiteLLM's key and URL through the &lt;strong&gt;&lt;code&gt;DEEPSEEK_API_KEY&lt;/code&gt; / &lt;code&gt;DEEPSEEK_BASE_URL&lt;/code&gt; environment variables&lt;/strong&gt; worked. Also note that a patch's &lt;code&gt;config&lt;/code&gt; &lt;strong&gt;replaces the block entirely&lt;/strong&gt; rather than merging, so you need to restore defaults such as &lt;code&gt;defaultContextWindow&lt;/code&gt; and &lt;code&gt;streamIdleTimeoutMs&lt;/code&gt; yourself.&lt;/p&gt;

&lt;h2&gt;
  
  
  Pitfall 4: different profiles cannot share the same sessions directory
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;session artifact ".../session.v4.jsonl.zstd" uses .jsonl.zstd, but this backend is configured for compression "none"

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;sdk&lt;/code&gt; profile compresses sessions (zstd); &lt;code&gt;sdk-minimal&lt;/code&gt; does not. &lt;strong&gt;If two different profiles run against the same &lt;code&gt;DSH_HOME&lt;/code&gt;, they end up reading each other's files.&lt;/strong&gt; Production only uses one profile, so this is not an issue there, but remember to clear &lt;code&gt;$DSH_HOME/sessions&lt;/code&gt; when experimenting locally.&lt;/p&gt;

&lt;h2&gt;
  
  
  Pitfall 5: Node's type stripping does not support constructor parameter properties
&lt;/h2&gt;

&lt;p&gt;Node 24 can run &lt;code&gt;node src/main.ts&lt;/code&gt; directly with no build step, which is great. But it only strips &lt;strong&gt;erasable syntax&lt;/strong&gt;, so code like this fails outright:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="nf"&gt;constructor&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;private&lt;/span&gt; &lt;span class="k"&gt;readonly&lt;/span&gt; &lt;span class="nx"&gt;store&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;Store&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{}&lt;/span&gt; &lt;span class="c1"&gt;// ❌ TS1294&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Enable &lt;code&gt;erasableSyntaxOnly: true&lt;/code&gt; in &lt;code&gt;tsconfig.json&lt;/code&gt; so &lt;code&gt;tsc&lt;/code&gt; catches this early. Also, &lt;strong&gt;&lt;code&gt;.ts&lt;/code&gt; files under &lt;code&gt;node_modules&lt;/code&gt; are not type-stripped&lt;/strong&gt;, so DSH plugins must be written in plain JavaScript.&lt;/p&gt;

&lt;h2&gt;
  
  
  Pitfall 6: &lt;code&gt;npx node@24&lt;/code&gt; does not actually run Node 24
&lt;/h2&gt;

&lt;p&gt;I wanted to confirm the container's Node 24 could run everything, but &lt;code&gt;npx node@24 --version&lt;/code&gt; printed &lt;code&gt;v26.0.0&lt;/code&gt;: npx still used the &lt;code&gt;node&lt;/code&gt; on &lt;code&gt;PATH&lt;/code&gt;. I ended up downloading the Node 24 tarball directly from nodejs.org (verify it against SHASUMS256) to run the tests, which also confirmed the DSH runtime starts cleanly on Node 24.&lt;/p&gt;

&lt;h2&gt;
  
  
  Pitfall 7: LiteLLM needs extra Vertex AI dependencies
&lt;/h2&gt;

&lt;p&gt;After &lt;code&gt;pip install 'litellm[proxy]'&lt;/code&gt;, the very first request failed with:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;litellm.APIConnectionError: No module named 'google'

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The Vertex AI path requires &lt;strong&gt;&lt;code&gt;google-auth&lt;/code&gt; + &lt;code&gt;google-cloud-aiplatform&lt;/code&gt;&lt;/strong&gt;, which you must add to the image yourself and pin (I use &lt;code&gt;litellm 1.106.6&lt;/code&gt;, &lt;code&gt;google-auth 2.62.1&lt;/code&gt;, &lt;code&gt;google-cloud-aiplatform 2.7.0&lt;/code&gt;). In addition, recent LiteLLM versions &lt;strong&gt;refuse to start without a master key&lt;/strong&gt;, and requests without a key return &lt;strong&gt;500 rather than 401&lt;/strong&gt; (due to missing &lt;code&gt;prisma&lt;/code&gt;), although they are still rejected. Fortunately the sidecar only listens on localhost inside the instance and is not reachable externally.&lt;/p&gt;

&lt;h2&gt;
  
  
  Pitfall 8: the agent subprocess does not need your secrets
&lt;/h2&gt;

&lt;p&gt;By default the DSH runtime inherits the entire &lt;code&gt;process.env&lt;/code&gt;, which means &lt;strong&gt;the LINE Channel Secret and Access Token end up inside the agent's process&lt;/strong&gt;. Even though the shell tools are disabled, I wrote a &lt;code&gt;runtimeEnv()&lt;/code&gt; helper to strip them out, with unit tests. This matches what the dsh-superagent docs say: &lt;strong&gt;wrappers and directories are defaults, not security boundaries&lt;/strong&gt; — don't hand over anything you don't have to.&lt;/p&gt;

&lt;h2&gt;
  
  
  Pitfall 9: it is slower than the ADK version
&lt;/h2&gt;

&lt;p&gt;The integration test (plan → search → write → deepen with a missing chapter) took &lt;strong&gt;about 7.5 minutes&lt;/strong&gt;, versus roughly 150–190 seconds for the ADK version. Contributing factors: an extra runtime startup per stage (about 1–2 seconds), the additional LiteLLM hop, and many &lt;code&gt;web_research&lt;/code&gt; calls. Everything still fits within Cloud Tasks' 30-minute dispatch deadline, but I relaxed the stage timeouts from ADK's 3 / 8 / 6 minutes to 3 / 10 / 8 minutes.&lt;/p&gt;

&lt;h2&gt;
  
  
  Pitfall 10: pin pre-release dependencies
&lt;/h2&gt;

&lt;p&gt;DSH publishes three release lines on npm simultaneously: &lt;code&gt;latest&lt;/code&gt; (0.0.1-rc.1 or 0.1.x), &lt;code&gt;next&lt;/code&gt; (0.2.1-rc.5), and &lt;code&gt;alpha&lt;/code&gt; (0.2.2-alpha.3), and &lt;strong&gt;&lt;code&gt;latest&lt;/code&gt; points to different versions for different packages&lt;/strong&gt;. That is exactly how the SDK option rename in Pitfall 1 bit me. I pinned everything to the &lt;code&gt;next&lt;/code&gt; line: &lt;code&gt;@deepseek-ai/dsh&lt;/code&gt;, &lt;code&gt;dsh-sdk-client&lt;/code&gt;, and &lt;code&gt;dsh-tools&lt;/code&gt; are all at &lt;code&gt;0.2.1-rc.5&lt;/code&gt;.&lt;/p&gt;




&lt;h1&gt;
  
  
  5. Deployment and cutover: reusing the existing service's configuration
&lt;/h1&gt;

&lt;p&gt;Deployment differs from the previous post: this time I &lt;strong&gt;created a new Cloud Run service&lt;/strong&gt;, since the sidecar changes the container layout. All configuration, however, was carried over from the original service:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;describe&lt;/code&gt; the original service first&lt;/strong&gt; to get the service account, bucket, queue, and Secret Manager bindings for the LINE secrets.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Reuse everything in the new service&lt;/strong&gt;: same SA, same bucket, same queue, same LINE secrets, and &lt;strong&gt;the same Firestore collections&lt;/strong&gt;. That way, after the cutover, users can keep "deepening" their existing reports. The only new secret is &lt;code&gt;LITELLM_MASTER_KEY&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Build two images with Cloud Build&lt;/strong&gt; (my laptop still has no Docker) and deploy with &lt;code&gt;gcloud run services replace service.yaml&lt;/code&gt;. &lt;code&gt;CLOUD_RUN_SERVICE_URL&lt;/code&gt; is precomputed using Cloud Run's deterministic &lt;code&gt;https://&amp;lt;service&amp;gt;-&amp;lt;project-number&amp;gt;.&amp;lt;region&amp;gt;.run.app&lt;/code&gt; format, so there is no need to deploy twice.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Smoke tests&lt;/strong&gt;: &lt;code&gt;/readyz&lt;/code&gt; returns 200, an invalid signature returns 401, a missing OIDC token returns 401, a request signed with the real Channel Secret returns 200, and both containers pass their startup probes.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Switch the webhook via the LINE API&lt;/strong&gt; — again, no console required:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;TOKEN&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="si"&gt;$(&lt;/span&gt;gcloud secrets versions access latest &lt;span class="nt"&gt;--secret&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;LINE_CHANNEL_ACCESS_TOKEN&lt;span class="si"&gt;)&lt;/span&gt;
curl &lt;span class="nt"&gt;-s&lt;/span&gt; &lt;span class="nt"&gt;-X&lt;/span&gt; PUT &lt;span class="nt"&gt;-H&lt;/span&gt; &lt;span class="s2"&gt;"Authorization: Bearer &lt;/span&gt;&lt;span class="nv"&gt;$TOKEN&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; &lt;span class="nt"&gt;-H&lt;/span&gt; &lt;span class="s1"&gt;'Content-Type: application/json'&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  &lt;span class="nt"&gt;-d&lt;/span&gt; &lt;span class="s1"&gt;'{"endpoint":"&amp;lt;NEW_SERVICE_URL&amp;gt;/webhook"}'&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  https://api.line.me/v2/bot/channel/webhook/endpoint
curl &lt;span class="nt"&gt;-s&lt;/span&gt; &lt;span class="nt"&gt;-X&lt;/span&gt; POST &lt;span class="nt"&gt;-H&lt;/span&gt; &lt;span class="s2"&gt;"Authorization: Bearer &lt;/span&gt;&lt;span class="nv"&gt;$TOKEN&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; &lt;span class="nt"&gt;-H&lt;/span&gt; &lt;span class="s1"&gt;'Content-Type: application/json'&lt;/span&gt; &lt;span class="nt"&gt;-d&lt;/span&gt; &lt;span class="s1"&gt;'{}'&lt;/span&gt; &lt;span class="se"&gt;\&lt;/span&gt;
  https://api.line.me/v2/bot/channel/webhook/test

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Confirm traffic in the logs&lt;/strong&gt;: after the switch, the new service received &lt;code&gt;LineBotWebhook/2.0&lt;/code&gt; requests and the old service dropped to zero. The first real user's research job then ran on the new service from &lt;code&gt;job start&lt;/code&gt; to &lt;code&gt;job done&lt;/code&gt; in &lt;strong&gt;about 6 minutes 43 seconds&lt;/strong&gt; with no errors. All Gemini calls through the LiteLLM sidecar returned 200, and a ~29 KB &lt;code&gt;index.html&lt;/code&gt; report appeared in GCS.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Rolling back is just a matter of pointing the webhook back at the original service. &lt;strong&gt;Because both services share Firestore, switching back and forth loses no data.&lt;/strong&gt;&lt;/p&gt;




&lt;h1&gt;
  
  
  6. ADK → DSH migration checklist
&lt;/h1&gt;

&lt;ul&gt;
&lt;li&gt; &lt;strong&gt;1. Decide whether you are replacing the harness or the app on top of it&lt;/strong&gt;: dsh-superagent is a GitHub coding agent; a chat bot on Cloud Run needs DSH itself.&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;2. Build a PoC first, using the production directory layout&lt;/strong&gt;: keep &lt;code&gt;DSH_HOME&lt;/code&gt; outside the project (e.g. &lt;code&gt;/tmp&lt;/code&gt;) so plugin resolution issues surface early.&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;3. Print the tool list the model actually receives&lt;/strong&gt; (&lt;code&gt;request/header&lt;/code&gt; event) to confirm the patch is applied and dangerous tools are really disabled.&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;4. Follow the type definitions for SDK options, not the README&lt;/strong&gt;: options get renamed between RCs, and old ones fail silently.&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;5. Use a literal absolute &lt;code&gt;file://&lt;/code&gt; URL for the plugin &lt;code&gt;name&lt;/code&gt;&lt;/strong&gt;; &lt;code&gt;!!js&lt;/code&gt; does not work here.&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;6. &lt;code&gt;OutputSchema&lt;/code&gt; → &lt;code&gt;submit_*&lt;/code&gt; tools&lt;/strong&gt;: let DSH validate the schema, and have the host pick the last accepted call from &lt;code&gt;tool/call&lt;/code&gt; / &lt;code&gt;tool/result&lt;/code&gt; events.&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;7. Use a Messages-compatible gateway (LiteLLM) for non-DeepSeek models&lt;/strong&gt;, pass credentials via &lt;code&gt;DEEPSEEK_API_KEY&lt;/code&gt; / &lt;code&gt;DEEPSEEK_BASE_URL&lt;/code&gt;, and remember that patch configs replace rather than merge.&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;8. Put vendor-specific capabilities (Google Search grounding) inside tools&lt;/strong&gt;; don't expect the translation layer to preserve them.&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;9. Filter environment variables for the agent subprocess&lt;/strong&gt;; never hand it your Channel Secret.&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;10. Pin all pre-release packages to the same dist-tag line&lt;/strong&gt;, and actually run the container's Node version at least once.&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;11. Reuse the old service's SA / bucket / queue / secrets / Firestore in the new service&lt;/strong&gt;, switch the webhook via the LINE API, verify traffic in the logs, and roll back by reverting the webhook.&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;12. Never expose real &lt;code&gt;.run.app&lt;/code&gt; URLs in public repos, issues, or posts.&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;




&lt;h1&gt;
  
  
  Summary and open-source links
&lt;/h1&gt;

&lt;p&gt;In this migration I replaced the agent layer of &lt;strong&gt;&lt;a href="https://github.com/kkdai/line-research-bot-go" rel="noopener noreferrer"&gt;&lt;code&gt;kkdai/line-research-bot-go&lt;/code&gt;&lt;/a&gt;&lt;/strong&gt; — ADK for Go — with DeepSeek Harness, producing &lt;strong&gt;&lt;a href="https://github.com/kkdai/line-research-bot-dsh" rel="noopener noreferrer"&gt;&lt;code&gt;kkdai/line-research-bot-dsh&lt;/code&gt;&lt;/a&gt;&lt;/strong&gt;. The key takeaways:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;DSH is a composable agent runtime.&lt;/strong&gt; The Cordis plugin + profile layering design is very clean: disabling, swapping, or inserting any component takes just a few lines of YAML. The trade-off is that the agent runs in a separate process and must be driven over JSON-RPC.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;dsh-superagent is an excellent reference design for proactive agents&lt;/strong&gt; (Source / Eval / Ticket / Mandate), but its execution model — a long-running process plus SQLite — is a poor fit for Cloud Run. Borrow its harness; don't force-port its app.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Most of what ADK offers can be rebuilt on DSH as tools&lt;/strong&gt;: &lt;code&gt;OutputSchema&lt;/code&gt; becomes &lt;code&gt;submit_*&lt;/code&gt;, and Google Search grounding becomes &lt;code&gt;web_research&lt;/code&gt;. Schema validation at the tool layer is arguably more reliable than prompt-level constraints.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The biggest risk with pre-release frameworks is not missing features but silent failures&lt;/strong&gt;: ignored options, and plugin load failures that surface as "unknown tool". Every layer needs a way to be observed and verified directly.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The full source code is at &lt;strong&gt;&lt;a href="https://github.com/kkdai/line-research-bot-dsh" rel="noopener noreferrer"&gt;&lt;code&gt;kkdai/line-research-bot-dsh&lt;/code&gt;&lt;/a&gt;&lt;/strong&gt;, and the design trade-offs are documented in the repo's &lt;a href="https://github.com/kkdai/line-research-bot-dsh/blob/main/docs/design.md" rel="noopener noreferrer"&gt;&lt;code&gt;docs/design.md&lt;/code&gt;&lt;/a&gt;. Feedback and discussion are welcome!&lt;/p&gt;

&lt;h2&gt;
  
  
  Further reading
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://dev.to/gde/ai-in-practice-rewriting-a-line-research-bot-from-python-managed-agents-to-go-adk-v190-from-4c50"&gt;Previous post: Rewriting a LINE Research Bot from Python Managed Agents to Go ADK&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/kkdai/line-research-bot-dsh" rel="noopener noreferrer"&gt;&lt;code&gt;kkdai/line-research-bot-dsh&lt;/code&gt;: full source code for this post&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/deepseek-ai/dsh-superagent-prototype" rel="noopener noreferrer"&gt;&lt;code&gt;deepseek-ai/dsh-superagent-prototype&lt;/code&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.deepseek.com/en/harness/" rel="noopener noreferrer"&gt;DeepSeek Harness&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.litellm.ai/" rel="noopener noreferrer"&gt;LiteLLM: Anthropic &lt;code&gt;/v1/messages&lt;/code&gt;-compatible endpoint&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://cloud.google.com/run/docs/deploying#sidecars" rel="noopener noreferrer"&gt;Cloud Run: multi-container (sidecar) deployments&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>ai</category>
      <category>architecture</category>
      <category>backend</category>
      <category>go</category>
    </item>
    <item>
      <title>[Agent Platform in Action (7)] When ADK Go Graph Workflow Meets Google Research Harness (Part 1): Two-Layer Recursive Agent Fram</title>
      <dc:creator>Evan Lin</dc:creator>
      <pubDate>Sun, 01 Nov 2026 14:37:47 +0000</pubDate>
      <link>https://dev.to/gde/agent-platform-in-action-7-when-adk-go-graph-workflow-meets-google-research-harness-part-1-28c1</link>
      <guid>https://dev.to/gde/agent-platform-in-action-7-when-adk-go-graph-workflow-meets-google-research-harness-part-1-28c1</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Ftgngihh3qblqv1ey9xpn.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Ftgngihh3qblqv1ey9xpn.png" alt="Harness² Part 1 Architecture: Current Architecture vs c1..c8 Editable Harness Tree" width="800" height="447"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Foreword: After the AI Agent Goes Online, What is the Next Bottleneck?
&lt;/h1&gt;

&lt;p&gt;Welcome back to the &lt;strong&gt;"Agent Platform in Action"&lt;/strong&gt; series! In the previous six articles, we took the &lt;strong&gt;&lt;a href="https://github.com/kkdai/line-card-assistant" rel="noopener noreferrer"&gt;LINE AI Card Assistant (&lt;code&gt;kkdai/line-card-assistant&lt;/code&gt;)&lt;/a&gt;&lt;/strong&gt; through the complete five stages from a standalone prototype to production-grade cloud deployment:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;&lt;a href="https://dev.to/2026/10/16/adk-graph-workflow-go/"&gt;[Agent Platform in Action (1)] Building LINE AI Card Assistant with Go and Google ADK 2.0 Graph Workflow&lt;/a&gt;&lt;/strong&gt;: Using &lt;code&gt;google.golang.org/adk/v2/workflow&lt;/code&gt; to build a 13-node directed graph featuring Vision OCR, &lt;code&gt;AddFanOut&lt;/code&gt; / &lt;code&gt;AddFanIn&lt;/code&gt; parallel background investigation, and &lt;code&gt;NewRequestInputEvent&lt;/code&gt; HITL interaction loops.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;a href="https://dev.to/2026/10/17/adk-graph-workflow-go-2/"&gt;[Agent Platform in Action (2)] From Monolithic Cloud Run to Google Cloud Agent Runtime&lt;/a&gt;&lt;/strong&gt;: Completed &lt;strong&gt;Phase 1 (&lt;a href="https://github.com/kkdai/line-card-assistant/pull/10" rel="noopener noreferrer"&gt;PR #10&lt;/a&gt;)&lt;/strong&gt;, standardizing the project into an &lt;code&gt;agents-cli&lt;/code&gt; (&lt;code&gt;adk_go&lt;/code&gt;) dual-channel architecture.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;a href="https://dev.to/2026/10/20/adk-graph-workflow-go-3/"&gt;[Agent Platform in Action (3)] Implementing Cross-Instance Business Card Recognition and Pause/Resume with ADK 2.0 GCS Artifact Service and Agent Platform Sessions&lt;/a&gt;&lt;/strong&gt;: Completed the &lt;strong&gt;first half of Phase 2 (&lt;a href="https://github.com/kkdai/line-card-assistant/pull/11" rel="noopener noreferrer"&gt;PR #11&lt;/a&gt;)&lt;/strong&gt;, solving the HITL "amnesia" of stateless containers and the issue of binary image data explosion.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;a href="https://dev.to/2026/10/21/adk-graph-workflow-go-4/"&gt;[Agent Platform in Action (4)] Completing the Architecture Puzzle with Cloud Run LINE Webhook Gateway, Agent Runtime, and Cloud SQL PostgreSQL&lt;/a&gt;&lt;/strong&gt;: Completed the &lt;strong&gt;second half of Phase 2 &amp;amp; Phase 3 (&lt;a href="https://github.com/kkdai/line-card-assistant/pull/12" rel="noopener noreferrer"&gt;PR #12&lt;/a&gt;)&lt;/strong&gt;, upgrading the business card database to Cloud SQL PostgreSQL and achieving two-layer stateless decoupling.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;a href="https://dev.to/2026/10/22/adk-graph-workflow-go-5/"&gt;[Agent Platform in Action (5)] Establishing Automated Evaluation Benchmarks with agents-cli eval and ADK 2.0 Go&lt;/a&gt;&lt;/strong&gt;: Completed &lt;strong&gt;Phase 4 (&lt;a href="https://github.com/kkdai/line-card-assistant/pull/13" rel="noopener noreferrer"&gt;PR #13&lt;/a&gt;)&lt;/strong&gt;, establishing a golden test set and a quality flywheel.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;a href="https://dev.to/2026/10/24/adk-graph-workflow-go-6/"&gt;[Agent Platform in Action (6)] Building a Full-Stack Observable LINE AI Card Assistant with agents-cli deploy, Terraform IaC, GitHub Actions CI/CD, and Cloud Trace&lt;/a&gt;&lt;/strong&gt;: Completed &lt;strong&gt;Phase 5 (&lt;a href="https://github.com/kkdai/line-card-assistant/pull/14" rel="noopener noreferrer"&gt;PR #14&lt;/a&gt;)&lt;/strong&gt;, adding OpenTelemetry Spans (&lt;code&gt;workflow.node.*&lt;/code&gt;) to all 13 Graph Nodes and deploying to the cloud via Terraform and GitHub Actions.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Additionally, we have planned advanced Graph Workflow primitives for future ADK v2.6+ (such as &lt;code&gt;Parallel&lt;/code&gt; dynamic dispatch, &lt;code&gt;MultiRoute&lt;/code&gt; multi-way fan-out, reflection-repair loops, and strongly typed nodes) into the &lt;strong&gt;&lt;a href="https://github.com/kkdai/line-card-assistant/issues/15" rel="noopener noreferrer"&gt;Future Roadmap Issue #15&lt;/a&gt;&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;However, now that our Agent possesses &lt;strong&gt;Phase 4 Automated Evaluation&lt;/strong&gt; and &lt;strong&gt;Phase 5 Full-Node Tracing (OpenTelemetry Spans)&lt;/strong&gt;, a deeper question emerges:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;When evaluations find that the Agent performs poorly in certain real-world cases (e.g., Japanese-English bilingual cards, searching for colloquial nicknames in the Taiwan tech industry, multi-clause colloquial HITL modifications, or financial compliance icebreaker letters), must engineers manually check logs, manually modify Prompt strings in the Go source code, and then recompile and redeploy every single time?&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Can we let a &lt;strong&gt;Meta-Agent (Engineer Agent)&lt;/strong&gt; automatically read our evaluation results and OpenTelemetry execution trajectories, diagnose the reasons for lost points, write new Skills and Long-Term Memory itself, and complete a closed-loop self-evolution?&lt;/p&gt;

&lt;p&gt;This is precisely the core proposition addressed by Google Research's recently published and open-sourced &lt;strong&gt;&lt;a href="https://github.com/google-research/harness2" rel="noopener noreferrer"&gt;&lt;code&gt;google-research/harness2&lt;/code&gt; (&lt;em&gt;Harness²: Recursive Harnessing for LLM Agents&lt;/em&gt;, arXiv:2610.14224)&lt;/a&gt;&lt;/strong&gt;!&lt;/p&gt;

&lt;p&gt;This series will consist of three articles (corresponding to &lt;strong&gt;&lt;a href="https://github.com/kkdai/line-card-assistant/issues/16" rel="noopener noreferrer"&gt;Issue #16&lt;/a&gt;&lt;/strong&gt;, &lt;strong&gt;&lt;a href="https://github.com/kkdai/line-card-assistant/issues/17" rel="noopener noreferrer"&gt;Issue #17&lt;/a&gt;&lt;/strong&gt;, &lt;strong&gt;&lt;a href="https://github.com/kkdai/line-card-assistant/issues/18" rel="noopener noreferrer"&gt;Issue #18&lt;/a&gt;&lt;/strong&gt;, and &lt;strong&gt;&lt;a href="https://github.com/kkdai/line-card-assistant/pull/19" rel="noopener noreferrer"&gt;PR #19&lt;/a&gt;&lt;/strong&gt;), guiding you through the complete integration of &lt;strong&gt;Google Research &lt;code&gt;Harness²&lt;/code&gt;&lt;/strong&gt; into our Go ADK 2.0 project:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Part 1 (This article, &lt;a href="https://github.com/kkdai/line-card-assistant/issues/16" rel="noopener noreferrer"&gt;Issue #16&lt;/a&gt;)&lt;/strong&gt;: What is Google &lt;code&gt;Harness²&lt;/code&gt;? What can it do? Inventorying the existing architecture before modification and decoupling hardcoded configurations in the Go binary into a &lt;code&gt;c1..c8&lt;/code&gt; editable Harness file tree.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Part 2 (&lt;a href="https://github.com/kkdai/line-card-assistant/issues/17" rel="noopener noreferrer"&gt;Issue #17&lt;/a&gt;)&lt;/strong&gt;: Encapsulating Phase 4's &lt;code&gt;eval/datasets/&lt;/code&gt; and Phase 5's OpenTelemetry Spans into a &lt;code&gt;LineCardAdapter&lt;/code&gt; for &lt;code&gt;Harness²&lt;/code&gt;, and analyzing why "Zero-Leakage Barriers" and "High-Resolution Behavioral Trajectories" are both indispensable.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Part 3 (&lt;a href="https://github.com/kkdai/line-card-assistant/issues/18" rel="noopener noreferrer"&gt;Issue #18&lt;/a&gt;)&lt;/strong&gt;: Complete testing tutorial, disclosure of &lt;code&gt;Parallel&lt;/code&gt; vs &lt;code&gt;Sequential + LongTermMEMORY&lt;/code&gt; two-layer recursive experimental data (accuracy jumping from &lt;code&gt;62.5%&lt;/code&gt; to &lt;code&gt;100.0%&lt;/code&gt;), and outlook on the future development of Agents.&lt;/li&gt;
&lt;/ul&gt;




&lt;h1&gt;
  
  
  1. What is Google Research &lt;code&gt;Harness²&lt;/code&gt;? What can it do?
&lt;/h1&gt;

&lt;h2&gt;
  
  
  1. From "Fine-tuning Model Weights" to "Optimizing Agent Harnessing"
&lt;/h2&gt;

&lt;p&gt;In the era of Large Language Models (LLMs), the success of an AI Agent is often determined not just by the underlying model (like Gemini 2.5 Flash / Pro) itself, but by the &lt;strong&gt;"Agent Harness"&lt;/strong&gt; layer wrapped around the model—namely, System Prompts, formatting and safety Guardrails, Long-Term Memory, Tool Descriptions, Sub-Agent settings, and On-Demand Skills.&lt;/p&gt;

&lt;p&gt;Past automated prompt optimizations (like PromptBreeder, TextGrad, or DSPy) mostly targeted mutations of a &lt;strong&gt;single Prompt string&lt;/strong&gt;. However, in a real enterprise-grade Agent, if you stuff all edge-case patching rules into the same System Prompt, it quickly leads to &lt;strong&gt;"Context Bloat"&lt;/strong&gt;: the number of Always-On Tokens increases, which not only squeezes the model's Output Token Budget but also causes different rules to interfere with each other!&lt;/p&gt;

&lt;p&gt;Google Research's &lt;strong&gt;&lt;code&gt;Harness²&lt;/code&gt; (&lt;em&gt;Recursive Harnessing for LLM Agents&lt;/em&gt;, arXiv:2610.14224)&lt;/strong&gt; breaks this limitation. It defines the entire Agent's equipment as a structured &lt;strong&gt;&lt;code&gt;c1..c8&lt;/code&gt; Editable Component Tree&lt;/strong&gt; and automatically evolves this file tree through &lt;strong&gt;Two-Level Recursion&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight dot"&gt;&lt;code&gt;&lt;span class="nv"&gt;flowchart&lt;/span&gt; &lt;span class="nv"&gt;TB&lt;/span&gt;
    &lt;span class="k"&gt;subgraph&lt;/span&gt; &lt;span class="nv"&gt;Outer&lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"Outer Recursion: Harnessing-Level Recursion (Experience accumulation across rounds k=1..K)"&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;
        &lt;span class="nv"&gt;Reflector&lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"Experience Reflector\n(ReflectorPrompt)\nDistilling success and failure patterns across rounds"&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;
        &lt;span class="nv"&gt;Memory&lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"c3: LongTermMEMORY.md\nPersisting domain experience across iterations"&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;
        &lt;span class="nv"&gt;Reflector&lt;/span&gt; &lt;span class="o"&gt;--&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;|&lt;/span&gt;&lt;span class="nv"&gt;Write&lt;/span&gt; &lt;span class="nv"&gt;long&lt;/span&gt;&lt;span class="err"&gt;-&lt;/span&gt;&lt;span class="nv"&gt;term&lt;/span&gt; &lt;span class="nv"&gt;rules&lt;/span&gt;&lt;span class="err"&gt;|&lt;/span&gt; &lt;span class="nv"&gt;Memory&lt;/span&gt;
    &lt;span class="nv"&gt;end&lt;/span&gt;

    &lt;span class="k"&gt;subgraph&lt;/span&gt; &lt;span class="nv"&gt;Inner&lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"Inner Recursion: Task-Level Recursion (Closed-loop diagnosis and patching within a single round)"&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;
        &lt;span class="nv"&gt;Propose&lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"1. Propose (Diagnostic Proposal)\nRead trajectory.md\nLocate behavioral defects and propose N candidate Patches"&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;
        &lt;span class="nv"&gt;Probe&lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"2. Probe (Sandbox Probing)\nExecute N candidate Harnesses in parallel\nCompare trajectory and score changes before and after modification"&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;
        &lt;span class="nv"&gt;Compose&lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"3. Compose (Conflict Resolution and Synthesis)\nRetain positive-gain Patches, discard negative interference\nSynthesize the next-generation best Harness H^(k)"&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;
        &lt;span class="nv"&gt;Propose&lt;/span&gt; &lt;span class="o"&gt;--&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;&lt;/span&gt; &lt;span class="nv"&gt;Probe&lt;/span&gt; &lt;span class="o"&gt;--&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;&lt;/span&gt; &lt;span class="nv"&gt;Compose&lt;/span&gt;
    &lt;span class="nv"&gt;end&lt;/span&gt;

    &lt;span class="nv"&gt;Memory&lt;/span&gt; &lt;span class="o"&gt;--&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;&lt;/span&gt; &lt;span class="nv"&gt;Propose&lt;/span&gt;
    &lt;span class="nv"&gt;Compose&lt;/span&gt; &lt;span class="o"&gt;--&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;&lt;/span&gt; &lt;span class="nv"&gt;Reflector&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  2. The &lt;code&gt;c1..c8&lt;/code&gt; Eight Harness Components and the 24KB Budget Limit
&lt;/h2&gt;

&lt;p&gt;In &lt;a href="https://github.com/google-research/harness2/blob/main/harness2/harness.py" rel="noopener noreferrer"&gt;&lt;code&gt;google-research/harness2/harness.py&lt;/code&gt;&lt;/a&gt;, a standard Agent Harness consists of &lt;strong&gt;4 Always-On Components (&lt;code&gt;c1..c4&lt;/code&gt;)&lt;/strong&gt; and &lt;strong&gt;4 On-Demand Components (&lt;code&gt;c5..c8&lt;/code&gt;)&lt;/strong&gt;:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Component Code&lt;/th&gt;
&lt;th&gt;File Path Rule&lt;/th&gt;
&lt;th&gt;Loading Mode&lt;/th&gt;
&lt;th&gt;Responsibility in &lt;code&gt;Harness²&lt;/code&gt;
&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;&lt;code&gt;c1&lt;/code&gt;&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;systemprompt.md&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;Always-On&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Defines core roles, node responsibilities, and indexing rules for triggering &lt;code&gt;c6&lt;/code&gt; skills (Skill Trigger Lines).&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;&lt;code&gt;c2&lt;/code&gt;&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;guardrails.md&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;Always-On&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Defines non-violable output formats (e.g., pure JSON constraints), E.164 normalization invariants, and security/PII guardrails.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;&lt;code&gt;c3&lt;/code&gt;&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;LongTermMEMORY.md&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;Always-On&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Domain lessons and industry compliance memories written across rounds by the outer &lt;code&gt;Experience Reflector&lt;/code&gt;.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;&lt;code&gt;c4&lt;/code&gt;&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;tool_descriptions/*.md&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;Always-On&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Tool parameter descriptions, search strategies, and normalization details (e.g., Japan long-distance prefix &lt;code&gt;(0)&lt;/code&gt; cleaning rules).&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;&lt;code&gt;c5&lt;/code&gt;&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;sub_agents/&amp;lt;name&amp;gt;/AGENT.md&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;On-Demand&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Exclusive Instructions and YAML Frontmatter (&lt;code&gt;mode: subagent&lt;/code&gt;) for delegated sub-agents (e.g., &lt;code&gt;company_enrich&lt;/code&gt;).&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;&lt;code&gt;c6&lt;/code&gt;&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;skills/&amp;lt;name&amp;gt;/SKILL.md&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;On-Demand&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Professional skills dynamically injected only for specific domains or tasks (e.g., Japanese card OCR, Hsinchu Science Park colloquial search expansion).&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;&lt;code&gt;c7&lt;/code&gt;&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;scripts/*.py&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;On-Demand&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Auxiliary verification or data conversion scripts.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;&lt;code&gt;c8&lt;/code&gt;&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;plugin/*.ts&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;On-Demand&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Runtime lifecycle and OpenTelemetry diagnostic hooks.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;blockquote&gt;
&lt;p&gt;Important&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Why distinguish between &lt;code&gt;c1..c4&lt;/code&gt; (Always-On) and &lt;code&gt;c5..c8&lt;/code&gt; (On-Demand)?&lt;/strong&gt; &lt;code&gt;Harness²&lt;/code&gt; sets an iron rule in &lt;code&gt;OPENCODE_SURFACE&lt;/code&gt;: &lt;strong&gt;The total byte count of &lt;code&gt;c1..c4&lt;/code&gt; always-on files must never exceed &lt;code&gt;24,000 bytes&lt;/code&gt; (&lt;code&gt;AlwaysOnMaxBytes = 24000&lt;/code&gt;)&lt;/strong&gt;! When &lt;code&gt;Harness²&lt;/code&gt; finds that a failure case requires lengthy domain knowledge (e.g., a department title mapping table for Japanese corporate cards or a colloquial abbreviation dictionary for Taiwan semiconductor parks), it won't force these rules into &lt;code&gt;systemprompt.md&lt;/code&gt; causing Context explosion. Instead, it will automatically create an on-demand &lt;strong&gt;&lt;code&gt;c6&lt;/code&gt; skill file (&lt;code&gt;skills/&amp;lt;name&amp;gt;/SKILL.md&lt;/code&gt;)&lt;/strong&gt; and leave only a lightweight Trigger Line in &lt;code&gt;systemprompt.md&lt;/code&gt;!&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  3. How Does Two-Level Recursion Work?
&lt;/h2&gt;

&lt;p&gt;The &lt;code&gt;Harness²&lt;/code&gt; evolution engine (&lt;a href="https://github.com/google-research/harness2/blob/main/harness2/core/recursion.py" rel="noopener noreferrer"&gt;&lt;code&gt;harness2/core/recursion.py&lt;/code&gt;&lt;/a&gt;) includes two levels of recursion:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Level 1 (Inner): Task-Level Recursion (&lt;code&gt;Propose&lt;/code&gt; $\rightarrow$ &lt;code&gt;Probe&lt;/code&gt; $\rightarrow$ &lt;code&gt;Compose&lt;/code&gt;)&lt;/strong&gt;: 

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;Propose&lt;/code&gt; (Diagnostic Proposal)&lt;/strong&gt;: The optimizer (Harvester LLM) observes tasks that lost points in the benchmark, the final output (Deliverable), and the &lt;strong&gt;execution trajectory (&lt;code&gt;trajectory.md&lt;/code&gt;)&lt;/strong&gt;. It diagnoses which step the Agent made a wrong decision on and proposes multiple independent candidate patches (Candidate Patches, each being a set of additions or modifications to &lt;code&gt;c1..c8&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;Probe&lt;/code&gt; (Sandbox Probing)&lt;/strong&gt;: The system mounts each candidate Patch into a sandbox and runs the task once, collecting new scores and new execution trajectories to form a "Before vs. After" Behavioral Contrast.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;Compose&lt;/code&gt; (Conflict Resolution and Synthesis)&lt;/strong&gt;: The optimizer compares the actual performance of all candidate Patches, merges modifications that truly bring positive score improvements into the new generation Harness $H^{(k)}$, and discards ineffective or side-effect-inducing modifications.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Level 2 (Outer): Harnessing-Level Recursion (&lt;code&gt;Experience Reflector&lt;/code&gt;)&lt;/strong&gt;: 

&lt;ul&gt;
&lt;li&gt;Between multiple iterations ($k = 1 \dots K$), the outer &lt;code&gt;ReflectorPrompt&lt;/code&gt; reviews the evolution history from $H^{(0)} \to H^{(1)} \to \dots \to H^{(k)}$: Which types of modifications succeeded? Which cross-domain constraints (e.g., financial industry compliance headers and personal data protection regulations) need to be remembered at a global level?&lt;/li&gt;
&lt;li&gt;Distilled high-level experiences are written into &lt;strong&gt;&lt;code&gt;c3: LongTermMEMORY.md&lt;/code&gt;&lt;/strong&gt;, guiding the next round of &lt;code&gt;Propose&lt;/code&gt; and Agent execution.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;




&lt;h1&gt;
  
  
  2. Inventorying the Current Architecture: Why Phase 1~5 Go Implementation Cannot Be Directly Optimized by &lt;code&gt;Harness²&lt;/code&gt;?
&lt;/h1&gt;

&lt;p&gt;Let's compare the &lt;strong&gt;left side (Before: Hardcoded Go Binary Architecture)&lt;/strong&gt; of the architecture diagram at the beginning of the article and review the system architecture we completed in Phase 1 to Phase 5:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight dot"&gt;&lt;code&gt;&lt;span class="nv"&gt;flowchart&lt;/span&gt; &lt;span class="nv"&gt;LR&lt;/span&gt;
    &lt;span class="k"&gt;subgraph&lt;/span&gt; &lt;span class="nv"&gt;Before&lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"Before: Phase 1~5 Solid Compilation Architecture (Hardcoded Go Binary)"&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;
        &lt;span class="nv"&gt;direction&lt;/span&gt; &lt;span class="nv"&gt;TB&lt;/span&gt;
        &lt;span class="nv"&gt;N1&lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"nodes_ingest.go\nHardcoded VisionOCR / CleanAndDedup /\nCompanyEnrich / ApplyEdit Prompts"&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;
        &lt;span class="nv"&gt;N2&lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"nodes_search.go\nHardcoded QueryIntent /\nEmailDraft Prompts"&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;
        &lt;span class="nv"&gt;N3&lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"graph.go\nFixed SubAgent Instruction"&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;
        &lt;span class="nv"&gt;E&lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"eval/datasets/basic-dataset.json\nPhase 4 Golden Test Set"&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;
        &lt;span class="nv"&gt;T&lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"telemetry.go\nPhase 5 OpenTelemetry 13-Node Spans"&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;
    &lt;span class="nv"&gt;end&lt;/span&gt;

    &lt;span class="nv"&gt;Problem&lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"Pain Points:\n1. Prompts hardcoded in .go string constants; re-go build required for every adjustment\n2. Lack of on-demand c6 Skills mechanism\n3. Phase 4 Eval and Phase 5 OTel Spans not yet connected into an automated optimization loop"&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;
    &lt;span class="nv"&gt;Before&lt;/span&gt; &lt;span class="o"&gt;--&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;&lt;/span&gt; &lt;span class="nv"&gt;Problem&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In the code before modification:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;All Prompt templates for &lt;strong&gt;&lt;code&gt;VisionOCRNode&lt;/code&gt;&lt;/strong&gt;, &lt;strong&gt;&lt;code&gt;CompanyEnrichNode&lt;/code&gt;&lt;/strong&gt;, &lt;strong&gt;&lt;code&gt;ApplyEditNode&lt;/code&gt;&lt;/strong&gt; (located in &lt;code&gt;internal/workflow/nodes_ingest.go&lt;/code&gt;), as well as &lt;strong&gt;&lt;code&gt;QueryIntentNode&lt;/code&gt;&lt;/strong&gt; and &lt;strong&gt;&lt;code&gt;EmailDraftNode&lt;/code&gt;&lt;/strong&gt; (located in &lt;code&gt;internal/workflow/nodes_search.go&lt;/code&gt;), are hardcoded as &lt;code&gt;fmt.Sprintf(...)&lt;/code&gt; string constants in the Go code.&lt;/li&gt;
&lt;li&gt;The &lt;code&gt;llmagent.Config{Instruction: ...}&lt;/code&gt; for &lt;strong&gt;&lt;code&gt;CompanyEnrichAgent&lt;/code&gt;&lt;/strong&gt; (located in &lt;code&gt;internal/workflow/nodes_ingest.go&lt;/code&gt;) is also a fixed string hardcoded in a Go function.&lt;/li&gt;
&lt;li&gt;When we want the &lt;code&gt;Harness²&lt;/code&gt; Python evolution loop to modify system prompts, add a Japanese business card recognition skill (&lt;code&gt;skills/jp_card_ocr/SKILL.md&lt;/code&gt;), or adjust phone number normalization guidelines (&lt;code&gt;tool_descriptions/tool_guidance.md&lt;/code&gt;), &lt;strong&gt;it is impossible for &lt;code&gt;Harness²&lt;/code&gt; to rewrite our &lt;code&gt;.go&lt;/code&gt; source code and &lt;code&gt;go build&lt;/code&gt; again for every single task&lt;/strong&gt;!&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Therefore, the first step in introducing &lt;code&gt;Harness²&lt;/code&gt; (&lt;strong&gt;&lt;a href="https://github.com/kkdai/line-card-assistant/issues/16" rel="noopener noreferrer"&gt;Issue #16&lt;/a&gt;&lt;/strong&gt;) is to completely decouple the Go compilation phase from the Harness equipment phase:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Go Binary is responsible for "Graph Topology and Dual-Channel Execution Engine"&lt;/strong&gt;: &lt;code&gt;RouterNode&lt;/code&gt;, parallel Fan-Out/Fan-In, &lt;code&gt;HITLConfirmNode&lt;/code&gt; pause/resume, Cloud SQL and GCS Artifact access, OpenTelemetry instrumentation.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;External &lt;code&gt;c1..c8&lt;/code&gt; Harness file tree is responsible for the "Evolvable Brain and Skill Equipment"&lt;/strong&gt;: Dynamically hot-reloaded at runtime via the environment variable &lt;code&gt;LINE_CARD_HARNESS_DIR&lt;/code&gt;!&lt;/li&gt;
&lt;/ul&gt;




&lt;h1&gt;
  
  
  3. Implementation Part 1: Building &lt;code&gt;internal/harness&lt;/code&gt; Loader and &lt;code&gt;harness/base/&lt;/code&gt; Initial Equipment Tree
&lt;/h1&gt;

&lt;p&gt;To make the Go ADK 2.0 Graph Workflow natively understand the &lt;code&gt;Harness²&lt;/code&gt; &lt;code&gt;c1..c8&lt;/code&gt; specification, we added two core directories to the project:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://github.com/kkdai/line-card-assistant/tree/main/harness/base" rel="noopener noreferrer"&gt;&lt;code&gt;harness/base/&lt;/code&gt;&lt;/a&gt;: Stores the initial unevolved ($k=0$) &lt;code&gt;c1..c8&lt;/code&gt; baseline file tree.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://github.com/kkdai/line-card-assistant/blob/main/internal/harness/harness.go" rel="noopener noreferrer"&gt;&lt;code&gt;internal/harness/harness.go&lt;/code&gt;&lt;/a&gt;: Responsible for loading the &lt;code&gt;c1..c8&lt;/code&gt; file tree, validating &lt;code&gt;OPENCODE_SURFACE&lt;/code&gt; 24KB limits and YAML Frontmatter rules, and dynamically combining always-on context with on-demand skills for each Graph Node.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  1. Establishing the &lt;code&gt;harness/base/&lt;/code&gt; Baseline &lt;code&gt;c1..c8&lt;/code&gt; File Tree
&lt;/h2&gt;

&lt;p&gt;We extracted the basic settings previously scattered in &lt;code&gt;nodes_ingest.go&lt;/code&gt; and &lt;code&gt;nodes_search.go&lt;/code&gt; into the &lt;code&gt;harness/base/&lt;/code&gt; directory:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;harness/base/
├── systemprompt.md # c1: Core roles and overview of Graph Node responsibilities
├── guardrails.md # c2: JSON output format and phone normalization guardrails
├── LongTermMEMORY.md # c3: Cross-round long-term memory (initially empty, to be written by Reflector)
├── tool_descriptions/
│ └── tool_guidance.md # c4: Guidance for google_search and format_company_profile
├── sub_agents/
│ └── company_enrich/
│ └── AGENT.md # c5: CompanyEnrichAgent delegated sub-agent definition
├── skills/ # c6: On-demand skills directory (to be generated by Propose-Probe-Compose evolution)
├── scripts/ # c7: Auxiliary scripts directory
└── plugin/ # c8: Diagnostic plugin directory
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For example, &lt;code&gt;harness/base/sub_agents/company_enrich/AGENT.md&lt;/code&gt; uses a YAML Frontmatter format fully compatible with &lt;code&gt;google-research/harness2&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="nn"&gt;---&lt;/span&gt;
&lt;span class="na"&gt;mode&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;subagent&lt;/span&gt;
&lt;span class="na"&gt;description&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;Searches Google to summarize company background and industry tags.&lt;/span&gt;
&lt;span class="nn"&gt;---&lt;/span&gt;
&lt;span class="s"&gt;You are a professional business analysis assistant. Please use the google_search tool to query the company name provided by the user, then call the format_company_profile tool to return a two-sentence Traditional Chinese company profile and 3 to 5 technical or industry tags (e.g., AI, Cloud, SaaS, FinTech, Semiconductor).&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  2. Implementing &lt;code&gt;internal/harness/harness.go&lt;/code&gt;: 24KB Always-On Budget Validation and On-Demand Skill Injection
&lt;/h2&gt;

&lt;p&gt;In &lt;a href="https://github.com/kkdai/line-card-assistant/blob/main/internal/harness/harness.go" rel="noopener noreferrer"&gt;&lt;code&gt;internal/harness/harness.go&lt;/code&gt;&lt;/a&gt;, we implemented the validator &lt;code&gt;Validate()&lt;/code&gt; and node prompt synthesizer &lt;code&gt;ComposeNodePrompt()&lt;/code&gt; fully aligned with the Python version of &lt;code&gt;OPENCODE_SURFACE.validate()&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="c"&gt;// AlwaysOnMaxBytes matches google-research/harness2 OPENCODE_SURFACE.always_on_max (24,000 bytes).&lt;/span&gt;
&lt;span class="k"&gt;const&lt;/span&gt; &lt;span class="n"&gt;AlwaysOnMaxBytes&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="m"&gt;24000&lt;/span&gt;

&lt;span class="c"&gt;// AlwaysOnFiles lists the four c1..c4 always-on files mounted into the agent context.&lt;/span&gt;
&lt;span class="k"&gt;var&lt;/span&gt; &lt;span class="n"&gt;AlwaysOnFiles&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[]&lt;/span&gt;&lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="s"&gt;"systemprompt.md"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s"&gt;"guardrails.md"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s"&gt;"LongTermMEMORY.md"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="s"&gt;"tool_descriptions/tool_guidance.md"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c"&gt;// Validate enforces Google Research Harness² OPENCODE_SURFACE invariants on the c1..c8 tree.&lt;/span&gt;
&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;h&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;Harness&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="n"&gt;Validate&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="kt"&gt;error&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;var&lt;/span&gt; &lt;span class="n"&gt;problems&lt;/span&gt; &lt;span class="p"&gt;[]&lt;/span&gt;&lt;span class="kt"&gt;string&lt;/span&gt;
    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;_&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;reqFile&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="k"&gt;range&lt;/span&gt; &lt;span class="n"&gt;AlwaysOnFiles&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;strings&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;TrimSpace&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;h&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Files&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;reqFile&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="s"&gt;""&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="n"&gt;problems&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;append&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;problems&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;fmt&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Sprintf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"missing or empty always-on component %q"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;reqFile&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;total&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;h&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;AlwaysOnBytes&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt; &lt;span class="n"&gt;total&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;AlwaysOnMaxBytes&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;problems&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;append&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;problems&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;fmt&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Sprintf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
            &lt;span class="s"&gt;"always-on c1..c4 byte count %d exceeds cap %d (every token here competes with the agent's output budget)"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="n"&gt;total&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;AlwaysOnMaxBytes&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="p"&gt;))&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="n"&gt;combinedAlwaysOn&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;h&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;SystemPrompt&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="s"&gt;"&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="s"&gt;"&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;h&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Guardrails&lt;/span&gt;
    &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;dirName&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;skill&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="k"&gt;range&lt;/span&gt; &lt;span class="n"&gt;h&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Skills&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;skill&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Name&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="n"&gt;dirName&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="n"&gt;problems&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;append&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;problems&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;fmt&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Sprintf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"%s frontmatter name %q must match directory name %q"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;skill&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;RelPath&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;skill&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;dirName&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;strings&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;TrimSpace&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;skill&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Description&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;==&lt;/span&gt; &lt;span class="s"&gt;""&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="n"&gt;problems&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;append&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;problems&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;fmt&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Sprintf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"%s must include a non-empty description in YAML frontmatter"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;skill&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;RelPath&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="n"&gt;strings&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Contains&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;combinedAlwaysOn&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;dirName&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="n"&gt;problems&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nb"&gt;append&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;problems&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;fmt&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Sprintf&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"skill %q is never referenced in systemprompt.md or guardrails.md; add a trigger line naming `%s`"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;dirName&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;dirName&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="c"&gt;// ...&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;There are two very critical engineering details here:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Mandatory Skill Trigger Reference Check&lt;/strong&gt;: If &lt;code&gt;Harness²&lt;/code&gt; adds a skill in &lt;code&gt;skills/jp_card_ocr/SKILL.md&lt;/code&gt; but forgets to write when to trigger &lt;code&gt;jp_card_ocr&lt;/code&gt; in &lt;code&gt;systemprompt.md&lt;/code&gt; or &lt;code&gt;guardrails.md&lt;/code&gt;, &lt;code&gt;Validate()&lt;/code&gt; will directly report an error and intercept it, avoiding the creation of "Orphan Skills" that will never be called.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Node-Level Dynamic Skill Matching (&lt;code&gt;MatchSkills&lt;/code&gt; + &lt;code&gt;ComposeNodePrompt&lt;/code&gt;)&lt;/strong&gt;: When the Graph Workflow executes &lt;code&gt;VisionOCRNode&lt;/code&gt;, &lt;code&gt;CompanyEnrichNode&lt;/code&gt;, &lt;code&gt;ApplyEditNode&lt;/code&gt;, &lt;code&gt;QueryIntentNode&lt;/code&gt;, or &lt;code&gt;EmailDraftNode&lt;/code&gt;, it only injects &lt;code&gt;c6&lt;/code&gt; skills related to that node and automatically attaches &lt;code&gt;adk.harness.skills&lt;/code&gt; and &lt;code&gt;adk.harness.always_on_bytes&lt;/code&gt; attributes to the OpenTelemetry Span:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="c"&gt;// composeHarnessPrompt enriches a node's base prompt with the active Harness² c1..c8 tree&lt;/span&gt;
&lt;span class="c"&gt;// and records the active harness metadata onto the node's OpenTelemetry span.&lt;/span&gt;
&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="n"&gt;composeHarnessPrompt&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;span&lt;/span&gt; &lt;span class="n"&gt;trace&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Span&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;nodeName&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;basePrompt&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;taskInput&lt;/span&gt; &lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;string&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;harness&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Harness&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;h&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;harness&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;LoadActive&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="n"&gt;composed&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;skills&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;h&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;ComposeNodePrompt&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;nodeName&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;basePrompt&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;taskInput&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;span&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="no"&gt;nil&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;span&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;SetAttributes&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
            &lt;span class="n"&gt;AttrHarnessRoot&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;String&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;h&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;RootDir&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
            &lt;span class="n"&gt;AttrHarnessAlwaysOnBytes&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Int&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;h&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;AlwaysOnBytes&lt;/span&gt;&lt;span class="p"&gt;()),&lt;/span&gt;
        &lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="nb"&gt;len&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;skills&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="n"&gt;span&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;SetAttributes&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;AttrHarnessSkills&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;StringSlice&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;skills&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;composed&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;h&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We can directly use the CLI to verify the always-on byte count and structural validity of &lt;code&gt;harness/base&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;go run ./cmd/harness-runner &lt;span class="nt"&gt;--validate-only&lt;/span&gt; &lt;span class="nt"&gt;--harness-dir&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;harness/base
OK &lt;span class="o"&gt;(&lt;/span&gt;1599 always-on bytes&lt;span class="o"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h1&gt;
  
  
  4. Summary and Next Article Preview
&lt;/h1&gt;

&lt;p&gt;In this article (Part 1), we completed the goals of &lt;strong&gt;&lt;a href="https://github.com/kkdai/line-card-assistant/issues/16" rel="noopener noreferrer"&gt;Issue #16&lt;/a&gt;&lt;/strong&gt;:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Gained a deep understanding of how Google Research &lt;strong&gt;&lt;code&gt;Harness²&lt;/code&gt; (arXiv:2610.14224)&lt;/strong&gt; automatically evolves Agent capabilities through a &lt;strong&gt;&lt;code&gt;c1..c8&lt;/code&gt; editable file tree&lt;/strong&gt; and &lt;strong&gt;two-level recursion (Task-level &lt;code&gt;Propose-Probe-Compose&lt;/code&gt; + Harnessing-level &lt;code&gt;Experience Reflector&lt;/code&gt;)&lt;/strong&gt;, without recompiling the main program or bloating the always-on context.&lt;/li&gt;
&lt;li&gt;Inventoried the architectural bottlenecks of Phase 1~5 where prompts and normalization logic were hardcoded in the Go binary.&lt;/li&gt;
&lt;li&gt;Implemented &lt;a href="https://github.com/kkdai/line-card-assistant/blob/main/internal/harness/harness.go" rel="noopener noreferrer"&gt;&lt;code&gt;internal/harness/harness.go&lt;/code&gt;&lt;/a&gt; and &lt;a href="https://github.com/kkdai/line-card-assistant/tree/main/harness/base" rel="noopener noreferrer"&gt;&lt;code&gt;harness/base/&lt;/code&gt;&lt;/a&gt;, allowing the 13 nodes of the ADK 2.0 Go Graph Workflow to support dynamic mounting of the &lt;code&gt;c1..c8&lt;/code&gt; equipment tree via &lt;code&gt;LINE_CARD_HARNESS_DIR&lt;/code&gt;.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;With a hot-reloadable &lt;code&gt;c1..c8&lt;/code&gt; equipment tree in place, the next article &lt;strong&gt;&lt;a href="https://dev.to/2026/10/26/adk-graph-workflow-go-8/"&gt;[Agent Platform in Action (8)] When ADK Go Graph Workflow Meets Google Research Harness² (Part 2): Turning Phase 4 Eval Datasets and Phase 5 OpenTelemetry Spans into LineCardAdapter&lt;/a&gt;&lt;/strong&gt; will enter &lt;strong&gt;&lt;a href="https://github.com/kkdai/line-card-assistant/issues/17" rel="noopener noreferrer"&gt;Issue #17&lt;/a&gt;&lt;/strong&gt;: revealing why we need to encapsulate Phase 4 test sets and Phase 5 OpenTelemetry Spans into a &lt;code&gt;LineCardAdapter&lt;/code&gt;, and how the "Zero-Leakage Barrier" prevents the AI optimizer from cheating!&lt;/p&gt;

</description>
      <category>agents</category>
      <category>ai</category>
      <category>architecture</category>
      <category>go</category>
    </item>
    <item>
      <title>[Agent Platform in Action (8)] When ADK Go Graph Workflow Meets Google Research Harness (Part 2): Integrating Phase 4 Eval Datas</title>
      <dc:creator>Evan Lin</dc:creator>
      <pubDate>Sun, 01 Nov 2026 14:37:19 +0000</pubDate>
      <link>https://dev.to/gde/agent-platform-in-action-8-when-adk-go-graph-workflow-meets-google-research-harness-part-2-nc8</link>
      <guid>https://dev.to/gde/agent-platform-in-action-8-when-adk-go-graph-workflow-meets-google-research-harness-part-2-nc8</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fyxdjol1nvvsed1qzztso.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fyxdjol1nvvsed1qzztso.png" alt="Harness² Part 2: LineCardAdapter Bridging Phase 4 Eval &amp;amp; Phase 5 OpenTelemetry Spans" width="800" height="447"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Introduction: Why Decoupling Prompts Isn't Enough?
&lt;/h1&gt;

&lt;p&gt;In the previous post &lt;strong&gt;&lt;a href="https://dev.to/2026/10/25/adk-graph-workflow-go-7/"&gt;[Agent Platform in Practice (7)] When ADK Go Graph Workflow Meets Google Research Harness² (Part 1): Understanding the Recursive Agent Framework and c1..c8 Decoupling&lt;/a&gt;&lt;/strong&gt; (corresponding to &lt;strong&gt;&lt;a href="https://github.com/kkdai/line-card-assistant/issues/16" rel="noopener noreferrer"&gt;Issue #16&lt;/a&gt;&lt;/strong&gt;), we introduced Google Research's &lt;strong&gt;&lt;a href="https://github.com/google-research/harness2" rel="noopener noreferrer"&gt;&lt;code&gt;google-research/harness2&lt;/code&gt; (arXiv:2610.14224)&lt;/a&gt;&lt;/strong&gt; and decoupled the prompts, guardrails, long-term memory, and on-demand skills of the &lt;strong&gt;&lt;a href="https://github.com/kkdai/line-card-assistant" rel="noopener noreferrer"&gt;LINE AI Business Card Assistant (&lt;code&gt;kkdai/line-card-assistant&lt;/code&gt;)&lt;/a&gt;&lt;/strong&gt; into an &lt;strong&gt;editable &lt;code&gt;c1..c8&lt;/code&gt; Harness file tree&lt;/strong&gt; that can be dynamically mounted via &lt;code&gt;LINE_CARD_HARNESS_DIR&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;However, simply having a hot-reloadable &lt;code&gt;c1..c8&lt;/code&gt; file tree isn't enough; the &lt;code&gt;Harness²&lt;/code&gt; dual-layer recursive optimization engine (&lt;a href="https://github.com/google-research/harness2/blob/main/harness2/core/recursion.py" rel="noopener noreferrer"&gt;&lt;code&gt;harness2/core/recursion.py&lt;/code&gt;&lt;/a&gt;) still cannot directly optimize our Go Agent. This is because &lt;code&gt;Harness²&lt;/code&gt; requires a standardized bridge — the &lt;strong&gt;&lt;code&gt;BenchmarkAdapter&lt;/code&gt;&lt;/strong&gt; — to answer three questions:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt; &lt;strong&gt;&lt;code&gt;list_tasks()&lt;/code&gt; (What are the test questions?)&lt;/strong&gt;: What test cases should the Agent challenge? What are the public inputs (Prompt / Image) for each case, and what are the hidden scoring criteria (Rubrics)?&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;&lt;code&gt;run()&lt;/code&gt; (How does the Agent think and execute?)&lt;/strong&gt;: When a candidate Harness $H’$ is mounted to execute a specific task, what is the Agent's final output (&lt;code&gt;deliverable&lt;/code&gt;)? More importantly, &lt;strong&gt;what decision trajectory did it follow across the 13 nodes of the Graph Workflow (&lt;code&gt;trajectory.md&lt;/code&gt;)&lt;/strong&gt;?&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;&lt;code&gt;score()&lt;/code&gt; (How was the performance?)&lt;/strong&gt;: Which independent scoring items (&lt;code&gt;per_rubric&lt;/code&gt;) did the final output and execution trajectory pass, and where did it lose points?&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Conveniently, in &lt;strong&gt;Phase 4 (&lt;a href="https://github.com/kkdai/line-card-assistant/pull/13" rel="noopener noreferrer"&gt;PR #13&lt;/a&gt;)&lt;/strong&gt;, we already established the &lt;code&gt;eval/datasets/&lt;/code&gt; automated evaluation benchmark, and in &lt;strong&gt;Phase 5 (&lt;a href="https://github.com/kkdai/line-card-assistant/pull/14" rel="noopener noreferrer"&gt;PR #14&lt;/a&gt;)&lt;/strong&gt;, we added &lt;code&gt;workflow.node.*&lt;/code&gt; OpenTelemetry Spans to all 13 Graph Nodes!&lt;/p&gt;

&lt;p&gt;In this post (Part 2, corresponding to &lt;strong&gt;&lt;a href="https://github.com/kkdai/line-card-assistant/issues/17" rel="noopener noreferrer"&gt;Issue #17&lt;/a&gt;&lt;/strong&gt; and &lt;strong&gt;&lt;a href="https://github.com/kkdai/line-card-assistant/pull/19" rel="noopener noreferrer"&gt;PR #19&lt;/a&gt;&lt;/strong&gt;), we will merge these two existing assets into the &lt;code&gt;Harness²&lt;/code&gt; &lt;strong&gt;&lt;code&gt;LineCardAdapter&lt;/code&gt;&lt;/strong&gt; and explain in depth &lt;strong&gt;"Why must it be designed this way?"&lt;/strong&gt;.&lt;/p&gt;




&lt;h1&gt;
  
  
  I. Why This Change? Two Core Design Philosophies
&lt;/h1&gt;

&lt;p&gt;Before diving into the code, many engineers often ask two questions:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt; &lt;em&gt;"Why not just feed the entire &lt;code&gt;eval/datasets/*.json&lt;/code&gt; file to the optimizer LLM and let it modify the Prompt itself?"&lt;/em&gt;
&lt;/li&gt;
&lt;li&gt; &lt;em&gt;"Why do we need to convert Phase 5 OpenTelemetry Spans into &lt;code&gt;trajectory.md&lt;/code&gt;? Isn't the final LINE reply text and total score enough?"&lt;/em&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;These two questions touch upon the most core engineering designs in the &lt;code&gt;Harness²&lt;/code&gt; paper: the &lt;strong&gt;Zero-Leakage Barrier&lt;/strong&gt; and &lt;strong&gt;Behavioral Trajectory Contrast&lt;/strong&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Why the "Zero-Leakage Barrier"? Preventing the Optimizer from "Cheating by Memorizing Answers"
&lt;/h2&gt;

&lt;p&gt;Imagine this: if we expose the golden answers in &lt;code&gt;eval/datasets/harness2-challenge-dataset.json&lt;/code&gt; (e.g., &lt;code&gt;expected_contains: ["+81-3-1234-5678", "Kenta Sato"]&lt;/code&gt;) directly to the Agent or the &lt;code&gt;Harness²&lt;/code&gt; Harvester LLM, what happens?&lt;/p&gt;

&lt;p&gt;The laziest and easiest way for the optimizer to get a perfect score is to write a single line in &lt;code&gt;systemprompt.md&lt;/code&gt;:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;"If the input contains Sato, please directly output &lt;code&gt;+81-3-1234-5678&lt;/code&gt; and &lt;code&gt;Kenta Sato&lt;/code&gt;."&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;In machine learning, this is known as &lt;strong&gt;Test Set Leakage / Overfitting to Rubrics&lt;/strong&gt;. The Agent appears to score 100 on the benchmark, but it crashes immediately when it encounters a new Japanese business card in the real world!&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight dot"&gt;&lt;code&gt;&lt;span class="nv"&gt;flowchart&lt;/span&gt; &lt;span class="nv"&gt;LR&lt;/span&gt;
    &lt;span class="nv"&gt;Dataset&lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"eval/datasets/*.json\nComplete Test Cases\n(incl. expected_contains / expected_route)"&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;

    &lt;span class="k"&gt;subgraph&lt;/span&gt; &lt;span class="nv"&gt;Barrier&lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"Zero-Leakage Barrier"&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;
        &lt;span class="nv"&gt;Brief&lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"TaskBrief (Public Task Sheet)\nContains only task_id, prompt, session_input\n❌ Never contains expected_* golden answers"&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;
        &lt;span class="nv"&gt;Scorer&lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"Isolated Scorer (Black-box Grader)\nHolds independent hidden r1..r4 Rubrics"&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;
    &lt;span class="nv"&gt;end&lt;/span&gt;

    &lt;span class="nv"&gt;Agent&lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"Go ADK Graph Workflow\n(cmd/harness-runner)"&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;
    &lt;span class="nv"&gt;Harvester&lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"Harness² Harvester\n(Propose / Probe / Compose)"&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;

    &lt;span class="nv"&gt;Dataset&lt;/span&gt; &lt;span class="o"&gt;--&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;&lt;/span&gt; &lt;span class="nv"&gt;Brief&lt;/span&gt;
    &lt;span class="nv"&gt;Dataset&lt;/span&gt; &lt;span class="o"&gt;--&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;&lt;/span&gt; &lt;span class="nv"&gt;Scorer&lt;/span&gt;
    &lt;span class="nv"&gt;Brief&lt;/span&gt; &lt;span class="o"&gt;--&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;|&lt;/span&gt;&lt;span class="s2"&gt;"Public Input"&lt;/span&gt;&lt;span class="err"&gt;|&lt;/span&gt; &lt;span class="nv"&gt;Agent&lt;/span&gt;
    &lt;span class="nv"&gt;Agent&lt;/span&gt; &lt;span class="o"&gt;--&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;|&lt;/span&gt;&lt;span class="s2"&gt;"Deliverable + OTel trajectory.md"&lt;/span&gt;&lt;span class="err"&gt;|&lt;/span&gt; &lt;span class="nv"&gt;Scorer&lt;/span&gt;
    &lt;span class="nv"&gt;Scorer&lt;/span&gt; &lt;span class="o"&gt;--&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;|&lt;/span&gt;&lt;span class="s2"&gt;"Returns only binary scores {r1: 1.0, r2: 0.0}\nand OTel execution trajectory"&lt;/span&gt;&lt;span class="err"&gt;|&lt;/span&gt; &lt;span class="nv"&gt;Harvester&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In the &lt;code&gt;Harness²&lt;/code&gt; &lt;code&gt;BenchmarkAdapter&lt;/code&gt; architecture:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  &lt;strong&gt;&lt;code&gt;TaskBrief&lt;/code&gt; (Public Task Sheet)&lt;/strong&gt;: Can only contain user input (&lt;code&gt;prompt&lt;/code&gt; and simulated images/context). It is &lt;strong&gt;strictly forbidden from containing any &lt;code&gt;expected_contains&lt;/code&gt;, &lt;code&gt;expected_not_contains&lt;/code&gt;, or correct answer strings&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;  &lt;strong&gt;&lt;code&gt;score()&lt;/code&gt; (Black-box Grader)&lt;/strong&gt;: After comparing answers in an isolated environment, it only returns "which Rubric received a &lt;code&gt;1.0&lt;/code&gt; or &lt;code&gt;0.0&lt;/code&gt;" (e.g., &lt;code&gt;r3_e164_jp_phone_normalization: 0.0&lt;/code&gt;), without leaking the expected string to the optimizer.&lt;/li&gt;
&lt;li&gt;  As a result, the &lt;code&gt;Harness²&lt;/code&gt; optimizer must truly reason out general domain rules (e.g., "When converting Japanese phone numbers &lt;code&gt;+81 (0)3-...&lt;/code&gt; to E.164, the domestic trunk prefix &lt;code&gt;(0)&lt;/code&gt; must be removed") by &lt;strong&gt;reading the Agent's execution trajectory (&lt;code&gt;trajectory.md&lt;/code&gt;)&lt;/strong&gt;, rather than hard-coding answers into the Prompt!&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  2. Why Convert Phase 5 OpenTelemetry Spans into &lt;code&gt;trajectory.md&lt;/code&gt;? Opening the Black Box of the 13-Node Graph
&lt;/h2&gt;

&lt;p&gt;Our LINE AI Business Card Assistant is not a simple "single LLM call," but an &lt;strong&gt;ADK 2.0 Directed Acyclic Graph (Graph Workflow) consisting of 13 nodes&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  Business Card Ingestion Pipeline: &lt;code&gt;RouterNode&lt;/code&gt; $\rightarrow$ &lt;code&gt;VisionOCRNode&lt;/code&gt; $\rightarrow$ Parallel &lt;code&gt;AddFanOut&lt;/code&gt; (&lt;code&gt;CleanAndDedupNode&lt;/code&gt;, &lt;code&gt;CompanyEnrichNode&lt;/code&gt;, &lt;code&gt;ContextMatchNode&lt;/code&gt;) $\rightarrow$ &lt;code&gt;AddFanIn&lt;/code&gt; (&lt;code&gt;JoinPreviewNode&lt;/code&gt;) $\rightarrow$ &lt;code&gt;BuildPreviewNode&lt;/code&gt; $\rightarrow$ &lt;code&gt;HITLConfirmNode&lt;/code&gt; $\rightarrow$ &lt;code&gt;ApplyEditNode&lt;/code&gt; / &lt;code&gt;SaveCardNode&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;  Smart Search and Icebreaker Pipeline: &lt;code&gt;RouterNode&lt;/code&gt; $\rightarrow$ &lt;code&gt;QueryIntentNode&lt;/code&gt; $\rightarrow$ &lt;code&gt;HybridSearchNode&lt;/code&gt; / &lt;code&gt;BroadSearchNode&lt;/code&gt; $\rightarrow$ &lt;code&gt;FormatCarouselNode&lt;/code&gt; / &lt;code&gt;EmailDraftNode&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Without Phase 5's OpenTelemetry Spans, when a user searches for &lt;em&gt;"Help me find a Sales Director in Hsinchu Science Park working on AI chips"&lt;/em&gt; but gets &lt;em&gt;"No matching business cards found"&lt;/em&gt; (score &lt;code&gt;0.25&lt;/code&gt;), the optimizer only sees this final failure message and cannot determine:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  Did the &lt;strong&gt;&lt;code&gt;RouterNode&lt;/code&gt;&lt;/strong&gt; misjudge the search intent as &lt;code&gt;chat&lt;/code&gt;?&lt;/li&gt;
&lt;li&gt;  Did the &lt;strong&gt;&lt;code&gt;QueryIntentNode&lt;/code&gt;&lt;/strong&gt; fail to expand the colloquial "Hsinchu Science Park" into the database's address &lt;code&gt;Hsinchu&lt;/code&gt;, or fail to expand "Sales Director" into &lt;code&gt;Sales Director&lt;/code&gt;?&lt;/li&gt;
&lt;li&gt;  Was there an error in the SQL query logic of the &lt;strong&gt;&lt;code&gt;HybridSearchNode&lt;/code&gt;&lt;/strong&gt;?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;When we collect and render Phase 5's OpenTelemetry &lt;code&gt;workflow.node.*&lt;/code&gt; Spans into a structured &lt;strong&gt;&lt;code&gt;trajectory.md&lt;/code&gt;&lt;/strong&gt;, &lt;code&gt;Harness²&lt;/code&gt; can clearly see the input, output, duration, routing decisions, and loaded skills of every Graph Node during the &lt;code&gt;Propose&lt;/code&gt; and &lt;code&gt;Probe&lt;/code&gt; stages!&lt;/p&gt;




&lt;h1&gt;
  
  
  II. Implementation Part 2: Building the &lt;code&gt;LineCardAdapter&lt;/code&gt; in Three Steps
&lt;/h1&gt;

&lt;p&gt;Referring to the architecture diagram at the beginning of this article, we completed the implementation of &lt;strong&gt;&lt;a href="https://github.com/kkdai/line-card-assistant/issues/17" rel="noopener noreferrer"&gt;Issue #17&lt;/a&gt;&lt;/strong&gt; through three core components:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt; &lt;strong&gt;&lt;a href="https://github.com/kkdai/line-card-assistant/blob/main/internal/harness/trajectory.go" rel="noopener noreferrer"&gt;&lt;code&gt;internal/harness/trajectory.go&lt;/code&gt;&lt;/a&gt;&lt;/strong&gt;: Mounts an in-memory OpenTelemetry &lt;code&gt;SpanRecorder&lt;/code&gt; on the Go side to export the execution details of the 13 Graph Nodes as &lt;code&gt;trajectory.md&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;&lt;a href="https://github.com/kkdai/line-card-assistant/blob/main/cmd/harness-runner/main.go" rel="noopener noreferrer"&gt;&lt;code&gt;cmd/harness-runner/main.go&lt;/code&gt;&lt;/a&gt;&lt;/strong&gt;: Provides a deterministic subprocess CLI for the Python &lt;code&gt;Harness²&lt;/code&gt; to call, receiving &lt;code&gt;--harness-dir&lt;/code&gt; and &lt;code&gt;--task-json&lt;/code&gt;, and outputting a JSON containing &lt;code&gt;deliverable&lt;/code&gt;, &lt;code&gt;trajectory_markdown&lt;/code&gt;, and &lt;code&gt;spans&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt; &lt;strong&gt;&lt;a href="https://github.com/kkdai/line-card-assistant/blob/main/harness/line_card_adapter.py" rel="noopener noreferrer"&gt;&lt;code&gt;harness/line_card_adapter.py&lt;/code&gt;&lt;/a&gt;&lt;/strong&gt;: Implements the &lt;code&gt;google-research/harness2&lt;/code&gt; &lt;code&gt;BenchmarkAdapter&lt;/code&gt; interface, connecting the Phase 4 Dataset with the Go &lt;code&gt;harness-runner&lt;/code&gt;.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  1. Implementing &lt;code&gt;internal/harness/trajectory.go&lt;/code&gt;: Rendering OpenTelemetry Spans as &lt;code&gt;trajectory.md&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;In Phase 5, our &lt;a href="https://github.com/kkdai/line-card-assistant/blob/main/internal/workflow/telemetry.go" rel="noopener noreferrer"&gt;&lt;code&gt;internal/workflow/telemetry.go&lt;/code&gt;&lt;/a&gt; already calls &lt;code&gt;startNodeSpan(ctx, "VisionOCRNode")&lt;/code&gt; in every Graph Node. Now, in &lt;a href="https://github.com/kkdai/line-card-assistant/blob/main/internal/harness/trajectory.go" rel="noopener noreferrer"&gt;&lt;code&gt;internal/harness/trajectory.go&lt;/code&gt;&lt;/a&gt;, we use &lt;code&gt;go.opentelemetry.io/otel/sdk/trace/tracetest.NewSpanRecorder()&lt;/code&gt; to intercept all completed node Spans and transform them into a Markdown trajectory report that the &lt;code&gt;Harness²&lt;/code&gt; Harvester LLM is best at reading:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight go"&gt;&lt;code&gt;&lt;span class="c"&gt;// InstallRecorder registers a new in-memory SpanRecorder as the global OTel TracerProvider&lt;/span&gt;
&lt;span class="c"&gt;// so every workflow.node.* span emitted by internal/workflow/telemetry.go is captured.&lt;/span&gt;
&lt;span class="k"&gt;func&lt;/span&gt; &lt;span class="n"&gt;InstallRecorder&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="n"&gt;TrajectoryRecorder&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;func&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="n"&gt;sr&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;tracetest&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;NewSpanRecorder&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="n"&gt;tp&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;sdktrace&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;NewTracerProvider&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;sdktrace&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;WithSpanProcessor&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;sr&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
    &lt;span class="n"&gt;prev&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="n"&gt;otel&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;GetTracerProvider&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="n"&gt;otel&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;SetTracerProvider&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;tp&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="n"&gt;rec&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="n"&gt;TrajectoryRecorder&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="n"&gt;recorder&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="n"&gt;sr&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;tp&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="n"&gt;tp&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="n"&gt;restore&lt;/span&gt; &lt;span class="o"&gt;:=&lt;/span&gt; &lt;span class="k"&gt;func&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;_&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;tp&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Shutdown&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;context&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Background&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;
        &lt;span class="n"&gt;otel&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;SetTracerProvider&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;prev&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;rec&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;restore&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;At the same time, we added three OpenTelemetry Attributes to &lt;a href="https://github.com/kkdai/line-card-assistant/blob/main/internal/workflow/telemetry.go" rel="noopener noreferrer"&gt;&lt;code&gt;internal/workflow/telemetry.go&lt;/code&gt;&lt;/a&gt;: &lt;code&gt;AttrNodeDecision&lt;/code&gt; (&lt;code&gt;adk.node.decision&lt;/code&gt;), &lt;code&gt;AttrNodeDiagnostic&lt;/code&gt; (&lt;code&gt;adk.node.diagnostic&lt;/code&gt;), and &lt;code&gt;AttrHarnessSkills&lt;/code&gt; (&lt;code&gt;adk.harness.skills&lt;/code&gt;). When &lt;code&gt;TrajectoryRecorder.RenderMarkdown()&lt;/code&gt; executes, it produces a high-resolution &lt;code&gt;trajectory.md&lt;/code&gt; like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight markdown"&gt;&lt;code&gt;&lt;span class="gh"&gt;# ADK 2.0 Go Graph Workflow Execution Trajectory&lt;/span&gt;
&lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="gs"&gt;**Task ID**&lt;/span&gt; : &lt;span class="sb"&gt;`challenge_colloquial_tw_search`&lt;/span&gt;
&lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="gs"&gt;**Harness Root**&lt;/span&gt; : &lt;span class="sb"&gt;`harness/base`&lt;/span&gt;
&lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="gs"&gt;**Always-On Bytes (`c1..c4`)**&lt;/span&gt;: &lt;span class="sb"&gt;`1599 / 24000`&lt;/span&gt;
&lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="gs"&gt;**Final Score**&lt;/span&gt; : &lt;span class="sb"&gt;`0.25`&lt;/span&gt;

&lt;span class="gu"&gt;## OpenTelemetry Node Spans (`workflow.node.*`)&lt;/span&gt;
&lt;span class="gu"&gt;### 1. `workflow.node.RouterNode`&lt;/span&gt;
&lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="gs"&gt;**Node**&lt;/span&gt; : &lt;span class="sb"&gt;`RouterNode`&lt;/span&gt; | &lt;span class="gs"&gt;**Status**&lt;/span&gt; : &lt;span class="sb"&gt;`OK`&lt;/span&gt; | &lt;span class="gs"&gt;**Duration**&lt;/span&gt; : &lt;span class="sb"&gt;`0.02 ms`&lt;/span&gt;
&lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="gs"&gt;**Decision**&lt;/span&gt; : &lt;span class="sb"&gt;`intent=search (colloquial_query=Help me find a Sales Director in Hsinchu Science Park working on AI chips, I need to contact Taiwan semiconductor clients)`&lt;/span&gt;
&lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="gs"&gt;**Diagnostic**&lt;/span&gt; : &lt;span class="sb"&gt;`routed search query to QueryIntentNode`&lt;/span&gt;

&lt;span class="gu"&gt;### 2. `workflow.node.QueryIntentNode`&lt;/span&gt;
&lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="gs"&gt;**Node**&lt;/span&gt; : &lt;span class="sb"&gt;`QueryIntentNode`&lt;/span&gt; | &lt;span class="gs"&gt;**Status**&lt;/span&gt; : &lt;span class="sb"&gt;`OK`&lt;/span&gt; | &lt;span class="gs"&gt;**Duration**&lt;/span&gt; : &lt;span class="sb"&gt;`0.04 ms`&lt;/span&gt;
&lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="gs"&gt;**Decision**&lt;/span&gt; : &lt;span class="sb"&gt;`parsed_filters={"location":"Hsinchu Science Park","role":"Sales Director","industry":"AI Chips"}`&lt;/span&gt;
&lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="gs"&gt;**Diagnostic**&lt;/span&gt; : &lt;span class="sb"&gt;`UNEXPANDED_COLLOQUIAL_FILTERS: colloquial Taiwan science park alias 'Hsinchu Science Park' and Mandarin title 'Sales Director' were passed literally without bilingual synonym expansion; add a c6 skill 'tw_semicon_search' with BILINGUAL_SYNONYM_MAP`&lt;/span&gt;

&lt;span class="gu"&gt;### 3. `workflow.node.HybridSearchNode`&lt;/span&gt;
&lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="gs"&gt;**Node**&lt;/span&gt; : &lt;span class="sb"&gt;`HybridSearchNode`&lt;/span&gt; | &lt;span class="gs"&gt;**Status**&lt;/span&gt; : &lt;span class="sb"&gt;`OK`&lt;/span&gt; | &lt;span class="gs"&gt;**Duration**&lt;/span&gt; : &lt;span class="sb"&gt;`0.03 ms`&lt;/span&gt;
&lt;span class="p"&gt;-&lt;/span&gt; &lt;span class="gs"&gt;**Decision**&lt;/span&gt; : &lt;span class="sb"&gt;`matched_cards=0 (strict literal filter on location='Hsinchu Science Park' failed against DB address='Hsinchu Science Park (竹科)')`&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Please pay attention to the Span records of the 2nd node &lt;code&gt;workflow.node.QueryIntentNode&lt;/code&gt; and the 3rd node &lt;code&gt;workflow.node.HybridSearchNode&lt;/code&gt;! Through this trajectory, the &lt;code&gt;Propose&lt;/code&gt; stage of &lt;code&gt;Harness²&lt;/code&gt; can see at a glance: &lt;strong&gt;&lt;code&gt;RouterNode&lt;/code&gt; was correct, the error was in &lt;code&gt;QueryIntentNode&lt;/code&gt; treating "Hsinchu Science Park" as a rigid string to query the English address field&lt;/strong&gt;!&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Expanding the Phase 4 Evaluation Set: &lt;code&gt;eval/datasets/harness2-challenge-dataset.json&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;To fully test &lt;code&gt;Harness²&lt;/code&gt;'s ability to retain existing capabilities (preventing catastrophic forgetting) and conquer difficult edge cases, we established &lt;strong&gt;8 tasks (totaling 32 fine-grained Rubrics)&lt;/strong&gt; in &lt;a href="https://github.com/kkdai/line-card-assistant/blob/main/eval/datasets/harness2-challenge-dataset.json" rel="noopener noreferrer"&gt;&lt;code&gt;eval/datasets/harness2-challenge-dataset.json&lt;/code&gt;&lt;/a&gt;:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Task Category&lt;/th&gt;
&lt;th&gt;Task ID&lt;/th&gt;
&lt;th&gt;Scenario Description&lt;/th&gt;
&lt;th&gt;4 Independent Scoring Rubrics (&lt;code&gt;r1..r4&lt;/code&gt;)&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Baseline (Regression)&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;baseline_ingest_ming_wang&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Standard Traditional Chinese card ingestion (Wang Xiaoming / Taiwan Cloud Tech)&lt;/td&gt;
&lt;td&gt;Intent routing, Name/Title extraction, E.164 phone normalization, Industry tag enrichment&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Baseline (Regression)&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;baseline_dedup_appier_promotion&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Duplicate detection for promotion (Lin Yating Senior $\rightarrow$ VP)&lt;/td&gt;
&lt;td&gt;Dedup detection, Title update, Keep new mobile, Company consistency&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Baseline (Regression)&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;baseline_search_cloud_summit_ai&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Standard keyword search (Cloud Summit + AI)&lt;/td&gt;
&lt;td&gt;Search routing, Multiple hits, Tag display, Interactive buttons&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Baseline (Regression)&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;baseline_email_google_cloud&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;General tech follow-up icebreaker (Chen Jianhong / Google Cloud)&lt;/td&gt;
&lt;td&gt;Email routing, Recipient/Event mention, Agenda link, Professional closing&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Challenge (Evolution 1)&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;challenge_jp_bilingual_ingest&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;
&lt;strong&gt;Bilingual JP/EN card OCR &amp;amp; JP phone normalization&lt;/strong&gt; (Kenta Sato / CTO / &lt;code&gt;+81 (0)3-1234-5678&lt;/code&gt;)&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;r1&lt;/code&gt; Routing, &lt;code&gt;r2&lt;/code&gt; Bilingual name retention, &lt;code&gt;r3&lt;/code&gt; &lt;strong&gt;JP &lt;code&gt;+81&lt;/code&gt; remove &lt;code&gt;(0)&lt;/code&gt; normalization&lt;/strong&gt;, &lt;code&gt;r4&lt;/code&gt; &lt;strong&gt;JP title bilingual mapping&lt;/strong&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Challenge (Evolution 2)&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;challenge_colloquial_tw_search&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;
&lt;strong&gt;Colloquial Taiwan tech alias search&lt;/strong&gt; ("Help me find a Sales Director in Hsinchu Science Park")&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;r1&lt;/code&gt; Routing, &lt;code&gt;r2&lt;/code&gt; &lt;strong&gt;Hsinchu Science Park $\leftrightarrow$ Hsinchu bilingual expansion hit&lt;/strong&gt;, &lt;code&gt;r3&lt;/code&gt; &lt;strong&gt;Sales Director $\leftrightarrow$ Sales Director title expansion&lt;/strong&gt;, &lt;code&gt;r4&lt;/code&gt; Tag completeness&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Challenge (Evolution 3)&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;challenge_noisy_multi_edit_hitl&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;
&lt;strong&gt;Multi-clause colloquial HITL continuous correction&lt;/strong&gt; ("Sorry, let me correct that, the title should be Group Senior VP, also change the end of the mobile to 8899, and add GDG DevFest speaker to notes")&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;r1&lt;/code&gt; HITL Edit routing, &lt;code&gt;r2&lt;/code&gt; &lt;strong&gt;Multi-field atomic update (Title)&lt;/strong&gt;, &lt;code&gt;r3&lt;/code&gt; &lt;strong&gt;Mobile suffix partial replacement &amp;amp; Note append&lt;/strong&gt;, &lt;code&gt;r4&lt;/code&gt; Retain original company/email&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Challenge (Evolution 4)&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;challenge_pii_safe_executive_followup&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;
&lt;strong&gt;Financial executive compliance &amp;amp; PII masking icebreaker&lt;/strong&gt; (Zhang Yazhu / Cathay Financial, Digital Risk Officer, requires privacy protection and compliance headers)&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;r1&lt;/code&gt; Email routing, &lt;code&gt;r2&lt;/code&gt; Executive title/scenario, &lt;code&gt;r3&lt;/code&gt; &lt;strong&gt;Mobile/Private Email PII Redaction&lt;/strong&gt;, &lt;code&gt;r4&lt;/code&gt; &lt;strong&gt;Financial compliance subject header &lt;code&gt;[Confidential / FinTech Compliance Verified]&lt;/code&gt;&lt;/strong&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  3. Implementing &lt;code&gt;harness/line_card_adapter.py&lt;/code&gt;: Connecting to &lt;code&gt;google-research/harness2&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;Finally, we implemented the &lt;code&gt;LineCardAdapter&lt;/code&gt; in &lt;a href="https://github.com/kkdai/line-card-assistant/blob/main/harness/line_card_adapter.py" rel="noopener noreferrer"&gt;&lt;code&gt;harness/line_card_adapter.py&lt;/code&gt;&lt;/a&gt;, connecting all the above components:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;LineCardAdapter&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="sh"&gt;"""&lt;/span&gt;&lt;span class="s"&gt;Adapts `line-card-assistant` to the `google-research/harness2` BenchmarkAdapter protocol.&lt;/span&gt;&lt;span class="sh"&gt;"""&lt;/span&gt;

    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;list_tasks&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="nb"&gt;list&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;TaskBrief&lt;/span&gt;&lt;span class="p"&gt;]:&lt;/span&gt;
        &lt;span class="sh"&gt;"""&lt;/span&gt;&lt;span class="s"&gt;Return public task briefs with zero ground-truth rubric leakage.&lt;/span&gt;&lt;span class="sh"&gt;"""&lt;/span&gt;
        &lt;span class="n"&gt;briefs&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;list&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;TaskBrief&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[]&lt;/span&gt;
        &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;raw&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;_raw_cases&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="c1"&gt;# Strip `rubrics` and `expected_*` so the agent/harvester never sees ground truth.
&lt;/span&gt;            &lt;span class="n"&gt;briefs&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;append&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
                &lt;span class="nc"&gt;TaskBrief&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
                    &lt;span class="n"&gt;task_id&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;raw&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;id&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
                    &lt;span class="n"&gt;prompt&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;raw&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;prompt&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
                    &lt;span class="n"&gt;context&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
                        &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;category&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;raw&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;category&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;general&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
                        &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;description&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;raw&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;description&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;""&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
                        &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;session_input&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;raw&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;session_input&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{}),&lt;/span&gt;
                    &lt;span class="p"&gt;},&lt;/span&gt;
                &lt;span class="p"&gt;)&lt;/span&gt;
            &lt;span class="p"&gt;)&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;briefs&lt;/span&gt;

    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;run&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;harness&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;Harness&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;task&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;TaskBrief&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;RunArtifact&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="sh"&gt;"""&lt;/span&gt;&lt;span class="s"&gt;Mount `harness` in a temporary directory and execute the Go Graph Workflow runner.&lt;/span&gt;&lt;span class="sh"&gt;"""&lt;/span&gt;
        &lt;span class="n"&gt;problems&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;harness&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;validate&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;problems&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="n"&gt;diag&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;# Harness Validation Failed&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="se"&gt;\n&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;join&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;- &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;p&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;p&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;problems&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
            &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nc"&gt;RunArtifact&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;task_id&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;task&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;task_id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;deliverable&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;""&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;trajectory&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;diag&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

        &lt;span class="k"&gt;with&lt;/span&gt; &lt;span class="n"&gt;tempfile&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;TemporaryDirectory&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;prefix&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;line_card_harness_&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;task&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;task_id&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt;_&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;tmp_dir&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
            &lt;span class="n"&gt;harness_root&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Path&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;tmp_dir&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
            &lt;span class="n"&gt;harness&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;materialize&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;harness_root&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
            &lt;span class="c1"&gt;# Invoke the compiled Go binary with --harness-dir pointing to the materialized c1..c8 tree
&lt;/span&gt;            &lt;span class="n"&gt;proc&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;subprocess&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;run&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
                &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nf"&gt;str&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;binary&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;--harness-dir=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;harness_root&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;--task-json=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;task_payload_path&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
                &lt;span class="n"&gt;capture_output&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;True&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;text&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;True&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;check&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;False&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;timeout&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;30&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="p"&gt;)&lt;/span&gt;
            &lt;span class="n"&gt;payload&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;json&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;loads&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;proc&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;stdout&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
            &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nc"&gt;RunArtifact&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
                &lt;span class="n"&gt;task_id&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;task&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;task_id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
                &lt;span class="n"&gt;deliverable&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;payload&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;deliverable&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;""&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
                &lt;span class="n"&gt;trajectory&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;payload&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;trajectory_markdown&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;""&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
                &lt;span class="n"&gt;raw&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;payload&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="p"&gt;)&lt;/span&gt;

    &lt;span class="k"&gt;def&lt;/span&gt; &lt;span class="nf"&gt;score&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;task&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;TaskBrief&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;artifact&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;RunArtifact&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;ScoreResult&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="sh"&gt;"""&lt;/span&gt;&lt;span class="s"&gt;Evaluate the deliverable against isolated per-rubric criteria.&lt;/span&gt;&lt;span class="sh"&gt;"""&lt;/span&gt;
        &lt;span class="n"&gt;raw&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;_cases_by_id&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;task&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;task_id&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
        &lt;span class="n"&gt;rubrics&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;raw&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;rubrics&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{})&lt;/span&gt;
        &lt;span class="n"&gt;per_rubric&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;dict&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nb"&gt;str&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nb"&gt;float&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{}&lt;/span&gt;
        &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;rubric_id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;spec&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;rubrics&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;items&lt;/span&gt;&lt;span class="p"&gt;():&lt;/span&gt;
            &lt;span class="n"&gt;per_rubric&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;rubric_id&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mf"&gt;1.0&lt;/span&gt; &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;self&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;_evaluate_rubric&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;artifact&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;deliverable&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;spec&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="mf"&gt;0.0&lt;/span&gt;
        &lt;span class="n"&gt;total&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;sum&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;per_rubric&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;values&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt; &lt;span class="o"&gt;/&lt;/span&gt; &lt;span class="nf"&gt;len&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;per_rubric&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;per_rubric&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="mf"&gt;0.0&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nc"&gt;ScoreResult&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;task_id&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;task&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;task_id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;total&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nf"&gt;round&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;total&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="n"&gt;per_rubric&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;per_rubric&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Through this &lt;code&gt;LineCardAdapter&lt;/code&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;  Whenever &lt;code&gt;Harness²&lt;/code&gt; proposes a new candidate Harness $H’$, &lt;code&gt;adapter.run(harness, task)&lt;/code&gt; first calls &lt;code&gt;harness.validate()&lt;/code&gt; to check the 24KB &lt;code&gt;OPENCODE_SURFACE&lt;/code&gt; limit and Skill Frontmatter rules.&lt;/li&gt;
&lt;li&gt;  Once validated, the &lt;code&gt;c1..c8&lt;/code&gt; files of $H’$ are materialized into a temporary directory and passed to Go's &lt;code&gt;harness-runner&lt;/code&gt; for execution.&lt;/li&gt;
&lt;li&gt;  After the Go 13-node Graph Workflow finishes, it returns the final LINE message (&lt;code&gt;deliverable&lt;/code&gt;) and OpenTelemetry trajectory (&lt;code&gt;trajectory_markdown&lt;/code&gt;), which are then passed to &lt;code&gt;adapter.score()&lt;/code&gt; for leakage-free independent scoring!&lt;/li&gt;
&lt;/ul&gt;




&lt;h1&gt;
  
  
  III. Summary and Teaser for the Next Part
&lt;/h1&gt;

&lt;p&gt;In this post (Part 2), we completed the core engineering for &lt;strong&gt;&lt;a href="https://github.com/kkdai/line-card-assistant/issues/17" rel="noopener noreferrer"&gt;Issue #17&lt;/a&gt;&lt;/strong&gt;:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt; Clarified why the golden test set cannot be fed directly to the optimizer — through the &lt;strong&gt;&lt;code&gt;TaskBrief&lt;/code&gt; Zero-Leakage Barrier&lt;/strong&gt;, we force &lt;code&gt;Harness²&lt;/code&gt; to reason out general skills from behavioral trajectories rather than memorizing answers.&lt;/li&gt;
&lt;li&gt; Through &lt;a href="https://github.com/kkdai/line-card-assistant/blob/main/internal/harness/trajectory.go" rel="noopener noreferrer"&gt;&lt;code&gt;internal/harness/trajectory.go&lt;/code&gt;&lt;/a&gt; and &lt;a href="https://github.com/kkdai/line-card-assistant/blob/main/cmd/harness-runner/main.go" rel="noopener noreferrer"&gt;&lt;code&gt;cmd/harness-runner/main.go&lt;/code&gt;&lt;/a&gt;, we transformed &lt;strong&gt;Phase 5's OpenTelemetry &lt;code&gt;workflow.node.*&lt;/code&gt; Spans&lt;/strong&gt; into high-resolution &lt;code&gt;trajectory.md&lt;/code&gt;, opening the black box of the 13-node Graph Workflow.&lt;/li&gt;
&lt;li&gt; Established &lt;a href="https://github.com/kkdai/line-card-assistant/blob/main/eval/datasets/harness2-challenge-dataset.json" rel="noopener noreferrer"&gt;&lt;code&gt;eval/datasets/harness2-challenge-dataset.json&lt;/code&gt;&lt;/a&gt; (8 major tasks, 32 fine-grained Rubrics) and &lt;a href="https://github.com/kkdai/line-card-assistant/blob/main/harness/line_card_adapter.py" rel="noopener noreferrer"&gt;&lt;code&gt;harness/line_card_adapter.py&lt;/code&gt;&lt;/a&gt;, perfectly implementing the &lt;code&gt;Harness²&lt;/code&gt; &lt;code&gt;BenchmarkAdapter&lt;/code&gt; protocol.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Everything is ready! In the final post &lt;strong&gt;&lt;a href="https://dev.to/2026/10/27/adk-graph-workflow-go-9/"&gt;[Agent Platform in Practice (9)] When ADK Go Graph Workflow Meets Google Research Harness² (Part 3): Dual-Layer Recursive Testing Guide, 62.5% to 100% Performance Results, and the Future of AgentOps&lt;/a&gt;&lt;/strong&gt; (corresponding to &lt;strong&gt;&lt;a href="https://github.com/kkdai/line-card-assistant/issues/18" rel="noopener noreferrer"&gt;Issue #18&lt;/a&gt;&lt;/strong&gt;), we will actually launch the dual-layer recursive optimization experiment, reveal the complete quantitative data evolving from &lt;code&gt;62.5%&lt;/code&gt; to &lt;code&gt;100.0%&lt;/code&gt;, and discuss the profound impact of &lt;code&gt;Harness²&lt;/code&gt; on future enterprise-grade Agent development!&lt;/p&gt;

</description>
      <category>agents</category>
      <category>ai</category>
      <category>go</category>
      <category>llm</category>
    </item>
    <item>
      <title>[Agent Platform in Action (9)] When ADK Go Graph Workflow Meets Google Research Harness (Part 2): Two-layer Recursive Testing Gu</title>
      <dc:creator>Evan Lin</dc:creator>
      <pubDate>Sun, 01 Nov 2026 14:36:51 +0000</pubDate>
      <link>https://dev.to/gde/agent-platform-in-action-9-when-adk-go-graph-workflow-meets-google-research-harness-part-2-1olm</link>
      <guid>https://dev.to/gde/agent-platform-in-action-9-when-adk-go-graph-workflow-meets-google-research-harness-part-2-1olm</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Frmuecj0ixueufuhe5l1s.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Frmuecj0ixueufuhe5l1s.png" alt="Harness² Part 3: Recursive Optimization Benchmark &amp;amp; Future AgentOps Outlook" width="800" height="447"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  Introduction: From "Manual Prompt Tuning" to "Two-Layer Recursive Autonomous Evolution"
&lt;/h1&gt;

&lt;p&gt;Welcome to the final part of the &lt;strong&gt;Agent Platform in Practice&lt;/strong&gt; Harness² trilogy! In the previous two articles:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;&lt;a href="https://dev.to/2026/10/25/adk-graph-workflow-go-7/"&gt;[Agent Platform in Practice (7)] When ADK Go Graph Workflow Meets Google Research Harness² (Part 1): Understanding the Two-Layer Recursive Agent Harnessing Framework and c1..c8 Decoupling Practice&lt;/a&gt;&lt;/strong&gt; (&lt;strong&gt;&lt;a href="https://github.com/kkdai/line-card-assistant/issues/16" rel="noopener noreferrer"&gt;Issue #16&lt;/a&gt;&lt;/strong&gt;): We introduced Google Research's &lt;strong&gt;&lt;a href="https://github.com/google-research/harness2" rel="noopener noreferrer"&gt;&lt;code&gt;google-research/harness2&lt;/code&gt; (arXiv:2610.14224)&lt;/a&gt;&lt;/strong&gt; and decoupled the 13-node Graph Workflow of &lt;strong&gt;&lt;a href="https://github.com/kkdai/line-card-assistant" rel="noopener noreferrer"&gt;LINE AI Card Master (&lt;code&gt;kkdai/line-card-assistant&lt;/code&gt;)&lt;/a&gt;&lt;/strong&gt; into an &lt;strong&gt;editable &lt;code&gt;c1..c8&lt;/code&gt; file tree&lt;/strong&gt; supporting dynamic mounting via &lt;code&gt;LINE_CARD_HARNESS_DIR&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;a href="https://dev.to/2026/10/26/adk-graph-workflow-go-8/"&gt;[Agent Platform in Practice (8)] When ADK Go Graph Workflow Meets Google Research Harness² (Part 2): Turning Phase 4 Eval Datasets and Phase 5 OpenTelemetry Spans into LineCardAdapter&lt;/a&gt;&lt;/strong&gt; (&lt;strong&gt;&lt;a href="https://github.com/kkdai/line-card-assistant/issues/17" rel="noopener noreferrer"&gt;Issue #17&lt;/a&gt;&lt;/strong&gt;): We encapsulated Phase 4's &lt;code&gt;eval/datasets/&lt;/code&gt; and Phase 5's OpenTelemetry &lt;code&gt;workflow.node.*&lt;/code&gt; Spans into a &lt;code&gt;LineCardAdapter&lt;/code&gt;, establishing a &lt;strong&gt;Zero-Leakage Barrier&lt;/strong&gt; and &lt;strong&gt;High-Resolution Behavior Trajectories (&lt;code&gt;trajectory.md&lt;/code&gt;)&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In this post (the final part, corresponding to &lt;strong&gt;&lt;a href="https://github.com/kkdai/line-card-assistant/issues/18" rel="noopener noreferrer"&gt;Issue #18&lt;/a&gt;&lt;/strong&gt; and &lt;strong&gt;&lt;a href="https://github.com/kkdai/line-card-assistant/pull/19" rel="noopener noreferrer"&gt;PR #19&lt;/a&gt;&lt;/strong&gt;), we will answer the last three key questions:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;How to test after modifications?&lt;/strong&gt; (A complete testing guide from Go unit tests, CLI single-point diagnosis, Python two-layer recursive experiments to production environment mounting)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;What is the overall performance after modifications?&lt;/strong&gt; (Publicly disclosing quantitative data and evolutionary details from &lt;code&gt;Base 62.5%&lt;/code&gt; $\rightarrow$ &lt;code&gt;k=1 84.4%&lt;/code&gt; $\rightarrow$ &lt;code&gt;k=2 Parallel 96.9%&lt;/code&gt; $\rightarrow$ &lt;code&gt;k=2 Sequential + Memory 100.0%&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;What are the future outlooks and application scenarios for &lt;code&gt;Harness²&lt;/code&gt; and Agents?&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;




&lt;h1&gt;
  
  
  1. How to test after modifications? (Step-by-Step Testing and Verification Guide)
&lt;/h1&gt;

&lt;p&gt;After introducing &lt;code&gt;Harness²&lt;/code&gt;, the entire project features four levels of testing and verification: &lt;strong&gt;Go native unit testing&lt;/strong&gt;, &lt;strong&gt;single-task OpenTelemetry trajectory diagnosis&lt;/strong&gt;, &lt;strong&gt;Python two-layer recursive evolution experiments&lt;/strong&gt;, and &lt;strong&gt;seamless production environment switching&lt;/strong&gt;:&lt;/p&gt;

&lt;h2&gt;
  
  
  Level 1: Execute Go &lt;code&gt;c1..c8&lt;/code&gt; Surface Constraints and Project-wide Unit Tests
&lt;/h2&gt;

&lt;p&gt;We have written comprehensive unit tests in &lt;a href="https://github.com/kkdai/line-card-assistant/blob/main/internal/harness/harness_test.go" rel="noopener noreferrer"&gt;&lt;code&gt;internal/harness/harness_test.go&lt;/code&gt;&lt;/a&gt; to verify:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;All &lt;code&gt;c1..c8&lt;/code&gt; file trees under &lt;code&gt;harness/base/&lt;/code&gt; and &lt;code&gt;harness/evolved/&lt;/code&gt; comply with the &lt;code&gt;OPENCODE_SURFACE&lt;/code&gt; 24KB resident byte limit (&lt;code&gt;AlwaysOnMaxBytes = 24000&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;Validate()&lt;/code&gt; accurately intercepts and reports errors when &lt;code&gt;c1..c4&lt;/code&gt; exceeds 24,000 bytes.&lt;/li&gt;
&lt;li&gt;When a new &lt;code&gt;c6&lt;/code&gt; skill (&lt;code&gt;skills/&amp;lt;name&amp;gt;/SKILL.md&lt;/code&gt;) is added but no trigger index (Trigger Line) is added to &lt;code&gt;systemprompt.md&lt;/code&gt; or &lt;code&gt;guardrails.md&lt;/code&gt;, &lt;code&gt;Validate()&lt;/code&gt; immediately intercepts the orphan skill.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;TrajectoryRecorder&lt;/code&gt; correctly intercepts OpenTelemetry &lt;code&gt;workflow.node.*&lt;/code&gt; Spans and renders a Markdown report containing node decisions and diagnostics.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Execution command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Execute Harness² c1..c8 loader and OpenTelemetry trajectory tests
$ go test -v ./internal/harness/...
=== RUN TestLoadBaseHarnessAndValidate
--- PASS: TestLoadBaseHarnessAndValidate (0.00s)
=== RUN TestValidateRejectsOversizedAlwaysOnAndUnreferencedSkill
--- PASS: TestValidateRejectsOversizedAlwaysOnAndUnreferencedSkill (0.00s)
=== RUN TestEvolvedHarnessesValidateAndMatchSkills
--- PASS: TestEvolvedHarnessesValidateAndMatchSkills (0.00s)
=== RUN TestTrajectoryRecorderRendersWorkflowNodeSpans
--- PASS: TestTrajectoryRecorderRendersWorkflowNodeSpans (0.00s)
PASS
ok github.com/kkdai/line-card-assistant/internal/harness

# Execute project-wide regression tests (ensuring 100% compatibility with all existing Phase 1~5 features)
$ go test ./...
ok github.com/kkdai/line-card-assistant/app
ok github.com/kkdai/line-card-assistant/cmd/harness-runner
ok github.com/kkdai/line-card-assistant/cmd/line-gateway
ok github.com/kkdai/line-card-assistant/eval
ok github.com/kkdai/line-card-assistant/internal/harness
ok github.com/kkdai/line-card-assistant/internal/storage
ok github.com/kkdai/line-card-assistant/internal/webhook
ok github.com/kkdai/line-card-assistant/internal/workflow
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Level 2: Use &lt;code&gt;cmd/harness-runner&lt;/code&gt; to Validate Any &lt;code&gt;c1..c8&lt;/code&gt; File Tree
&lt;/h2&gt;

&lt;p&gt;Before mounting any custom or evolved Harness online, you can use &lt;code&gt;--validate-only&lt;/code&gt; to quickly check its &lt;code&gt;c1..c4&lt;/code&gt; resident byte count and YAML Frontmatter compliance:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;go run ./cmd/harness-runner &lt;span class="nt"&gt;--validate-only&lt;/span&gt; &lt;span class="nt"&gt;--harness-dir&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;harness/base
OK &lt;span class="o"&gt;(&lt;/span&gt;1599 always-on bytes&lt;span class="o"&gt;)&lt;/span&gt;

&lt;span class="nv"&gt;$ &lt;/span&gt;go run ./cmd/harness-runner &lt;span class="nt"&gt;--validate-only&lt;/span&gt; &lt;span class="nt"&gt;--harness-dir&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;harness/evolved/k2_sequential_memory
OK &lt;span class="o"&gt;(&lt;/span&gt;4661 always-on bytes&lt;span class="o"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Level 3: Execute the Four-Stage &lt;code&gt;Harness²&lt;/code&gt; Two-Layer Recursive Evolution Benchmark Experiment
&lt;/h2&gt;

&lt;p&gt;We implemented a complete two-layer recursive experiment script in &lt;a href="https://github.com/kkdai/line-card-assistant/blob/main/harness/run_harness2_experiment.py" rel="noopener noreferrer"&gt;&lt;code&gt;harness/run_harness2_experiment.py&lt;/code&gt;&lt;/a&gt;. It automatically compiles the Go &lt;code&gt;harness-runner&lt;/code&gt; and sequentially evaluates four configurations against the 8 major tasks (32 independent Rubrics) in &lt;a href="https://github.com/kkdai/line-card-assistant/blob/main/eval/datasets/harness2-challenge-dataset.json" rel="noopener noreferrer"&gt;&lt;code&gt;eval/datasets/harness2-challenge-dataset.json&lt;/code&gt;&lt;/a&gt;, finally outputting a Markdown comparison table and &lt;a href="https://github.com/kkdai/line-card-assistant/blob/main/harness/experiment_report.json" rel="noopener noreferrer"&gt;&lt;code&gt;harness/experiment_report.json&lt;/code&gt;&lt;/a&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ python3 harness/run_harness2_experiment.py
### Overall Configuration Comparison

| Stage | Configuration | Task Score (Max 8.0) | Rubric Pass Rate | Always-On Bytes (Cap 24,000) | Active `c6` Skills | `LongTermMEMORY.md` |
| :--- | :--- | :---: | :---: | :---: | :--- | :---: |
| `base_k0` | **Base Harness ($k=0$)** | `5.00 / 8.00` | `20/32 (62.5%)` | `1599 B` | `(none)` | `No` |
| `k1_single_step` | **Single-Step Propose-Probe-Compose ($k=1$)** | `6.75 / 8.00` | `27/32 (84.4%)` | `2505 B` | `jp_card_ocr, tw_semicon_search` | `No` |
| `k2_parallel` | **Multi-Step Parallel Recursion ($k=2$, No Memory)** | `7.75 / 8.00` | `31/32 (96.9%)` | `2998 B` | `executive_email_drafter, hitl_multi_edit, jp_card_ocr, tw_semicon_search` | `No` |
| `k2_sequential_memory` | **Multi-Step Sequential Recursion + `LongTermMEMORY.md` ($k=2$)** | `8.00 / 8.00` | `32/32 (100.0%)` | `4661 B` | `executive_email_drafter, hitl_multi_edit, jp_card_ocr, tw_semicon_search` | `Yes` |
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Level 4: Directly Mount the Best Evolved Harness in Production or Local Servers
&lt;/h2&gt;

&lt;p&gt;Once &lt;code&gt;Harness²&lt;/code&gt; evolves the optimal &lt;code&gt;harness/evolved/k2_sequential_memory&lt;/code&gt;, &lt;strong&gt;no modification to any line of Go code is required&lt;/strong&gt;. Simply specify the directory via the environment variable &lt;code&gt;LINE_CARD_HARNESS_DIR&lt;/code&gt;, and both the dual-channel main program (&lt;code&gt;main.go&lt;/code&gt;) and the evaluator (&lt;code&gt;eval/&lt;/code&gt;) will immediately load the evolved harness tree:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ LINE_CARD_HARNESS_DIR&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;harness/evolved/k2_sequential_memory go run &lt;span class="nb"&gt;.&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h1&gt;
  
  
  2. Performance Summary: Evolutionary Analysis from &lt;code&gt;62.5%&lt;/code&gt; to &lt;code&gt;100.0%&lt;/code&gt;
&lt;/h1&gt;

&lt;p&gt;Let's take a deep dive into the four-stage quantitative experimental data recorded in &lt;a href="https://github.com/kkdai/line-card-assistant/blob/main/harness/experiment_report.json" rel="noopener noreferrer"&gt;&lt;code&gt;harness/experiment_report.json&lt;/code&gt;&lt;/a&gt; to see how &lt;code&gt;Harness²&lt;/code&gt; diagnosed and patched the Go Agent's flaws step-by-step!&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Four-Stage Overall and Single-Task Score Summary
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Evaluation Metric / Test Task&lt;/th&gt;
&lt;th&gt;
&lt;strong&gt;Stage 0: Base Harness ($k=0$)&lt;/strong&gt; (&lt;code&gt;harness/base&lt;/code&gt;)&lt;/th&gt;
&lt;th&gt;
&lt;strong&gt;Stage 1: Single-Step Inner Recursion ($k=1$)&lt;/strong&gt; (&lt;code&gt;k1_single_step&lt;/code&gt;)&lt;/th&gt;
&lt;th&gt;
&lt;strong&gt;Stage 2: Multi-Step Parallel Recursion ($k=2$, No Memory)&lt;/strong&gt; (&lt;code&gt;k2_parallel&lt;/code&gt;)&lt;/th&gt;
&lt;th&gt;
&lt;strong&gt;Stage 3: Two-Layer Sequential Recursion + Long-Term Memory ($k=2$)&lt;/strong&gt; (&lt;code&gt;k2_sequential_memory&lt;/code&gt;)&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;strong&gt;&lt;code&gt;baseline_ingest_ming_wang&lt;/code&gt;&lt;/strong&gt; (Standard Chinese Entry)&lt;/td&gt;
&lt;td&gt;&lt;code&gt;1.00 (4/4)&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;1.00 (4/4)&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;1.00 (4/4)&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;&lt;code&gt;1.00 (4/4)&lt;/code&gt;&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;strong&gt;&lt;code&gt;baseline_dedup_appier_promotion&lt;/code&gt;&lt;/strong&gt; (Promotion Deduplication Update)&lt;/td&gt;
&lt;td&gt;&lt;code&gt;1.00 (4/4)&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;1.00 (4/4)&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;1.00 (4/4)&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;&lt;code&gt;1.00 (4/4)&lt;/code&gt;&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;strong&gt;&lt;code&gt;baseline_search_cloud_summit_ai&lt;/code&gt;&lt;/strong&gt; (Standard Keyword Search)&lt;/td&gt;
&lt;td&gt;&lt;code&gt;1.00 (4/4)&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;1.00 (4/4)&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;1.00 (4/4)&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;&lt;code&gt;1.00 (4/4)&lt;/code&gt;&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;strong&gt;&lt;code&gt;baseline_email_google_cloud&lt;/code&gt;&lt;/strong&gt; (General Tech Icebreaker Email)&lt;/td&gt;
&lt;td&gt;&lt;code&gt;1.00 (4/4)&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;1.00 (4/4)&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;1.00 (4/4)&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;&lt;code&gt;1.00 (4/4)&lt;/code&gt;&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;strong&gt;&lt;code&gt;challenge_jp_bilingual_ingest&lt;/code&gt;&lt;/strong&gt; (JP-EN Bilingual Card OCR)&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;0.25 (1/4)&lt;/code&gt; ❌&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;1.00 (4/4)&lt;/code&gt; ✅&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;1.00 (4/4)&lt;/code&gt; ✅&lt;/td&gt;
&lt;td&gt;
&lt;strong&gt;&lt;code&gt;1.00 (4/4)&lt;/code&gt;&lt;/strong&gt; ✅&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;strong&gt;&lt;code&gt;challenge_colloquial_tw_search&lt;/code&gt;&lt;/strong&gt; (Hsinchu Science Park Colloquial Search)&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;0.25 (1/4)&lt;/code&gt; ❌&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;1.00 (4/4)&lt;/code&gt; ✅&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;1.00 (4/4)&lt;/code&gt; ✅&lt;/td&gt;
&lt;td&gt;
&lt;strong&gt;&lt;code&gt;1.00 (4/4)&lt;/code&gt;&lt;/strong&gt; ✅&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;strong&gt;&lt;code&gt;challenge_noisy_multi_edit_hitl&lt;/code&gt;&lt;/strong&gt; (Multi-clause Colloquial HITL Edit)&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;0.25 (1/4)&lt;/code&gt; ❌&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;0.25 (1/4)&lt;/code&gt; ❌&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;1.00 (4/4)&lt;/code&gt; ✅&lt;/td&gt;
&lt;td&gt;
&lt;strong&gt;&lt;code&gt;1.00 (4/4)&lt;/code&gt;&lt;/strong&gt; ✅&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;strong&gt;&lt;code&gt;challenge_pii_safe_executive_followup&lt;/code&gt;&lt;/strong&gt; (Financial Exec Compliance Icebreaker)&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;0.25 (1/4)&lt;/code&gt; ❌&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;0.50 (2/4)&lt;/code&gt; ⚠️&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;0.75 (3/4)&lt;/code&gt; ⚠️&lt;/td&gt;
&lt;td&gt;
&lt;strong&gt;&lt;code&gt;1.00 (4/4)&lt;/code&gt;&lt;/strong&gt; ✅&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Total Task Score (Max 8.00)&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;&lt;code&gt;5.00 / 8.00&lt;/code&gt;&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;&lt;code&gt;6.75 / 8.00&lt;/code&gt;&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;&lt;code&gt;7.75 / 8.00&lt;/code&gt;&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;&lt;code&gt;8.00 / 8.00&lt;/code&gt;&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Fine-grained Rubric Pass Rate (Max 32)&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;&lt;code&gt;20 / 32 (62.5%)&lt;/code&gt;&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;&lt;code&gt;27 / 32 (84.4%)&lt;/code&gt;&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;&lt;code&gt;31 / 32 (96.9%)&lt;/code&gt;&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;&lt;code&gt;32 / 32 (100.0%)&lt;/code&gt;&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Resident Bytes (&lt;code&gt;c1..c4&lt;/code&gt; / 24,000 B)&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;1,599 B (6.7%)&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;2,505 B (10.4%)&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;2,998 B (12.5%)&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;4,661 B (19.4%)&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;On-demand Skills (&lt;code&gt;c6&lt;/code&gt; Skills)&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;0&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;2&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;4&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;&lt;code&gt;4 + LongTermMEMORY&lt;/code&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h2&gt;
  
  
  2. Key Findings Analysis: What evolved in each stage?
&lt;/h2&gt;

&lt;h3&gt;
  
  
  🔹 Stage 0 $\rightarrow$ Stage 1 (&lt;code&gt;62.5%&lt;/code&gt; $\rightarrow$ &lt;code&gt;84.4%&lt;/code&gt;): Diagnosing the first two on-demand skills (&lt;code&gt;c6&lt;/code&gt;) from OpenTelemetry trajectories
&lt;/h3&gt;

&lt;p&gt;In the &lt;code&gt;Base Harness ($k=0$)&lt;/code&gt;, while all 4 Baseline tasks scored full points (&lt;code&gt;4.00/4.00&lt;/code&gt;), all 4 Challenge tasks scored only &lt;code&gt;0.25&lt;/code&gt; because they only passed the &lt;code&gt;RouterNode&lt;/code&gt; intent routing:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;In the &lt;code&gt;trajectory.md&lt;/code&gt; of &lt;code&gt;challenge_jp_bilingual_ingest&lt;/code&gt;, the Spans for &lt;code&gt;VisionOCRNode&lt;/code&gt; and &lt;code&gt;CleanAndDedupNode&lt;/code&gt; diagnosed that the Japanese phone number &lt;code&gt;+81 (0)3-1234-5678&lt;/code&gt; failed to strip the domestic trunk prefix &lt;code&gt;(0)&lt;/code&gt;, and the Japanese title &lt;code&gt;取締役 最高技術責任者 (CTO)&lt;/code&gt; failed to retain the bilingual title.&lt;/li&gt;
&lt;li&gt;In the &lt;code&gt;trajectory.md&lt;/code&gt; of &lt;code&gt;challenge_colloquial_tw_search&lt;/code&gt;, the &lt;code&gt;QueryIntentNode&lt;/code&gt; Span diagnosed that colloquial Taiwanese terms like "Hsinchu Science Park" (竹科) and "Sales Director" (業務總監) were not expanded into bilingual synonyms.&lt;/li&gt;
&lt;li&gt;After the first round of inner recursion (&lt;code&gt;Propose -&amp;gt; Probe -&amp;gt; Compose&lt;/code&gt;), &lt;code&gt;Harness²&lt;/code&gt; automatically synthesized &lt;code&gt;skills/jp_card_ocr/SKILL.md&lt;/code&gt; and &lt;code&gt;skills/tw_semicon_search/SKILL.md&lt;/code&gt; in &lt;code&gt;k1_single_step&lt;/code&gt;, and updated the PII masking rules in &lt;code&gt;guardrails.md&lt;/code&gt;, jumping the accuracy from &lt;strong&gt;&lt;code&gt;62.5%&lt;/code&gt; to &lt;code&gt;84.4%&lt;/code&gt;&lt;/strong&gt;!&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  🔹 Stage 1 $\rightarrow$ Stage 2 (&lt;code&gt;84.4%&lt;/code&gt; $\rightarrow$ &lt;code&gt;96.9%&lt;/code&gt;): Second round of recursion conquers multi-clause HITL modification and executive email structure
&lt;/h3&gt;

&lt;p&gt;In the second round of inner recursion, &lt;code&gt;Harness²&lt;/code&gt; continued to probe the remaining two failing tasks:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;For &lt;code&gt;challenge_noisy_multi_edit_hitl&lt;/code&gt; (where &lt;code&gt;ApplyEditNode&lt;/code&gt; only modified the title in the first clause, missing the mobile suffix replacement and note addition), it evolved &lt;code&gt;skills/hitl_multi_edit/SKILL.md&lt;/code&gt; (containing &lt;code&gt;ATOMIC_MULTI_CLAUSE_EDIT&lt;/code&gt; rules).&lt;/li&gt;
&lt;li&gt;For &lt;code&gt;challenge_pii_safe_executive_followup&lt;/code&gt; (where &lt;code&gt;EmailDraftNode&lt;/code&gt; lacked structured executive follow-up paragraphs), it evolved &lt;code&gt;skills/executive_email_drafter/SKILL.md&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;At this point, under &lt;strong&gt;Parallel Recursion (no cross-round long-term memory)&lt;/strong&gt;, the score reached &lt;strong&gt;&lt;code&gt;31/32 (96.9%)&lt;/code&gt;&lt;/strong&gt;!&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  🔹 Stage 2 $\rightarrow$ Stage 3 (&lt;code&gt;96.9%&lt;/code&gt; $\rightarrow$ &lt;code&gt;100.0%&lt;/code&gt;): Why is &lt;code&gt;Sequential + LongTermMEMORY.md&lt;/code&gt; needed to complete the final 3.1%?
&lt;/h3&gt;

&lt;p&gt;Why did &lt;code&gt;k2_parallel&lt;/code&gt; get &lt;code&gt;96.9%&lt;/code&gt; (31/32), yet fail on the 4th Rubric (&lt;code&gt;r4_fintech_compliance_subject_tag&lt;/code&gt;) of &lt;code&gt;challenge_pii_safe_executive_followup&lt;/code&gt;?&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Because in cross-enterprise outgoing emails for financial institutions (e.g., Digital Risk Officer at Cathay Financial Holdings), beyond single-skill email formatting, cross-domain &lt;strong&gt;industry compliance memory (FinTech Outbound Compliance Header &lt;code&gt;[Confidential / FinTech Compliance Verified]&lt;/code&gt;)&lt;/strong&gt; is required.&lt;/li&gt;
&lt;li&gt;In &lt;strong&gt;Sequential Recursion + &lt;code&gt;Experience Reflector&lt;/code&gt;&lt;/strong&gt; mode, the outer recursion reviewed the residual failure trajectories from the first to the second round. The &lt;code&gt;ReflectorPrompt&lt;/code&gt; then wrote the &lt;code&gt;FINTECH_COMPLIANCE_SUBJECT_TAG&lt;/code&gt; and cross-channel PII protection principles into the resident component &lt;strong&gt;&lt;code&gt;c3: LongTermMEMORY.md&lt;/code&gt;&lt;/strong&gt;!&lt;/li&gt;
&lt;li&gt;Note the &lt;strong&gt;Resident Bytes (Always-On Bytes)&lt;/strong&gt;: even with 4 rich domain skills and long-term memory evolved, the resident size of &lt;code&gt;c1..c4&lt;/code&gt; is only &lt;strong&gt;&lt;code&gt;4,661 bytes&lt;/code&gt;&lt;/strong&gt; (only &lt;strong&gt;&lt;code&gt;19.4%&lt;/code&gt;&lt;/strong&gt; of the &lt;code&gt;24,000 bytes&lt;/code&gt; limit), perfectly avoiding Context Bloat!&lt;/li&gt;
&lt;/ul&gt;




&lt;h1&gt;
  
  
  3. Future Outlook and Application Scenarios for &lt;code&gt;Harness²&lt;/code&gt; and Agents
&lt;/h1&gt;

&lt;p&gt;This practical implementation of Google Research &lt;code&gt;Harness²&lt;/code&gt; into &lt;strong&gt;&lt;a href="https://github.com/kkdai/line-card-assistant" rel="noopener noreferrer"&gt;LINE AI Card Master&lt;/a&gt;&lt;/strong&gt; has shown us a brand-new &lt;strong&gt;AgentOps development paradigm&lt;/strong&gt;. Looking ahead, we believe &lt;code&gt;Harness²&lt;/code&gt; has four high-potential application scenarios in the enterprise-grade AI Agent field:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight dot"&gt;&lt;code&gt;&lt;span class="nv"&gt;flowchart&lt;/span&gt; &lt;span class="nv"&gt;LR&lt;/span&gt;
    &lt;span class="k"&gt;subgraph&lt;/span&gt; &lt;span class="nv"&gt;Prod&lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"1. Production Observability (Cloud Run + Agent Runtime)"&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;
        &lt;span class="nv"&gt;Traffic&lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"Real User Traffic\n(LINE Webhook / A2A)"&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;
        &lt;span class="nv"&gt;Trace&lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"Cloud Trace OTel Spans\n+ Negative Feedback (HITL Retry)"&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;
        &lt;span class="nv"&gt;Traffic&lt;/span&gt; &lt;span class="o"&gt;--&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;&lt;/span&gt; &lt;span class="nv"&gt;Trace&lt;/span&gt;
    &lt;span class="nv"&gt;end&lt;/span&gt;

    &lt;span class="k"&gt;subgraph&lt;/span&gt; &lt;span class="nv"&gt;Nightly&lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"2. Nightly Autonomous Evolution Flywheel (Nightly Harness² CI/CD)"&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;
        &lt;span class="nv"&gt;Extract&lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"Auto Mask PII &amp;amp; Convert to\nChallenge Dataset Cases"&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;
        &lt;span class="nv"&gt;Evolve&lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"Harness² Two-Layer Recursion\n(Propose-Probe-Compose + Reflector)"&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;
        &lt;span class="nv"&gt;PR&lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"Auto Initiate GitHub PR\nUpdate harness/evolved/ c1..c8"&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;
        &lt;span class="nv"&gt;Extract&lt;/span&gt; &lt;span class="o"&gt;--&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;&lt;/span&gt; &lt;span class="nv"&gt;Evolve&lt;/span&gt; &lt;span class="o"&gt;--&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;&lt;/span&gt; &lt;span class="nv"&gt;PR&lt;/span&gt;
    &lt;span class="nv"&gt;end&lt;/span&gt;

    &lt;span class="k"&gt;subgraph&lt;/span&gt; &lt;span class="nv"&gt;Scenarios&lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"3. Future Four High-Value Application Scenarios"&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;
        &lt;span class="nv"&gt;S1&lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"Scenario A: Fully Automated Nightly Self-Healing AgentOps"&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;
        &lt;span class="nv"&gt;S2&lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"Scenario B: Cross-Model Harnessing &amp;amp; Tuning"&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;
        &lt;span class="nv"&gt;S3&lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"Scenario C: Multi-Tenant Enterprise Compliance &amp;amp; Skills"&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;
        &lt;span class="nv"&gt;S4&lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"Scenario D: Dual Evolution with ADK Graph Topology (Issue #15)"&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;
    &lt;span class="nv"&gt;end&lt;/span&gt;

    &lt;span class="nv"&gt;Trace&lt;/span&gt; &lt;span class="o"&gt;--&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;&lt;/span&gt; &lt;span class="nv"&gt;Extract&lt;/span&gt;
    &lt;span class="nv"&gt;PR&lt;/span&gt; &lt;span class="o"&gt;--&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;&lt;/span&gt; &lt;span class="nv"&gt;Scenarios&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  1. Scenario A: Fully Automated "Nightly Self-Healing AgentOps"
&lt;/h2&gt;

&lt;p&gt;In the past, when a production LINE Bot encountered frequent "✏️ Edit Data" triggers via &lt;code&gt;HITLConfirmNode&lt;/code&gt; or received negative feedback, engineers had to manually analyze Cloud Trace logs the next day. Combining the Cloud Trace established in Phase 5 with the &lt;code&gt;LineCardAdapter&lt;/code&gt; from this series, future CI/CD can achieve:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Automatically filtering anonymous Span trajectories from Cloud Trace every night where "users modified data more than twice consecutively" or "search results were 0," and adding them to the Challenge Dataset.&lt;/li&gt;
&lt;li&gt;Triggering a GitHub Action to run a round of &lt;code&gt;Harness²&lt;/code&gt; two-layer recursion to automatically synthesize new &lt;code&gt;c6&lt;/code&gt; skills or update &lt;code&gt;LongTermMEMORY.md&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Once regression tests (Baseline + Challenge) confirm score improvements and zero regression, &lt;strong&gt;the Bot automatically initiates a Pull Request&lt;/strong&gt; modifying only the &lt;code&gt;harness/&lt;/code&gt; directory. Engineers only need to review the skill Markdown in the morning to deploy with one click!&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  2. Scenario B: Cross-Model Upgrades and "Harness Compensation" for Lightweight Models
&lt;/h2&gt;

&lt;p&gt;Enterprises often encounter behavioral drift when switching underlying models from high-cost models to ultra-fast lightweight models (e.g., switching from Gemini 1.5 Pro to Gemini 1.5 Flash or Flash-Lite to reduce latency and cost by 80%) or upgrading to next-gen models. Through &lt;code&gt;Harness²&lt;/code&gt;, we can automatically run a round of &lt;code&gt;Propose-Probe-Compose&lt;/code&gt; for the target model while keeping the Go code and Benchmark fixed. &lt;code&gt;Harness²&lt;/code&gt; will automatically compensate for the lightweight model's gaps with required reasoning auxiliary skills (&lt;code&gt;c6&lt;/code&gt; Skills) and guardrails (&lt;code&gt;c2&lt;/code&gt; Guardrails), using "smarter gear" to bridge the gap.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Scenario C: Multi-Tenant Enterprise-Specific Compliance and Domain Memory
&lt;/h2&gt;

&lt;p&gt;As seen in &lt;code&gt;challenge_pii_safe_executive_followup&lt;/code&gt;, industries like FinTech, MedTech, and the semiconductor supply chain each have distinct terminology dictionaries and compliance guardrails. Because &lt;code&gt;Harness²&lt;/code&gt; externalizes the gear as a plain-text file tree, enterprises only need to mount different &lt;code&gt;LINE_CARD_HARNESS_DIR&lt;/code&gt; (e.g., &lt;code&gt;harness/tenants/fintech/&lt;/code&gt; vs &lt;code&gt;harness/tenants/semiconductor/&lt;/code&gt;) for different departments or tenants. This allows the same Go Container Binary to serve multiple highly regulated vertical industries simultaneously!&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Scenario D: Dual Evolution of "Topology + Harness" with ADK v2.6+ Advanced Graph Workflow Primitives
&lt;/h2&gt;

&lt;p&gt;In &lt;strong&gt;&lt;a href="https://github.com/kkdai/line-card-assistant/issues/15" rel="noopener noreferrer"&gt;Issue #15&lt;/a&gt;&lt;/strong&gt;, we planned ADK v2.6+ features like &lt;code&gt;Parallel&lt;/code&gt; dynamic dispatch, &lt;code&gt;MultiRoute&lt;/code&gt; multi-path concurrency, and &lt;code&gt;VerifyOCRQualityNode&lt;/code&gt; reflection loops. In the future, &lt;code&gt;Harness²&lt;/code&gt;'s &lt;code&gt;c5&lt;/code&gt; (&lt;code&gt;sub_agents/&lt;/code&gt;) and &lt;code&gt;c8&lt;/code&gt; (&lt;code&gt;plugin/&lt;/code&gt;) could even further control Graph Workflow routing thresholds and sub-agent concurrency strategies—achieving an ultimate architecture where &lt;strong&gt;"Go is responsible for the type-safe topological skeleton, and Harness² is responsible for dynamically evolving the neural network and skill muscles."&lt;/strong&gt;&lt;/p&gt;




&lt;h1&gt;
  
  
  4. Recap of the "Agent Platform in Practice" Series
&lt;/h1&gt;

&lt;p&gt;From the first to the ninth post, we have completed a very solid production-grade AI Agent engineering journey:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;&lt;a href="https://dev.to/2026/10/16/adk-graph-workflow-go/"&gt;[Agent Platform in Practice (1)] Building LINE AI Card Master with Go and Google ADK 2.0 Graph Workflow&lt;/a&gt;&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;a href="https://dev.to/2026/10/17/adk-graph-workflow-go-2/"&gt;[Agent Platform in Practice (2)] From Monolithic Cloud Run to Google Cloud Agent Runtime (Phase 1)&lt;/a&gt;&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;a href="https://dev.to/2026/10/20/adk-graph-workflow-go-3/"&gt;[Agent Platform in Practice (3)] Implementing Cross-Instance Recognition and Pause/Resume with ADK 2.0 GCS Artifact Service and Agent Platform Sessions (Phase 2 Part 1)&lt;/a&gt;&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;a href="https://dev.to/2026/10/21/adk-graph-workflow-go-4/"&gt;[Agent Platform in Practice (4)] Completing the Architecture with Cloud Run LINE Webhook Gateway, Agent Runtime, and Cloud SQL PostgreSQL (Phase 2 Part 2 &amp;amp; Phase 3)&lt;/a&gt;&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;a href="https://dev.to/2026/10/22/adk-graph-workflow-go-5/"&gt;[Agent Platform in Practice (5)] Establishing Automated Evaluation Benchmarks with agents-cli eval and ADK 2.0 Go (Phase 4)&lt;/a&gt;&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;a href="https://dev.to/2026/10/24/adk-graph-workflow-go-6/"&gt;[Agent Platform in Practice (6)] Building a Full-Stack Observable LINE AI Card Master with agents-cli deploy, Terraform IaC, GitHub Actions CI/CD, and Cloud Trace (Phase 5)&lt;/a&gt;&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;a href="https://dev.to/2026/10/25/adk-graph-workflow-go-7/"&gt;[Agent Platform in Practice (7)] When ADK Go Graph Workflow Meets Google Research Harness² (Part 1): Understanding the Two-Layer Recursive Agent Harnessing Framework and c1..c8 Decoupling Practice&lt;/a&gt;&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;a href="https://dev.to/2026/10/26/adk-graph-workflow-go-8/"&gt;[Agent Platform in Practice (8)] When ADK Go Graph Workflow Meets Google Research Harness² (Part 2): Turning Phase 4 Eval Datasets and Phase 5 OpenTelemetry Spans into LineCardAdapter&lt;/a&gt;&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;a href="https://dev.to/2026/10/27/adk-graph-workflow-go-9/"&gt;[Agent Platform in Practice (9)] When ADK Go Graph Workflow Meets Google Research Harness² (Part 3): Two-Layer Recursive Testing Guide, 62.5% to 100% Performance Benchmark, and Future AgentOps Outlook (This post)&lt;/a&gt;&lt;/strong&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;All code, Terraform IaC, evaluation datasets, and evolved &lt;code&gt;c1..c8&lt;/code&gt; Harness file trees are fully open-sourced on GitHub: &lt;strong&gt;&lt;a href="https://github.com/kkdai/line-card-assistant" rel="noopener noreferrer"&gt;&lt;code&gt;kkdai/line-card-assistant&lt;/code&gt;&lt;/a&gt;&lt;/strong&gt;. If you are also building enterprise-grade AI Agents with Go and ADK, feel free to Star, Fork, and experience the power of &lt;code&gt;Harness²&lt;/code&gt; two-layer recursion!&lt;/p&gt;

</description>
      <category>agents</category>
      <category>ai</category>
      <category>go</category>
      <category>testing</category>
    </item>
  </channel>
</rss>
