<?xml version="1.0" encoding="UTF-8"?><rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>Hugues Clouâtre - AI &amp; Platform Engineering</title><description>AI and platform engineering insights from an AWS veteran and technology executive. Practical guides for CTOs and engineering leaders.</description><link>https://clouatre.ca/</link><item><title>Open-Weight LLMs Reach the Structured Output Quality Ceiling</title><link>https://clouatre.ca/posts/open-weights-structured-output-cost/</link><guid isPermaLink="true">https://clouatre.ca/posts/open-weights-structured-output-cost/</guid><description>Open-weight models now match closed-source on structured output at 95x lower cost. Pre-registered blind eval, 30 samples, zero quality delta.</description><pubDate>Fri, 10 Jul 2026 10:55:00 GMT</pubDate><content:encoded>&lt;p&gt;Three models entered a pre-registered blind evaluation: Gemma 4 26B-A4B at $0.00042 per run, Claude Haiku 4.5 at $0.0119, and Claude Sonnet 5 at $0.0399. Across 30 samples and 8 rubric criteria, all three scored identically on 7 criteria. The single divergence on criterion C8 traced entirely to token-limit truncation, not to any reasoning failure. When quality converges at the ceiling, cost is the only rational differentiation axis.&lt;/p&gt;
&lt;p&gt;That cost gap is not marginal. The 28x spread between Gemma 4 and Haiku 4.5, and the 95x spread between Gemma 4 and Sonnet 5, translate directly to operational scale. A pipeline processing one million structured-output calls per month costs $39,900 against Sonnet 5, $11,900 against Haiku 4.5, and $420 against Gemma 4 26B-A4B via managed API; this represents a monthly delta of $39,480 for identical rubric performance on this task class. The MMLU gap between the best open and closed models shrank from 17.5 percentage points in late 2023 to effectively zero by early 2026. For structured-output pipelines specifically, that convergence appears to be complete.&lt;/p&gt;
&lt;p&gt;Two additional forces make this moment structurally different from prior open-weights cycles. Apache 2.0 licensing removes the license-review step that once slowed open-model procurement, though self-hosting transfers other friction onto the deploying team. These hurdles include GPU qualification, indemnification gaps, and inference engineering ownership. EU AI Act GPAI enforcement powers activate August 2, 2026, making data residency a compliance requirement rather than an operational preference. Self-hosted open-weight models satisfy data residency; so do managed closed-model providers with EU-resident infrastructure.&lt;/p&gt;
&lt;h2 id=&quot;table-of-contents&quot;&gt;Table of contents&lt;/h2&gt;
&lt;p&gt;&lt;/p&gt;&lt;details&gt;&lt;summary&gt;Contents&lt;/summary&gt;&lt;p&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;#what-does-it-mean-for-structured-output-quality-to-hit-a-ceiling&quot;&gt;What Does It Mean for Structured-Output Quality to Hit a Ceiling?&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#how-was-experiment-9-designed-to-avoid-benchmark-gaming&quot;&gt;How Was Experiment 9 Designed to Avoid Benchmark Gaming?&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#what-did-the-blind-evaluation-reveal-about-cost-versus-quality&quot;&gt;What Did the Blind Evaluation Reveal About Cost Versus Quality?&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;#what-does-a-95x-cost-spread-mean-at-scale&quot;&gt;What Does a 95x Cost Spread Mean at Scale?&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#when-does-switching-to-open-weight-models-make-economic-sense&quot;&gt;When Does Switching to Open-Weight Models Make Economic Sense?&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#why-is-c8-a-token-budget-problem-not-a-reasoning-problem&quot;&gt;Why Is C8 a Token Budget Problem, Not a Reasoning Problem?&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;#what-does-c8-mean-for-self-hosted-vs-managed-inference&quot;&gt;What Does C8 Mean for Self-Hosted vs. Managed Inference?&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#how-wide-is-the-remaining-gap-between-open-and-closed-models&quot;&gt;How Wide Is the Remaining Gap Between Open and Closed Models?&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;#what-are-the-scope-boundaries&quot;&gt;What Are the Scope Boundaries?&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#when-do-closed-models-still-win&quot;&gt;When Do Closed Models Still Win?&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#what-does-apache-20-licensing-change-for-enterprise-procurement&quot;&gt;What Does Apache 2.0 Licensing Change for Enterprise Procurement?&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;#what-does-self-hosting-provide-for-audit-trails&quot;&gt;What Does Self-Hosting Provide for Audit Trails?&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#how-does-eu-ai-act-enforcement-shift-the-data-residency-calculus&quot;&gt;How Does EU AI Act Enforcement Shift the Data Residency Calculus?&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;#does-using-a-third-party-api-create-a-data-residency-risk&quot;&gt;Does Using a Third-Party API Create a Data Residency Risk?&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#takeaways&quot;&gt;Takeaways&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#references&quot;&gt;References&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;/p&gt;&lt;/details&gt;&lt;p&gt;&lt;/p&gt;
&lt;h2 id=&quot;what-does-it-mean-for-structured-output-quality-to-hit-a-ceiling&quot;&gt;What Does It Mean for Structured-Output Quality to Hit a Ceiling?&lt;/h2&gt;
&lt;p&gt;The quality ceiling is the finding: Gemma 4 26B-A4B matched Claude Haiku 4.5 and Claude Sonnet 5 on 7 of 8 rubric criteria at 95x lower cost. Benchmark scores can mislead in two directions, and understanding what “ceiling” means here determines whether the result generalizes to your workload.&lt;/p&gt;
&lt;p&gt;JSON Pass Rate is &lt;a href=&quot;https://doi.org/10.48550/arXiv.2604.25359&quot;&gt;not a discriminating metric at modern quality levels&lt;/a&gt; (Singh et al., 2026): almost every current model clears 95% or above, yet &lt;a href=&quot;https://interfaze.ai/blog/introducing-structured-output-benchmark&quot;&gt;valid JSON and correct JSON diverge by 15-30 points on every frontier model&lt;/a&gt; (Interfaze AI, 2026). The SOB (Structured Output Benchmark) leaderboard shows the top six models within one point of each other on overall score, with structural metrics such as Path Recall and Type Safety reading 99% while 20-30% of leaf values remain wrong.&lt;/p&gt;
&lt;p&gt;Quality ceiling, in this context, means the task-relevant rubric criteria are saturated across models of materially different cost tiers. It does not mean all models are interchangeable for all tasks. Reasoning-heavy chains, multi-step tool orchestration, and complex disambiguation tasks continue to stratify models. The ceiling applies to structured extraction and generation against a defined schema, the domain where Exp9 was conducted.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://interfaze.ai/blog/introducing-structured-output-benchmark&quot;&gt;Model size is not a reliable predictor of value accuracy&lt;/a&gt;: open-weight GLM-5.1, GLM-4.7, and Qwen3.5-35B beat GPT-5, Claude-Opus-4.7, and Claude-Sonnet-4.6 on unified Value Accuracy in the SOB benchmark (Interfaze AI, 2026). Exp9 adds a cost-controlled data point: when Gemma 4 26B-A4B, a mixture-of-experts (MoE) model activating 4 billion of its 26 billion parameters per forward pass, operates at the same rubric level as models priced 28x and 95x higher, the ceiling is the signal.&lt;/p&gt;
&lt;h2 id=&quot;how-was-experiment-9-designed-to-avoid-benchmark-gaming&quot;&gt;How Was Experiment 9 Designed to Avoid Benchmark Gaming?&lt;/h2&gt;
&lt;p&gt;Exp9 (&lt;a href=&quot;https://github.com/clouatre-labs/llm-agent-experiments/pull/44&quot;&gt;Clouatre, 2026&lt;/a&gt;) applied a pre-registered rubric before any model results were observed. The rubric covered eight criteria, C1 through C8, capturing schema compliance, value accuracy, field completeness, format adherence, instruction following, edge-case handling, output coherence, and response length within budget. All three models were evaluated under a blind protocol: n=10 samples per model (30 total), routed through the OpenRouter endpoint, with no post-hoc rubric adjustments.&lt;/p&gt;
&lt;p&gt;The pre-registration constraint is the key methodological safeguard. Rubric criteria were fixed before evaluation commenced, precluding the selection of metrics that favor any particular model after results were visible. LLM-judge scoring was applied to criteria C6 and C7, using a separate model as the evaluator. Haiku 4.5 and Sonnet 5 each scored 20/20 on those criteria; Gemma 4 scored 18/20, a two-point difference that appears in the LLM-judge outputs but not in the objective scores for C1-C5 or C8.&lt;/p&gt;
&lt;h2 id=&quot;what-did-the-blind-evaluation-reveal-about-cost-versus-quality&quot;&gt;What Did the Blind Evaluation Reveal About Cost Versus Quality?&lt;/h2&gt;
&lt;p&gt;On criteria C1 through C7, all three models scored identically: pass on every objective criterion. The LLM-judge scores for C6 and C7 showed Haiku 4.5 and Sonnet 5 at 10/10 each (20/20 judge points) and Gemma 4 at 18/20, with one missed point on C6 and one on C7, both from run-91. That two-point gap is within LLM-judge variance and does not represent a functional quality difference on the task.&lt;/p&gt;

































&lt;table tabindex=&quot;0&quot;&gt;&lt;caption&gt;&lt;strong&gt;Table 1:&lt;/strong&gt; Exp9 per-model results (n=10 per model, 30 total, pre-registered rubric). Sonnet 5 at intro rates ($2/$10 per MTok input/output, valid through Aug 31, 2026); standard is $3/$15. Cost/run computed from Exp9 mean token counts: 1,723 input and 3,646 output tokens per Sonnet 5 call; 1,128 input and 996 output for Gemma 4.&lt;/caption&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Model&lt;/th&gt;&lt;th&gt;C6/C7 judge&lt;/th&gt;&lt;th&gt;C8&lt;/th&gt;&lt;th&gt;Cost/run&lt;/th&gt;&lt;th&gt;vs Gemma 4&lt;/th&gt;&lt;/tr&gt;&lt;/thead&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;Gemma 4 26B-A4B&lt;/td&gt;&lt;td&gt;18/20&lt;/td&gt;&lt;td&gt;Truncation (10%)&lt;/td&gt;&lt;td&gt;$0.00042&lt;/td&gt;&lt;td&gt;baseline&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Haiku 4.5&lt;/td&gt;&lt;td&gt;20/20&lt;/td&gt;&lt;td&gt;Pass&lt;/td&gt;&lt;td&gt;$0.0119&lt;/td&gt;&lt;td&gt;28x&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Sonnet 5&lt;/td&gt;&lt;td&gt;20/20&lt;/td&gt;&lt;td&gt;Truncation (20%)&lt;/td&gt;&lt;td&gt;$0.0399&lt;/td&gt;&lt;td&gt;95x&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;
&lt;h3 id=&quot;what-does-a-95x-cost-spread-mean-at-scale&quot;&gt;What Does a 95x Cost Spread Mean at Scale?&lt;/h3&gt;
&lt;p&gt;Seven of eight rubric criteria produce no differentiation. Selecting Sonnet 5 over Gemma 4 for structured-output workloads matching the Exp9 task profile delivers no measurable quality gain at 95x the cost. The one criterion where differentiation appeared is addressed in the following section.&lt;/p&gt;
&lt;figure&gt;&lt;figcaption&gt;&lt;strong&gt;Code Snippet 1:&lt;/strong&gt; Monthly cost calculator using OpenRouter 2026-07-06 pricing&lt;/figcaption&gt;&lt;pre class=&quot;astro-code astro-code-themes catppuccin-latte catppuccin-macchiato mt-8&quot; style=&quot;--shiki-light:#4c4f69; --shiki-dark:#cad3f5; --shiki-light-bg:#eff1f5; --shiki-dark-bg:#24273a; --file-name-offset: -0.75rem&quot; tabindex=&quot;0&quot; data-language=&quot;python&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;COST_PER_RUN &lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt; {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;    &quot;gemma-4-26b-a4b&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#FE640B;--shiki-dark:#F5A97F&quot;&gt; 0.00042&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;    &quot;claude-haiku-4-5&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#FE640B;--shiki-dark:#F5A97F&quot;&gt; 0.01190&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;    &quot;claude-sonnet-5&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#FE640B;--shiki-dark:#F5A97F&quot;&gt;  0.03990&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-dark:#C6A0F6&quot;&gt;def&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-light-font-style:italic;--shiki-dark:#8AADF4;--shiki-dark-font-style:italic&quot;&gt; monthly_cost&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--shiki-light:#E64553;--shiki-light-font-style:italic;--shiki-dark:#EE99A0;--shiki-dark-font-style:italic&quot;&gt;model&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-light-font-style:italic;--shiki-dark:#C6A0F6;--shiki-dark-font-style:italic&quot;&gt; str&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;--shiki-light:#E64553;--shiki-light-font-style:italic;--shiki-dark:#EE99A0;--shiki-dark-font-style:italic&quot;&gt; runs_per_month&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-light-font-style:italic;--shiki-dark:#C6A0F6;--shiki-dark-font-style:italic&quot;&gt; int&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt; -&gt;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-light-font-style:italic;--shiki-dark:#C6A0F6;--shiki-dark-font-style:italic&quot;&gt; float&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;    &quot;&quot;&quot;Return total monthly cost in USD.&quot;&quot;&quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-dark:#C6A0F6&quot;&gt;    return&lt;/span&gt;&lt;span style=&quot;--shiki-light:#E64553;--shiki-light-font-style:italic;--shiki-dark:#EE99A0;--shiki-dark-font-style:italic&quot;&gt; COST_PER_RUN&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;--shiki-light:#E64553;--shiki-light-font-style:italic;--shiki-dark:#EE99A0;--shiki-dark-font-style:italic&quot;&gt;model&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt; *&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt; runs_per_month&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-dark:#C6A0F6&quot;&gt;def&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-light-font-style:italic;--shiki-dark:#8AADF4;--shiki-dark-font-style:italic&quot;&gt; cost_per_run&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--shiki-light:#E64553;--shiki-light-font-style:italic;--shiki-dark:#EE99A0;--shiki-dark-font-style:italic&quot;&gt;model&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-light-font-style:italic;--shiki-dark:#C6A0F6;--shiki-dark-font-style:italic&quot;&gt; str&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt; -&gt;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-light-font-style:italic;--shiki-dark:#C6A0F6;--shiki-dark-font-style:italic&quot;&gt; float&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;    &quot;&quot;&quot;Return per-run cost in USD.&quot;&quot;&quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-dark:#C6A0F6&quot;&gt;    return&lt;/span&gt;&lt;span style=&quot;--shiki-light:#E64553;--shiki-light-font-style:italic;--shiki-dark:#EE99A0;--shiki-dark-font-style:italic&quot;&gt; COST_PER_RUN&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;--shiki-light:#E64553;--shiki-light-font-style:italic;--shiki-dark:#EE99A0;--shiki-dark-font-style:italic&quot;&gt;model&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-light-font-style:italic;--shiki-dark:#939AB7;--shiki-dark-font-style:italic&quot;&gt;# Example: 1 million runs/month&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-dark:#C6A0F6&quot;&gt;for&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt; m&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt; c &lt;/span&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-dark:#C6A0F6&quot;&gt;in&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt; COST_PER_RUN&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;items&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;():&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#FE640B;--shiki-light-font-style:italic;--shiki-dark:#F5A97F;--shiki-dark-font-style:italic&quot;&gt;    print&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-light-font-style:italic;--shiki-dark:#A6DA95;--shiki-dark-font-style:italic&quot;&gt;f&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#EA76CB;--shiki-dark:#F5BDE6&quot;&gt;{&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;m&lt;/span&gt;&lt;span style=&quot;--shiki-light:#EA76CB;--shiki-dark:#F5BDE6&quot;&gt;}&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;: $&lt;/span&gt;&lt;span style=&quot;--shiki-light:#EA76CB;--shiki-dark:#F5BDE6&quot;&gt;{&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;monthly_cost&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;m&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;--shiki-light:#FE640B;--shiki-dark:#F5A97F&quot;&gt; 1_000_000&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-dark:#C6A0F6&quot;&gt;:,.0f&lt;/span&gt;&lt;span style=&quot;--shiki-light:#EA76CB;--shiki-dark:#F5BDE6&quot;&gt;}&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;/month&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;)&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;span class=&quot;absolute py-1 text-foreground text-xs font-medium leading-4 pl-4 pr-2 before:inline-block before:size-1 before:bg-green-500 before:rounded-full before:absolute before:top-[45%] before:left-2 left-2 top-(--file-name-offset) border rounded-md bg-background&quot;&gt;scripts/model_cost_convergence.py&lt;/span&gt;&lt;/pre&gt;&lt;/figure&gt;
&lt;h2 id=&quot;when-does-switching-to-open-weight-models-make-economic-sense&quot;&gt;When Does Switching to Open-Weight Models Make Economic Sense?&lt;/h2&gt;
&lt;p&gt;The cost decision tree below maps monthly token volume to the go/no-go threshold. At Exp9’s mean of ~2,100 tokens per call, 50 million tokens per month corresponds to roughly 24,000 structured-output calls. Under that threshold, the API cost delta does not justify the operational overhead of self-hosting; GPU infrastructure, continuous batching tuning, and MLOps staffing add costs that typically exceed token savings at low volume. Above 500 million tokens per month, the $530 vs $18,000 per month comparison makes the case; the intermediate path is a managed open-weight inference provider (OpenRouter, Together AI, Baseten), not bare-metal self-hosting.&lt;/p&gt;
&lt;figure&gt;&lt;img alt=&quot;Cost decision tree by monthly token volume: under 50M tokens/month no switch needed, above 500M strong case for open-weights&quot; loading=&quot;eager&quot; decoding=&quot;sync&quot; fetchpriority=&quot;high&quot; sizes=&quot;(min-width: 805px) 805px, 100vw&quot; data-astro-image=&quot;constrained&quot; data-astro-image-pos=&quot;center&quot; width=&quot;805&quot; height=&quot;484&quot; src=&quot;/_astro/open-weights-cost-axis.BTPSADIP_1zlft2.svg&quot; srcset=&quot;/_astro/open-weights-cost-axis.BTPSADIP_294Ejq.svg 640w, /_astro/open-weights-cost-axis.BTPSADIP_Z1Al769.svg 750w, /_astro/open-weights-cost-axis.BTPSADIP_1zlft2.svg 805w&quot;&gt;&lt;figcaption&gt;&lt;strong&gt;Figure 1:&lt;/strong&gt; Cost decision tree by monthly token volume. Under 50M tokens/month the cost delta does not justify a switch; the 50M-500M band requires quality and latency evaluation (see Figure 2); above 500M the open-weights case is strong.&lt;/figcaption&gt;&lt;/figure&gt;
&lt;h2 id=&quot;why-is-c8-a-token-budget-problem-not-a-reasoning-problem&quot;&gt;Why Is C8 a Token Budget Problem, Not a Reasoning Problem?&lt;/h2&gt;
&lt;p&gt;C8 failures (response length within budget) in Gemma 4 26B-A4B were exclusively token-limit truncations. Outputs were structurally correct and semantically accurate until the token budget was exhausted; responses did not produce incoherence or malformed output. They simply stopped. Haiku 4.5 had no C8 failures. Sonnet 5 also hit the 4096-token cap in run-112 and run-113; its mean output of 3,652 tokens per run versus 996 for Gemma 4 makes it the most verbose model and the one most exposed to truncation risk at higher completion budgets.&lt;/p&gt;
&lt;h3 id=&quot;what-does-c8-mean-for-self-hosted-vs-managed-inference&quot;&gt;What Does C8 Mean for Self-Hosted vs. Managed Inference?&lt;/h3&gt;
&lt;p&gt;The fix is a configuration change, not a model substitution. Increasing the max_tokens parameter to the 95th-percentile response length eliminates the failure mode. That said, C8 illustrates a broader operational reality: production inference is not a configuration exercise. Naive self-hosted deployments achieve 30 to 40 percent GPU utilization; a production-tuned stack using continuous batching and PagedAttention reaches 80 to 90 percent, a 2 to 3x cost differential on identical hardware (Kiely, 2026). C8 on a managed API is an operational parameter; C8 on a self-hosted stack is the entry point to inference engineering.&lt;/p&gt;
&lt;figure&gt;&lt;figcaption&gt;&lt;strong&gt;Code Snippet 2:&lt;/strong&gt; max_tokens configuration fix for C8, targeting the 95th-percentile response length&lt;/figcaption&gt;&lt;pre class=&quot;astro-code astro-code-themes catppuccin-latte catppuccin-macchiato mt-8&quot; style=&quot;--shiki-light:#4c4f69; --shiki-dark:#cad3f5; --shiki-light-bg:#eff1f5; --shiki-dark-bg:#24273a; --file-name-offset: -0.75rem&quot; tabindex=&quot;0&quot; data-language=&quot;python&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-dark:#C6A0F6&quot;&gt;import&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt; httpx&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-light-font-style:italic;--shiki-dark:#939AB7;--shiki-dark-font-style:italic&quot;&gt;# Before: default completion limit caused C8 truncation failures&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-light-font-style:italic;--shiki-dark:#939AB7;--shiki-dark-font-style:italic&quot;&gt;# payload_before = {&quot;model&quot;: &quot;google/gemma-4-26b-a4b&quot;, &quot;max_tokens&quot;: 1024}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-light-font-style:italic;--shiki-dark:#939AB7;--shiki-dark-font-style:italic&quot;&gt;# After: set max_tokens to 95th-percentile observed response length&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-light-font-style:italic;--shiki-dark:#939AB7;--shiki-dark-font-style:italic&quot;&gt;# Heuristic: sample 100 runs, take p95 token count, round up to nearest 512&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;payload &lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt; {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;    &quot;model&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; &quot;google/gemma-4-26b-a4b&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;    &quot;max_tokens&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#FE640B;--shiki-dark:#F5A97F&quot;&gt; 4096&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-light-font-style:italic;--shiki-dark:#939AB7;--shiki-dark-font-style:italic&quot;&gt;  # p95 for Exp9 task distribution&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;    &quot;messages&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt; [{&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;&quot;role&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; &quot;user&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; &quot;content&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; &quot;...&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;}],&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;response &lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt; httpx&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;post&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;(&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;    &quot;https://openrouter.ai/api/v1/chat/completions&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#E64553;--shiki-light-font-style:italic;--shiki-dark:#EE99A0;--shiki-dark-font-style:italic&quot;&gt;    json&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;payload&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#E64553;--shiki-light-font-style:italic;--shiki-dark:#EE99A0;--shiki-dark-font-style:italic&quot;&gt;    headers&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;{&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;&quot;Authorization&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; &quot;Bearer $OPENROUTER_API_KEY&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;},&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;)&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;span class=&quot;absolute py-1 text-foreground text-xs font-medium leading-4 pl-4 pr-2 before:inline-block before:size-1 before:bg-green-500 before:rounded-full before:absolute before:top-[45%] before:left-2 left-2 top-(--file-name-offset) border rounded-md bg-background&quot;&gt;scripts/openrouter_invoke.py&lt;/span&gt;&lt;/pre&gt;&lt;/figure&gt;
&lt;h2 id=&quot;how-wide-is-the-remaining-gap-between-open-and-closed-models&quot;&gt;How Wide Is the Remaining Gap Between Open and Closed Models?&lt;/h2&gt;
&lt;p&gt;The structured-output quality ceiling does not imply open-weights have reached parity on all tasks. &lt;a href=&quot;https://epochai.org/blog/tracking-the-capability-gap-between-closed-and-open-source-models&quot;&gt;Open-weight models trail closed-source frontier by approximately 4 months&lt;/a&gt; as of May 2026, measured by Epoch AI’s Epoch Capabilities Index (ECI; Epoch AI, 2026). That gap is real and worth quantifying before deployment decisions.&lt;/p&gt;
&lt;p&gt;The &lt;a href=&quot;https://llm-stats.com/&quot;&gt;reasoning gap between open and closed models measures approximately 13 points on structured benchmarks&lt;/a&gt; as of June 2026 (LLM Stats, 2026). This gap manifests primarily in multi-step reasoning, adversarial prompts, and tasks requiring synthesis across long contexts. Structured-output extraction against a defined schema, the Exp9 task class, falls below the threshold where that gap becomes operational.&lt;/p&gt;
&lt;figure&gt;&lt;img alt=&quot;Quality and latency gate decision tree: P50 latency requirement and rubric score thresholds determine whether fine-tuning is needed before open-weights promotion&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; sizes=&quot;(min-width: 852px) 852px, 100vw&quot; data-astro-image=&quot;constrained&quot; data-astro-image-pos=&quot;center&quot; width=&quot;852&quot; height=&quot;761&quot; src=&quot;/_astro/open-weights-quality-latency-axis.CtRrRRmh_Z1J7FTS.svg&quot; srcset=&quot;/_astro/open-weights-quality-latency-axis.CtRrRRmh_ZiCIaO.svg 640w, /_astro/open-weights-quality-latency-axis.CtRrRRmh_Z1cmoua.svg 750w, /_astro/open-weights-quality-latency-axis.CtRrRRmh_Z2dFP1r.svg 828w, /_astro/open-weights-quality-latency-axis.CtRrRRmh_Z1J7FTS.svg 852w&quot;&gt;&lt;figcaption&gt;&lt;strong&gt;Figure 2:&lt;/strong&gt; Quality and latency gate. P50 latency requirement and rubric score thresholds determine whether fine-tuning is needed before open-weights promotion.&lt;/figcaption&gt;&lt;/figure&gt;
&lt;h3 id=&quot;what-are-the-scope-boundaries&quot;&gt;What Are the Scope Boundaries?&lt;/h3&gt;
&lt;p&gt;Two scope boundaries apply to Exp9 specifically. Tool calling was not tested; Gemma 4 26B-A4B scores 68.2% on tau2-bench agentic benchmarks vs higher scores on closed alternatives, and that gap has not been evaluated under the same controlled conditions. Exp9 results generalize to structured extraction and generation tasks; extension to multi-step agentic pipelines requires separate experimentation.&lt;/p&gt;
&lt;p&gt;The practical heuristic: use open-weights for tasks where the Exp9 rubric class applies (structured extraction, schema validation, templated generation). Evaluate closed frontier models for tasks requiring the top 13 reasoning points or tool-orchestration depth that currently differentiate them. &lt;a href=&quot;https://letsdatascience.com/blog/open-source-vs-closed-llms-choosing-the-right-model-in-2026&quot;&gt;Five independent open model families reached frontier quality simultaneously by early 2026&lt;/a&gt; (LetsDataScience, 2026), confirming the convergence is structural rather than attributable to any single model or provider.&lt;/p&gt;
&lt;h2 id=&quot;when-do-closed-models-still-win&quot;&gt;When Do Closed Models Still Win?&lt;/h2&gt;
&lt;p&gt;Five conditions favor closed-model APIs regardless of token-cost arithmetic:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;No inference engineering team.&lt;/strong&gt; Self-hosting a 26B MoE model in production requires continuous batching configuration, KV-cache tuning, GPU health monitoring, and model rollback procedures, at minimum 0.5 FTE MLOps. Without that capability, infrastructure cost exceeds token savings.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Contractual SLA required.&lt;/strong&gt; Self-hosted deployments carry no vendor uptime guarantee and no incident escalation path. Closed-model APIs provide contractual SLAs; for production systems with business continuity obligations, that is a hard requirement.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Interactive latency below 2,000 ms P50 required.&lt;/strong&gt; Self-hosted MoE inference on commodity hardware does not reliably meet sub-2-second P50 targets. Closed API endpoints with dedicated capacity are the appropriate choice for latency-sensitive workloads.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Reasoning-heavy or agentic tasks.&lt;/strong&gt; Multi-step tool orchestration, adversarial disambiguation, and long-context synthesis fall in the region where the benchmark gap translates to production failures. Gemma 4 26B-A4B scores 68.2% on tau2-bench agentic benchmarks versus higher scores on closed alternatives.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;GPU generation mismatch.&lt;/strong&gt; Open-weight model releases are coupled to GPU generation cycles; a successor model may ship kernels optimized for a different architecture, requiring months of porting before stable performance on the incumbent stack (Kiely, 2026).&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;what-does-apache-20-licensing-change-for-enterprise-procurement&quot;&gt;What Does Apache 2.0 Licensing Change for Enterprise Procurement?&lt;/h2&gt;
&lt;p&gt;&lt;a href=&quot;https://ai.google.dev/gemma/docs/core/model_card_4&quot;&gt;All four Gemma 4 models ship under the Apache 2.0 license&lt;/a&gt; with native function calling and structured JSON output support (Google DeepMind, 2026). Apache 2.0 permits commercial use, modification, and redistribution without requiring downstream source disclosure. That removes one procurement bottleneck. It does not provide vendor indemnification for model outputs, GPU procurement lead-time relief (H100 SXM5 lead time is 2-6 weeks), or a patch cadence for weight-level security vulnerabilities; those responsibilities transfer to the deploying organization.&lt;/p&gt;
&lt;h3 id=&quot;what-does-self-hosting-provide-for-audit-trails&quot;&gt;What Does Self-Hosting Provide for Audit Trails?&lt;/h3&gt;
&lt;p&gt;The audit trail advantage is concrete. A self-hosted model with a SHA-256 hash of the weights, version-pinned dependencies, and deterministic inference configuration produces a reproducible artifact satisfying change-management requirements. Cloud API endpoints provide no equivalent: model versions can be updated by the provider without notice, and the inference path is opaque. Open-weight GPAI models released under a free open-source license are &lt;a href=&quot;https://www.alation.com/blog/eu-ai-act-compliance-guide&quot;&gt;exempt from Annex XI technical documentation and Annex XII downstream provider information requirements&lt;/a&gt; under the EU AI Act (Alation, 2026), though copyright compliance and training data summaries are still required.&lt;/p&gt;

























&lt;table tabindex=&quot;0&quot;&gt;&lt;caption&gt;&lt;strong&gt;Table 2:&lt;/strong&gt; Regulatory posture by deployment model&lt;/caption&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Regulation&lt;/th&gt;&lt;th&gt;Open-weights (Apache 2.0)&lt;/th&gt;&lt;th&gt;Proprietary API&lt;/th&gt;&lt;/tr&gt;&lt;/thead&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;EU AI Act GPAI (Aug 2026)&lt;/td&gt;&lt;td&gt;Exempt from Annex XI/XII documentation&lt;/td&gt;&lt;td&gt;Full documentation required&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Audit trail&lt;/td&gt;&lt;td&gt;SHA-256 weight pin, reproducible&lt;/td&gt;&lt;td&gt;Provider-controlled, opaque&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Data residency&lt;/td&gt;&lt;td&gt;Self-hosted on EU infrastructure&lt;/td&gt;&lt;td&gt;Cross-border transfer triggers GDPR Art. 46&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;
&lt;h2 id=&quot;how-does-eu-ai-act-enforcement-shift-the-data-residency-calculus&quot;&gt;How Does EU AI Act Enforcement Shift the Data Residency Calculus?&lt;/h2&gt;
&lt;p&gt;GPAI enforcement powers activate August 2, 2026 under Articles 101 and 113. The fine schedule is compact:&lt;/p&gt;























&lt;table tabindex=&quot;0&quot;&gt;&lt;caption&gt;&lt;strong&gt;Table 3:&lt;/strong&gt; EU AI Act enforcement schedule (GPAI, 2026)&lt;/caption&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Enforcement Date&lt;/th&gt;&lt;th&gt;Provision&lt;/th&gt;&lt;th&gt;Fine Standard&lt;/th&gt;&lt;th&gt;Fine Serious&lt;/th&gt;&lt;/tr&gt;&lt;/thead&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;Aug 2, 2026&lt;/td&gt;&lt;td&gt;GPAI obligations (Art. 101/113); Transparency (Art. 50)&lt;/td&gt;&lt;td&gt;EUR 15M or 3% global turnover&lt;/td&gt;&lt;td&gt;EUR 35M or 7% global turnover&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Dec 2, 2027&lt;/td&gt;&lt;td&gt;High-risk systems (Art. 9-17)&lt;/td&gt;&lt;td&gt;EUR 15M or 3% global turnover&lt;/td&gt;&lt;td&gt;EUR 35M or 7% global turnover&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;
&lt;p&gt;The serious-violation ceiling exceeds GDPR maximums (Alation, 2026). &lt;a href=&quot;https://www.ewsolutions.com/eu-ai-act-updates-2026&quot;&gt;US-based institutions produced 40 notable AI models in 2024 vs 15 from China and 3 from Europe&lt;/a&gt;, meaning enforcement pressure falls disproportionately on US cloud providers serving European organizations (EWSolutions, 2026).&lt;/p&gt;
&lt;h3 id=&quot;does-using-a-third-party-api-create-a-data-residency-risk&quot;&gt;Does Using a Third-Party API Create a Data Residency Risk?&lt;/h3&gt;
&lt;p&gt;Data processed through a third-party API in a foreign jurisdiction creates a transfer record triggering GDPR Article 46 analysis. Data processed through a self-hosted model in the deploying organization’s own infrastructure does not. Managed closed-model providers with EU-resident deployments (Azure OpenAI EU data zones, Vertex AI EU regions, Bedrock Frankfurt) satisfy the same Article 46 requirement without the infrastructure burden, at the cost of weight-level auditability. The choice is between operational simplicity and documentation control, not between compliant and non-compliant.&lt;/p&gt;
&lt;h2 id=&quot;takeaways&quot;&gt;Takeaways&lt;/h2&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Quality ceiling reached for this task class:&lt;/strong&gt; Gemma 4 26B-A4B matched Claude Haiku 4.5 and Claude Sonnet 5 on C1-C7 across n=30 blind trials (10 per model); results do not generalize to reasoning-heavy, agentic, or latency-sensitive workloads.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;C8 is a configuration problem, not a capability problem:&lt;/strong&gt; Token-limit truncations are correctable by adjusting completion budgets; they do not indicate a reasoning gap.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;API token cost favors open weights above volume thresholds; TCO requires separate modelling.&lt;/strong&gt; The 28x-95x spread reaches $39,480 per million monthly runs at identical rubric quality via managed API. Self-hosted TCO adds GPU infrastructure, 0.5 or more FTE MLOps, and idle-utilization loss; break-even sits at 35 to 50 million tokens per month for a single-GPU MoE deployment; multi-GPU open-weight models require ~256M tokens per month against a premium API (&lt;a href=&quot;https://letsdatascience.com/blog/open-source-vs-closed-llms-choosing-the-right-model-in-2026&quot;&gt;LetsDataScience, 2026&lt;/a&gt;).&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Reasoning gap exists and is bounded:&lt;/strong&gt; Open-weights trail closed frontier by approximately 4 months and 8 ECI points; that gap surfaces in reasoning-heavy tasks, not in the Exp9 structured-output class.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Apache 2.0 self-hosting is a viable EU AI Act compliance path, not the only one.&lt;/strong&gt; SHA-256 weight pins and GPAI open-source exemptions provide documentation control; managed EU-resident providers satisfy the same data-residency requirement with contractual SLAs and no inference infrastructure ownership.&lt;/li&gt;
&lt;/ol&gt;
&lt;hr&gt;
&lt;h2 id=&quot;references&quot;&gt;References&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Alation, “EU AI Act Compliance: A Practical Guide for 2026-2027” (2026) — &lt;a href=&quot;https://www.alation.com/blog/eu-ai-act-compliance-guide&quot;&gt;https://www.alation.com/blog/eu-ai-act-compliance-guide&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Clouatre, H., “Exp9: Gemma 4 26B-A4B vs Haiku 4.5 vs Sonnet 5 structured-output blind evaluation” (2026) — &lt;a href=&quot;https://github.com/clouatre-labs/llm-agent-experiments#replication-study-experiment-9&quot;&gt;https://github.com/clouatre-labs/llm-agent-experiments#replication-study-experiment-9&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;DeepInfra, “Gemma 4 on DeepInfra: Fast &amp;#x26; Scalable Open AI Models” (2026) — &lt;a href=&quot;https://deepinfra.com/blog/gemma-4-on-deepinfra&quot;&gt;https://deepinfra.com/blog/gemma-4-on-deepinfra&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Epoch AI, “Open models lag state-of-the-art closed models by 4 months” (2026) — &lt;a href=&quot;https://epoch.ai/data-insights/open-closed-eci-gap&quot;&gt;https://epoch.ai/data-insights/open-closed-eci-gap&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;EWSolutions, “EU AI Act Updates 2026: What US Firms Must Do” (2026) — &lt;a href=&quot;https://www.ewsolutions.com/eu-ai-act-updates-2026&quot;&gt;https://www.ewsolutions.com/eu-ai-act-updates-2026&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Google DeepMind, “Gemma 4 model card” (2026) — &lt;a href=&quot;https://ai.google.dev/gemma/docs/core/model_card_4&quot;&gt;https://ai.google.dev/gemma/docs/core/model_card_4&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Interfaze AI, “Introducing SOB: A Multi-Source Structured Output Benchmark for LLMs” (2026) — &lt;a href=&quot;https://interfaze.ai/blog/introducing-structured-output-benchmark&quot;&gt;https://interfaze.ai/blog/introducing-structured-output-benchmark&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Kiely, P., “Inference Engineering” (2026) — &lt;a href=&quot;https://www.baseten.co/inference-engineering/&quot;&gt;https://www.baseten.co/inference-engineering/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;LetsDataScience, “Open Source vs Closed LLMs: The 2026 Decision Framework” (2026) — &lt;a href=&quot;https://letsdatascience.com/blog/open-source-vs-closed-llms-choosing-the-right-model-in-2026&quot;&gt;https://letsdatascience.com/blog/open-source-vs-closed-llms-choosing-the-right-model-in-2026&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;LLM Stats, “LLM Benchmark Leaderboard” (2026) — &lt;a href=&quot;https://llm-stats.com/&quot;&gt;https://llm-stats.com/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Singh, A. K. et al., “SOB: A Benchmark for Evaluating Structured Output Quality in Large Language Models” (2026) — &lt;a href=&quot;https://doi.org/10.48550/arXiv.2604.25359&quot;&gt;https://doi.org/10.48550/arXiv.2604.25359&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</content:encoded><category>agentic-ai</category><category>ai-engineering</category><category>case-studies</category><category>architecture</category><author>Hugues Clouâtre</author></item><item><title>AI Approval Gates: Engineering Oversight at Machine Speed</title><link>https://clouatre.ca/posts/ai-approval-gates/</link><guid isPermaLink="true">https://clouatre.ca/posts/ai-approval-gates/</guid><description>AI approval gates: reversibility-tiered human-in-the-loop design with four health metrics that prevent reviewer atrophy at machine speed.</description><pubDate>Tue, 07 Jul 2026 11:42:00 GMT</pubDate><content:encoded>&lt;p&gt;In April 2026, a PocketOS coding agent deleted a production database and its only backup in nine seconds, triggering a 30-hour outage (&lt;a href=&quot;https://www.cerbos.dev/blog/ai-coding-agent-deleted-a-production-database-in-9-seconds&quot;&gt;Crane, 2026&lt;/a&gt;). No gate existed to stop it. Tiering approval gates by action reversibility, not risk category, is the structural fix. This post gives a three-tier gate model, the reviewer atrophy research behind it, and the four metrics that tell you when the gates are holding.&lt;/p&gt;
&lt;h2 id=&quot;table-of-contents&quot;&gt;Table of contents&lt;/h2&gt;
&lt;p&gt;&lt;/p&gt;&lt;details&gt;&lt;summary&gt;Contents&lt;/summary&gt;&lt;p&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;#why-are-ai-agents-causing-production-incidents-without-any-external-attacker&quot;&gt;Why Are AI Agents Causing Production Incidents Without Any External Attacker?&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#why-does-adding-a-human-reviewer-sometimes-make-things-worse&quot;&gt;Why Does Adding a Human Reviewer Sometimes Make Things Worse?&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;#why-debugging-skill-is-the-specific-casualty&quot;&gt;Why Debugging Skill Is the Specific Casualty&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#what-does-dora-say-about-external-approval-processes&quot;&gt;What Does DORA Say About External Approval Processes?&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#what-is-reversibility-and-why-does-it-define-the-gate-design&quot;&gt;What Is Reversibility, and Why Does It Define the Gate Design?&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;#why-risk-category-fails-as-a-gate-axis&quot;&gt;Why Risk Category Fails as a Gate Axis&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#what-does-the-eu-ai-act-require-from-this-design&quot;&gt;What Does the EU AI Act Require From This Design?&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#how-does-a-three-tier-reversibility-gate-work-in-practice&quot;&gt;How Does a Three-Tier Reversibility Gate Work in Practice?&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;#what-happens-when-an-action-is-mis-tiered&quot;&gt;What Happens When an Action Is Mis-Tiered?&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#how-do-you-prevent-reviewer-atrophy-from-hollowing-out-the-judgment-tier&quot;&gt;How Do You Prevent Reviewer Atrophy From Hollowing Out the Judgment Tier?&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#how-do-you-measure-whether-your-gates-are-holding&quot;&gt;How Do You Measure Whether Your Gates Are Holding?&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#what-should-engineering-leaders-act-on&quot;&gt;What Should Engineering Leaders Act On?&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#references&quot;&gt;References&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;/p&gt;&lt;/details&gt;&lt;p&gt;&lt;/p&gt;
&lt;h2 id=&quot;why-are-ai-agents-causing-production-incidents-without-any-external-attacker&quot;&gt;Why Are AI Agents Causing Production Incidents Without Any External Attacker?&lt;/h2&gt;
&lt;p&gt;&lt;a href=&quot;https://www.cyera.com/research/agent-inflicted-damage-inside-the-real-world-failures-of-enterprise-ai-systems&quot;&gt;Cyera’s dataset of 7,246 publicly reported AI incident records&lt;/a&gt; isolates 188 cases where corporate production environments were harmed by the AI system itself (Cyera Research, 2026). These are not adversarial attacks. They are authorized agents completing assigned tasks with insufficient constraint on action scope.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://www.coderabbit.ai/blog/state-of-ai-vs-human-code-generation-report&quot;&gt;CodeRabbit’s analysis of 470 pull requests&lt;/a&gt; found AI-generated code produces 2.74 times more XSS vulnerabilities and 1.57 times more security findings overall (CodeRabbit, 2025). &lt;a href=&quot;https://www.faros.ai/research/ai-acceleration-whiplash&quot;&gt;Faros AI’s telemetry across 22,000 developers&lt;/a&gt; documents a 242.7% increase in incidents per PR (Faros AI, 2026).&lt;/p&gt;
&lt;p&gt;A second threat is behavioral: when an agent is blocked from one execution path, it finds another. An agent prevented from calling an API directly may route the same action through browser automation or a chained tool call. Static permission scopes cannot anticipate every path an agent will discover; runtime enforcement intercepts actions as they execute, not only at task classification, complementing what a blocklist-only model cannot cover.&lt;/p&gt;
&lt;p&gt;The production incident rate is not a model quality problem alone. Regulated industries built every governance control on a deterministic assumption: the same input produces the same output, every time. Agents are probabilistic. Every audit trail, approval gate, and access policy in your stack was designed for a world that no longer exists once agents enter it. In practice, operators compounded this by defining permissions at the identity level (what the agent could authenticate to) rather than the action level: what it could execute without human confirmation.&lt;/p&gt;
&lt;h2 id=&quot;why-does-adding-a-human-reviewer-sometimes-make-things-worse&quot;&gt;Why Does Adding a Human Reviewer Sometimes Make Things Worse?&lt;/h2&gt;
&lt;p&gt;The &lt;a href=&quot;https://www.nature.com/articles/s41562-024-02024-1&quot;&gt;Vaccaro et al. meta-analysis&lt;/a&gt; examined 106 experiments across 74 studies and found human-AI combinations were outperformed by either humans or AI alone (Vaccaro et al., 2024). When AI was stronger than the reviewer, adding a human created approval theater: a process that looks like oversight but delivers none.&lt;/p&gt;
&lt;p&gt;The &lt;a href=&quot;https://doi.org/10.48550/arXiv.2601.20245&quot;&gt;Anthropic RCT by Shen and Tamkin&lt;/a&gt; sharpens the mechanism: 52 junior engineers randomized to AI-assisted conditions showed 17% lower comprehension scores on debugging tasks (Shen and Tamkin, 2026).&lt;/p&gt;
&lt;h3 id=&quot;why-debugging-skill-is-the-specific-casualty&quot;&gt;Why Debugging Skill Is the Specific Casualty&lt;/h3&gt;
&lt;p&gt;Debugging requires tracing causation backward from a symptom without the model’s assistance. When AI supplies those intermediate steps, the engineer’s causal-reasoning muscle goes unexercised. The more AI assistance a reviewer receives in their own daily work, the less that muscle is maintained.&lt;/p&gt;
&lt;figure&gt;&lt;img alt=&quot;Reviewer atrophy feedback loop showing how rising AI volume degrades review quality and the reversibility gate as the structural break point&quot; loading=&quot;eager&quot; decoding=&quot;sync&quot; fetchpriority=&quot;high&quot; sizes=&quot;(min-width: 420px) 420px, 100vw&quot; data-astro-image=&quot;constrained&quot; data-astro-image-pos=&quot;center&quot; width=&quot;420&quot; height=&quot;599&quot; src=&quot;/_astro/reviewer-atrophy-loop.B6j2jyUe_ZlxtCU.svg&quot; srcset=&quot;/_astro/reviewer-atrophy-loop.B6j2jyUe_ZlxtCU.svg 420w&quot;&gt;&lt;figcaption&gt;&lt;strong&gt;Figure 1:&lt;/strong&gt; Reviewer atrophy feedback loop and the structural break point.&lt;/figcaption&gt;&lt;/figure&gt;
&lt;h3 id=&quot;what-does-dora-say-about-external-approval-processes&quot;&gt;What Does DORA Say About External Approval Processes?&lt;/h3&gt;
&lt;p&gt;The &lt;a href=&quot;https://dora.dev/research/2019/dora-report/&quot;&gt;2019 DORA report&lt;/a&gt; found organizations using formal external approval processes, including CABs and senior manager sign-off, were 2.6 times more likely to be low delivery performers, with no reduction in change failure rates (DORA, 2019). Heavyweight gates added latency without improving stability. The &lt;a href=&quot;https://dora.dev/research/2025/dora-report/&quot;&gt;2025 DORA report&lt;/a&gt; adds the AI dimension: adoption increases delivery instability even as throughput improves (DORA, 2025). 90% of developers now use AI tools; 30% report little to no trust in the output. Instability drives burnout even when individual productivity metrics improve.&lt;/p&gt;
&lt;p&gt;AI reintroduces instability at machine speed, and the structural answer applies friction at the reversibility boundary, not uniformly at every change.&lt;/p&gt;
&lt;h2 id=&quot;what-is-reversibility-and-why-does-it-define-the-gate-design&quot;&gt;What Is Reversibility, and Why Does It Define the Gate Design?&lt;/h2&gt;
&lt;p&gt;Before tiering gates, scope agent permissions to the minimum required for their task. Agents routinely receive access equivalent to ten times a developer’s typical permissions by default; a reversibility gate operating against that blast radius is correcting for a structural miscalibration, not solving it. Reversibility is the property that determines whether a mistake can be corrected after it is made. A database deletion that destroys the only backup is not reversible; a customer notification already delivered is not.&lt;/p&gt;
&lt;p&gt;Risk category requires human judgment to assess and shifts with business context. Reversibility is a structural property of the action, encodable as a constraint and evaluated before execution. No sharp reviewer is required, no model confidence score, and the property does not erode as queue depth increases. Unlike risk category, the classification is binary: an action either has a rollback path or it does not. Tier-based interrupts add the execution-time gate that AGENTS.md policy and repository controls do not provide (&lt;a href=&quot;/posts/ai-assisted-development/&quot;&gt;AI-Assisted Development&lt;/a&gt;).&lt;/p&gt;
&lt;h3 id=&quot;why-risk-category-fails-as-a-gate-axis&quot;&gt;Why Risk Category Fails as a Gate Axis&lt;/h3&gt;
&lt;p&gt;In an original benchmark of 60 agentic action scenarios seeded from documented production incidents, a multi-factor risk-label classifier (Classifier A) evaluates each action on severity, blast radius, and authorization level. Blast radius here is measured by data volume and system count; the operationally relevant dimension is system-of-record criticality. An agent writing a log file and an agent with Salesforce write access score identically on volume metrics; only one can corrupt enterprise data at scale through a single hallucinated action. All three signals were low for the missed cases, and the axis cannot encode whether a mistake can be undone: Classifier A missed 13.8%; the reversibility blocklist missed none (&lt;a href=&quot;https://doi.org/10.5281/zenodo.20644042&quot;&gt;Clouatre, 2026&lt;/a&gt;). The PocketOS incident is one instance: low risk by any standard rubric, and irreversible (&lt;a href=&quot;https://www.cerbos.dev/blog/ai-coding-agent-deleted-a-production-database-in-9-seconds&quot;&gt;Crane, 2026&lt;/a&gt;).&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://www.nist.gov/system/files/documents/director/planning/report02-3.pdf&quot;&gt;Tassey (2002)&lt;/a&gt; found production defect fixes cost two or more orders of magnitude more than design-phase fixes; the cost compounds as downstream state propagates. DO-178C and IEC 61508 encode the same logic: gate on reversibility consequence before execution, not on risk category label (&lt;a href=&quot;https://www.rtca.org/content/do-178c&quot;&gt;RTCA / EUROCAE, 2011&lt;/a&gt;).&lt;/p&gt;
&lt;figure&gt;&lt;figcaption&gt;&lt;strong&gt;Code Snippet 1:&lt;/strong&gt; Reversibility classifier — actions matching any IRREVERSIBLE_MARKERS property route to Tier 3.&lt;/figcaption&gt;&lt;pre class=&quot;astro-code astro-code-themes catppuccin-latte catppuccin-macchiato has-highlighted mt-8&quot; style=&quot;--shiki-light:#4c4f69; --shiki-dark:#cad3f5; --shiki-light-bg:#eff1f5; --shiki-dark-bg:#24273a; --file-name-offset: -0.75rem&quot; tabindex=&quot;0&quot; data-language=&quot;python&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-dark:#C6A0F6&quot;&gt;from&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt; enum &lt;/span&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-dark:#C6A0F6&quot;&gt;import&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt; Enum&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-dark:#C6A0F6&quot;&gt;class&lt;/span&gt;&lt;span style=&quot;--shiki-light:#DF8E1D;--shiki-light-font-style:italic;--shiki-dark:#EED49F;--shiki-dark-font-style:italic&quot;&gt; ReversibilityTier&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--shiki-light:#DF8E1D;--shiki-light-font-style:italic;--shiki-dark:#EED49F;--shiki-dark-font-style:italic&quot;&gt;Enum&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;):&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line highlighted&quot;&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;    TIER1 &lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; &quot;reversible&quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line highlighted&quot;&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;    TIER2 &lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; &quot;bounded_reversible&quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line highlighted&quot;&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;    TIER3 &lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; &quot;irreversible&quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-light-font-style:italic;--shiki-dark:#939AB7;--shiki-dark-font-style:italic&quot;&gt;# Action properties that force Tier 3 regardless of risk label&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;IRREVERSIBLE_MARKERS &lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt; {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line highlighted&quot;&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;    &quot;mutates_persistent_state&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line highlighted&quot;&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;    &quot;external_side_effect&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line highlighted&quot;&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;    &quot;no_rollback_procedure&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-dark:#C6A0F6&quot;&gt;def&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-light-font-style:italic;--shiki-dark:#8AADF4;--shiki-dark-font-style:italic&quot;&gt; classify&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--shiki-light:#E64553;--shiki-light-font-style:italic;--shiki-dark:#EE99A0;--shiki-dark-font-style:italic&quot;&gt;action&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-light-font-style:italic;--shiki-dark:#C6A0F6;--shiki-dark-font-style:italic&quot;&gt; dict&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt; -&gt;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt; ReversibilityTier&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-dark:#C6A0F6&quot;&gt;    if&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt; action&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;get&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;&quot;properties&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-light-font-style:italic;--shiki-dark:#C6A0F6;--shiki-dark-font-style:italic&quot;&gt; set&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;())&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt; &amp;#x26;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt; IRREVERSIBLE_MARKERS&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-dark:#C6A0F6&quot;&gt;        return&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt; ReversibilityTier&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;TIER3&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-dark:#C6A0F6&quot;&gt;    if&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt; action&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;get&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;&quot;confidence&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;--shiki-light:#FE640B;--shiki-dark:#F5A97F&quot;&gt; 1.0&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt; &amp;#x3C;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt; action&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;get&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;&quot;threshold&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;--shiki-light:#FE640B;--shiki-dark:#F5A97F&quot;&gt; 0.85&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;):&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-light-font-style:italic;--shiki-dark:#939AB7;--shiki-dark-font-style:italic&quot;&gt;  # calibrate threshold to your FP baseline&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-dark:#C6A0F6&quot;&gt;        return&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt; ReversibilityTier&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;TIER2&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-dark:#C6A0F6&quot;&gt;    return&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt; ReversibilityTier&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;TIER1&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;span class=&quot;absolute py-1 text-foreground text-xs font-medium leading-4 pl-4 pr-2 before:inline-block before:size-1 before:bg-green-500 before:rounded-full before:absolute before:top-[45%] before:left-2 left-2 top-(--file-name-offset) border rounded-md bg-background&quot;&gt;gates/reversibility_classifier.py&lt;/span&gt;&lt;/pre&gt;&lt;/figure&gt;
&lt;p&gt;The three-marker blocklist above was tested against that same 60-scenario benchmark. The Tier 2 confidence threshold implements the SLM-for-governance pattern: a model tuned for the risk/safe decision boundary rather than general language generation. Embedding organizational policy at inference time, rather than retraining per deployment, is the practical path to multi-tenant calibration. Table 1 shows results across three classifier designs; Classifier B’s 96.7% halt rate is a blocklist artifact, not a production threshold.&lt;/p&gt;





























&lt;table tabindex=&quot;0&quot;&gt;&lt;caption&gt;&lt;strong&gt;Table 1:&lt;/strong&gt; Classifier comparison across 60 agentic action scenarios.&lt;/caption&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Classifier&lt;/th&gt;&lt;th&gt;Design&lt;/th&gt;&lt;th&gt;Miss rate&lt;/th&gt;&lt;th&gt;False-positive rate&lt;/th&gt;&lt;/tr&gt;&lt;/thead&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;A&lt;/td&gt;&lt;td&gt;Multi-factor risk label&lt;/td&gt;&lt;td&gt;13.8%&lt;/td&gt;&lt;td&gt;64.5%&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;B&lt;/td&gt;&lt;td&gt;Reversibility blocklist&lt;/td&gt;&lt;td&gt;0.0%&lt;/td&gt;&lt;td&gt;93.6%&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;C&lt;/td&gt;&lt;td&gt;Combined A OR B&lt;/td&gt;&lt;td&gt;0.0%&lt;/td&gt;&lt;td&gt;71.0%&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;
&lt;p&gt;Classifier C reduces that false-positive rate by 22 percentage points at the same zero miss. The difference is statistically supported but should be treated as directional given the pilot scale. Results reflect a single model family (Claude Sonnet 4.6).&lt;/p&gt;
&lt;h3 id=&quot;what-does-the-eu-ai-act-require-from-this-design&quot;&gt;What Does the EU AI Act Require From This Design?&lt;/h3&gt;
&lt;p&gt;&lt;a href=&quot;https://eur-lex.europa.eu/eli/reg/2024/1689/oj/eng&quot;&gt;Article 14 of the EU AI Act&lt;/a&gt; requires that high-risk AI systems allow humans to understand capabilities and limitations, detect and address issues, decide not to use the output, and halt operation (European Parliament, 2024). These obligations enter into force on August 2, 2026, with fines up to 15 million euros or 3% of global annual turnover for non-compliance with high-risk system obligations.&lt;/p&gt;
&lt;p&gt;This gate aligns with Article 14 structurally; legal counsel should confirm applicability to specific system classifications. Tier 1 provides the audit trail. Tier 2’s interrupt provides the “decide not to use” surface. Tier 3’s mandatory hold provides “halt operation” where the cost of a mistake is highest. A uniform review process satisfies the letter of the requirement; approval theater at scale means the human is nominally present but substantively absent.&lt;/p&gt;
&lt;h2 id=&quot;how-does-a-three-tier-reversibility-gate-work-in-practice&quot;&gt;How Does a Three-Tier Reversibility Gate Work in Practice?&lt;/h2&gt;
&lt;p&gt;The three tiers below govern action consequence, not pipeline security. They are distinct from the security framework in &lt;a href=&quot;/posts/ai-augmented-cicd/&quot;&gt;AI-Augmented CI/CD&lt;/a&gt;, which controls what context AI receives during code review. Here, tier determines latency budget and reviewer type; risk category informs judgment at Tier 3 but does not select the tier.&lt;/p&gt;

























&lt;table tabindex=&quot;0&quot;&gt;&lt;caption&gt;&lt;strong&gt;Table 2:&lt;/strong&gt; Three-tier reversibility gate model.&lt;/caption&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Tier&lt;/th&gt;&lt;th&gt;Action type&lt;/th&gt;&lt;th&gt;Gate mechanism&lt;/th&gt;&lt;/tr&gt;&lt;/thead&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;1 — Reversible&lt;/td&gt;&lt;td&gt;Feature flag, config with instant rollback&lt;/td&gt;&lt;td&gt;Automated pass-through + audit log&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;2 — Bounded&lt;/td&gt;&lt;td&gt;PR merge, dependency update&lt;/td&gt;&lt;td&gt;Confidence-threshold interrupt&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;3 — Irreversible&lt;/td&gt;&lt;td&gt;Schema change, data mutation, external API call&lt;/td&gt;&lt;td&gt;Mandatory expert hold; four-eyes&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;
&lt;p&gt;The &lt;a href=&quot;https://langchain-ai.github.io/langgraph/concepts/human_in_the_loop/&quot;&gt;LangGraph interrupt pattern&lt;/a&gt; supports four decision types at Tier 2: approve, reject, edit, or respond with additional context (LangChain, 2025). At Tier 3, risk category, business context, and regulatory requirements inform the expert’s judgment; the human brings context the classification cannot encode. The checkpoint is the structural guarantee: when a Tier 3 review takes hours, the agent resumes from exact state rather than replaying the full plan. The &lt;a href=&quot;/posts/zero-downtime-dns-migration/&quot;&gt;Zero-Downtime DNS Migration&lt;/a&gt; post documents two named Tier 3 holds in a production workflow, each requiring a reviewable artifact, not a yes/no click.&lt;/p&gt;
&lt;figure&gt;&lt;figcaption&gt;&lt;strong&gt;Code Snippet 2:&lt;/strong&gt; LangGraph interrupt pattern for Tier 2 and Tier 3 actions.&lt;/figcaption&gt;&lt;pre class=&quot;astro-code astro-code-themes catppuccin-latte catppuccin-macchiato has-highlighted mt-8&quot; style=&quot;--shiki-light:#4c4f69; --shiki-dark:#cad3f5; --shiki-light-bg:#eff1f5; --shiki-dark-bg:#24273a; --file-name-offset: -0.75rem&quot; tabindex=&quot;0&quot; data-language=&quot;python&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-dark:#C6A0F6&quot;&gt;from&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt; langgraph&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;graph &lt;/span&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-dark:#C6A0F6&quot;&gt;import&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt; StateGraph&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-dark:#C6A0F6&quot;&gt;from&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt; langgraph&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;checkpoint&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;memory &lt;/span&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-dark:#C6A0F6&quot;&gt;import&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt; MemorySaver&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-dark:#C6A0F6&quot;&gt;def&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-light-font-style:italic;--shiki-dark:#8AADF4;--shiki-dark-font-style:italic&quot;&gt; build_gated_graph&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;():&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;    builder &lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt; StateGraph&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;AgentState&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;    builder&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;add_node&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;&quot;plan&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt; plan_node&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line highlighted&quot;&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;    builder&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;add_node&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;&quot;human_review&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt; interrupt_node&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;    builder&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;add_node&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;&quot;execute&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt; execute_node&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-dark:#C6A0F6&quot;&gt;    def&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-light-font-style:italic;--shiki-dark:#8AADF4;--shiki-dark-font-style:italic&quot;&gt; route_by_tier&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--shiki-light:#E64553;--shiki-light-font-style:italic;--shiki-dark:#EE99A0;--shiki-dark-font-style:italic&quot;&gt;state&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;):&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;        tier &lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt; classify&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--shiki-light:#E64553;--shiki-light-font-style:italic;--shiki-dark:#EE99A0;--shiki-dark-font-style:italic&quot;&gt;state&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-light-font-style:italic;--shiki-dark:#A6DA95;--shiki-dark-font-style:italic&quot;&gt;next_action&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;])&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-dark:#C6A0F6&quot;&gt;        if&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt; tier &lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;==&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt; ReversibilityTier&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;TIER3&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line highlighted&quot;&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-dark:#C6A0F6&quot;&gt;            return&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; &quot;human_review&quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-dark:#C6A0F6&quot;&gt;        if&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt; tier &lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;==&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt; ReversibilityTier&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;TIER2&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-dark:#C6A0F6&quot;&gt;            if&lt;/span&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-dark:#C6A0F6&quot;&gt; not&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt; above_confidence_threshold&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;state&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;):&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line highlighted&quot;&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-dark:#C6A0F6&quot;&gt;                return&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; &quot;human_review&quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-dark:#C6A0F6&quot;&gt;        return&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; &quot;execute&quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;    builder&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;add_conditional_edges&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;&quot;plan&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt; route_by_tier&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line highlighted&quot;&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;    builder&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;add_edge&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;&quot;human_review&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; &quot;execute&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-light-font-style:italic;--shiki-dark:#939AB7;--shiki-dark-font-style:italic&quot;&gt; # resumes from checkpoint &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-dark:#C6A0F6&quot;&gt;    return&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt; builder&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;compile&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--shiki-light:#E64553;--shiki-light-font-style:italic;--shiki-dark:#EE99A0;--shiki-dark-font-style:italic&quot;&gt;checkpointer&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;MemorySaver&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;())&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;span class=&quot;absolute py-1 text-foreground text-xs font-medium leading-4 pl-4 pr-2 before:inline-block before:size-1 before:bg-green-500 before:rounded-full before:absolute before:top-[45%] before:left-2 left-2 top-(--file-name-offset) border rounded-md bg-background&quot;&gt;gates/reversibility_gate.py&lt;/span&gt;&lt;/pre&gt;&lt;/figure&gt;
&lt;h3 id=&quot;what-happens-when-an-action-is-mis-tiered&quot;&gt;What Happens When an Action Is Mis-Tiered?&lt;/h3&gt;
&lt;p&gt;The classifier in Code Snippet 1 addresses mis-tiering with a blocklist of consequence markers: any action matching even one marker routes to Tier 3 regardless of its assigned risk label. The post-approval incident rate metric in Table 3 closes the feedback loop: Tier 1 post-approval incidents trigger automatic reclassification of that action type to Tier 2.&lt;/p&gt;
&lt;p&gt;A harder case is agent chaining: multiple agents, each operating within individually scoped permissions, executing in sequence to achieve what no single agent is authorized to do alone. The gate model handles this by classifying each action independently at execution time. Each step that crosses a reversibility marker halts; the blast radius of the chain is bounded by whichever step first triggers Tier 3.&lt;/p&gt;
&lt;h2 id=&quot;how-do-you-prevent-reviewer-atrophy-from-hollowing-out-the-judgment-tier&quot;&gt;How Do You Prevent Reviewer Atrophy From Hollowing Out the Judgment Tier?&lt;/h2&gt;
&lt;p&gt;That same comprehension gap concentrates precisely in Tier 3 review tasks. Three structural controls counter reviewer atrophy: rotate Tier 3 reviewers through agent-free work to maintain baseline judgment; require a comprehension check before approval (the reviewer explains the action, the agent’s reasoning, and the rollback procedure); and audit Tier 3 decisions against outcomes, moving reviewers whose approvals correlate with post-deployment incidents to supervised review.&lt;/p&gt;
&lt;p&gt;None of these controls are self-monitoring; the next section defines the four metrics that detect when they are failing.&lt;/p&gt;
&lt;h2 id=&quot;how-do-you-measure-whether-your-gates-are-holding&quot;&gt;How Do You Measure Whether Your Gates Are Holding?&lt;/h2&gt;
&lt;p&gt;Four metrics provide early warning before an incident and close the feedback loop between agent throughput and stability. The first two are leading indicators; the last two confirm whether tier classifications remain valid.&lt;/p&gt;






























&lt;table tabindex=&quot;0&quot;&gt;&lt;caption&gt;&lt;strong&gt;Table 3:&lt;/strong&gt; Gate health metrics. Calibrate thresholds to your baseline.&lt;/caption&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Metric&lt;/th&gt;&lt;th&gt;Source&lt;/th&gt;&lt;th&gt;Alert signal&lt;/th&gt;&lt;/tr&gt;&lt;/thead&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;Tier 3 queue depth&lt;/td&gt;&lt;td&gt;Gate event log&lt;/td&gt;&lt;td&gt;Rising faster than reviewer capacity&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Tier 2 trigger rate&lt;/td&gt;&lt;td&gt;Gate event log&lt;/td&gt;&lt;td&gt;Rising rate — agent scope expanding&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Post-approval incident rate&lt;/td&gt;&lt;td&gt;Incident + gate log&lt;/td&gt;&lt;td&gt;Any Tier 3 incident triggers reviewer audit and tier classification review&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Tier 1 rollback success&lt;/td&gt;&lt;td&gt;Deployment log&lt;/td&gt;&lt;td&gt;Any failure reclassifies action to Tier 2&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;
&lt;p&gt;A rising Tier 2 trigger rate signals task framing investigation, not threshold adjustment: agent scope is expanding. A Tier 1 rollback failure means the action was never truly reversible and must be reclassified. In Figure 2, the Hold branch fires on &lt;code&gt;gate.tier3_queue_depth&lt;/code&gt; or &lt;code&gt;gate.tier2_trigger_rate&lt;/code&gt; breaches; the Alert branch fires when &lt;code&gt;gate.post_approval_incident&lt;/code&gt; is true or &lt;code&gt;gate.tier1_rollback_success&lt;/code&gt; drops below 100%.&lt;/p&gt;
&lt;figure&gt;&lt;img alt=&quot;Gate health signals: four input metrics feed a health assessment that routes to Hold or Alert, triggering reviewer audit or tier reclassification&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; sizes=&quot;(min-width: 849px) 849px, 100vw&quot; data-astro-image=&quot;constrained&quot; data-astro-image-pos=&quot;center&quot; width=&quot;849&quot; height=&quot;448&quot; src=&quot;/_astro/gate-health-signals.BJFNC7Oo_Z2pa2pN.svg&quot; srcset=&quot;/_astro/gate-health-signals.BJFNC7Oo_DhM2O.svg 640w, /_astro/gate-health-signals.BJFNC7Oo_AXBf5.svg 750w, /_astro/gate-health-signals.BJFNC7Oo_8SPEb.svg 828w, /_astro/gate-health-signals.BJFNC7Oo_Z2pa2pN.svg 849w&quot;&gt;&lt;figcaption&gt;&lt;strong&gt;Figure 2:&lt;/strong&gt; Four gate health signals and their alert routing.&lt;/figcaption&gt;&lt;/figure&gt;
&lt;h2 id=&quot;what-should-engineering-leaders-act-on&quot;&gt;What Should Engineering Leaders Act On?&lt;/h2&gt;
&lt;p&gt;Engineering leaders cannot solve reviewer atrophy with cultural mandates; it requires architectural constraints. Organizations that solve agentic governance systematically deploy faster than those that solve it ad hoc. Startups ship agents in days; enterprises stall for months because their committees cannot iterate faster than the technology evolves. The governance gap is a deployment velocity problem as much as a compliance one.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Scope permissions, then audit action space.&lt;/strong&gt; Before classifying actions, scope each agent to the minimum permissions its task requires. Then identify every action that mutates persistent state, fires external side effects, or has no rollback procedure, and blocklist it into Tier 3. Code Snippet 1 provides the starting classifier.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Implement checkpointed interrupts.&lt;/strong&gt; Deploy LangGraph’s durable checkpointer (Code Snippet 2) for Tier 2 and Tier 3 gates. The checkpoint survives reviewer session boundaries.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Instrument the four gate metrics.&lt;/strong&gt; Add the OpenTelemetry span in Code Snippet 3: Tier 3 queue depth, Tier 2 trigger rate, post-approval incident rate, and Tier 1 rollback success are your early-warning system.&lt;/li&gt;
&lt;/ol&gt;
&lt;figure&gt;&lt;figcaption&gt;&lt;strong&gt;Code Snippet 3:&lt;/strong&gt; Gate health OTel (OpenTelemetry) span. The four highlighted attributes are the early-warning signals; tier_misclassification_detected triggers immediate review.&lt;/figcaption&gt;&lt;pre class=&quot;astro-code astro-code-themes catppuccin-latte catppuccin-macchiato has-highlighted mt-8&quot; style=&quot;--shiki-light:#4c4f69; --shiki-dark:#cad3f5; --shiki-light-bg:#eff1f5; --shiki-dark-bg:#24273a; --file-name-offset: -0.75rem&quot; tabindex=&quot;0&quot; data-language=&quot;python&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-dark:#C6A0F6&quot;&gt;from&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt; opentelemetry &lt;/span&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-dark:#C6A0F6&quot;&gt;import&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt; trace&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;tracer &lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt; trace&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;get_tracer&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;__name__&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-dark:#C6A0F6&quot;&gt;def&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-light-font-style:italic;--shiki-dark:#8AADF4;--shiki-dark-font-style:italic&quot;&gt; record_gate_event&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--shiki-light:#E64553;--shiki-light-font-style:italic;--shiki-dark:#EE99A0;--shiki-dark-font-style:italic&quot;&gt;action&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-light-font-style:italic;--shiki-dark:#C6A0F6;--shiki-dark-font-style:italic&quot;&gt; dict&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;--shiki-light:#E64553;--shiki-light-font-style:italic;--shiki-dark:#EE99A0;--shiki-dark-font-style:italic&quot;&gt; tier&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-light-font-style:italic;--shiki-dark:#C6A0F6;--shiki-dark-font-style:italic&quot;&gt; str&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;--shiki-light:#E64553;--shiki-light-font-style:italic;--shiki-dark:#EE99A0;--shiki-dark-font-style:italic&quot;&gt; outcome&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-light-font-style:italic;--shiki-dark:#C6A0F6;--shiki-dark-font-style:italic&quot;&gt; str&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt; -&gt;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#FE640B;--shiki-dark:#F5A97F&quot;&gt; None&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-dark:#C6A0F6&quot;&gt;    with&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt; tracer&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;start_as_current_span&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;&quot;gate_health&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-dark:#C6A0F6&quot;&gt; as&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt; span&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;        span&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;set_attribute&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;&quot;gate.tier&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt; tier&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;        span&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;set_attribute&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;&quot;gate.outcome&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt; outcome&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;        span&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;set_attribute&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;&quot;gate.tier3_queue_depth&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line highlighted&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;            get_queue_depth&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;&quot;tier3&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;))&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;        span&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;set_attribute&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;&quot;gate.tier2_trigger_rate&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line highlighted&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;            get_trigger_rate&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;&quot;tier2&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;))&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;        span&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;set_attribute&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;&quot;gate.post_approval_incident&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line highlighted&quot;&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;            outcome &lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;==&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; &quot;incident_post_approval&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;        span&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;set_attribute&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;&quot;gate.tier1_rollback_success&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line highlighted&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;            get_rollback_success_rate&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;&quot;tier1&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;))&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;        span&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;set_attribute&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;&quot;gate.tier_misclassification_detected&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;            outcome &lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;==&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; &quot;incident&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-dark:#C6A0F6&quot;&gt; and&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt; tier &lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;==&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; &quot;tier1&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;)&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;span class=&quot;absolute py-1 text-foreground text-xs font-medium leading-4 pl-4 pr-2 before:inline-block before:size-1 before:bg-green-500 before:rounded-full before:absolute before:top-[45%] before:left-2 left-2 top-(--file-name-offset) border rounded-md bg-background&quot;&gt;gates/gate_health_span.py&lt;/span&gt;&lt;/pre&gt;&lt;/figure&gt;
&lt;hr&gt;
&lt;p&gt;The approval gate methodology described in this post is the subject of Canadian patent application CA 3315358, filed Jun 17, 2026 (CIPO).&lt;/p&gt;
&lt;h2 id=&quot;references&quot;&gt;References&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Clouatre, H., “Reversibility Benchmark: Risk-Label vs. Reversibility Gate on 60 Agentic Action Scenarios” (2026) — &lt;a href=&quot;https://doi.org/10.5281/zenodo.20644042&quot;&gt;https://doi.org/10.5281/zenodo.20644042&lt;/a&gt; — &lt;a href=&quot;https://github.com/clouatre-labs/reversibility-benchmark&quot;&gt;https://github.com/clouatre-labs/reversibility-benchmark&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;CodeRabbit, “State of AI vs Human Code Generation Report” (2025) — &lt;a href=&quot;https://www.coderabbit.ai/blog/state-of-ai-vs-human-code-generation-report&quot;&gt;https://www.coderabbit.ai/blog/state-of-ai-vs-human-code-generation-report&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Crane, J. (via Cerbos), “PocketOS AI Coding Agent Deleted a Production Database in 9 Seconds” (2026) — &lt;a href=&quot;https://www.cerbos.dev/blog/ai-coding-agent-deleted-a-production-database-in-9-seconds&quot;&gt;https://www.cerbos.dev/blog/ai-coding-agent-deleted-a-production-database-in-9-seconds&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Cyera Research, “Agent-Inflicted Damage: Inside the Real-World Failures of Enterprise AI Systems” (2026) — &lt;a href=&quot;https://www.cyera.com/research/agent-inflicted-damage-inside-the-real-world-failures-of-enterprise-ai-systems&quot;&gt;https://www.cyera.com/research/agent-inflicted-damage-inside-the-real-world-failures-of-enterprise-ai-systems&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;DORA (Google), “2019 Accelerate State of DevOps Report” (2019) — &lt;a href=&quot;https://dora.dev/research/2019/dora-report/&quot;&gt;https://dora.dev/research/2019/dora-report/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;DORA (Google), “State of AI-assisted Software Development 2025” (2025) — &lt;a href=&quot;https://dora.dev/research/2025/dora-report/&quot;&gt;https://dora.dev/research/2025/dora-report/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;European Parliament and Council of the EU, “Regulation (EU) 2024/1689 (AI Act), Article 14: Human Oversight” (2024) — &lt;a href=&quot;https://eur-lex.europa.eu/eli/reg/2024/1689/oj/eng&quot;&gt;https://eur-lex.europa.eu/eli/reg/2024/1689/oj/eng&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Faros AI, “AI Engineering Report 2026: The Acceleration Whiplash” (2026) — &lt;a href=&quot;https://www.faros.ai/research/ai-acceleration-whiplash&quot;&gt;https://www.faros.ai/research/ai-acceleration-whiplash&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;LangChain / LangGraph, “Human-in-the-Loop” (2025) — &lt;a href=&quot;https://langchain-ai.github.io/langgraph/concepts/human_in_the_loop/&quot;&gt;https://langchain-ai.github.io/langgraph/concepts/human_in_the_loop/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;MindStudio, “How a Data Science Team Achieved Massive ROI with AI Agents” (vendor case study, 2025) — &lt;a href=&quot;https://www.mindstudio.ai/blog/data-science-roi&quot;&gt;https://www.mindstudio.ai/blog/data-science-roi&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;RTCA / EUROCAE, “DO-178C: Software Considerations in Airborne Systems and Equipment Certification” (2011) — &lt;a href=&quot;https://www.rtca.org/content/do-178c&quot;&gt;https://www.rtca.org/content/do-178c&lt;/a&gt;; see also FAA Advisory Circular AC 20-115D — &lt;a href=&quot;https://www.faa.gov/documentLibrary/media/Advisory_Circular/AC_20-115D.pdf&quot;&gt;https://www.faa.gov/documentLibrary/media/Advisory_Circular/AC_20-115D.pdf&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Shen, J.H. and Tamkin, A. (Anthropic), “How AI Impacts Skill Formation” (2026) — &lt;a href=&quot;https://doi.org/10.48550/arXiv.2601.20245&quot;&gt;https://doi.org/10.48550/arXiv.2601.20245&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Tassey, G., “The Economic Impacts of Inadequate Infrastructure for Software Testing,” NIST (2002) — &lt;a href=&quot;https://www.nist.gov/system/files/documents/director/planning/report02-3.pdf&quot;&gt;https://www.nist.gov/system/files/documents/director/planning/report02-3.pdf&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Vaccaro et al. (MIT Center for Collective Intelligence), “When combinations of humans and AI are useful: A systematic review and meta-analysis,” Nature Human Behaviour (2024) — &lt;a href=&quot;https://www.nature.com/articles/s41562-024-02024-1&quot;&gt;https://www.nature.com/articles/s41562-024-02024-1&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</content:encoded><category>agentic-ai</category><category>implementation-guide</category><category>ai-governance</category><author>Hugues Clouâtre</author></item><item><title>AI Adoption in Engineering: Breaking the 50% Plateau</title><link>https://clouatre.ca/posts/ai-adoption-engineering/</link><guid isPermaLink="true">https://clouatre.ca/posts/ai-adoption-engineering/</guid><description>Purpose-built AI tooling cuts per-task cost 21-68%. Three-cohort model and four-phase operating framework for engineering leaders past the 50% adoption plateau.</description><pubDate>Mon, 01 Jun 2026 16:25:00 GMT</pubDate><content:encoded>&lt;p&gt;Purpose-built AI tooling cuts per-task cost 21-68%, yet only 13% of organizations have AI agents broadly integrated into workflows (BCG, 2025) and self-reported velocity diverges from measured outcomes by 39 percentage points (Becker et al., 2025). Frontline use has stagnated at 51% across three annual editions of BCG’s survey. This post gives a three-cohort segmentation model, a four-phase operating model, and the benchmark data behind those numbers.&lt;/p&gt;
&lt;h2 id=&quot;table-of-contents&quot;&gt;Table of contents&lt;/h2&gt;
&lt;p&gt;&lt;/p&gt;&lt;details&gt;&lt;summary&gt;Contents&lt;/summary&gt;&lt;p&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;#why-do-enterprise-ai-programs-stall-at-50&quot;&gt;Why Do Enterprise AI Programs Stall at 50%?&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;#the-self-reporting-trap&quot;&gt;The Self-Reporting Trap&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#the-deployment-before-instrumentation-pattern&quot;&gt;The Deployment-Before-Instrumentation Pattern&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#who-is-actually-blocked-and-why&quot;&gt;Who Is Actually Blocked, and Why?&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;#three-cohorts-three-interventions&quot;&gt;Three Cohorts, Three Interventions&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#the-policy-document-as-unlocker&quot;&gt;The Policy Document as Unlocker&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#what-does-purpose-built-tooling-change&quot;&gt;What Does Purpose-Built Tooling Change?&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;#benchmark-methodology&quot;&gt;Benchmark Methodology&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#benchmark-results&quot;&gt;Benchmark Results&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#how-do-you-instrument-before-you-deploy&quot;&gt;How Do You Instrument Before You Deploy?&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;#five-numbers-before-day-one&quot;&gt;Five Numbers Before Day One&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#what-generic-monitoring-misses&quot;&gt;What Generic Monitoring Misses&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#what-operating-model-sustains-adoption&quot;&gt;What Operating Model Sustains Adoption?&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;#phase-1-baseline-and-segmentation&quot;&gt;Phase 1: Baseline and Segmentation&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#phase-2-friction-removal&quot;&gt;Phase 2: Friction Removal&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#phase-3-workflow-integration&quot;&gt;Phase 3: Workflow Integration&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#phase-4-sustaining&quot;&gt;Phase 4: Sustaining&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#which-ai-adoption-plays-waste-budget&quot;&gt;Which AI Adoption Plays Waste Budget?&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#how-do-you-measure-adoption-not-just-activity&quot;&gt;How Do You Measure Adoption, Not Just Activity?&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;#the-five-number-rule&quot;&gt;The Five-Number Rule&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#the-kpi-scorecard&quot;&gt;The KPI Scorecard&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#what-should-engineering-leaders-do-next&quot;&gt;What Should Engineering Leaders Do Next?&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#references&quot;&gt;References&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;/p&gt;&lt;/details&gt;&lt;p&gt;&lt;/p&gt;
&lt;h2 id=&quot;why-do-enterprise-ai-programs-stall-at-50&quot;&gt;Why Do Enterprise AI Programs Stall at 50%?&lt;/h2&gt;
&lt;p&gt;The frontline adoption stall is not primarily a culture problem; it is a measurement problem. When leaders rely on survey confidence instead of workflow telemetry, they misclassify blocked engineers as resistant.&lt;/p&gt;
&lt;h3 id=&quot;the-self-reporting-trap&quot;&gt;The Self-Reporting Trap&lt;/h3&gt;
&lt;p&gt;The METR perception gap explains why the stall persists. A &lt;a href=&quot;https://metr.org/blog/2025-07-10-early-2025-ai-experienced-os-dev-study&quot;&gt;2025 randomized controlled trial&lt;/a&gt; (Becker et al., 2025) across experienced open-source developers found that AI tools caused tasks to take 19% longer, while developers simultaneously reported believing AI made them 20% faster. A &lt;a href=&quot;https://metr.org/blog/2026-02-24-uplift-update/&quot;&gt;February 2026 follow-up&lt;/a&gt; found likely speedup from late-2025 tools but with severe selection effects, and the perception gap finding stands.&lt;/p&gt;
&lt;h3 id=&quot;the-deployment-before-instrumentation-pattern&quot;&gt;The Deployment-Before-Instrumentation Pattern&lt;/h3&gt;
&lt;p&gt;When programs stall, the default response is a new communications campaign, a lunch-and-learn series, or an expanded license rollout. None of these address the actual distribution of blockers across the engineering population. &lt;a href=&quot;https://www.gartner.com/en/newsroom/press-releases/2025-06-25-gartner-predicts-over-40-percent-of-agentic-ai-projects-will-be-canceled-by-end-of-2027&quot;&gt;Gartner&lt;/a&gt; predicts over 40% of agentic AI projects will be canceled by end of 2027 due to escalating costs, unclear business value, or inadequate risk controls. The pattern is consistent: organizations deploy before they instrument, then cannot make a defensible scale-or-stop decision.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://dora.dev/research/2025/dora-report/&quot;&gt;DORA 2025&lt;/a&gt; found AI impact depends on the quality of the underlying organizational system; platform maturity gates adoption returns.&lt;/p&gt;
&lt;h2 id=&quot;who-is-actually-blocked-and-why&quot;&gt;Who Is Actually Blocked, and Why?&lt;/h2&gt;
&lt;p&gt;Before any intervention, segment the engineering population by blocker type. Three cohorts emerge, each with a distinct barrier type independently validated across enterprise deployments (OECD/BCG, 2025); in larger organizations, the cohort map also surfaces AI expertise concentration risk.&lt;/p&gt;
&lt;h3 id=&quot;three-cohorts-three-interventions&quot;&gt;Three Cohorts, Three Interventions&lt;/h3&gt;
&lt;p&gt;The Blocked cohort is the highest-leverage and least-served by standard programs. Policy uncertainty, not skepticism, is the barrier.&lt;/p&gt;
&lt;figure&gt;&lt;img alt=&quot;Three engineer cohorts: Active (40-55%), Passive (25-35%), Blocked (15-25%) with barriers and interventions&quot; loading=&quot;eager&quot; decoding=&quot;sync&quot; fetchpriority=&quot;high&quot; sizes=&quot;(min-width: 794px) 794px, 100vw&quot; data-astro-image=&quot;constrained&quot; data-astro-image-pos=&quot;center&quot; width=&quot;794&quot; height=&quot;430&quot; src=&quot;/_astro/ai-adoption-cohorts.D9dIHVa__Z1Pyu0F.svg&quot; srcset=&quot;/_astro/ai-adoption-cohorts.D9dIHVa__ZQMvfE.svg 640w, /_astro/ai-adoption-cohorts.D9dIHVa__QSeAi.svg 750w, /_astro/ai-adoption-cohorts.D9dIHVa__Z1Pyu0F.svg 794w&quot;&gt;&lt;figcaption&gt;&lt;strong&gt;Figure 1:&lt;/strong&gt; Three cohorts mapped to three barrier types. Distribution is illustrative; ranges informed by Cisco (2024) data.&lt;/figcaption&gt;&lt;/figure&gt;
&lt;h3 id=&quot;the-policy-document-as-unlocker&quot;&gt;The Policy Document as Unlocker&lt;/h3&gt;
&lt;p&gt;A one-page tier policy unblocks engineers faster than another launch event because it answers the operational questions they face at commit time: which data category, which approved provider agreement, and which approval path. The three tiers (internal productivity, institutional data, and regulated or restricted) each carry a distinct approved-provider list and approval path (see Snippet 2).&lt;/p&gt;
&lt;p&gt;Without policy clarity, engineers route work to unsanctioned tools. &lt;a href=&quot;https://www.harmonic.security/resources/what-22-million-enterprise-ai-prompts-reveal-about-shadow-ai-in-2025&quot;&gt;Harmonic Security (2025)&lt;/a&gt; found this at over 90% of organizations. Free tools lack the data agreements, context windows, and authenticated access that enterprise workflows require.&lt;/p&gt;
&lt;h2 id=&quot;what-does-purpose-built-tooling-change&quot;&gt;What Does Purpose-Built Tooling Change?&lt;/h2&gt;
&lt;p&gt;Generic AI access via a chat interface is not the same as purpose-built tooling for a specific workflow.&lt;/p&gt;
&lt;h3 id=&quot;benchmark-methodology&quot;&gt;Benchmark Methodology&lt;/h3&gt;
&lt;p&gt;We ran two benchmark tasks using &lt;a href=&quot;https://github.com/aaif-goose/goose&quot;&gt;Goose&lt;/a&gt; (Agentic AI Foundation) with the &lt;a href=&quot;https://github.com/clouatre-labs/aptu-coder&quot;&gt;aptu-coder MCP (Model Context Protocol) server&lt;/a&gt;: an auth migration analysis against the official Django codebase, and an AeroDyn integration audit against OpenFAST, a public Fortran repository. The MCP server provides on-demand, structured access to codebases via AST (Abstract Syntax Tree) queries: only the symbols, call graphs, and file ranges each task requires are loaded into context.&lt;/p&gt;
&lt;h3 id=&quot;benchmark-results&quot;&gt;Benchmark Results&lt;/h3&gt;
&lt;p&gt;&lt;a href=&quot;https://github.com/clouatre-labs/aptu-coder#benchmarks&quot;&gt;aptu-coder benchmarks&lt;/a&gt; show purpose-built tooling reduced per-task cost 21-68% across two production codebases. &lt;a href=&quot;https://doi.org/10.2139/ssrn.4573321&quot;&gt;Dell’Acqua et al.&lt;/a&gt; (2023) found AI assistance lifted output quality 40% on tasks inside the capability frontier and degraded it outside. Tooling determines which side of that line a task lands on. Routing planning to a capable model and execution to a faster one, with structured handoffs between specialized agents, compounds that reduction. &lt;a href=&quot;https://www.bain.com/insights/from-pilots-to-payoff-generative-ai-in-software-development-technology-report-2025/&quot;&gt;Bain (2025)&lt;/a&gt; found teams pairing AI with end-to-end process transformation reported 25-30% gains vs. 10% for single-tool augmentation.&lt;/p&gt;
&lt;p&gt;Model selection compounds the effect. &lt;a href=&quot;https://github.com/clouatre-labs/aptu/blob/main/docs/BENCHMARKS.md&quot;&gt;Aptu benchmarks&lt;/a&gt; (Clouatre, 2026) comparing a structured, schema-enforced prompt with Mercury 2 against a raw Claude Opus 4.6 call across six fixtures show: 4.8/5 mean quality vs 2.2/5, at 17x lower cost and 8x lower latency. The structured prompt gives the smaller diffusion model the context it needs.&lt;/p&gt;
&lt;h2 id=&quot;how-do-you-instrument-before-you-deploy&quot;&gt;How Do You Instrument Before You Deploy?&lt;/h2&gt;
&lt;p&gt;Instrumentation has to precede rollout because the pre-change baseline is the only defensible reference point. Without it, leaders can report usage but cannot prove whether AI changed cost, quality, or delivery time.&lt;/p&gt;
&lt;h3 id=&quot;five-numbers-before-day-one&quot;&gt;Five Numbers Before Day One&lt;/h3&gt;
&lt;p&gt;Before deploying any AI tooling to a cohort, pre-register five numbers for each target workflow: baseline time or cost per task, target improvement percentage, acceptable risk threshold for defect regression, adoption target as a percentage of the cohort by a fixed date, and the decision date for scale or stop.&lt;/p&gt;
&lt;figure&gt;&lt;figcaption&gt;&lt;strong&gt;Code Snippet 1:&lt;/strong&gt; PilotRecord dataclass and OTel (OpenTelemetry) span. The five highlighted fields are pre-registration inputs; actual_secs is measured at task completion.&lt;/figcaption&gt;&lt;pre class=&quot;astro-code astro-code-themes catppuccin-latte catppuccin-macchiato has-highlighted mt-8&quot; style=&quot;--shiki-light:#4c4f69; --shiki-dark:#cad3f5; --shiki-light-bg:#eff1f5; --shiki-dark-bg:#24273a; --file-name-offset: -0.75rem&quot; tabindex=&quot;0&quot; data-language=&quot;python&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-dark:#C6A0F6&quot;&gt;from&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt; dataclasses &lt;/span&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-dark:#C6A0F6&quot;&gt;import&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt; dataclass&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-dark:#C6A0F6&quot;&gt;from&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt; datetime &lt;/span&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-dark:#C6A0F6&quot;&gt;import&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt; date&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-dark:#C6A0F6&quot;&gt;from&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt; opentelemetry &lt;/span&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-dark:#C6A0F6&quot;&gt;import&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt; trace&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-dark:#C6A0F6&quot;&gt;from&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt; opentelemetry&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;trace &lt;/span&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-dark:#C6A0F6&quot;&gt;import&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt; StatusCode&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#FE640B;--shiki-light-font-style:italic;--shiki-dark:#F5A97F;--shiki-dark-font-style:italic&quot;&gt;@dataclass&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-dark:#C6A0F6&quot;&gt;class&lt;/span&gt;&lt;span style=&quot;--shiki-light:#DF8E1D;--shiki-light-font-style:italic;--shiki-dark:#EED49F;--shiki-dark-font-style:italic&quot;&gt; PilotRecord&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;    task&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-light-font-style:italic;--shiki-dark:#C6A0F6;--shiki-dark-font-style:italic&quot;&gt; str&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line highlighted&quot;&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;    baseline_secs&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-light-font-style:italic;--shiki-dark:#C6A0F6;--shiki-dark-font-style:italic&quot;&gt; float&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line highlighted&quot;&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;    target_reduction_pct&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-light-font-style:italic;--shiki-dark:#C6A0F6;--shiki-dark-font-style:italic&quot;&gt; float&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line highlighted&quot;&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;    risk_threshold_regression_pct&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-light-font-style:italic;--shiki-dark:#C6A0F6;--shiki-dark-font-style:italic&quot;&gt; float&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line highlighted&quot;&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;    cohort_adoption_target_pct&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-light-font-style:italic;--shiki-dark:#C6A0F6;--shiki-dark-font-style:italic&quot;&gt; float&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line highlighted&quot;&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;    decision_date&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt; date           &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;tracer &lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt; trace&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;get_tracer&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;__name__&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-dark:#C6A0F6&quot;&gt;def&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-light-font-style:italic;--shiki-dark:#8AADF4;--shiki-dark-font-style:italic&quot;&gt; record_task_completion&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--shiki-light:#E64553;--shiki-light-font-style:italic;--shiki-dark:#EE99A0;--shiki-dark-font-style:italic&quot;&gt;record&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#E64553;--shiki-dark:#EE99A0&quot;&gt; PilotRecord&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;--shiki-light:#E64553;--shiki-light-font-style:italic;--shiki-dark:#EE99A0;--shiki-dark-font-style:italic&quot;&gt; actual_secs&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-light-font-style:italic;--shiki-dark:#C6A0F6;--shiki-dark-font-style:italic&quot;&gt; float&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt; -&gt;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#FE640B;--shiki-dark:#F5A97F&quot;&gt; None&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-dark:#C6A0F6&quot;&gt;    with&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt; tracer&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;start_as_current_span&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;&quot;ai_task_completion&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-dark:#C6A0F6&quot;&gt; as&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt; span&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-dark:#C6A0F6&quot;&gt;        try&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;            span&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;set_attribute&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;&quot;pilot.task&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt; record&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;task&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;            span&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;set_attribute&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;&quot;pilot.baseline_secs&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt; record&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;baseline_secs&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;            span&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;set_attribute&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;&quot;pilot.actual_secs&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt; actual_secs&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;            span&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;set_attribute&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;&quot;pilot.reduction_pct&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#FE640B;--shiki-light-font-style:italic;--shiki-dark:#F5A97F;--shiki-dark-font-style:italic&quot;&gt;                round&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;((&lt;/span&gt;&lt;span style=&quot;--shiki-light:#FE640B;--shiki-dark:#F5A97F&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt; -&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt; actual_secs &lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;/&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt; record&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;baseline_secs&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt; *&lt;/span&gt;&lt;span style=&quot;--shiki-light:#FE640B;--shiki-dark:#F5A97F&quot;&gt; 100&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;--shiki-light:#FE640B;--shiki-dark:#F5A97F&quot;&gt; 1&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;))&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;            span&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;set_attribute&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;&quot;pilot.decision_date&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-light-font-style:italic;--shiki-dark:#C6A0F6;--shiki-dark-font-style:italic&quot;&gt; str&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;record&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;decision_date&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;))&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;            span&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;set_status&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;StatusCode&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;OK&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-dark:#C6A0F6&quot;&gt;        except&lt;/span&gt;&lt;span style=&quot;--shiki-light:#FE640B;--shiki-light-font-style:italic;--shiki-dark:#F5A97F;--shiki-dark-font-style:italic&quot;&gt; Exception&lt;/span&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-dark:#C6A0F6&quot;&gt; as&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt; exc&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;            span&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;record_exception&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;exc&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;            span&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;set_status&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;StatusCode&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;ERROR&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-dark:#C6A0F6&quot;&gt;            raise&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;span class=&quot;absolute py-1 text-foreground text-xs font-medium leading-4 pl-4 pr-2 before:inline-block before:size-1 before:bg-green-500 before:rounded-full before:absolute before:top-[45%] before:left-2 left-2 top-(--file-name-offset) border rounded-md bg-background&quot;&gt;instrumentation/pilot_record.py&lt;/span&gt;&lt;/pre&gt;&lt;/figure&gt;
&lt;h3 id=&quot;what-generic-monitoring-misses&quot;&gt;What Generic Monitoring Misses&lt;/h3&gt;
&lt;p&gt;The &lt;a href=&quot;/posts/ai-observability-gaps/&quot;&gt;AI observability gaps&lt;/a&gt; that block measurement at the agent level apply equally at the program level. Generic monitoring tools capture latency and error rates; they do not capture task completion rates, acceleration ratios, or abandonment.&lt;/p&gt;
&lt;h2 id=&quot;what-operating-model-sustains-adoption&quot;&gt;What Operating Model Sustains Adoption?&lt;/h2&gt;
&lt;p&gt;Sustained adoption requires a sequenced operating model, not a launch event. Each phase removes the precondition that blocks the next.&lt;/p&gt;



































&lt;table tabindex=&quot;0&quot;&gt;&lt;caption&gt;&lt;strong&gt;Table 1:&lt;/strong&gt; Four-phase operating model with timelines, deliverables, and success signals&lt;/caption&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Phase&lt;/th&gt;&lt;th&gt;Timeline&lt;/th&gt;&lt;th&gt;Key deliverables&lt;/th&gt;&lt;th&gt;Success signal&lt;/th&gt;&lt;/tr&gt;&lt;/thead&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;1: Baseline and segmentation&lt;/td&gt;&lt;td&gt;Days 1-30&lt;/td&gt;&lt;td&gt;Cohort map, friction audit, policy gap register&lt;/td&gt;&lt;td&gt;Top 5 friction items identified&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;2: Friction removal&lt;/td&gt;&lt;td&gt;Days 30-60&lt;/td&gt;&lt;td&gt;Data-category policy doc, approved tool list, vendor certifications, role-specific prompt libraries&lt;/td&gt;&lt;td&gt;Blocked cohort begins moving&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;3: Workflow integration&lt;/td&gt;&lt;td&gt;Days 60-120&lt;/td&gt;&lt;td&gt;Task-specific templates, acceleration ratio tracking, defect quality delta&lt;/td&gt;&lt;td&gt;Measurable throughput in 3+ task categories&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;4: Sustaining&lt;/td&gt;&lt;td&gt;Days 90-180&lt;/td&gt;&lt;td&gt;Manager KPI inclusion, AI-first sprint planning, monthly adoption review&lt;/td&gt;&lt;td&gt;80% sustained for 60+ days&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;
&lt;h3 id=&quot;phase-1-baseline-and-segmentation&quot;&gt;Phase 1: Baseline and Segmentation&lt;/h3&gt;
&lt;p&gt;Run a friction audit: structured interviews with a sample of Passive and Blocked engineers, focused on what specifically prevents use of tools already available. The policy gap register captures every approval, certification, or data-handling question with no documented answer. Output is the cohort map, a ranked list of the top five friction items, and a use-case inventory scored on five axes: business value, feasibility, data readiness, risk level, and named sponsorship.&lt;/p&gt;
&lt;p&gt;Classify candidate use cases into three lanes by governance exposure. Lane 1 covers internal productivity: code assist, documentation, knowledge search. No regulated data; immediate confidence gains. Lane 2 covers operational workflows: support summarization, knowledge bases, implementation tooling. Institutional data in scope; requires Tier 2 policy coverage. Lane 3 covers product-embedded AI: features delivered to end users. External or regulated data; formal risk review is a precondition. Pilot sequencing follows lane order. Lane 3 is a distinct governance regime, not a later phase of Lane 1. Conflating them is where programs in regulated industries produce incidents (ISG, 2025; PwC, 2025).&lt;/p&gt;
&lt;h3 id=&quot;phase-2-friction-removal&quot;&gt;Phase 2: Friction Removal&lt;/h3&gt;
&lt;p&gt;Policy clarity for the blocked cohort is a governance question, not a technology one. The data-category policy document needs to answer three questions per category: which approved provider agreements cover it, whether output may be retained, and what approval is required before a new vendor or tool class is introduced. &lt;a href=&quot;https://getdx.com/blog/ai-cuts-developer-onboarding-time-in-half&quot;&gt;DX Research&lt;/a&gt; (Tacho, 2025) found that daily AI users hit their 10th pull request in 49 days vs. 91 days for non-users, cutting onboarding time by 46%. Reaching that outcome requires role-differentiated enablement (Anthropic, 2025; DORA, 2026):&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Executives:&lt;/strong&gt; governance framing and outcome visibility.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Managers:&lt;/strong&gt; workflow redesign patterns and inspection criteria for AI-assisted output.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Practitioners:&lt;/strong&gt; standardized agentic workflows, context engineering patterns, and AI SDLC integration.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;McKinsey (2025) found only 1% of companies have reached AI maturity and identified leadership steering, not employee readiness, as the primary gap.&lt;/p&gt;
&lt;figure&gt;&lt;figcaption&gt;&lt;strong&gt;Code Snippet 2:&lt;/strong&gt; Three-tier data policy template. Tier 1 requires no case-by-case review.&lt;/figcaption&gt;&lt;pre class=&quot;astro-code astro-code-themes catppuccin-latte catppuccin-macchiato has-highlighted mt-8&quot; style=&quot;--shiki-light:#4c4f69; --shiki-dark:#cad3f5; --shiki-light-bg:#eff1f5; --shiki-dark-bg:#24273a; --file-name-offset: -0.75rem&quot; tabindex=&quot;0&quot; data-language=&quot;yaml&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;tiers&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;  -&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt; tier&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#FE640B;--shiki-dark:#F5A97F&quot;&gt; 1&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;    label&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; Internal productivity&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;    data_types&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt; [&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;code&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; docs&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; internal-comms&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line highlighted&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;    approved_providers&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; any-approved&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;    audit_logging&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#FE640B;--shiki-dark:#F5A97F&quot;&gt; false&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line highlighted&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;    approval_path&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; none&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;  -&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt; tier&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#FE640B;--shiki-dark:#F5A97F&quot;&gt; 2&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;    label&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; Institutional data&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;    data_types&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt; [&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;architecture-docs&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; anonymized-datasets&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; internal-kb&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;    approved_providers&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt; [&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;enterprise-agreement-only&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line highlighted&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;    audit_logging&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#FE640B;--shiki-dark:#F5A97F&quot;&gt; true&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line highlighted&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;    approval_path&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; team-lead-once-per-tool-class&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;  -&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt; tier&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#FE640B;--shiki-dark:#F5A97F&quot;&gt; 3&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;    label&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; Restricted or regulated&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;    data_types&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt; [&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;pii&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; regulated-records&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; confidential&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;    approved_providers&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt; [&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;isolated-endpoints-only&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line highlighted&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;    audit_logging&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#FE640B;--shiki-dark:#F5A97F&quot;&gt; true&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line highlighted&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;    approval_path&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; security-review-once-per-vendor&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;span class=&quot;absolute py-1 text-foreground text-xs font-medium leading-4 pl-4 pr-2 before:inline-block before:size-1 before:bg-green-500 before:rounded-full before:absolute before:top-[45%] before:left-2 left-2 top-(--file-name-offset) border rounded-md bg-background&quot;&gt;policy/ai-data-policy.yaml&lt;/span&gt;&lt;/pre&gt;&lt;/figure&gt;
&lt;p&gt;Without a published tier definition, organizations default to Tier 3 overhead on Tier 1 tasks. In regulated environments, Tier 3 maps to any data class with statutory retention or confidentiality obligations: isolated model endpoints and exportable audit logs are entry criteria before any workflow touches that data. RAG applied to an existing architecture documentation corpus reduced manual compliance documentation effort from weeks to near-automated throughput per migration phase (see &lt;a href=&quot;/posts/rag-legacy-systems/&quot;&gt;RAG for Legacy Systems&lt;/a&gt; for the full architecture). That result required Tier 2 classification and an approved provider agreement.&lt;/p&gt;
&lt;h3 id=&quot;phase-3-workflow-integration&quot;&gt;Phase 3: Workflow Integration&lt;/h3&gt;
&lt;p&gt;Deploy purpose-built tooling for the highest-volume tasks for Active engineers and role-specific templates with explicit examples for the Passive cohort. Track acceleration ratios and defect delta from day one. An &lt;a href=&quot;https://agents.md/&quot;&gt;&lt;code&gt;AGENTS.md&lt;/code&gt;&lt;/a&gt; file instructs the agent on commit conventions, identity requirements, and policy boundaries. Orchestrator hooks (in tools like Goose, Claude Code, or Codex) enforce those rules at execution time; local git hooks verify the same contract at commit time; and repository controls (GPG signing, DCO, required code owner review, branch rulesets, provenance attestation) enforce them again at the server. All three layers are intentionally aligned: a well-configured agent should never trip a hook, preserving smooth developer experience without sacrificing accountability.&lt;/p&gt;
&lt;h3 id=&quot;phase-4-sustaining&quot;&gt;Phase 4: Sustaining&lt;/h3&gt;
&lt;p&gt;Include adoption metrics in manager team health reviews and AI-assisted task identification in sprint planning. Without management inclusion, adoption reverts to those who would have adopted regardless. For Tier 3 production AI, uptime guarantees, audit logging, model versioning, and data lineage are entry criteria, not optional features. When an AI-assisted workflow in that tier degrades, the rollback path and escalation owner must be documented before go-live, not defined during the incident. &lt;a href=&quot;/posts/sre-ai-agents-production/&quot;&gt;SRE practices for AI agents in production&lt;/a&gt; covers the error budget and trust ladder model that operationalizes this.&lt;/p&gt;
&lt;h2 id=&quot;which-ai-adoption-plays-waste-budget&quot;&gt;Which AI Adoption Plays Waste Budget?&lt;/h2&gt;
&lt;p&gt;Four interventions consume program budget while producing no durable change in the blocked and passive cohorts.&lt;/p&gt;






























&lt;table tabindex=&quot;0&quot;&gt;&lt;caption&gt;&lt;strong&gt;Table 2:&lt;/strong&gt; High-visibility interventions with low conversion impact&lt;/caption&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Intervention&lt;/th&gt;&lt;th&gt;Why it fails&lt;/th&gt;&lt;th&gt;What to do instead&lt;/th&gt;&lt;/tr&gt;&lt;/thead&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;Hackathons&lt;/td&gt;&lt;td&gt;Attract Active engineers only; do not address Blocked cohort’s actual barrier&lt;/td&gt;&lt;td&gt;Friction audit and policy doc for Blocked cohort&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Performance review linkage in year one&lt;/td&gt;&lt;td&gt;Engineers game the metric before templates exist; self-reported numbers inflate&lt;/td&gt;&lt;td&gt;Telemetry-based measurement only until workflow templates are established&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Deploying all tools simultaneously&lt;/td&gt;&lt;td&gt;Decision fatigue, shallow engagement; no cohort gets a complete workflow&lt;/td&gt;&lt;td&gt;Sequence by cohort readiness; one complete workflow per cohort before expanding&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Skipping policy clarity on data categories&lt;/td&gt;&lt;td&gt;Self-censorship is the correct default in the absence of guidance&lt;/td&gt;&lt;td&gt;Publish the tier model before any rollout begins&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;
&lt;h2 id=&quot;how-do-you-measure-adoption-not-just-activity&quot;&gt;How Do You Measure Adoption, Not Just Activity?&lt;/h2&gt;
&lt;p&gt;Activity metrics, license activations, prompt volumes, and satisfaction scores are easy to collect and tell you nothing about delivery outcomes. Adoption, defined as sustained workflow change, maps directly to business value.&lt;/p&gt;
&lt;h3 id=&quot;the-five-number-rule&quot;&gt;The Five-Number Rule&lt;/h3&gt;
&lt;p&gt;The pre-registration record below is the program management counterpart to the telemetry pipeline: the committed numbers that turn a pilot into a decision.&lt;/p&gt;
&lt;figure&gt;&lt;figcaption&gt;&lt;strong&gt;Code Snippet 3:&lt;/strong&gt; Pilot pre-registration record for a code-review workflow. decision_date is the go/no-go gate.&lt;/figcaption&gt;&lt;pre class=&quot;astro-code astro-code-themes catppuccin-latte catppuccin-macchiato has-highlighted mt-8&quot; style=&quot;--shiki-light:#4c4f69; --shiki-dark:#cad3f5; --shiki-light-bg:#eff1f5; --shiki-dark-bg:#24273a; --file-name-offset: -0.75rem&quot; tabindex=&quot;0&quot; data-language=&quot;yaml&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;task&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; ai-assisted-code-review&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;baseline_minutes&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#FE640B;--shiki-dark:#F5A97F&quot;&gt; 45&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;target_reduction_pct&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#FE640B;--shiki-dark:#F5A97F&quot;&gt; 30&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;risk_threshold_defect_regression_pct&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#FE640B;--shiki-dark:#F5A97F&quot;&gt; 0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;cohort_size&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#FE640B;--shiki-dark:#F5A97F&quot;&gt; 20&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;adoption_target_pct&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#FE640B;--shiki-dark:#F5A97F&quot;&gt; 75&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line highlighted&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;decision_date&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; &quot;2026-07-25&quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;scale_signal&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; &quot;&gt;=75% cohort active AND defect_regression == 0&quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;stop_signal&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; &quot;&amp;#x3C;50% cohort active OR defect_regression &gt; 0&quot;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;span class=&quot;absolute py-1 text-foreground text-xs font-medium leading-4 pl-4 pr-2 before:inline-block before:size-1 before:bg-green-500 before:rounded-full before:absolute before:top-[45%] before:left-2 left-2 top-(--file-name-offset) border rounded-md bg-background&quot;&gt;pilots/code-review-pilot.yaml&lt;/span&gt;&lt;/pre&gt;&lt;/figure&gt;
&lt;p&gt;&lt;a href=&quot;https://doi.org/10.5281/zenodo.20039271&quot;&gt;Clouatre (2026)&lt;/a&gt; found no effect of prompt repetition across three pre-registered experiments. Techniques that improve published benchmarks do not transfer to production agentic systems without internal measurement.&lt;/p&gt;
&lt;h3 id=&quot;the-kpi-scorecard&quot;&gt;The KPI Scorecard&lt;/h3&gt;
&lt;p&gt;The adoption metric must come from tool telemetry, not self-report. The METR perception gap (Becker et al., 2025) makes this non-negotiable: survey data is not a proxy for productivity. The burnout index is required: programs that drive throughput without monitoring team health create a different kind of debt.&lt;/p&gt;








































&lt;table tabindex=&quot;0&quot;&gt;&lt;caption&gt;&lt;strong&gt;Table 3:&lt;/strong&gt; KPI scorecard for AI adoption programs. 80% sustained adoption is the threshold at which the practice propagates without continued program intervention.&lt;/caption&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Dimension&lt;/th&gt;&lt;th&gt;Metric (source)&lt;/th&gt;&lt;th&gt;Target&lt;/th&gt;&lt;/tr&gt;&lt;/thead&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;Delivery velocity&lt;/td&gt;&lt;td&gt;Time per task category (sprint logs)&lt;/td&gt;&lt;td&gt;20-40% reduction by Day 120&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Quality (dev)&lt;/td&gt;&lt;td&gt;Defect rate vs. baseline (defect tracker)&lt;/td&gt;&lt;td&gt;No regression&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Quality (prod)&lt;/td&gt;&lt;td&gt;Defect escape rate to production (incident tracker)&lt;/td&gt;&lt;td&gt;No increase from pre-AI baseline&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;AI adoption&lt;/td&gt;&lt;td&gt;% active in past 30 days (tool telemetry)&lt;/td&gt;&lt;td&gt;80% by Day 120&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Policy compliance&lt;/td&gt;&lt;td&gt;% use within approved boundaries (audit logs)&lt;/td&gt;&lt;td&gt;100% from Day 1&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Team health&lt;/td&gt;&lt;td&gt;Burnout index (anonymous quarterly survey)&lt;/td&gt;&lt;td&gt;No regression&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;
&lt;h2 id=&quot;what-should-engineering-leaders-do-next&quot;&gt;What Should Engineering Leaders Do Next?&lt;/h2&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Segment before you intervene.&lt;/strong&gt; The three-cohort model determines which intervention produces return. A single program applied to all cohorts is the primary reason generic programs stall.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Publish a tier model before rollout.&lt;/strong&gt; A one-page policy that classifies data by tier and names approved provider agreements removes that blocker.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Instrument before you deploy.&lt;/strong&gt; Build the telemetry pipeline first: OTel spans, task logs, and a pre-registered decision date. The data you collect before rollout is the only baseline you will ever have.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Purpose-built agentic tooling reduces cost.&lt;/strong&gt; Specialize agents per phase over MCP and AGENTS.md. In regulated environments, vet vendors on data agreements, model provenance, and audit log exportability before any restricted-data pilot.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Measure adoption from telemetry, not self-report.&lt;/strong&gt; Track acceleration ratio and defect delta, not prompt volume.&lt;/li&gt;
&lt;/ol&gt;
&lt;hr&gt;
&lt;p&gt;For AI governance and decision sequencing in delivery contexts, see &lt;a href=&quot;/posts/decision-frameworks-ai-delivery/&quot;&gt;Decision Frameworks for AI Delivery&lt;/a&gt;.&lt;/p&gt;
&lt;hr&gt;
&lt;h2 id=&quot;references&quot;&gt;References&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Anthropic, “Effective Context Engineering for AI Agents” (2025) — &lt;a href=&quot;https://www.anthropic.com/engineering/effective-context-engineering&quot;&gt;https://www.anthropic.com/engineering/effective-context-engineering&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Bain &amp;#x26; Company, “From Pilots to Payoff: Generative AI in Software Development” (2025) — &lt;a href=&quot;https://www.bain.com/insights/from-pilots-to-payoff-generative-ai-in-software-development-technology-report-2025/&quot;&gt;https://www.bain.com/insights/from-pilots-to-payoff-generative-ai-in-software-development-technology-report-2025/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;BCG, “AI at Work 2025: Momentum Builds, But Gaps Remain” (2025) — &lt;a href=&quot;https://www.bcg.com/publications/2025/ai-at-work-momentum-builds-but-gaps-remain&quot;&gt;https://www.bcg.com/publications/2025/ai-at-work-momentum-builds-but-gaps-remain&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Becker, J. et al., “Measuring the Impact of Early-2025 AI on Experienced Open-Source Developer Productivity” (2025) — &lt;a href=&quot;https://metr.org/blog/2025-07-10-early-2025-ai-experienced-os-dev-study&quot;&gt;https://metr.org/blog/2025-07-10-early-2025-ai-experienced-os-dev-study&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Cisco, “AI Readiness Index” (2024) — &lt;a href=&quot;https://www.cisco.com/c/m/en_us/solutions/ai/readiness-index/archive/2024-m11.html&quot;&gt;https://www.cisco.com/c/m/en_us/solutions/ai/readiness-index/archive/2024-m11.html&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Clouatre, H., “Aptu Benchmarks: aptu+mercury-2 vs raw claude-opus-4.6” (2026) — &lt;a href=&quot;https://github.com/clouatre-labs/aptu/blob/main/docs/BENCHMARKS.md&quot;&gt;https://github.com/clouatre-labs/aptu/blob/main/docs/BENCHMARKS.md&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Clouatre, H., “aptu-coder benchmark results” (2026) — &lt;a href=&quot;https://github.com/clouatre-labs/aptu-coder#benchmarks&quot;&gt;https://github.com/clouatre-labs/aptu-coder#benchmarks&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Clouatre, H., “Ceiling Effects and Convergence: Null Results for Instruction Repetition in LLM-Agent Pipelines” (2026) — &lt;a href=&quot;https://doi.org/10.5281/zenodo.20039271&quot;&gt;https://doi.org/10.5281/zenodo.20039271&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Dell’Acqua, F. et al., “Navigating the Jagged Technological Frontier” (2023) — &lt;a href=&quot;https://doi.org/10.2139/ssrn.4573321&quot;&gt;https://doi.org/10.2139/ssrn.4573321&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;DORA (Google Cloud), “2025 State of DevOps Report” (2025) — &lt;a href=&quot;https://dora.dev/research/2025/dora-report/&quot;&gt;https://dora.dev/research/2025/dora-report/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;DORA (Google Cloud), “Moving from AI Adoption to Effective SDLC Use” (2026) — &lt;a href=&quot;https://dora.dev/research/2026/ai-sdlc/&quot;&gt;https://dora.dev/research/2026/ai-sdlc/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Gartner, “Gartner Predicts Over 40% of Agentic AI Projects Will Be Canceled by End of 2027” (2025) — &lt;a href=&quot;https://www.gartner.com/en/newsroom/press-releases/2025-06-25-gartner-predicts-over-40-percent-of-agentic-ai-projects-will-be-canceled-by-end-of-2027&quot;&gt;https://www.gartner.com/en/newsroom/press-releases/2025-06-25-gartner-predicts-over-40-percent-of-agentic-ai-projects-will-be-canceled-by-end-of-2027&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Harmonic Security, “What 22 Million Enterprise AI Prompts Reveal About Shadow AI” (2025) — &lt;a href=&quot;https://www.harmonic.security/resources/what-22-million-enterprise-ai-prompts-reveal-about-shadow-ai-in-2025&quot;&gt;https://www.harmonic.security/resources/what-22-million-enterprise-ai-prompts-reveal-about-shadow-ai-in-2025&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;ISG, “State of Enterprise AI Adoption” (2025) — &lt;a href=&quot;https://isg-one.com/research/state-of-enterprise-ai-adoption&quot;&gt;https://isg-one.com/research/state-of-enterprise-ai-adoption&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;McKinsey, “Superagency in the Workplace: Empowering People to Unlock AI’s Full Potential at Work” (2025) — &lt;a href=&quot;https://www.mckinsey.com/capabilities/tech-and-ai/our-insights/superagency-in-the-workplace-empowering-people-to-unlock-ais-full-potential-at-work&quot;&gt;https://www.mckinsey.com/capabilities/tech-and-ai/our-insights/superagency-in-the-workplace-empowering-people-to-unlock-ais-full-potential-at-work&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;OECD/BCG, “Identifying and Overcoming Barriers to AI Adoption in Enterprises” (2025) — &lt;a href=&quot;https://doi.org/10.1787/f9ef33c3-en&quot;&gt;https://doi.org/10.1787/f9ef33c3-en&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;PwC, “Responsible AI Survey: From Policy to Practice” (2025) — &lt;a href=&quot;https://www.pwc.com/us/en/tech-effect/ai-analytics/responsible-ai-survey.html&quot;&gt;https://www.pwc.com/us/en/tech-effect/ai-analytics/responsible-ai-survey.html&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Tacho, L., “AI cuts onboarding time in half for new hires in the enterprise” (2025) — &lt;a href=&quot;https://getdx.com/blog/ai-cuts-developer-onboarding-time-in-half&quot;&gt;https://getdx.com/blog/ai-cuts-developer-onboarding-time-in-half&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</content:encoded><category>agentic-ai</category><category>implementation-guide</category><category>ai-governance</category><category>case-studies</category><author>Hugues Clouâtre</author></item><item><title>AI Delivery Decision Frameworks: Type 1, Type 2, DACI</title><link>https://clouatre.ca/posts/decision-frameworks-ai-delivery/</link><guid isPermaLink="true">https://clouatre.ca/posts/decision-frameworks-ai-delivery/</guid><description>Misclassifying reversible decisions costs more than the decision itself. Four frameworks unblock AI delivery: Type 1/Type 2, Eisenhower, DACI, and PMBOK.</description><pubDate>Tue, 26 May 2026 10:55:00 GMT</pubDate><content:encoded>&lt;p&gt;A bench mismatch, a scope gap, a stakeholder escalation: each gets treated as a hard blocker requiring structural intervention, when most warrant fast iteration instead. Four frameworks correct this: Type 1/Type 2 sets decision velocity; Eisenhower orders the queue; DACI assigns authority and prevents reversible decisions from stalling; PMBOK stakeholder management separates trust failure from delivery failure.&lt;/p&gt;
&lt;h2 id=&quot;table-of-contents&quot;&gt;Table of contents&lt;/h2&gt;
&lt;p&gt;&lt;/p&gt;&lt;details&gt;&lt;summary&gt;Contents&lt;/summary&gt;&lt;p&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;#why-are-staffing-mismatches-misclassified-as-irreversible&quot;&gt;Why Are Staffing Mismatches Misclassified as Irreversible?&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;#which-decision-types-are-most-often-misclassified&quot;&gt;Which Decision Types Are Most Often Misclassified?&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#what-is-the-type-1type-2-decision-lens&quot;&gt;What Is the Type 1/Type 2 Decision Lens?&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;#delivery-examples-of-each-type&quot;&gt;Delivery Examples of Each Type&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#how-does-the-eisenhower-matrix-add-triage-ordering&quot;&gt;How Does the Eisenhower Matrix Add Triage Ordering?&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;#why-q2-is-the-real-leverage-point&quot;&gt;Why Q2 Is the Real Leverage Point&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#immediate-vs-deferrable-actions-across-simultaneous-crises&quot;&gt;Immediate vs. Deferrable Actions Across Simultaneous Crises&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#why-does-delivery-authority-collapse-without-a-daci&quot;&gt;Why Does Delivery Authority Collapse Without a DACI?&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;#what-failure-mode-does-daci-prevent&quot;&gt;What Failure Mode Does DACI Prevent?&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#how-do-you-exercise-authority-through-dotted-line-relationships&quot;&gt;How Do You Exercise Authority Through Dotted-Line Relationships?&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#daci-in-practice-sow-scope-disputes&quot;&gt;DACI in Practice: SOW Scope Disputes&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#how-to-distinguish-a-stakeholder-failure-from-a-delivery-failure&quot;&gt;How to Distinguish a Stakeholder Failure from a Delivery Failure?&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;#how-do-you-separate-perception-from-delivery-record&quot;&gt;How Do You Separate Perception from Delivery Record?&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#how-does-psychological-safety-aid-team-recovery&quot;&gt;How Does Psychological Safety Aid Team Recovery?&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#when-a-lead-engineer-requests-reassignment&quot;&gt;When a Lead Engineer Requests Reassignment&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#how-does-ai-tooling-shift-the-staffing-reversibility-boundary&quot;&gt;How Does AI Tooling Shift the Staffing Reversibility Boundary?&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;#how-does-ai-tooling-reclassify-adjacent-stack-decisions&quot;&gt;How Does AI Tooling Reclassify Adjacent-Stack Decisions?&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#how-do-you-qualify-the-boundary-at-intake&quot;&gt;How Do You Qualify the Boundary at Intake?&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#how-do-the-four-frameworks-form-a-single-decision-cadence&quot;&gt;How Do the Four Frameworks Form a Single Decision Cadence?&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;#the-four-layer-stack&quot;&gt;The Four-Layer Stack&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#what-operating-model-changes-prevent-delivery-failure-recurrence&quot;&gt;What Operating Model Changes Prevent Delivery Failure Recurrence?&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;#what-three-structural-changes-close-the-gaps&quot;&gt;What Three Structural Changes Close the Gaps?&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#follow-on-sequence-per-crisis-type&quot;&gt;Follow-On Sequence per Crisis Type&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#references&quot;&gt;References&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;/p&gt;&lt;/details&gt;&lt;p&gt;&lt;/p&gt;
&lt;h2 id=&quot;why-are-staffing-mismatches-misclassified-as-irreversible&quot;&gt;Why Are Staffing Mismatches Misclassified as Irreversible?&lt;/h2&gt;
&lt;p&gt;When a client challenges team competence mid-engagement, the reflex is to swap resources, open a requisition, or restructure. &lt;a href=&quot;https://www.pmi.org/-/media/pmi/documents/public/pdf/learning/thought-leadership/pulse/pulse-of-the-profession-2018.pdf&quot;&gt;PMI data across 4,455 project management practitioners&lt;/a&gt; shows communication, requirements, sponsorship, and alignment failures as leading causes of project underperformance, ahead of personnel gaps.&lt;/p&gt;
&lt;p&gt;Triage requires four parties: the account executive (client relationship), the practice lead (bench and capability decisions), the resource manager (internal re-allocation and capacity), and the vendor CSM (Customer Success Manager) if a technology partner is co-funding the engagement. Convening the wrong subset produces a decision without the authority to execute it.&lt;/p&gt;
&lt;h3 id=&quot;which-decision-types-are-most-often-misclassified&quot;&gt;Which Decision Types Are Most Often Misclassified?&lt;/h3&gt;
&lt;p&gt;A resistant client is more often a symptom of unmet expectations than a verdict on team quality. A bench mismatch signals a lead-time gap, not a capability ceiling. A CEO-level escalation over team conflict is an interpersonal dynamic, not a personnel failure.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://s2.q4cdn.com/299287126/files/doc_financials/annual/2015-Letter-to-Shareholders.PDF&quot;&gt;Bezos&lt;/a&gt; identified this pattern at organizational scale: the primary failure mode in large institutions is applying Type 1 process to reversible situations.&lt;/p&gt;
&lt;h2 id=&quot;what-is-the-type-1type-2-decision-lens&quot;&gt;What Is the Type 1/Type 2 Decision Lens?&lt;/h2&gt;
&lt;p&gt;Type 1 decisions are consequential and largely irreversible (“one-way doors”), warranting great deliberation before committing. Type 2 decisions are reversible and cheap to undo (“two-way doors”), warranting speed and high-judgment individuals or small groups.&lt;/p&gt;
&lt;h3 id=&quot;delivery-examples-of-each-type&quot;&gt;Delivery Examples of Each Type&lt;/h3&gt;
&lt;p&gt;Signing a milestone SOW with vague scope is Type 1: contractually binding and hard to reverse. Proposing a paid inception phase is Type 2: time-limited and reversible. Treating a two-way door as a one-way door stalls decisions.&lt;/p&gt;





























&lt;table tabindex=&quot;0&quot;&gt;&lt;caption&gt;&lt;strong&gt;Table 1:&lt;/strong&gt; Type 1/Type 2 classification for three common delivery decisions.&lt;/caption&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Situation&lt;/th&gt;&lt;th&gt;Decision&lt;/th&gt;&lt;th&gt;Type&lt;/th&gt;&lt;th&gt;Rationale&lt;/th&gt;&lt;/tr&gt;&lt;/thead&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;Client questions team competence&lt;/td&gt;&lt;td&gt;Hold team; address trust directly&lt;/td&gt;&lt;td&gt;1&lt;/td&gt;&lt;td&gt;Replacing mid-engagement severs continuity and confirms the client’s narrative&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Adjacent-stack mismatch, AI tooling available&lt;/td&gt;&lt;td&gt;Deploy with quality gate&lt;/td&gt;&lt;td&gt;2&lt;/td&gt;&lt;td&gt;Architectural reasoning transfers; syntax gap is addressable in the first sprint&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;CEO escalation over team conflict&lt;/td&gt;&lt;td&gt;Add interim senior lead&lt;/td&gt;&lt;td&gt;2&lt;/td&gt;&lt;td&gt;Addition is reversible; replacement is not&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;
&lt;h2 id=&quot;how-does-the-eisenhower-matrix-add-triage-ordering&quot;&gt;How Does the Eisenhower Matrix Add Triage Ordering?&lt;/h2&gt;
&lt;p&gt;Eisenhower determines the order of engagement; Type 1/Type 2 determines the decision velocity within each item.&lt;/p&gt;






























&lt;table tabindex=&quot;0&quot;&gt;&lt;caption&gt;&lt;strong&gt;Table 2:&lt;/strong&gt; Eisenhower quadrant examples for delivery leaders.&lt;/caption&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Quadrant&lt;/th&gt;&lt;th&gt;Delivery example&lt;/th&gt;&lt;th&gt;Action&lt;/th&gt;&lt;/tr&gt;&lt;/thead&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;Q1: Urgent + Important&lt;/td&gt;&lt;td&gt;CEO escalation on a strategic account&lt;/td&gt;&lt;td&gt;Act now; deliberate Type 2 process&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Q2: Not Urgent + Important&lt;/td&gt;&lt;td&gt;DACI clarity before SOW is signed; stakeholder relationship investment&lt;/td&gt;&lt;td&gt;Schedule; protect this time each week&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Q3: Urgent + Not Important&lt;/td&gt;&lt;td&gt;Non-strategic sales pursuit routing request&lt;/td&gt;&lt;td&gt;Delegate immediately&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Q4: Not Urgent + Not Important&lt;/td&gt;&lt;td&gt;Internal reporting that no stakeholder reads&lt;/td&gt;&lt;td&gt;Eliminate&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;
&lt;h3 id=&quot;why-q2-is-the-real-leverage-point&quot;&gt;Why Q2 Is the Real Leverage Point&lt;/h3&gt;
&lt;p&gt;In practice, many Q1 crises begin as neglected Q2 work, a framing consistent with Covey’s urgent-important model and with crisis-management literature emphasizing the cost of deferred preparation (&lt;a href=&quot;https://www.researchgate.net/publication/10811426_Preparing_for_Evil&quot;&gt;Mitroff &amp;#x26; Alpaslan, 2003&lt;/a&gt;): DACI not established before pursuit, stakeholder relationships not maintained, team capability not developed. These activities are never urgent, so they are chronically deferred.&lt;/p&gt;
&lt;h3 id=&quot;immediate-vs-deferrable-actions-across-simultaneous-crises&quot;&gt;Immediate vs. Deferrable Actions Across Simultaneous Crises&lt;/h3&gt;
&lt;p&gt;When multiple crises land at once, Eisenhower gives the sequence but not the split between stabilization and root-cause work. The immediate column stops the bleeding; the deferrable column addresses recurrence.&lt;/p&gt;

























&lt;table tabindex=&quot;0&quot;&gt;&lt;caption&gt;&lt;strong&gt;Table 3:&lt;/strong&gt; Immediate vs. deferrable actions per crisis type (Eisenhower Q1/Q2 split).&lt;/caption&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Crisis type&lt;/th&gt;&lt;th&gt;Immediate&lt;/th&gt;&lt;th&gt;Deferrable&lt;/th&gt;&lt;/tr&gt;&lt;/thead&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;Client trust&lt;/td&gt;&lt;td&gt;Call client sponsor; present sprint completion rate and defect density; establish weekly client sync&lt;/td&gt;&lt;td&gt;Stakeholder map refresh; executive sync cadence; quarterly relationship review&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Scope/contract&lt;/td&gt;&lt;td&gt;Hold SOW boundary as named Approver; deliver counter-proposal to Sales&lt;/td&gt;&lt;td&gt;Pre-pursuit DACI templates; milestone definition checklist&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Team conflict&lt;/td&gt;&lt;td&gt;Convene mediated session; hold structural changes pending root-cause analysis&lt;/td&gt;&lt;td&gt;Psychological safety diagnostic; pairing rotation; retrospective redesign&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;
&lt;h2 id=&quot;why-does-delivery-authority-collapse-without-a-daci&quot;&gt;Why Does Delivery Authority Collapse Without a DACI?&lt;/h2&gt;
&lt;p&gt;Without a DACI, no single role holds unambiguous decision rights. Decisions stall in silence across dotted-line relationships.&lt;/p&gt;
&lt;p&gt;DACI assigns four roles to every significant decision: a Driver who owns moving the decision forward, a single Approver with final authority, Contributors who provide substantive input, and Informed parties notified afterward.&lt;/p&gt;
&lt;h3 id=&quot;what-failure-mode-does-daci-prevent&quot;&gt;What Failure Mode Does DACI Prevent?&lt;/h3&gt;
&lt;p&gt;Its power is not taxonomic; it is a forcing function that requires organizations to name, in advance, who can say no. The Approver is the human-in-the-loop control point: the role that cannot be automated, delegated by silence, or assumed. Without that clarity, Sales commits to scope in a client meeting, Delivery identifies structural risks, and the client receives contradictory signals from the same firm. No individual owns the decision, so no individual acts. The tell: Sales and Delivery both believe they communicated clearly; the client received two different answers.&lt;/p&gt;
&lt;h3 id=&quot;how-do-you-exercise-authority-through-dotted-line-relationships&quot;&gt;How Do You Exercise Authority Through Dotted-Line Relationships?&lt;/h3&gt;
&lt;p&gt;DACI works cleanly when authority is direct. When the Delivery Director has only dotted-line authority (informal influence without org-chart ownership), the Approver role depends on trust rather than structure. The mitigation: establish DACI expectations at engagement kickoff, before any crisis, so the dotted-line relationship carries decision-making weight when a scope dispute arrives. Silence is not agreement in dotted-line structures: the Delivery Director must confirm the Approver role in writing at engagement start.&lt;/p&gt;
&lt;figure&gt;&lt;figcaption&gt;&lt;strong&gt;Code Snippet 1:&lt;/strong&gt; AGENTS.md delivery governance section. The Role block scopes agent authority; the Constraints block makes rules machine-checkable.&lt;/figcaption&gt;&lt;pre class=&quot;astro-code astro-code-themes catppuccin-latte catppuccin-macchiato mt-8&quot; style=&quot;--shiki-light:#4c4f69; --shiki-dark:#cad3f5; --shiki-light-bg:#eff1f5; --shiki-dark-bg:#24273a; --file-name-offset: -0.75rem&quot; tabindex=&quot;0&quot; data-language=&quot;markdown&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#FE640B;--shiki-dark:#F5A97F&quot;&gt;## Role&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line highlighted&quot;&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;You assist the Delivery Director on scope, staffing, and client communication tasks.&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;You do not have authority to commit, approve, or communicate on behalf of Sales or the client.&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#FE640B;--shiki-dark:#F5A97F&quot;&gt;## Constraints&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line highlighted&quot;&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt; Scope changes to a signed SOW: flag for Approver sign-off before any client communication.&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt; Sales verbal commitments are not binding; require a written amendment before acting on them.&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt; Staffing proposals outside the AI capability frontier: classify Type 1 and flag for human review.&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt; Ambiguous decisions: output what information is missing; do not infer or assume.&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;span class=&quot;absolute py-1 text-foreground text-xs font-medium leading-4 pl-4 pr-2 before:inline-block before:size-1 before:bg-green-500 before:rounded-full before:absolute before:top-[45%] before:left-2 left-2 top-(--file-name-offset) border rounded-md bg-background&quot;&gt;AGENTS.md&lt;/span&gt;&lt;/pre&gt;&lt;/figure&gt;
&lt;h3 id=&quot;daci-in-practice-sow-scope-disputes&quot;&gt;DACI in Practice: SOW Scope Disputes&lt;/h3&gt;
&lt;p&gt;When a client compresses a fixed-scope contract to a shorter timeline with vague milestones, the Delivery Director must be the named Approver on SOW structure. Without that delineation, Sales capitulates because no one has organizational standing to hold the boundary. &lt;a href=&quot;https://www.sciencedirect.com/science/article/pii/S2666307421000218&quot;&gt;Haleem et al. (2021)&lt;/a&gt; trace this failure to requirements uncertainty — missing, misinterpreted, or shifting stakeholder needs. The correct response is sharpening milestones before commitment, not compressing the schedule around them.&lt;/p&gt;
&lt;p&gt;The distinction between T&amp;#x26;M (Time and Materials) and milestone-based contracts is not cosmetic: T&amp;#x26;M transfers schedule risk to the client; milestones transfer it to Delivery. Compressing T&amp;#x26;M scope into a milestone structure without sharpening acceptance criteria turns a signed contract into a liability. The Delivery Director’s counter-proposal to Sales is not a refusal — it is a paid inception phase that sharpens milestones before risk transfers.&lt;/p&gt;
&lt;figure&gt;&lt;figcaption&gt;&lt;strong&gt;Code Snippet 2:&lt;/strong&gt; DACI governance template for SOW milestone compression. Gatekeepers hold narrow, policy-bounded veto rights; silence within 48 hours defaults to sign-off.&lt;/figcaption&gt;&lt;pre class=&quot;astro-code astro-code-themes catppuccin-latte catppuccin-macchiato has-highlighted mt-8&quot; style=&quot;--shiki-light:#4c4f69; --shiki-dark:#cad3f5; --shiki-light-bg:#eff1f5; --shiki-dark-bg:#24273a; --file-name-offset: -0.75rem&quot; tabindex=&quot;0&quot; data-language=&quot;yaml&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;decision&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; sow_milestone_compression&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;description&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; &quot;Client requests timeline reduction on fixed-scope contract&quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;roles&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;  driver&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; account_executive&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line highlighted&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;  approver&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; delivery_director&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;  gatekeepers&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;    delivery_operations&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;      scope&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; bench capability and stack fit&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line highlighted&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;      veto_right&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#FE640B;--shiki-dark:#F5A97F&quot;&gt; true&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-light-font-style:italic;--shiki-dark:#939AB7;--shiki-dark-font-style:italic&quot;&gt;              # Blocks if skills gap cannot be closed &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;    legal_compliance&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;      scope&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; liability shift from T&amp;#x26;M to milestone&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line highlighted&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;      veto_right&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#FE640B;--shiki-dark:#F5A97F&quot;&gt; true&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-light-font-style:italic;--shiki-dark:#939AB7;--shiki-dark-font-style:italic&quot;&gt;              # Blocks if indemnification limits breached &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;  contributors&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;    -&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; lead_architect&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;    -&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; engagement_manager&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;  informed&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;    -&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; practice_lead&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;    -&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; engineering_bench&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;constraints&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line highlighted&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;  veto_sla_hours&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#FE640B;--shiki-dark:#F5A97F&quot;&gt; 48&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-light-font-style:italic;--shiki-dark:#939AB7;--shiki-dark-font-style:italic&quot;&gt;                # Silence defaults to sign-off &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;  escalation&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; delivery_director&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-light-font-style:italic;--shiki-dark:#939AB7;--shiki-dark-font-style:italic&quot;&gt;     # Unresolved veto escalates here&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line highlighted&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;  decision_deadline_days&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#FE640B;--shiki-dark:#F5A97F&quot;&gt; 3&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;span class=&quot;absolute py-1 text-foreground text-xs font-medium leading-4 pl-4 pr-2 before:inline-block before:size-1 before:bg-green-500 before:rounded-full before:absolute before:top-[45%] before:left-2 left-2 top-(--file-name-offset) border rounded-md bg-background&quot;&gt;delivery/daci-sow-template.yaml&lt;/span&gt;&lt;/pre&gt;&lt;/figure&gt;
&lt;h2 id=&quot;how-to-distinguish-a-stakeholder-failure-from-a-delivery-failure&quot;&gt;How to Distinguish a Stakeholder Failure from a Delivery Failure?&lt;/h2&gt;
&lt;p&gt;When a client says “your team is bad,” that is a claim, not a diagnosis. Genuine delivery underperformance and a stakeholder engagement breakdown produce nearly identical surface symptoms. Treating them as the same problem leads to the wrong intervention.&lt;/p&gt;
&lt;h3 id=&quot;how-do-you-separate-perception-from-delivery-record&quot;&gt;How Do You Separate Perception from Delivery Record?&lt;/h3&gt;
&lt;p&gt;PMBOK stakeholder management provides the diagnostic frame: a high-power, low-trust client who is resistant to decisions and consistently critical of the team is a textbook stakeholder engagement failure (per PMBOK’s power/interest grid) until the objective delivery record proves otherwise. Separate the client’s perception from the sprint completion rate, defect density, and milestone adherence. If the team is delivering against agreed commitments, the problem is trust, not performance.&lt;/p&gt;
&lt;h3 id=&quot;how-does-psychological-safety-aid-team-recovery&quot;&gt;How Does Psychological Safety Aid Team Recovery?&lt;/h3&gt;
&lt;p&gt;When a lead engineer requests reassignment and multiple engineers are in open conflict, this is a psychological safety breakdown. Replacing the team validates the client’s framing and signals the pattern will recur. The correct response is the Delivery Director engaging directly to stabilize the relationship and create conditions for recovery.&lt;/p&gt;
&lt;h3 id=&quot;when-a-lead-engineer-requests-reassignment&quot;&gt;When a Lead Engineer Requests Reassignment&lt;/h3&gt;
&lt;p&gt;A reassignment request from a lead engineer is a Type 1/Type 2 decision with team-wide visibility. Granting it immediately signals that opting out under pressure is acceptable; denying it without addressing the cause risks losing the engineer and worsening morale. The decision hinges on whether the engineer’s distress is rooted in the client relationship, recoverable with Delivery Director intervention, or in the team dynamic, requiring mediation first. Hold the reassignment open while the Delivery Director stabilizes the client relationship directly. Psychological safety reduces turnover intent: a meta-analysis of 136 studies found a negative correlation between psychological safety and turnover intent (&lt;a href=&quot;https://doi.org/10.1111/peps.12183&quot;&gt;Frazier et al., 2017&lt;/a&gt;).&lt;/p&gt;
&lt;p&gt;When multiple engineers are at odds, the cause is rarely uniform. The diagnostic split: interpersonal conflict resolves with mediation and pairing rotation; technical disagreement resolves with an architectural decision record and a designated technical authority; structural conflict (competing priorities, unclear ownership) resolves with DACI. Applying the wrong intervention to the wrong cause extends the crisis.&lt;/p&gt;
&lt;p&gt;The first direct Delivery Director-to-client conversation should follow a structured agenda:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Acknowledge the frustration without conceding the diagnosis.&lt;/li&gt;
&lt;li&gt;Present the objective delivery record: sprint completions, defect density, milestone adherence.&lt;/li&gt;
&lt;li&gt;Establish a direct cadence: weekly sync with the Delivery Director attending.&lt;/li&gt;
&lt;li&gt;Name one concrete commitment with a short timeline, visible before the next sync.&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id=&quot;how-does-ai-tooling-shift-the-staffing-reversibility-boundary&quot;&gt;How Does AI Tooling Shift the Staffing Reversibility Boundary?&lt;/h2&gt;
&lt;p&gt;A client requires a stack the available bench has not worked in directly. Traditionally, this is treated as Type 1: the wrong profile risks delivery failure and reputational exposure that cannot be undone mid-engagement.&lt;/p&gt;
&lt;h3 id=&quot;how-does-ai-tooling-reclassify-adjacent-stack-decisions&quot;&gt;How Does AI Tooling Reclassify Adjacent-Stack Decisions?&lt;/h3&gt;
&lt;p&gt;AI-augmented delivery changes this calculus. Engineers on an adjacent stack carry the mental models that matter: async concurrency patterns, component-based UI (User Interface) architecture, REST (Representational State Transfer) API design, client-side state management. The gap is syntax and ecosystem conventions, not architectural reasoning, and that is what agentic engineering addresses: code generation, documentation injection, and automated quality gates. &lt;a href=&quot;https://doi.org/10.48550/arXiv.2302.06590&quot;&gt;Peng et al. (2023)&lt;/a&gt; found that developers completed an HTTP server implementation task 55.8% faster with GitHub Copilot.&lt;/p&gt;
&lt;p&gt;When live framework documentation is injected into agent context, unfamiliarity with a specific library significantly reduces as a delivery constraint, narrowing the bottleneck to quality review — a role a senior engineer performs in any language. &lt;a href=&quot;https://arxiv.org/abs/2207.05987&quot;&gt;Zhou et al. (2023)&lt;/a&gt; found that injecting API documentation at inference time improved code generation on unseen APIs by 52% relative (CodeT5 pass@1); &lt;a href=&quot;https://arxiv.org/abs/2503.15231&quot;&gt;Chen et al. (2025)&lt;/a&gt; measured 83-220% pass-rate improvements on unfamiliar Python libraries with documentation injection. Amazon migrated tens of thousands of production Java applications from Java 8 or 11 to Java 17, saving an estimated 4,500 developer-years of manual effort (&lt;a href=&quot;https://aws.amazon.com/blogs/devops/amazon-q-developer-just-reached-a-260-million-dollar-milestone/&quot;&gt;AWS, 2024&lt;/a&gt;).&lt;/p&gt;
&lt;figure&gt;&lt;img alt=&quot;Before/after reversibility boundary for adjacent-stack bench mismatch decisions with and without AI tooling&quot; loading=&quot;eager&quot; decoding=&quot;sync&quot; fetchpriority=&quot;high&quot; sizes=&quot;(min-width: 497px) 497px, 100vw&quot; data-astro-image=&quot;constrained&quot; data-astro-image-pos=&quot;center&quot; width=&quot;497&quot; height=&quot;906&quot; src=&quot;/_astro/ai-reversibility-shift.Dd7PgwHL_Z2nsdvW.svg&quot; srcset=&quot;/_astro/ai-reversibility-shift.Dd7PgwHL_Z2nsdvW.svg 497w&quot;&gt;&lt;figcaption&gt;&lt;strong&gt;Figure 1:&lt;/strong&gt; Adjacent-stack bench mismatches route to Type 1 (specialist required) or Type 2 (augment with AI tooling) based on gap type and a quality gate.&lt;/figcaption&gt;&lt;/figure&gt;
&lt;h3 id=&quot;how-do-you-qualify-the-boundary-at-intake&quot;&gt;How Do You Qualify the Boundary at Intake?&lt;/h3&gt;
&lt;p&gt;For adjacent stacks, bench mismatch is now a Type 2 decision when agentic tooling is available. The qualification step belongs at engagement intake: assess which engineers have the &lt;a href=&quot;/posts/ai-assisted-development&quot;&gt;architectural mental models&lt;/a&gt; that transfer and confirm tooling access is in place before committing the profile to the client. One constraint applies uniformly: for tasks outside the confirmed AI capability frontier, &lt;a href=&quot;https://doi.org/10.1287/orsc.2025.21838&quot;&gt;Dell’Acqua et al. (2023)&lt;/a&gt; found the BCG (Boston Consulting Group) cohort using AI performed 19% worse than those without it. Map the frontier before staffing, not after.&lt;/p&gt;
&lt;figure&gt;&lt;figcaption&gt;&lt;strong&gt;Code Snippet 3:&lt;/strong&gt; SKILL.md for delivery decision triage. The description is a neutral trigger condition; the Rules block prevents inference beyond provided intake data.&lt;/figcaption&gt;&lt;pre class=&quot;astro-code astro-code-themes catppuccin-latte catppuccin-macchiato mt-8&quot; style=&quot;--shiki-light:#4c4f69; --shiki-dark:#cad3f5; --shiki-light-bg:#eff1f5; --shiki-dark-bg:#24273a; --file-name-offset: -0.75rem&quot; tabindex=&quot;0&quot; data-language=&quot;markdown&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;---&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;name&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; delivery-decision-triage&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line highlighted&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;description&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; &quot;Classifies staffing and scope decisions as Type 1 or Type 2. Use when evaluating an adjacent-stack deployment, a scope change, or a delivery risk at intake.&quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;---&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#FE640B;--shiki-dark:#F5A97F&quot;&gt;## When to use&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt; Evaluating whether to deploy an engineer on an adjacent stack&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt; Assessing whether to approve a scope or timeline change&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt; Triaging a delivery risk under time pressure&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#FE640B;--shiki-dark:#F5A97F&quot;&gt;## Rules&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt; Use only intake data provided; do not infer missing context.&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line highlighted&quot;&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt; Architectural gap (domain knowledge missing): Type 1, escalate to Delivery Director.&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line highlighted&quot;&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt; Syntactic gap with active AI tooling: Type 2, require a written quality gate before committing.&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt; Tasks outside the confirmed AI capability frontier: Type 1 regardless of tooling.&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt; Classification ambiguous after intake: output &quot;insufficient data&quot; and list what is missing.&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;span class=&quot;absolute py-1 text-foreground text-xs font-medium leading-4 pl-4 pr-2 before:inline-block before:size-1 before:bg-green-500 before:rounded-full before:absolute before:top-[45%] before:left-2 left-2 top-(--file-name-offset) border rounded-md bg-background&quot;&gt;skills/delivery-decision-triage.md&lt;/span&gt;&lt;/pre&gt;&lt;/figure&gt;
&lt;h2 id=&quot;how-do-the-four-frameworks-form-a-single-decision-cadence&quot;&gt;How Do the Four Frameworks Form a Single Decision Cadence?&lt;/h2&gt;
&lt;p&gt;The four frameworks operate at different levels and answer distinct questions. Treating them as alternatives produces analysis paralysis; used as complementary layers, they produce a coherent cadence.&lt;/p&gt;
&lt;h3 id=&quot;the-four-layer-stack&quot;&gt;The Four-Layer Stack&lt;/h3&gt;






























&lt;table tabindex=&quot;0&quot;&gt;&lt;caption&gt;&lt;strong&gt;Table 4:&lt;/strong&gt; Four-framework decision cadence — what each layer answers and when it fires.&lt;/caption&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Framework&lt;/th&gt;&lt;th&gt;Question answered&lt;/th&gt;&lt;th&gt;When it fires&lt;/th&gt;&lt;/tr&gt;&lt;/thead&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;Eisenhower&lt;/td&gt;&lt;td&gt;What order do I act in?&lt;/td&gt;&lt;td&gt;On arrival of any new issue; set priority before acting&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Type 1 / Type 2&lt;/td&gt;&lt;td&gt;How carefully should I decide?&lt;/td&gt;&lt;td&gt;Before committing to any action; governs deliberation depth&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;DACI&lt;/td&gt;&lt;td&gt;Who decides, who executes?&lt;/td&gt;&lt;td&gt;When authority is ambiguous or Sales and Delivery diverge&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;PMBOK Stakeholder&lt;/td&gt;&lt;td&gt;Whose buy-in do I need?&lt;/td&gt;&lt;td&gt;When a high-power party is not yet engaged or trust is low&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;
&lt;h2 id=&quot;what-operating-model-changes-prevent-delivery-failure-recurrence&quot;&gt;What Operating Model Changes Prevent Delivery Failure Recurrence?&lt;/h2&gt;
&lt;p&gt;An AI operating model requires decision frameworks embedded at the pursuit stage, before any crisis arrives. Governance structures must be in place before the pressure that tests them.&lt;/p&gt;
&lt;p&gt;All four failure modes share one structural root cause: decisions that should have been made upstream were deferred until pressure forced them.&lt;/p&gt;
&lt;figure&gt;&lt;img alt=&quot;Triage decision flow: Eisenhower sequences, Type 1/Type 2 sets velocity, DACI assigns ownership&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; sizes=&quot;(min-width: 607px) 607px, 100vw&quot; data-astro-image=&quot;constrained&quot; data-astro-image-pos=&quot;center&quot; width=&quot;607&quot; height=&quot;875&quot; src=&quot;/_astro/decision-cadence.rxLJl40l_Z1ex7tz.svg&quot; srcset=&quot;/_astro/decision-cadence.rxLJl40l_Z1ex7tz.svg 607w&quot;&gt;&lt;figcaption&gt;&lt;strong&gt;Figure 2:&lt;/strong&gt; Eisenhower sequences the queue, Type 1/Type 2 sets decision velocity, DACI assigns the Approver.&lt;/figcaption&gt;&lt;/figure&gt;
&lt;h3 id=&quot;what-three-structural-changes-close-the-gaps&quot;&gt;What Three Structural Changes Close the Gaps?&lt;/h3&gt;
&lt;p&gt;Three changes close those gaps:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Establish DACI before pursuit.&lt;/strong&gt; Document the Approver role for SOW structure at pursuit, agree an escalation ladder between Sales and Delivery, and communicate it to the client before contract execution.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Protect Q2 capacity.&lt;/strong&gt; Stakeholder investment, milestone sharpening, and team psychological safety are Q2 activities that Q1 crises crowd out; block Q2 time weekly.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Qualify the &lt;a href=&quot;/posts/prompt-repetition-agent-evaluation&quot;&gt;AI capability frontier&lt;/a&gt; at intake.&lt;/strong&gt; Map which tasks fall within AI range, classify which staffing decisions are Type 2, and flag which require a specialist match tooling cannot substitute.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;follow-on-sequence-per-crisis-type&quot;&gt;Follow-On Sequence per Crisis Type&lt;/h3&gt;
&lt;p&gt;The operating model changes are structural; the follow-on sequence is tactical. The phases below reflect practitioner convention, not empirical prescription: timelines compress or extend based on client risk tolerance and relationship history.&lt;/p&gt;





























&lt;table tabindex=&quot;0&quot;&gt;&lt;caption&gt;&lt;strong&gt;Table 5:&lt;/strong&gt; Follow-on sequence per crisis type (practitioner heuristic).&lt;/caption&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Crisis type&lt;/th&gt;&lt;th&gt;Stabilize&lt;/th&gt;&lt;th&gt;Demonstrate&lt;/th&gt;&lt;th&gt;Decide&lt;/th&gt;&lt;/tr&gt;&lt;/thead&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;Client trust crisis&lt;/td&gt;&lt;td&gt;Delivery Director sync cadence established&lt;/td&gt;&lt;td&gt;Objective delivery scorecard shared with client&lt;/td&gt;&lt;td&gt;Client confirms team continues or escalation path named&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Scope/contract dispute&lt;/td&gt;&lt;td&gt;Counter-proposal delivered to Sales&lt;/td&gt;&lt;td&gt;Sharpened milestones documented in writing&lt;/td&gt;&lt;td&gt;Signed SOW or explicit walk-away decision&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Team conflict escalation&lt;/td&gt;&lt;td&gt;Mediated retrospective completed&lt;/td&gt;&lt;td&gt;Pairing rotation and lead coaching underway&lt;/td&gt;&lt;td&gt;Lead reassignment request resolved or closed&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;
&lt;p&gt;These frameworks do not eliminate hard conversations. They determine who has standing to have them, in what order, and with what authority. Most delivery failures trace to one deferred upstream decision: a DACI never written, a stakeholder relationship never invested in, a scope boundary never held (&lt;a href=&quot;https://www.pmi.org/-/media/pmi/documents/public/pdf/learning/thought-leadership/pulse/pulse-of-the-profession-2018.pdf&quot;&gt;PMI, 2018&lt;/a&gt;). The delivery leader’s leverage is in Q2 work, not crisis response.&lt;/p&gt;
&lt;hr&gt;
&lt;p&gt;For a deeper look at how agentic tooling changes the architecture of delivery work itself, see &lt;a href=&quot;/posts/orchestrating-ai-agents-subagent-architecture&quot;&gt;Orchestrating AI Agents: A Practical Guide to Subagent Architecture&lt;/a&gt;.&lt;/p&gt;
&lt;hr&gt;
&lt;h2 id=&quot;references&quot;&gt;References&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;AWS, “Amazon Q Developer Just Reached a $260 Million Dollar Milestone” (2024) — &lt;a href=&quot;https://aws.amazon.com/blogs/devops/amazon-q-developer-just-reached-a-260-million-dollar-milestone/&quot;&gt;https://aws.amazon.com/blogs/devops/amazon-q-developer-just-reached-a-260-million-dollar-milestone/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Bezos, J., “2015 Letter to Shareholders” (2016) — &lt;a href=&quot;https://s2.q4cdn.com/299287126/files/doc_financials/annual/2015-Letter-to-Shareholders.PDF&quot;&gt;https://s2.q4cdn.com/299287126/files/doc_financials/annual/2015-Letter-to-Shareholders.PDF&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Chen, Y. et al., “When LLMs Meet API Documentation” (2025) — &lt;a href=&quot;https://arxiv.org/abs/2503.15231&quot;&gt;https://arxiv.org/abs/2503.15231&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Covey, S.R., “The 7 Habits of Highly Effective People” (1989) — &lt;a href=&quot;https://www.simonandschuster.com/books/The-7-Habits-of-Highly-Effective-People/Stephen-R-Covey/9781982137274&quot;&gt;https://www.simonandschuster.com/books/The-7-Habits-of-Highly-Effective-People/Stephen-R-Covey/9781982137274&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Dell’Acqua, F. et al., “Navigating the Jagged Technological Frontier” (2023) — &lt;a href=&quot;https://doi.org/10.1287/orsc.2025.21838&quot;&gt;https://doi.org/10.1287/orsc.2025.21838&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Edmondson, A.C., “Psychological Safety and Learning Behavior in Work Teams” (1999) — &lt;a href=&quot;https://doi.org/10.2307/2666999&quot;&gt;https://doi.org/10.2307/2666999&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Frazier, M.L. et al., “Psychological Safety: A Meta-Analytic Review and Extension” (2017) — &lt;a href=&quot;https://doi.org/10.1111/peps.12183&quot;&gt;https://doi.org/10.1111/peps.12183&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Haleem, M. et al., “Cognitive Approach to Handle Requirements Uncertainty in Software Projects” (2021) — &lt;a href=&quot;https://www.sciencedirect.com/science/article/pii/S2666307421000218&quot;&gt;https://www.sciencedirect.com/science/article/pii/S2666307421000218&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Mitroff, I.I. &amp;#x26; Alpaslan, M.C., “Preparing for Evil” (2003) — &lt;a href=&quot;https://www.researchgate.net/publication/10811426_Preparing_for_Evil&quot;&gt;https://www.researchgate.net/publication/10811426_Preparing_for_Evil&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Peng, S. et al., “The Impact of AI on Developer Productivity: Evidence from GitHub Copilot” (2023) — &lt;a href=&quot;https://doi.org/10.48550/arXiv.2302.06590&quot;&gt;https://doi.org/10.48550/arXiv.2302.06590&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;PMI, “Pulse of the Profession” (2018) — &lt;a href=&quot;https://www.pmi.org/-/media/pmi/documents/public/pdf/learning/thought-leadership/pulse/pulse-of-the-profession-2018.pdf&quot;&gt;https://www.pmi.org/-/media/pmi/documents/public/pdf/learning/thought-leadership/pulse/pulse-of-the-profession-2018.pdf&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Zhou, S. et al., “DocPrompting: Generating Code by Retrieving the Docs” (2023) — &lt;a href=&quot;https://arxiv.org/abs/2207.05987&quot;&gt;https://arxiv.org/abs/2207.05987&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</content:encoded><category>agentic-ai</category><category>implementation-guide</category><category>ai-governance</category><author>Hugues Clouâtre</author></item><item><title>SRE for AI Agents: Error Budgets, Trust, and 90 Trials</title><link>https://clouatre.ca/posts/sre-ai-agents-production/</link><guid isPermaLink="true">https://clouatre.ca/posts/sre-ai-agents-production/</guid><description>Can an AI agent predict scope without hallucinating? We ran 90 trials. It added 1.7 phantom files per change. Error budgets and trust ladders are the gate.</description><pubDate>Thu, 11 Jun 2026 11:07:00 GMT</pubDate><content:encoded>&lt;p&gt;AI tooling budgets hit record highs. We ran 90 file-prediction trials to measure what an AI agent gets wrong before it touches production. The model predicted 1.7 files beyond the actual change set on average, even on a well-structured codebase. SRE is not ceremony. It is the empirical gate between velocity and blast radius.&lt;/p&gt;
&lt;h2 id=&quot;table-of-contents&quot;&gt;Table of contents&lt;/h2&gt;
&lt;p&gt;&lt;/p&gt;&lt;details&gt;&lt;summary&gt;Contents&lt;/summary&gt;&lt;p&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;#why-is-ai-widening-the-devops-gap&quot;&gt;Why Is AI Widening the Dev/Ops Gap?&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;#the-perception-gap-dashboards-vs-practitioner-reality&quot;&gt;The Perception Gap: Dashboards vs. Practitioner Reality&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#how-did-we-measure-ais-scope-creep&quot;&gt;How Did We Measure AI’s Scope Creep?&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;#why-medium-tier-prs-underperformed&quot;&gt;Why Medium-Tier PRs Underperformed&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#what-does-sre-mean-in-a-regulated-enterprise&quot;&gt;What Does SRE Mean in a Regulated Enterprise?&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;#error-budgets-as-compliance-evidence&quot;&gt;Error Budgets as Compliance Evidence&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#how-does-sre-act-as-ais-production-conscience&quot;&gt;How Does SRE Act as AI’s Production Conscience?&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;#decision-provenance-and-error-budget-separation&quot;&gt;Decision Provenance and Error Budget Separation&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#blast-radius-containment-and-the-trust-ladder&quot;&gt;Blast Radius Containment and the Trust Ladder&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#why-does-platform-maturity-gate-ai-readiness&quot;&gt;Why Does Platform Maturity Gate AI Readiness?&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;#the-learning-time-deficit&quot;&gt;The Learning Time Deficit&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#where-should-you-start&quot;&gt;Where Should You Start?&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;#the-four-actions-in-order&quot;&gt;The Four Actions in Order&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#references&quot;&gt;References&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;/p&gt;&lt;/details&gt;&lt;p&gt;&lt;/p&gt;
&lt;h2 id=&quot;why-is-ai-widening-the-devops-gap&quot;&gt;Why Is AI Widening the Dev/Ops Gap?&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;Toil&lt;/strong&gt; is the repetitive, manual operational work that scales with system load rather than adding lasting value. Catchpoint’s annual SRE reports tracked toil &lt;a href=&quot;https://www.catchpoint.com/learn/sre-report-2026&quot;&gt;rising from 25% to 34% between 2024 and 2026&lt;/a&gt;, the first sustained increase in five years. Over the same period, &lt;a href=&quot;https://devops.com/survey-ai-tools-are-increasing-amount-of-bad-code-needing-to-be-fixed-2/&quot;&gt;92% of developers&lt;/a&gt; report that AI tools increase the blast radius of bad code needing to be debugged (DevOps.com, 2025). &lt;a href=&quot;/posts/ai-augmented-cicd&quot;&gt;Defensive pipeline architectures&lt;/a&gt; can close part of this gap, but they address the pipeline, not the production governance layer.&lt;/p&gt;
&lt;p&gt;Three root causes keep surfacing in post-mortems:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;AI babysitting:&lt;/strong&gt; someone has to review generated runbooks and roll back missed-context remediations&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Configuration drift:&lt;/strong&gt; accelerating faster than humans can audit it&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Validation overhead:&lt;/strong&gt; compounding because every AI output needs a trust-but-verify pass before production&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;More frequent deploys, multiplied by more autonomous agents, against review capacity that has not scaled to match. &lt;a href=&quot;https://arxiv.org/abs/2507.09089&quot;&gt;METR found experienced developers took 19% longer with AI tools&lt;/a&gt; despite perceiving a 20% speedup (Becker et al., 2025).&lt;/p&gt;
&lt;h3 id=&quot;the-perception-gap-dashboards-vs-practitioner-reality&quot;&gt;The Perception Gap: Dashboards vs. Practitioner Reality&lt;/h3&gt;
&lt;p&gt;The perception gap makes this harder to fix. Directors reviewing dashboards see ticket counts drop and declare victory. Practitioners on the ground feel increased friction because toil shifted from “boring but predictable” to “novel and unpredictable.”&lt;/p&gt;
&lt;figure&gt;&lt;img alt=&quot;Chart showing AI investment and measured toil both climbing from 2021 to 2026&quot; loading=&quot;eager&quot; decoding=&quot;sync&quot; fetchpriority=&quot;high&quot; sizes=&quot;(min-width: 436px) 436px, 100vw&quot; data-astro-image=&quot;constrained&quot; data-astro-image-pos=&quot;center&quot; width=&quot;436&quot; height=&quot;570&quot; src=&quot;/_astro/sre-toil-paradox.CxyLZyJL_Z1jjAou.svg&quot; srcset=&quot;/_astro/sre-toil-paradox.CxyLZyJL_Z1jjAou.svg 436w&quot;&gt;&lt;figcaption&gt;&lt;strong&gt;Figure 1:&lt;/strong&gt; AI investment and measured toil both climbing, 2021-2026.&lt;/figcaption&gt;&lt;/figure&gt;
&lt;h2 id=&quot;how-did-we-measure-ais-scope-creep&quot;&gt;How Did We Measure AI’s Scope Creep?&lt;/h2&gt;
&lt;p&gt;We ran 90 file-prediction trials against &lt;a href=&quot;https://github.com/tobymao/sqlglot&quot;&gt;tobymao/sqlglot&lt;/a&gt;, an MIT-licensed SQL transpiler with 9k+ stars: 30 merged PRs stratified across simple, medium, and complex tiers, 3 predictions each, using a single Claude Sonnet 4.6 Bedrock call with no agent loop or retrieval. Given a GitHub issue description and the repository file tree, the model predicted which files a human engineer modified. &lt;strong&gt;Scope hallucination&lt;/strong&gt; counts files predicted beyond the human’s actual change set. For full data, see &lt;a href=&quot;https://doi.org/10.5281/zenodo.20645992&quot;&gt;Supplementary Materials&lt;/a&gt;.&lt;/p&gt;





























&lt;table tabindex=&quot;0&quot;&gt;&lt;caption&gt;&lt;strong&gt;Table 2:&lt;/strong&gt; Scope prediction results by complexity tier across 90 trials (30 PRs x 3 runs). F1 is harmonic mean of precision and recall.&lt;/caption&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Tier&lt;/th&gt;&lt;th&gt;Precision / Recall&lt;/th&gt;&lt;th&gt;F1&lt;/th&gt;&lt;th&gt;Scope Creep&lt;/th&gt;&lt;/tr&gt;&lt;/thead&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;Simple (1-2 files)&lt;/td&gt;&lt;td&gt;0.645 / 0.850&lt;/td&gt;&lt;td&gt;0.708&lt;/td&gt;&lt;td&gt;1.3 files&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Medium (3-5 files)&lt;/td&gt;&lt;td&gt;0.540 / 0.585&lt;/td&gt;&lt;td&gt;0.552&lt;/td&gt;&lt;td&gt;2.2 files&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Complex (6-15 files)&lt;/td&gt;&lt;td&gt;0.769 / 0.673&lt;/td&gt;&lt;td&gt;0.712&lt;/td&gt;&lt;td&gt;1.6 files&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;
&lt;h3 id=&quot;why-medium-tier-prs-underperformed&quot;&gt;Why Medium-Tier PRs Underperformed&lt;/h3&gt;
&lt;p&gt;The non-monotonic curve is the headline finding: Jaccard similarity scored 0.60 for simple PRs, 0.41 for medium, and 0.58 for complex. Medium PRs are the hardest tier: too many candidate files to guess by elimination, yet not enough structural regularity to infer the change set from sqlglot’s dialect-file conventions. Complex PRs scored highest because sqlglot’s rigid directory structure makes multi-file change sets predictable from the dialect name alone. 12 of 30 PRs failed with a Jaccard score below 0.5, spread across all tiers; no tier is immune. In a shadow-mode deployment, every over-predicted file is a false positive the reviewer must filter before the change reaches production.&lt;/p&gt;
&lt;h2 id=&quot;what-does-sre-mean-in-a-regulated-enterprise&quot;&gt;What Does SRE Mean in a Regulated Enterprise?&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;SRE&lt;/strong&gt; is not DevOps with a different name. The distinction is structural. In regulated financial services, production reliability carries regulatory weight: &lt;a href=&quot;https://www.osfi-bsif.gc.ca/en/guidance/guidance-library/technology-cyber-risk-management&quot;&gt;OSFI’s B-13 guideline&lt;/a&gt; mandates technology risk management with board-level accountability, and the &lt;a href=&quot;https://www.digital-operational-resilience-act.com/&quot;&gt;EU’s DORA regulation&lt;/a&gt; sets equivalent requirements for operational resilience across European financial services (European Parliament and Council, 2022).&lt;/p&gt;
&lt;h3 id=&quot;error-budgets-as-compliance-evidence&quot;&gt;Error Budgets as Compliance Evidence&lt;/h3&gt;
&lt;p&gt;SRE answers this with a reliability contract. &lt;strong&gt;Error budgets&lt;/strong&gt; define how much unreliability a service can tolerate before feature work stops. &lt;strong&gt;SLOs&lt;/strong&gt; (service level objectives) make reliability measurable rather than aspirational. Blameless postmortems treat incidents as system failures, not personnel failures. Google &lt;a href=&quot;https://sre.google/sre-book/table-of-contents/&quot;&gt;codified this framework in 2016&lt;/a&gt; and enterprises have since adapted it, but in regulated environments the stakes include regulatory censure, not just customer churn.&lt;/p&gt;
&lt;p&gt;Platform Engineering provides capability: the tools, the internal developer platform, the golden paths. SRE provides accountability: the error budgets, the incident response, the production governance. The question is whether that accountability holds when the agent making changes is not human.&lt;/p&gt;
&lt;h2 id=&quot;how-does-sre-act-as-ais-production-conscience&quot;&gt;How Does SRE Act as AI’s Production Conscience?&lt;/h2&gt;
&lt;p&gt;Deploying an AI agent is a reliability problem, not a monitoring problem. Monitoring tells you something broke; a reliability framework tells you how much breakage you can tolerate, who caused it, and whether to keep going.&lt;/p&gt;
&lt;h3 id=&quot;decision-provenance-and-error-budget-separation&quot;&gt;Decision Provenance and Error Budget Separation&lt;/h3&gt;
&lt;p&gt;&lt;a href=&quot;/posts/ai-observability-gaps/#what-is-decision-provenance-and-why-does-compliance-require-it&quot;&gt;&lt;strong&gt;Decision provenance&lt;/strong&gt;&lt;/a&gt;, the &lt;strong&gt;AI observability&lt;/strong&gt; requirement that every agent action links to its inputs, reasoning, and authorization chain, goes beyond logging what an agent did. You need to trace &lt;em&gt;why&lt;/em&gt; it made a choice, what context it consumed, and which prior decisions influenced the outcome. Without this, debugging an autonomous system is archaeology, not engineering. Under OSFI B-13 and DORA, an agent action without decision provenance is not just a debugging gap; it is a compliance liability.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Separate error budgets for AI-generated changes&lt;/strong&gt; keep machine-authored deployments from hiding behind human baselines. If an AI agent burns through its error budget, its write permissions get revoked automatically, not the entire team’s. Our results showed 0.769 precision even on the best-performing tier, meaning roughly 1 in 4 predicted files was wrong. That error rate needs its own budget.&lt;/p&gt;
&lt;figure&gt;&lt;figcaption&gt;&lt;strong&gt;Code Snippet 1:&lt;/strong&gt; Prometheus recording rules and burn-rate alert for AI-authored deployments. Separate SLIs per author type; &lt;a href=&quot;https://sre.google/workbook/alerting-on-slos/&quot;&gt;14.4x burn-rate threshold&lt;/a&gt; (Google, 2018).&lt;/figcaption&gt;&lt;pre class=&quot;astro-code astro-code-themes catppuccin-latte catppuccin-macchiato mt-8&quot; style=&quot;--shiki-light:#4c4f69; --shiki-dark:#cad3f5; --shiki-light-bg:#eff1f5; --shiki-dark-bg:#24273a; --file-name-offset: -0.75rem&quot; tabindex=&quot;0&quot; data-language=&quot;yaml&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;groups&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;  -&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt; name&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; sli.deploys&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;    rules&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;      -&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt; record&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; sli:deploy_success:ratio1h&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;        expr&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-dark:#C6A0F6&quot;&gt; |&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line highlighted&quot;&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;          sum(rate(deploy_success_total{author_type=&quot;ai&quot;}[1h]))&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line highlighted&quot;&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;          / sum(rate(deploys_total{author_type=&quot;ai&quot;}[1h]))&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;        labels&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;          author_type&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; ai&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line highlighted&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;          slo_target&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; &quot;0.995&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-light-font-style:italic;--shiki-dark:#939AB7;--shiki-dark-font-style:italic&quot;&gt; # Stricter than human baseline of 0.990&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;      -&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt; record&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; sli:deploy_success:ratio1h&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;        expr&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-dark:#C6A0F6&quot;&gt; |&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;          sum(rate(deploy_success_total{author_type=&quot;human&quot;}[1h]))&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;          / sum(rate(deploys_total{author_type=&quot;human&quot;}[1h]))&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;        labels&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;          author_type&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; human&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;          slo_target&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; &quot;0.990&quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;      -&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt; alert&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; AIChangeErrorBudgetBurnRate&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;        expr&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-dark:#C6A0F6&quot;&gt; |&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line highlighted&quot;&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;          (1 - sli:deploy_success:ratio1h{author_type=&quot;ai&quot;})&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line highlighted&quot;&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;          / (1 - 0.995) &gt; 14.4&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;        for&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; 5m&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;        labels&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;          severity&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; critical&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;          team&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; sre&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;span class=&quot;absolute py-1 text-foreground text-xs font-medium leading-4 pl-4 pr-2 before:inline-block before:size-1 before:bg-green-500 before:rounded-full before:absolute before:top-[45%] before:left-2 left-2 top-(--file-name-offset) border rounded-md bg-background&quot;&gt;sli-and-burn-rate.yaml&lt;/span&gt;&lt;/pre&gt;&lt;/figure&gt;
&lt;p&gt;&lt;a href=&quot;https://arxiv.org/abs/2512.04123&quot;&gt;Production teams consistently trade agent capability for reliability&lt;/a&gt;, preferring narrower but predictable automation over broad but brittle autonomy (Pan et al., 2026). Separate error budgets formalize that trade-off.&lt;/p&gt;
&lt;h3 id=&quot;blast-radius-containment-and-the-trust-ladder&quot;&gt;Blast Radius Containment and the Trust Ladder&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;Blast radius containment&lt;/strong&gt; means progressive rollout gates. No agent ships to 100% on day one. The &lt;strong&gt;trust ladder&lt;/strong&gt; is a graduated set of &lt;strong&gt;AI guardrails&lt;/strong&gt; where each rung grants broader blast radius only after the agent demonstrates reliability at the current level:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Shadow mode (read-only, no writes)&lt;/li&gt;
&lt;li&gt;Supervised writes (human approval required)&lt;/li&gt;
&lt;li&gt;Unsupervised writes (scoped to low-risk paths)&lt;/li&gt;
&lt;li&gt;Full autonomy (reserved for proven, bounded tasks)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Our experiment is a proxy for what shadow mode catches. At the medium tier, where Jaccard dropped to 0.409, shadow mode would have flagged more than half the predicted change set as incorrect. The specific SLO threshold is yours to define; what matters is that it is explicit, measured, and tied to your error budget rather than a gut feeling.&lt;/p&gt;
&lt;figure&gt;&lt;figcaption&gt;&lt;strong&gt;Code Snippet 2:&lt;/strong&gt; Kubernetes RBAC ClusterRoles for each trust ladder tier. Promotion from readonly to scoped-write to production-write is a ServiceAccount rebinding; demotion reverses it.&lt;/figcaption&gt;&lt;pre class=&quot;astro-code astro-code-themes catppuccin-latte catppuccin-macchiato has-highlighted mt-8&quot; style=&quot;--shiki-light:#4c4f69; --shiki-dark:#cad3f5; --shiki-light-bg:#eff1f5; --shiki-dark-bg:#24273a; --file-name-offset: -0.75rem&quot; tabindex=&quot;0&quot; data-language=&quot;yaml&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;apiVersion&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; rbac.authorization.k8s.io/v1&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;kind&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; ClusterRole&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;metadata&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;  name&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; ai-agent-readonly&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;rules&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;  -&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt; apiGroups&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt; [&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;&quot;&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;    resources&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt; [&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;pods&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; services&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; configmaps&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line highlighted&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;    verbs&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt; [&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;get&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; list&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; watch&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;  -&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt; apiGroups&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt; [&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;apps&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;    resources&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt; [&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;deployments&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; replicasets&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line highlighted&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;    verbs&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt; [&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;get&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; list&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; watch&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#EA76CB;--shiki-dark:#F5BDE6&quot;&gt;---&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;apiVersion&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; rbac.authorization.k8s.io/v1&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;kind&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; ClusterRole&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;metadata&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;  name&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; ai-agent-scoped-write&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;rules&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;  -&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt; apiGroups&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt; [&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;&quot;&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;    resources&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt; [&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;pods&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; services&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; configmaps&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;    verbs&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt; [&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;get&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; list&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; watch&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;  -&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt; apiGroups&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt; [&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;apps&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;    resources&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt; [&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;deployments&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line highlighted&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;    verbs&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt; [&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;get&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; list&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; watch&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; update&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; patch&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line highlighted&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;    resourceNames&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt; [&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;canary-payments&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#EA76CB;--shiki-dark:#F5BDE6&quot;&gt;---&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;apiVersion&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; rbac.authorization.k8s.io/v1&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;kind&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; ClusterRole&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;metadata&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;  name&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; ai-agent-production-write&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;rules&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;  -&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt; apiGroups&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt; [&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;&quot;&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;    resources&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt; [&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;pods&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; services&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; configmaps&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line highlighted&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;    verbs&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt; [&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;get&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; list&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; watch&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; create&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; update&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; patch&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; delete&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;  -&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt; apiGroups&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt; [&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;apps&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;    resources&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt; [&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;deployments&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; replicasets&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line highlighted&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;    verbs&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt; [&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;get&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; list&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; watch&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; create&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; update&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; patch&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; delete&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;]&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;span class=&quot;absolute py-1 text-foreground text-xs font-medium leading-4 pl-4 pr-2 before:inline-block before:size-1 before:bg-green-500 before:rounded-full before:absolute before:top-[45%] before:left-2 left-2 top-(--file-name-offset) border rounded-md bg-background&quot;&gt;sre/trust-ladder-rbac.yaml&lt;/span&gt;&lt;/pre&gt;&lt;/figure&gt;
&lt;p&gt;&lt;a href=&quot;https://arxiv.org/abs/2602.16666&quot;&gt;Accuracy alone cannot distinguish&lt;/a&gt; an agent that fails on a fixed subset of tasks from one that fails unpredictably at the same rate (Rabanser et al., 2026). Our 90 runs confirmed consistency (27 of 30 PRs showed zero variance across runs, 3 showed near-zero) but exposed robustness and safety gaps on complex refactoring tasks. Consistent failures are exactly what shadow mode is designed to catch: the model’s errors are systematic, not random, and a human reviewer can filter them. Early evidence supports this approach: &lt;a href=&quot;https://arxiv.org/abs/2506.02009&quot;&gt;STRATUS&lt;/a&gt;, a multi-agent SRE system operating under similar progressive constraints, achieved a 1.5x improvement over baselines in automated failure mitigation (Chen et al., 2025).&lt;/p&gt;
&lt;h2 id=&quot;why-does-platform-maturity-gate-ai-readiness&quot;&gt;Why Does Platform Maturity Gate AI Readiness?&lt;/h2&gt;
&lt;p&gt;&lt;a href=&quot;https://dora.dev/research/2025/dora-report/&quot;&gt;The 2025 DORA report is explicit&lt;/a&gt;: AI’s impact depends on the quality of the underlying organizational system. Bolt AI onto a fragile platform and you get faster fragility. An AI agent that auto-scales a misconfigured service does not fix the misconfiguration; it scales the blast radius. The &lt;a href=&quot;https://arxiv.org/abs/2501.06706&quot;&gt;AIOpsLab framework&lt;/a&gt; shows agent performance varies significantly with the quality of instrumented infrastructure underneath (Chen et al., 2025).&lt;/p&gt;
&lt;p&gt;The maturity sequence matters. Build the &lt;strong&gt;IDP&lt;/strong&gt; (internal developer platform) first, layer SRE practices including &lt;strong&gt;LLMOps&lt;/strong&gt; telemetry for token consumption, latency, and decision traces on top, then introduce agentic AI. Skip a step and the agents inherit your tech debt at machine speed.&lt;/p&gt;
&lt;h3 id=&quot;the-learning-time-deficit&quot;&gt;The Learning Time Deficit&lt;/h3&gt;
&lt;p&gt;&lt;a href=&quot;https://www.catchpoint.com/learn/sre-report-2026&quot;&gt;Only 6% of SREs&lt;/a&gt; have dedicated, protected learning time (Catchpoint, 2026). You cannot build an SRE practice when the people staffing it have no time to learn the discipline. Concretely, 10% protected time means one half-day per week where an SRE studies agent failure modes, reviews postmortems from other teams, or shadow-tests a new observability tool without on-call interruptions. The organizations with the lowest toil trends treat learning hours like error budgets: protected, measured, and non-negotiable.&lt;/p&gt;









































&lt;table tabindex=&quot;0&quot;&gt;&lt;caption&gt;&lt;strong&gt;Table 3:&lt;/strong&gt; Platform + SRE maturity levels and what each unlocks.&lt;/caption&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Maturity Level&lt;/th&gt;&lt;th&gt;Platform State&lt;/th&gt;&lt;th&gt;SRE State&lt;/th&gt;&lt;th&gt;AI Readiness&lt;/th&gt;&lt;/tr&gt;&lt;/thead&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;Foundation&lt;/td&gt;&lt;td&gt;Manual provisioning&lt;/td&gt;&lt;td&gt;Reactive ops, no SLOs&lt;/td&gt;&lt;td&gt;Not ready&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Standardized&lt;/td&gt;&lt;td&gt;Self-service IDP&lt;/td&gt;&lt;td&gt;SLOs defined, error budgets&lt;/td&gt;&lt;td&gt;Read-only agents&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Measured&lt;/td&gt;&lt;td&gt;Golden paths adopted&lt;/td&gt;&lt;td&gt;Toil tracked, burn-rate alerts&lt;/td&gt;&lt;td&gt;Shadow mode agents&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Optimized&lt;/td&gt;&lt;td&gt;Platform-as-product&lt;/td&gt;&lt;td&gt;Blameless culture, SLO-driven&lt;/td&gt;&lt;td&gt;Supervised write agents&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Autonomous&lt;/td&gt;&lt;td&gt;Full self-service&lt;/td&gt;&lt;td&gt;Proactive reliability&lt;/td&gt;&lt;td&gt;Agentic AI with guardrails&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;
&lt;p&gt;Read-only agents need SLOs because without a defined “good,” the agent cannot distinguish signal from noise. Supervised write agents need blameless culture because humans must feel safe overriding the machine.&lt;/p&gt;
&lt;h2 id=&quot;where-should-you-start&quot;&gt;Where Should You Start?&lt;/h2&gt;
&lt;p&gt;Enforce the prerequisites before enabling agentic AI on any service:&lt;/p&gt;
&lt;figure&gt;&lt;figcaption&gt;&lt;strong&gt;Code Snippet 3:&lt;/strong&gt; OPA policy gate enforcing the minimum bar before any service receives agentic AI write access. Shadow period and decision provenance are the two gates most commonly skipped in practice.&lt;/figcaption&gt;&lt;pre class=&quot;astro-code astro-code-themes catppuccin-latte catppuccin-macchiato has-highlighted mt-8&quot; style=&quot;--shiki-light:#4c4f69; --shiki-dark:#cad3f5; --shiki-light-bg:#eff1f5; --shiki-dark-bg:#24273a; --file-name-offset: -0.75rem&quot; tabindex=&quot;0&quot; data-language=&quot;python&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;package sre&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;ai&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;readiness&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-dark:#C6A0F6&quot;&gt;import&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt; rego&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;v1&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;default allow_agentic_ai &lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:=&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt; false&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;allow_agentic_ai &lt;/span&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-dark:#C6A0F6&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt; {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#FE640B;--shiki-light-font-style:italic;--shiki-dark:#F5A97F;--shiki-dark-font-style:italic&quot;&gt;    input&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;slo_defined&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#FE640B;--shiki-light-font-style:italic;--shiki-dark:#F5A97F;--shiki-dark-font-style:italic&quot;&gt;    input&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;error_budget_policy&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line highlighted&quot;&gt;&lt;span style=&quot;--shiki-light:#FE640B;--shiki-light-font-style:italic;--shiki-dark:#F5A97F;--shiki-dark-font-style:italic&quot;&gt;    input&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;shadow_period_days &lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;&gt;=&lt;/span&gt;&lt;span style=&quot;--shiki-light:#FE640B;--shiki-dark:#F5A97F&quot;&gt; 30&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line highlighted&quot;&gt;&lt;span style=&quot;--shiki-light:#FE640B;--shiki-light-font-style:italic;--shiki-dark:#F5A97F;--shiki-dark-font-style:italic&quot;&gt;    input&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;decision_provenance      &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#FE640B;--shiki-light-font-style:italic;--shiki-dark:#F5A97F;--shiki-dark-font-style:italic&quot;&gt;    input&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;rollback_automated&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#FE640B;--shiki-light-font-style:italic;--shiki-dark:#F5A97F;--shiki-dark-font-style:italic&quot;&gt;    input&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;toil_measured&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;span class=&quot;absolute py-1 text-foreground text-xs font-medium leading-4 pl-4 pr-2 before:inline-block before:size-1 before:bg-green-500 before:rounded-full before:absolute before:top-[45%] before:left-2 left-2 top-(--file-name-offset) border rounded-md bg-background&quot;&gt;sre-readiness-check.rego&lt;/span&gt;&lt;/pre&gt;&lt;/figure&gt;
&lt;h3 id=&quot;the-four-actions-in-order&quot;&gt;The Four Actions in Order&lt;/h3&gt;
&lt;p&gt;Four actions, in order:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Audit your toil budget.&lt;/strong&gt; Measure actual toil against perceived toil. If practitioners report higher friction while dashboards show fewer tickets, you have shifted toil rather than eliminated it.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Define SRE boundaries.&lt;/strong&gt; One team owns the IDP. Another owns the error budgets. Overlap is where accountability dies.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Split error budgets by author type.&lt;/strong&gt; Human-authored and AI-authored deployments have different failure profiles. Track them independently and revoke AI write access when the budget burns too fast.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Protect learning time.&lt;/strong&gt; Budget 10% of engineering hours for skill development or accept compounding operational risk.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Start with the toil audit, the only prerequisite you can measure without instrumentation already in place. Measure first. Then automate. Each rung you skip is a gap in your audit trail and a risk your board will eventually ask about.&lt;/p&gt;
&lt;hr&gt;
&lt;h2 id=&quot;references&quot;&gt;References&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Becker et al., “Evidence on the Impact of Generative AI on Software Development” (2025) — &lt;a href=&quot;https://arxiv.org/abs/2507.09089&quot;&gt;https://arxiv.org/abs/2507.09089&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Catchpoint, “SRE Report 2026” (2026) — &lt;a href=&quot;https://www.catchpoint.com/learn/sre-report-2026&quot;&gt;https://www.catchpoint.com/learn/sre-report-2026&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Chen et al., “AIOpsLab: A Holistic Framework to Evaluate AI Agents for Enabling Autonomous Clouds” (2025) — &lt;a href=&quot;https://arxiv.org/abs/2501.06706&quot;&gt;https://arxiv.org/abs/2501.06706&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Chen et al., “STRATUS: A Multi-agent System for Autonomous Reliability Engineering of Modern Clouds” (2025) — &lt;a href=&quot;https://arxiv.org/abs/2506.02009&quot;&gt;https://arxiv.org/abs/2506.02009&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Clouatre, H., “SRE Shadow-Mode File Prediction” (2026) — &lt;a href=&quot;https://doi.org/10.5281/zenodo.20645992&quot;&gt;https://doi.org/10.5281/zenodo.20645992&lt;/a&gt; — &lt;a href=&quot;https://github.com/clouatre-labs/sre-shadow-replay&quot;&gt;https://github.com/clouatre-labs/sre-shadow-replay&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;DevOps.com, “Survey: AI Tools are Increasing Amount of Bad Code Needing to be Fixed” (2025) — &lt;a href=&quot;https://devops.com/survey-ai-tools-are-increasing-amount-of-bad-code-needing-to-be-fixed-2/&quot;&gt;https://devops.com/survey-ai-tools-are-increasing-amount-of-bad-code-needing-to-be-fixed-2/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;DORA (Google Cloud’s DevOps Research and Assessment), “2025 State of AI-assisted Software Development” (2025) — &lt;a href=&quot;https://dora.dev/research/2025/dora-report/&quot;&gt;https://dora.dev/research/2025/dora-report/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;European Parliament and Council, “Digital Operational Resilience Act (DORA)” (2022) — &lt;a href=&quot;https://www.digital-operational-resilience-act.com/&quot;&gt;https://www.digital-operational-resilience-act.com/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Google, “Site Reliability Engineering” (2016) — &lt;a href=&quot;https://sre.google/sre-book/table-of-contents/&quot;&gt;https://sre.google/sre-book/table-of-contents/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Jimenez, C. E. et al., “SWE-bench: Can Language Models Resolve Real-World GitHub Issues?” (ICLR 2024) — &lt;a href=&quot;https://arxiv.org/abs/2310.06770&quot;&gt;https://arxiv.org/abs/2310.06770&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;OSFI, “Technology and Cyber Risk Management Guideline B-13” (2022) — &lt;a href=&quot;https://www.osfi-bsif.gc.ca/en/guidance/guidance-library/technology-cyber-risk-management&quot;&gt;https://www.osfi-bsif.gc.ca/en/guidance/guidance-library/technology-cyber-risk-management&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Pan et al., “Measuring Agents in Production” (2026) — &lt;a href=&quot;https://arxiv.org/abs/2512.04123&quot;&gt;https://arxiv.org/abs/2512.04123&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Rabanser et al., “Towards a Science of AI Agent Reliability” (2026) — &lt;a href=&quot;https://arxiv.org/abs/2602.16666&quot;&gt;https://arxiv.org/abs/2602.16666&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</content:encoded><category>agentic-ai</category><category>architecture</category><category>case-studies</category><category>evaluation</category><author>Hugues Clouâtre</author></item><item><title>What a Null Result Taught Us About AI Agent Evaluation</title><link>https://clouatre.ca/posts/prompt-repetition-agent-evaluation/</link><guid isPermaLink="true">https://clouatre.ca/posts/prompt-repetition-agent-evaluation/</guid><description>We tested prompt repetition on 20 parallel AI agents. Ceiling effects dominated both experiments. The null result is a finding about evaluation design.</description><pubDate>Wed, 17 Jun 2026 11:04:00 GMT</pubDate><content:encoded>&lt;p&gt;A Google Research paper demonstrates that repeating the entire user prompt verbatim can lift accuracy by up to 76 percentage points at zero output cost. No chain-of-thought overhead. No reasoning budget. Just send the same instruction twice.&lt;/p&gt;
&lt;p&gt;We ran 20 parallel agents across two experiments: 10 per experiment, 5 control vs. 5 treatment, blind-scored against a pre-registered rubric.&lt;/p&gt;
&lt;p&gt;We found nothing. The nothing is the finding.&lt;/p&gt;
&lt;h2 id=&quot;table-of-contents&quot;&gt;Table of contents&lt;/h2&gt;
&lt;p&gt;&lt;/p&gt;&lt;details&gt;&lt;summary&gt;Contents&lt;/summary&gt;&lt;p&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;#what-did-the-paper-claim&quot;&gt;What Did the Paper Claim?&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;#why-our-agent-seemed-like-a-good-candidate&quot;&gt;Why Our Agent Seemed Like a Good Candidate&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#why-this-matters-for-engineering-teams&quot;&gt;Why This Matters for Engineering Teams&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#how-did-we-design-the-test&quot;&gt;How Did We Design the Test?&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#what-happened-in-the-fastmcp-refactor-test&quot;&gt;What Happened in the FastMCP Refactor Test?&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#did-a-stricter-methodology-change-the-result&quot;&gt;Did a Stricter Methodology Change the Result?&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#what-infrastructure-confound-did-we-miss&quot;&gt;What Infrastructure Confound Did We Miss?&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#why-did-both-experiments-hit-100&quot;&gt;Why Did Both Experiments Hit 100%?&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;#where-the-boundary-falls&quot;&gt;Where the Boundary Falls&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#what-did-we-learn-about-ai-evaluation-design&quot;&gt;What Did We Learn About AI Evaluation Design?&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;#rubric-design-is-harder-than-experiment-design&quot;&gt;Rubric Design Is Harder Than Experiment Design&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#infrastructure-behavior-is-a-confounder&quot;&gt;Infrastructure Behavior Is a Confounder&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#delegate-authoring-has-a-turn-length-problem&quot;&gt;Delegate Authoring Has a Turn-Length Problem&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#when-should-you-use-prompt-repetition&quot;&gt;When Should You Use Prompt Repetition?&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;#what-transfers-to-your-team&quot;&gt;What Transfers to Your Team&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#did-prompt-repetition-change-anything-else&quot;&gt;Did Prompt Repetition Change Anything Else?&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#references&quot;&gt;References&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;/p&gt;&lt;/details&gt;&lt;p&gt;&lt;/p&gt;
&lt;h2 id=&quot;what-did-the-paper-claim&quot;&gt;What Did the Paper Claim?&lt;/h2&gt;
&lt;p&gt;A &lt;a href=&quot;https://arxiv.org/abs/2512.14982&quot;&gt;2025 paper by Leviathan et al.&lt;/a&gt; at Google Research proposes a simple technique: repeat the entire user prompt once, verbatim, before sending to the model.&lt;/p&gt;
&lt;p&gt;The mechanism is structural, not empirical. Decoder-only transformers use causal masking: each token attends only to tokens before it. In a single-pass prompt, early tokens never see later context. Repeating the prompt creates a second copy where every token attends to the full instruction during prefill. This reduces the positional attention decay documented as the &lt;a href=&quot;https://arxiv.org/abs/2307.03172&quot;&gt;“lost in the middle” phenomenon&lt;/a&gt; (Liu et al., 2023). This is a fundamental limitation of the decoder-only architecture, not a quirk of specific benchmarks. Among decoder-only models, a 675B-parameter Mixture-of-Experts frontier model and a &lt;a href=&quot;https://arxiv.org/abs/2512.20856&quot;&gt;3B-active-parameter small language model (SLM)&lt;/a&gt; (NVIDIA, 2025) share it equally. Bidirectional architectures, including diffusion language models such as &lt;a href=&quot;https://www.inceptionlabs.ai/blog/introducing-mercury-2&quot;&gt;Inception Mercury 2&lt;/a&gt;, attend to the full sequence in a single pass and do not exhibit this limitation.&lt;/p&gt;
&lt;figure&gt;&lt;figcaption&gt;&lt;strong&gt;Code Snippet 1:&lt;/strong&gt; Causal masking creates an asymmetry where early tokens cannot attend to later context. Repeating the prompt gives the second copy full visibility over the first.&lt;/figcaption&gt;&lt;pre class=&quot;astro-code astro-code-themes catppuccin-latte catppuccin-macchiato has-highlighted mt-8&quot; style=&quot;--shiki-light:#4c4f69; --shiki-dark:#cad3f5; --shiki-light-bg:#eff1f5; --shiki-dark-bg:#24273a; --file-name-offset: -0.75rem&quot; tabindex=&quot;0&quot; data-language=&quot;text&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span&gt;Standard prompt (single pass):&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;  Token 1  sees: [Token 1]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;  Token 5  sees: [Token 1, 2, 3, 4, 5]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;  Token 50 sees: [Token 1, 2, ..., 50]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;  --&gt; Early tokens are blind to later context&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;Repeated prompt (two copies):&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;  Token 51 sees: [Token 1, 2, ..., 50, 51]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;  Token 55 sees: [Token 1, 2, ..., 50, 51, 52, 53, 54, 55]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line highlighted&quot;&gt;&lt;span&gt;  --&gt; Every token in the second copy attends to the full first copy&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span&gt;  --&gt; Full context available during prefill, zero generation cost&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;span class=&quot;absolute py-1 text-foreground text-xs font-medium leading-4 pl-4 pr-2 before:inline-block before:size-1 before:bg-green-500 before:rounded-full before:absolute before:top-[45%] before:left-2 left-2 top-(--file-name-offset) border rounded-md bg-background&quot;&gt;causal-masking.txt&lt;/span&gt;&lt;/pre&gt;&lt;/figure&gt;
&lt;p&gt;The reported gains:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Gemini 2.0 Flash-Lite on NameIndex: &lt;strong&gt;21.33% to 97.33%&lt;/strong&gt; accuracy&lt;/li&gt;
&lt;li&gt;GSM8K and MMLU-Pro gains across Gemini 2.0 Flash, GPT-4o, Claude 3.7 Sonnet, DeepSeek V3, and others&lt;/li&gt;
&lt;li&gt;Input tokens double; output tokens unchanged in fixed-format benchmarks (no latency increase, unlike chain-of-thought)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The paper positions this as a Pareto improvement over reasoning-heavy approaches: same output budget, better accuracy.&lt;/p&gt;
&lt;h3 id=&quot;why-our-agent-seemed-like-a-good-candidate&quot;&gt;Why Our Agent Seemed Like a Good Candidate&lt;/h3&gt;
&lt;p&gt;Our Scout delegate, the research agent in our &lt;a href=&quot;/posts/orchestrating-ai-agents-subagent-architecture/&quot;&gt;subagent architecture&lt;/a&gt; (&lt;a href=&quot;https://github.com/clouatre-labs/prompt-repetition-experiments/tree/main/recipe&quot;&gt;full recipe&lt;/a&gt;), runs on &lt;code&gt;claude-haiku-4-5&lt;/code&gt; at temperature 0.5 with extended thinking off. Haiku 4.5 is structurally a non-reasoning model (extended thinking is opt-in, not default), making it precisely the class of LLM the paper’s title targets.&lt;/p&gt;
&lt;p&gt;The paper tested Claude 3 Haiku alongside six other models; its strongest gains came from Gemini 2.0 Flash-Lite and GPT-4o-mini. We tested Claude 4.5 Haiku, a different model generation. Anthropic does not publish architectural details for either model. Whether the technique transfers across generations is an open question this experiment cannot answer, because our ceiling effects prevented any treatment from showing lift.&lt;/p&gt;
&lt;h3 id=&quot;why-this-matters-for-engineering-teams&quot;&gt;Why This Matters for Engineering Teams&lt;/h3&gt;
&lt;p&gt;Teams adopt AI techniques from papers without field-testing them first. &lt;a href=&quot;https://www.bcg.com/publications/2025/ai-adoption-puzzle-why-usage-up-impact-not&quot;&gt;BCG reports that 50% of companies are stagnating with AI&lt;/a&gt; (BCG, 2025), partly because they ship optimizations without measuring baselines. Shipping an unvalidated prompt change to production would cost more: doubled input tokens on every request, with no accuracy gain to show for it. As we covered in &lt;a href=&quot;/posts/ai-observability-gaps/&quot;&gt;observability for AI agents&lt;/a&gt;, optimizing without measuring before and after is flying blind.&lt;/p&gt;
&lt;h2 id=&quot;how-did-we-design-the-test&quot;&gt;How Did We Design the Test?&lt;/h2&gt;
&lt;p&gt;Both experiments shared the same core structure: 10 parallel async Scout delegates, split 5 control vs. 5 treatment, scored blind against a pre-registered rubric. For detailed methodology and raw data, see &lt;a href=&quot;https://doi.org/10.5281/zenodo.19696593&quot;&gt;Supplementary Materials&lt;/a&gt;.&lt;/p&gt;
&lt;figure&gt;&lt;figcaption&gt;&lt;strong&gt;Code Snippet 2:&lt;/strong&gt; Shared delegate configuration. All 10 runs use the same model, temperature, and extensions.&lt;/figcaption&gt;&lt;pre class=&quot;astro-code astro-code-themes catppuccin-latte catppuccin-macchiato has-highlighted mt-8&quot; style=&quot;--shiki-light:#4c4f69; --shiki-dark:#cad3f5; --shiki-light-bg:#eff1f5; --shiki-dark-bg:#24273a; --file-name-offset: -0.75rem&quot; tabindex=&quot;0&quot; data-language=&quot;yaml&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-light-font-style:italic;--shiki-dark:#939AB7;--shiki-dark-font-style:italic&quot;&gt;# Shared config across all 10 delegates&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line highlighted&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;model&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; claude-haiku-4-5&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;temperature&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#FE640B;--shiki-dark:#F5A97F&quot;&gt; 0.5&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;extensions&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;  -&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; developer&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;  -&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; context7&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;  -&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; brave_search&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;output&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; &quot;scout-run-{{ id }}.json&quot;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;span class=&quot;absolute py-1 text-foreground text-xs font-medium leading-4 pl-4 pr-2 before:inline-block before:size-1 before:bg-green-500 before:rounded-full before:absolute before:top-[45%] before:left-2 left-2 top-(--file-name-offset) border rounded-md bg-background&quot;&gt;delegate-config.yaml&lt;/span&gt;&lt;/pre&gt;&lt;/figure&gt;
&lt;p&gt;&lt;strong&gt;Control group:&lt;/strong&gt; standard Scout instructions (~3,805 characters, instructions x1).&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Treatment group:&lt;/strong&gt; instructions repeated verbatim (~7,633 characters, instructions x2), mimicking the paper’s &lt;code&gt;&amp;#x3C;QUERY&gt;&amp;#x3C;QUERY&gt;&lt;/code&gt; pattern applied to the agent’s system prompt.&lt;/p&gt;
&lt;p&gt;The orchestrator spawned all 10 delegates simultaneously via Goose’s background task system and handed off structured JSON. A separate blind-scoring delegate received only the output files (no group labels) and scored each against the rubric. Group assignments were sealed in a &lt;a href=&quot;https://github.com/clouatre-labs/prompt-repetition-experiments/blob/main/experiments/exp1-fastmcp-refactor/label-map.json&quot;&gt;label map&lt;/a&gt; before scoring began.&lt;/p&gt;
&lt;figure&gt;&lt;img alt=&quot;Experiment pipeline: orchestrator spawns control and treatment delegate groups, both feed into a blind scorer, producing results&quot; loading=&quot;eager&quot; decoding=&quot;sync&quot; fetchpriority=&quot;high&quot; sizes=&quot;(min-width: 399px) 399px, 100vw&quot; data-astro-image=&quot;constrained&quot; data-astro-image-pos=&quot;center&quot; width=&quot;399&quot; height=&quot;406&quot; src=&quot;/_astro/experiment-flow.DqpR_TtQ_1Synk7.svg&quot; srcset=&quot;/_astro/experiment-flow.DqpR_TtQ_1Synk7.svg 399w&quot;&gt;&lt;figcaption&gt;&lt;strong&gt;Figure 1:&lt;/strong&gt; Blind evaluation pipeline. Group labels are stripped before scoring to prevent bias.&lt;/figcaption&gt;&lt;/figure&gt;
&lt;h2 id=&quot;what-happened-in-the-fastmcp-refactor-test&quot;&gt;What Happened in the FastMCP Refactor Test?&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;Target:&lt;/strong&gt; &lt;a href=&quot;https://github.com/clouatre-labs/math-mcp-learning-server/issues/222&quot;&gt;FastMCP session ID refactor&lt;/a&gt; in &lt;code&gt;math-mcp-learning-server&lt;/code&gt;. Open and unimplemented at the time of the experiment.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Rubric:&lt;/strong&gt; 6 binary criteria, pre-registered before any runs were examined.&lt;/p&gt;
&lt;p&gt;9 of 10 delegates produced valid output. &lt;code&gt;control-1&lt;/code&gt; ran 93 messages and wrote no output file. Session log analysis confirmed the file-write instruction appeared only at the end of the delegate prompt, and the model drifted past it. This is a delegate authoring flaw with a known fix: bookend critical instructions at the start and end.&lt;/p&gt;
&lt;p&gt;Across the 9 valid runs, 5 of 6 criteria scored 100% in both groups. The only variance was C5 (must-not constraint violations): control 5.50/6, treatment 5.80/6, delta +0.30. The treatment scored marginally higher, but at n=4 vs n=5 with binary outcomes, Fisher’s exact test is degenerate (p = 1.0). Full per-criterion scores are in the &lt;a href=&quot;https://github.com/clouatre-labs/prompt-repetition-experiments/tree/main/experiments/exp1-fastmcp-refactor&quot;&gt;raw data&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;The task was too easy. The rubric could not discriminate. We needed a harder target.&lt;/p&gt;
&lt;h2 id=&quot;did-a-stricter-methodology-change-the-result&quot;&gt;Did a Stricter Methodology Change the Result?&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;Target:&lt;/strong&gt; &lt;a href=&quot;https://github.com/clouatre-labs/aptu/issues/737&quot;&gt;&lt;code&gt;aptu#737&lt;/code&gt;&lt;/a&gt;, a tree-sitter AST (Abstract Syntax Tree)-based security scanner evaluation. Harder task, requiring synthesis from source code rather than retrieval from issue text. Unimplemented when tested.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Rubric:&lt;/strong&gt; 7 binary criteria. C5, C6, and C7 required the delegate to read and reason about actual source code, not just summarize the issue. Pre-registered before any runs began.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Methodology improvements over Experiment 1:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Blinded file naming from the start (&lt;code&gt;scout-run-01.json&lt;/code&gt; through &lt;code&gt;scout-run-10.json&lt;/code&gt; with sealed &lt;code&gt;label-map.json&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;Mann-Whitney U test pre-specified (two-tailed, alpha = 0.05)&lt;/li&gt;
&lt;li&gt;Wall-clock latency recorded per delegate&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Results:&lt;/p&gt;

























&lt;table tabindex=&quot;0&quot;&gt;&lt;caption&gt;&lt;strong&gt;Table 1:&lt;/strong&gt; Experiment 2 results. Zero variance in either group. Mann-Whitney U = 12.5, p = 1.0 (degenerate: complete ties, test cannot be evaluated).&lt;/caption&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Group&lt;/th&gt;&lt;th&gt;Score&lt;/th&gt;&lt;th&gt;Wall-clock median&lt;/th&gt;&lt;/tr&gt;&lt;/thead&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;Control (x1)&lt;/td&gt;&lt;td&gt;7/7 all runs&lt;/td&gt;&lt;td&gt;6m 21s&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Treatment (x2)&lt;/td&gt;&lt;td&gt;7/7 all runs&lt;/td&gt;&lt;td&gt;7m 29s&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Delta&lt;/td&gt;&lt;td&gt;0&lt;/td&gt;&lt;td&gt;+17.8%&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;
&lt;p&gt;Every Scout, in every run, in both groups, scored 7/7. Even C5, C6, and C7, the synthesis criteria we specifically designed to require source code reasoning, hit 100% across the board.&lt;/p&gt;
&lt;p&gt;The 17.8% latency difference is in the expected direction (longer prompt, longer prefill), which is consistent with the paper’s Anthropic-specific latency caveat. At scale, that delta compounds: doubled tokens cost money, and the added prefill time costs throughput across every agent invocation. But n=5 cannot support any inference here, and the finding is further confounded by an infrastructure issue we discovered afterward.&lt;/p&gt;
&lt;p&gt;The scores told us nothing. The session logs told us something we did not expect.&lt;/p&gt;
&lt;h2 id=&quot;what-infrastructure-confound-did-we-miss&quot;&gt;What Infrastructure Confound Did We Miss?&lt;/h2&gt;
&lt;p&gt;Post-hoc session log analysis revealed a confound present in both experiments.&lt;/p&gt;
&lt;p&gt;Goose enforces a hard cap of &lt;strong&gt;5 concurrent background delegates&lt;/strong&gt;. When all 10 delegates were spawned simultaneously, runs 06-10 hit the cap and were queued into a second batch after runs 01-05 completed.&lt;/p&gt;
&lt;p&gt;The resulting batch structure was unbalanced:&lt;/p&gt;


























&lt;table tabindex=&quot;0&quot;&gt;&lt;caption&gt;&lt;strong&gt;Table 2:&lt;/strong&gt; The 5-delegate concurrency cap split 10 simultaneous spawns into two unbalanced batches. Exact run assignments are in the &lt;a href=&quot;https://github.com/clouatre-labs/prompt-repetition-experiments/tree/main/experiments/exp2-treesitter-synthesis&quot;&gt;raw data&lt;/a&gt;.&lt;/caption&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Batch&lt;/th&gt;&lt;th&gt;Runs&lt;/th&gt;&lt;th&gt;Control&lt;/th&gt;&lt;th&gt;Treatment&lt;/th&gt;&lt;th&gt;Condition&lt;/th&gt;&lt;/tr&gt;&lt;/thead&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;1 (runs 01-05)&lt;/td&gt;&lt;td&gt;5&lt;/td&gt;&lt;td&gt;C1, C2, C3&lt;/td&gt;&lt;td&gt;T1, T2&lt;/td&gt;&lt;td&gt;Resource contested&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;2 (runs 06-10)&lt;/td&gt;&lt;td&gt;5&lt;/td&gt;&lt;td&gt;C4, C5&lt;/td&gt;&lt;td&gt;T3, T4, T5&lt;/td&gt;&lt;td&gt;No contention&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;
&lt;p&gt;Treatment delegates landed disproportionately in the less-contested second batch, making any latency comparison between groups uninterpretable. Accuracy was unaffected (ceiling effects dominated regardless), but the exposure is worth naming: &lt;strong&gt;pre-registration does not protect against runtime infrastructure behavior you did not know existed.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;The confound matters for latency. But the bigger question is why accuracy showed zero variance in the first place.&lt;/p&gt;
&lt;h2 id=&quot;why-did-both-experiments-hit-100&quot;&gt;Why Did Both Experiments Hit 100%?&lt;/h2&gt;
&lt;p&gt;Two experiments, two rubrics designed to be harder than the last, two 100% results.&lt;/p&gt;
&lt;p&gt;This is itself a finding. A well-designed Scout delegate on a well-scoped engineering issue is already operating above the baseline accuracy threshold where prompt repetition shows lift. The paper’s largest gains came from synthetic positional tasks, &lt;a href=&quot;https://arxiv.org/abs/2512.14982&quot;&gt;NameIndex&lt;/a&gt; (Leviathan et al., 2025), where the answer is a name buried in a list. Real engineering issues, even unimplemented ones, give the agent structured context, code references, and acceptance criteria. The agent finds what it needs without help from the prefill geometry.&lt;/p&gt;
&lt;p&gt;This is the core finding: prompt repetition solves an attention problem that well-scoped engineering tasks do not have. The technique’s value is real, but the paper’s benchmarks do not cover agentic engineering tasks. Our experiments tested that boundary. When the agent already has structured context pointing it to the right code, repeating the instruction adds input tokens without adding accuracy signal. Understanding where SLMs succeed and fail on their own is not academic: hybrid architectures like &lt;a href=&quot;https://arxiv.org/abs/2504.09923&quot;&gt;SMART&lt;/a&gt; (Kim et al., 2025) use SLMs as the primary reasoning engine, with LLMs intervening only at critical junctures. Every prompt-level optimization that improves standalone SLM accuracy reduces how often the expensive backstop fires.&lt;/p&gt;
&lt;p&gt;For teams evaluating prompt techniques at scale, the implication is financial: doubling input tokens across every agent invocation is a measurable cost increase. If your agents already converge correctly on well-scoped tasks, that spend returns nothing. &lt;a href=&quot;https://arxiv.org/html/2406.03980v1&quot;&gt;Embracing negative results&lt;/a&gt; as a research practice (Berger et al., 2024) prevents exactly this kind of waste: publication bias toward positive results means the null findings that would have saved you the experiment often go unpublished. The full methodology and statistical analysis from both experiments are documented in the accompanying paper (&lt;a href=&quot;https://doi.org/10.5281/zenodo.20039271&quot;&gt;Clouatre, 2026&lt;/a&gt;).&lt;/p&gt;
&lt;h3 id=&quot;where-the-boundary-falls&quot;&gt;Where the Boundary Falls&lt;/h3&gt;
&lt;p&gt;The gap is between task types, not between models:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Positional retrieval tasks&lt;/strong&gt; (NameIndex, needle-in-haystack): high positional attention decay, repetition helps&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Structured engineering tasks&lt;/strong&gt; (scoped issues with code context): low positional decay, Scout already converges correctly&lt;/li&gt;
&lt;/ul&gt;









































&lt;table tabindex=&quot;0&quot;&gt;&lt;caption&gt;&lt;strong&gt;Table 3:&lt;/strong&gt; Comparison of experimental conditions. The paper’s gains concentrate on positional retrieval tasks; our structured engineering tasks hit ceiling effects before any treatment could show lift.&lt;/caption&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Dimension&lt;/th&gt;&lt;th&gt;Paper (Leviathan et al.)&lt;/th&gt;&lt;th&gt;Experiment 1&lt;/th&gt;&lt;th&gt;Experiment 2&lt;/th&gt;&lt;/tr&gt;&lt;/thead&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;Task type&lt;/td&gt;&lt;td&gt;Standard + custom retrieval (MMLU-Pro, NameIndex, others)&lt;/td&gt;&lt;td&gt;Issue analysis (FastMCP refactor)&lt;/td&gt;&lt;td&gt;Source code synthesis (AST scanner)&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Model&lt;/td&gt;&lt;td&gt;Gemini 2.0 Flash-Lite, Claude 3 Haiku, 5 others&lt;/td&gt;&lt;td&gt;Claude 4.5 Haiku&lt;/td&gt;&lt;td&gt;Claude 4.5 Haiku&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Sample size&lt;/td&gt;&lt;td&gt;McNemar test on full benchmark datasets (7 benchmarks, 7 models)&lt;/td&gt;&lt;td&gt;n=4 vs n=5 (1 dropped)&lt;/td&gt;&lt;td&gt;n=5 vs n=5&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Accuracy delta&lt;/td&gt;&lt;td&gt;47/70 pairs improved, 0 regressed; +76pp on NameIndex (Flash-Lite)&lt;/td&gt;&lt;td&gt;+0.30 (noise)&lt;/td&gt;&lt;td&gt;0.00 (ceiling)&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Confounds&lt;/td&gt;&lt;td&gt;None reported&lt;/td&gt;&lt;td&gt;Delegate authoring failure&lt;/td&gt;&lt;td&gt;5-delegate batch cap&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;
&lt;p&gt;Designing a rubric that discriminates between good and very good on the second category is harder than it looks. Both of ours failed. The criteria require synthesis and judgment under genuine ambiguity, not retrieval from a well-scoped document.&lt;/p&gt;
&lt;h2 id=&quot;what-did-we-learn-about-ai-evaluation-design&quot;&gt;What Did We Learn About AI Evaluation Design?&lt;/h2&gt;
&lt;h3 id=&quot;rubric-design-is-harder-than-experiment-design&quot;&gt;Rubric Design Is Harder Than Experiment Design&lt;/h3&gt;
&lt;p&gt;We iterated twice and hit the ceiling both times. A 7-point rubric with “source code synthesis” criteria is not automatically harder. It depends on whether the task actually creates ambiguity the agent must resolve. Ours did not.&lt;/p&gt;
&lt;p&gt;A practical calibration target: if your scoring delegate can answer any criterion by reading the issue alone (without running the code), the criterion will not discriminate.&lt;/p&gt;
&lt;h3 id=&quot;infrastructure-behavior-is-a-confounder&quot;&gt;Infrastructure Behavior Is a Confounder&lt;/h3&gt;
&lt;p&gt;The 5-delegate cap is undocumented. It is enforced as a hard rejection in source (&lt;code&gt;GOOSE_MAX_BACKGROUND_TASKS&lt;/code&gt; defaults to 5), with no queuing or retry. Excess delegates are dropped, not deferred. It silently split our groups into unbalanced batches. This category of confound (runtime resource limits, queue behavior, model routing) is endemic to agent systems and invisible without structured logging.&lt;/p&gt;
&lt;p&gt;Future experiments: spawn delegates in explicit batches of 5 with documented batch assignments. Record session IDs. Treat infrastructure state as a variable, not background noise.&lt;/p&gt;
&lt;h3 id=&quot;delegate-authoring-has-a-turn-length-problem&quot;&gt;Delegate Authoring Has a Turn-Length Problem&lt;/h3&gt;
&lt;p&gt;Long sessions drift from instructions that appear only once. The &lt;code&gt;control-1&lt;/code&gt; failure (93 messages, no output) demonstrated the fix: bookend critical actions at both the start and end of delegate prompts. This class of failure is predictable and preventable, but only if you treat delegate prompt structure as part of your experimental design.&lt;/p&gt;
&lt;p&gt;The blind scoring infrastructure proved its value here. Each run produced a structured justification the scorer generated without knowing group assignment:&lt;/p&gt;
&lt;figure&gt;&lt;figcaption&gt;&lt;strong&gt;Code Snippet 3:&lt;/strong&gt; Blind scorer output for a single run. Each criterion includes a justification generated without knowledge of group assignment.&lt;/figcaption&gt;&lt;pre class=&quot;astro-code astro-code-themes catppuccin-latte catppuccin-macchiato has-highlighted mt-8&quot; style=&quot;--shiki-light:#4c4f69; --shiki-dark:#cad3f5; --shiki-light-bg:#eff1f5; --shiki-dark-bg:#24273a; --file-name-offset: -0.75rem&quot; tabindex=&quot;0&quot; data-language=&quot;json&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;  &quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;run_id&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; &quot;run-01&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;  &quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;C1&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#FE640B;--shiki-dark:#F5A97F&quot;&gt; 1&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt; &quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;C2&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#FE640B;--shiki-dark:#F5A97F&quot;&gt; 1&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt; &quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;C3&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#FE640B;--shiki-dark:#F5A97F&quot;&gt; 1&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt; &quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;C4&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#FE640B;--shiki-dark:#F5A97F&quot;&gt; 1&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;  &quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;C5&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#FE640B;--shiki-dark:#F5A97F&quot;&gt; 1&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt; &quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;C6&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#FE640B;--shiki-dark:#F5A97F&quot;&gt; 1&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt; &quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;C7&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#FE640B;--shiki-dark:#F5A97F&quot;&gt; 1&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt; &quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;total&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#FE640B;--shiki-dark:#F5A97F&quot;&gt; 7&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;  &quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;justifications&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt; {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;    &quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;C1&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; &quot;Issues #735/#736 explicitly identified as regex limitation.&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;    &quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;C5&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; &quot;Backward compatibility addressed via hybrid approach.&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line highlighted&quot;&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;    &quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;C7&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; &quot;Synthesis connects tree-sitter AST parsing to existing rules.&quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;  }&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;span class=&quot;absolute py-1 text-foreground text-xs font-medium leading-4 pl-4 pr-2 before:inline-block before:size-1 before:bg-green-500 before:rounded-full before:absolute before:top-[45%] before:left-2 left-2 top-(--file-name-offset) border rounded-md bg-background&quot;&gt;scorer-output.json&lt;/span&gt;&lt;/pre&gt;&lt;/figure&gt;
&lt;h2 id=&quot;when-should-you-use-prompt-repetition&quot;&gt;When Should You Use Prompt Repetition?&lt;/h2&gt;
&lt;p&gt;The null result is not a failure of the paper. Prompt repetition won 47 out of 70 benchmark-model combinations with zero losses (Leviathan et al., 2025). The technique works. The question is where.&lt;/p&gt;
&lt;p&gt;The paper’s gains concentrate on &lt;strong&gt;benchmarks with positional retrieval components&lt;/strong&gt;: NameIndex, MiddleMatch, options-first multiple choice. Tasks where the answer depends on information placement in the context window. The paper also notes a &lt;strong&gt;neutral-to-slight effect with reasoning prompts&lt;/strong&gt; (5 wins, 1 loss, 22 neutral with step-by-step). Reasoning appears to compensate for the same attention decay that repetition addresses.&lt;/p&gt;
&lt;p&gt;The industry trend is not exclusively toward reasoning models. Capable SLMs are gaining ground. NVIDIA’s Nemotron 3 Nano (NVIDIA, 2025) activates 3 billion of its 30 billion parameters per token, delivering 3.3x the throughput of Qwen3-30B on a single H200, designed explicitly for multi-agent systems at scale. &lt;a href=&quot;https://arxiv.org/abs/2510.01265&quot;&gt;RLP&lt;/a&gt; (Hatamizadeh et al., 2025) embeds reinforcement learning into pretraining itself, lifting math and science accuracy by 19% on a 1.7B-parameter model without post-training reasoning. These models are non-reasoning by default. The causal masking limitation that prompt repetition addresses is structural to the decoder-only architecture all of them share. Their users are also the most cost-sensitive to doubled input tokens. Every token matters when you are optimizing for throughput at the edge.&lt;/p&gt;
&lt;p&gt;Our null result came from the other side of that boundary: structured engineering tasks where the agent already has scoped context, code references, and acceptance criteria. The ceiling was in the task, not the technique.&lt;/p&gt;
&lt;figure&gt;&lt;img alt=&quot;Decision flowchart: evaluate task type, check baseline headroom, run controlled experiment, adopt or skip&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; sizes=&quot;(min-width: 458px) 458px, 100vw&quot; data-astro-image=&quot;constrained&quot; data-astro-image-pos=&quot;center&quot; width=&quot;458&quot; height=&quot;1095&quot; src=&quot;/_astro/prompt-repetition-decision.BEX6XDXE_ZFSomx.svg&quot; srcset=&quot;/_astro/prompt-repetition-decision.BEX6XDXE_ZFSomx.svg 458w&quot;&gt;&lt;figcaption&gt;&lt;strong&gt;Figure 2:&lt;/strong&gt; When to use prompt repetition. Three decision points, two outcomes.&lt;/figcaption&gt;&lt;/figure&gt;
&lt;h3 id=&quot;what-transfers-to-your-team&quot;&gt;What Transfers to Your Team&lt;/h3&gt;
&lt;p&gt;Three things that transfer directly to any team evaluating AI agent behavior:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Baseline accuracy determines whether any prompt technique has room to work.&lt;/strong&gt; Measure it before testing an optimization.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Infrastructure constraints are confounder candidates.&lt;/strong&gt; Audit your delegate system’s limits before attributing latency or throughput differences to treatment variables.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Rubric discrimination is the bottleneck.&lt;/strong&gt; Two rubrics, two ceiling effects. If your scoring criteria can be satisfied by reading the issue description alone, the rubric will not discriminate.&lt;/li&gt;
&lt;/ol&gt;
&lt;h2 id=&quot;did-prompt-repetition-change-anything-else&quot;&gt;Did Prompt Repetition Change Anything Else?&lt;/h2&gt;
&lt;p&gt;One observation worth noting: treatment agents in both experiments used fewer output tokens and messages to reach the same scores. This is consistent with what the attention mechanism would predict; a richer prefill context may reduce exploratory turns in an agentic loop, though the mechanism is not established. The original paper’s benchmarks (MMLU, GSM8K) produce fixed-format answers where output length does not vary, making this effect invisible. Agentic workloads, where the model decides how many turns to take, may be where the efficiency signal surfaces.&lt;/p&gt;
&lt;p&gt;The economics are also different than single-turn benchmarks suggest: in a multi-turn session, the doubled prompt adds single-digit overhead to accumulated input, not 100%. The growing conversation history dominates each API call. In our data, treatment agents used 13.1% fewer input tokens and 15.4% fewer output tokens despite the longer prompt. Each avoided turn eliminates an entire context window from the running total. The effect is confounded and too small to draw conclusions, but it is a pattern worth investigating with a discriminating rubric.&lt;/p&gt;
&lt;hr&gt;
&lt;p&gt;The evaluation methodology described in this post is the subject of Canadian patent application CA 3315358, filed Jun 17, 2026 (CIPO).&lt;/p&gt;
&lt;h2 id=&quot;references&quot;&gt;References&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;BCG, “AI Adoption Puzzle: Why Usage Is Up But Impact Is Not” (2025) — &lt;a href=&quot;https://www.bcg.com/publications/2025/ai-adoption-puzzle-why-usage-up-impact-not&quot;&gt;https://www.bcg.com/publications/2025/ai-adoption-puzzle-why-usage-up-impact-not&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Berger et al., “Position: Embracing Negative Results in Machine Learning” (2024) — &lt;a href=&quot;https://arxiv.org/abs/2406.03980&quot;&gt;https://arxiv.org/abs/2406.03980&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Clouatre, H., “Orchestrating AI Agents: A Subagent Architecture for Code” (2025) — &lt;a href=&quot;https://clouatre.ca/posts/orchestrating-ai-agents-subagent-architecture/&quot;&gt;https://clouatre.ca/posts/orchestrating-ai-agents-subagent-architecture/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Clouatre, H., “Ceiling Effects and Convergence: Null Results for Instruction Repetition in LLM-Agent Pipelines” (2026) — &lt;a href=&quot;https://doi.org/10.5281/zenodo.20039271&quot;&gt;https://doi.org/10.5281/zenodo.20039271&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Clouatre, H., “Prompt Repetition Experiments: Supplementary Materials and Dataset” (2026) — &lt;a href=&quot;https://doi.org/10.5281/zenodo.19696593&quot;&gt;https://doi.org/10.5281/zenodo.19696593&lt;/a&gt; — &lt;a href=&quot;https://github.com/clouatre-labs/prompt-repetition-experiments&quot;&gt;https://github.com/clouatre-labs/prompt-repetition-experiments&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Hatamizadeh, A. et al., “RLP: Reinforcement as a Pretraining Objective” (2025) — &lt;a href=&quot;https://arxiv.org/abs/2510.01265&quot;&gt;https://arxiv.org/abs/2510.01265&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Kim, Y. et al., “Guiding Reasoning in Small Language Models with LLM Assistance” (2025) — &lt;a href=&quot;https://arxiv.org/abs/2504.09923&quot;&gt;https://arxiv.org/abs/2504.09923&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Leviathan, Y., Kalman, M., and Matias, Y., “Prompt Repetition Improves Non-Reasoning LLMs” (2025) — &lt;a href=&quot;https://arxiv.org/abs/2512.14982&quot;&gt;https://arxiv.org/abs/2512.14982&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Liu et al., “Lost in the Middle: How Language Models Use Long Contexts” (2023) — &lt;a href=&quot;https://arxiv.org/abs/2307.03172&quot;&gt;https://arxiv.org/abs/2307.03172&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;NVIDIA, “Nemotron 3: Efficient and Open Intelligence” (2025) — &lt;a href=&quot;https://arxiv.org/abs/2512.20856&quot;&gt;https://arxiv.org/abs/2512.20856&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</content:encoded><category>agentic-ai</category><category>goose</category><category>case-studies</category><category>evaluation</category><author>Hugues Clouâtre</author></item><item><title>Why Your AI Agent Failed in Production</title><link>https://clouatre.ca/posts/ai-observability-gaps/</link><guid isPermaLink="true">https://clouatre.ca/posts/ai-observability-gaps/</guid><description>Why your AI agent failed: missing decision provenance, not metrics. The 3 observability gaps traditional monitoring won&apos;t catch.</description><pubDate>Tue, 16 Jun 2026 19:10:00 GMT</pubDate><content:encoded>&lt;p&gt;Your AI agent just approved a $50,000 invoice for office supplies. A legitimate vendor. The PO number matches. But the quantity is wrong by a factor of 10. By the time finance catches it, you’ve already paid, the goods already shipped, and you’re stuck negotiating a return.&lt;/p&gt;
&lt;p&gt;The agent’s logs show “decision: approved” but nothing about why it ignored the quantity anomaly that a human would have caught instantly. Without proper instrumentation, root cause analysis stretches from minutes to days. This is what happens when observability is treated as “nice to have” instead of foundational infrastructure.&lt;/p&gt;
&lt;p&gt;This post covers the production architecture, the vendor-neutral stack, and why you need to instrument before deployment, not after the first failure.&lt;/p&gt;
&lt;h2 id=&quot;table-of-contents&quot;&gt;Table of contents&lt;/h2&gt;
&lt;p&gt;&lt;/p&gt;&lt;details&gt;&lt;summary&gt;Contents&lt;/summary&gt;&lt;p&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;#why-should-observability-be-foundational-infrastructure&quot;&gt;Why Should Observability Be Foundational Infrastructure?&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;#the-observer-effect-paradox&quot;&gt;The Observer Effect Paradox&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#what-is-decision-provenance-and-why-does-compliance-require-it&quot;&gt;What Is Decision Provenance and Why Does Compliance Require It?&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;#why-every-framework-requires-decision-trails&quot;&gt;Why Every Framework Requires Decision Trails&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#structured-logging-with-correlation-ids&quot;&gt;Structured Logging with Correlation IDs&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#tracking-tool-calls-with-genai-semantic-conventions&quot;&gt;Tracking Tool Calls with GenAI Semantic Conventions&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#how-do-silent-integration-failures-kill-ai-agents&quot;&gt;How Do Silent Integration Failures Kill AI Agents?&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#why-do-token-costs-spiral-out-of-control&quot;&gt;Why Do Token Costs Spiral Out of Control?&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;#alerting-on-token-budgets&quot;&gt;Alerting on Token Budgets&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#what-does-a-vendor-neutral-observability-stack-look-like&quot;&gt;What Does a Vendor-Neutral Observability Stack Look Like?&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;#how-the-components-connect&quot;&gt;How the Components Connect&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#why-trace-metric-correlation-matters&quot;&gt;Why Trace-Metric Correlation Matters&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#what-is-the-roi-and-how-do-you-start&quot;&gt;What Is the ROI and How Do You Start?&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#are-you-ready-for-production&quot;&gt;Are You Ready for Production?&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#references&quot;&gt;References&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;/p&gt;&lt;/details&gt;&lt;p&gt;&lt;/p&gt;
&lt;h2 id=&quot;why-should-observability-be-foundational-infrastructure&quot;&gt;Why Should Observability Be Foundational Infrastructure?&lt;/h2&gt;
&lt;p&gt;When your agent fails in production, you need to answer three questions immediately: What decision did it make? What data did it use? How much did it cost? But monitoring only answers questions you already knew to ask. The failures that damage production most, a model quietly conserving tokens by skipping reasoning steps, an upstream API silently returning empty results, a prompt change that fixes one behavior while degrading another, never trigger an alert. They show up as patterns across thousands of traces, invisible to any dashboard you configured in advance.&lt;/p&gt;
&lt;h3 id=&quot;the-observer-effect-paradox&quot;&gt;The Observer Effect Paradox&lt;/h3&gt;
&lt;p&gt;Instrumentation changes what you measure. Synchronous logging to external systems adds latency to every LLM call. In multi-agent systems, this can trigger timeout-based retries where observability causes the failures it detects.&lt;/p&gt;
&lt;p&gt;OpenTelemetry’s &lt;a href=&quot;https://opentelemetry.io/docs/specs/otel/trace/sdk/#batching-processor&quot;&gt;BatchSpanProcessor&lt;/a&gt; solves this by queuing spans in memory and exporting in batches, minimizing per-request overhead.&lt;/p&gt;
&lt;h2 id=&quot;what-is-decision-provenance-and-why-does-compliance-require-it&quot;&gt;What Is Decision Provenance and Why Does Compliance Require It?&lt;/h2&gt;
&lt;p&gt;How do you prove your AI agent made the right decision six months ago when a regulator asks? Logging outputs without reasoning fails every major compliance framework.&lt;/p&gt;
&lt;h3 id=&quot;why-every-framework-requires-decision-trails&quot;&gt;Why Every Framework Requires Decision Trails&lt;/h3&gt;
&lt;p&gt;Every major compliance framework mandates reconstructible reasoning.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://www.aicpa-cima.com/resources/download/2017-trust-services-criteria-with-revised-points-of-focus-2022&quot;&gt;SOC 2 Type II&lt;/a&gt;: audit trails of system access and user activity. The &lt;code&gt;gen_ai.conversation.id&lt;/code&gt; attribute ties every decision to a user and timestamp.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://gdpr-info.eu/art-30-gdpr/&quot;&gt;GDPR Article 30&lt;/a&gt;: records of processing activities. Structured logs with trace IDs link inputs to outputs.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://www.kiteworks.com/hipaa-compliance/hipaa-audit-log-requirements/&quot;&gt;HIPAA&lt;/a&gt;: audit controls for ePHI access. Span attributes capture what data the agent accessed.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://docs-prv.pcisecuritystandards.org/PCI%20DSS/Standard/PCI-DSS-v4_0_1.pdf&quot;&gt;PCI DSS 4.0.1 Requirement 10&lt;/a&gt;: tracking cardholder data access with automated log reviews. Prometheus metrics enable real-time anomaly detection.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id=&quot;structured-logging-with-correlation-ids&quot;&gt;Structured Logging with Correlation IDs&lt;/h3&gt;
&lt;p&gt;The fix links every decision to its inputs.&lt;/p&gt;
&lt;figure&gt;&lt;figcaption&gt;&lt;strong&gt;Code Snippet 1:&lt;/strong&gt; OpenTelemetry structured logging captures decision provenance with trace IDs, span attributes, and correlation across the entire request lifecycle.&lt;/figcaption&gt;&lt;pre class=&quot;astro-code astro-code-themes catppuccin-latte catppuccin-macchiato has-highlighted mt-8&quot; style=&quot;--shiki-light:#4c4f69; --shiki-dark:#cad3f5; --shiki-light-bg:#eff1f5; --shiki-dark-bg:#24273a; --file-name-offset: -0.75rem&quot; tabindex=&quot;0&quot; data-language=&quot;python&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-dark:#C6A0F6&quot;&gt;from&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt; opentelemetry &lt;/span&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-dark:#C6A0F6&quot;&gt;import&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt; trace&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-dark:#C6A0F6&quot;&gt;from&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt; opentelemetry&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;trace &lt;/span&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-dark:#C6A0F6&quot;&gt;import&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt; Status&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt; StatusCode&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-dark:#C6A0F6&quot;&gt;import&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt; logging&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;tracer &lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt; trace&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;get_tracer&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;__name__&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;logger &lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt; logging&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;getLogger&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;__name__&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-dark:#C6A0F6&quot;&gt;def&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-light-font-style:italic;--shiki-dark:#8AADF4;--shiki-dark-font-style:italic&quot;&gt; make_decision&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--shiki-light:#E64553;--shiki-light-font-style:italic;--shiki-dark:#EE99A0;--shiki-dark-font-style:italic&quot;&gt;invoice_data&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;--shiki-light:#E64553;--shiki-light-font-style:italic;--shiki-dark:#EE99A0;--shiki-dark-font-style:italic&quot;&gt; retrieved_context&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;):&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-dark:#C6A0F6&quot;&gt;    with&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt; tracer&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;start_as_current_span&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;&quot;make_decision&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-dark:#C6A0F6&quot;&gt; as&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt; span&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;        span&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;set_attribute&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;&quot;invoice.id&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;--shiki-light:#E64553;--shiki-light-font-style:italic;--shiki-dark:#EE99A0;--shiki-dark-font-style:italic&quot;&gt; invoice_data&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-light-font-style:italic;--shiki-dark:#A6DA95;--shiki-dark-font-style:italic&quot;&gt;id&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;])&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;        span&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;set_attribute&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;&quot;invoice.amount&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;--shiki-light:#E64553;--shiki-light-font-style:italic;--shiki-dark:#EE99A0;--shiki-dark-font-style:italic&quot;&gt; invoice_data&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-light-font-style:italic;--shiki-dark:#A6DA95;--shiki-dark-font-style:italic&quot;&gt;amount&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;])&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;        span&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;set_attribute&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;&quot;context.sources&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;--shiki-light:#FE640B;--shiki-light-font-style:italic;--shiki-dark:#F5A97F;--shiki-dark-font-style:italic&quot;&gt; len&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;retrieved_context&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;))&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;        &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line highlighted&quot;&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;        decision &lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt; analyze&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;invoice_data&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt; retrieved_context&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line highlighted&quot;&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;        confidence &lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt; calculate_confidence&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;decision&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;        &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line highlighted&quot;&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;        span&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;set_attribute&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;&quot;decision.result&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;--shiki-light:#E64553;--shiki-light-font-style:italic;--shiki-dark:#EE99A0;--shiki-dark-font-style:italic&quot;&gt; decision&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-light-font-style:italic;--shiki-dark:#A6DA95;--shiki-dark-font-style:italic&quot;&gt;action&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;])&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line highlighted&quot;&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;        span&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;set_attribute&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;&quot;decision.confidence&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt; confidence&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;        &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;        logger&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;info&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;(&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;            &quot;Decision made&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#E64553;--shiki-light-font-style:italic;--shiki-dark:#EE99A0;--shiki-dark-font-style:italic&quot;&gt;            extra&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;                &quot;trace_id&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#FE640B;--shiki-light-font-style:italic;--shiki-dark:#F5A97F;--shiki-dark-font-style:italic&quot;&gt; format&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;span&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;get_span_context&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;().&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;trace_id&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; &quot;032x&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;),&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;                &quot;invoice_id&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#E64553;--shiki-light-font-style:italic;--shiki-dark:#EE99A0;--shiki-dark-font-style:italic&quot;&gt; invoice_data&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-light-font-style:italic;--shiki-dark:#A6DA95;--shiki-dark-font-style:italic&quot;&gt;id&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;],&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;                &quot;decision&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#E64553;--shiki-light-font-style:italic;--shiki-dark:#EE99A0;--shiki-dark-font-style:italic&quot;&gt; decision&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-light-font-style:italic;--shiki-dark:#A6DA95;--shiki-dark-font-style:italic&quot;&gt;action&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;],&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;                &quot;confidence&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt; confidence&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;                &quot;context_count&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#FE640B;--shiki-light-font-style:italic;--shiki-dark:#F5A97F;--shiki-dark-font-style:italic&quot;&gt; len&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;retrieved_context&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;            }&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;        )&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;        &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-dark:#C6A0F6&quot;&gt;        return&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt; decision&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;span class=&quot;absolute py-1 text-foreground text-xs font-medium leading-4 pl-4 pr-2 before:inline-block before:size-1 before:bg-green-500 before:rounded-full before:absolute before:top-[45%] before:left-2 left-2 top-(--file-name-offset) border rounded-md bg-background&quot;&gt;agent/decision_logger.py&lt;/span&gt;&lt;/pre&gt;&lt;/figure&gt;
&lt;p&gt;This gives you a complete audit trail: trace ID links the decision to all upstream data retrievals, span attributes capture the decision logic, and structured logs provide queryable records. When the regulator asks “why did you approve invoice #12345?”, you can show exactly what data the agent saw and how it weighted each factor.&lt;/p&gt;
&lt;h3 id=&quot;tracking-tool-calls-with-genai-semantic-conventions&quot;&gt;Tracking Tool Calls with GenAI Semantic Conventions&lt;/h3&gt;
&lt;p&gt;Multi-agent systems make dozens of tool calls per decision. OpenTelemetry’s &lt;a href=&quot;https://opentelemetry.io/docs/specs/semconv/gen-ai/&quot;&gt;GenAI semantic conventions&lt;/a&gt; provide standard attributes for tracking these interactions:&lt;/p&gt;
&lt;figure&gt;&lt;figcaption&gt;&lt;strong&gt;Code Snippet 2:&lt;/strong&gt; GenAI semantic conventions enable cross-platform analysis across LangChain, LlamaIndex, and custom agents.&lt;/figcaption&gt;&lt;pre class=&quot;astro-code astro-code-themes catppuccin-latte catppuccin-macchiato has-highlighted mt-8&quot; style=&quot;--shiki-light:#4c4f69; --shiki-dark:#cad3f5; --shiki-light-bg:#eff1f5; --shiki-dark-bg:#24273a; --file-name-offset: -0.75rem&quot; tabindex=&quot;0&quot; data-language=&quot;python&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-dark:#C6A0F6&quot;&gt;from&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt; opentelemetry &lt;/span&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-dark:#C6A0F6&quot;&gt;import&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt; trace&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;tracer &lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt; trace&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;get_tracer&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;__name__&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-dark:#C6A0F6&quot;&gt;def&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-light-font-style:italic;--shiki-dark:#8AADF4;--shiki-dark-font-style:italic&quot;&gt; execute_tool_call&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--shiki-light:#E64553;--shiki-light-font-style:italic;--shiki-dark:#EE99A0;--shiki-dark-font-style:italic&quot;&gt;tool_name&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;--shiki-light:#E64553;--shiki-light-font-style:italic;--shiki-dark:#EE99A0;--shiki-dark-font-style:italic&quot;&gt; arguments&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;--shiki-light:#E64553;--shiki-light-font-style:italic;--shiki-dark:#EE99A0;--shiki-dark-font-style:italic&quot;&gt; conversation_id&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;):&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-dark:#C6A0F6&quot;&gt;    with&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt; tracer&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;start_as_current_span&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;&quot;execute_tool&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-dark:#C6A0F6&quot;&gt; as&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt; span&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-light-font-style:italic;--shiki-dark:#939AB7;--shiki-dark-font-style:italic&quot;&gt;        # Standard GenAI attributes&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line highlighted&quot;&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;        span&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;set_attribute&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;&quot;gen_ai.operation.name&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; &quot;execute_tool&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line highlighted&quot;&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;        span&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;set_attribute&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;&quot;gen_ai.tool.name&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt; tool_name&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line highlighted&quot;&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;        span&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;set_attribute&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;&quot;gen_ai.conversation.id&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt; conversation_id&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line highlighted&quot;&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;        span&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;set_attribute&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;&quot;gen_ai.tool.call.arguments&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-light-font-style:italic;--shiki-dark:#C6A0F6;--shiki-dark-font-style:italic&quot;&gt; str&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;arguments&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;))&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;        &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;        result &lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt; call_tool&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;tool_name&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt; arguments&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;        &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;        span&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;set_attribute&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;&quot;gen_ai.tool.call.result&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-light-font-style:italic;--shiki-dark:#C6A0F6;--shiki-dark-font-style:italic&quot;&gt; str&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;result&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;))&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;        &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-dark:#C6A0F6&quot;&gt;        return&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt; result&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;span class=&quot;absolute py-1 text-foreground text-xs font-medium leading-4 pl-4 pr-2 before:inline-block before:size-1 before:bg-green-500 before:rounded-full before:absolute before:top-[45%] before:left-2 left-2 top-(--file-name-offset) border rounded-md bg-background&quot;&gt;agent/tool_tracking.py&lt;/span&gt;&lt;/pre&gt;&lt;/figure&gt;
&lt;p&gt;Standard attributes like &lt;code&gt;gen_ai.tool.name&lt;/code&gt; let you answer operational questions across your entire stack: “Which tools fail most often?” or “Which conversations require the most tool calls?” When you swap frameworks, your dashboards still work.&lt;/p&gt;
&lt;h2 id=&quot;how-do-silent-integration-failures-kill-ai-agents&quot;&gt;How Do Silent Integration Failures Kill AI Agents?&lt;/h2&gt;
&lt;p&gt;Your AI agent calls a legacy API that returns HTTP 200 with an empty result set. The agent interprets “no data” as “no problem” and proceeds. But the API actually failed silently because the database connection pool was exhausted. By the time you notice, you’ve processed 500 transactions with incomplete data.&lt;/p&gt;
&lt;p&gt;AI agents don’t fail loudly. They fail gracefully, hiding problems until they cascade. You need distributed tracing that correlates agent decisions with integration health across every dependency.&lt;/p&gt;
&lt;figure&gt;&lt;figcaption&gt;&lt;strong&gt;Code Snippet 3:&lt;/strong&gt; Distributed tracing propagates correlation IDs and flags suspicious patterns like empty responses from healthy endpoints.&lt;/figcaption&gt;&lt;pre class=&quot;astro-code astro-code-themes catppuccin-latte catppuccin-macchiato has-highlighted mt-8&quot; style=&quot;--shiki-light:#4c4f69; --shiki-dark:#cad3f5; --shiki-light-bg:#eff1f5; --shiki-dark-bg:#24273a; --file-name-offset: -0.75rem&quot; tabindex=&quot;0&quot; data-language=&quot;python&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-dark:#C6A0F6&quot;&gt;from&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt; opentelemetry &lt;/span&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-dark:#C6A0F6&quot;&gt;import&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt; trace&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt; propagate&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-dark:#C6A0F6&quot;&gt;from&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt; opentelemetry&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;trace &lt;/span&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-dark:#C6A0F6&quot;&gt;import&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt; Status&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt; StatusCode&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;tracer &lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt; trace&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;get_tracer&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;__name__&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-dark:#C6A0F6&quot;&gt;def&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-light-font-style:italic;--shiki-dark:#8AADF4;--shiki-dark-font-style:italic&quot;&gt; retrieve_from_legacy_api&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--shiki-light:#E64553;--shiki-light-font-style:italic;--shiki-dark:#EE99A0;--shiki-dark-font-style:italic&quot;&gt;query&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;):&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-dark:#C6A0F6&quot;&gt;    with&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt; tracer&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;start_as_current_span&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;&quot;legacy_api_call&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-dark:#C6A0F6&quot;&gt; as&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt; span&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;        span&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;set_attribute&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;&quot;api.endpoint&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; &quot;/legacy/search&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;        span&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;set_attribute&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;&quot;query&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt; query&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;        &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;        headers &lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt; {}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line highlighted&quot;&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;        propagate&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;inject&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;headers&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-light-font-style:italic;--shiki-dark:#939AB7;--shiki-dark-font-style:italic&quot;&gt;  # Inject trace context &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;        &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;        response &lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt; requests&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;get&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;(&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;            &quot;https://legacy.example.com/search&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#E64553;--shiki-light-font-style:italic;--shiki-dark:#EE99A0;--shiki-dark-font-style:italic&quot;&gt;            params&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;{&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;&quot;q&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt; query&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;},&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#E64553;--shiki-light-font-style:italic;--shiki-dark:#EE99A0;--shiki-dark-font-style:italic&quot;&gt;            headers&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;headers&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;        )&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;        &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line highlighted&quot;&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;        span&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;set_attribute&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;&quot;http.status_code&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt; response&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;status_code&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line highlighted&quot;&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;        span&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;set_attribute&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;&quot;response.size&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;--shiki-light:#FE640B;--shiki-light-font-style:italic;--shiki-dark:#F5A97F;--shiki-dark-font-style:italic&quot;&gt; len&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;response&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;content&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;))&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;        &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line highlighted&quot;&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-dark:#C6A0F6&quot;&gt;        if&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt; response&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;status_code &lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;==&lt;/span&gt;&lt;span style=&quot;--shiki-light:#FE640B;--shiki-dark:#F5A97F&quot;&gt; 200&lt;/span&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-dark:#C6A0F6&quot;&gt; and&lt;/span&gt;&lt;span style=&quot;--shiki-light:#FE640B;--shiki-light-font-style:italic;--shiki-dark:#F5A97F;--shiki-dark-font-style:italic&quot;&gt; len&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;response&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;json&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;())&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt; ==&lt;/span&gt;&lt;span style=&quot;--shiki-light:#FE640B;--shiki-dark:#F5A97F&quot;&gt; 0&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line highlighted&quot;&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;            span&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;set_status&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;Status&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;StatusCode&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;ERROR&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; &quot;Empty result set&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;))&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line highlighted&quot;&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;            span&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;add_event&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;&quot;Suspicious empty response from healthy endpoint&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;        &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-dark:#C6A0F6&quot;&gt;        return&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt; response&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;json&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;()&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;span class=&quot;absolute py-1 text-foreground text-xs font-medium leading-4 pl-4 pr-2 before:inline-block before:size-1 before:bg-green-500 before:rounded-full before:absolute before:top-[45%] before:left-2 left-2 top-(--file-name-offset) border rounded-md bg-background&quot;&gt;agent/trace_integration.py&lt;/span&gt;&lt;/pre&gt;&lt;/figure&gt;
&lt;p&gt;Correlation ID propagation (line 12) and explicit error marking for suspicious patterns (lines 23-25) are what matter. When you see a spike in “empty result set” errors correlated with database saturation metrics, you know the integration is degraded even though HTTP status codes look fine. The harder failure is invisible: when an upstream API returns an error, some models fabricate a plausible answer rather than retrying. Token costs stay flat, latency looks normal, and your users receive confident, invented responses. Span attributes on both the tool call result and the subsequent LLM generation, correlated by trace ID, are the only way to detect it.&lt;/p&gt;
&lt;h2 id=&quot;why-do-token-costs-spiral-out-of-control&quot;&gt;Why Do Token Costs Spiral Out of Control?&lt;/h2&gt;
&lt;p&gt;Your agent works in testing. Then production traffic hits and your LLM bill explodes. &lt;a href=&quot;https://www.cloudzero.com/state-of-ai-costs/&quot;&gt;AI costs are surging 36% year-over-year&lt;/a&gt;, yet only half of organizations can confidently evaluate ROI (CloudZero, 2025). Without per-operation cost tracking, you can’t identify which workflows are burning money.&lt;/p&gt;
&lt;p&gt;Consider a Claude 4.5 Sonnet deployment: input tokens cost $3/million, output tokens cost $15/million. A single complex query might use 50K input tokens and 4K output tokens, costing $0.21. At 10,000 queries per day, that’s $2,100 daily, or $63,000 monthly, just for one workflow. If your agent retries on failures or chains multiple calls, costs multiply fast.&lt;/p&gt;
&lt;figure&gt;&lt;figcaption&gt;&lt;strong&gt;Code Snippet 4:&lt;/strong&gt; Prometheus metrics track token usage with labels for model, operation, and user tier, enabling real-time cost monitoring and per-operation granularity to prevent budget overruns.&lt;/figcaption&gt;&lt;pre class=&quot;astro-code astro-code-themes catppuccin-latte catppuccin-macchiato has-highlighted mt-8&quot; style=&quot;--shiki-light:#4c4f69; --shiki-dark:#cad3f5; --shiki-light-bg:#eff1f5; --shiki-dark-bg:#24273a; --file-name-offset: -0.75rem&quot; tabindex=&quot;0&quot; data-language=&quot;python&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-dark:#C6A0F6&quot;&gt;from&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt; prometheus_client &lt;/span&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-dark:#C6A0F6&quot;&gt;import&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt; Counter&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt; Histogram&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-light-font-style:italic;--shiki-dark:#939AB7;--shiki-dark-font-style:italic&quot;&gt;# Token counter with model and operation labels&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;tokens_total &lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt; Counter&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;(&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;    &apos;ai_tokens_total&apos;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;    &apos;Total tokens consumed&apos;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;    [&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;&apos;model&apos;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; &apos;operation&apos;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; &apos;user_tier&apos;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-light-font-style:italic;--shiki-dark:#939AB7;--shiki-dark-font-style:italic&quot;&gt;# Latency histogram with cost correlation&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;request_duration &lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt; Histogram&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;(&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;    &apos;ai_request_duration_seconds&apos;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;    &apos;Request duration&apos;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;    [&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;&apos;operation&apos;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;],&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#E64553;--shiki-light-font-style:italic;--shiki-dark:#EE99A0;--shiki-dark-font-style:italic&quot;&gt;    buckets&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;--shiki-light:#FE640B;--shiki-dark:#F5A97F&quot;&gt;0.1&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;--shiki-light:#FE640B;--shiki-dark:#F5A97F&quot;&gt; 0.5&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;--shiki-light:#FE640B;--shiki-dark:#F5A97F&quot;&gt; 1.0&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;--shiki-light:#FE640B;--shiki-dark:#F5A97F&quot;&gt; 2.0&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;--shiki-light:#FE640B;--shiki-dark:#F5A97F&quot;&gt; 5.0&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;--shiki-light:#FE640B;--shiki-dark:#F5A97F&quot;&gt; 10.0&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-light-font-style:italic;--shiki-dark:#C6A0F6;--shiki-dark-font-style:italic&quot;&gt; float&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;&apos;inf&apos;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;)]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-dark:#C6A0F6&quot;&gt;def&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-light-font-style:italic;--shiki-dark:#8AADF4;--shiki-dark-font-style:italic&quot;&gt; process_query&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--shiki-light:#E64553;--shiki-light-font-style:italic;--shiki-dark:#EE99A0;--shiki-dark-font-style:italic&quot;&gt;query&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;--shiki-light:#E64553;--shiki-light-font-style:italic;--shiki-dark:#EE99A0;--shiki-dark-font-style:italic&quot;&gt; user_tier&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;):&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-dark:#C6A0F6&quot;&gt;    with&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt; request_duration&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;labels&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--shiki-light:#E64553;--shiki-light-font-style:italic;--shiki-dark:#EE99A0;--shiki-dark-font-style:italic&quot;&gt;operation&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;&apos;query&apos;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;).&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;time&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;():&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;        embedding &lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt; embed&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;query&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line highlighted&quot;&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;        tokens_total&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;labels&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;(&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line highlighted&quot;&gt;&lt;span style=&quot;--shiki-light:#E64553;--shiki-light-font-style:italic;--shiki-dark:#EE99A0;--shiki-dark-font-style:italic&quot;&gt;            model&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;&apos;text-embedding-3-small&apos;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line highlighted&quot;&gt;&lt;span style=&quot;--shiki-light:#E64553;--shiki-light-font-style:italic;--shiki-dark:#EE99A0;--shiki-dark-font-style:italic&quot;&gt;            operation&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;&apos;embed&apos;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line highlighted&quot;&gt;&lt;span style=&quot;--shiki-light:#E64553;--shiki-light-font-style:italic;--shiki-dark:#EE99A0;--shiki-dark-font-style:italic&quot;&gt;            user_tier&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;user_tier &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line highlighted&quot;&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;        ).&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;inc&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--shiki-light:#FE640B;--shiki-light-font-style:italic;--shiki-dark:#F5A97F;--shiki-dark-font-style:italic&quot;&gt;len&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;query&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;split&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;()))&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;        &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;        results &lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt; vector_search&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;embedding&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;        &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;        response &lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt; generate_response&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;results&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line highlighted&quot;&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;        tokens_total&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;labels&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;(&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line highlighted&quot;&gt;&lt;span style=&quot;--shiki-light:#E64553;--shiki-light-font-style:italic;--shiki-dark:#EE99A0;--shiki-dark-font-style:italic&quot;&gt;            model&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;&apos;claude-4.5-sonnet&apos;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line highlighted&quot;&gt;&lt;span style=&quot;--shiki-light:#E64553;--shiki-light-font-style:italic;--shiki-dark:#EE99A0;--shiki-dark-font-style:italic&quot;&gt;            operation&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;&apos;generate&apos;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line highlighted&quot;&gt;&lt;span style=&quot;--shiki-light:#E64553;--shiki-light-font-style:italic;--shiki-dark:#EE99A0;--shiki-dark-font-style:italic&quot;&gt;            user_tier&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;user_tier &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line highlighted&quot;&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;        ).&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;inc&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--shiki-light:#E64553;--shiki-light-font-style:italic;--shiki-dark:#EE99A0;--shiki-dark-font-style:italic&quot;&gt;response&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;&apos;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-light-font-style:italic;--shiki-dark:#A6DA95;--shiki-dark-font-style:italic&quot;&gt;usage&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;&apos;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;][&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;&apos;total_tokens&apos;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;])&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;        &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-dark:#C6A0F6&quot;&gt;        return&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt; response&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;span class=&quot;absolute py-1 text-foreground text-xs font-medium leading-4 pl-4 pr-2 before:inline-block before:size-1 before:bg-green-500 before:rounded-full before:absolute before:top-[45%] before:left-2 left-2 top-(--file-name-offset) border rounded-md bg-background&quot;&gt;agent/metrics.py&lt;/span&gt;&lt;/pre&gt;&lt;/figure&gt;
&lt;h3 id=&quot;alerting-on-token-budgets&quot;&gt;Alerting on Token Budgets&lt;/h3&gt;
&lt;p&gt;Labels let you slice cost by model, operation, and user tier. When free-tier token usage spikes on expensive models, you can throttle, switch to cheaper models, or convert users to paid tiers before costs spiral.&lt;/p&gt;
&lt;figure&gt;&lt;figcaption&gt;&lt;strong&gt;Code Snippet 5:&lt;/strong&gt; Prometheus alerting rule triggers when any user tier exceeds 1,000 tokens per second sustained over 5 minutes, enabling proactive cost control before budget overruns.&lt;/figcaption&gt;&lt;pre class=&quot;astro-code astro-code-themes catppuccin-latte catppuccin-macchiato has-highlighted mt-8&quot; style=&quot;--shiki-light:#4c4f69; --shiki-dark:#cad3f5; --shiki-light-bg:#eff1f5; --shiki-dark-bg:#24273a; --file-name-offset: -0.75rem&quot; tabindex=&quot;0&quot; data-language=&quot;yaml&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;groups&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt; name&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; ai-cost-alerts&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;  rules&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;  -&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt; alert&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; TokenBudgetExceeded&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line highlighted&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;    expr&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; sum(rate(ai_tokens_total[5m])) by (user_tier) &gt; 1000&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;    for&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; 5m&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;    labels&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;      severity&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; warning&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;    annotations&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;      summary&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; &quot;Token budget exceeded for {{ $labels.user_tier }}&quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;      description&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; &quot;{{ $labels.user_tier }} tier consuming {{ $value }} tokens/sec&quot;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;span class=&quot;absolute py-1 text-foreground text-xs font-medium leading-4 pl-4 pr-2 before:inline-block before:size-1 before:bg-green-500 before:rounded-full before:absolute before:top-[45%] before:left-2 left-2 top-(--file-name-offset) border rounded-md bg-background&quot;&gt;ai-alerts.yml&lt;/span&gt;&lt;/pre&gt;&lt;/figure&gt;
&lt;h2 id=&quot;what-does-a-vendor-neutral-observability-stack-look-like&quot;&gt;What Does a Vendor-Neutral Observability Stack Look Like?&lt;/h2&gt;
&lt;p&gt;Enterprise platforms like Datadog and Splunk offer polished, integrated experiences. For teams prioritizing cloud-native portability, OpenTelemetry handles instrumentation, Prometheus stores metrics, and Grafana visualizes everything. Zero licensing cost, no vendor lock-in, and production-proven.&lt;/p&gt;
&lt;p&gt;Already invested in an enterprise platform? OpenTelemetry collectors export directly to these platforms, preserving full trace context and semantic attributes. You can adopt incrementally without disrupting existing dashboards, gaining richer observability now and portability for future migrations.&lt;/p&gt;
&lt;figure&gt;&lt;img alt=&quot;OpenTelemetry to Grafana stack&quot; loading=&quot;eager&quot; decoding=&quot;sync&quot; fetchpriority=&quot;high&quot; sizes=&quot;(min-width: 272px) 272px, 100vw&quot; data-astro-image=&quot;constrained&quot; data-astro-image-pos=&quot;center&quot; width=&quot;272&quot; height=&quot;486&quot; src=&quot;/_astro/ai-observability-stack.DcFX4Ym8_ZvW1oB.svg&quot; srcset=&quot;/_astro/ai-observability-stack.DcFX4Ym8_ZvW1oB.svg 272w&quot;&gt;&lt;figcaption&gt;&lt;strong&gt;Figure 1:&lt;/strong&gt; OpenTelemetry + Prometheus + Grafana stack&lt;/figcaption&gt;&lt;/figure&gt;
&lt;h3 id=&quot;how-the-components-connect&quot;&gt;How the Components Connect&lt;/h3&gt;
&lt;p&gt;Your agent emits traces, metrics, and logs via OpenTelemetry SDKs. The OpenTelemetry Collector receives, processes, and routes telemetry to backends. Prometheus scrapes metrics and stores time-series data. Grafana queries Prometheus for metrics, Tempo for traces, and Loki for logs, correlating them in unified dashboards.&lt;/p&gt;
&lt;h3 id=&quot;why-trace-metric-correlation-matters&quot;&gt;Why Trace-Metric Correlation Matters&lt;/h3&gt;
&lt;p&gt;When a user reports “the agent is slow”, start in Grafana, filter metrics by user ID, see elevated p95 latency, drill down to the request, and find the bottleneck in 30 seconds. Without correlation, you’re grepping logs for hours.&lt;/p&gt;
&lt;figure&gt;&lt;img alt=&quot;Trace ID propagation with per-operation latency breakdown&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; sizes=&quot;(min-width: 202px) 202px, 100vw&quot; data-astro-image=&quot;constrained&quot; data-astro-image-pos=&quot;center&quot; width=&quot;202&quot; height=&quot;686&quot; src=&quot;/_astro/ai-decision-trace.Co8X9gBX_Z1RniEz.svg&quot; srcset=&quot;/_astro/ai-decision-trace.Co8X9gBX_Z1RniEz.svg 202w&quot;&gt;&lt;figcaption&gt;&lt;strong&gt;Figure 2:&lt;/strong&gt; Trace ID propagation with per-operation latency breakdown&lt;/figcaption&gt;&lt;/figure&gt;
&lt;p&gt;Every request gets a correlation ID that propagates through RAG retrieval, API calls, and decision logic. When you need to audit a decision, query by trace ID to reconstruct the entire flow: what data was retrieved, which APIs were called, response times, and token consumption.&lt;/p&gt;
&lt;h2 id=&quot;what-is-the-roi-and-how-do-you-start&quot;&gt;What Is the ROI and How Do You Start?&lt;/h2&gt;
&lt;p&gt;Think of AI observability as a hierarchy: logging lets you see that something happened, monitoring alerts you to known problems in real time, and analytics surfaces the failures you did not know to look for. Most teams stop at monitoring and call it done. Scott Clark, founder of Distributional, calls this a “Maslow’s hierarchy of observability,” and the analytics layer is precisely the one most production failures hide in. The vendor-neutral stack below covers all three.&lt;/p&gt;
&lt;p&gt;Setup cost is roughly 40-80 hours of engineering time, with payback in 1-3 months. &lt;a href=&quot;https://chronosphere.io/forrester-total-economic-impact-chronosphere/&quot;&gt;Forrester TEI studies&lt;/a&gt; on comparable observability investments show 165-201% ROI (Forrester, 2020-2022). This stack delivers comparable returns with full portability.&lt;/p&gt;





















&lt;table tabindex=&quot;0&quot;&gt;&lt;caption&gt;&lt;strong&gt;Table 1:&lt;/strong&gt; AI Observability ROI&lt;/caption&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Without&lt;/th&gt;&lt;th&gt;With&lt;/th&gt;&lt;/tr&gt;&lt;/thead&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;$5K-$20K/month untracked token spend&lt;/td&gt;&lt;td&gt;Per-request cost attribution&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;4-8 hours debugging per incident&lt;/td&gt;&lt;td&gt;30 minutes with trace correlation&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;$20K-$50K manual audit reconstruction&lt;/td&gt;&lt;td&gt;Query-ready decision logs&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;
&lt;p&gt;Start small: instrument one critical path (the highest-risk decision your agent makes) with decision provenance logging. Add integration health tracing for your most fragile API dependency. Implement cost tracking for your most expensive model. Expand based on what breaks. This is the same incremental approach I described in &lt;a href=&quot;/posts/ai-agents-legacy-roi/&quot;&gt;my AI agents ROI post&lt;/a&gt;: start with 5% of workflows, prove value, then scale.&lt;/p&gt;
&lt;p&gt;Decision provenance, integration health, and cost runaway are not edge cases. They cause production AI failures. Fix them before deployment, not after the invoice arrives.&lt;/p&gt;
&lt;h2 id=&quot;are-you-ready-for-production&quot;&gt;Are You Ready for Production?&lt;/h2&gt;
&lt;p&gt;Before your next AI deployment, verify these capabilities:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Decision provenance&lt;/strong&gt;: High-risk workflows log inputs, reasoning, and outputs with trace IDs using OpenTelemetry and structured logging&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Integration health&lt;/strong&gt;: Distributed tracing covers legacy APIs and third-party services, with alerts on silent failures like empty responses from healthy endpoints&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Cost attribution&lt;/strong&gt;: Token usage tracked per model, operation, and user tier, with budget alerts via Prometheus metrics&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Audit reconstruction&lt;/strong&gt;: Any decision from the past 12 months can be fully reconstructed in under 30 minutes&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Behavioral drift&lt;/strong&gt;: You have a mechanism to detect when agent behavior shifts across deployments, not just latency or cost, but output patterns and tool call sequences&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;If you can’t confirm all five, you’re not ready for production.&lt;/p&gt;
&lt;hr&gt;
&lt;p&gt;For the SRE framework that operationalizes decision provenance with error budgets and trust ladders, see &lt;a href=&quot;/posts/sre-ai-agents-production&quot;&gt;SRE for AI Agents: Error Budgets, Trust, and 90 Trials&lt;/a&gt;.&lt;/p&gt;
&lt;hr&gt;
&lt;h2 id=&quot;references&quot;&gt;References&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;AICPA, “2017 Trust Services Criteria (With Revised Points of Focus - 2022)” (2022) - &lt;a href=&quot;https://www.aicpa-cima.com/resources/download/2017-trust-services-criteria-with-revised-points-of-focus-2022&quot;&gt;https://www.aicpa-cima.com/resources/download/2017-trust-services-criteria-with-revised-points-of-focus-2022&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Clark, Scott, “How to Find the Agent Failures Your Evals Miss”, TWiML AI Podcast (2025) - &lt;a href=&quot;https://twimlai.com/podcast/twimlai/how-find-agent-failures-your-evals-miss&quot;&gt;https://twimlai.com/podcast/twimlai/how-find-agent-failures-your-evals-miss&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;CloudZero, “The State of AI Costs in 2025” (2025) - &lt;a href=&quot;https://www.cloudzero.com/state-of-ai-costs/&quot;&gt;https://www.cloudzero.com/state-of-ai-costs/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;European Union, “GDPR Article 30: Records of Processing Activities” (2018) - &lt;a href=&quot;https://gdpr-info.eu/art-30-gdpr/&quot;&gt;https://gdpr-info.eu/art-30-gdpr/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Forrester Consulting, “The Total Economic Impact of Chronosphere” (2022) - &lt;a href=&quot;https://chronosphere.io/forrester-total-economic-impact-chronosphere/&quot;&gt;https://chronosphere.io/forrester-total-economic-impact-chronosphere/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Forrester Consulting, “The Total Economic Impact of Microsoft Sentinel” (2020) - &lt;a href=&quot;https://tei.forrester.com/go/microsoft/microsoft_sentinel/&quot;&gt;https://tei.forrester.com/go/microsoft/microsoft_sentinel/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Kiteworks, “HIPAA Audit Logs: Complete Requirements for Healthcare Compliance in 2025” (2025) - &lt;a href=&quot;https://www.kiteworks.com/hipaa-compliance/hipaa-audit-log-requirements/&quot;&gt;https://www.kiteworks.com/hipaa-compliance/hipaa-audit-log-requirements/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;OpenTelemetry, “Semantic Conventions for Generative AI Systems” — &lt;a href=&quot;https://opentelemetry.io/docs/specs/semconv/gen-ai/&quot;&gt;https://opentelemetry.io/docs/specs/semconv/gen-ai/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;OpenTelemetry, “Tracing SDK Specification” — &lt;a href=&quot;https://opentelemetry.io/docs/specs/otel/trace/sdk/&quot;&gt;https://opentelemetry.io/docs/specs/otel/trace/sdk/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;PCI Security Standards Council, “PCI DSS v4.0.1” (2024) - &lt;a href=&quot;https://docs-prv.pcisecuritystandards.org/PCI%20DSS/Standard/PCI-DSS-v4_0_1.pdf&quot;&gt;https://docs-prv.pcisecuritystandards.org/PCI%20DSS/Standard/PCI-DSS-v4_0_1.pdf&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</content:encoded><category>agentic-ai</category><category>architecture</category><category>observability</category><category>ai-governance</category><author>Hugues Clouâtre</author></item><item><title>RAG for Legacy Systems: 7,432 Pages to 3s Answers</title><link>https://clouatre.ca/posts/rag-legacy-systems/</link><guid isPermaLink="true">https://clouatre.ca/posts/rag-legacy-systems/</guid><description>7,432 pages to 3-second answers. Production RAG for legacy systems with model-agnostic reranking. No vendor lock-in, validated across 4 LLM families.</description><pubDate>Tue, 16 Jun 2026 18:19:00 GMT</pubDate><content:encoded>&lt;p&gt;Your legacy system documentation is 20 years old, 7,432 pages, and locked in PDFs. Manual search takes 15-30 minutes per query. We made it queryable in 170 seconds. Query response time: 3-5 seconds. ROI break-even: one day.&lt;/p&gt;
&lt;p&gt;This isn’t a prototype. It’s Retrieval-Augmented Generation (RAG) on Amazon Bedrock, a system that retrieves relevant documentation and uses an LLM to generate answers without retraining models. Validated across four LLM families with 480 measurements. The implementation indexes 20,679 chunks and delivers sub-5-second responses with model-agnostic reranking. Overhead: 27.2ms ± 4.6ms regardless of which LLM you use.&lt;/p&gt;
&lt;p&gt;Yes, 7,432 pages fit in any search index. But ranked results aren’t answers.&lt;/p&gt;
&lt;p&gt;Here’s the production architecture, the multi-model validation data, and why you can switch providers without re-tuning.&lt;/p&gt;
&lt;h2 id=&quot;table-of-contents&quot;&gt;Table of contents&lt;/h2&gt;
&lt;p&gt;&lt;/p&gt;&lt;details&gt;&lt;summary&gt;Contents&lt;/summary&gt;&lt;p&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;#why-rag-not-fine-tuning&quot;&gt;Why RAG, Not Fine-Tuning?&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#how-does-rag-turn-pdfs-into-answers&quot;&gt;How Does RAG Turn PDFs Into Answers?&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;#the-ingestion-pipeline&quot;&gt;The Ingestion Pipeline&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#hybrid-retrieval-bm25--vector-search&quot;&gt;Hybrid Retrieval: BM25 + Vector Search&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#example-error-lookup-in-34-seconds&quot;&gt;Example: Error Lookup in 3.4 Seconds&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#local-embeddings-and-model-agnostic-design&quot;&gt;Local Embeddings and Model-Agnostic Design&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#does-reranking-work-across-different-models&quot;&gt;Does Reranking Work Across Different Models?&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#what-are-the-real-performance-numbers&quot;&gt;What Are the Real Performance Numbers?&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#whats-the-roi-without-modernization&quot;&gt;What’s the ROI Without Modernization?&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#when-does-rag-fail&quot;&gt;When Does RAG Fail?&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;#hallucination&quot;&gt;Hallucination&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#context-overflow&quot;&gt;Context Overflow&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#drift&quot;&gt;Drift&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#corpus-limitations&quot;&gt;Corpus Limitations&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#what-is-the-overall-failure-rate&quot;&gt;What Is the Overall Failure Rate?&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#how-do-you-migrate-from-prototype-to-production&quot;&gt;How Do You Migrate from Prototype to Production?&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#what-should-you-do-next&quot;&gt;What Should You Do Next?&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#references&quot;&gt;References&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;/p&gt;&lt;/details&gt;&lt;p&gt;&lt;/p&gt;
&lt;h2 id=&quot;why-rag-not-fine-tuning&quot;&gt;Why RAG, Not Fine-Tuning?&lt;/h2&gt;
&lt;p&gt;Fine-tuning trains a model on your docs. It bakes knowledge into weights (making provenance verification difficult), requires retraining for every update, and costs &lt;a href=&quot;https://www.thundercompute.com/blog/ai-gpu-rental-market-trends&quot;&gt;$1.32-6.24 per run on A100 GPUs&lt;/a&gt; (Thunder Compute, 2025). RAG costs $0 setup with local embeddings, $0.0011 per query on Bedrock, updates in 2 seconds, and keeps sources verifiable.&lt;/p&gt;
&lt;p&gt;For legacy systems, choose RAG for operational factors, not economics. Documentation evolves as reverse-engineering uncovers new system behaviors; fine-tuning would require retraining each time. The deciding factors: instant updates (2 seconds vs retraining), source citations for compliance, and simpler maintenance.&lt;/p&gt;
&lt;p&gt;A common objection: modern LLMs have million-token context windows, so why not load all 7,432 pages and skip retrieval entirely? Two reasons. First, relevance ranking still matters: injecting the full corpus degrades answer quality because the LLM attends poorly to relevant passages buried in noise. Second, compliance requires provenance, knowing not just what the answer is, but which document and page it came from. A context dump cannot produce a citable source. Retrieval can.&lt;/p&gt;
&lt;h2 id=&quot;how-does-rag-turn-pdfs-into-answers&quot;&gt;How Does RAG Turn PDFs Into Answers?&lt;/h2&gt;
&lt;h3 id=&quot;the-ingestion-pipeline&quot;&gt;The Ingestion Pipeline&lt;/h3&gt;
&lt;p&gt;The pipeline has six stages:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Extract&lt;/strong&gt; - Pull text from PDFs using PyMuPDF (44 pages/second)&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Transform&lt;/strong&gt; - Convert to Markdown with heading detection&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Chunk&lt;/strong&gt; - Split at headings (1,000-char limit, 200-char overlap)&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Embed&lt;/strong&gt; - Generate vectors with all-MiniLM-L6-v2 (local, free)&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Index&lt;/strong&gt; - Store in ChromaDB vector database&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Retrieve&lt;/strong&gt; - Hybrid search (BM25 + vector) with FlashRank reranking&lt;/li&gt;
&lt;/ol&gt;
&lt;figure&gt;&lt;figcaption&gt;&lt;strong&gt;Code Snippet 1:&lt;/strong&gt; PyMuPDF extracts text and converts to Markdown with heading detection, processing 44 pages/second.&lt;/figcaption&gt;&lt;pre class=&quot;astro-code astro-code-themes catppuccin-latte catppuccin-macchiato has-highlighted mt-8&quot; style=&quot;--shiki-light:#4c4f69; --shiki-dark:#cad3f5; --shiki-light-bg:#eff1f5; --shiki-dark-bg:#24273a; --file-name-offset: -0.75rem&quot; tabindex=&quot;0&quot; data-language=&quot;python&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-dark:#C6A0F6&quot;&gt;import&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt; fitz  &lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-light-font-style:italic;--shiki-dark:#939AB7;--shiki-dark-font-style:italic&quot;&gt;# pymupdf&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;doc &lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt; fitz&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;open&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;pdf_path&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-dark:#C6A0F6&quot;&gt;for&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt; page_num &lt;/span&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-dark:#C6A0F6&quot;&gt;in&lt;/span&gt;&lt;span style=&quot;--shiki-light:#FE640B;--shiki-light-font-style:italic;--shiki-dark:#F5A97F;--shiki-dark-font-style:italic&quot;&gt; range&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--shiki-light:#FE640B;--shiki-light-font-style:italic;--shiki-dark:#F5A97F;--shiki-dark-font-style:italic&quot;&gt;len&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;doc&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;)):&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;    page &lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--shiki-light:#E64553;--shiki-light-font-style:italic;--shiki-dark:#EE99A0;--shiki-dark-font-style:italic&quot;&gt; doc&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;--shiki-light:#E64553;--shiki-light-font-style:italic;--shiki-dark:#EE99A0;--shiki-dark-font-style:italic&quot;&gt;page_num&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line highlighted&quot;&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;    text &lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt; page&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;get_text&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;()&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;    &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line highlighted&quot;&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-dark:#C6A0F6&quot;&gt;    for&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt; line &lt;/span&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-dark:#C6A0F6&quot;&gt;in&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt; text&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;split&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#EA76CB;--shiki-dark:#F5BDE6&quot;&gt;\n&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;):&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-light-font-style:italic;--shiki-dark:#939AB7;--shiki-dark-font-style:italic&quot;&gt;        # Detect chapter headings (e.g., &quot;Chapter 1. Title&quot;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-dark:#C6A0F6&quot;&gt;        if&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt; line&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;startswith&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;&quot;Chapter &quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-dark:#C6A0F6&quot;&gt; and&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; &quot;. &quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-dark:#C6A0F6&quot;&gt; in&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt; line&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line highlighted&quot;&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;            cleaned_lines&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;append&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-light-font-style:italic;--shiki-dark:#A6DA95;--shiki-dark-font-style:italic&quot;&gt;f&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#EA76CB;--shiki-dark:#F5BDE6&quot;&gt;\n&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;## &lt;/span&gt;&lt;span style=&quot;--shiki-light:#EA76CB;--shiki-dark:#F5BDE6&quot;&gt;{&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;line&lt;/span&gt;&lt;span style=&quot;--shiki-light:#EA76CB;--shiki-dark:#F5BDE6&quot;&gt;}\n&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-light-font-style:italic;--shiki-dark:#939AB7;--shiki-dark-font-style:italic&quot;&gt;        # Detect section headings&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-dark:#C6A0F6&quot;&gt;        elif&lt;/span&gt;&lt;span style=&quot;--shiki-light:#FE640B;--shiki-light-font-style:italic;--shiki-dark:#F5A97F;--shiki-dark-font-style:italic&quot;&gt; len&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;line&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt; &amp;#x3C;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#FE640B;--shiki-dark:#F5A97F&quot;&gt; 80&lt;/span&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-dark:#C6A0F6&quot;&gt; and&lt;/span&gt;&lt;span style=&quot;--shiki-light:#E64553;--shiki-light-font-style:italic;--shiki-dark:#EE99A0;--shiki-dark-font-style:italic&quot;&gt; line&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;--shiki-light:#FE640B;--shiki-light-font-style:italic;--shiki-dark:#F5A97F;--shiki-dark-font-style:italic&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;].&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;isupper&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;():&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line highlighted&quot;&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;            cleaned_lines&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;append&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-light-font-style:italic;--shiki-dark:#A6DA95;--shiki-dark-font-style:italic&quot;&gt;f&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#EA76CB;--shiki-dark:#F5BDE6&quot;&gt;\n&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;### &lt;/span&gt;&lt;span style=&quot;--shiki-light:#EA76CB;--shiki-dark:#F5BDE6&quot;&gt;{&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;line&lt;/span&gt;&lt;span style=&quot;--shiki-light:#EA76CB;--shiki-dark:#F5BDE6&quot;&gt;}\n&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;doc&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;close&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;()&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;span class=&quot;absolute py-1 text-foreground text-xs font-medium leading-4 pl-4 pr-2 before:inline-block before:size-1 before:bg-green-500 before:rounded-full before:absolute before:top-[45%] before:left-2 left-2 top-(--file-name-offset) border rounded-md bg-background&quot;&gt;src/ingest.py&lt;/span&gt;&lt;/pre&gt;&lt;/figure&gt;
&lt;p&gt;The pipeline converts PDFs to Markdown before chunking, preserving chapter and section hierarchy. Chunks split at heading boundaries instead of mid-paragraph, keeping related content together. Storing the parent section per chunk allows the retriever to expand context upward during reranking, useful when an answer spans a subsection and its parent chapter.&lt;/p&gt;
&lt;h3 id=&quot;hybrid-retrieval-bm25--vector-search&quot;&gt;Hybrid Retrieval: BM25 + Vector Search&lt;/h3&gt;
&lt;p&gt;Why not just Elasticsearch or Ctrl+F? Pure keyword search fails when you search “memory error” but the 2005 docs say “data file cache exhaustion.” Pure vector search misses exact terms like “port 5432.” Dense retrieval (ChromaDB) handles conceptual queries; sparse (BM25) ensures exact references for compliance and explainability. Legacy terminology drift makes both necessary. Hybrid retrieval solves ranking. The LLM solves synthesis: combining fragments from multiple documents into an actionable answer. Reciprocal Rank Fusion (RRF) &lt;a href=&quot;https://arxiv.org/abs/2401.04055&quot;&gt;consistently outperforms single-method search&lt;/a&gt; (Mandikal &amp;#x26; Mooney, 2024).&lt;/p&gt;
&lt;figure&gt;&lt;figcaption&gt;&lt;strong&gt;Code Snippet 2:&lt;/strong&gt; RRF formula combines keyword and semantic search scores with k=60 constant.&lt;/figcaption&gt;&lt;pre class=&quot;astro-code astro-code-themes catppuccin-latte catppuccin-macchiato has-highlighted mt-8&quot; style=&quot;--shiki-light:#4c4f69; --shiki-dark:#cad3f5; --shiki-light-bg:#eff1f5; --shiki-dark-bg:#24273a; --file-name-offset: -0.75rem&quot; tabindex=&quot;0&quot; data-language=&quot;python&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-light-font-style:italic;--shiki-dark:#939AB7;--shiki-dark-font-style:italic&quot;&gt;# RRF combines BM25 + vector scores&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;doc_scores&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#E64553;--shiki-light-font-style:italic;--shiki-dark:#EE99A0;--shiki-dark-font-style:italic&quot;&gt; dict&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-light-font-style:italic;--shiki-dark:#C6A0F6;--shiki-dark-font-style:italic&quot;&gt;str&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;--shiki-light:#E64553;--shiki-light-font-style:italic;--shiki-dark:#EE99A0;--shiki-dark-font-style:italic&quot;&gt; tuple&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;--shiki-light:#E64553;--shiki-light-font-style:italic;--shiki-dark:#EE99A0;--shiki-dark-font-style:italic&quot;&gt;Document&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-light-font-style:italic;--shiki-dark:#C6A0F6;--shiki-dark-font-style:italic&quot;&gt; float&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;]]&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt; =&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt; {}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-dark:#C6A0F6&quot;&gt;for&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt; rank&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt; idx &lt;/span&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-dark:#C6A0F6&quot;&gt;in&lt;/span&gt;&lt;span style=&quot;--shiki-light:#FE640B;--shiki-light-font-style:italic;--shiki-dark:#F5A97F;--shiki-dark-font-style:italic&quot;&gt; enumerate&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--shiki-light:#E64553;--shiki-light-font-style:italic;--shiki-dark:#EE99A0;--shiki-dark-font-style:italic&quot;&gt;bm25_top_indices&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;[:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#E64553;--shiki-light-font-style:italic;--shiki-dark:#EE99A0;--shiki-dark-font-style:italic&quot;&gt;retrieve_k&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;]):&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;    doc &lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--shiki-light:#E64553;--shiki-light-font-style:italic;--shiki-dark:#EE99A0;--shiki-dark-font-style:italic&quot;&gt; chunks&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;--shiki-light:#E64553;--shiki-light-font-style:italic;--shiki-dark:#EE99A0;--shiki-dark-font-style:italic&quot;&gt;idx&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;    doc_id &lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt; doc&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;metadata&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;get&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;&quot;source&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; &quot;&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt; +&lt;/span&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-light-font-style:italic;--shiki-dark:#C6A0F6;--shiki-dark-font-style:italic&quot;&gt; str&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--shiki-light:#FE640B;--shiki-light-font-style:italic;--shiki-dark:#F5A97F;--shiki-dark-font-style:italic&quot;&gt;hash&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;doc&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;--shiki-light:#E64553;--shiki-light-font-style:italic;--shiki-dark:#EE99A0;--shiki-dark-font-style:italic&quot;&gt;page_content&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;[:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#FE640B;--shiki-light-font-style:italic;--shiki-dark:#F5A97F;--shiki-dark-font-style:italic&quot;&gt;100&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;]))&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line highlighted&quot;&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;    rrf_score &lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--shiki-light:#FE640B;--shiki-dark:#F5A97F&quot;&gt; 1&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt; /&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt; (&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;rank &lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;--shiki-light:#FE640B;--shiki-dark:#F5A97F&quot;&gt; 60&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-light-font-style:italic;--shiki-dark:#939AB7;--shiki-dark-font-style:italic&quot;&gt;  # RRF with k=60&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-dark:#C6A0F6&quot;&gt;    if&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt; doc_id &lt;/span&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-dark:#C6A0F6&quot;&gt;in&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt; doc_scores&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#E64553;--shiki-light-font-style:italic;--shiki-dark:#EE99A0;--shiki-dark-font-style:italic&quot;&gt;        doc_scores&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;--shiki-light:#E64553;--shiki-light-font-style:italic;--shiki-dark:#EE99A0;--shiki-dark-font-style:italic&quot;&gt;doc_id&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt; =&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt; (&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;doc&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;--shiki-light:#E64553;--shiki-light-font-style:italic;--shiki-dark:#EE99A0;--shiki-dark-font-style:italic&quot;&gt; doc_scores&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;--shiki-light:#E64553;--shiki-light-font-style:italic;--shiki-dark:#EE99A0;--shiki-dark-font-style:italic&quot;&gt;doc_id&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;][&lt;/span&gt;&lt;span style=&quot;--shiki-light:#FE640B;--shiki-dark:#F5A97F&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt; +&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt; rrf_score&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-dark:#C6A0F6&quot;&gt;    else&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#E64553;--shiki-light-font-style:italic;--shiki-dark:#EE99A0;--shiki-dark-font-style:italic&quot;&gt;        doc_scores&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;--shiki-light:#E64553;--shiki-light-font-style:italic;--shiki-dark:#EE99A0;--shiki-dark-font-style:italic&quot;&gt;doc_id&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt; =&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt; (&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;doc&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt; rrf_score&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;)&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;span class=&quot;absolute py-1 text-foreground text-xs font-medium leading-4 pl-4 pr-2 before:inline-block before:size-1 before:bg-green-500 before:rounded-full before:absolute before:top-[45%] before:left-2 left-2 top-(--file-name-offset) border rounded-md bg-background&quot;&gt;src/rag.py&lt;/span&gt;&lt;/pre&gt;&lt;/figure&gt;
&lt;p&gt;Hybrid retrieval returns 16 candidate chunks. A cross-encoder model (FlashRank) scores each query-document pair and returns the top 8. This fixes the precision problem: high recall from hybrid search, high precision from reranking.&lt;/p&gt;
&lt;h3 id=&quot;example-error-lookup-in-34-seconds&quot;&gt;Example: Error Lookup in 3.4 Seconds&lt;/h3&gt;
&lt;p&gt;&lt;strong&gt;User query:&lt;/strong&gt; “What is error 1006030 and how do I fix it?”&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Generated answer:&lt;/strong&gt;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Error 1006030: “Failed to bring a data file page into cache. Data file cache is too small.”&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Cause:&lt;/strong&gt; Essbase cannot store the data file page in the data file cache.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Solution:&lt;/strong&gt; Increase the data file cache size. After fixing, check for database corruption (Error Message Reference, p. 126).&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;strong&gt;Timing:&lt;/strong&gt; 3.4s total (retrieval: 80ms, reranking: 31ms, generation: 3.3s)&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Retrieved from:&lt;/strong&gt; Error Message Reference v11.1.1 (ranked 3rd of 8 after reranking)&lt;/p&gt;
&lt;p&gt;The system retrieved error 1006030 from the Error Message Reference (ranked 3rd of 8 after reranking) and synthesized an actionable answer. Manual search would require opening the 1,200-page Error Message Reference PDF and using Ctrl+F. FlashRank reranking adds 31ms overhead for a &lt;a href=&quot;https://arxiv.org/abs/2601.03258&quot;&gt;6-8% accuracy gain&lt;/a&gt; (George, 2025).&lt;/p&gt;
&lt;figure&gt;&lt;img alt=&quot;RAG Pipeline with Reranking&quot; loading=&quot;eager&quot; decoding=&quot;sync&quot; fetchpriority=&quot;high&quot; sizes=&quot;(min-width: 394px) 394px, 100vw&quot; data-astro-image=&quot;constrained&quot; data-astro-image-pos=&quot;center&quot; width=&quot;394&quot; height=&quot;1430&quot; src=&quot;/_astro/rag-pipeline-reranking.99vE_Oef_1ccBt9.svg&quot; srcset=&quot;/_astro/rag-pipeline-reranking.99vE_Oef_1ccBt9.svg 394w&quot;&gt;&lt;figcaption&gt;&lt;strong&gt;Figure 1:&lt;/strong&gt; RAG pipeline with hybrid retrieval and reranking (FlashRank adds 31ms overhead for precision gain).&lt;/figcaption&gt;&lt;/figure&gt;
&lt;h3 id=&quot;local-embeddings-and-model-agnostic-design&quot;&gt;Local Embeddings and Model-Agnostic Design&lt;/h3&gt;
&lt;p&gt;Why local embeddings? Cost, simplicity, and performance. Cloud embedding APIs charge $0.10-0.50 per million tokens. Local models are free, require no API keys, and embed 1,000 chunks in under 10 seconds on CPU. The all-MiniLM-L6-v2 model is 80 MB and runs without GPU acceleration. FlashRank follows the same logic: local cross-encoder, no API call, no per-request cost.&lt;/p&gt;
&lt;p&gt;The architecture is model-agnostic by design. We use Amazon Bedrock, but the same pipeline works with Azure OpenAI, Google Vertex AI, or local models.&lt;/p&gt;
&lt;h2 id=&quot;does-reranking-work-across-different-models&quot;&gt;Does Reranking Work Across Different Models?&lt;/h2&gt;
&lt;p&gt;We tested four LLM families across two providers (Amazon Bedrock, OpenRouter) to validate portability. Mean latency: 27.2ms ± 4.6ms across 480 measurements, with no statistically significant difference (ANOVA p=0.34). Cross-provider variance was only 4.1ms.&lt;/p&gt;



































&lt;table tabindex=&quot;0&quot;&gt;&lt;caption&gt;&lt;strong&gt;Table 1:&lt;/strong&gt; Latency is consistent across models and providers (480 measurements, ANOVA p=0.34).&lt;/caption&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Model&lt;/th&gt;&lt;th&gt;Family&lt;/th&gt;&lt;th&gt;Latency&lt;/th&gt;&lt;th&gt;Provider&lt;/th&gt;&lt;/tr&gt;&lt;/thead&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;Claude Haiku 4.5&lt;/td&gt;&lt;td&gt;Anthropic&lt;/td&gt;&lt;td&gt;+31.3ms&lt;/td&gt;&lt;td&gt;Amazon Bedrock&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Mistral Devstral-2512&lt;/td&gt;&lt;td&gt;Mistral&lt;/td&gt;&lt;td&gt;+32.5ms&lt;/td&gt;&lt;td&gt;OpenRouter&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Llama 3.3 Instruct&lt;/td&gt;&lt;td&gt;Meta&lt;/td&gt;&lt;td&gt;+24.1ms&lt;/td&gt;&lt;td&gt;OpenRouter&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Qwen 2.5 Coder&lt;/td&gt;&lt;td&gt;Alibaba&lt;/td&gt;&lt;td&gt;+25.1ms&lt;/td&gt;&lt;td&gt;OpenRouter&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;
&lt;p&gt;The latency is dominated by FlashRank’s cross-encoder, not the LLM. This means you implement once and switch providers without re-tuning.&lt;/p&gt;
&lt;figure&gt;&lt;figcaption&gt;&lt;strong&gt;Code Snippet 3:&lt;/strong&gt; FlashRank reranks 16 candidates in 31ms using cross-encoder scoring.&lt;/figcaption&gt;&lt;pre class=&quot;astro-code astro-code-themes catppuccin-latte catppuccin-macchiato has-highlighted mt-8&quot; style=&quot;--shiki-light:#4c4f69; --shiki-dark:#cad3f5; --shiki-light-bg:#eff1f5; --shiki-dark-bg:#24273a; --file-name-offset: -0.75rem&quot; tabindex=&quot;0&quot; data-language=&quot;python&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-dark:#C6A0F6&quot;&gt;from&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt; flashrank &lt;/span&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-dark:#C6A0F6&quot;&gt;import&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt; Ranker&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt; RerankRequest&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-dark:#C6A0F6&quot;&gt;def&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-light-font-style:italic;--shiki-dark:#8AADF4;--shiki-dark-font-style:italic&quot;&gt; _rerank&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--shiki-light:#D20F39;--shiki-light-font-style:italic;--shiki-dark:#ED8796;--shiki-dark-font-style:italic&quot;&gt;self&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;--shiki-light:#E64553;--shiki-light-font-style:italic;--shiki-dark:#EE99A0;--shiki-dark-font-style:italic&quot;&gt; query&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-light-font-style:italic;--shiki-dark:#C6A0F6;--shiki-dark-font-style:italic&quot;&gt; str&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;--shiki-light:#E64553;--shiki-light-font-style:italic;--shiki-dark:#EE99A0;--shiki-dark-font-style:italic&quot;&gt; docs&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#E64553;--shiki-light-font-style:italic;--shiki-dark:#EE99A0;--shiki-dark-font-style:italic&quot;&gt; list&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;--shiki-light:#E64553;--shiki-light-font-style:italic;--shiki-dark:#EE99A0;--shiki-dark-font-style:italic&quot;&gt;Document&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;])&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt; -&gt;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#E64553;--shiki-light-font-style:italic;--shiki-dark:#EE99A0;--shiki-dark-font-style:italic&quot;&gt; list&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;--shiki-light:#E64553;--shiki-light-font-style:italic;--shiki-dark:#EE99A0;--shiki-dark-font-style:italic&quot;&gt;Document&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;]:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;    passages &lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt; [&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;        {&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;&quot;id&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt; i&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; &quot;text&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt; doc&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;page_content&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; &quot;meta&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt; doc&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;metadata&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-dark:#C6A0F6&quot;&gt;        for&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt; i&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt; doc &lt;/span&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-dark:#C6A0F6&quot;&gt;in&lt;/span&gt;&lt;span style=&quot;--shiki-light:#FE640B;--shiki-light-font-style:italic;--shiki-dark:#F5A97F;--shiki-dark-font-style:italic&quot;&gt; enumerate&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;docs&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;    ]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;    &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line highlighted&quot;&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;    rerank_request &lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt; RerankRequest&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--shiki-light:#E64553;--shiki-light-font-style:italic;--shiki-dark:#EE99A0;--shiki-dark-font-style:italic&quot;&gt;query&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;query&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;--shiki-light:#E64553;--shiki-light-font-style:italic;--shiki-dark:#EE99A0;--shiki-dark-font-style:italic&quot;&gt; passages&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;passages&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line highlighted&quot;&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;    results &lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--shiki-light:#D20F39;--shiki-light-font-style:italic;--shiki-dark:#ED8796;--shiki-dark-font-style:italic&quot;&gt; self&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;ranker&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;rerank&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;rerank_request&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;    &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-dark:#C6A0F6&quot;&gt;    return&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt; [&lt;/span&gt;&lt;span style=&quot;--shiki-light:#E64553;--shiki-light-font-style:italic;--shiki-dark:#EE99A0;--shiki-dark-font-style:italic&quot;&gt;docs&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;--shiki-light:#E64553;--shiki-light-font-style:italic;--shiki-dark:#EE99A0;--shiki-dark-font-style:italic&quot;&gt;result&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-light-font-style:italic;--shiki-dark:#A6DA95;--shiki-dark-font-style:italic&quot;&gt;id&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;]]&lt;/span&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-dark:#C6A0F6&quot;&gt; for&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt; result &lt;/span&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-dark:#C6A0F6&quot;&gt;in&lt;/span&gt;&lt;span style=&quot;--shiki-light:#E64553;--shiki-light-font-style:italic;--shiki-dark:#EE99A0;--shiki-dark-font-style:italic&quot;&gt; results&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;[:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#E64553;--shiki-light-font-style:italic;--shiki-dark:#EE99A0;--shiki-dark-font-style:italic&quot;&gt;RERANK_TOP_N&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;]]&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;span class=&quot;absolute py-1 text-foreground text-xs font-medium leading-4 pl-4 pr-2 before:inline-block before:size-1 before:bg-green-500 before:rounded-full before:absolute before:top-[45%] before:left-2 left-2 top-(--file-name-offset) border rounded-md bg-background&quot;&gt;src/rag.py&lt;/span&gt;&lt;/pre&gt;&lt;/figure&gt;
&lt;p&gt;Reranking is infrastructure, not model-specific configuration. Cross-encoder reranking (FlashRank) is the right starting point; for higher-stakes queries, an LLM-as-judge reranker scores query-document pairs using semantic reasoning rather than similarity, at higher cost but better precision on complex domain questions.&lt;/p&gt;
&lt;h2 id=&quot;what-are-the-real-performance-numbers&quot;&gt;What Are the Real Performance Numbers?&lt;/h2&gt;
&lt;p&gt;With model-agnostic reranking validated, here are the production metrics.&lt;/p&gt;
&lt;p&gt;We indexed 7,432 pages in 170 seconds. First-time setup includes PDF extraction (120s), chunking (20s), embedding (25s), and indexing (5s). Cached runs skip extraction and take 2.2 seconds. Query response time averages 3-5 seconds: retrieval (80ms), LLM generation (4s), overhead (200ms).&lt;/p&gt;
&lt;p&gt;Cost per query is $0.01-0.05 on Amazon Bedrock. Input tokens (context from retrieved chunks) cost $0.25 per million. Output tokens (LLM answer) cost $1.25 per million. A typical query uses 2,000 input tokens and 500 output tokens, totaling $0.0011.&lt;/p&gt;








































&lt;table tabindex=&quot;0&quot;&gt;&lt;caption&gt;&lt;strong&gt;Table 2:&lt;/strong&gt; Performance metrics across two production RAG systems (System A handles technical docs, System B processes meeting notes).&lt;/caption&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Metric&lt;/th&gt;&lt;th&gt;System A (Docs)&lt;/th&gt;&lt;th&gt;System B (Notes)&lt;/th&gt;&lt;/tr&gt;&lt;/thead&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;Documents&lt;/td&gt;&lt;td&gt;14 PDFs (7,432 pages)&lt;/td&gt;&lt;td&gt;94 markdown files&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Chunks&lt;/td&gt;&lt;td&gt;20,679&lt;/td&gt;&lt;td&gt;Auto-chunked&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;First run&lt;/td&gt;&lt;td&gt;170s&lt;/td&gt;&lt;td&gt;40s&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Cached run&lt;/td&gt;&lt;td&gt;2.2s&lt;/td&gt;&lt;td&gt;2s&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Query time&lt;/td&gt;&lt;td&gt;3-5s&lt;/td&gt;&lt;td&gt;3-5s&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Cost/query&lt;/td&gt;&lt;td&gt;$0.01-0.05&lt;/td&gt;&lt;td&gt;$0.01-0.05&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;
&lt;p&gt;Reranking adds 31ms to retrieval time. That’s a 65% increase in retrieval latency but only 0.3% of total query time. Users don’t notice 31ms in a 9-second end-to-end response. The 6-8% accuracy improvement compounds with hybrid retrieval’s gains over single-method search, making the overhead negligible compared to the final quality benefit. For detailed methodology and raw data, see &lt;a href=&quot;https://doi.org/10.5281/zenodo.19056880&quot;&gt;Supplementary Materials&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&quot;whats-the-roi-without-modernization&quot;&gt;What’s the ROI Without Modernization?&lt;/h2&gt;
&lt;p&gt;Manual search through 7,432 pages takes 15-30 minutes (median: 25 min). You open PDFs, use Ctrl+F, read context, cross-reference sections. RAG reduces this to 3-5 seconds.&lt;/p&gt;
&lt;p&gt;Assume 10 queries per day during a 6-month migration project. Labor cost: $100/hour (mid-market technical consultant). Time saved: 25 minutes per query. Success rate: 87% (28 of 32 evaluation queries returned useful results; 4 required human review).&lt;/p&gt;
&lt;p&gt;Daily savings: 10 queries × 25 min × ($100/hr ÷ 60) × 87% success rate = &lt;strong&gt;$362/day&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Setup cost: 170 seconds of compute time plus $0 for local embeddings. Query cost: $0.01-0.05 on Amazon Bedrock. Break-even happens in one day.&lt;/p&gt;
&lt;h2 id=&quot;when-does-rag-fail&quot;&gt;When Does RAG Fail?&lt;/h2&gt;
&lt;p&gt;RAG fails on multi-step reasoning, ambiguous questions, and knowledge not in the docs. We’ve seen three failure modes in production.&lt;/p&gt;
&lt;h3 id=&quot;hallucination&quot;&gt;Hallucination&lt;/h3&gt;
&lt;p&gt;The LLM invents answers not in the retrieved chunks. Mitigation: constrain responses to retrieved context only, and surface source citations with document name and page number for every answer. In compliance contexts, citations are not a UX nicety; they are an audit trail. A user who can see “Error Message Reference v11.1.1, p. 126” can verify, escalate, or dispute the answer. A context-window dump cannot produce that chain of custody.&lt;/p&gt;
&lt;h3 id=&quot;context-overflow&quot;&gt;Context Overflow&lt;/h3&gt;
&lt;p&gt;Complex queries need more context than fits in the LLM’s window. Mitigation: break queries into sub-questions, use query expansion for domain terms, implement multi-hop retrieval for connected concepts.&lt;/p&gt;
&lt;h3 id=&quot;drift&quot;&gt;Drift&lt;/h3&gt;
&lt;p&gt;Two kinds of drift affect production RAG. Data drift: documentation changes but embeddings don’t update; mitigate with hash-based cache invalidation for PDFs and timestamp-based re-indexing for markdown. Model drift: generation changes between model versions (or silent provider-side updates) alter answer tone and structure, requiring prompt recalibration. Maintain a regression test set of known queries and expected answers; run it on every model or prompt change.&lt;/p&gt;
&lt;h3 id=&quot;corpus-limitations&quot;&gt;Corpus Limitations&lt;/h3&gt;
&lt;p&gt;Not all failures are system failures. The evaluation revealed three corpus-related issues:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Corpus gap&lt;/strong&gt;: Knowledge doesn’t exist (e.g., specific error codes not documented). The system correctly responds “I don’t know.”&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Scattered information&lt;/strong&gt;: Knowledge exists but spread across sections, making synthesis incomplete.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Query formulation&lt;/strong&gt;: Symptom-based queries (“out of memory errors”) outperform code-based queries (“error 1012001”) when exact codes aren’t indexed.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;These are honest limitations, not RAG failures. The mitigation is corpus expansion, not system tuning.&lt;/p&gt;
&lt;h3 id=&quot;what-is-the-overall-failure-rate&quot;&gt;What Is the Overall Failure Rate?&lt;/h3&gt;
&lt;p&gt;12.5% of queries (4 of 32) need human review, primarily for multi-step reasoning or ambiguous questions. The alternative is searching 7,432 pages manually. RAG handles the straightforward cases autonomously, while experts focus on edge cases.&lt;/p&gt;



































&lt;table tabindex=&quot;0&quot;&gt;&lt;caption&gt;&lt;strong&gt;Table 3:&lt;/strong&gt; 32 scored queries across 4 categories (n=8 each), 98.1% ground truth accuracy, 0% false positive rate. Success rate includes partial matches. (&lt;a href=&quot;https://doi.org/10.5281/zenodo.19056880&quot;&gt;methodology&lt;/a&gt;).&lt;/caption&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Query Category&lt;/th&gt;&lt;th&gt;Success Rate&lt;/th&gt;&lt;th&gt;Common Failure Mode&lt;/th&gt;&lt;th&gt;Mitigation&lt;/th&gt;&lt;/tr&gt;&lt;/thead&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;Error lookup&lt;/td&gt;&lt;td&gt;62%&lt;/td&gt;&lt;td&gt;Exact code not in corpus&lt;/td&gt;&lt;td&gt;Symptom-based queries; corpus expansion&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Conceptual&lt;/td&gt;&lt;td&gt;100%&lt;/td&gt;&lt;td&gt;Rare; scattered information&lt;/td&gt;&lt;td&gt;Query expansion with domain terms&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Procedural&lt;/td&gt;&lt;td&gt;100%&lt;/td&gt;&lt;td&gt;None observed (n=8)&lt;/td&gt;&lt;td&gt;Query expansion with command names&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Multi-hop&lt;/td&gt;&lt;td&gt;88%&lt;/td&gt;&lt;td&gt;Knowledge scattered or missing&lt;/td&gt;&lt;td&gt;Corpus expansion; honest “not found”&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;
&lt;p&gt;The operational metric that matters in compliance settings is not internal test accuracy; it is the expert adjustment rate: the percentage of answers a subject-matter expert had to correct before use. Every point of improvement here maps directly to labor cost avoided and liability reduced.&lt;/p&gt;
&lt;h2 id=&quot;how-do-you-migrate-from-prototype-to-production&quot;&gt;How Do You Migrate from Prototype to Production?&lt;/h2&gt;
&lt;p&gt;We started on OpenRouter’s free tier. Model: Devstral-2512. Cost: $0. Limits: rate-limited, no compliance guarantees. We validated quality with 20-30 test queries.&lt;/p&gt;
&lt;p&gt;Migration to Amazon Bedrock took under 30 minutes. Code changes: swap dependencies (langchain-openai to langchain-aws), replace ChatOpenAI with ChatBedrock, update authentication to use AWS credentials instead of API keys. Benefits: no rate limits, SOC 2 compliance, governance controls, better answer quality from Claude Haiku 4.5.&lt;/p&gt;
&lt;p&gt;The migration path: start small with one document set and one use case. Validate quality with test queries comparing RAG answers to ground truth from source documents. Measure adoption by tracking query volume and user feedback. Iterate by adding more docs, tuning chunking strategy, and improving retrieval.&lt;/p&gt;
&lt;figure&gt;&lt;img alt=&quot;Migration Path&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; sizes=&quot;(min-width: 380px) 380px, 100vw&quot; data-astro-image=&quot;constrained&quot; data-astro-image-pos=&quot;center&quot; width=&quot;380&quot; height=&quot;599&quot; src=&quot;/_astro/migration-path.A3JMcUUq_Z1ceJ8w.svg&quot; srcset=&quot;/_astro/migration-path.A3JMcUUq_Z1ceJ8w.svg 380w&quot;&gt;&lt;figcaption&gt;&lt;strong&gt;Figure 2:&lt;/strong&gt; Migration path from free tier validation to enterprise production (iterate on quality before investing in infrastructure).&lt;/figcaption&gt;&lt;/figure&gt;
&lt;p&gt;A common alternative at this stage is an AI agent that searches a file system directly. Agents work when the corpus is small and well-structured. When document volume grows, query specificity demands ranked retrieval, or answers require a citable source, a proper retrieval pipeline outperforms file-system search. The compliance argument is unambiguous: agents browsing files produce no provenance record.&lt;/p&gt;
&lt;h2 id=&quot;what-should-you-do-next&quot;&gt;What Should You Do Next?&lt;/h2&gt;
&lt;p&gt;Identify high-value document sets. Look for onboarding materials, compliance docs, or migration guides. Estimate ROI using queries per day, time saved per query, and hourly labor cost. If the math works, start with a free tier.&lt;/p&gt;
&lt;p&gt;Use OpenRouter or local models for validation. Run 20-30 test queries. Compare RAG answers to ground truth from source documents. Measure accuracy, check for hallucinations, verify source citations. If quality is acceptable, invest in enterprise infrastructure.&lt;/p&gt;
&lt;p&gt;Amazon Bedrock and Azure OpenAI offer compliance, governance, and better models. Cost is $0.01-0.05 per query. For 100 queries per day, that’s $1-5 daily or $30-150 monthly. Compare that to $9,000 in labor savings.&lt;/p&gt;
&lt;p&gt;The decision framework: RAG wins when documentation changes frequently, source citations matter for compliance, or you need operational agility. Fine-tuning wins when knowledge is stable, you need specialized behavior beyond retrieval, or query volume is extreme (thousands per day) with strict latency requirements.&lt;/p&gt;
&lt;p&gt;For legacy systems, RAG delivers ROI without modernization. No need to rewrite docs, migrate databases, or retrain staff. Layer RAG over existing PDFs and get 3-second answers to 20-year-old questions.&lt;/p&gt;
&lt;hr&gt;
&lt;p&gt;For broader integration patterns and ROI frameworks, see &lt;a href=&quot;/posts/ai-agents-legacy-roi&quot;&gt;AI Agents in Legacy Systems: ROI Without Modernization&lt;/a&gt;.&lt;/p&gt;
&lt;hr&gt;
&lt;h2 id=&quot;references&quot;&gt;References&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Braintrust, “RAG Evaluation Metrics: How to Evaluate Your RAG Pipeline” (2025) — &lt;a href=&quot;https://www.braintrust.dev/articles/rag-evaluation-metrics&quot;&gt;https://www.braintrust.dev/articles/rag-evaluation-metrics&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Clouatre, H., “RAG Reranking Benchmarks: Supplementary Materials” (2026) — &lt;a href=&quot;https://doi.org/10.5281/zenodo.19056880&quot;&gt;https://doi.org/10.5281/zenodo.19056880&lt;/a&gt; — &lt;a href=&quot;https://github.com/clouatre-labs/rag-reranking-benchmarks&quot;&gt;https://github.com/clouatre-labs/rag-reranking-benchmarks&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;de Luis Balaguer et al., “RAG vs Fine-tuning: Pipelines, Tradeoffs, and a Case Study on Agriculture” (2024) — &lt;a href=&quot;https://arxiv.org/abs/2401.08406&quot;&gt;https://arxiv.org/abs/2401.08406&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Dettmers et al., “QLoRA: Efficient Finetuning of Quantized LLMs” (2023) — &lt;a href=&quot;https://arxiv.org/abs/2305.14314&quot;&gt;https://arxiv.org/abs/2305.14314&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Gan et al., “Retrieval Augmented Generation Evaluation in the Era of Large Language Models: A Comprehensive Survey” (2025) — &lt;a href=&quot;https://arxiv.org/abs/2504.14891&quot;&gt;https://arxiv.org/abs/2504.14891&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;George, Sherine, “Enhancing Retrieval-Augmented Generation with Two-Stage Retrieval: FlashRank Reranking and Query Expansion” (2025) — &lt;a href=&quot;https://arxiv.org/abs/2601.03258&quot;&gt;https://arxiv.org/abs/2601.03258&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;LangChain Documentation, “Contextual Compression and Reranking” (2025) — &lt;a href=&quot;https://python.langchain.com/docs/how_to/contextual_compression/&quot;&gt;https://python.langchain.com/docs/how_to/contextual_compression/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Mandikal &amp;#x26; Mooney, “Sparse Meets Dense: A Hybrid Approach to Enhance Scientific Document Retrieval” (2024) — &lt;a href=&quot;https://arxiv.org/abs/2401.04055&quot;&gt;https://arxiv.org/abs/2401.04055&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Oche et al., “A Systematic Review of Key Retrieval-Augmented Generation (RAG) Systems: Progress, Gaps, and Future Directions” (2025) — &lt;a href=&quot;https://arxiv.org/abs/2507.18910&quot;&gt;https://arxiv.org/abs/2507.18910&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Thunder Compute, “AI GPU Rental Market Trends December 2025: Complete Industry Analysis” (2025) — &lt;a href=&quot;https://www.thundercompute.com/blog/ai-gpu-rental-market-trends&quot;&gt;https://www.thundercompute.com/blog/ai-gpu-rental-market-trends&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</content:encoded><category>agentic-ai</category><category>legacy-systems</category><category>case-studies</category><author>Hugues Clouâtre</author></item><item><title>AI Agents in Legacy Systems: ROI Without Modernization</title><link>https://clouatre.ca/posts/ai-agents-legacy-roi/</link><guid isPermaLink="true">https://clouatre.ca/posts/ai-agents-legacy-roi/</guid><description>Layer AI agents over legacy systems without modernization. 30-80% productivity gains in 3-6 months. Patterns that bypass technical debt.</description><pubDate>Sat, 20 Jun 2026 00:00:00 GMT</pubDate><content:encoded>&lt;p&gt;You run a company with SAP, mainframe, or AS400 systems that work but won’t win awards. The board wants AI. Your team wants modernization budgets. You’re stuck in the middle.&lt;/p&gt;
&lt;p&gt;Every AI agent case study assumes clean APIs, cloud-native apps, and real-time data. Your world is batch jobs, COBOL, and integration layers built in 2003. The conventional answer is “modernize first, then AI.” That’s a 2-5 year, $5M-$50M bet before you prove a single dollar of AI value.&lt;/p&gt;
&lt;p&gt;This post shows where AI agents make economic sense &lt;em&gt;on top of&lt;/em&gt; legacy systems, how to measure ROI without enterprise-wide transformation, and which integrations work when your data lives in places LLMs have never heard of. You’ll walk away with a decision framework for identifying agent use cases that pay back in quarters, not years.&lt;/p&gt;
&lt;h2 id=&quot;table-of-contents&quot;&gt;Table of contents&lt;/h2&gt;
&lt;p&gt;&lt;/p&gt;&lt;details&gt;&lt;summary&gt;Contents&lt;/summary&gt;&lt;p&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;#why-legacy-systems-became-the-1-ai-adoption-obstacle&quot;&gt;Why Legacy Systems Became the #1 AI Adoption Obstacle&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#the-reverse-modernization-strategy-layer-ai-first-upgrade-later&quot;&gt;The Reverse Modernization Strategy: Layer AI First, Upgrade Later&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;#why-this-works&quot;&gt;Why This Works&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#when-reverse-modernization-doesnt-apply&quot;&gt;When Reverse Modernization Doesn’t Apply&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#how-do-ai-agents-actually-integrate-with-legacy-systems&quot;&gt;How Do AI Agents Actually Integrate with Legacy Systems?&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;#api-mediation-layer&quot;&gt;API Mediation Layer&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#event-driven-architecture&quot;&gt;Event-Driven Architecture&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#model-context-protocol-mcp&quot;&gt;Model Context Protocol (MCP)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#which-pattern-should-you-choose&quot;&gt;Which Pattern Should You Choose?&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#when-to-consider-platform-level-solutions&quot;&gt;When to Consider Platform-Level Solutions&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#why-observability-infrastructure-is-non-negotiable&quot;&gt;Why Observability Infrastructure Is Non-Negotiable&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;#why-log-everything&quot;&gt;Why Log Everything?&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#integration-health-metrics&quot;&gt;Integration Health Metrics&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#agent-performance-metrics&quot;&gt;Agent Performance Metrics&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#how-do-you-measure-decision-accuracy&quot;&gt;How Do You Measure Decision Accuracy?&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#business-impact-metrics&quot;&gt;Business Impact Metrics&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#what-roi-can-you-actually-expect&quot;&gt;What ROI Can You Actually Expect?&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#why-do-40-of-ai-agent-projects-still-fail&quot;&gt;Why Do 40% of AI Agent Projects Still Fail?&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#how-to-start-a-practical-implementation-framework&quot;&gt;How to Start: A Practical Implementation Framework&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#why-should-your-board-fund-this-now&quot;&gt;Why Should Your Board Fund This Now?&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#references&quot;&gt;References&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;/p&gt;&lt;/details&gt;&lt;p&gt;&lt;/p&gt;
&lt;h2 id=&quot;why-legacy-systems-became-the-1-ai-adoption-obstacle&quot;&gt;Why Legacy Systems Became the #1 AI Adoption Obstacle&lt;/h2&gt;
&lt;p&gt;Legacy systems top the list of AI adoption obstacles, but the conventional fix is worse than the problem. Traditional modernization projects require multi-year timelines and eight-figure budgets before proving a single dollar of AI value. No wonder &lt;a href=&quot;https://www.gartner.com/en/newsroom/press-releases/2025-06-25-gartner-predicts-over-40-percent-of-agentic-ai-projects-will-be-canceled-by-end-of-2027&quot;&gt;40% of agentic AI projects will be canceled by 2027&lt;/a&gt; (Gartner, 2025) due to escalating costs and unclear business value.&lt;/p&gt;
&lt;p&gt;The real bottleneck isn’t legacy systems. It’s the false choice between “modernize everything” and “do nothing.” You need integration patterns that work with what you have.&lt;/p&gt;
&lt;h2 id=&quot;the-reverse-modernization-strategy-layer-ai-first-upgrade-later&quot;&gt;The Reverse Modernization Strategy: Layer AI First, Upgrade Later&lt;/h2&gt;
&lt;p&gt;Layer AI agents over existing systems first. Capture ROI in months, then fund selective modernization. Prove value before investing in infrastructure.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://www.allianz.com/en/mediacenter/news/articles/251103-when-the-storm-clears-so-should-the-claim-queue.html&quot;&gt;Allianz’s Project Nemo reduced food spoilage claims processing from four or more days to hours&lt;/a&gt; (Allianz, 2025), an 80% reduction, using seven specialized agents with a human making the final payout decision. The business case was proven before committing to deeper modernization.&lt;/p&gt;
&lt;h3 id=&quot;why-this-works&quot;&gt;Why This Works&lt;/h3&gt;
&lt;p&gt;Reverse modernization works because legacy systems keep running (no disruption), ROI arrives in 3-6 months (30-80% productivity gains), and you start small: one workflow, one team, one agent.&lt;/p&gt;
&lt;p&gt;Modernization is a binary bet. Agent layering is incremental: prove value, fund upgrades, repeat.&lt;/p&gt;
&lt;h3 id=&quot;when-reverse-modernization-doesnt-apply&quot;&gt;When Reverse Modernization Doesn’t Apply&lt;/h3&gt;
&lt;p&gt;Three scenarios require modernization first. &lt;strong&gt;End-of-life systems&lt;/strong&gt; without vendor support expose you to &lt;a href=&quot;https://cybersnowden.com/difference-between-end-of-life-and-legacy-cyber-security/&quot;&gt;compliance violations and security breaches&lt;/a&gt; (Cyber Snowden, 2026). Agent integration can’t fix missing security patches. &lt;strong&gt;Regulatory mandates&lt;/strong&gt; that explicitly require infrastructure upgrades (e.g., PCI-DSS 4.0, GDPR data residency) make layering non-compliant. &lt;strong&gt;Systems scheduled for decommissioning&lt;/strong&gt; within 12 months don’t justify integration investment. In these cases, accelerate modernization or sunset the system entirely.&lt;/p&gt;
&lt;p&gt;For everything else, reverse modernization applies.&lt;/p&gt;
&lt;figure&gt;&lt;img alt=&quot;Reverse modernization flow showing AI agents layered first, generating ROI, then funding selective infrastructure upgrades&quot; loading=&quot;eager&quot; decoding=&quot;sync&quot; fetchpriority=&quot;high&quot; sizes=&quot;(min-width: 216px) 216px, 100vw&quot; data-astro-image=&quot;constrained&quot; data-astro-image-pos=&quot;center&quot; width=&quot;216&quot; height=&quot;622&quot; src=&quot;/_astro/reverse-modernization-flow.COxLfdoV_Z2rdWl0.svg&quot; srcset=&quot;/_astro/reverse-modernization-flow.COxLfdoV_Z2rdWl0.svg 216w&quot;&gt;&lt;figcaption&gt;&lt;strong&gt;Figure 1:&lt;/strong&gt; Reverse modernization flow (agents first, infrastructure later)&lt;/figcaption&gt;&lt;/figure&gt;
&lt;h2 id=&quot;how-do-ai-agents-actually-integrate-with-legacy-systems&quot;&gt;How Do AI Agents Actually Integrate with Legacy Systems?&lt;/h2&gt;
&lt;p&gt;But integration is where most projects fail. Agents need access to data and business logic buried in legacy systems. You have three options. Each has tradeoffs.&lt;/p&gt;
&lt;h3 id=&quot;api-mediation-layer&quot;&gt;API Mediation Layer&lt;/h3&gt;
&lt;p&gt;Build a facade that abstracts legacy complexity. Agents interact with clean, modern interfaces while the mediation layer handles authentication, data translation (EBCDIC to UTF-8, fixed-width to JSON), and error handling. When the legacy system changes, you update the facade, not the agents. You also get a single point for logging, monitoring, and compliance audits.&lt;/p&gt;
&lt;figure&gt;&lt;figcaption&gt;&lt;strong&gt;Code Snippet 1:&lt;/strong&gt; FastAPI facade translates COBOL fixed-width records to validated JSON.&lt;/figcaption&gt;&lt;pre class=&quot;astro-code astro-code-themes catppuccin-latte catppuccin-macchiato has-highlighted mt-8&quot; style=&quot;--shiki-light:#4c4f69; --shiki-dark:#cad3f5; --shiki-light-bg:#eff1f5; --shiki-dark-bg:#24273a; --file-name-offset: -0.75rem&quot; tabindex=&quot;0&quot; data-language=&quot;python&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-dark:#C6A0F6&quot;&gt;from&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt; fastapi &lt;/span&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-dark:#C6A0F6&quot;&gt;import&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt; FastAPI&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-dark:#C6A0F6&quot;&gt;from&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt; pydantic &lt;/span&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-dark:#C6A0F6&quot;&gt;import&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt; BaseModel&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-dark:#C6A0F6&quot;&gt;class&lt;/span&gt;&lt;span style=&quot;--shiki-light:#DF8E1D;--shiki-light-font-style:italic;--shiki-dark:#EED49F;--shiki-dark-font-style:italic&quot;&gt; Customer&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--shiki-light:#DF8E1D;--shiki-light-font-style:italic;--shiki-dark:#EED49F;--shiki-dark-font-style:italic&quot;&gt;BaseModel&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;):&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-light-font-style:italic;--shiki-dark:#939AB7;--shiki-dark-font-style:italic&quot;&gt;  # Modern JSON schema&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#FE640B;--shiki-light-font-style:italic;--shiki-dark:#F5A97F;--shiki-dark-font-style:italic&quot;&gt;    id&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-light-font-style:italic;--shiki-dark:#C6A0F6;--shiki-dark-font-style:italic&quot;&gt; str&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;    name&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-light-font-style:italic;--shiki-dark:#C6A0F6;--shiki-dark-font-style:italic&quot;&gt; str&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;    balance&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-light-font-style:italic;--shiki-dark:#C6A0F6;--shiki-dark-font-style:italic&quot;&gt; float&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#FE640B;--shiki-light-font-style:italic;--shiki-dark:#F5A97F;--shiki-dark-font-style:italic&quot;&gt;@app&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;--shiki-light:#FE640B;--shiki-light-font-style:italic;--shiki-dark:#F5A97F;--shiki-dark-font-style:italic&quot;&gt;get&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;&quot;/customers/&lt;/span&gt;&lt;span style=&quot;--shiki-light:#EA76CB;--shiki-dark:#F5BDE6&quot;&gt;{customer_id}&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;--shiki-light:#E64553;--shiki-light-font-style:italic;--shiki-dark:#EE99A0;--shiki-dark-font-style:italic&quot;&gt; response_model&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;Customer&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-dark:#C6A0F6&quot;&gt;async&lt;/span&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-dark:#C6A0F6&quot;&gt; def&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-light-font-style:italic;--shiki-dark:#8AADF4;--shiki-dark-font-style:italic&quot;&gt; get_customer&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--shiki-light:#E64553;--shiki-light-font-style:italic;--shiki-dark:#EE99A0;--shiki-dark-font-style:italic&quot;&gt;customer_id&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-light-font-style:italic;--shiki-dark:#C6A0F6;--shiki-dark-font-style:italic&quot;&gt; str&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt; -&gt;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt; Customer&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line highlighted&quot;&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;    raw &lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt; legacy_client&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;call&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;&quot;CUSTINQ&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt; customer_id&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;ljust&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--shiki-light:#FE640B;--shiki-dark:#F5A97F&quot;&gt;10&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;))&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-dark:#C6A0F6&quot;&gt;    return&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt; Customer&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;(&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#E64553;--shiki-light-font-style:italic;--shiki-dark:#EE99A0;--shiki-dark-font-style:italic&quot;&gt;        id&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--shiki-light:#E64553;--shiki-light-font-style:italic;--shiki-dark:#EE99A0;--shiki-dark-font-style:italic&quot;&gt;raw&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;--shiki-light:#FE640B;--shiki-light-font-style:italic;--shiki-dark:#F5A97F;--shiki-dark-font-style:italic&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#FE640B;--shiki-light-font-style:italic;--shiki-dark:#F5A97F;--shiki-dark-font-style:italic&quot;&gt;10&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;].&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;strip&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;(),&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line highlighted&quot;&gt;&lt;span style=&quot;--shiki-light:#E64553;--shiki-light-font-style:italic;--shiki-dark:#EE99A0;--shiki-dark-font-style:italic&quot;&gt;        name&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--shiki-light:#E64553;--shiki-light-font-style:italic;--shiki-dark:#EE99A0;--shiki-dark-font-style:italic&quot;&gt;raw&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;--shiki-light:#FE640B;--shiki-light-font-style:italic;--shiki-dark:#F5A97F;--shiki-dark-font-style:italic&quot;&gt;10&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#FE640B;--shiki-light-font-style:italic;--shiki-dark:#F5A97F;--shiki-dark-font-style:italic&quot;&gt;40&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;].&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;encode&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;&quot;cp037&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;).&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;decode&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;&quot;utf-8&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;),&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-light-font-style:italic;--shiki-dark:#939AB7;--shiki-dark-font-style:italic&quot;&gt;  # EBCDIC to UTF-8  &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#E64553;--shiki-light-font-style:italic;--shiki-dark:#EE99A0;--shiki-dark-font-style:italic&quot;&gt;        balance&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-light-font-style:italic;--shiki-dark:#C6A0F6;--shiki-dark-font-style:italic&quot;&gt;int&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--shiki-light:#E64553;--shiki-light-font-style:italic;--shiki-dark:#EE99A0;--shiki-dark-font-style:italic&quot;&gt;raw&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;--shiki-light:#FE640B;--shiki-light-font-style:italic;--shiki-dark:#F5A97F;--shiki-dark-font-style:italic&quot;&gt;40&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#FE640B;--shiki-light-font-style:italic;--shiki-dark:#F5A97F;--shiki-dark-font-style:italic&quot;&gt;52&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;])&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt; /&lt;/span&gt;&lt;span style=&quot;--shiki-light:#FE640B;--shiki-dark:#F5A97F&quot;&gt; 100&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-light-font-style:italic;--shiki-dark:#939AB7;--shiki-dark-font-style:italic&quot;&gt;  # Packed decimal&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;    )&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;span class=&quot;absolute py-1 text-foreground text-xs font-medium leading-4 pl-4 pr-2 before:inline-block before:size-1 before:bg-green-500 before:rounded-full before:absolute before:top-[45%] before:left-2 left-2 top-(--file-name-offset) border rounded-md bg-background&quot;&gt;mediation/legacy_facade.py&lt;/span&gt;&lt;/pre&gt;&lt;/figure&gt;
&lt;h3 id=&quot;event-driven-architecture&quot;&gt;Event-Driven Architecture&lt;/h3&gt;
&lt;p&gt;Legacy systems publish state changes through &lt;strong&gt;Dapr&lt;/strong&gt;, which supports Kafka, Azure Event Hub, and others. Agents subscribe and react in near real-time. This pattern scales better than API mediation: the system pushes updates when they matter instead of agents polling constantly. &lt;strong&gt;Dapr’s abstraction avoids vendor lock-in.&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;The tradeoff: you need to instrument the legacy system to publish events, which isn’t trivial if the system is old and undocumented.&lt;/p&gt;
&lt;figure&gt;&lt;figcaption&gt;&lt;strong&gt;Code Snippet 2:&lt;/strong&gt; Dapr subscriber receives legacy system events via CloudEvents (swap Kafka/RabbitMQ/Azure without code changes).&lt;/figcaption&gt;&lt;pre class=&quot;astro-code astro-code-themes catppuccin-latte catppuccin-macchiato has-highlighted mt-8&quot; style=&quot;--shiki-light:#4c4f69; --shiki-dark:#cad3f5; --shiki-light-bg:#eff1f5; --shiki-dark-bg:#24273a; --file-name-offset: -0.75rem&quot; tabindex=&quot;0&quot; data-language=&quot;python&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-dark:#C6A0F6&quot;&gt;from&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt; dapr&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;ext&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;grpc &lt;/span&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-dark:#C6A0F6&quot;&gt;import&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt; App&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-dark:#C6A0F6&quot;&gt;from&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt; cloudevents&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;sdk&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;event &lt;/span&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-dark:#C6A0F6&quot;&gt;import&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt; v1&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-dark:#C6A0F6&quot;&gt;import&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt; json&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;app &lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt; App&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;()&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line highlighted&quot;&gt;&lt;span style=&quot;--shiki-light:#FE640B;--shiki-light-font-style:italic;--shiki-dark:#F5A97F;--shiki-dark-font-style:italic&quot;&gt;@app&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;--shiki-light:#FE640B;--shiki-light-font-style:italic;--shiki-dark:#F5A97F;--shiki-dark-font-style:italic&quot;&gt;subscribe&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--shiki-light:#E64553;--shiki-light-font-style:italic;--shiki-dark:#EE99A0;--shiki-dark-font-style:italic&quot;&gt;pubsub_name&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;&quot;legacy-events&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;--shiki-light:#E64553;--shiki-light-font-style:italic;--shiki-dark:#EE99A0;--shiki-dark-font-style:italic&quot;&gt; topic&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;&quot;orders&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-dark:#C6A0F6&quot;&gt;def&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-light-font-style:italic;--shiki-dark:#8AADF4;--shiki-dark-font-style:italic&quot;&gt; handle_order&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--shiki-light:#E64553;--shiki-light-font-style:italic;--shiki-dark:#EE99A0;--shiki-dark-font-style:italic&quot;&gt;event&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#E64553;--shiki-dark:#EE99A0&quot;&gt; v1&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;--shiki-light:#E64553;--shiki-dark:#EE99A0&quot;&gt;Event&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt; -&gt;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#FE640B;--shiki-dark:#F5A97F&quot;&gt; None&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line highlighted&quot;&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;    data &lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt; json&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;loads&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;event&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;Data&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;())&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-light-font-style:italic;--shiki-dark:#939AB7;--shiki-dark-font-style:italic&quot;&gt;  # CloudEvents envelope  &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-light-font-style:italic;--shiki-dark:#939AB7;--shiki-dark-font-style:italic&quot;&gt;    # Agent processes order without polling legacy system&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;    agent&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;process_order&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--shiki-light:#E64553;--shiki-light-font-style:italic;--shiki-dark:#EE99A0;--shiki-dark-font-style:italic&quot;&gt;data&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-light-font-style:italic;--shiki-dark:#A6DA95;--shiki-dark-font-style:italic&quot;&gt;order_id&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;],&lt;/span&gt;&lt;span style=&quot;--shiki-light:#E64553;--shiki-light-font-style:italic;--shiki-dark:#EE99A0;--shiki-dark-font-style:italic&quot;&gt; data&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-light-font-style:italic;--shiki-dark:#A6DA95;--shiki-dark-font-style:italic&quot;&gt;customer_id&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;])&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;app&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;run&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--shiki-light:#FE640B;--shiki-dark:#F5A97F&quot;&gt;6002&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;)&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;span class=&quot;absolute py-1 text-foreground text-xs font-medium leading-4 pl-4 pr-2 before:inline-block before:size-1 before:bg-green-500 before:rounded-full before:absolute before:top-[45%] before:left-2 left-2 top-(--file-name-offset) border rounded-md bg-background&quot;&gt;events/order_subscriber.py&lt;/span&gt;&lt;/pre&gt;&lt;/figure&gt;
&lt;h3 id=&quot;model-context-protocol-mcp&quot;&gt;Model Context Protocol (MCP)&lt;/h3&gt;
&lt;p&gt;Anthropic’s open standard for agent-to-data connections. You write one MCP server for your legacy system, and any agent can use it. No custom integration code for each agent. This matters when coordinating multiple agents, a problem I’ve written about in &lt;a href=&quot;/posts/orchestrating-ai-agents-subagent-architecture&quot;&gt;orchestrating multiple AI agents with subagent architecture&lt;/a&gt;.&lt;/p&gt;
&lt;figure&gt;&lt;figcaption&gt;&lt;strong&gt;Code Snippet 3:&lt;/strong&gt; FastMCP 3.0 server exposes legacy data to any MCP-compatible agent (one server, many agents).&lt;/figcaption&gt;&lt;pre class=&quot;astro-code astro-code-themes catppuccin-latte catppuccin-macchiato has-highlighted mt-8&quot; style=&quot;--shiki-light:#4c4f69; --shiki-dark:#cad3f5; --shiki-light-bg:#eff1f5; --shiki-dark-bg:#24273a; --file-name-offset: -0.75rem&quot; tabindex=&quot;0&quot; data-language=&quot;python&quot;&gt;&lt;code&gt;&lt;span class=&quot;line highlighted&quot;&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-dark:#C6A0F6&quot;&gt;from&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt; fastmcp &lt;/span&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-dark:#C6A0F6&quot;&gt;import&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt; FastMCP  &lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-light-font-style:italic;--shiki-dark:#939AB7;--shiki-dark-font-style:italic&quot;&gt;# FastMCP 3.0  &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;mcp &lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt; FastMCP&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;&quot;Legacy ERP&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line highlighted&quot;&gt;&lt;span style=&quot;--shiki-light:#FE640B;--shiki-light-font-style:italic;--shiki-dark:#F5A97F;--shiki-dark-font-style:italic&quot;&gt;@mcp&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;--shiki-light:#FE640B;--shiki-light-font-style:italic;--shiki-dark:#F5A97F;--shiki-dark-font-style:italic&quot;&gt;tool&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-dark:#C6A0F6&quot;&gt;def&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-light-font-style:italic;--shiki-dark:#8AADF4;--shiki-dark-font-style:italic&quot;&gt; query_customer&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--shiki-light:#E64553;--shiki-light-font-style:italic;--shiki-dark:#EE99A0;--shiki-dark-font-style:italic&quot;&gt;customer_id&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-light-font-style:italic;--shiki-dark:#C6A0F6;--shiki-dark-font-style:italic&quot;&gt; str&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt; -&gt;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-light-font-style:italic;--shiki-dark:#C6A0F6;--shiki-dark-font-style:italic&quot;&gt; str&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;    &quot;&quot;&quot;Query customer from mainframe. Any MCP-compatible agent can call this.&quot;&quot;&quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;    result &lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt; mainframe_client&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;execute&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-light-font-style:italic;--shiki-dark:#A6DA95;--shiki-dark-font-style:italic&quot;&gt;f&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;&quot;SELECT * FROM CUSTMAST WHERE ID=&apos;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#EA76CB;--shiki-dark:#F5BDE6&quot;&gt;{&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;customer_id&lt;/span&gt;&lt;span style=&quot;--shiki-light:#EA76CB;--shiki-dark:#F5BDE6&quot;&gt;}&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;&apos;&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-dark:#C6A0F6&quot;&gt;    return&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt; json&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;dumps&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;result&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-dark:#C6A0F6&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt; __name__ &lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;==&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; &quot;__main__&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;    mcp&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;run&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--shiki-light:#E64553;--shiki-light-font-style:italic;--shiki-dark:#EE99A0;--shiki-dark-font-style:italic&quot;&gt;transport&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;&quot;http&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;--shiki-light:#E64553;--shiki-light-font-style:italic;--shiki-dark:#EE99A0;--shiki-dark-font-style:italic&quot;&gt; port&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--shiki-light:#FE640B;--shiki-dark:#F5A97F&quot;&gt;8000&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-light-font-style:italic;--shiki-dark:#939AB7;--shiki-dark-font-style:italic&quot;&gt;  # Remote agents connect via HTTP&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;span class=&quot;absolute py-1 text-foreground text-xs font-medium leading-4 pl-4 pr-2 before:inline-block before:size-1 before:bg-green-500 before:rounded-full before:absolute before:top-[45%] before:left-2 left-2 top-(--file-name-offset) border rounded-md bg-background&quot;&gt;mcp/legacy_server.py&lt;/span&gt;&lt;/pre&gt;&lt;/figure&gt;
&lt;h3 id=&quot;which-pattern-should-you-choose&quot;&gt;Which Pattern Should You Choose?&lt;/h3&gt;
&lt;p&gt;The patterns above work differently from platform solutions. You build lightweight facades around legacy systems using open tools (FastAPI, Dapr, MCP). Implementation takes weeks, not quarters. You prove value before committing to platforms.&lt;/p&gt;

























&lt;table tabindex=&quot;0&quot;&gt;&lt;caption&gt;&lt;strong&gt;Table 1:&lt;/strong&gt; Integration pattern selection guide&lt;/caption&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Pattern&lt;/th&gt;&lt;th&gt;Best When&lt;/th&gt;&lt;th&gt;Timeline&lt;/th&gt;&lt;/tr&gt;&lt;/thead&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;API Mediation&lt;/td&gt;&lt;td&gt;Stable APIs, 1-2 agents, tight control needed&lt;/td&gt;&lt;td&gt;4-8 weeks&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Event-Driven&lt;/td&gt;&lt;td&gt;1,000+ transactions/hour, sub-second response&lt;/td&gt;&lt;td&gt;8-12 weeks&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;MCP&lt;/td&gt;&lt;td&gt;3+ agents, standardization priority&lt;/td&gt;&lt;td&gt;6-12 weeks&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;
&lt;h3 id=&quot;when-to-consider-platform-level-solutions&quot;&gt;When to Consider Platform-Level Solutions&lt;/h3&gt;
&lt;p&gt;Enterprise platforms like Palantir Foundry take a different approach: containerizing legacy code itself through Foundry Container Engine (FCE). This “lift and shift” strategy &lt;a href=&quot;https://blog.palantir.com/safely-modernize-legacy-systems-with-palantir-foundry-container-engine-fce-d8900464da7c&quot;&gt;runs your COBOL or Fortran logic in a modern environment&lt;/a&gt; (Palantir, 2023) without rewriting it.&lt;/p&gt;
&lt;p&gt;The tradeoff is vendor commitment. Palantir engagements typically start at $1M+/year and require dedicated integration teams. For organizations with complex, multi-system landscapes and enterprise budgets, this can make sense.&lt;/p&gt;
&lt;p&gt;These approaches complement each other. Demonstrate ROI with integration patterns, then justify platform investments for deeper modernization. &lt;a href=&quot;https://www.deloitte.com/us/en/Industries/government-public/perspectives/deloitte-palantir-collaboration.html&quot;&gt;Deloitte calls this “data-first ERP modernization”&lt;/a&gt; (Deloitte, 2025).&lt;/p&gt;
&lt;figure&gt;&lt;img alt=&quot;Three integration patterns: API Mediation Layer (facade pattern), Event-Driven Architecture (message bus), and Model Context Protocol (MCP servers)&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; sizes=&quot;(min-width: 860px) 860px, 100vw&quot; data-astro-image=&quot;constrained&quot; data-astro-image-pos=&quot;center&quot; width=&quot;860&quot; height=&quot;640&quot; src=&quot;/_astro/integration-patterns.BZjqA_oC_107SrF.svg&quot; srcset=&quot;/_astro/integration-patterns.BZjqA_oC_y5cmE.svg 640w, /_astro/integration-patterns.BZjqA_oC_1ylcNn.svg 750w, /_astro/integration-patterns.BZjqA_oC_Z1lNGs2.svg 828w, /_astro/integration-patterns.BZjqA_oC_107SrF.svg 860w&quot;&gt;&lt;figcaption&gt;&lt;strong&gt;Figure 2:&lt;/strong&gt; Three integration patterns for legacy systems&lt;/figcaption&gt;&lt;/figure&gt;
&lt;h2 id=&quot;why-observability-infrastructure-is-non-negotiable&quot;&gt;Why Observability Infrastructure Is Non-Negotiable&lt;/h2&gt;
&lt;p&gt;Whatever integration pattern you choose, log everything. Every integration call. Every agent decision. Every error. This isn’t optional.&lt;/p&gt;
&lt;h3 id=&quot;why-log-everything&quot;&gt;Why Log Everything?&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Compliance&lt;/strong&gt;: Auditors ask “why did your agent approve this transaction?” You need logs showing the decision path.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Debugging&lt;/strong&gt;: When an agent fails, trace which integration call failed, what data it received, and why it made the wrong decision.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Developer autonomy&lt;/strong&gt;: Teams that can observe system behavior can configure and tune agents without waiting for platform intervention, a prerequisite for scaling agent ownership.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Track three categories of metrics.&lt;/p&gt;
&lt;h3 id=&quot;integration-health-metrics&quot;&gt;Integration Health Metrics&lt;/h3&gt;
&lt;p&gt;Monitor API latency (p50, p95, p99), error rates by type, and timeout frequency—metrics that align with &lt;a href=&quot;https://opentelemetry.io/docs/specs/semconv/gen-ai/&quot;&gt;OpenTelemetry GenAI conventions&lt;/a&gt;.&lt;/p&gt;
&lt;h3 id=&quot;agent-performance-metrics&quot;&gt;Agent Performance Metrics&lt;/h3&gt;
&lt;p&gt;These require deliberate instrumentation design. &lt;strong&gt;Task completion rate&lt;/strong&gt; needs a definition of “complete” per task type (e.g., “ticket resolved without escalation”). &lt;strong&gt;User satisfaction&lt;/strong&gt; comes from thumbs up/down on responses, escalation rate, and support ticket correlation. &lt;strong&gt;Decision accuracy&lt;/strong&gt; is the hardest to measure, see below.&lt;/p&gt;
&lt;h3 id=&quot;how-do-you-measure-decision-accuracy&quot;&gt;How Do You Measure Decision Accuracy?&lt;/h3&gt;
&lt;p&gt;Ground truth is often available. The question is where to find it.&lt;/p&gt;
&lt;p&gt;For &lt;strong&gt;RAG systems&lt;/strong&gt;, use &lt;a href=&quot;/posts/rag-legacy-systems/#what-is-the-overall-failure-rate&quot;&gt;categorized query benchmarks with validation subsets&lt;/a&gt;. Test accuracy by query type (conceptual, procedural, error lookup, multi-hop) since each fails differently.&lt;/p&gt;
&lt;p&gt;For &lt;strong&gt;approval workflows&lt;/strong&gt;, compare agent decisions against eventual outcomes. Was the approved invoice paid? Was the flagged transaction actually fraudulent? The business process itself provides ground truth.&lt;/p&gt;
&lt;p&gt;When &lt;strong&gt;ground truth is unavailable&lt;/strong&gt;, sample decisions for human or AI-assisted review. The question is: how many?&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Sample 300-400 decisions monthly.&lt;/strong&gt; For most systems this achieves +/-5% margin of error at 95% confidence (Cochran, 1977). For systems under 500 decisions/month, review all or accept wider uncertainty.&lt;/p&gt;
&lt;h3 id=&quot;business-impact-metrics&quot;&gt;Business Impact Metrics&lt;/h3&gt;
&lt;p&gt;Calculate these monthly against pre-deployment baselines. These are not real-time dashboard metrics:&lt;/p&gt;





















&lt;table tabindex=&quot;0&quot;&gt;&lt;caption&gt;&lt;strong&gt;Table 2:&lt;/strong&gt; Business impact calculation formulas&lt;/caption&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Metric&lt;/th&gt;&lt;th&gt;Formula&lt;/th&gt;&lt;/tr&gt;&lt;/thead&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;Response time reduction&lt;/td&gt;&lt;td&gt;Agent-handled avg vs. pre-deployment baseline&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Throughput increase&lt;/td&gt;&lt;td&gt;Tickets/hour after vs. before deployment&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Cost savings&lt;/td&gt;&lt;td&gt;(Hours saved x labor cost) - (API costs + infrastructure)&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;
&lt;p&gt;These metrics prove ROI and guide your next investments. For a complete observability implementation guide, see &lt;a href=&quot;/posts/ai-observability-gaps/&quot;&gt;closing the AI observability gap&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&quot;what-roi-can-you-actually-expect&quot;&gt;What ROI Can You Actually Expect?&lt;/h2&gt;
&lt;p&gt;The numbers are compelling. Let me walk through real examples.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://newsroom.bankofamerica.com/content/newsroom/press-releases/2025/08/a-decade-of-ai-innovation--bofa-s-virtual-assistant-erica-surpas.html&quot;&gt;Bank of America’s Erica reduced IT service desk calls by 50%&lt;/a&gt; (Bank of America, 2025) across 213,000 employees.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://www.bcg.com/publications/2026/agentic-ai-power-core-insurance-ai-modernization&quot;&gt;BCG reports AI can reduce core insurance modernization costs by 30-50%&lt;/a&gt; (BCG, 2026). Agents pay for themselves, then fund the upgrades.&lt;/p&gt;





























&lt;table tabindex=&quot;0&quot;&gt;&lt;caption&gt;&lt;strong&gt;Table 3:&lt;/strong&gt; ROI examples across integration patterns (note: API Mediation dominates early wins due to faster implementation)&lt;/caption&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Company&lt;/th&gt;&lt;th&gt;Pattern&lt;/th&gt;&lt;th&gt;Metric&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;Bank of America&lt;/td&gt;&lt;td&gt;API Mediation&lt;/td&gt;&lt;td&gt;IT Service Desk Calls&lt;/td&gt;&lt;td&gt;50% reduction&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Allianz (Project Nemo)&lt;/td&gt;&lt;td&gt;Event-Driven&lt;/td&gt;&lt;td&gt;Claims Processing Time&lt;/td&gt;&lt;td&gt;80% reduction (days to hours)&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;BCG research (cross-industry)&lt;/td&gt;&lt;td&gt;Any&lt;/td&gt;&lt;td&gt;Modernization cost reduction&lt;/td&gt;&lt;td&gt;30-50% lower operational costs&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;
&lt;h2 id=&quot;why-do-40-of-ai-agent-projects-still-fail&quot;&gt;Why Do 40% of AI Agent Projects Still Fail?&lt;/h2&gt;
&lt;p&gt;Projects fail when teams skip fundamentals.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Unclear Business Value.&lt;/strong&gt; &lt;a href=&quot;https://www.gartner.com/en/newsroom/press-releases/2025-06-25-gartner-predicts-over-40-percent-of-agentic-ai-projects-will-be-canceled-by-end-of-2027&quot;&gt;Gartner predicts over 40% of agentic AI projects will be canceled by 2027&lt;/a&gt; due to escalating costs, unclear value, and inadequate risk controls. Launching with vague goals like “improve productivity” makes it impossible to measure success. Define exact metrics before development: “Reduce invoice processing time from 8 days to 2 days while maintaining 99.5% accuracy” is measurable; “handle invoices better” is not.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Security Vulnerabilities.&lt;/strong&gt; &lt;a href=&quot;https://genai.owasp.org/llmrisk/llm01-prompt-injection/&quot;&gt;Prompt injection attacks are ranked #1 in OWASP 2025 Top 10 for LLMs&lt;/a&gt; (OWASP, 2025). Treat agents as privileged service accounts with these controls:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Tool allowlisting (no arbitrary network/file access)&lt;/li&gt;
&lt;li&gt;Schema validation on tool inputs/outputs&lt;/li&gt;
&lt;li&gt;Output sanitization (no untrusted content forwarded)&lt;/li&gt;
&lt;li&gt;Secrets isolation (no secrets in prompts; short-lived tokens)&lt;/li&gt;
&lt;li&gt;Rate limiting + anomaly detection&lt;/li&gt;
&lt;li&gt;Approval gates for high-impact actions&lt;/li&gt;
&lt;li&gt;Audit logs (immutable, centralized)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;A compromised agent can make thousands of requests per minute. For deeper coverage, see &lt;a href=&quot;/posts/ai-supply-chain-attack-vectors&quot;&gt;AI supply chain security risks&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Governance Retrofitting.&lt;/strong&gt; Adding compliance controls after deployment requires painful redesigns. Plan audit trails, role-based access, and compliance testing from the start. Treat governance as a living alignment task: agent standards are evolving and your controls must track them, not just satisfy requirements at launch.&lt;/p&gt;
&lt;h2 id=&quot;how-to-start-a-practical-implementation-framework&quot;&gt;How to Start: A Practical Implementation Framework&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;Step 1: Set Specific Targets.&lt;/strong&gt; Pick one workflow with high volume, predictable, with success metrics, and low regulatory risk. Budget onboarding time: the agent tooling learning curve is steep and compounds with each new capability your team adopts.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Step 2: Audit Data Quality.&lt;/strong&gt; Check for duplicates, format inconsistencies, missing values, and access permissions. Fix the top three issues. Aim for 80% clean data, not perfection.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Step 3: Choose Your Integration Pattern.&lt;/strong&gt; API mediation for stable APIs and 1-2 agents (4-8 weeks). Event-driven for 1,000+ transactions/hour (8-12 weeks). MCP for 3+ agents or standardization priority (6-12 weeks).&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Step 4: Build Observability from Day One.&lt;/strong&gt; Track integration health (latency, error rates), agent performance (completion rate, accuracy), and business impact (your target KPI). Set alerts for error rates above 5%, latency p95 spikes, and approval override surges.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Step 5: Start with Single-Agent Workflows.&lt;/strong&gt; Run your first agent in shadow mode for 2-4 weeks (longer for complex workflows). Compare agent decisions against human decisions. &lt;strong&gt;Exit criteria:&lt;/strong&gt; Switch to production when accuracy exceeds 95% (adjust based on cost-of-failure analysis). &lt;strong&gt;Production gate:&lt;/strong&gt; Error rate below 5% and manual override rate trending down. &lt;strong&gt;Expansion gate:&lt;/strong&gt; KPI sustained for 4 weeks with no Sev-1 incidents.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Step 6: Fund Modernization with Agent ROI.&lt;/strong&gt; Track which legacy systems create the most integration friction. If agents generate measurable savings, reinvest a defined share into infrastructure upgrades. &lt;a href=&quot;https://www.mckinsey.com/capabilities/mckinsey-technology/our-insights/recalibrating-technology-budgets-for-the-ai-era&quot;&gt;McKinsey finds that top-performing modernizers direct at least one-third of their technology budget to change activities&lt;/a&gt; such as modernization and AI platforms (McKinsey, 2026). At this point the challenge shifts: coordinating agents across business lines is a strategic concern, not just a technical one.&lt;/p&gt;
&lt;h2 id=&quot;why-should-your-board-fund-this-now&quot;&gt;Why Should Your Board Fund This Now?&lt;/h2&gt;
&lt;p&gt;ROI before major infrastructure investment: your board sees results next quarter, not in three years.&lt;/p&gt;
&lt;p&gt;Competitive advantage: while competitors wait for budgets, you’re winning deals with faster response times, higher throughput, and lower support costs. Risk mitigation: agents layer over existing systems with no business disruption. &lt;a href=&quot;https://twimlai.com/podcast/twimlai/how-capital-one-delivers-multi-agent-systems&quot;&gt;Capital One is actively scaling agents to serve millions of customers in production&lt;/a&gt; (Shetty, TWiML #765, 2026), a signal that the enterprise agent lifecycle has moved from experimentation to fleet-scale operation.&lt;/p&gt;
&lt;hr&gt;
&lt;p&gt;Explore how &lt;a href=&quot;/posts/orchestrating-ai-agents-subagent-architecture&quot;&gt;subagent architectures can orchestrate multiple AI agents without coordination complexity&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&quot;references&quot;&gt;References&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Allianz, “When the Storm Clears, So Should the Claim Queue” (2025) — &lt;a href=&quot;https://www.allianz.com/en/mediacenter/news/articles/251103-when-the-storm-clears-so-should-the-claim-queue.html&quot;&gt;https://www.allianz.com/en/mediacenter/news/articles/251103-when-the-storm-clears-so-should-the-claim-queue.html&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Bank of America, “A Decade of AI Innovation: Erica Surpasses Milestones” (2025) — &lt;a href=&quot;https://newsroom.bankofamerica.com/content/newsroom/press-releases/2025/08/a-decade-of-ai-innovation--bofa-s-virtual-assistant-erica-surpas.html&quot;&gt;https://newsroom.bankofamerica.com/content/newsroom/press-releases/2025/08/a-decade-of-ai-innovation—bofa-s-virtual-assistant-erica-surpas.html&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;BCG, “Agentic AI Power Core Insurance AI Modernization” (2026) — &lt;a href=&quot;https://www.bcg.com/publications/2026/agentic-ai-power-core-insurance-ai-modernization&quot;&gt;https://www.bcg.com/publications/2026/agentic-ai-power-core-insurance-ai-modernization&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Cochran, W.G., &lt;em&gt;Sampling Techniques&lt;/em&gt;, 3rd ed. (1977) — &lt;a href=&quot;https://en.wikipedia.org/wiki/Sample_size_determination&quot;&gt;https://en.wikipedia.org/wiki/Sample_size_determination&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Cyber Snowden, “Difference Between End of Life and Legacy Cyber Security” (2026) — &lt;a href=&quot;https://cybersnowden.com/difference-between-end-of-life-and-legacy-cyber-security/&quot;&gt;https://cybersnowden.com/difference-between-end-of-life-and-legacy-cyber-security/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Deloitte, “Deloitte &amp;#x26; Palantir: Driving Value in Enterprise Operations” (2025) — &lt;a href=&quot;https://www.deloitte.com/us/en/Industries/government-public/perspectives/deloitte-palantir-collaboration.html&quot;&gt;https://www.deloitte.com/us/en/Industries/government-public/perspectives/deloitte-palantir-collaboration.html&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Gartner, “Gartner Predicts Over 40% of Agentic AI Projects Will Be Canceled by End of 2027” (2025) — &lt;a href=&quot;https://www.gartner.com/en/newsroom/press-releases/2025-06-25-gartner-predicts-over-40-percent-of-agentic-ai-projects-will-be-canceled-by-end-of-2027&quot;&gt;https://www.gartner.com/en/newsroom/press-releases/2025-06-25-gartner-predicts-over-40-percent-of-agentic-ai-projects-will-be-canceled-by-end-of-2027&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;McKinsey, “Recalibrating CIO Technology Budgets for the AI Era” (2026) — &lt;a href=&quot;https://www.mckinsey.com/capabilities/mckinsey-technology/our-insights/recalibrating-technology-budgets-for-the-ai-era&quot;&gt;https://www.mckinsey.com/capabilities/mckinsey-technology/our-insights/recalibrating-technology-budgets-for-the-ai-era&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;OpenTelemetry, “Semantic Conventions for Generative AI” (2024) — &lt;a href=&quot;https://opentelemetry.io/docs/specs/semconv/gen-ai/&quot;&gt;https://opentelemetry.io/docs/specs/semconv/gen-ai/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;OWASP, “LLM01:2025 Prompt Injection” (2025) — &lt;a href=&quot;https://genai.owasp.org/llmrisk/llm01-prompt-injection/&quot;&gt;https://genai.owasp.org/llmrisk/llm01-prompt-injection/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Palantir, “Safely Modernize Legacy Systems with Palantir Foundry Container Engine (FCE)” (2023) — &lt;a href=&quot;https://blog.palantir.com/safely-modernize-legacy-systems-with-palantir-foundry-container-engine-fce-d8900464da7c&quot;&gt;https://blog.palantir.com/safely-modernize-legacy-systems-with-palantir-foundry-container-engine-fce-d8900464da7c&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Shetty, R., “How Capital One Delivers Multi-Agent Systems,” TWiML AI Podcast #765 (2026) — &lt;a href=&quot;https://twimlai.com/podcast/twimlai/how-capital-one-delivers-multi-agent-systems&quot;&gt;https://twimlai.com/podcast/twimlai/how-capital-one-delivers-multi-agent-systems&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</content:encoded><category>agentic-ai</category><category>legacy-systems</category><category>architecture</category><category>case-studies</category><author>Hugues Clouâtre</author></item><item><title>AI Supply Chain Attacks: New Vectors in Dependencies</title><link>https://clouatre.ca/posts/ai-supply-chain-attack-vectors/</link><guid isPermaLink="true">https://clouatre.ca/posts/ai-supply-chain-attack-vectors/</guid><description>Slopsquatting: attackers register packages AI hallucinates. XZ Utils showed the stakes. A framework to assess your AI supply chain exposure.</description><pubDate>Wed, 11 Feb 2026 20:45:00 GMT</pubDate><content:encoded>&lt;p&gt;A CI pipeline trusts 400 packages. Last week, one of them laid off 75% of its engineering team. Two years ago, another nearly shipped a backdoor to every major Linux distribution. Attackers are now registering package names that only exist because an AI hallucinated them.&lt;/p&gt;
&lt;p&gt;Three incidents. Three attack vectors. One common thread: AI is reshaping software supply chain risk faster than most security programs can adapt.&lt;/p&gt;
&lt;p&gt;Most organizations scan for CVEs and maintain an SBOM. Few monitor for maintainer burnout, AI-driven revenue collapse, or packages that only exist because an LLM invented them. The following framework closes those gaps.&lt;/p&gt;
&lt;figure&gt;&lt;img alt=&quot;Three AI-driven attack vectors targeting a software dependency chain&quot; loading=&quot;eager&quot; decoding=&quot;sync&quot; fetchpriority=&quot;high&quot; sizes=&quot;(min-width: 768px) 768px, 100vw&quot; data-astro-image=&quot;constrained&quot; data-astro-image-pos=&quot;center&quot; width=&quot;768&quot; height=&quot;492&quot; src=&quot;/_astro/ai-attack-vectors.CiovEITa_Zd8COx.svg&quot; srcset=&quot;/_astro/ai-attack-vectors.CiovEITa_1453P1.svg 640w, /_astro/ai-attack-vectors.CiovEITa_Z29zM2w.svg 750w, /_astro/ai-attack-vectors.CiovEITa_Zd8COx.svg 768w&quot;&gt;&lt;figcaption&gt;&lt;strong&gt;Figure 1:&lt;/strong&gt; Three AI-driven attack vectors targeting a software dependency chain.&lt;/figcaption&gt;&lt;/figure&gt;
&lt;h2 id=&quot;table-of-contents&quot;&gt;Table of contents&lt;/h2&gt;
&lt;p&gt;&lt;/p&gt;&lt;details&gt;&lt;summary&gt;Contents&lt;/summary&gt;&lt;p&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;#what-are-the-three-attack-vectors&quot;&gt;What Are the Three Attack Vectors?&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;#vector-1-maintainer-collapse-ai-accelerated&quot;&gt;Vector 1: Maintainer Collapse (AI-Accelerated)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#vector-2-social-engineering-of-solo-maintainers&quot;&gt;Vector 2: Social Engineering of Solo Maintainers&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#vector-3-slopsquatting-ai-native&quot;&gt;Vector 3: Slopsquatting (AI-Native)&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#why-does-this-matter-at-enterprise-scale&quot;&gt;Why Does This Matter at Enterprise Scale?&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#how-does-the-two-tier-ecosystem-create-different-risks&quot;&gt;How Does the Two-Tier Ecosystem Create Different Risks?&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;#tier-1-foundation-backed-projects&quot;&gt;Tier 1: Foundation-Backed Projects&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#tier-2-indie-and-vc-backed-projects&quot;&gt;Tier 2: Indie and VC-Backed Projects&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#how-should-organizations-assess-ai-exposure-risk&quot;&gt;How Should Organizations Assess AI Exposure Risk?&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;#the-5-signal-ai-exposure-audit&quot;&gt;The 5-Signal AI Exposure Audit&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#decision-thresholds&quot;&gt;Decision Thresholds&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#enterprise-application&quot;&gt;Enterprise Application&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#how-does-vibe-coding-multiply-supply-chain-risk&quot;&gt;How Does Vibe Coding Multiply Supply Chain Risk?&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#how-can-organizations-defend-against-ai-supply-chain-attacks&quot;&gt;How Can Organizations Defend Against AI Supply Chain Attacks?&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;#extend-the-toolchain&quot;&gt;Extend the Toolchain&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#sponsor-strategically&quot;&gt;Sponsor Strategically&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#how-will-relicensing-reshape-the-stack&quot;&gt;How Will Relicensing Reshape the Stack?&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;#before-the-next-sprint&quot;&gt;Before the Next Sprint&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#references&quot;&gt;References&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;/p&gt;&lt;/details&gt;&lt;p&gt;&lt;/p&gt;
&lt;h2 id=&quot;what-are-the-three-attack-vectors&quot;&gt;What Are the Three Attack Vectors?&lt;/h2&gt;
&lt;p&gt;AI does not just accelerate existing supply chain risks. It creates new ones.&lt;/p&gt;
&lt;h3 id=&quot;vector-1-maintainer-collapse-ai-accelerated&quot;&gt;Vector 1: Maintainer Collapse (AI-Accelerated)&lt;/h3&gt;
&lt;p&gt;On January 6, 2026, Adam Wathan attributed Tailwind’s layoffs directly to &lt;a href=&quot;https://github.com/tailwindlabs/tailwindcss.com/pull/2388#issuecomment-3717222957&quot;&gt;AI’s brutal impact on their business&lt;/a&gt;. Documentation traffic dropped 40%. Revenue collapsed 80%. Yet Tailwind CSS downloads keep climbing.&lt;/p&gt;
&lt;p&gt;The mechanism is simple: developers ask Copilot for a Tailwind grid layout. The AI generates it. No documentation visit. No discovery of Tailwind UI. No conversion. The developer gets value. The maintainer gets nothing.&lt;/p&gt;
&lt;p&gt;This is not a failing product. It is a failing business model, and not unique to Tailwind. Any project monetizing through documentation traffic faces the same exposure.&lt;/p&gt;
&lt;p&gt;Meanwhile, curl maintainer Daniel Stenberg &lt;a href=&quot;https://arstechnica.com/security/2026/01/overrun-with-ai-slop-curl-scraps-bug-bounties-to-ensure-intact-mental-health/&quot;&gt;scrapped the project’s bug bounty program&lt;/a&gt; on January 21, 2026, citing “intact mental health.” Twenty AI-generated vulnerability reports flooded HackerOne in January alone. None identified actual vulnerabilities. Researchers paste code into LLMs, submit the hallucinated analysis, then loop follow-up questions through the same models. The result: maintainers spend hours triaging garbage instead of shipping code.&lt;/p&gt;
&lt;p&gt;Different mechanism, same outcome. Two forces compete: AI lowers the cost of writing software (beneficial for maintainers), but it also diverts users away from the direct engagement that funds maintainers (unsustainable for business models). Koren et al. (2026) model this formally and show the demand-diversion channel dominates. Stack Overflow activity has declined roughly 25% since ChatGPT’s launch, following the same pattern as Tailwind.&lt;/p&gt;
&lt;h3 id=&quot;vector-2-social-engineering-of-solo-maintainers&quot;&gt;Vector 2: Social Engineering of Solo Maintainers&lt;/h3&gt;
&lt;p&gt;In March 2024, Microsoft engineer Andres Freund &lt;a href=&quot;https://www.crowdstrike.com/en-us/blog/cve-2024-3094-xz-upstream-supply-chain-attack/&quot;&gt;discovered a backdoor in XZ Utils&lt;/a&gt; days before it would have shipped to most Linux distributions. CVE-2024-3094 scored a perfect 10.0. The backdoor enabled remote code execution through SSH on affected systems.&lt;/p&gt;
&lt;p&gt;The attack took two years. A contributor using the name “Jia Tan” gained the sole maintainer’s trust through legitimate contributions, then inserted malicious code. The maintainer was burned out, working alone, grateful for help.&lt;/p&gt;
&lt;p&gt;This pattern repeats. The event-stream incident in 2018 followed the same playbook: abandoned maintainer transfers control, attacker inserts cryptocurrency-stealing code. XZ Utils proved the technique works at infrastructure scale.&lt;/p&gt;
&lt;p&gt;Two years later, the technique has evolved. Attackers now use LLMs to maintain technically helpful, perfectly patient personas over months, bypassing the “vibe check” that once caught human bad actors.&lt;/p&gt;
&lt;h3 id=&quot;vector-3-slopsquatting-ai-native&quot;&gt;Vector 3: Slopsquatting (AI-Native)&lt;/h3&gt;
&lt;p&gt;This attack vector did not exist before LLMs. &lt;a href=&quot;https://snyk.io/articles/slopsquatting-mitigation-strategies/&quot;&gt;Slopsquatting&lt;/a&gt; exploits models that confidently recommend nonexistent packages. One in five AI suggestions points to a package that was never published (Spracklen et al., 2025).&lt;/p&gt;
&lt;p&gt;The attack flow:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Researchers run popular LLMs and collect hallucinated package names&lt;/li&gt;
&lt;li&gt;Attackers register those names on npm, PyPI, or RubyGems with malicious payloads&lt;/li&gt;
&lt;li&gt;Developers install AI-suggested packages without validation&lt;/li&gt;
&lt;li&gt;Malicious code executes&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Unlike typosquatting, attackers do not need to guess which names developers might mistype. The model identifies exactly which fake packages to register. Names like “aws-helper-sdk” and “fastapi-middleware” appear in AI-generated code but never existed until attackers registered them.&lt;/p&gt;
&lt;p&gt;The defense is straightforward: verify that packages existed before the commit date. This check catches AI-hallucinated packages that attackers registered after the model suggested them:&lt;/p&gt;
&lt;figure&gt;&lt;figcaption&gt;&lt;strong&gt;Code Snippet 1:&lt;/strong&gt; Detect slopsquatting by checking package age. Conceptual implementation only.&lt;/figcaption&gt;&lt;pre class=&quot;astro-code astro-code-themes catppuccin-latte catppuccin-macchiato has-highlighted mt-8&quot; style=&quot;--shiki-light:#4c4f69; --shiki-dark:#cad3f5; --shiki-light-bg:#eff1f5; --shiki-dark-bg:#24273a; --file-name-offset: -0.75rem&quot; tabindex=&quot;0&quot; data-language=&quot;python&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-dark:#C6A0F6&quot;&gt;import&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt; requests&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-dark:#C6A0F6&quot;&gt;from&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt; datetime &lt;/span&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-dark:#C6A0F6&quot;&gt;import&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt; datetime&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-dark:#C6A0F6&quot;&gt;def&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-light-font-style:italic;--shiki-dark:#8AADF4;--shiki-dark-font-style:italic&quot;&gt; check_package_age&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--shiki-light:#E64553;--shiki-light-font-style:italic;--shiki-dark:#EE99A0;--shiki-dark-font-style:italic&quot;&gt;name&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-light-font-style:italic;--shiki-dark:#C6A0F6;--shiki-dark-font-style:italic&quot;&gt; str&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;--shiki-light:#E64553;--shiki-light-font-style:italic;--shiki-dark:#EE99A0;--shiki-dark-font-style:italic&quot;&gt; commit_date&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-light-font-style:italic;--shiki-dark:#C6A0F6;--shiki-dark-font-style:italic&quot;&gt; str&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt; -&gt;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-light-font-style:italic;--shiki-dark:#C6A0F6;--shiki-dark-font-style:italic&quot;&gt; bool&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;    resp &lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt; requests&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;get&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-light-font-style:italic;--shiki-dark:#A6DA95;--shiki-dark-font-style:italic&quot;&gt;f&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;&quot;https://registry.npmjs.org/&lt;/span&gt;&lt;span style=&quot;--shiki-light:#EA76CB;--shiki-dark:#F5BDE6&quot;&gt;{&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;name&lt;/span&gt;&lt;span style=&quot;--shiki-light:#EA76CB;--shiki-dark:#F5BDE6&quot;&gt;}&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-dark:#C6A0F6&quot;&gt;    if&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt; resp&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;status_code &lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;==&lt;/span&gt;&lt;span style=&quot;--shiki-light:#FE640B;--shiki-dark:#F5A97F&quot;&gt; 404&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-dark:#C6A0F6&quot;&gt;        return&lt;/span&gt;&lt;span style=&quot;--shiki-light:#FE640B;--shiki-dark:#F5A97F&quot;&gt; False&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-light-font-style:italic;--shiki-dark:#939AB7;--shiki-dark-font-style:italic&quot;&gt;  # Package does not exist&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;    pkg &lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt; resp&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;json&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;()&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;    published &lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt; datetime&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;fromisoformat&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--shiki-light:#E64553;--shiki-light-font-style:italic;--shiki-dark:#EE99A0;--shiki-dark-font-style:italic&quot;&gt;pkg&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;&apos;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-light-font-style:italic;--shiki-dark:#A6DA95;--shiki-dark-font-style:italic&quot;&gt;time&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;&apos;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;][&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;&apos;created&apos;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;].&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;replace&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;&apos;Z&apos;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; &apos;+00:00&apos;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;))&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line highlighted&quot;&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-dark:#C6A0F6&quot;&gt;    return&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt; published &lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;&amp;#x3C;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt; datetime&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;fromisoformat&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;commit_date&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;)&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;span class=&quot;absolute py-1 text-foreground text-xs font-medium leading-4 pl-4 pr-2 before:inline-block before:size-1 before:bg-green-500 before:rounded-full before:absolute before:top-[45%] before:left-2 left-2 top-(--file-name-offset) border rounded-md bg-background&quot;&gt;scripts/validate_deps.py&lt;/span&gt;&lt;/pre&gt;&lt;/figure&gt;
&lt;h2 id=&quot;why-does-this-matter-at-enterprise-scale&quot;&gt;Why Does This Matter at Enterprise Scale?&lt;/h2&gt;
&lt;p&gt;Sonatype’s 2024 State of the Software Supply Chain report documented &lt;a href=&quot;https://www.infosecurity-magazine.com/news/156-increase-in-oss-malicious/&quot;&gt;512,847 malicious packages&lt;/a&gt; discovered between November 2023 and November 2024. A 156% year-over-year increase. The Verizon 2025 DBIR found that &lt;a href=&quot;https://deepstrike.io/blog/supply-chain-attack-statistics-2025&quot;&gt;30% of breaches now involve third-party components&lt;/a&gt;, double the previous year.&lt;/p&gt;
&lt;p&gt;Log4Shell proved how fast these risks materialize. According to Wiz and EY, &lt;a href=&quot;https://en.wikipedia.org/wiki/Log4Shell&quot;&gt;93% of enterprise cloud environments&lt;/a&gt; were affected. Four years later, 13% of Log4j downloads from Maven Central still contain the vulnerable version, roughly 40 million vulnerable downloads per year.&lt;/p&gt;
&lt;p&gt;These vectors do not operate in isolation. They cascade. The same “software-begets-software” feedback loop that drove OSS growth now amplifies contraction: fewer maintainers produce fewer packages, which reduces ecosystem quality, which further weakens incentives to share. At 70% vibe coding adoption, engagement-based monetization drops roughly 70%, but OSS entry can only sustain an 11% decline before projects start disappearing. That 59-percentage-point gap is the crisis window.&lt;/p&gt;
&lt;p&gt;Monitoring the right signals matters more than counting CVEs.&lt;/p&gt;
&lt;h2 id=&quot;how-does-the-two-tier-ecosystem-create-different-risks&quot;&gt;How Does the Two-Tier Ecosystem Create Different Risks?&lt;/h2&gt;
&lt;p&gt;Not all dependencies face equal exposure. A two-tier structure is emerging.&lt;/p&gt;
&lt;h3 id=&quot;tier-1-foundation-backed-projects&quot;&gt;Tier 1: Foundation-Backed Projects&lt;/h3&gt;
&lt;p&gt;CNCF, Apache, and Linux Foundation projects operate differently. Kubernetes maintainers are typically employed by member companies. Corporate membership dues fund development. Governance structures distribute responsibility.&lt;/p&gt;
&lt;p&gt;These projects face sustainability challenges: burnout, security maintenance burdens, contributor fatigue. Foundation backing buffers against documentation-traffic collapse, but not full immunity. Corporate membership dues often correlate with ecosystem health; if the broader ecosystem contracts, so does corporate willingness to fund.&lt;/p&gt;
&lt;h3 id=&quot;tier-2-indie-and-vc-backed-projects&quot;&gt;Tier 2: Indie and VC-Backed Projects&lt;/h3&gt;
&lt;p&gt;Tailwind, Bun (pre-acquisition), curl, and thousands of smaller projects depend on sponsorships, consulting revenue, or VC runway. Many have single maintainers. The bus factor is often one.&lt;/p&gt;
&lt;p&gt;These projects underpin the modern web. They are also most exposed to all three attack vectors.&lt;/p&gt;
&lt;p&gt;Most enterprise stacks span both tiers. Kubernetes (Tier 1) might orchestrate containers running applications built with Tailwind (Tier 2). The risk profiles differ, and monitoring should reflect that.&lt;/p&gt;
&lt;h2 id=&quot;how-should-organizations-assess-ai-exposure-risk&quot;&gt;How Should Organizations Assess AI Exposure Risk?&lt;/h2&gt;
&lt;p&gt;Traditional dependency scanning catches CVEs. It does not catch maintainer burnout, revenue collapse, or AI-hallucinated packages. Additional signals are needed.&lt;/p&gt;
&lt;h3 id=&quot;the-5-signal-ai-exposure-audit&quot;&gt;The 5-Signal AI Exposure Audit&lt;/h3&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Funding model&lt;/strong&gt;: Corporate-backed or sponsorship-dependent? Check GitHub Sponsors, Open Collective, or company backing. Sponsorship-dependent projects face higher AI exposure.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Contributor count&lt;/strong&gt;: Bus factor greater than three? XZ Utils had one active contributor. Look at commit history and active contributors over the past 12 months.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Governance&lt;/strong&gt;: Foundation membership or solo maintainer? CNCF and Apache projects have succession plans. Solo projects often do not.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;AI exposure score&lt;/strong&gt;: Docs-driven monetization (high exposure) or infrastructure utility (lower exposure)? UI libraries and developer tools face higher risk than compression utilities or parsers.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Recent signals&lt;/strong&gt;: Layoffs, acquisition talks, burnout posts? Monitor project blogs, maintainer social media, and GitHub discussions.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;h3 id=&quot;decision-thresholds&quot;&gt;Decision Thresholds&lt;/h3&gt;
&lt;p&gt;The following framework maps signals to response levels:&lt;/p&gt;






























&lt;table tabindex=&quot;0&quot;&gt;&lt;caption&gt;&lt;strong&gt;Table 1:&lt;/strong&gt; Decision thresholds for dependency risk response.&lt;/caption&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Risk Level&lt;/th&gt;&lt;th&gt;Signals&lt;/th&gt;&lt;th&gt;Action&lt;/th&gt;&lt;/tr&gt;&lt;/thead&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;strong&gt;Monitor&lt;/strong&gt;&lt;/td&gt;&lt;td&gt;1-2 signals, Tier 1 project&lt;/td&gt;&lt;td&gt;Quarterly review&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;strong&gt;Watch&lt;/strong&gt;&lt;/td&gt;&lt;td&gt;2-3 signals, any tier&lt;/td&gt;&lt;td&gt;Monthly review, identify alternatives&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;strong&gt;Mitigate&lt;/strong&gt;&lt;/td&gt;&lt;td&gt;3+ signals, Tier 2 project&lt;/td&gt;&lt;td&gt;Sponsor, fork, or migrate&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;strong&gt;Critical&lt;/strong&gt;&lt;/td&gt;&lt;td&gt;Active incidents (layoffs, security events)&lt;/td&gt;&lt;td&gt;Immediate review, contingency plan&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;
&lt;h3 id=&quot;enterprise-application&quot;&gt;Enterprise Application&lt;/h3&gt;
&lt;p&gt;Consider a fintech platform with 400 npm dependencies. Traditional scanning surfaces CVEs. The AI exposure audit surfaces different risks:&lt;/p&gt;



































&lt;table tabindex=&quot;0&quot;&gt;&lt;caption&gt;&lt;strong&gt;Table 2:&lt;/strong&gt; AI exposure audit across dependency categories.&lt;/caption&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Dependency Type&lt;/th&gt;&lt;th&gt;Count&lt;/th&gt;&lt;th&gt;High AI Exposure&lt;/th&gt;&lt;th&gt;Action&lt;/th&gt;&lt;/tr&gt;&lt;/thead&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;UI frameworks&lt;/td&gt;&lt;td&gt;12&lt;/td&gt;&lt;td&gt;4&lt;/td&gt;&lt;td&gt;Review monetization models&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Build tools&lt;/td&gt;&lt;td&gt;8&lt;/td&gt;&lt;td&gt;2&lt;/td&gt;&lt;td&gt;Track bus factor, burnout signals&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Infrastructure&lt;/td&gt;&lt;td&gt;45&lt;/td&gt;&lt;td&gt;1&lt;/td&gt;&lt;td&gt;Lower priority&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Utility libraries&lt;/td&gt;&lt;td&gt;335&lt;/td&gt;&lt;td&gt;23&lt;/td&gt;&lt;td&gt;Automate monitoring&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;
&lt;p&gt;The 23 high-exposure utility libraries are not all equal. Prioritize by criticality: is it in the authentication path? The payment flow? The deployment pipeline?&lt;/p&gt;
&lt;h2 id=&quot;how-does-vibe-coding-multiply-supply-chain-risk&quot;&gt;How Does Vibe Coding Multiply Supply Chain Risk?&lt;/h2&gt;
&lt;p&gt;Andrej Karpathy &lt;a href=&quot;https://x.com/karpathy/status/1886192184808149383&quot;&gt;coined “vibe coding”&lt;/a&gt; in February 2025: developers who “fully give in to the vibes” and let AI generate entire applications. The practice is &lt;a href=&quot;https://www.infosecurity-magazine.com/opinions/vibe-coding-security-risk-ai/&quot;&gt;accelerating&lt;/a&gt;, and it compounds every vector above.&lt;/p&gt;
&lt;p&gt;Slopsquatting is the visible risk. The less visible one: license laundering. AI training data includes GPL and AGPL (copyleft) code. When developers accept AI-generated output without review, they risk shipping restrictive-licensed code as proprietary. The provenance is untraceable. Tools like &lt;a href=&quot;https://fossa.com/solutions/oss-license-compliance/&quot;&gt;FOSSA&lt;/a&gt; and &lt;a href=&quot;https://snyk.io/product/open-source-security-management/license-compliance/&quot;&gt;Snyk License Compliance&lt;/a&gt; can scan for license violations in CI, but they catch dependencies, not AI-generated source code. Manual review remains essential.&lt;/p&gt;
&lt;figure&gt;&lt;figcaption&gt;&lt;strong&gt;Code Snippet 4:&lt;/strong&gt; FOSSA scans dependencies for GPL/AGPL violations and fails the build on policy breach.&lt;/figcaption&gt;&lt;pre class=&quot;astro-code astro-code-themes catppuccin-latte catppuccin-macchiato has-highlighted mt-8&quot; style=&quot;--shiki-light:#4c4f69; --shiki-dark:#cad3f5; --shiki-light-bg:#eff1f5; --shiki-dark-bg:#24273a; --file-name-offset: -0.75rem&quot; tabindex=&quot;0&quot; data-language=&quot;yaml&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;jobs&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;  license-scan&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;    runs-on&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; ubuntu-latest&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;    steps&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;      -&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt; name&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; Checkout repository&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;        uses&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; actions/checkout@v6&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;      -&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt; name&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; Scan licenses with FOSSA&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;        uses&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; fossas/fossa-action@v1&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;        with&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;          api-key&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; ${{ secrets.FOSSA_API_KEY }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line highlighted&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;          run-tests&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#FE640B;--shiki-dark:#F5A97F&quot;&gt; true&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;span class=&quot;absolute py-1 text-foreground text-xs font-medium leading-4 pl-4 pr-2 before:inline-block before:size-1 before:bg-green-500 before:rounded-full before:absolute before:top-[45%] before:left-2 left-2 top-(--file-name-offset) border rounded-md bg-background&quot;&gt;.github/workflows/license-check.yml&lt;/span&gt;&lt;/pre&gt;&lt;/figure&gt;
&lt;p&gt;AI-assisted commits warrant validation: flagging new dependencies, verifying packages existed before the commit date (Code Snippet 1), and checking maintainer history. For teams using AI agents extensively, &lt;a href=&quot;/posts/orchestrating-ai-agents-subagent-architecture/&quot;&gt;subagent architectures&lt;/a&gt; can dedicate a validation agent to check every dependency before acceptance.&lt;/p&gt;
&lt;h2 id=&quot;how-can-organizations-defend-against-ai-supply-chain-attacks&quot;&gt;How Can Organizations Defend Against AI Supply Chain Attacks?&lt;/h2&gt;
&lt;h3 id=&quot;extend-the-toolchain&quot;&gt;Extend the Toolchain&lt;/h3&gt;
&lt;p&gt;Existing tools catch CVEs. Tools that catch sustainability risks fill the gap:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;OpenSSF Scorecard&lt;/strong&gt; (scorecard.dev) scores projects on maintainer activity, security practices, and bus factor&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;deps.dev&lt;/strong&gt; provides dependency graphs with contributor data&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Socket.dev&lt;/strong&gt; detects supply chain attacks including slopsquatting patterns&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Scorecard and Socket integrate directly into &lt;a href=&quot;/posts/ai-augmented-cicd/&quot;&gt;AI-augmented CI/CD pipelines&lt;/a&gt; via GitHub Actions, flagging risky dependencies before merge.&lt;/p&gt;
&lt;p&gt;For a quick CLI check:&lt;/p&gt;
&lt;figure&gt;&lt;figcaption&gt;&lt;strong&gt;Code Snippet 2:&lt;/strong&gt; OpenSSF Scorecard CLI checks a repository’s security health score (0-10).&lt;/figcaption&gt;&lt;pre class=&quot;astro-code astro-code-themes catppuccin-latte catppuccin-macchiato&quot; style=&quot;--shiki-light:#4c4f69; --shiki-dark:#cad3f5; --shiki-light-bg:#eff1f5; --shiki-dark-bg:#24273a; --file-name-offset: -0.75rem&quot; tabindex=&quot;0&quot; data-language=&quot;bash&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-light-font-style:italic;--shiki-dark:#939AB7;--shiki-dark-font-style:italic&quot;&gt;# Check a project&apos;s health score (0-10)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-light-font-style:italic;--shiki-dark:#8AADF4;--shiki-dark-font-style:italic&quot;&gt;scorecard&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; --repo=tailwindlabs/tailwindcss&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;
&lt;p&gt;To enforce this in CI, integrate Scorecard into a GitHub Actions workflow. The workflow below fails the build if a dependency scores below 7 out of 10, preventing risky dependencies from entering production:&lt;/p&gt;
&lt;figure&gt;&lt;figcaption&gt;&lt;strong&gt;Code Snippet 3:&lt;/strong&gt; GitHub Actions workflow to enforce minimum dependency health score of 7/10 in CI.&lt;/figcaption&gt;&lt;pre class=&quot;astro-code astro-code-themes catppuccin-latte catppuccin-macchiato has-highlighted mt-8&quot; style=&quot;--shiki-light:#4c4f69; --shiki-dark:#cad3f5; --shiki-light-bg:#eff1f5; --shiki-dark-bg:#24273a; --file-name-offset: -0.75rem&quot; tabindex=&quot;0&quot; data-language=&quot;yaml&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt; name&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; Run OpenSSF Scorecard&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;  uses&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; ossf/scorecard-action@v2&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;  with&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;    results_file&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; scorecard.json&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line highlighted&quot;&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt; name&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; Block on low score&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;  run&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-dark:#C6A0F6&quot;&gt; |&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;    jq -e &apos;.score &gt;= 7&apos; scorecard.json || exit 1&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;span class=&quot;absolute py-1 text-foreground text-xs font-medium leading-4 pl-4 pr-2 before:inline-block before:size-1 before:bg-green-500 before:rounded-full before:absolute before:top-[45%] before:left-2 left-2 top-(--file-name-offset) border rounded-md bg-background&quot;&gt;.github/workflows/scorecard.yml&lt;/span&gt;&lt;/pre&gt;&lt;/figure&gt;
&lt;h3 id=&quot;sponsor-strategically&quot;&gt;Sponsor Strategically&lt;/h3&gt;
&lt;p&gt;Tooling catches symptoms. Sponsorship addresses the cause. If a Tier 2 project in a critical path shows stress signals, $500/month establishes a relationship with the maintainer and early warning on sustainability issues.&lt;/p&gt;
&lt;p&gt;But individual sponsorship is a stopgap, not a solution. The systemic fix requires platform-level change. One proposed model: AI coding platforms already track which packages they import, so they could redistribute subscription revenue to maintainers based on attributed usage, a “Spotify for open source.” The infrastructure exists; the coordination does not. Until it does, direct sponsorship remains the best lever CTOs have.&lt;/p&gt;
&lt;p&gt;The companies that sponsored Log4j before Log4Shell had maintainer relationships when the crisis hit. The ones that did not scrambled with everyone else.&lt;/p&gt;
&lt;h2 id=&quot;how-will-relicensing-reshape-the-stack&quot;&gt;How Will Relicensing Reshape the Stack?&lt;/h2&gt;
&lt;p&gt;The OSS ecosystem is adapting. Bun’s &lt;a href=&quot;https://bun.sh/blog/bun-joins-anthropic&quot;&gt;acquisition by Anthropic&lt;/a&gt; shows one path: AI companies absorbing critical infrastructure. More acquisitions are likely.&lt;/p&gt;
&lt;p&gt;Experimental protocols like x402 attempt to let AI agents pay for resource access. Still early, but architecturally sound.&lt;/p&gt;
&lt;p&gt;The two-tier ecosystem is crystallizing. Foundation-backed projects will weather it better. Indie projects will face consolidation pressure, through acquisition, abandonment, new business models, or relicensing. HashiCorp moved Terraform to BSL in 2023. Redis followed months later. Sentry, MariaDB, Elastic. The pattern is clear. When sponsorships fail and AI erodes documentation revenue, restrictive licenses become the survival strategy. For enterprises, this means dependencies assumed to be permissively licensed may not stay that way.&lt;/p&gt;
&lt;h3 id=&quot;before-the-next-sprint&quot;&gt;Before the Next Sprint&lt;/h3&gt;
&lt;ul class=&quot;contains-task-list&quot;&gt;
&lt;li class=&quot;task-list-item&quot;&gt;&lt;input type=&quot;checkbox&quot; disabled&gt; Run OpenSSF Scorecard on the top 10 dependencies&lt;/li&gt;
&lt;li class=&quot;task-list-item&quot;&gt;&lt;input type=&quot;checkbox&quot; disabled&gt; Check bus factor on Tier 2 critical-path projects&lt;/li&gt;
&lt;li class=&quot;task-list-item&quot;&gt;&lt;input type=&quot;checkbox&quot; disabled&gt; Add slopsquatting validation to CI (Code Snippet 1)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;AI adoption is accelerating. So are the attacks exploiting it. The question is not whether a supply chain has risk, but whether teams that see it first have the advantage.&lt;/p&gt;
&lt;hr&gt;
&lt;h2 id=&quot;references&quot;&gt;References&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;CrowdStrike, “CVE-2024-3094 and XZ Upstream Supply Chain Attack” (2024) - &lt;a href=&quot;https://www.crowdstrike.com/en-us/blog/cve-2024-3094-xz-upstream-supply-chain-attack/&quot;&gt;https://www.crowdstrike.com/en-us/blog/cve-2024-3094-xz-upstream-supply-chain-attack/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Goodin, Dan, “Overrun with AI slop, cURL scraps bug bounties” (Ars Technica, 2026) - &lt;a href=&quot;https://arstechnica.com/security/2026/01/overrun-with-ai-slop-curl-scraps-bug-bounties-to-ensure-intact-mental-health/&quot;&gt;https://arstechnica.com/security/2026/01/overrun-with-ai-slop-curl-scraps-bug-bounties-to-ensure-intact-mental-health/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Infosecurity Magazine, “Vibe Coding: A Hidden Security Risk of the AI Era” (2025) - &lt;a href=&quot;https://www.infosecurity-magazine.com/opinions/vibe-coding-security-risk-ai/&quot;&gt;https://www.infosecurity-magazine.com/opinions/vibe-coding-security-risk-ai/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Karpathy, Andrej, “vibe coding” (X, 2025) - &lt;a href=&quot;https://x.com/karpathy/status/1886192184808149383&quot;&gt;https://x.com/karpathy/status/1886192184808149383&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Koren, Miklos et al., “Vibe Coding Kills Open Source” (arXiv, 2026) - &lt;a href=&quot;https://arxiv.org/abs/2601.15494&quot;&gt;https://arxiv.org/abs/2601.15494&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Snyk, “Slopsquatting: New AI Hallucination Threats” (2025) - &lt;a href=&quot;https://snyk.io/articles/slopsquatting-mitigation-strategies/&quot;&gt;https://snyk.io/articles/slopsquatting-mitigation-strategies/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Sonatype, “10th Annual State of the Software Supply Chain” (2024) - &lt;a href=&quot;https://www.sonatype.com/state-of-the-software-supply-chain/introduction&quot;&gt;https://www.sonatype.com/state-of-the-software-supply-chain/introduction&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Spracklen, Joseph et al., “We Have a Package for You! A Comprehensive Analysis of Package Hallucinations by Code Generating LLMs” (arXiv, 2025) - &lt;a href=&quot;https://arxiv.org/abs/2406.10279&quot;&gt;https://arxiv.org/abs/2406.10279&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Sumner, Jarred, “Bun is joining Anthropic” (2025) - &lt;a href=&quot;https://bun.sh/blog/bun-joins-anthropic&quot;&gt;https://bun.sh/blog/bun-joins-anthropic&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Verizon, “2025 Data Breach Investigations Report” - &lt;a href=&quot;https://www.verizon.com/business/resources/reports/dbir/&quot;&gt;https://www.verizon.com/business/resources/reports/dbir/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Wathan, Adam, “GitHub comment on Tailwind layoffs” (2026) - &lt;a href=&quot;https://github.com/tailwindlabs/tailwindcss.com/pull/2388#issuecomment-3717222957&quot;&gt;https://github.com/tailwindlabs/tailwindcss.com/pull/2388#issuecomment-3717222957&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</content:encoded><category>agentic-ai</category><category>security</category><category>ai-governance</category><author>Hugues Clouâtre</author></item><item><title>Orchestrating AI Agents: A Subagent Architecture</title><link>https://clouatre.ca/posts/orchestrating-ai-agents-subagent-architecture/</link><guid isPermaLink="true">https://clouatre.ca/posts/orchestrating-ai-agents-subagent-architecture/</guid><description>50% cost reduction with subagent architecture for AI coding. Capable models for planning, fast models for building. Real metrics from Goose.</description><pubDate>Wed, 17 Jun 2026 11:04:00 GMT</pubDate><content:encoded>&lt;p&gt;Single-agent AI coding hits a ceiling. Context windows fill up. Role confusion creeps in. Output quality degrades. The solution: multiple specialized agents handle distinct phases with structured handoffs.&lt;/p&gt;
&lt;p&gt;Basic code assistants show roughly 10% productivity gains. But companies pairing AI with end-to-end process transformation report &lt;a href=&quot;https://www.bain.com/insights/from-pilots-to-payoff-generative-ai-in-software-development-technology-report-2025/&quot;&gt;25-30% improvements&lt;/a&gt; (Bain, 2025). The difference isn’t the model. It’s the architecture, specifically how you engineer the context each agent receives.&lt;/p&gt;
&lt;p&gt;Anthropic’s research on multi-agent systems confirms what we observe: architecture matters more than model choice. Their finding that &lt;a href=&quot;https://www.anthropic.com/engineering/multi-agent-research-system&quot;&gt;“token usage explains 80% of the variance”&lt;/a&gt; reflects the impact of isolation: focused context rather than accumulated conversation history.&lt;/p&gt;
&lt;p&gt;This post documents a production workflow using &lt;a href=&quot;https://github.com/aaif-goose/goose&quot;&gt;Goose&lt;/a&gt; (Agentic AI Foundation). The same architecture runs in &lt;a href=&quot;https://github.com/anthropics/claude-code&quot;&gt;Claude Code&lt;/a&gt; via a skill file. Specialized agents, each optimized for its phase: research, planning, building, and validation.&lt;/p&gt;
&lt;h2 id=&quot;table-of-contents&quot;&gt;Table of contents&lt;/h2&gt;
&lt;p&gt;&lt;/p&gt;&lt;details&gt;&lt;summary&gt;Contents&lt;/summary&gt;&lt;p&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;#why-do-single-agent-ai-coding-workflows-hit-a-ceiling&quot;&gt;Why Do Single-Agent AI Coding Workflows Hit a Ceiling?&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;#context-rot&quot;&gt;Context Rot&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#role-confusion&quot;&gt;Role Confusion&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#accumulated-errors&quot;&gt;Accumulated Errors&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#how-does-subagent-architecture-solve-context-problems&quot;&gt;How Does Subagent Architecture Solve Context Problems?&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#how-does-model-selection-affect-cost-and-quality&quot;&gt;How Does Model Selection Affect Cost and Quality?&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;#how-does-model-routing-reduce-cost&quot;&gt;How Does Model Routing Reduce Cost?&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#which-alternative-models-pass-quality-gates&quot;&gt;Which Alternative Models Pass Quality Gates?&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#how-does-project-context-reach-subagents&quot;&gt;How Does Project Context Reach Subagents?&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#how-do-subagents-communicate&quot;&gt;How Do Subagents Communicate?&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#where-should-human-judgment-stay-in-ai-workflows&quot;&gt;Where Should Human Judgment Stay in AI Workflows?&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#what-results-does-this-produce&quot;&gt;What Results Does This Produce?&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;#design-targets&quot;&gt;Design Targets&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#when-does-this-work-and-when-doesnt-it&quot;&gt;When Does This Work (and When Doesn’t It)?&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#takeaways&quot;&gt;Takeaways&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#references&quot;&gt;References&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;/p&gt;&lt;/details&gt;&lt;p&gt;&lt;/p&gt;
&lt;h2 id=&quot;why-do-single-agent-ai-coding-workflows-hit-a-ceiling&quot;&gt;Why Do Single-Agent AI Coding Workflows Hit a Ceiling?&lt;/h2&gt;
&lt;p&gt;A single AI model handling an entire coding task accumulates context with every interaction. By implementation time, the model carries baggage from analysis, research, and planning phases. This stems from three core problems.&lt;/p&gt;
&lt;h3 id=&quot;context-rot&quot;&gt;Context Rot&lt;/h3&gt;
&lt;p&gt;Long conversations consume token budgets. The model forgets early instructions or weighs recent context too heavily. Chroma Research calls this &lt;a href=&quot;https://research.trychroma.com/context-rot&quot;&gt;context rot: performance degrades consistently as input tokens increase&lt;/a&gt;, even on simple tasks, and worsens for multi-step reasoning like coding (Chroma Research, 2025). On-demand retrieval adds another failure mode: agents miss context 56% of the time because they don’t recognize when to fetch it (Gao, 2026).&lt;/p&gt;
&lt;h3 id=&quot;role-confusion&quot;&gt;Role Confusion&lt;/h3&gt;
&lt;p&gt;A model asked to analyze, plan, implement, and validate lacks clear boundaries. It starts implementing during planning. It skips validation steps. Outputs blur together.&lt;/p&gt;
&lt;h3 id=&quot;accumulated-errors&quot;&gt;Accumulated Errors&lt;/h3&gt;
&lt;p&gt;Mistakes in early phases propagate. A misunderstanding in analysis leads to a flawed plan. A flawed plan leads to incorrect implementation. Fixing requires starting over.&lt;/p&gt;
&lt;h2 id=&quot;how-does-subagent-architecture-solve-context-problems&quot;&gt;How Does Subagent Architecture Solve Context Problems?&lt;/h2&gt;
&lt;p&gt;The fix: spawn specialized subagents for each phase. An orchestrator handles high-level coordination and synthesis. Subagents handle execution with fresh context.&lt;/p&gt;
&lt;figure&gt;&lt;img alt=&quot;Subagent workflow diagram showing Orchestrator with RESEARCH, PLAN phases flowing to Builder and Validator subagents&quot; loading=&quot;eager&quot; decoding=&quot;sync&quot; fetchpriority=&quot;high&quot; sizes=&quot;(min-width: 233px) 233px, 100vw&quot; data-astro-image=&quot;constrained&quot; data-astro-image-pos=&quot;center&quot; width=&quot;233&quot; height=&quot;832&quot; src=&quot;/_astro/subagent-workflow.BgRQxp9Q_ZtdS7U.svg&quot; srcset=&quot;/_astro/subagent-workflow.BgRQxp9Q_ZtdS7U.svg 233w&quot;&gt;&lt;figcaption&gt;&lt;strong&gt;Figure 1:&lt;/strong&gt; Core subagent workflow. SCOUT and GUARD handle RESEARCH sequentially; ORCHESTRATOR synthesizes both into a PLAN. Each agent starts with fresh context, isolated from prior phases. SETUP and COMMIT/PR phases omitted for clarity.&lt;/figcaption&gt;&lt;/figure&gt;
&lt;p&gt;The orchestrator (Claude Sonnet 4.6) handles PLAN only. RESEARCH is split between a SCOUT agent (Haiku, exploratory) and a GUARD agent (Haiku, adversarial) that stress-tests SCOUT’s proposals before the orchestrator synthesizes both into a plan. SCOUT operates on structured codebase inputs (file trees, function indexes, call graphs), where output volume matters more than reasoning range. GUARD’s task is lower-entropy still: finding flaws in a concrete proposal rather than producing one. Both fit Haiku’s profile. After plan completion, the orchestrator spawns a BUILD subagent (Claude Sonnet 4.6) that receives only the plan, not accumulated history. The builder writes code, runs tests, then hands off to a CHECK subagent (Haiku) for validation.&lt;/p&gt;
&lt;p&gt;Each subagent starts with clean context. The builder knows what to build, not how we decided to build it. The validator knows what was built, not what alternatives we considered. This is context engineering in practice: deciding what information enters each context window, in what form, and when, distinct from prompt engineering, which only governs phrasing. Smaller, structured inputs produce deterministic behavior: the same plan JSON produces the same output. That reproducibility is what drives a high PR acceptance rate.&lt;/p&gt;
&lt;h2 id=&quot;how-does-model-selection-affect-cost-and-quality&quot;&gt;How Does Model Selection Affect Cost and Quality?&lt;/h2&gt;
&lt;p&gt;Different phases need different capabilities. Planning requires reasoning. Building requires speed and instruction-following. Validation requires balanced judgment.&lt;/p&gt;









































&lt;table tabindex=&quot;0&quot;&gt;&lt;caption&gt;&lt;strong&gt;Table 1:&lt;/strong&gt; Model selection by agent. Sonnet handles open-ended reasoning; Haiku handles constrained execution. Temperature reflects task openness: higher for exploration, lower for verification.&lt;/caption&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Agent&lt;/th&gt;&lt;th&gt;Model&lt;/th&gt;&lt;th&gt;Temperature&lt;/th&gt;&lt;th&gt;Role&lt;/th&gt;&lt;/tr&gt;&lt;/thead&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;ORCHESTRATOR&lt;/td&gt;&lt;td&gt;Sonnet&lt;/td&gt;&lt;td&gt;0.3&lt;/td&gt;&lt;td&gt;Plan and agent coordination&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;SCOUT&lt;/td&gt;&lt;td&gt;Haiku&lt;/td&gt;&lt;td&gt;0.5&lt;/td&gt;&lt;td&gt;Exploratory research and code analysis&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;GUARD&lt;/td&gt;&lt;td&gt;Haiku&lt;/td&gt;&lt;td&gt;0.1&lt;/td&gt;&lt;td&gt;Adversarial risk review&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;BUILD&lt;/td&gt;&lt;td&gt;Sonnet&lt;/td&gt;&lt;td&gt;0.2&lt;/td&gt;&lt;td&gt;Precise instruction-following coding&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;CHECK&lt;/td&gt;&lt;td&gt;Haiku&lt;/td&gt;&lt;td&gt;0.1&lt;/td&gt;&lt;td&gt;Compliance and security validation&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;
&lt;h3 id=&quot;how-does-model-routing-reduce-cost&quot;&gt;How Does Model Routing Reduce Cost?&lt;/h3&gt;
&lt;p&gt;Building involves the most token-heavy work: reading files, writing code, running tests. Routing this volume to cheaper models cuts costs significantly.&lt;/p&gt;





























&lt;table tabindex=&quot;0&quot;&gt;&lt;caption&gt;&lt;strong&gt;Table 2:&lt;/strong&gt; Anthropic API pricing, March 2026. Standard rates (prompts under 200K tokens). Three agents on Haiku, two on Sonnet.&lt;/caption&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Model&lt;/th&gt;&lt;th&gt;Input&lt;/th&gt;&lt;th&gt;Output&lt;/th&gt;&lt;th&gt;Agent&lt;/th&gt;&lt;/tr&gt;&lt;/thead&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;Opus&lt;/td&gt;&lt;td&gt;$5/MTok&lt;/td&gt;&lt;td&gt;$25/MTok&lt;/td&gt;&lt;td&gt;Not used in default flow&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Sonnet&lt;/td&gt;&lt;td&gt;$3/MTok&lt;/td&gt;&lt;td&gt;$15/MTok&lt;/td&gt;&lt;td&gt;ORCHESTRATOR + BUILD&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Haiku&lt;/td&gt;&lt;td&gt;$1/MTok&lt;/td&gt;&lt;td&gt;$5/MTok&lt;/td&gt;&lt;td&gt;SCOUT + GUARD + CHECK&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;
&lt;p&gt;Research on multi-agent LLM systems shows up to 94% cost reduction through model cascading (Gandhi et al., 2025). This architecture targets 50-60% savings: three of five agents run on Haiku ($1/$5 per MTok), two on Sonnet ($3/$15 per MTok). SCOUT, GUARD, and CHECK run on Haiku and together account for 61% of pipeline sessions at one-third the per-token cost of Sonnet. BUILD runs on Sonnet despite being the single highest-volume phase by tokens (39% of pipeline total): the retry reduction from 77% to 14% offsets the model premium. Versus Opus, the saving is 5x.&lt;/p&gt;
&lt;p&gt;Smaller models with focused context outperform a single large model carrying full session history. Anthropic’s multi-agent research showed a 90.2% performance gain over single-agent Opus by distributing work across Sonnet subagents with isolated context windows (Anthropic Engineering, 2025). Cost drops; quality improves.&lt;/p&gt;
&lt;p&gt;Beyond cost, fresh context enables tasks that fail with single agents. A 12-file refactor that exhausts a single model’s context window succeeds when each subagent starts clean.&lt;/p&gt;
&lt;h3 id=&quot;which-alternative-models-pass-quality-gates&quot;&gt;Which Alternative Models Pass Quality Gates?&lt;/h3&gt;
&lt;p&gt;Each run was scored on an 8-point binary rubric (file identification, dependency verification, architectural tradeoff, pattern analysis, taint-tracking gap, non-obvious synthesis, JSON schema compliance). QP is a composite efficiency metric: cost per run divided by score times reliability. &lt;a href=&quot;https://github.com/clouatre-labs/llm-agent-experiments&quot;&gt;Our model-comparison experiments&lt;/a&gt; tested eight candidates as SCOUT delegates: only MiniMax M2.5 ($0.019/QP) and Kimi K2.5 ($0.040/QP) passed against a Haiku baseline of $0.150/QP. Mistral Small 4 ($0.002/QP) narrowly failed on a floor score violation; DeepSeek V3.2 failed all gates; Mercury-2, the cheapest candidate at $0.001/QP, failed on score (Clouatre, 2026).&lt;/p&gt;
&lt;h3 id=&quot;how-does-project-context-reach-subagents&quot;&gt;How Does Project Context Reach Subagents?&lt;/h3&gt;
&lt;p&gt;Recipes define the workflow, but subagents also need project context: build commands, conventions, file structure. That’s where &lt;a href=&quot;https://agents.md/&quot;&gt;&lt;code&gt;AGENTS.md&lt;/code&gt;&lt;/a&gt; comes in, a portable markdown file that provides the baseline knowledge every subagent inherits. Goose, Cursor, Codex, and 40+ other tools read it natively. In &lt;a href=&quot;https://vercel.com/blog/agents-md-outperforms-skills-in-our-agent-evals&quot;&gt;Vercel’s evals&lt;/a&gt; (Gao, 2026), an &lt;code&gt;AGENTS.md&lt;/code&gt; file achieved a 100% pass rate on build, lint, and test tasks where skills-based approaches maxed out at 79%.&lt;/p&gt;
&lt;p&gt;Think of it as CSS for agents: global rules cascade into every project, project-specific rules override where needed. The orchestrator and every subagent it spawns inherit both layers without explicit prompting.&lt;/p&gt;
&lt;figure&gt;&lt;figcaption&gt;&lt;strong&gt;Code Snippet 1:&lt;/strong&gt; Global and project-level AGENTS.md files. The builder subagent from Table 1 inherits both layers: it knows to GPG-sign commits (global) and use cargo-deny (project) without either appearing in the handoff JSON.&lt;/figcaption&gt;&lt;pre class=&quot;astro-code astro-code-themes catppuccin-latte catppuccin-macchiato mt-8&quot; style=&quot;--shiki-light:#4c4f69; --shiki-dark:#cad3f5; --shiki-light-bg:#eff1f5; --shiki-dark-bg:#24273a; --file-name-offset: -0.75rem&quot; tabindex=&quot;0&quot; data-language=&quot;markdown&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#FE640B;--shiki-dark:#F5A97F&quot;&gt;## Commits&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt; Conventional commits, GPG signed and DCO sign-off&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt; Feature branches only, PRs for everything&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line highlighted&quot;&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt; Never merge without explicit user request&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#FE640B;--shiki-dark:#F5A97F&quot;&gt;## Security&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt; Treat all repositories as public&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt; No secrets, API keys, credentials, or PII&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;span class=&quot;absolute py-1 text-foreground text-xs font-medium leading-4 pl-4 pr-2 before:inline-block before:size-1 before:bg-green-500 before:rounded-full before:absolute before:top-[45%] before:left-2 left-2 top-(--file-name-offset) border rounded-md bg-background&quot;&gt;~/.config/goose/AGENTS.md&lt;/span&gt;&lt;/pre&gt;&lt;/figure&gt;
&lt;pre class=&quot;astro-code astro-code-themes catppuccin-latte catppuccin-macchiato mt-8&quot; style=&quot;--shiki-light:#4c4f69; --shiki-dark:#cad3f5; --shiki-light-bg:#eff1f5; --shiki-dark-bg:#24273a; --file-name-offset: -0.75rem&quot; tabindex=&quot;0&quot; data-language=&quot;markdown&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#FE640B;--shiki-dark:#F5A97F&quot;&gt;## Stack&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;Rust 2024 + Tokio + Clap (derive) + Octocrab&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#FE640B;--shiki-dark:#F5A97F&quot;&gt;## Project-Specific Patterns&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt; Apache-2.0 license with SPDX headers&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line highlighted&quot;&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt; cargo-deny for dependency audits&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;span class=&quot;absolute py-1 text-foreground text-xs font-medium leading-4 pl-4 pr-2 before:inline-block before:size-1 before:bg-green-500 before:rounded-full before:absolute before:top-[45%] before:left-2 left-2 top-(--file-name-offset) border rounded-md bg-background&quot;&gt;aptu/AGENTS.md&lt;/span&gt;&lt;/pre&gt;
&lt;h2 id=&quot;how-do-subagents-communicate&quot;&gt;How Do Subagents Communicate?&lt;/h2&gt;
&lt;p&gt;Subagents communicate through JSON files in &lt;code&gt;$WORKTREE/.handoff/&lt;/code&gt;. Each session uses an isolated git worktree, so handoff files are scoped to that execution context. This creates an explicit contract between phases.&lt;/p&gt;



































&lt;table tabindex=&quot;0&quot;&gt;&lt;caption&gt;&lt;strong&gt;Table 5:&lt;/strong&gt; Handoff file chain. Each file is scoped to one phase transition.&lt;/caption&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;File&lt;/th&gt;&lt;th&gt;From&lt;/th&gt;&lt;th&gt;To&lt;/th&gt;&lt;/tr&gt;&lt;/thead&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;code&gt;01a-research-scout.json&lt;/code&gt;&lt;/td&gt;&lt;td&gt;SCOUT&lt;/td&gt;&lt;td&gt;GUARD&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;code&gt;01b-research-guard.json&lt;/code&gt;&lt;/td&gt;&lt;td&gt;GUARD&lt;/td&gt;&lt;td&gt;ORCHESTRATOR&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;code&gt;02-plan.json&lt;/code&gt;&lt;/td&gt;&lt;td&gt;ORCHESTRATOR&lt;/td&gt;&lt;td&gt;BUILD&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;code&gt;03-build.json&lt;/code&gt;&lt;/td&gt;&lt;td&gt;BUILD&lt;/td&gt;&lt;td&gt;CHECK&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;code&gt;04-validation.json&lt;/code&gt;&lt;/td&gt;&lt;td&gt;CHECK&lt;/td&gt;&lt;td&gt;BUILD (on failure)&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;
&lt;p&gt;GUARD confirms SCOUT’s file list, scores each approach by safety, and flags risks SCOUT didn’t surface. The orchestrator synthesizes both into a plan only after GUARD clears it.&lt;/p&gt;
&lt;figure&gt;&lt;figcaption&gt;&lt;strong&gt;Code Snippet 3:&lt;/strong&gt; GUARD handoff file. Three things SCOUT didn’t produce: a risk with concrete mitigation, safety scores with rationale, and a test gap.&lt;/figcaption&gt;&lt;pre class=&quot;astro-code astro-code-themes catppuccin-latte catppuccin-macchiato has-highlighted mt-8&quot; style=&quot;--shiki-light:#4c4f69; --shiki-dark:#cad3f5; --shiki-light-bg:#eff1f5; --shiki-dark-bg:#24273a; --file-name-offset: -0.75rem&quot; tabindex=&quot;0&quot; data-language=&quot;json&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;  &quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;scout_verification&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt; {&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;accurate&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#FE640B;--shiki-dark:#F5A97F&quot;&gt; true&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt; &quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;corrections&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt; []},&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;  &quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;risks&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt; [&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;    {&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;      &quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;function&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; &quot;try_with_fallback&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;      &quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;risk&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; &quot;Async extraction requires careful borrowing&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;      &quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;severity&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; &quot;medium&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line highlighted&quot;&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;      &quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;mitigation&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; &quot;Extract only sync setup; keep async operation in caller&quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;    }&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;  ],&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;  &quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;safety_ranking&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt; [&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line highlighted&quot;&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;    {&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;id&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; &quot;A&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt; &quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;score&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#FE640B;--shiki-dark:#F5A97F&quot;&gt; 95&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt; &quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;rationale&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; &quot;Minimal scope, aligns with existing patterns&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;},&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;    {&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;id&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; &quot;B&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt; &quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;score&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#FE640B;--shiki-dark:#F5A97F&quot;&gt; 70&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt; &quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;rationale&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; &quot;Struct over-engineered for current scope&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;},&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;    {&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;id&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; &quot;C&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt; &quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;score&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#FE640B;--shiki-dark:#F5A97F&quot;&gt; 55&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt; &quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;rationale&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; &quot;try_fold() pattern; highest maintenance risk&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;  ],&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line highlighted&quot;&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;  &quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;guard_test_gaps&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt; [&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;    &quot;try_with_fallback: add test for fallback chain with real failures&quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;  ]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;span class=&quot;absolute py-1 text-foreground text-xs font-medium leading-4 pl-4 pr-2 before:inline-block before:size-1 before:bg-green-500 before:rounded-full before:absolute before:top-[45%] before:left-2 left-2 top-(--file-name-offset) border rounded-md bg-background&quot;&gt;.handoff/01b-research-guard.json&lt;/span&gt;&lt;/pre&gt;&lt;/figure&gt;
&lt;p&gt;The plan file contains everything the builder needs:&lt;/p&gt;
&lt;figure&gt;&lt;figcaption&gt;&lt;strong&gt;Code Snippet 4:&lt;/strong&gt; Plan handoff file with structured task definition for the builder subagent.&lt;/figcaption&gt;&lt;pre class=&quot;astro-code astro-code-themes catppuccin-latte catppuccin-macchiato has-highlighted mt-8&quot; style=&quot;--shiki-light:#4c4f69; --shiki-dark:#cad3f5; --shiki-light-bg:#eff1f5; --shiki-dark-bg:#24273a; --file-name-offset: -0.75rem&quot; tabindex=&quot;0&quot; data-language=&quot;json&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line highlighted&quot;&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;  &quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;overview&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; &quot;Remove 4 dead render_with_context methods&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;  &quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;files&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt; [&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;    {&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;path&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; &quot;src/output/triage.rs&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt; &quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;action&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; &quot;modify&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;},&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;    {&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;path&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; &quot;src/output/history.rs&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt; &quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;action&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; &quot;modify&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;},&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;    {&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;path&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; &quot;src/output/bulk.rs&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt; &quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;action&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; &quot;modify&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;},&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;    {&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;path&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; &quot;src/output/create.rs&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt; &quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;action&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; &quot;modify&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;  ],&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;  &quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;steps&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt; [&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;    &quot;Remove render_with_context impl blocks from each file&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;    &quot;Remove #[allow(dead_code)] annotations&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;    &quot;Remove unused imports&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;    &quot;Run cargo fmt &amp;#x26;&amp;#x26; cargo clippy &amp;#x26;&amp;#x26; cargo test&quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;  ],&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line highlighted&quot;&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;  &quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;risks&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt; [&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;&quot;None - confirmed dead code&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;span class=&quot;absolute py-1 text-foreground text-xs font-medium leading-4 pl-4 pr-2 before:inline-block before:size-1 before:bg-green-500 before:rounded-full before:absolute before:top-[45%] before:left-2 left-2 top-(--file-name-offset) border rounded-md bg-background&quot;&gt;.handoff/02-plan.json&lt;/span&gt;&lt;/pre&gt;&lt;/figure&gt;
&lt;p&gt;The validator reads both &lt;code&gt;02-plan.json&lt;/code&gt; and &lt;code&gt;03-build.json&lt;/code&gt; to verify implementation matches requirements. It writes structured feedback to &lt;code&gt;04-validation.json&lt;/code&gt;:&lt;/p&gt;
&lt;figure&gt;&lt;figcaption&gt;&lt;strong&gt;Code Snippet 5:&lt;/strong&gt; Validation handoff file with actionable feedback for the builder to address.&lt;/figcaption&gt;&lt;pre class=&quot;astro-code astro-code-themes catppuccin-latte catppuccin-macchiato has-highlighted mt-8&quot; style=&quot;--shiki-light:#4c4f69; --shiki-dark:#cad3f5; --shiki-light-bg:#eff1f5; --shiki-dark-bg:#24273a; --file-name-offset: -0.75rem&quot; tabindex=&quot;0&quot; data-language=&quot;json&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;{&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line highlighted&quot;&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;  &quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;verdict&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; &quot;FAIL&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;  &quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;checks&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt; [&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;    {&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;name&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; &quot;Remove #[allow(dead_code)] annotations&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt; &quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;status&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; &quot;FAIL&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;,&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;     &quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;notes&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; &quot;Annotations still present in history.rs:145, bulk.rs:31, create.rs:63&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;  ],&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;  &quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;issues&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt; [&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;&quot;Plan required removing annotations, but these are still present&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;],&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line highlighted&quot;&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;  &quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;next_steps&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; &quot;Fix issue: Remove the three annotations, then re-validate&quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;}&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;span class=&quot;absolute py-1 text-foreground text-xs font-medium leading-4 pl-4 pr-2 before:inline-block before:size-1 before:bg-green-500 before:rounded-full before:absolute before:top-[45%] before:left-2 left-2 top-(--file-name-offset) border rounded-md bg-background&quot;&gt;.handoff/04-validation.json&lt;/span&gt;&lt;/pre&gt;&lt;/figure&gt;
&lt;p&gt;The builder reads this feedback, fixes the specific issues, and triggers another CHECK cycle until validation passes.&lt;/p&gt;
&lt;p&gt;Why files instead of memory? Three reasons:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Auditable.&lt;/strong&gt; Every decision is recorded. Debug failures by reading the handoff chain.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Resumable.&lt;/strong&gt; Handoff files checkpoint state. Resume any session from where it stopped.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Debuggable.&lt;/strong&gt; Failed validations include exact locations and actionable next steps.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Both Goose and Claude Code resume sessions natively, but they restore full conversation history, reintroducing the context rot this architecture avoids. Resuming here means picking up the plan and build results with fresh agent context, not replaying an accumulated chat.&lt;/p&gt;
&lt;figure&gt;&lt;img alt=&quot;BUILD-CHECK feedback loop diagram showing PASS, PASS WITH NOTES, and FAIL verdict routing&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; sizes=&quot;(min-width: 658px) 658px, 100vw&quot; data-astro-image=&quot;constrained&quot; data-astro-image-pos=&quot;center&quot; width=&quot;658&quot; height=&quot;529&quot; src=&quot;/_astro/build-check-feedback-loop.DnlGcnQ__151o8A.svg&quot; srcset=&quot;/_astro/build-check-feedback-loop.DnlGcnQ__fK9Lu.svg 640w, /_astro/build-check-feedback-loop.DnlGcnQ__151o8A.svg 658w&quot;&gt;&lt;figcaption&gt;&lt;strong&gt;Figure 2:&lt;/strong&gt; BUILD-CHECK feedback loop. Validation verdict routes to PR-ready state on PASS, user gate on PASS WITH NOTES, or retry loop on FAIL with actionable next steps.&lt;/figcaption&gt;&lt;/figure&gt;
&lt;h2 id=&quot;where-should-human-judgment-stay-in-ai-workflows&quot;&gt;Where Should Human Judgment Stay in AI Workflows?&lt;/h2&gt;
&lt;p&gt;The quality of the input determines the ceiling for everything that follows. A well-scoped GitHub issue with clear acceptance criteria and explicit constraints, written with AI assistance but reviewed by a human, is the best prompt you can give this workflow. Imprecise requirements produce technically correct but misaligned results. A high-quality issue or spec is the single biggest lever for PR acceptance rate.&lt;/p&gt;
&lt;p&gt;The workflow runs autonomously: RESEARCH, PLAN, BUILD, and CHECK all auto-proceed. The one recommended human touchpoint at the end is the PR review itself. The code has your name on it.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Phases (all auto-proceed):&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;SETUP: Initialize context and gather requirements&lt;/li&gt;
&lt;li&gt;RESEARCH: SCOUT and GUARD run sequentially; the orchestrator synthesizes their findings autonomously&lt;/li&gt;
&lt;li&gt;PLAN: Design solution based on research synthesis&lt;/li&gt;
&lt;li&gt;BUILD: Execute the approved plan&lt;/li&gt;
&lt;li&gt;CHECK: Validate and loop back to BUILD on failure, then push to PR&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;what-results-does-this-produce&quot;&gt;What Results Does This Produce?&lt;/h2&gt;
&lt;p&gt;This architecture powers development across multiple projects. Three examples from &lt;a href=&quot;https://github.com/clouatre-labs/aptu&quot;&gt;aptu&lt;/a&gt;:&lt;/p&gt;

























&lt;table tabindex=&quot;0&quot;&gt;&lt;caption&gt;&lt;strong&gt;Table 3:&lt;/strong&gt; Representative PRs using subagent architecture. All passed CI, all merged without rework.&lt;/caption&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;PR&lt;/th&gt;&lt;th&gt;Scope&lt;/th&gt;&lt;th&gt;Files Changed&lt;/th&gt;&lt;/tr&gt;&lt;/thead&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;a href=&quot;https://github.com/clouatre-labs/aptu/pull/272&quot;&gt;#272&lt;/a&gt;&lt;/td&gt;&lt;td&gt;Consolidate 4 clients → 1 generic&lt;/td&gt;&lt;td&gt;9 files&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;a href=&quot;https://github.com/clouatre-labs/aptu/pull/256&quot;&gt;#256&lt;/a&gt;&lt;/td&gt;&lt;td&gt;Add Groq + Cerebras providers&lt;/td&gt;&lt;td&gt;9 files&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;a href=&quot;https://github.com/clouatre-labs/aptu/pull/244&quot;&gt;#244&lt;/a&gt;&lt;/td&gt;&lt;td&gt;Extract shared AiProvider trait&lt;/td&gt;&lt;td&gt;9 files&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;
&lt;p&gt;The validation phase caught issues the builder missed. In PR #272, the CHECK subagent identified a missing trait bound that would have failed compilation. The builder fixed it on the retry loop. No human intervention required.&lt;/p&gt;
&lt;p&gt;The CHECK phase consistently catches issues before they reach a PR: wrong serde attributes, uncommitted builds, scope creep, CLI interface drift, and formatting violations. The workflow now operates at production scale across dozens of repositories, with thousands of pull requests merged. Representative public benchmarks: aptu reached PR #1,325 and aptu-coder reached PR #1,038, both built entirely with this pipeline.&lt;/p&gt;
&lt;h3 id=&quot;design-targets&quot;&gt;Design Targets&lt;/h3&gt;
&lt;p&gt;Enterprise platforms reach the same conclusions at scale. Sid Pardeshi, CTO of Blitzy, described on the &lt;a href=&quot;https://twimlai.com/podcast/twimlai/agent-swarms-knowledge-graphs-autonomous-software-development&quot;&gt;TWiML AI podcast&lt;/a&gt; (2026) a system that writes millions of lines of code autonomously. His diagnosis of the root constraint is identical: the effective context window has been stuck at 80-120K tokens for two years, regardless of headline sizes. Their solution replaces the single orchestrator with a database as the coordination layer, enabling tens of thousands of parallel agents. The architectural principle is the same one this workflow applies: isolate context, specialize roles, and pass structured state between agents rather than accumulating a single conversation.&lt;/p&gt;
&lt;p&gt;Research on multi-agent frameworks for code generation shows they &lt;a href=&quot;https://arxiv.org/abs/2510.08804&quot;&gt;consistently outperform single-model systems&lt;/a&gt; (Raghavan &amp;#x26; Mallick, 2025).&lt;/p&gt;



































&lt;table tabindex=&quot;0&quot;&gt;&lt;caption&gt;&lt;strong&gt;Table 4:&lt;/strong&gt; Isolated context, specialized roles, structured state over accumulated conversation.&lt;/caption&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Metric&lt;/th&gt;&lt;th&gt;Single-Agent&lt;/th&gt;&lt;th&gt;Multi-Agent&lt;/th&gt;&lt;/tr&gt;&lt;/thead&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;Output quality over session&lt;/td&gt;&lt;td&gt;Degrades as context fills&lt;/td&gt;&lt;td&gt;Stable (each agent starts fresh)&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Model strategy&lt;/td&gt;&lt;td&gt;Generic model&lt;/td&gt;&lt;td&gt;Specialized per role&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Estimated cost reduction&lt;/td&gt;&lt;td&gt;Baseline&lt;/td&gt;&lt;td&gt;50-60% via model routing&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Human interventions&lt;/td&gt;&lt;td&gt;Throughout&lt;/td&gt;&lt;td&gt;Issue scoping + PR review&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Audit trail&lt;/td&gt;&lt;td&gt;Conversation history&lt;/td&gt;&lt;td&gt;Structured JSON handoff chain&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;
&lt;h2 id=&quot;when-does-this-work-and-when-doesnt-it&quot;&gt;When Does This Work (and When Doesn’t It)?&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;Works well for:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Multi-file refactors where context isolation prevents confusion&lt;/li&gt;
&lt;li&gt;Feature additions following established patterns&lt;/li&gt;
&lt;li&gt;Complex changes requiring distinct planning and execution&lt;/li&gt;
&lt;li&gt;Teams wanting audit trails (handoff files document decisions)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Less effective for:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Simple one-file fixes (overhead exceeds benefit)&lt;/li&gt;
&lt;li&gt;Legacy systems without clear patterns (builder lacks context)&lt;/li&gt;
&lt;li&gt;Exploratory work where plans change during implementation&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;See &lt;a href=&quot;/posts/ai-agents-legacy-roi&quot;&gt;AI agents in legacy environments&lt;/a&gt; for integration patterns that work when your data lives in mainframes and AS400 systems.&lt;/p&gt;
&lt;h2 id=&quot;takeaways&quot;&gt;Takeaways&lt;/h2&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Separate reasoning from execution.&lt;/strong&gt; Use capable models for planning, fast models for building.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Fresh context beats accumulated context.&lt;/strong&gt; Subagents start clean. They follow instructions without historical baggage.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Structured handoffs create audit trails.&lt;/strong&gt; JSON files document what was planned, built, and validated.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Quality input, autonomous execution.&lt;/strong&gt; A well-scoped issue is the highest-leverage human contribution.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;The full workflow is available on &lt;a href=&quot;https://gist.github.com/clouatre/d771fc03240a119a1f9a09203ba02d65&quot;&gt;GitHub Gist&lt;/a&gt; as both a Goose recipe (YAML) and a Claude Code skill (Markdown). It builds on patterns from &lt;a href=&quot;/posts/ai-assisted-development/&quot;&gt;AI-Assisted Development: The Accountability Layer&lt;/a&gt;.&lt;/p&gt;
&lt;hr&gt;
&lt;p&gt;The agentic architecture described in this post is the subject of Canadian patent application CA 3315347, filed Jun 16, 2026 (CIPO).&lt;/p&gt;
&lt;h2 id=&quot;references&quot;&gt;References&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Anthropic Engineering, “How we built our multi-agent research system” (2025) — &lt;a href=&quot;https://www.anthropic.com/engineering/multi-agent-research-system&quot;&gt;https://www.anthropic.com/engineering/multi-agent-research-system&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Bain &amp;#x26; Company, “From Pilots to Payoff: Generative AI in Software Development” (2025) — &lt;a href=&quot;https://www.bain.com/insights/from-pilots-to-payoff-generative-ai-in-software-development-technology-report-2025/&quot;&gt;https://www.bain.com/insights/from-pilots-to-payoff-generative-ai-in-software-development-technology-report-2025/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Chroma Research, “Context Rot: How Increasing Input Tokens Impacts LLM Performance” (2025) — &lt;a href=&quot;https://research.trychroma.com/context-rot&quot;&gt;https://research.trychroma.com/context-rot&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Gao, Jude, “AGENTS.md outperforms skills in our agent evals” (2026) — &lt;a href=&quot;https://vercel.com/blog/agents-md-outperforms-skills-in-our-agent-evals&quot;&gt;https://vercel.com/blog/agents-md-outperforms-skills-in-our-agent-evals&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Clouatre, H., “LLM Agent Experiments: Model Comparison for SCOUT Delegates” (2026) — &lt;a href=&quot;https://doi.org/10.5281/zenodo.19056876&quot;&gt;https://doi.org/10.5281/zenodo.19056876&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Gandhi et al., “BudgetMLAgent: A Cost-Effective LLM Multi-Agent System” (2025) — &lt;a href=&quot;https://arxiv.org/abs/2411.07464&quot;&gt;https://arxiv.org/abs/2411.07464&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Pardeshi, Sid, “Agent Swarms, Knowledge Graphs, and Autonomous Software Development” (2026) — &lt;a href=&quot;https://twimlai.com/podcast/twimlai/agent-swarms-knowledge-graphs-autonomous-software-development&quot;&gt;https://twimlai.com/podcast/twimlai/agent-swarms-knowledge-graphs-autonomous-software-development&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Raghavan &amp;#x26; Mallick, “MOSAIC: Multi-agent Orchestration for Task-Intelligent Scientific Coding” (2025) — &lt;a href=&quot;https://arxiv.org/abs/2510.08804&quot;&gt;https://arxiv.org/abs/2510.08804&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</content:encoded><category>agentic-ai</category><category>architecture</category><category>goose</category><category>implementation-guide</category><author>Hugues Clouâtre</author></item><item><title>AI-Augmented CI/CD: Shift Left Security Without Risk</title><link>https://clouatre.ca/posts/ai-augmented-cicd/</link><guid isPermaLink="true">https://clouatre.ca/posts/ai-augmented-cicd/</guid><description>AI code review in CI/CD without prompt injection. Defensive patterns: three security tiers, isolated execution, no secrets in prompts.</description><pubDate>Mon, 30 Mar 2026 16:16:00 GMT</pubDate><content:encoded>&lt;p&gt;Code reviews are a bottleneck. Engineering teams lose measurable velocity waiting for feedback. This delay compounds when security vulnerabilities escalate: defects caught late cost orders of magnitude more to fix than those caught at design time.&lt;/p&gt;
&lt;p&gt;AI in CI/CD augments human review by analyzing code patterns and tool outputs before human reviewers see the changes.&lt;/p&gt;
&lt;h2 id=&quot;table-of-contents&quot;&gt;Table of contents&lt;/h2&gt;
&lt;p&gt;&lt;/p&gt;&lt;details&gt;&lt;summary&gt;Contents&lt;/summary&gt;&lt;p&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;#what-is-the-real-cost-of-manual-code-review&quot;&gt;What Is the Real Cost of Manual Code Review?&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;#the-review-bottleneck&quot;&gt;The Review Bottleneck&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#the-security-cost-multiplier&quot;&gt;The Security Cost Multiplier&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#the-prompt-injection-risk&quot;&gt;The Prompt Injection Risk&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#how-does-ai-integration-work-without-prompt-injection-risk&quot;&gt;How Does AI Integration Work Without Prompt Injection Risk?&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#how-do-tier-2-and-tier-3-balance-speed-against-security&quot;&gt;How Do Tier 2 and Tier 3 Balance Speed Against Security?&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#how-does-uncontrolled-ai-analysis-become-a-security-risk&quot;&gt;How Does Uncontrolled AI Analysis Become a Security Risk?&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#what-outcomes-does-ai-augmented-cicd-deliver&quot;&gt;What Outcomes Does AI-Augmented CI/CD Deliver?&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#how-do-you-get-started-with-ai-augmented-cicd&quot;&gt;How Do You Get Started With AI-Augmented CI/CD?&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;#start-with-tier-1&quot;&gt;Start With Tier 1&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#measure-before-you-integrate&quot;&gt;Measure Before You Integrate&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#tune-for-signal-quality&quot;&gt;Tune for Signal Quality&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#give-the-ai-project-context&quot;&gt;Give the AI Project Context&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#references&quot;&gt;References&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;/p&gt;&lt;/details&gt;&lt;p&gt;&lt;/p&gt;
&lt;h2 id=&quot;what-is-the-real-cost-of-manual-code-review&quot;&gt;What Is the Real Cost of Manual Code Review?&lt;/h2&gt;
&lt;h3 id=&quot;the-review-bottleneck&quot;&gt;The Review Bottleneck&lt;/h3&gt;
&lt;p&gt;Development velocity correlates with code review latency. Code review bottlenecks are well-documented across engineering teams. Feedback loops stretch from hours to days while developers context-switch or wait on reviewers. Research from Forsgren et al. (2024) shows context-switching during code review significantly reduces developer productivity and satisfaction.&lt;/p&gt;
&lt;p&gt;GitHub’s 2024 Octoverse reports median time from PR open to first review is 4 hours in large organizations, 22 hours in enterprises.&lt;/p&gt;
&lt;p&gt;Traditional CI/CD pipelines run automated linters and security scanners, generate reports, then stop. A human reads the output, interprets it, decides if it matters, and either approves or comments. This handoff creates velocity bottlenecks. Eight-hour review windows delay production deployments. Critical insights get buried in noise. Studies confirm developers fear review delays will slow delivery, even though they recognize reviews’ long-term quality benefits (Santos et al., 2024). The cost of this wait scales with engineer compensation.&lt;/p&gt;
&lt;h3 id=&quot;the-security-cost-multiplier&quot;&gt;The Security Cost Multiplier&lt;/h3&gt;
&lt;p&gt;Security defects amplify this cost multiplier. Boehm &amp;#x26; Basili (2001) document that the cost multiplier is phase-dependent, rising from single-digit factors at design time to two or more orders of magnitude at production; Tassey (2002) corroborates these findings at the systems level. The expenses compound: rework costs, deployment delays, and potential security incidents each add to the total as the defect progresses through the pipeline.&lt;/p&gt;
&lt;p&gt;Shift-left automation detects issues before a PR merges, before human review begins. AI analyzes linter output, security scan results, and code patterns in seconds. Developers receive immediate feedback, iterate faster, and ship with higher confidence.&lt;/p&gt;
&lt;h3 id=&quot;the-prompt-injection-risk&quot;&gt;The Prompt Injection Risk&lt;/h3&gt;
&lt;p&gt;Raw AI analysis of code diffs introduces a critical vulnerability: prompt injection. If a CI/CD pipeline feeds user-submitted code directly to an AI model, an attacker can craft a PR with embedded instructions that manipulate the AI’s behavior. The AI might approve malicious code, disable security checks, or expose sensitive information. This is not theoretical. It represents a live attack surface in every AI-augmented system.&lt;/p&gt;
&lt;p&gt;Defensive architecture mitigates this risk. The AI analyzes &lt;em&gt;tool output&lt;/em&gt; (structured, deterministic results from linters, security scanners, and static analysis) rather than untrusted input directly. The pipeline sequence: linter runs first, generates JSON, AI summarizes the findings, human approves. This removes the direct injection vector, though structured output can still carry adversarially crafted content via file paths or error message text (OWASP, 2025).&lt;/p&gt;
&lt;p&gt;Threat models vary by repository type. A private repository with a trusted five-person team tolerates different risk than open-source projects accepting external contributors. Three security tiers match different threat models while maintaining analysis speed.&lt;/p&gt;
&lt;h2 id=&quot;how-does-ai-integration-work-without-prompt-injection-risk&quot;&gt;How Does AI Integration Work Without Prompt Injection Risk?&lt;/h2&gt;
&lt;p&gt;Tier 1 eliminates prompt injection risk. The linter runs first, produces JSON output, and the AI analyzes only that structured data. The AI never sees the raw code, never processes user input, and never runs in the context of potentially malicious diffs. Using an independent review instance, one without prior context from code generation, is the recommended architectural pattern; a session that wrote the code carries implicit context that can suppress contradictory findings during self-review.&lt;/p&gt;
&lt;figure&gt;&lt;figcaption&gt;&lt;strong&gt;Code Snippet 1:&lt;/strong&gt; In Tier 1, AI analyzes only JSON output from the linter, never raw code. &lt;a href=&quot;https://github.com/clouatre-labs/setup-goose-action/blob/main/examples/tier1-maximum-security.yml&quot;&gt;Full example&lt;/a&gt;&lt;/figcaption&gt;&lt;pre class=&quot;astro-code astro-code-themes catppuccin-latte catppuccin-macchiato has-highlighted mt-8&quot; style=&quot;--shiki-light:#4c4f69; --shiki-dark:#cad3f5; --shiki-light-bg:#eff1f5; --shiki-dark-bg:#24273a; --file-name-offset: -0.75rem&quot; tabindex=&quot;0&quot; data-language=&quot;yaml&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;name&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; AI Analysis - Maximum Security&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#FE640B;--shiki-dark:#F5A97F&quot;&gt;on&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt; [&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;pull_request&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;permissions&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;  contents&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; read&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;jobs&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;  analyze&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;    runs-on&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; ubuntu-24.04&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;    steps&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;      -&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt; name&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; Checkout&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;        uses&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-light-font-style:italic;--shiki-dark:#939AB7;--shiki-dark-font-style:italic&quot;&gt;  # v6.0.2&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;      &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;      -&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt; name&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; Lint Code&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;        run&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; pipx run ruff check --output-format=json . &gt; lint.json || exit 0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;      &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;      -&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt; name&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; Setup Goose&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;        uses&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; clouatre-labs/setup-goose-action@35f35c3a8f08aa333486693114938ec643bf8310&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-light-font-style:italic;--shiki-dark:#939AB7;--shiki-dark-font-style:italic&quot;&gt;  # v1.0.7&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;      &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;      -&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt; name&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; AI Analysis&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;        env&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;          GOOGLE_API_KEY&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; ${{ secrets.GOOGLE_API_KEY }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;        run&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-dark:#C6A0F6&quot;&gt; |&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;          echo &quot;Summarize these linting issues:&quot; &gt; prompt.txt&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;          cat lint.json &gt;&gt; prompt.txt&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line highlighted&quot;&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;          # Only structured tool output appended. Never raw source code.&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;          goose run --instructions prompt.txt --no-session --quiet &gt; analysis.md&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;      &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;      -&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt; name&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; Upload Analysis&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;        uses&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-light-font-style:italic;--shiki-dark:#939AB7;--shiki-dark-font-style:italic&quot;&gt;  # v7.0.0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;        with&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;          name&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; ai-analysis&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;          path&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; analysis.md&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;span class=&quot;absolute py-1 text-foreground text-xs font-medium leading-4 pl-4 pr-2 before:inline-block before:size-1 before:bg-green-500 before:rounded-full before:absolute before:top-[45%] before:left-2 left-2 top-(--file-name-offset) border rounded-md bg-background&quot;&gt;tier1-maximum-security.yml&lt;/span&gt;&lt;/pre&gt;&lt;/figure&gt;
&lt;p&gt;Pinning actions to a commit SHA rather than a floating tag is a supply chain control, not a style preference. In March 2026, the Trivy ecosystem supply chain was briefly compromised (&lt;a href=&quot;https://github.com/advisories/GHSA-69fq-xp46-6x23&quot;&gt;CVE-2026-33634&lt;/a&gt;): an attacker force-pushed 76 version tags in &lt;code&gt;aquasecurity/trivy-action&lt;/code&gt; to point to credential-stealing code, and every workflow using a floating tag silently executed the malicious version. A SHA reference is immutable, so tag mutation has no effect. The maintenance burden is minimal: Renovate and Dependabot both open automated PRs to bump pinned SHAs when upstream releases a new version, so staying current requires only a one-click merge.&lt;/p&gt;
&lt;p&gt;The AI sees only JSON. No code, no comments, no user input. Attack surface is minimal, but file paths and error strings in JSON output remain a residual indirect-injection vector (OWASP, 2025). This pattern applies to public repositories, open-source projects, and any system where external contributors submit PRs.&lt;/p&gt;
&lt;figure&gt;&lt;img alt=&quot;Tier 1 defensive pattern: AI analyzes tool output, never sees raw code. Immune to prompt injection.&quot; loading=&quot;eager&quot; decoding=&quot;sync&quot; fetchpriority=&quot;high&quot; sizes=&quot;(min-width: 423px) 423px, 100vw&quot; data-astro-image=&quot;constrained&quot; data-astro-image-pos=&quot;center&quot; width=&quot;423&quot; height=&quot;480&quot; src=&quot;/_astro/tier1-workflow.BnxpK2XN_ZjFUSz.svg&quot; srcset=&quot;/_astro/tier1-workflow.BnxpK2XN_ZjFUSz.svg 423w&quot;&gt;&lt;figcaption&gt;&lt;strong&gt;Figure 1:&lt;/strong&gt; Tier 1 defensive pattern. AI analyzes tool output, never sees raw code. Immune to prompt injection.&lt;/figcaption&gt;&lt;/figure&gt;
&lt;h2 id=&quot;how-do-tier-2-and-tier-3-balance-speed-against-security&quot;&gt;How Do Tier 2 and Tier 3 Balance Speed Against Security?&lt;/h2&gt;
&lt;p&gt;Tier 2 provides additional context (file paths, change stats, commit metadata) without exposing raw code. This represents a middle ground: more insight than Tier 1, lower risk than Tier 3.&lt;/p&gt;
&lt;figure&gt;&lt;figcaption&gt;&lt;strong&gt;Code Snippet 2:&lt;/strong&gt; In Tier 2, AI sees file scope and metadata, but not code diffs. &lt;a href=&quot;https://github.com/clouatre-labs/setup-goose-action/blob/main/examples/tier2-balanced-security.yml&quot;&gt;Full example&lt;/a&gt;&lt;/figcaption&gt;&lt;pre class=&quot;astro-code astro-code-themes catppuccin-latte catppuccin-macchiato has-highlighted mt-8&quot; style=&quot;--shiki-light:#4c4f69; --shiki-dark:#cad3f5; --shiki-light-bg:#eff1f5; --shiki-dark-bg:#24273a; --file-name-offset: -0.75rem&quot; tabindex=&quot;0&quot; data-language=&quot;yaml&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;name&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; AI Analysis - Balanced Security&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#FE640B;--shiki-dark:#F5A97F&quot;&gt;on&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt; [&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;pull_request&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;permissions&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;  contents&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; read&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;jobs&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;  analyze&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;    runs-on&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; ubuntu-24.04&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;    steps&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;      -&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt; name&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; Checkout&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;        uses&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-light-font-style:italic;--shiki-dark:#939AB7;--shiki-dark-font-style:italic&quot;&gt;  # v6.0.2&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;      &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;      -&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt; name&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; Get Changed Files&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;        id&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; files&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;        run&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-dark:#C6A0F6&quot;&gt; |&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;          git diff --name-only origin/main...HEAD &gt; files.txt&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;          wc -l files.txt &gt;&gt; summary.txt&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;      &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;      -&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt; name&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; Setup Goose&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;        uses&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; clouatre-labs/setup-goose-action@35f35c3a8f08aa333486693114938ec643bf8310&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-light-font-style:italic;--shiki-dark:#939AB7;--shiki-dark-font-style:italic&quot;&gt;  # v1.0.7&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;      &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;      -&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt; name&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; AI Analysis&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;        env&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;          GOOGLE_API_KEY&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; ${{ secrets.GOOGLE_API_KEY }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;        run&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-dark:#C6A0F6&quot;&gt; |&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;          echo &quot;Review these file changes:&quot; &gt; prompt.txt&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;          cat files.txt summary.txt &gt;&gt; prompt.txt&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line highlighted&quot;&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;          # File names and stats. Not the actual code content.&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;          goose run --instructions prompt.txt --no-session --quiet &gt; analysis.md&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;      &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;      -&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt; name&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; Upload Analysis&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;        uses&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-light-font-style:italic;--shiki-dark:#939AB7;--shiki-dark-font-style:italic&quot;&gt;  # v7.0.0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;        with&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;          name&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; ai-analysis&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;          path&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; analysis.md&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;span class=&quot;absolute py-1 text-foreground text-xs font-medium leading-4 pl-4 pr-2 before:inline-block before:size-1 before:bg-green-500 before:rounded-full before:absolute before:top-[45%] before:left-2 left-2 top-(--file-name-offset) border rounded-md bg-background&quot;&gt;tier2-balanced-security.yml&lt;/span&gt;&lt;/pre&gt;&lt;/figure&gt;
&lt;p&gt;The AI sees file-level patterns but not line-by-line changes. Injection risk is low but non-zero: an attacker could craft filenames or commit messages to manipulate analysis. This tier applies to private repositories with trusted contributors.&lt;/p&gt;
&lt;p&gt;Tier 3 applies to small, trusted teams where analysis speed outweighs defense-in-depth requirements. The AI sees full code diffs. Injection risk exists but is controlled through human approval gates.&lt;/p&gt;
&lt;figure&gt;&lt;figcaption&gt;&lt;strong&gt;Code Snippet 3:&lt;/strong&gt; In Tier 3, AI sees full diffs for subtle patterns. &lt;a href=&quot;https://github.com/clouatre-labs/setup-goose-action/blob/main/examples/tier3-advanced-patterns.yml&quot;&gt;Full example&lt;/a&gt;&lt;/figcaption&gt;&lt;pre class=&quot;astro-code astro-code-themes catppuccin-latte catppuccin-macchiato has-highlighted mt-8&quot; style=&quot;--shiki-light:#4c4f69; --shiki-dark:#cad3f5; --shiki-light-bg:#eff1f5; --shiki-dark-bg:#24273a; --file-name-offset: -0.75rem&quot; tabindex=&quot;0&quot; data-language=&quot;yaml&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;name&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; AI Analysis - Advanced Patterns&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#FE640B;--shiki-dark:#F5A97F&quot;&gt;on&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt; [&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;pull_request&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;]&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;permissions&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;  contents&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; read&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;jobs&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;  analyze&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;    runs-on&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; ubuntu-24.04&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;    steps&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;      -&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt; name&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; Checkout&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;        uses&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-light-font-style:italic;--shiki-dark:#939AB7;--shiki-dark-font-style:italic&quot;&gt;  # v6.0.2&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;      &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;      -&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt; name&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; Get Full Diff&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;        run&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; git diff origin/main...HEAD &gt; changes.diff&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;      &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;      -&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt; name&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; Setup Goose&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;        uses&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; clouatre-labs/setup-goose-action@35f35c3a8f08aa333486693114938ec643bf8310&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-light-font-style:italic;--shiki-dark:#939AB7;--shiki-dark-font-style:italic&quot;&gt;  # v1.0.7&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;      &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;      -&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt; name&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; AI Analysis&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;        env&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;          GOOGLE_API_KEY&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; ${{ secrets.GOOGLE_API_KEY }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;        run&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-dark:#C6A0F6&quot;&gt; |&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;          echo &quot;Deeply analyze these code changes:&quot; &gt; prompt.txt&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;          cat changes.diff &gt;&gt; prompt.txt&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line highlighted&quot;&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;          # Complete code diffs for maximum context and detail&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;          goose run --instructions prompt.txt --no-session --quiet &gt; analysis.md&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;      &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;      -&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt; name&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; Upload Analysis&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;        uses&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-light-font-style:italic;--shiki-dark:#939AB7;--shiki-dark-font-style:italic&quot;&gt;  # v7.0.0&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;        with&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;          name&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; ai-analysis&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;          path&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; analysis.md&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;span class=&quot;absolute py-1 text-foreground text-xs font-medium leading-4 pl-4 pr-2 before:inline-block before:size-1 before:bg-green-500 before:rounded-full before:absolute before:top-[45%] before:left-2 left-2 top-(--file-name-offset) border rounded-md bg-background&quot;&gt;tier3-advanced-patterns.yml&lt;/span&gt;&lt;/pre&gt;&lt;/figure&gt;
&lt;p&gt;Each tier trades visibility for security. Tier 1 eliminates injection risk by sacrificing some context. Tier 2 accepts low risk for moderate context. Tier 3 prioritizes insight over security and is typically used sparingly.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Tier selection depends on three factors:&lt;/strong&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Repository access model (external contributors vs internal team)&lt;/li&gt;
&lt;li&gt;Required AI context (tool output vs full diffs)&lt;/li&gt;
&lt;li&gt;Risk tolerance (injection risk vs deeper analysis)&lt;/li&gt;
&lt;/ul&gt;
&lt;figure&gt;&lt;img alt=&quot;Three security tiers side-by-side showing input type, approval gates, and risk levels for each tier.&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; sizes=&quot;(min-width: 600px) 600px, 100vw&quot; data-astro-image=&quot;constrained&quot; data-astro-image-pos=&quot;center&quot; width=&quot;600&quot; height=&quot;522&quot; src=&quot;/_astro/tier-comparison.DXiNHCrM_ZgpJqt.svg&quot; srcset=&quot;/_astro/tier-comparison.DXiNHCrM_ZgpJqt.svg 600w&quot;&gt;&lt;figcaption&gt;&lt;strong&gt;Figure 2:&lt;/strong&gt; Three security tiers. Selection depends on threat model and team trust level.&lt;/figcaption&gt;&lt;/figure&gt;

































&lt;table tabindex=&quot;0&quot;&gt;&lt;caption&gt;&lt;strong&gt;Table 1:&lt;/strong&gt; Tier comparison: security, risk, and recommended use.&lt;/caption&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Tier&lt;/th&gt;&lt;th&gt;Input&lt;/th&gt;&lt;th&gt;Injection Risk&lt;/th&gt;&lt;th&gt;Approval Gate&lt;/th&gt;&lt;th&gt;Recommended For&lt;/th&gt;&lt;/tr&gt;&lt;/thead&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;strong&gt;1&lt;/strong&gt;&lt;/td&gt;&lt;td&gt;Tool output (JSON)&lt;/td&gt;&lt;td&gt;None&lt;/td&gt;&lt;td&gt;Human reviews artifact&lt;/td&gt;&lt;td&gt;Public repos, OSS, any external contributors&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;strong&gt;2&lt;/strong&gt;&lt;/td&gt;&lt;td&gt;File stats + metadata&lt;/td&gt;&lt;td&gt;Low&lt;/td&gt;&lt;td&gt;Human pre-approval&lt;/td&gt;&lt;td&gt;Private repos, internal teams&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;strong&gt;3&lt;/strong&gt;&lt;/td&gt;&lt;td&gt;Full code diff&lt;/td&gt;&lt;td&gt;Controlled&lt;/td&gt;&lt;td&gt;Optional&lt;/td&gt;&lt;td&gt;Tiny trusted teams only&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;
&lt;p&gt;The decision framework is simple: start at Tier 1. Measure deployment velocity, security posture, and developer satisfaction. Only move to Tier 2 or 3 if team consensus is that the additional AI context outweighs the injection risk. Most teams never need to leave Tier 1.&lt;/p&gt;
&lt;h2 id=&quot;how-does-uncontrolled-ai-analysis-become-a-security-risk&quot;&gt;How Does Uncontrolled AI Analysis Become a Security Risk?&lt;/h2&gt;
&lt;p&gt;The naive approach feeds AI the code diff directly and allows it to comment on the PR. This is fast, appears intelligent, and creates an injection surface. The improved approach layers security tiers on top, providing a decision framework that matches the threat model.&lt;/p&gt;
&lt;figure&gt;&lt;img alt=&quot;Evolution from uncontrolled AI analysis (high risk) to managed 3-tier model (risk controlled).&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; sizes=&quot;(min-width: 718px) 718px, 100vw&quot; data-astro-image=&quot;constrained&quot; data-astro-image-pos=&quot;center&quot; width=&quot;718&quot; height=&quot;483&quot; src=&quot;/_astro/security-evolution.BKbhvVEy_17B0Ld.svg&quot; srcset=&quot;/_astro/security-evolution.BKbhvVEy_1rPegF.svg 640w, /_astro/security-evolution.BKbhvVEy_17B0Ld.svg 718w&quot;&gt;&lt;figcaption&gt;&lt;strong&gt;Figure 3:&lt;/strong&gt; Evolution from uncontrolled AI analysis to risk-managed tiers.&lt;/figcaption&gt;&lt;/figure&gt;
&lt;p&gt;The shift is architectural, not just operational. The evolution moves from “AI sees everything and decides” to “AI sees what’s safe and humans decide what matters.” This distinction enables both security and speed improvements.&lt;/p&gt;






























&lt;table tabindex=&quot;0&quot;&gt;&lt;caption&gt;&lt;strong&gt;Table 2:&lt;/strong&gt; Architectural comparison: uncontrolled vs. managed AI analysis.&lt;/caption&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Dimension&lt;/th&gt;&lt;th&gt;Uncontrolled AI&lt;/th&gt;&lt;th&gt;Managed AI (Tiered)&lt;/th&gt;&lt;/tr&gt;&lt;/thead&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;&lt;strong&gt;Input to AI&lt;/strong&gt;&lt;/td&gt;&lt;td&gt;Full code diffs, commit messages, PR context&lt;/td&gt;&lt;td&gt;Structured tool output (Tier 1) or metadata (Tier 2)&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;strong&gt;Decision Authority&lt;/strong&gt;&lt;/td&gt;&lt;td&gt;AI suggests, human reviews comments&lt;/td&gt;&lt;td&gt;AI analyzes, human approves before action&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;strong&gt;Injection Surface&lt;/strong&gt;&lt;/td&gt;&lt;td&gt;High (user-submitted code in prompt)&lt;/td&gt;&lt;td&gt;Minimal to none (tool output only in Tier 1)&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;&lt;strong&gt;Applicable Context&lt;/strong&gt;&lt;/td&gt;&lt;td&gt;Small trusted teams only&lt;/td&gt;&lt;td&gt;All team sizes and trust models&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;
&lt;h2 id=&quot;what-outcomes-does-ai-augmented-cicd-deliver&quot;&gt;What Outcomes Does AI-Augmented CI/CD Deliver?&lt;/h2&gt;
&lt;p&gt;Human first-review latency runs 4–22 hours in large organizations (Graphite, “State of Code Review 2024”); in our implementation, AI analysis completes in 2–7 seconds, a reduction of three to four orders of magnitude compared to that baseline. Developers iterate faster because they receive feedback immediately. CI/CD pipelines do not stall waiting for human review availability.&lt;/p&gt;
&lt;p&gt;AI flags issues during windows when human attention degrades: late-night reviews, context-switching mid-sprint. Linting issues get flagged automatically. Security tool outputs get analyzed for severity and context. Fewer critical issues reach production because they are caught earlier in the workflow.&lt;/p&gt;
&lt;p&gt;For broader observability patterns in AI agent workflows, including legacy system integration, see &lt;a href=&quot;/posts/ai-agents-legacy-roi&quot;&gt;AI agents in legacy systems&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Developer satisfaction increases when velocity and quality both improve. Engineers are not blocked by the review process. They receive comprehensive feedback without waiting. They trust the pipeline because it combines deterministic tools with AI insight and human judgment.&lt;/p&gt;
&lt;p&gt;The expected directional outcomes, higher deployment frequency, lower mean time to resolution, fewer security incidents, follow directly from the mechanisms described above. Baseline measurement before integration is the only reliable way to confirm these trends in a given environment.&lt;/p&gt;
&lt;h2 id=&quot;how-do-you-get-started-with-ai-augmented-cicd&quot;&gt;How Do You Get Started With AI-Augmented CI/CD?&lt;/h2&gt;
&lt;h3 id=&quot;start-with-tier-1&quot;&gt;Start With Tier 1&lt;/h3&gt;
&lt;p&gt;Start with Tier 1. It provides maximum security with zero prompt injection risk. The &lt;a href=&quot;https://github.com/clouatre-labs/setup-goose-action/blob/main/examples/tier1-maximum-security.yml&quot;&gt;example workflow&lt;/a&gt; demonstrates the complete pattern. As of v1.0.7, the action verifies the Goose binary against its SLSA provenance attestation before installation, and the project holds an OpenSSF Best Practices Silver badge, a level reached by fewer than 1% of open-source projects. For AWS-native environments, &lt;a href=&quot;https://github.com/clouatre-labs/setup-kiro-action&quot;&gt;setup-kiro-action&lt;/a&gt; offers SIGV4 authentication without API keys in secrets.&lt;/p&gt;
&lt;p&gt;Tier selection depends on threat model. External contributors and public repositories warrant Tier 1. Internal teams with trusted code may benefit from Tier 2 or Tier 3 context. The key is matching exposure level to trust level.&lt;/p&gt;
&lt;h3 id=&quot;measure-before-you-integrate&quot;&gt;Measure Before You Integrate&lt;/h3&gt;
&lt;p&gt;Baseline measurement establishes the starting point: current review latency, deployment frequency, and security incident rate. A two-week measurement period provides sufficient data for comparison. After AI integration, the same metrics reveal impact.&lt;/p&gt;
&lt;p&gt;The human gate remains essential throughout. AI generates artifacts for review, not merge approvals. Engineers validate recommendations before acting. This preserves accountability while accelerating feedback cycles.&lt;/p&gt;
&lt;h3 id=&quot;tune-for-signal-quality&quot;&gt;Tune for Signal Quality&lt;/h3&gt;
&lt;p&gt;Explicit review criteria improve signal quality. Define which issue categories the AI should report (bugs, security vulnerabilities, API misuse) and which to skip (minor style preferences or project-local conventions). Vague instructions like “be thorough” produce high false-positive rates that erode developer trust across all finding categories.&lt;/p&gt;
&lt;p&gt;On re-runs after new commits, pass prior findings in context and instruct the AI to report only new or still-unaddressed issues. This prevents duplicate comments from accumulating on long-lived PRs. For large PRs spanning many files, split the review into a per-file local analysis pass followed by a separate cross-file integration pass. Reviewing everything in a single prompt overloads context and produces contradictory findings (Anthropic, “Best Practices for Claude Code”, 2026).&lt;/p&gt;
&lt;h3 id=&quot;give-the-ai-project-context&quot;&gt;Give the AI Project Context&lt;/h3&gt;
&lt;p&gt;An &lt;code&gt;AGENTS.md&lt;/code&gt; file at the repository root is the idiomatic mechanism for providing project-level context (testing standards, review criteria, fixture conventions) to CI-invoked AI without modifying prompts per workflow. Whether those gains materialise at the expected magnitude depends on how precisely the review criteria and context files are configured. The infrastructure exists; the constraint is configuration discipline.&lt;/p&gt;
&lt;hr&gt;
&lt;p&gt;For observability patterns in AI agent workflows, see &lt;a href=&quot;/posts/ai-observability-gaps&quot;&gt;AI Observability Gaps&lt;/a&gt;.&lt;/p&gt;
&lt;hr&gt;
&lt;h2 id=&quot;references&quot;&gt;References&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Anthropic, “Best Practices for Claude Code” (2026) - &lt;a href=&quot;https://code.claude.com/docs/en/best-practices&quot;&gt;https://code.claude.com/docs/en/best-practices&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Boehm &amp;#x26; Basili, “Software Defect Reduction Top 10 List” (2001) - &lt;a href=&quot;https://www.cs.umd.edu/projects/SoftEng/ESEG/papers/82.78.pdf&quot;&gt;https://www.cs.umd.edu/projects/SoftEng/ESEG/papers/82.78.pdf&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Forsgren et al., “DevEx in Action: A study of its tangible impacts” (2024) - &lt;a href=&quot;https://dl.acm.org/doi/10.1145/3639443&quot;&gt;https://dl.acm.org/doi/10.1145/3639443&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Graphite, “State of Code Review 2024” - &lt;a href=&quot;https://static.graphite.dev/Graphite_State_of_code_review_2024.pdf&quot;&gt;https://static.graphite.dev/Graphite_State_of_code_review_2024.pdf&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;GitHub Advisory Database, “Trivy ecosystem supply chain was briefly compromised” CVE-2026-33634 (2026) - &lt;a href=&quot;https://github.com/advisories/GHSA-69fq-xp46-6x23&quot;&gt;https://github.com/advisories/GHSA-69fq-xp46-6x23&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;OWASP LLM Top 10 (2025 edition), Prompt Injection LLM01 - &lt;a href=&quot;https://genai.owasp.org/llmrisk/llm01-prompt-injection/&quot;&gt;https://genai.owasp.org/llmrisk/llm01-prompt-injection/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Santos et al., “Modern code review in practice: A developer-centric study” (2024) - &lt;a href=&quot;https://www.sciencedirect.com/science/article/pii/S0164121224003327&quot;&gt;https://www.sciencedirect.com/science/article/pii/S0164121224003327&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Tassey, G., “The Economic Impacts of Inadequate Infrastructure for Software Testing,” NIST (2002) - &lt;a href=&quot;https://www.nist.gov/system/files/documents/director/planning/report02-3.pdf&quot;&gt;https://www.nist.gov/system/files/documents/director/planning/report02-3.pdf&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</content:encoded><category>agentic-ai</category><category>devops</category><category>security</category><category>implementation-guide</category><author>Hugues Clouâtre</author></item><item><title>AI-Assisted Development: The Accountability Layer</title><link>https://clouatre.ca/posts/ai-assisted-development/</link><guid isPermaLink="true">https://clouatre.ca/posts/ai-assisted-development/</guid><description>AI made writing code faster. Without governance controls, it makes reviewing and understanding code slower. The accountability layer is the structural response.</description><pubDate>Sat, 30 May 2026 07:34:00 GMT</pubDate><content:encoded>&lt;p&gt;A 2025 analysis found security flaws in 45% of AI-generated code outputs when context was underspecified (Zigler, 2025). AI accelerated the part of development that was never the bottleneck.&lt;/p&gt;
&lt;p&gt;Implementation was already fast relative to debugging, architecture, and review. AI compressed it further. The slow parts, the ones requiring genuine domain understanding, got harder when code volume grew without a corresponding rise in qualified human attention. The result is not a productivity gain but a redistribution that benefits teams with strong review discipline and harms those without it.&lt;/p&gt;
&lt;p&gt;The structural response is not better prompting. It is a governance layer that enforces human decision points where judgment matters: at authoring, at commit, and at ship. This post describes that layer in concrete terms.&lt;/p&gt;
&lt;h2 id=&quot;table-of-contents&quot;&gt;Table of contents&lt;/h2&gt;
&lt;p&gt;&lt;/p&gt;&lt;details&gt;&lt;summary&gt;Contents&lt;/summary&gt;&lt;p&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;#why-does-ai-assisted-development-create-an-accountability-gap&quot;&gt;Why Does AI-Assisted Development Create an Accountability Gap?&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;#the-volume-problem&quot;&gt;The Volume Problem&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#the-synthesis-degradation-finding&quot;&gt;The Synthesis Degradation Finding&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#how-does-ai-shift-time-from-implementation-to-judgment&quot;&gt;How Does AI Shift Time From Implementation to Judgment?&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;#the-controlled-trial-baseline&quot;&gt;The Controlled Trial Baseline&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#where-the-research-diverges&quot;&gt;Where the Research Diverges&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#metacognition-as-the-hidden-variable&quot;&gt;Metacognition as the Hidden Variable&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#how-do-structured-workflows-enforce-human-decision-points&quot;&gt;How Do Structured Workflows Enforce Human Decision Points?&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;#the-five-phase-recipe&quot;&gt;The Five-Phase Recipe&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#hard-blocks-vs-guidelines&quot;&gt;Hard Blocks vs. Guidelines&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#how-do-you-maintain-accountability-when-ai-writes-the-code&quot;&gt;How Do You Maintain Accountability When AI Writes the Code?&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;#authorship-and-attribution&quot;&gt;Authorship and Attribution&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#commit-integrity&quot;&gt;Commit Integrity&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#review-accountability&quot;&gt;Review Accountability&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#build-provenance-and-certification&quot;&gt;Build Provenance and Certification&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#what-do-measured-time-savings-actually-look-like&quot;&gt;What Do Measured Time Savings Actually Look Like?&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;#ci-modernization-pr-52&quot;&gt;CI Modernization (PR #52)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#matrix-operations-feature-pr-109&quot;&gt;Matrix Operations Feature (PR #109)&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#when-does-this-approach-work--and-when-does-it-not&quot;&gt;When Does This Approach Work — and When Does It Not?&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;#security-sensitive-tasks&quot;&gt;Security-Sensitive Tasks&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#the-candidate-generation-model&quot;&gt;The Candidate Generation Model&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#what-does-this-mean-for-technical-leaders&quot;&gt;What Does This Mean for Technical Leaders?&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;#the-perception-gap-risk&quot;&gt;The Perception Gap Risk&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#three-conditions-for-success&quot;&gt;Three Conditions for Success&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#references&quot;&gt;References&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;/p&gt;&lt;/details&gt;&lt;p&gt;&lt;/p&gt;
&lt;h2 id=&quot;why-does-ai-assisted-development-create-an-accountability-gap&quot;&gt;Why Does AI-Assisted Development Create an Accountability Gap?&lt;/h2&gt;
&lt;p&gt;Software developers spend roughly 11% of their time coding; the rest is distributed across debugging, architecture, reviews, meetings, and operational tasks (Kumar et al., 2025). Coding was never the binding constraint.&lt;/p&gt;
&lt;h3 id=&quot;the-volume-problem&quot;&gt;The Volume Problem&lt;/h3&gt;
&lt;p&gt;When AI tools eliminate implementation friction, code volume increases. More pull requests, more changed lines, more design decisions embedded in generated output. But the human capacity for careful review does not scale with code volume. A reviewer evaluating 200 lines of handwritten code may face 800 lines of AI-generated output covering the same feature, with subtler assumptions embedded in the structure.&lt;/p&gt;
&lt;h3 id=&quot;the-synthesis-degradation-finding&quot;&gt;The Synthesis Degradation Finding&lt;/h3&gt;
&lt;p&gt;&lt;a href=&quot;https://doi.org/10.1145/3706599.3719931&quot;&gt;CHI 2025 research on AI-assisted development&lt;/a&gt; found that synthesis tasks, the core of architecture and design, show the steepest degradation under cognitive offloading (Shukla, Bui, Parsons et al., 2025). Reviewers who routinely approve AI output without deep engagement gradually lose the ability to catch what they once would have caught.&lt;/p&gt;
&lt;p&gt;The accountability gap is structural: code is now generated faster than human judgment can validate it. Without explicit controls, the natural equilibrium is faster shipping with lower comprehension per merged line.&lt;/p&gt;
&lt;h2 id=&quot;how-does-ai-shift-time-from-implementation-to-judgment&quot;&gt;How Does AI Shift Time From Implementation to Judgment?&lt;/h2&gt;
&lt;h3 id=&quot;the-controlled-trial-baseline&quot;&gt;The Controlled Trial Baseline&lt;/h3&gt;
&lt;p&gt;The original case for AI coding assistance rested on controlled experiments. &lt;a href=&quot;https://arxiv.org/abs/2302.06590&quot;&gt;A randomized controlled trial with 95 developers&lt;/a&gt; found task completion approximately 55.8% faster with AI assistance (Peng et al., 2023). That result held for greenfield, well-specified programming tasks. Later research complicates it.&lt;/p&gt;
&lt;h3 id=&quot;where-the-research-diverges&quot;&gt;Where the Research Diverges&lt;/h3&gt;
&lt;p&gt;&lt;a href=&quot;https://arxiv.org/abs/2507.09089&quot;&gt;METR’s 2025 study&lt;/a&gt; found that experienced developers working on real tasks with AI tools &lt;strong&gt;took 19% longer while perceiving a 20% speedup&lt;/strong&gt; (Becker et al., 2025). The gap between perceived and measured performance is itself informative: the feeling of productivity increased while actual throughput declined. That is the metacognitive failure mode that governance controls are designed to interrupt.&lt;/p&gt;









































&lt;table tabindex=&quot;0&quot;&gt;&lt;caption&gt;&lt;strong&gt;Table 1:&lt;/strong&gt; Time allocation shift under AI-assisted development. Implementation shrinks; review and judgment must grow to hold quality constant.&lt;/caption&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Activity&lt;/th&gt;&lt;th&gt;Traditional&lt;/th&gt;&lt;th&gt;AI-Assisted&lt;/th&gt;&lt;th&gt;Direction&lt;/th&gt;&lt;/tr&gt;&lt;/thead&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;Implementation&lt;/td&gt;&lt;td&gt;High (bottleneck)&lt;/td&gt;&lt;td&gt;Low (AI-generated)&lt;/td&gt;&lt;td&gt;Shrinks&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Debugging own code&lt;/td&gt;&lt;td&gt;High&lt;/td&gt;&lt;td&gt;Lower (less handwritten code)&lt;/td&gt;&lt;td&gt;Shrinks&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Review and judgment&lt;/td&gt;&lt;td&gt;Low (limited by implementation time)&lt;/td&gt;&lt;td&gt;Must grow to match volume&lt;/td&gt;&lt;td&gt;Must grow&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Architecture and design&lt;/td&gt;&lt;td&gt;Fragmented&lt;/td&gt;&lt;td&gt;Consolidated&lt;/td&gt;&lt;td&gt;Grows&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Cognitive synthesis&lt;/td&gt;&lt;td&gt;Frequent, shallow&lt;/td&gt;&lt;td&gt;Fewer, deeper sessions required&lt;/td&gt;&lt;td&gt;Deepens&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;
&lt;h3 id=&quot;metacognition-as-the-hidden-variable&quot;&gt;Metacognition as the Hidden Variable&lt;/h3&gt;
&lt;p&gt;&lt;a href=&quot;https://arxiv.org/abs/2506.10051&quot;&gt;Prather et al. (2024)&lt;/a&gt; found that metacognitive skill, not experience level, determines whether a developer benefits or is harmed by AI assistance. The skill in question is the ability to accurately assess what you understand and what you do not. Developers with strong metacognition catch AI errors because they notice when generated code does something they cannot explain. Developers without it ship the errors because the code looked plausible.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://x.com/karpathy/status/1886192184808149082&quot;&gt;Karpathy’s distinction between vibe coding and agentic engineering&lt;/a&gt; (Karpathy, 2025) maps directly onto this: vibe coding raises the floor for simple tasks and lowers the ceiling for complex ones. Agentic engineering, with explicit spec design, diff review, eval design, security oversight, and quality judgment, preserves the ceiling. The difference is whether human judgment is structurally required or merely available.&lt;/p&gt;
&lt;h2 id=&quot;how-do-structured-workflows-enforce-human-decision-points&quot;&gt;How Do Structured Workflows Enforce Human Decision Points?&lt;/h2&gt;
&lt;p&gt;The recipe workflow used in this practice formalizes the judgment gates that distinguish agentic engineering from vibe coding. A recipe is a YAML workflow definition that codifies process: AI handles analysis, research, and implementation; the human approves direction at mandatory STOP points before any code is written.&lt;/p&gt;
&lt;h3 id=&quot;the-five-phase-recipe&quot;&gt;The Five-Phase Recipe&lt;/h3&gt;
&lt;p&gt;Each phase requires explicit human approval before the next begins:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;ANALYZE:&lt;/strong&gt; Understand the codebase, identify problem scope and affected files&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;RESEARCH:&lt;/strong&gt; Explore 2-3 solution approaches with trade-offs; human selects direction&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;PLAN:&lt;/strong&gt; Detailed implementation plan reviewed before any code is written&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;IMPLEMENT:&lt;/strong&gt; Code, tests, documentation; AI executes against approved plan&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;PREPARE:&lt;/strong&gt; PR creation, branch verification, push; human approves before opening&lt;/li&gt;
&lt;/ul&gt;
&lt;figure&gt;&lt;figcaption&gt;&lt;strong&gt;Code Snippet 1:&lt;/strong&gt; GATE pattern from production recipe. AI presents constrained options; human selects direction before any code is written.&lt;/figcaption&gt;&lt;pre class=&quot;astro-code astro-code-themes catppuccin-latte catppuccin-macchiato has-highlighted mt-8&quot; style=&quot;--shiki-light:#4c4f69; --shiki-dark:#cad3f5; --shiki-light-bg:#eff1f5; --shiki-dark-bg:#24273a; --file-name-offset: -0.75rem&quot; tabindex=&quot;0&quot; data-language=&quot;yaml&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-light-font-style:italic;--shiki-dark:#939AB7;--shiki-dark-font-style:italic&quot;&gt;## Phase 1: RESEARCH&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;Understand scope and constraints&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; Read issue/PR description, linked discussions&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; Identify affected files with `rg` and `analyze`&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; Note CI requirements, test patterns, coding standards&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-light-font-style:italic;--shiki-dark:#939AB7;--shiki-dark-font-style:italic&quot;&gt;### GATE: Research Summary  &lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line highlighted&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#EA76CB;--shiki-dark:#F5BDE6&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;--shiki-light:#DF8E1D;--shiki-dark:#EED49F&quot;&gt;*STOP&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt; -&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; Present to user:**&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; Problem statement (1-2 sentences)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; Affected files and scope&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; Constraints discovered (CI, tests, dependencies)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line highlighted&quot;&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; 2-3 possible approaches with trade-offs&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line highlighted&quot;&gt;&lt;span style=&quot;--shiki-light:#EA76CB;--shiki-dark:#F5BDE6&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;--shiki-light:#DF8E1D;--shiki-dark:#EED49F&quot;&gt;*ASK:**&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; &quot;Which approach do you prefer?&quot;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;span class=&quot;absolute py-1 text-foreground text-xs font-medium leading-4 pl-4 pr-2 before:inline-block before:size-1 before:bg-green-500 before:rounded-full before:absolute before:top-[45%] before:left-2 left-2 top-(--file-name-offset) border rounded-md bg-background&quot;&gt;~/.config/goose/recipes/goose-coder.yaml&lt;/span&gt;&lt;/pre&gt;&lt;/figure&gt;
&lt;p&gt;This pattern ensures that architectural direction is always a human decision, not an inference from incomplete context. The full recipe is available at &lt;a href=&quot;https://gist.github.com/clouatre/11e8afc102d659420921db6fcff4409a&quot;&gt;goose-coder.yaml on GitHub Gist&lt;/a&gt;.&lt;/p&gt;
&lt;h3 id=&quot;hard-blocks-vs-guidelines&quot;&gt;Hard Blocks vs. Guidelines&lt;/h3&gt;
&lt;p&gt;Governance controls operate at three layers. &lt;a href=&quot;https://github.com/clouatre-labs/aptu-coder/blob/main/AGENTS.md&quot;&gt;&lt;code&gt;AGENTS.md&lt;/code&gt;&lt;/a&gt; is the policy declaration: it instructs the agent on commit conventions, identity requirements, and policy boundaries before any code is written. Local git hooks enforce the same contract at commit time.&lt;/p&gt;

























&lt;table tabindex=&quot;0&quot;&gt;&lt;caption&gt;&lt;strong&gt;Table 2:&lt;/strong&gt; Three-layer governance enforcement stack&lt;/caption&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Layer&lt;/th&gt;&lt;th&gt;Mechanism&lt;/th&gt;&lt;th&gt;Controls&lt;/th&gt;&lt;/tr&gt;&lt;/thead&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;Policy declaration&lt;/td&gt;&lt;td&gt;AGENTS.md&lt;/td&gt;&lt;td&gt;Commit conventions, identity requirements, policy boundaries&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Commit-time&lt;/td&gt;&lt;td&gt;git hooks&lt;/td&gt;&lt;td&gt;Conventional commits, DCO sign-off, protected branch block&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Repository&lt;/td&gt;&lt;td&gt;Branch rulesets, code owner review&lt;/td&gt;&lt;td&gt;GPG signing, SLSA provenance, OpenSSF certification&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;
&lt;p&gt;Repository controls enforce the rules again at the server: branch rulesets, required code owner review, GPG signing, and provenance attestation. All three layers are intentionally aligned: a well-configured agent should never trip a hook. &lt;a href=&quot;https://github.com/clouatre-labs/aptu/blob/main/docs/REPO-STANDARDS.md&quot;&gt;&lt;code&gt;REPO-STANDARDS.md&lt;/code&gt;&lt;/a&gt; documents the full pipeline.&lt;/p&gt;
&lt;figure&gt;&lt;figcaption&gt;&lt;strong&gt;Code Snippet 2:&lt;/strong&gt; Global commit-msg hook enforces conventional commits and DCO. Hard blocks prevent non-compliant commits from reaching review.&lt;/figcaption&gt;&lt;pre class=&quot;astro-code astro-code-themes catppuccin-latte catppuccin-macchiato has-highlighted mt-8&quot; style=&quot;--shiki-light:#4c4f69; --shiki-dark:#cad3f5; --shiki-light-bg:#eff1f5; --shiki-dark-bg:#24273a; --file-name-offset: -0.75rem&quot; tabindex=&quot;0&quot; data-language=&quot;bash&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-light-font-style:italic;--shiki-dark:#939AB7;--shiki-dark-font-style:italic&quot;&gt;# Conventional commit format&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;CONVENTIONAL_REGEX&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;&apos;^(feat|fix|docs|...)(\([a-z0-9_-]+\))?(!)?: .{1,100}$&apos;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-dark:#C6A0F6&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt; !&lt;/span&gt;&lt;span style=&quot;--shiki-light:#D20F39;--shiki-light-font-style:italic;--shiki-dark:#ED8796;--shiki-dark-font-style:italic&quot;&gt; echo&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; &quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;$COMMIT_MSG&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt; |&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-light-font-style:italic;--shiki-dark:#8AADF4;--shiki-dark-font-style:italic&quot;&gt; grep&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; -qE&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; &quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;$CONVENTIONAL_REGEX&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-dark:#C6A0F6&quot;&gt; then&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line highlighted&quot;&gt;&lt;span style=&quot;--shiki-light:#D20F39;--shiki-light-font-style:italic;--shiki-dark:#ED8796;--shiki-dark-font-style:italic&quot;&gt;    echo&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; &quot;BLOCKED: Commit message must follow conventional format&quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#D20F39;--shiki-light-font-style:italic;--shiki-dark:#ED8796;--shiki-dark-font-style:italic&quot;&gt;    exit&lt;/span&gt;&lt;span style=&quot;--shiki-light:#FE640B;--shiki-dark:#F5A97F&quot;&gt; 1&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-dark:#C6A0F6&quot;&gt;fi&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-light-font-style:italic;--shiki-dark:#939AB7;--shiki-dark-font-style:italic&quot;&gt;# DCO required&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-dark:#C6A0F6&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt; !&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-light-font-style:italic;--shiki-dark:#8AADF4;--shiki-dark-font-style:italic&quot;&gt; grep&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; -q&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; &quot;^Signed-off-by:&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; &quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#4C4F69;--shiki-dark:#CAD3F5&quot;&gt;$COMMIT_MSG_FILE&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;;&lt;/span&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-dark:#C6A0F6&quot;&gt; then&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line highlighted&quot;&gt;&lt;span style=&quot;--shiki-light:#D20F39;--shiki-light-font-style:italic;--shiki-dark:#ED8796;--shiki-dark-font-style:italic&quot;&gt;    echo&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; &quot;BLOCKED: Missing DCO (Signed-off-by)&quot;&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#D20F39;--shiki-light-font-style:italic;--shiki-dark:#ED8796;--shiki-dark-font-style:italic&quot;&gt;    exit&lt;/span&gt;&lt;span style=&quot;--shiki-light:#FE640B;--shiki-dark:#F5A97F&quot;&gt; 1&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#8839EF;--shiki-dark:#C6A0F6&quot;&gt;fi&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;span class=&quot;absolute py-1 text-foreground text-xs font-medium leading-4 pl-4 pr-2 before:inline-block before:size-1 before:bg-green-500 before:rounded-full before:absolute before:top-[45%] before:left-2 left-2 top-(--file-name-offset) border rounded-md bg-background&quot;&gt;~/.githooks/commit-msg&lt;/span&gt;&lt;/pre&gt;&lt;/figure&gt;
&lt;h2 id=&quot;how-do-you-maintain-accountability-when-ai-writes-the-code&quot;&gt;How Do You Maintain Accountability When AI Writes the Code?&lt;/h2&gt;
&lt;p&gt;When any portion of code is AI-generated, the accountability question sharpens. The human who submits and certifies the code bears full responsibility for what it does, regardless of how much of it was generated. Making that accountability explicit requires controls that a policy document alone cannot provide. &lt;a href=&quot;https://github.com/clouatre-labs/aptu-coder/blob/main/AI_POLICY.md&quot;&gt;&lt;code&gt;AI_POLICY.md&lt;/code&gt;&lt;/a&gt; formalizes four of them.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://dora.dev/dora-report-2025&quot;&gt;DORA 2025&lt;/a&gt; confirms that AI acts as an organizational capability amplifier: the greatest return on investment accrues to teams with strong review discipline and platform engineering foundations, not to teams that simply adopt the tools (DORA / Google Cloud, 2025). The governance layer described here is precisely those foundations.&lt;/p&gt;
&lt;figure&gt;&lt;img alt=&quot;Governance chain from AI proposal to GPG-signed commit to SLSA provenance to OpenSSF certification&quot; loading=&quot;eager&quot; decoding=&quot;sync&quot; fetchpriority=&quot;high&quot; sizes=&quot;(min-width: 276px) 276px, 100vw&quot; data-astro-image=&quot;constrained&quot; data-astro-image-pos=&quot;center&quot; width=&quot;276&quot; height=&quot;822&quot; src=&quot;/_astro/ai-governance-chain.DRAW17le_1IpAqr.svg&quot; srcset=&quot;/_astro/ai-governance-chain.DRAW17le_1IpAqr.svg 276w&quot;&gt;&lt;figcaption&gt;&lt;strong&gt;Figure 1:&lt;/strong&gt; Governance chain. Each step adds a verifiable artifact; the chain is only as strong as the named human at the review gate.&lt;/figcaption&gt;&lt;/figure&gt;
&lt;h3 id=&quot;authorship-and-attribution&quot;&gt;Authorship and Attribution&lt;/h3&gt;
&lt;p&gt;Industry practice varies: the Linux kernel requires &lt;code&gt;Assisted-by&lt;/code&gt; disclosure; Claude Code adds &lt;code&gt;Co-Authored-By: Claude&lt;/code&gt; by default. The position here is accountability over attribution. DCO (Developer Certificate of Origin) sign-off is a responsibility certification, not an originality one: the committer certifies they have the right to submit the change and understand its contents. That certification is only honest if the reviewer has engaged with the code. As AI generates more of it, the reviewer role shifts from syntax-checker to spec-verifier and security judge: a higher-accountability function, not a diminishing one.&lt;/p&gt;
&lt;h3 id=&quot;commit-integrity&quot;&gt;Commit Integrity&lt;/h3&gt;
&lt;p&gt;All commits are GPG-signed. A GPG signature ties the commit cryptographically to a verified identity, making it impossible to silently alter commit history or impersonate a contributor. Combined with DCO, every commit carries a named, verified human who certified its contents. These two controls together mean the audit trail is tamper-evident: you can verify not just what changed but who vouched for it.&lt;/p&gt;
&lt;h3 id=&quot;review-accountability&quot;&gt;Review Accountability&lt;/h3&gt;
&lt;p&gt;Every non-trivial change requires a named human reviewer. The PR checklist includes an explicit attestation: the reviewer has read every line and can explain it. This standard matters specifically because AI-generated code can be syntactically correct and pass all tests while containing subtle assumptions the reviewer would catch if they engaged deeply. Approving on the basis of CI green alone is the failure mode the attestation is designed to prevent.&lt;/p&gt;
&lt;h3 id=&quot;build-provenance-and-certification&quot;&gt;Build Provenance and Certification&lt;/h3&gt;
&lt;p&gt;SLSA (Supply-chain Levels for Software Artifacts, a build integrity framework) Level 3 build provenance establishes a verifiable chain from source to artifact. Every build produces a signed attestation of what was compiled, from which commit, with which toolchain. OpenSSF (Open Source Security Foundation) Best Practices certification documents that these controls are maintained continuously.&lt;/p&gt;
&lt;p&gt;These controls are not compliance theater. They are the structural response to the accountability gap: when code is generated faster than it can be understood, the governance layer is the only verified signal that a qualified human evaluated what ships.&lt;/p&gt;
&lt;h2 id=&quot;what-do-measured-time-savings-actually-look-like&quot;&gt;What Do Measured Time Savings Actually Look Like?&lt;/h2&gt;
&lt;p&gt;Two production examples provide concrete data. Both are single-author measurements on a controlled codebase without a comparison group. They are illustrative, not generalizable. These gains held because the governance controls in the previous section ensured reviewer quality was sufficient to catch AI errors; without that condition, the same speed would produce a different outcome.&lt;/p&gt;
&lt;h3 id=&quot;ci-modernization-pr-52&quot;&gt;CI Modernization (PR #52)&lt;/h3&gt;
&lt;p&gt;&lt;code&gt;math-mcp-learning-server&lt;/code&gt; had no CI workflow. The judgment call: build from scratch or adapt patterns from a similar project. AI identified Ruff, uv, and pytest-cov as the right stack. Review covered the risk assessment, tooling fit, and zero-regression confirmation. Result: approximately 20 minutes versus an estimated 3-4 hours, with CI runtime at 5 seconds and 67 tests passing at 83% coverage. Source: &lt;a href=&quot;https://github.com/clouatre-labs/math-mcp-learning-server/pull/52&quot;&gt;PR #52&lt;/a&gt;.&lt;/p&gt;
&lt;h3 id=&quot;matrix-operations-feature-pr-109&quot;&gt;Matrix Operations Feature (PR #109)&lt;/h3&gt;
&lt;p&gt;Five matrix operation tools with NumPy integration. The judgment call: implement incrementally or batch with shared validation patterns. AI identified the common infrastructure needs: dimension validation, ToolError handling, DoS prevention via size limits. Review covered API design, error handling conventions, and security boundaries. Result: 2 minutes from PR creation to merge, 5 tools, 21 tests, 395 lines. Source: &lt;a href=&quot;https://github.com/clouatre-labs/math-mcp-learning-server/pull/109&quot;&gt;PR #109&lt;/a&gt;.&lt;/p&gt;























&lt;table tabindex=&quot;0&quot;&gt;&lt;caption&gt;&lt;strong&gt;Table 3:&lt;/strong&gt; Measured time savings from two production examples (single-author, no control group)&lt;/caption&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Task&lt;/th&gt;&lt;th&gt;AI-Assisted&lt;/th&gt;&lt;th&gt;Traditional Estimate&lt;/th&gt;&lt;th&gt;Savings&lt;/th&gt;&lt;/tr&gt;&lt;/thead&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;CI modernization (PR #52)&lt;/td&gt;&lt;td&gt;~20 min&lt;/td&gt;&lt;td&gt;3-4 hours&lt;/td&gt;&lt;td&gt;~90%&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Matrix operations, 5 tools (PR #109)&lt;/td&gt;&lt;td&gt;2 min&lt;/td&gt;&lt;td&gt;1-2 hours&lt;/td&gt;&lt;td&gt;~95%&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;
&lt;p&gt;At 10 infrastructure tasks per month, savings at this rate recover approximately 60 hours per year per engineer. That estimate depends entirely on reviewer quality being sufficient to catch AI errors; the governance controls in the previous section are what make that condition hold.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://github.blog/news-insights/research/research-quantifying-github-copilots-impact-on-developer-productivity-and-happiness/&quot;&gt;GitHub / Kalliamvakou (2024)&lt;/a&gt; found a 26% overall productivity increase across 4,867 developers, with 60-75% reporting increased job fulfillment. These aggregate figures align with the production examples directionally. The governance layer is what separates an individual positive experience from a reproducible organizational outcome.&lt;/p&gt;
&lt;h2 id=&quot;when-does-this-approach-work--and-when-does-it-not&quot;&gt;When Does This Approach Work — and When Does It Not?&lt;/h2&gt;


















































&lt;table tabindex=&quot;0&quot;&gt;&lt;caption&gt;&lt;strong&gt;Table 4:&lt;/strong&gt; Task type fit for AI-assisted development, based on production experience&lt;/caption&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Task Type&lt;/th&gt;&lt;th&gt;Fit&lt;/th&gt;&lt;th&gt;Evidence&lt;/th&gt;&lt;/tr&gt;&lt;/thead&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;CI/DevOps automation&lt;/td&gt;&lt;td&gt;High&lt;/td&gt;&lt;td&gt;20 min vs 3-4 hrs (PR #52)&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Feature implementation with established patterns&lt;/td&gt;&lt;td&gt;High&lt;/td&gt;&lt;td&gt;2 min for 5 tools (PR #109)&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Boilerplate and scaffolding&lt;/td&gt;&lt;td&gt;High&lt;/td&gt;&lt;td&gt;Common pattern in both PRs&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Legacy code: analysis and documentation&lt;/td&gt;&lt;td&gt;High&lt;/td&gt;&lt;td&gt;&lt;a href=&quot;https://github.com/clouatre-labs/aptu-coder&quot;&gt;aptu-coder&lt;/a&gt;: structured agent access without full context load&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Greenfield architecture&lt;/td&gt;&lt;td&gt;Medium&lt;/td&gt;&lt;td&gt;More judgment gates needed&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Security-sensitive code&lt;/td&gt;&lt;td&gt;Low&lt;/td&gt;&lt;td&gt;Context underspecification risk&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Regex and parsing logic&lt;/td&gt;&lt;td&gt;Low&lt;/td&gt;&lt;td&gt;Subtle bugs compound&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Legacy code: generation and modification&lt;/td&gt;&lt;td&gt;Low&lt;/td&gt;&lt;td&gt;Hallucination risk without grounding context&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;
&lt;h3 id=&quot;security-sensitive-tasks&quot;&gt;Security-Sensitive Tasks&lt;/h3&gt;
&lt;p&gt;The security-sensitive category warrants elaboration. The 45% security flaw rate from Veracode (reported in Zigler, 2025) applies specifically when context is underspecified: incomplete specifications, ambiguous threat models, or missing documentation of invariants. It is not a universal finding about all AI-generated code. Well-specified codebases with clear security requirements produce substantially better results. Reviewer attestation and SLSA provenance are the mechanism for verifying that the higher-quality path was actually taken.&lt;/p&gt;
&lt;h3 id=&quot;the-candidate-generation-model&quot;&gt;The Candidate Generation Model&lt;/h3&gt;
&lt;p&gt;The critical success factor is consistent across task types: the human evaluating AI proposals must have sufficient expertise to recognize errors. &lt;a href=&quot;https://dora.dev/dora-report-2025&quot;&gt;DORA 2025&lt;/a&gt; confirms that AI amplifies existing organizational capability rather than substituting for it (DORA / Google Cloud, 2025). A team without strong review culture will see AI increase their defect rate, not decrease it.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://www.emilbacklund.com/p/a-cost-based-decision-framework-for&quot;&gt;Backlund (2024)&lt;/a&gt; frames this as a candidate generation problem: in large-scale projects it is infeasible to thoroughly research every decision, but more candidates increase the likelihood that the ideal solution is among them. AI excels at candidate generation. Human judgment determines which candidate ships.&lt;/p&gt;
&lt;h2 id=&quot;what-does-this-mean-for-technical-leaders&quot;&gt;What Does This Mean for Technical Leaders?&lt;/h2&gt;
&lt;h3 id=&quot;the-perception-gap-risk&quot;&gt;The Perception Gap Risk&lt;/h3&gt;
&lt;p&gt;That perception gap is an organizational risk, not just an individual one. Teams adopting AI tools without governance controls may be degrading engineering throughput while believing they are improving it.&lt;/p&gt;
&lt;p&gt;Implementation was already a small fraction of developer time (Kumar et al., 2025). AI compresses it further. The question is whether the time freed is reinvested in the judgment tasks that determine output quality.&lt;/p&gt;
&lt;h3 id=&quot;three-conditions-for-success&quot;&gt;Three Conditions for Success&lt;/h3&gt;
&lt;p&gt;The governance layer described here works when three conditions hold: reviewer expertise is sufficient to evaluate AI proposals, the workflow enforces human approval at structural decision points, and cryptographic controls make accountability non-repudiable.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://dora.dev/dora-report-2025&quot;&gt;DORA 2025&lt;/a&gt; is direct on this: teams with strong engineering foundations see the gains; teams without them see increased complexity, larger pull requests, and architectural drift (DORA / Google Cloud, 2025). The governance layer is what creates the foundation.&lt;/p&gt;
&lt;p&gt;This is Part 1 of a two-post series. Part 2 scales these controls across multi-agent workflows: &lt;a href=&quot;/posts/orchestrating-ai-agents-subagent-architecture/&quot;&gt;Orchestrating AI Agents: Subagent Architecture&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;The practical test is simple: audit your last ten pull requests and ask how many reviewers could explain every line of AI-generated code before approving. That gap between “CI passed” and “I understand this” is where the accountability layer lives.&lt;/p&gt;
&lt;hr&gt;
&lt;h2 id=&quot;references&quot;&gt;References&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Backlund, Emil, “A Cost-Based Decision Framework for Software Engineers” (2024) — &lt;a href=&quot;https://www.emilbacklund.com/p/a-cost-based-decision-framework-for&quot;&gt;https://www.emilbacklund.com/p/a-cost-based-decision-framework-for&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Becker et al. / METR, “Measuring the Impact of Early-2025 AI on Experienced Open-Source Developer Productivity” (2025) — &lt;a href=&quot;https://arxiv.org/abs/2507.09089&quot;&gt;https://arxiv.org/abs/2507.09089&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;DORA / Google Cloud, “State of AI-assisted Software Development 2025” (2025) — &lt;a href=&quot;https://dora.dev/dora-report-2025&quot;&gt;https://dora.dev/dora-report-2025&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;GitHub / Kalliamvakou, “Research: quantifying GitHub Copilot’s impact on developer productivity and happiness” (2024) — &lt;a href=&quot;https://github.blog/news-insights/research/research-quantifying-github-copilots-impact-on-developer-productivity-and-happiness/&quot;&gt;https://github.blog/news-insights/research/research-quantifying-github-copilots-impact-on-developer-productivity-and-happiness/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Karpathy, Andrej, “Software Is Changing (Again)” (2025) — &lt;a href=&quot;https://x.com/karpathy/status/1886192184808149082&quot;&gt;https://x.com/karpathy/status/1886192184808149082&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Kumar et al., “Time Warp: The Gap Between Developers’ Ideal vs Actual Workweeks in an AI-Driven Era” (2025) — &lt;a href=&quot;https://arxiv.org/abs/2502.15287&quot;&gt;https://arxiv.org/abs/2502.15287&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Peng et al., “The Impact of AI on Developer Productivity: Evidence from GitHub Copilot” (2023) — &lt;a href=&quot;https://arxiv.org/abs/2302.06590&quot;&gt;https://arxiv.org/abs/2302.06590&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Prather et al., “The Effects of GitHub Copilot on Computing Students’ Programming Effectiveness, Efficiency, and Processes in Brownfield Programming Tasks” (2024) — &lt;a href=&quot;https://arxiv.org/abs/2506.10051&quot;&gt;https://arxiv.org/abs/2506.10051&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Shukla, Bui, Parsons et al., “De-skilling, Cognitive Offloading, and Misplaced Responsibilities: Potential Ironies of AI-Assisted Design” (2025) — &lt;a href=&quot;https://doi.org/10.1145/3706599.3719931&quot;&gt;https://doi.org/10.1145/3706599.3719931&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Zigler, Andrew, “Mise en Place for Agentic Coding: Deliberate Preparation as Context Engineering Methodology” (2025) — &lt;a href=&quot;https://arxiv.org/abs/2605.05400&quot;&gt;https://arxiv.org/abs/2605.05400&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</content:encoded><category>agentic-ai</category><category>ai-engineering</category><category>devops</category><category>goose</category><category>governance</category><author>Hugues Clouâtre</author></item><item><title>AI-Governed DNS Migration Without Maintenance Windows</title><link>https://clouatre.ca/posts/zero-downtime-dns-migration/</link><guid isPermaLink="true">https://clouatre.ca/posts/zero-downtime-dns-migration/</guid><description>Programmatic pre-validation eliminates the weekend window from DNS migrations. Full platform migration: 2 hours, business hours, zero downtime.</description><pubDate>Sat, 30 May 2026 10:25:00 GMT</pubDate><content:encoded>&lt;p&gt;DNS migrations fail in production because teams discover errors after the nameserver switch, not before it. The operational question is not whether AI can execute the migration, but whether you can validate the entire target state against live Cloudflare nameservers before committing. That pre-validation step, not the AI, is what makes business-hours execution safe.&lt;/p&gt;
&lt;p&gt;The migration described here moved 20+ DNS records, three CI/CD workflows, and a static hosting platform from Amazon Route53 and GitHub Pages to Cloudflare Workers in two hours, during business hours, with zero downtime. The AI assistant (Goose with Claude Sonnet) is the implementation detail. The governance architecture, pre-validation pipeline, and the auditable artifacts it produced are the thesis.&lt;/p&gt;
&lt;p&gt;&lt;a href=&quot;https://uptimeinstitute.com/about-ui/press-releases/uptime-announces-annual-outage-analysis-report-2025&quot;&gt;Human error causes 66-80% of infrastructure outages&lt;/a&gt; (Uptime Institute, 2025). The operational solution is not to be more careful; it is to eliminate the manual steps that create the error surface in the first place.&lt;/p&gt;
&lt;h2 id=&quot;table-of-contents&quot;&gt;Table of contents&lt;/h2&gt;
&lt;p&gt;&lt;/p&gt;&lt;details&gt;&lt;summary&gt;Contents&lt;/summary&gt;&lt;p&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;#why-do-dns-migrations-still-require-weekend-windows&quot;&gt;Why Do DNS Migrations Still Require Weekend Windows?&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#what-does-programmatic-pre-validation-actually-look-like&quot;&gt;What Does Programmatic Pre-Validation Actually Look Like?&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;#how-does-the-pre-validation-window-work&quot;&gt;How Does the Pre-Validation Window Work?&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#what-does-a-clean-diff-confirm&quot;&gt;What Does a Clean Diff Confirm?&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#how-does-the-approval-gate-workflow-distribute-risk&quot;&gt;How Does the Approval-Gate Workflow Distribute Risk?&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;#what-does-each-gate-surface&quot;&gt;What Does Each Gate Surface?&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#how-does-this-meet-dora-elite-performer-criteria&quot;&gt;How Does This Meet DORA Elite Performer Criteria?&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#what-did-the-migration-produce-as-artifacts&quot;&gt;What Did the Migration Produce as Artifacts?&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;#what-does-a-38-second-deploy-time-prove&quot;&gt;What Does a 38-Second Deploy Time Prove?&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#how-does-every-pr-become-a-compliance-artifact&quot;&gt;How Does Every PR Become a Compliance Artifact?&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#why-is-the-runbook-executable-code-not-a-document&quot;&gt;Why Is the Runbook Executable Code, Not a Document?&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#how-do-the-numbers-compare-to-a-manual-migration&quot;&gt;How Do the Numbers Compare to a Manual Migration?&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;#where-does-the-88-deploy-reduction-compound&quot;&gt;Where Does the 88% Deploy Reduction Compound?&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#when-does-this-pattern-apply-beyond-dns&quot;&gt;When Does This Pattern Apply Beyond DNS?&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;#which-infrastructure-patterns-generalize&quot;&gt;Which Infrastructure Patterns Generalize?&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#when-does-this-pattern-not-apply&quot;&gt;When Does This Pattern Not Apply?&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#takeaways&quot;&gt;Takeaways&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;#references&quot;&gt;References&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;/p&gt;&lt;/details&gt;&lt;p&gt;&lt;/p&gt;
&lt;h2 id=&quot;why-do-dns-migrations-still-require-weekend-windows&quot;&gt;Why Do DNS Migrations Still Require Weekend Windows?&lt;/h2&gt;
&lt;p&gt;Weekend deployment windows are a risk-management response to an information problem: teams do not know whether their target configuration is correct until they switch nameservers and observe production traffic. At that point, any error is already in production: a missing MX record, a transposed SPF value, an incorrect CNAME priority. Rollback means re-pointing nameservers and waiting for propagation, typically 15-60 minutes with modern low-TTL configurations, but with real exposure in the interim.&lt;/p&gt;
&lt;p&gt;The weekend window does not reduce the probability of error; it reduces the business cost of the error by shifting it to off-peak hours. That is a reasonable mitigation for a manual process, but it is not a governance solution. It accepts the failure mode and schedules around it.&lt;/p&gt;
&lt;p&gt;The compounding problem is knowledge concentration. DNS record formats, TTL semantics, DNSSEC interactions, and cloud provider API specifics are tribal knowledge. When the engineer who last touched Route53 is unavailable, the migration either waits or proceeds with higher risk. &lt;a href=&quot;https://www.splunk.com/en_us/newsroom/press-releases/2024/conf24-splunk-report-shows-downtime-costs-global-2000-companies-400-billion-annually.html&quot;&gt;Downtime costs Global 2000 companies $400B annually&lt;/a&gt; (Splunk/Oxford Economics, 2024), and a significant fraction of that cost comes from configuration errors that a programmatic diff would have caught before execution.&lt;/p&gt;
&lt;h2 id=&quot;what-does-programmatic-pre-validation-actually-look-like&quot;&gt;What Does Programmatic Pre-Validation Actually Look Like?&lt;/h2&gt;
&lt;h3 id=&quot;how-does-the-pre-validation-window-work&quot;&gt;How Does the Pre-Validation Window Work?&lt;/h3&gt;
&lt;p&gt;The core mechanism is querying the target nameservers directly before the nameserver switch. Cloudflare assigns nameservers to a zone the moment the zone is created; those nameservers resolve the zone’s records independently of where the domain’s registrar is pointing. This creates a window in which you can validate the entire target DNS state against authoritative Cloudflare resolvers while production traffic still flows through the old nameservers.&lt;/p&gt;
&lt;p&gt;Cloudflare’s nameserver infrastructure serves as the reference implementation: see &lt;a href=&quot;https://developers.cloudflare.com/dns/zone-setups/full-setup/setup/&quot;&gt;Cloudflare’s full setup documentation&lt;/a&gt; for the zone creation mechanics that enable pre-validation.&lt;/p&gt;
&lt;h3 id=&quot;what-does-a-clean-diff-confirm&quot;&gt;What Does a Clean Diff Confirm?&lt;/h3&gt;
&lt;figure&gt;&lt;figcaption&gt;&lt;strong&gt;Code Snippet 1:&lt;/strong&gt; Pre-validation against Cloudflare nameservers before switching (zero output from diff confirms zero-risk parity)&lt;/figcaption&gt;&lt;pre class=&quot;astro-code astro-code-themes catppuccin-latte catppuccin-macchiato has-highlighted mt-8&quot; style=&quot;--shiki-light:#4c4f69; --shiki-dark:#cad3f5; --shiki-light-bg:#eff1f5; --shiki-dark-bg:#24273a; --file-name-offset: -0.75rem&quot; tabindex=&quot;0&quot; data-language=&quot;bash&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-light-font-style:italic;--shiki-dark:#939AB7;--shiki-dark-font-style:italic&quot;&gt;# Verify records match before switching nameservers&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line highlighted&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-light-font-style:italic;--shiki-dark:#8AADF4;--shiki-dark-font-style:italic&quot;&gt;dig&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; @nameserver1.cloudflare.com&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; clouatre.ca&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; MX&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; +short&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-light-font-style:italic;--shiki-dark:#939AB7;--shiki-dark-font-style:italic&quot;&gt;# Output: 1 aspmx.l.google.com. (matches Route53)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line highlighted&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-light-font-style:italic;--shiki-dark:#8AADF4;--shiki-dark-font-style:italic&quot;&gt;diff&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; &amp;#x3C;(&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-light-font-style:italic;--shiki-dark:#8AADF4;--shiki-dark-font-style:italic&quot;&gt;aws&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; route53 list-resource-record-sets)&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; &amp;#x3C;(&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-light-font-style:italic;--shiki-dark:#8AADF4;--shiki-dark-font-style:italic&quot;&gt;curl&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; cloudflare-api)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-light-font-style:italic;--shiki-dark:#939AB7;--shiki-dark-font-style:italic&quot;&gt;# Output: (empty = 100% match, zero risk)&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;span class=&quot;absolute py-1 text-foreground text-xs font-medium leading-4 pl-4 pr-2 before:inline-block before:size-1 before:bg-green-500 before:rounded-full before:absolute before:top-[45%] before:left-2 left-2 top-(--file-name-offset) border rounded-md bg-background&quot;&gt;scripts/validate-cloudflare-dns.sh&lt;/span&gt;&lt;/pre&gt;&lt;/figure&gt;
&lt;p&gt;The diff producing zero output is the safety gate. Every MX record (5 records for Google Workspace), every TXT record (SPF, DKIM, DMARC), every CNAME, and every A record was verified against Cloudflare’s authoritative nameservers before the registrar switch was initiated. The validation report confirmed 100% parity across all 20+ records.&lt;/p&gt;
&lt;p&gt;This approach externalizes domain knowledge into executable code. The validation script encodes what “correct” looks like; it does not rely on an engineer remembering every record type and priority.&lt;/p&gt;
&lt;h2 id=&quot;how-does-the-approval-gate-workflow-distribute-risk&quot;&gt;How Does the Approval-Gate Workflow Distribute Risk?&lt;/h2&gt;
&lt;h3 id=&quot;what-does-each-gate-surface&quot;&gt;What Does Each Gate Surface?&lt;/h3&gt;
&lt;p&gt;The migration ran as a &lt;a href=&quot;/posts/ai-assisted-development/#how-do-structured-workflows-enforce-human-decision-points&quot;&gt;five-phase recipe workflow&lt;/a&gt;: Analyze, Research, Plan, Implement, Prepare. Each phase produced a structured artifact and stopped at an explicit approval gate before proceeding. This is not autonomous execution; it is AI-assisted execution with human governance at every decision point.&lt;/p&gt;
&lt;figure&gt;&lt;img alt=&quot;Cloudflare migration workflow diagram showing approval gates and validation steps&quot; loading=&quot;eager&quot; decoding=&quot;sync&quot; fetchpriority=&quot;high&quot; sizes=&quot;(min-width: 337px) 337px, 100vw&quot; data-astro-image=&quot;constrained&quot; data-astro-image-pos=&quot;center&quot; width=&quot;337&quot; height=&quot;1545&quot; src=&quot;/_astro/migration-workflow.ObNBk8kF_Z1RuBRi.svg&quot; srcset=&quot;/_astro/migration-workflow.ObNBk8kF_Z1RuBRi.svg 337w&quot;&gt;&lt;figcaption&gt;&lt;strong&gt;Figure 1:&lt;/strong&gt; Migration workflow with five phases and two human approval gates. Each gate produces a reviewable artifact before the next phase begins.&lt;/figcaption&gt;&lt;/figure&gt;
&lt;p&gt;The first gate, after the Analyze and Research phases, surfaced the full infrastructure inventory: 20+ Route53 records, 15 classified as critical (email, Google Workspace, SSL validation) and 5 as obsolete. DNSSEC verification returned negative, confirming no migration blocker. A CTO reviewing this gate sees the full blast radius before any change is made.&lt;/p&gt;
&lt;p&gt;The second gate, after the Plan phase, presented the complete Cloudflare zone configuration and the CI/CD migration design for approval before any API calls were made to the target platform. The Cloudflare API token (the one manual step in the entire workflow, approximately two minutes to create) was the only credential that could not be automated from the outside.&lt;/p&gt;
&lt;h3 id=&quot;how-does-this-meet-dora-elite-performer-criteria&quot;&gt;How Does This Meet DORA Elite Performer Criteria?&lt;/h3&gt;
&lt;p&gt;The result is a change process that satisfies the &lt;a href=&quot;https://dora.dev/research/2024/dora-report/&quot;&gt;DORA 2024 elite performer profile&lt;/a&gt;: on-demand deployment with change lead time under one hour, achieved not by removing governance but by encoding it into the workflow structure itself. For a broader treatment of how governance gates integrate with AI delivery pipelines, see &lt;a href=&quot;/posts/decision-frameworks-ai-delivery/&quot;&gt;Decision Frameworks for AI Delivery&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;The before and after infrastructure states are captured below. The key architectural shift is consolidation: from three separate platforms (Squarespace registrar, Route53 DNS, GitHub Pages hosting) to a single Cloudflare control plane for DNS, hosting, and CDN.&lt;/p&gt;
&lt;p&gt;&lt;img alt=&quot;Before migration infrastructure&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; sizes=&quot;(min-width: 423px) 423px, 100vw&quot; data-astro-image=&quot;constrained&quot; data-astro-image-pos=&quot;center&quot; width=&quot;423&quot; height=&quot;550&quot; src=&quot;/_astro/infrastructure-before.fsshW-FS_Z2iqyh0.svg&quot; srcset=&quot;/_astro/infrastructure-before.fsshW-FS_Z2iqyh0.svg 423w&quot;&gt;
&lt;img alt=&quot;After migration infrastructure&quot; loading=&quot;lazy&quot; decoding=&quot;async&quot; sizes=&quot;(min-width: 407px) 407px, 100vw&quot; data-astro-image=&quot;constrained&quot; data-astro-image-pos=&quot;center&quot; width=&quot;407&quot; height=&quot;598&quot; src=&quot;/_astro/infrastructure-after.DsUy8AIt_8RbJE.svg&quot; srcset=&quot;/_astro/infrastructure-after.DsUy8AIt_8RbJE.svg 407w&quot;&gt;
&lt;em&gt;Figure 2: Infrastructure before (Route53 + GitHub Pages) and after (unified Cloudflare Workers platform). DNS, hosting, and CDN under a single control plane.&lt;/em&gt;&lt;/p&gt;
&lt;h2 id=&quot;what-did-the-migration-produce-as-artifacts&quot;&gt;What Did the Migration Produce as Artifacts?&lt;/h2&gt;
&lt;p&gt;The standard framing for AI-assisted migration focuses on what the AI did. The more useful framing for a technical leader is what the migration left behind as operational artifacts.&lt;/p&gt;
&lt;h3 id=&quot;what-does-a-38-second-deploy-time-prove&quot;&gt;What Does a 38-Second Deploy Time Prove?&lt;/h3&gt;
&lt;p&gt;The CI/CD reconfiguration produced a GitHub Actions workflow that deploys to Cloudflare Workers via the official wrangler action. The 38-second deploy time is a falsifiable metric visible in every subsequent CI run.&lt;/p&gt;
&lt;figure&gt;&lt;figcaption&gt;&lt;strong&gt;Code Snippet 2:&lt;/strong&gt; GitHub Actions deployment to Cloudflare Workers (88% faster than the GitHub Pages baseline)&lt;/figcaption&gt;&lt;pre class=&quot;astro-code astro-code-themes catppuccin-latte catppuccin-macchiato has-highlighted mt-8&quot; style=&quot;--shiki-light:#4c4f69; --shiki-dark:#cad3f5; --shiki-light-bg:#eff1f5; --shiki-dark-bg:#24273a; --file-name-offset: -0.75rem&quot; tabindex=&quot;0&quot; data-language=&quot;yaml&quot;&gt;&lt;code&gt;&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-light-font-style:italic;--shiki-dark:#939AB7;--shiki-dark-font-style:italic&quot;&gt;# Cloudflare Workers deployment (38-second deploys)&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#7C7F93;--shiki-dark:#939AB7&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt; name&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; Deploy to Cloudflare Workers&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line highlighted&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;  uses&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; cloudflare/wrangler-action@v3&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;  with&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;    apiToken&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; ${{ secrets.CLOUDFLARE_API_TOKEN }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;    accountId&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}&lt;/span&gt;&lt;/span&gt;
&lt;span class=&quot;line highlighted&quot;&gt;&lt;span style=&quot;--shiki-light:#1E66F5;--shiki-dark:#8AADF4&quot;&gt;    command&lt;/span&gt;&lt;span style=&quot;--shiki-light:#179299;--shiki-dark:#8BD5CA&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;--shiki-light:#40A02B;--shiki-dark:#A6DA95&quot;&gt; deploy dist --project-name=clouatre-ca&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;span class=&quot;absolute py-1 text-foreground text-xs font-medium leading-4 pl-4 pr-2 before:inline-block before:size-1 before:bg-green-500 before:rounded-full before:absolute before:top-[45%] before:left-2 left-2 top-(--file-name-offset) border rounded-md bg-background&quot;&gt;.github/workflows/deploy.yml&lt;/span&gt;&lt;/pre&gt;&lt;/figure&gt;
&lt;h3 id=&quot;how-does-every-pr-become-a-compliance-artifact&quot;&gt;How Does Every PR Become a Compliance Artifact?&lt;/h3&gt;
&lt;p&gt;The governance trail is more significant than the workflow file. Every phase produced a pull request containing the proposed change, the rationale, and a rollback procedure. The PR is the audit artifact: reviewable before merge, traceable after. This satisfies common compliance requirements for change management without a separate change management system.&lt;/p&gt;
&lt;h3 id=&quot;why-is-the-runbook-executable-code-not-a-document&quot;&gt;Why Is the Runbook Executable Code, Not a Document?&lt;/h3&gt;
&lt;p&gt;The validation script is itself a reusable artifact. Parameterized for a different domain and a different source DNS provider, the same pre-validation pattern applies to any subsequent migration. The runbook is not a document describing what to do; it is executable code that enforces correctness before each step executes.&lt;/p&gt;
&lt;p&gt;The preview deployment infrastructure, provisioned as part of the migration, means every subsequent branch gets an isolated preview URL with seven-day auto-cleanup. This was not a pre-existing capability; it was produced as a migration output.&lt;/p&gt;
&lt;h2 id=&quot;how-do-the-numbers-compare-to-a-manual-migration&quot;&gt;How Do the Numbers Compare to a Manual Migration?&lt;/h2&gt;
&lt;p&gt;The comparison baseline is a manual DNS migration executed by a competent engineer: exporting records from Route53, manually importing to Cloudflare, testing each record type, monitoring propagation, and coordinating the registrar switch. The typical execution window is four to six hours of focused work, scheduled over a weekend.&lt;/p&gt;









































&lt;table tabindex=&quot;0&quot;&gt;&lt;caption&gt;&lt;strong&gt;Table 1:&lt;/strong&gt; Before and after metrics for the complete migration (DNS + Hosting + CI/CD)&lt;/caption&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Metric&lt;/th&gt;&lt;th&gt;Before&lt;/th&gt;&lt;th&gt;After&lt;/th&gt;&lt;th&gt;Change&lt;/th&gt;&lt;/tr&gt;&lt;/thead&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;DNS Resolution&lt;/td&gt;&lt;td&gt;20-30ms&lt;/td&gt;&lt;td&gt;&lt;a href=&quot;https://www.dnsperf.com/&quot;&gt;10-15ms&lt;/a&gt;&lt;/td&gt;&lt;td&gt;~50% faster global access&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Deploy Time&lt;/td&gt;&lt;td&gt;5-8 min&lt;/td&gt;&lt;td&gt;38 sec&lt;/td&gt;&lt;td&gt;&lt;strong&gt;88% reduction&lt;/strong&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Platform Cost&lt;/td&gt;&lt;td&gt;Route53: $12/year&lt;/td&gt;&lt;td&gt;Cloudflare: Free&lt;/td&gt;&lt;td&gt;Cost-neutral&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Preview Deployments&lt;/td&gt;&lt;td&gt;None&lt;/td&gt;&lt;td&gt;Per PR, 7-day cleanup&lt;/td&gt;&lt;td&gt;New capability&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Migration Window&lt;/td&gt;&lt;td&gt;Weekend&lt;/td&gt;&lt;td&gt;2 hours, business hours&lt;/td&gt;&lt;td&gt;Risk profile eliminated&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;
&lt;h3 id=&quot;where-does-the-88-deploy-reduction-compound&quot;&gt;Where Does the 88% Deploy Reduction Compound?&lt;/h3&gt;
&lt;p&gt;The deploy time reduction compounds across every subsequent deployment. At five deploys per day, that is approximately 35 minutes of CI waiting time recovered daily. The more significant number for risk management is the migration window: two hours during business hours versus a weekend event with an on-call team standing by.&lt;/p&gt;
&lt;p&gt;The cost-neutral outcome is notable. Cloudflare’s free tier covers the use case, so the migration produced capability improvements (preview deployments, faster resolution, consolidated control plane) without a budget line. The DNS resolution improvement, from 20-30ms to &lt;a href=&quot;https://www.dnsperf.com/&quot;&gt;10-15ms&lt;/a&gt; globally, is consistent with DNSPerf benchmark data on Cloudflare’s anycast network performance.&lt;/p&gt;
&lt;h2 id=&quot;when-does-this-pattern-apply-beyond-dns&quot;&gt;When Does This Pattern Apply Beyond DNS?&lt;/h2&gt;
&lt;h3 id=&quot;which-infrastructure-patterns-generalize&quot;&gt;Which Infrastructure Patterns Generalize?&lt;/h3&gt;
&lt;p&gt;The pre-validation pattern generalizes to any infrastructure change where a target state can be queried before traffic is redirected to it. DNS is a clean example because Cloudflare nameservers are queryable independently of registrar pointing, but the structural pattern is broader.&lt;/p&gt;
&lt;p&gt;The same governance architecture applies to CDN origin switching (validate the new origin responds correctly before updating the CDN routing rule), database migration cutover (validate read replica lag and schema parity before promoting), and API gateway routing changes (validate the new backend passes all contract tests before updating the routing table). In each case, the question is the same: can you assert that the target state is correct before making it the production state?&lt;/p&gt;

























&lt;table tabindex=&quot;0&quot;&gt;&lt;caption&gt;&lt;strong&gt;Table 2:&lt;/strong&gt; Pre-validation pattern applied across infrastructure change types&lt;/caption&gt;&lt;thead&gt;&lt;tr&gt;&lt;th&gt;Infrastructure Change&lt;/th&gt;&lt;th&gt;Pre-Validation Query&lt;/th&gt;&lt;th&gt;Assertion Condition&lt;/th&gt;&lt;/tr&gt;&lt;/thead&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td&gt;DNS migration&lt;/td&gt;&lt;td&gt;Authoritative nameserver dig against target zone&lt;/td&gt;&lt;td&gt;Record parity diff is empty&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;CDN origin switch&lt;/td&gt;&lt;td&gt;Health check against new origin backend&lt;/td&gt;&lt;td&gt;All contract tests pass&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td&gt;Database cutover&lt;/td&gt;&lt;td&gt;Read replica lag + schema diff&lt;/td&gt;&lt;td&gt;Lag below threshold, zero schema delta&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;
&lt;p&gt;The conditions under which this pattern is strictly better than alternatives (Terraform, Pulumi, manual execution) are worth stating precisely. Terraform and Pulumi produce excellent state management for greenfield infrastructure, but they require the source state to already be expressed as code. When the source state lives in a legacy cloud console with 20+ manually created records and no IaC history, the migration cost to get into a Terraform-managed state is itself a significant project. The approach described here treats the migration as a one-time governed event that produces an IaC artifact (the Cloudflare zone configuration) as output, without requiring IaC as a prerequisite.&lt;/p&gt;
&lt;h3 id=&quot;when-does-this-pattern-not-apply&quot;&gt;When Does This Pattern Not Apply?&lt;/h3&gt;
&lt;p&gt;The pattern is not appropriate when the change cannot be pre-validated (some stateful database cutovers), when regulatory requirements mandate human execution of each step rather than scripted automation, or when the team lacks the domain knowledge to evaluate the AI-proposed configuration at each gate. The approval gates require a reviewer who can assess whether the proposed DNS records are correct, not just whether the workflow ran. For observability patterns that support gate reviewers in production, see &lt;a href=&quot;/posts/ai-observability-gaps/&quot;&gt;Closing the AI Observability Gap&lt;/a&gt;.&lt;/p&gt;
&lt;h2 id=&quot;takeaways&quot;&gt;Takeaways&lt;/h2&gt;
&lt;ol&gt;
&lt;li&gt;&lt;strong&gt;Pre-validation is the safety mechanism, not the AI.&lt;/strong&gt; Querying Cloudflare nameservers before the registrar switch converts an information problem into a boolean assertion. The AI accelerates the mechanics; the pre-validation architecture is what makes business-hours execution defensible.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Approval gates produce audit artifacts, not just checkpoints.&lt;/strong&gt; Each gate generates a PR with rationale and rollback procedure. The compliance artifact is a byproduct of the governance structure, not a separate documentation effort.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;The runbook is the deliverable.&lt;/strong&gt; A parameterized, executable validation script that can be reused for any subsequent migration has more operational value than a completed migration. The infrastructure state is recoverable; an executable governance process is built, not bought.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Elite deployment performance follows from pre-validation confidence.&lt;/strong&gt; The DORA 2024 finding that elite performers deploy on-demand with sub-hour change lead time is a consequence of investing in pre-deployment correctness guarantees, not a consequence of moving faster.&lt;/li&gt;
&lt;/ol&gt;
&lt;hr&gt;
&lt;p&gt;For a broader treatment of agentic workflow patterns and approval-gate architecture, see &lt;a href=&quot;/posts/ai-assisted-development/&quot;&gt;AI-Assisted Development: The Accountability Layer&lt;/a&gt;.&lt;/p&gt;
&lt;hr&gt;
&lt;h2 id=&quot;references&quot;&gt;References&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Cloudflare, “Change your nameservers (Full setup)” (2026) — &lt;a href=&quot;https://developers.cloudflare.com/dns/zone-setups/full-setup/setup/&quot;&gt;https://developers.cloudflare.com/dns/zone-setups/full-setup/setup/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;DNSPerf, “DNS Performance Benchmarks” (2026) — &lt;a href=&quot;https://www.dnsperf.com/&quot;&gt;https://www.dnsperf.com/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;DORA, “Accelerate State of DevOps Report” (2024) — &lt;a href=&quot;https://dora.dev/research/2024/dora-report/&quot;&gt;https://dora.dev/research/2024/dora-report/&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Splunk and Oxford Economics, “Downtime Costs Global 2000 Companies $400B Annually” (2024) — &lt;a href=&quot;https://www.splunk.com/en_us/newsroom/press-releases/2024/conf24-splunk-report-shows-downtime-costs-global-2000-companies-400-billion-annually.html&quot;&gt;https://www.splunk.com/en_us/newsroom/press-releases/2024/conf24-splunk-report-shows-downtime-costs-global-2000-companies-400-billion-annually.html&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Uptime Institute, “Annual Outage Analysis Report 2025” (2025) — &lt;a href=&quot;https://uptimeinstitute.com/about-ui/press-releases/uptime-announces-annual-outage-analysis-report-2025&quot;&gt;https://uptimeinstitute.com/about-ui/press-releases/uptime-announces-annual-outage-analysis-report-2025&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;</content:encoded><category>agentic-ai</category><category>devops</category><category>goose</category><category>case-studies</category><category>ai-governance</category><author>Hugues Clouâtre</author></item></channel></rss>