<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Software Engineering on KbWen Blog</title>
    <link>https://www.kbwen.com/tags/software-engineering/</link>
    <description>KbWen 的個人技術部落格，分享 Python、機器學習、深度學習、資料工程與 AI 開發的學習筆記與實作心得。</description>
    <generator>Hugo</generator>
    <language>zh-tw</language>
    <image>
      <url>https://www.kbwen.com/images/og-default.png</url>
      <title>KbWen Blog</title>
      <link>https://www.kbwen.com/</link>
    </image>
    
    <lastBuildDate>Fri, 22 May 2026 20:00:00 +0800</lastBuildDate><atom:link href="https://www.kbwen.com/tags/software-engineering/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>No evidence, no completion</title>
      <link>https://www.kbwen.com/no-evidence-no-completion-verification-principle/</link>
      <pubDate>Fri, 22 May 2026 20:00:00 +0800</pubDate><dc:creator>KbWen</dc:creator>
      <guid>https://www.kbwen.com/no-evidence-no-completion-verification-principle/</guid>
      <description>No evidence, no completion: the one rule that closes most AI agent failures. A task isn&amp;#39;t done until it produces a verifiable artifact (commit SHA, test output).</description>
      <content:encoded><![CDATA[<blockquote>
<p><strong>TL;DR:</strong> &ldquo;No evidence, no completion&rdquo; is a single structural principle: a task isn&rsquo;t done until the agent produces an artifact that exists outside the conversation and can be checked independently. It sounds trivial. In practice it closes most of the common agent failure modes in one rule, because the act of specifying what evidence looks like, before the task runs, forces you to define what &ldquo;done&rdquo; actually means.</p>
</blockquote>
<hr>
<p>In the <a href="/why-ai-agents-fail-without-governance/">previous post in this series</a> I described an agent that said a feature was done (commit SHA requested, none existed, two of three modules unchanged). The failure had a name: no external completion criterion existed, so the agent supplied its own. That gap has a one-rule fix.</p>
<hr>
<h2 id="what-evidence-means-here">What &ldquo;evidence&rdquo; means here</h2>
<p>Evidence is any artifact that exists outside the conversation and can be verified independently of what the agent said.</p>
<p>A commit SHA is evidence. A test output is evidence. A file path with a checksum is evidence. A screenshot of a passing CI run is evidence.</p>
<p>&ldquo;I implemented it&rdquo; is not evidence. &ldquo;The feature is working&rdquo; is not evidence. A description of what the agent did is not evidence: it&rsquo;s the agent&rsquo;s own assessment of its work, which is exactly what you&rsquo;re trying to verify.</p>
<p>The distinction matters because conversation text is not auditable. It exists only within the session, can&rsquo;t be pointed to by anyone who wasn&rsquo;t there, and doesn&rsquo;t prove the underlying state of the system. An artifact external to the conversation can be checked at any time, by anyone, against the actual state.</p>
<hr>
<h2 id="why-one-rule-covers-so-much">Why one rule covers so much</h2>
<p><a href="/why-ai-agents-fail-without-governance/">The first post in this series</a> catalogued five structural gaps: no completion criterion, no phase gate, no state handoff, no resource scoping, no capability boundary. The evidence principle doesn&rsquo;t replace all of them, but it forces the most important one: you cannot specify what evidence looks like without first deciding what &ldquo;done&rdquo; means.</p>
<p>If the evidence for a feature task is &ldquo;passing tests + commit SHA on the feature branch,&rdquo; you&rsquo;ve implicitly defined the completion criterion, the scope boundary (the feature branch, not the main codebase), and a checkpoint for the phase gate. The evidence requirement is the handle that pulls the rest of the structure into place.</p>
<p>This is why <a href="/ai-agent-governance-distributed-systems-prior-art/">the distributed systems framing</a> maps so cleanly: delivery acknowledgment in a message queue is exactly this pattern. The queue doesn&rsquo;t trust the worker&rsquo;s internal state; it requires an external signal that the job completed. Decades of production systems run on that principle because systems without it fail in the same predictable way.</p>
<hr>
<h2 id="before-the-task-not-after">Before the task, not after</h2>
<p>The principle works when it&rsquo;s applied before the task starts, not as a review step after.</p>
<p>&ldquo;What would prove this is done?&rdquo; asked before the work begins forces a design decision. It&rsquo;s not a check on the agent — it&rsquo;s a check on the task specification. If you can&rsquo;t answer it, the task isn&rsquo;t specified well enough to run. If you can answer it but the answer is vague (&ldquo;the feature works&rdquo;), the vagueness is in your specification, not in the agent&rsquo;s execution.</p>
<p>This is the mechanism <a href="https://blog.thepete.net/blog/2025/05/22/why-your-ai-coding-assistant-keeps-doing-it-wrong-and-how-to-fix-it/">Pete Hodgson&rsquo;s analysis of AI coding tools</a> points toward: when a problem has many valid solutions, the agent will pick one. That one will probably be valid. It probably won&rsquo;t be the one you wanted. Specifying evidence before the task runs is a way of narrowing the solution space — the agent&rsquo;s output has to satisfy the evidence criterion, which eliminates the paths that don&rsquo;t.</p>
<p>In practice: &ldquo;implement email verification&rdquo; with no evidence criterion produces one kind of output. &ldquo;Implement email verification — done when: (1) tests pass for OTP generation and expiry, (2) commit SHA on feat/email-verification&rdquo; produces a different one. Same model. Different structure around it.</p>
<hr>
<h2 id="what-good-evidence-looks-like">What good evidence looks like</h2>
<p>Evidence should be:</p>
<p><strong>External to the conversation.</strong> It can be retrieved or verified by someone who wasn&rsquo;t in the session. A commit SHA can be looked up. A test output can be reproduced. A URL can be visited.</p>
<p><strong>Specific enough to be falsifiable.</strong> &ldquo;Tests pass&rdquo; is weaker than &ldquo;running <code>npm test</code> returns exit 0 with 47 tests passing.&rdquo; The second can be false in a way that &ldquo;tests pass&rdquo; can&rsquo;t — which is the point. If the evidence criterion can&rsquo;t be falsified, it&rsquo;s not doing the work.</p>
<p><strong>Proportional to the task.</strong> A one-line bug fix doesn&rsquo;t need a full audit trail. The evidence for a tiny fix is the commit SHA and a grep confirming the old string is gone. The evidence for a feature touching auth, API, and database schema is more involved: test output, migration SHA, API contract diff. The Agentic OS framework classifies tasks before they run partly to route to the appropriate evidence format: a quick-win task and an architecture-change task need different levels of proof.</p>
<hr>
<h2 id="the-cost-of-specifying-evidence">The cost of specifying evidence</h2>
<p>Specifying evidence costs something up front. It takes maybe two minutes to think through &ldquo;what would prove this is done&rdquo; before a task starts. That&rsquo;s real overhead.</p>
<p>The comparison is with recovery cost. A governance failure (completing a task that didn&rsquo;t actually complete, or completing it the wrong way) typically costs: discovering the error, rebuilding context, rerunning the work, and auditing scope. None of those costs are bounded. The two minutes up front is.</p>
<p>The <a href="https://github.com/KbWen/agentic-os">Agentic OS v1.1 benchmark</a> (April 2026, using <code>chars/4</code> as the token estimation formula, ±10%) measured governance overhead for a quick-win task at roughly 17,000 tokens: the cost of the full structured lifecycle, evidence requirement included. For a complex feature spanning API design, auth, and database schema, it&rsquo;s around 51,000 tokens. Those numbers are real costs. They&rsquo;re also the ceiling. The cost of an undetected wrong completion has no ceiling — it depends on when you find it and how much work built on top of it.</p>
<hr>
<h2 id="the-question-to-ask-before-your-next-task">The question to ask before your next task</h2>
<p>Before you give an agent its next task: what artifact would prove this is done?</p>
<p>Not &ldquo;what would it mean to be done&rdquo; — that&rsquo;s vague enough for the agent to fill in. What specific artifact, external to the conversation, would you point to afterward and say: here is the evidence this completed correctly.</p>
<p>If you have an answer, you have a completion criterion. If you don&rsquo;t, you&rsquo;re delegating the definition of &ldquo;done&rdquo; to the agent. It will define one. It almost never matches yours.</p>
<p><em>This post is part of a series on building real AI systems. The previous posts cover the <a href="/why-ai-agents-fail-without-governance/">two-failure taxonomy</a> and the <a href="/ai-agent-governance-distributed-systems-prior-art/">distributed systems prior art</a> that motivates the evidence requirement. The framework is open source at <a href="https://github.com/KbWen/agentic-os">github.com/KbWen/agentic-os</a>.</em></p>
]]></content:encoded>
    </item>
    
    <item>
      <title>Prior art: what distributed systems already knows</title>
      <link>https://www.kbwen.com/ai-agent-governance-distributed-systems-prior-art/</link>
      <pubDate>Fri, 22 May 2026 16:00:00 +0800</pubDate><dc:creator>KbWen</dc:creator>
      <guid>https://www.kbwen.com/ai-agent-governance-distributed-systems-prior-art/</guid>
      <description>AI agent governance maps onto distributed systems patterns: audit logs, delivery acknowledgment, idempotency, least privilege. The prior art already exists.</description>
      <content:encoded><![CDATA[<blockquote>
<p><strong>TL;DR:</strong> The governance problems that make AI agents unpredictable (unverified completions, state loss between sessions, unconstrained scope) are structurally identical to problems distributed systems engineering solved with audit logs, delivery acknowledgment, state machines, and least-privilege access. The one genuine difference is non-determinism: an agent given the same open-ended task twice will do something different, which means governance needs to front-load constraints rather than just catch failures after. But the rest of the pattern library applies directly.</p>
</blockquote>
<hr>
<p>If you have built a message queue, you have hit a version of this bug: a worker picks up a job, does the work, then fails before sending the acknowledgment. The queue marks it undelivered. The job runs again. Now you have a duplicate record, a double email, or worse, depending on what &ldquo;the job&rdquo; was.</p>
<p>The fix is well-understood: require the worker to produce evidence of completion that the system can verify externally. Don&rsquo;t trust the worker&rsquo;s internal state. Trust the artifact.</p>
<p>When an AI agent says &ldquo;done&rdquo; and you have no artifact to check against, that&rsquo;s the same design gap. <a href="/why-ai-agents-fail-without-governance/">The previous post in this series</a> has a concrete example: the agent said the feature was done, I asked for the commit SHA, there wasn&rsquo;t one, and two of the three modules it described implementing hadn&rsquo;t changed. A capability failure looks like wrong reasoning. This was neither: the agent completed exactly what it was given, through its own completion criterion, because no external one existed. The fix is in the surrounding structure.</p>
<p>Distributed systems already solved the worker-reliability problem. The patterns map directly.</p>
<hr>
<h2 id="what-agent-execution-looks-like-from-the-outside">What agent execution looks like from the outside</h2>
<p>Strip the language model out for a moment. What&rsquo;s left?</p>
<p>A task arrives. A worker picks it up, performs operations, and signals completion. The orchestrator decides what to do next.</p>
<p>Standard async task pipeline. The governance questions are the same ones distributed systems have always asked: Did the work actually happen? What state is the system in now? What was the worker allowed to touch?</p>
<p>The answers (delivery acknowledgment, audit logs, state machines, capability sandboxing) aren&rsquo;t novel. They exist because systems without them fail in predictable, documented ways. Agent deployments running without that structure encounter the same failure modes.</p>
<hr>
<h2 id="the-pattern-mapping">The pattern mapping</h2>
<table>
  <thead>
      <tr>
          <th>Distributed systems pattern</th>
          <th>Agent governance equivalent</th>
      </tr>
  </thead>
  <tbody>
      <tr>
          <td>Delivery acknowledgment</td>
          <td>Every task completion requires an external verifiable artifact: commit SHA, test output, file path</td>
      </tr>
      <tr>
          <td>Idempotency key</td>
          <td>Task dispatch is deduplicated: same task classified and scoped the same way, regardless of retry</td>
      </tr>
      <tr>
          <td>Audit log / event sourcing</td>
          <td>Work Log: decisions recorded at the time they happen, not reconstructed from memory later</td>
      </tr>
      <tr>
          <td>State machine with explicit transitions</td>
          <td>Phase gate: plan before implementing, review before shipping, with real entry/exit conditions</td>
      </tr>
      <tr>
          <td>Least privilege / capability sandbox</td>
          <td>Agent&rsquo;s tool access scoped to what the specific task requires, not everything available</td>
      </tr>
      <tr>
          <td>Resource quota</td>
          <td>Task classification that routes work to an appropriately sized execution path before it begins</td>
      </tr>
  </tbody>
</table>
<p>The <a href="https://github.com/KbWen/agentic-os">Agentic OS framework</a> is essentially this table implemented as a working system, not because it invented these patterns, but because building it kept arriving at the same structural answers distributed systems already had. The evidence requirement feels new until you recognize it as a CI gate. The work log feels novel until you recognize it as event sourcing. The insight isn&rsquo;t original; it&rsquo;s just overdue.</p>
<hr>
<h2 id="the-one-place-the-analogy-breaks">The one place the analogy breaks</h2>
<p>Distributed systems assume deterministic workers. Same input, same output, retry is safe.</p>
<p>Agents aren&rsquo;t deterministic, at least not for open-ended tasks. The same prompt, the same tools, the same context: execution goes somewhere different. Sometimes better. Often just different. For well-scoped sub-tasks (&ldquo;run these tests and report failures,&rdquo; &ldquo;format this JSON to this schema&rdquo;), retry still works fine. But for the tasks where governance matters most (feature implementation, refactoring decisions, scope-touching work), retry isn&rsquo;t a recovery strategy; it&rsquo;s another roll.</p>
<p>This is what <a href="https://blog.thepete.net/blog/2025/05/22/why-your-ai-coding-assistant-keeps-doing-it-wrong-and-how-to-fix-it/">Pete Hodgson&rsquo;s analysis of AI coding tools</a> points toward: when a problem has many valid solutions, the probability that an agent independently lands on the one you wanted approaches zero. The governance implication is that task decomposition is itself a governance act. Break work into pieces small enough that non-determinism is contained. Then front-load the constraints on the pieces that remain open-ended: define what &ldquo;done&rdquo; means, specify which files are in scope, classify the task before the first tool call.</p>
<p>The circuit breaker in distributed systems stops a cascade after failures accumulate. The agent equivalent is not letting the cascade start.</p>
<hr>
<h2 id="where-to-instrument">Where to instrument</h2>
<p>Distributed systems tell you to instrument at the transition points: message intake, worker pickup, task completion, downstream dispatch. These are where state changes happen and where failures manifest.</p>
<p>The agent equivalent:</p>
<ul>
<li><strong>Task intake</strong>: Is this classified correctly? What phase path follows? What tools does it need, and only those?</li>
<li><strong>Phase completion</strong>: What artifact exists to prove this phase is done? Is it external to the conversation?</li>
</ul>
<p>The third transition point is worth more than a bullet. <strong>Session boundary</strong> is the agent-specific failure mode that has no clean distributed-systems equivalent: it&rsquo;s closer to a stateless worker that loses its in-memory state and reprocesses from the queue head on restart. <a href="https://spectrum.ieee.org/ai-coding-degrades">An IEEE Spectrum report on AI coding tools</a> documented the pattern: in longer sessions, agents increasingly regenerated functions that already existed and ignored conventions established earlier. The fix is identical to the queue case: persistent state external to the worker. In agent terms: a work log that records decisions at the time they&rsquo;re made, so the next session inherits context instead of reconstructing it.</p>
<hr>
<h2 id="which-gaps-cost-the-most">Which gaps cost the most</h2>
<p>The distributed systems frame doesn&rsquo;t just explain why agent governance looks the way it does — it tells you which gaps cost the most.</p>
<p>Missing completion verification produces the cheapest failures: you find out fast. Missing scope constraints produce the expensive ones: the agent did three things you didn&rsquo;t ask for, two of which were correct, and now you&rsquo;re auditing which is which. Missing session state produces the hidden ones: the agent solved a problem you already solved, using a pattern you already decided against, because it had no way to know.</p>
<p>If you&rsquo;re choosing where to add structure first: start with scope. The task intake gate is the circuit breaker — it constrains what the agent can reach before it runs. The work log is the audit trail you need after something goes wrong. The completion artifact is the acknowledgment the queue was never getting.</p>
<p>Add them in that order.</p>
<p><em>This post is part of a series on building real AI systems. The previous post, <a href="/why-ai-agents-fail-without-governance/">Why AI Agents Go Wrong: It&rsquo;s Not the Model</a>, covers the capability vs. governance failure taxonomy that motivates this framing. Next: <a href="/no-evidence-no-completion-verification-principle/">No Evidence, No Completion</a> takes the evidence requirement as a standalone principle and shows what it looks like in practice. The framework is open source at <a href="https://github.com/KbWen/agentic-os">github.com/KbWen/agentic-os</a>.</em></p>
]]></content:encoded>
    </item>
    
    <item>
      <title>Why AI Agents Go Wrong: It&#39;s Not the Model</title>
      <link>https://www.kbwen.com/why-ai-agents-fail-without-governance/</link>
      <pubDate>Fri, 22 May 2026 12:00:00 +0800</pubDate><dc:creator>KbWen</dc:creator>
      <guid>https://www.kbwen.com/why-ai-agents-fail-without-governance/</guid>
      <description>Why AI agents fail: most agent failures aren&amp;#39;t model problems, they&amp;#39;re governance problems, and the two need completely different fixes. How to tell them apart.</description>
      <content:encoded><![CDATA[<blockquote>
<p><strong>TL;DR:</strong> &ldquo;The agent did something wrong&rdquo; usually gets diagnosed as a model problem. Most of the time it isn&rsquo;t. Capability failures (wrong reasoning) and governance failures (no structure to catch wrong reasoning) look identical from the outside but need completely different fixes. This post is about telling them apart, and why most teams are currently solving the wrong one.</p>
</blockquote>
<hr>
<p>The agent said the feature was done. I asked for the commit SHA. There wasn&rsquo;t one. When I checked the branch, two of the three modules it described implementing hadn&rsquo;t changed.</p>
<p>The instinct in that moment is to reach for a better prompt, a smarter model, maybe a different tool call. That instinct is usually wrong.</p>
<p>What happened wasn&rsquo;t a reasoning failure. The agent completed exactly the task it was given, interpreted through its own completion criterion, because no explicit one existed. There was no audit trail to check what it actually did. There was no scope boundary to constrain what &ldquo;done&rdquo; even meant. The model behaved correctly inside a system that gave it no structure to behave <em>correctly toward</em>.</p>
<p>That&rsquo;s a governance failure, not a capability failure. And the fix is not a better model.</p>
<hr>
<h2 id="two-failure-modes-that-look-the-same">Two failure modes that look the same</h2>
<p>When an agent produces bad output, the failure is almost always categorized as one thing: the AI got it wrong. Which leads to one solution category: better AI.</p>
<p>The problem is that &ldquo;the AI got it wrong&rdquo; conflates two distinct failure modes that have nothing to do with each other.</p>
<p><strong>Capability failure:</strong> the model reasoned incorrectly. It missed a constraint, hallucinated a fact, drew a wrong inference. The fix lives in the model layer: better prompt, better retrieval, better fine-tuning, sometimes a more capable model.</p>
<p><strong>Governance failure:</strong> the system had no invariant to catch or prevent what the agent did. The agent may have reasoned perfectly well and still produced a wrong outcome, because the surrounding structure gave it nothing to constrain against.</p>
<p>There&rsquo;s a useful diagnostic test: <em>would a smarter model have prevented this?</em></p>
<p>If yes, if the failure was clearly about incorrect reasoning or a factual miss, that&rsquo;s a capability failure.</p>
<p>If no, if a brilliant expert given the same underspecified task would have made the same wrong choice, or a different wrong choice, because the task itself had no defined success condition. That&rsquo;s a governance failure. Upgrading the model doesn&rsquo;t help.</p>
<p>Most of the &ldquo;unpredictable agent&rdquo; complaints I&rsquo;ve seen are governance failures. The problem gets framed as model unreliability because that&rsquo;s what&rsquo;s visible. The actual cause is invisible: the absence of structure.</p>
<hr>
<h2 id="the-five-structural-gaps">The five structural gaps</h2>
<p>These are the governance gaps that show up repeatedly, not as edge cases, but as the default state of most agent deployments. The zh-TW companion post <a href="/ai-agent-common-pitfalls-and-fixes/">AI 代理常見痛點與我們的嘗試</a> goes deeper on each one with narrative examples. Here I want to name the structural invariant that&rsquo;s missing in each case.</p>
<p><strong>Output not verifiable → no completion criterion or audit trail.</strong>
The agent says &ldquo;done.&rdquo; You have no artifact to check against. The agent&rsquo;s word that something happened is not evidence that it happened. The missing invariant: every task completion requires an attached evidence artifact: a file path, a commit SHA, a test result, something external to the conversation.</p>
<p><strong>Steps skipped → no phase gate.</strong>
Given a complex task, agents move toward output by the shortest path. Scope-setting, dependency mapping, impact analysis (anything that doesn&rsquo;t look like &ldquo;doing the thing&rdquo;) gets skipped. The missing invariant: phases with entry and exit conditions that must be satisfied before proceeding. Pete Hodgson has written about this from an angle worth noting: when a problem has many valid solutions, the probability that an agent independently arrives at the one you actually wanted approaches zero. Pre-alignment isn&rsquo;t overhead. It&rsquo;s the phase gate that prevents redoing work.</p>
<p><strong>Cross-session amnesia → no state handoff mechanism.</strong>
Every new conversation is a blank slate. Decisions made in session one are unknown in session two. The agent rediscovers problems you&rsquo;ve already solved, proposes patterns you&rsquo;ve already rejected, rebuilds context you&rsquo;ve already paid to build. An IEEE Spectrum report on AI coding tools documented this concretely: in longer sessions, agents increasingly regenerated functions that already existed and ignored conventions established earlier in the same session. The missing invariant: a structured work log that carries decisions forward across session boundaries. The mechanism we use is stupid-simple. It&rsquo;s essentially forcing the agent to keep a diary. That description isn&rsquo;t flattering, but cross-session amnesia is real enough that stupid-simple works.</p>
<p><strong>Unbounded token cost → no resource scoping.</strong>
An agent given a large task will read everything it can find, activate every relevant capability, and use as much context as the task allows it to justify. Without resource scoping, costs are unpredictable and you have no way to set expectations before a task starts. The missing invariant: task classification that routes to appropriately sized execution paths before the task begins.</p>
<p><strong>Scope creep → no capability boundary.</strong>
This is the quietest failure mode. The agent does what you asked, and also reorganizes a module you didn&rsquo;t ask it to touch, and also &ldquo;helpfully&rdquo; updates a config file while it was in the neighborhood. Security researcher Johann Rehberger (Embrace the Red) made this failure mode concrete in April 2025 when he spent $500 testing Devin AI&rsquo;s response to embedded instructions in GitHub issues, then reported the results to Cognition: 84–85% of attacks succeeded in getting the agent to execute actions outside the intended scope. That&rsquo;s an extreme case, but the everyday version of this (the agent quietly expanding what &ldquo;done&rdquo; means) is the same structural gap. The missing invariant: explicit capability boundaries that define what the agent is allowed to do, not just what it&rsquo;s been asked to do.</p>
<p>None of these gaps are model problems. A more capable model, given the same absent structure, makes the same category of errors, just more convincingly.</p>
<hr>
<h2 id="engineering-already-solved-these-problems">Engineering already solved these problems</h2>
<p>These aren&rsquo;t new problems with new solutions. They&rsquo;re old problems that software engineering solved decades ago, applied to a different execution substrate.</p>
<table>
  <thead>
      <tr>
          <th>Governance gap</th>
          <th>Engineering equivalent</th>
      </tr>
  </thead>
  <tbody>
      <tr>
          <td>No completion criterion</td>
          <td>CI gate: no merge without passing checks</td>
      </tr>
      <tr>
          <td>No phase gate</td>
          <td>PR review requirement: code doesn&rsquo;t ship without sign-off</td>
      </tr>
      <tr>
          <td>No state handoff</td>
          <td>Audit log / ADR: decisions are recorded, not reconstructed</td>
      </tr>
      <tr>
          <td>No resource scoping</td>
          <td>Budget / SLA: bounded cost before work starts</td>
      </tr>
      <tr>
          <td>No capability boundary</td>
          <td>Principle of least privilege: access limited to what the task requires</td>
      </tr>
  </tbody>
</table>
<p>The analogy isn&rsquo;t decorative. These are the same structural mechanisms. Building the evidence requirement for <a href="https://github.com/KbWen/agentic-os">Agentic OS</a>, I kept writing things that felt novel until I realized I was describing CI gates and audit logs with different names. The insight wasn&rsquo;t new. It was just late.</p>
<p>A CI gate doesn&rsquo;t trust the developer&rsquo;s word that the tests pass. It requires evidence. An audit log records decisions at the time they&rsquo;re made, so they don&rsquo;t need to be reconstructed from memory later. Least privilege limits what an agent can touch, not out of distrust, but to contain the blast radius when something goes wrong.</p>
<p>The AGENTS.md convention, now adopted across Claude Code, Cursor, and GitHub Copilot as a standard way for agents to load project context, is essentially a machine-readable project governance document. It&rsquo;s the same idea as a team&rsquo;s architecture decision record, but in a format the agent reads automatically. That&rsquo;s not a coincidence. It&rsquo;s the same structural need surfacing in a new context.</p>
<p>What&rsquo;s missing in most agent deployments isn&rsquo;t better AI. It&rsquo;s the application of mechanisms that software engineering already knows work.</p>
<hr>
<h2 id="what-governance-actually-costs">What governance actually costs</h2>
<p>&ldquo;Adding structure&rdquo; sounds like adding overhead. It&rsquo;s worth being concrete about the actual numbers.</p>
<p>We measured governance overhead across several task types in Agentic OS v1.1 (April 2026, using <code>chars/4</code> as the token estimation formula; actual counts vary by ±10% depending on tokenizer). For a quick-win task (something like fixing a date format in a CSV export), the governance overhead came to <strong>17,041 tokens</strong>. For a complex feature touching API design, authentication, and database schema, it came to <strong>50,975 tokens</strong>.</p>
<p>Those numbers sound large until you compare them to the cost of an ungoverned failure. A governance failure typically means: an undetected wrong completion that gets discovered later, a context restart, redone work, and scope cleanup. None of those costs are bounded or predictable.</p>
<p>The governance overhead is bounded. It scales with task complexity in a predictable way: the lightest path costs roughly 17K tokens; the heaviest measured scenario costs under 62K. The cost of recovering from a scope error or a missed completion criterion is not bounded. It depends on when you find it.</p>
<p>This isn&rsquo;t an argument for any particular framework. It&rsquo;s an argument for the structure itself: known, upfront cost versus unbounded, discovery-time cost. That trade-off is the same one CI gates resolved for software deployment twenty years ago.</p>
<hr>
<h2 id="the-question-to-ask-before-the-task-starts">The question to ask before the task starts</h2>
<p>None of this requires a framework. The diagnostic test at the task level is simpler than that.</p>
<p>Before your next agent task: what artifact would prove this is done?</p>
<p>Not &ldquo;what would it mean to be done.&rdquo; That&rsquo;s vague enough that the agent will fill in the answer. What <em>artifact</em>, specifically, would you point to afterward and say: here is the evidence this completed correctly?</p>
<p>If you can answer that question before the task starts, you have a completion criterion. If you can&rsquo;t, you don&rsquo;t, and the agent will invent one. That invented criterion is almost never the one you wanted. The everyday version doesn&rsquo;t look like a security incident. It&rsquo;s an agent that quietly refactored a module you didn&rsquo;t mention, or updated a config file it found nearby. Its completion criterion included those things. Yours didn&rsquo;t.</p>
<p>That&rsquo;s the smallest possible governance structure. A definition of done, stated before work begins, tied to something observable.</p>
<p>The rest of the gaps (phase gates, state handoffs, resource scoping, capability boundaries) are the same logic applied at increasing scope. But they all start from the same place: deciding what &ldquo;done&rdquo; means before asking the agent to find out.</p>
<hr>
<p><em>These observations are from building and using Agentic OS v1.1 (April 2026). The field moves fast — if a model capability has improved or a pattern here no longer holds, I want to know. The framework is open source and the issues are open: <a href="https://github.com/KbWen/agentic-os">github.com/KbWen/agentic-os</a>.</em></p>
<p><em>This post is part of a series on building real AI systems. Related reading: <a href="/what-makes-an-ai-skill-different-from-a-prompt/">What Makes an AI Skill Different from a Prompt?</a> covers the capability abstraction layer that sits below agent orchestration. The zh-TW companion post <a href="/ai-agent-common-pitfalls-and-fixes/">AI 代理常見痛點與我們的嘗試</a> covers the same failure catalogue with more narrative depth. Both build on <a href="/beyond-prompt-from-instructions-to-building-systems/">Beyond Prompt: From Instructions to Building Systems</a>.</em></p>
]]></content:encoded>
    </item>
    
  </channel>
</rss>
