<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Todd Doane</title>
    <description>The latest articles on DEV Community by Todd Doane (@skibuff).</description>
    <link>https://dev.to/skibuff</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F2438797%2F390e0092-7538-4977-9390-fcb53dd32e9b.png</url>
      <title>DEV Community: Todd Doane</title>
      <link>https://dev.to/skibuff</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/skibuff"/>
    <language>en</language>
    <item>
      <title>Why your AI coding agent keeps breaking prod (and the 3-layer fix)</title>
      <dc:creator>Todd Doane</dc:creator>
      <pubDate>Sun, 18 Oct 2026 12:08:23 +0000</pubDate>
      <link>https://dev.to/skibuff/why-your-ai-coding-agent-keeps-breaking-prod-and-the-3-layer-fix-fgj</link>
      <guid>https://dev.to/skibuff/why-your-ai-coding-agent-keeps-breaking-prod-and-the-3-layer-fix-fgj</guid>
      <description>&lt;p&gt;Claude Code, Cursor and Codex are excellent at single steps. Production work is not a single step. Here is the arithmetic of why agents fall apart on real tasks, and the structure we use to run a small company's platform with agents without babysitting them.&lt;/p&gt;

&lt;h2&gt;
  
  
  The symptom: brilliant in the demo, flaky on Tuesday
&lt;/h2&gt;

&lt;p&gt;You ask the agent to deploy a fix. It edits the right file, writes a plausible commit message, runs the deploy, and then something small goes wrong: a CRLF line ending breaks a shell script on the server, an environment variable is read from the wrong file, a webhook key rotates on redeploy. The agent notices the failure, "fixes" it by retrying or resetting state, and reports success. Next week, in a fresh session, it does exactly the same thing.&lt;/p&gt;

&lt;p&gt;None of this is the model being dumb. It is the shape of the work.&lt;/p&gt;

&lt;h2&gt;
  
  
  The arithmetic: errors compound
&lt;/h2&gt;

&lt;p&gt;Suppose your agent gets each step right 90% of the time, which is generous for a step like "parse this API response and write the right rows". Chain steps together and the probabilities multiply:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Steps the model executes&lt;/th&gt;
&lt;th&gt;Success rate&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;3 decisions, scripts do the rest&lt;/td&gt;
&lt;td&gt;0.9³ = &lt;strong&gt;73%&lt;/strong&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;5 steps&lt;/td&gt;
&lt;td&gt;0.9⁵ = &lt;strong&gt;59%&lt;/strong&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;10 steps&lt;/td&gt;
&lt;td&gt;0.9¹⁰ = &lt;strong&gt;35%&lt;/strong&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Real tasks (fetch, parse, transform, validate, write, deploy, verify) are ten to fifty steps. If the model &lt;em&gt;executes&lt;/em&gt; every one of them by improvising code or commands in the moment, the success rate of the whole job collapses, and you end up watching it.&lt;/p&gt;

&lt;p&gt;The fix is not a better prompt. It is moving the steps that have a right answer out of the model entirely.&lt;/p&gt;

&lt;h2&gt;
  
  
  The 3-layer fix: Directive, Orchestration, Execution
&lt;/h2&gt;

&lt;p&gt;We call it D.O.E. Each layer does one kind of work, and the boundaries between them are the point.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Layer&lt;/th&gt;
&lt;th&gt;Nature&lt;/th&gt;
&lt;th&gt;Lives in&lt;/th&gt;
&lt;th&gt;Changed by&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Directive&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Intent, in prose: goal, inputs, tools, outputs, edge cases, how to verify&lt;/td&gt;
&lt;td&gt;&lt;code&gt;directives/*.md&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Humans write; agents append learnings&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Orchestration&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Judgment: which directive applies, which inputs, did it work&lt;/td&gt;
&lt;td&gt;The agent; &lt;code&gt;CLAUDE.md&lt;/code&gt; is its job description&lt;/td&gt;
&lt;td&gt;You, rarely&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Execution&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Determinism: fetch, parse, transform, deploy&lt;/td&gt;
&lt;td&gt;&lt;code&gt;executions/*.py&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Agents write; tests guard&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;A directive never contains code. A script never contains policy ("ask the user if…"). The agent never contains either: it reads one and runs the other. Now the model makes three decisions instead of fifty executions, and decisions are the part a model is actually good at. A script that parses a response correctly once parses it correctly forever.&lt;/p&gt;

&lt;h3&gt;
  
  
  What a directive looks like
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight markdown"&gt;&lt;code&gt;&lt;span class="gh"&gt;# Directive: Deploy the API&lt;/span&gt;

&lt;span class="gu"&gt;## Goal&lt;/span&gt;
Ship the current branch to the API server and prove it's live.

&lt;span class="gu"&gt;## Execution tools&lt;/span&gt;
executions/deploy_service.py --target api   # normalizes CRLF/BOM, uploads, restarts

&lt;span class="gu"&gt;## Edge cases &amp;amp; learnings&lt;/span&gt;
&lt;span class="p"&gt;-&lt;/span&gt; Shell scripts committed from Windows had CRLF endings and
  failed with "bad interpreter". deploy_service.py now normalizes them.
&lt;span class="p"&gt;-&lt;/span&gt; The webhook key rotates on redeploy; the script refreshes it.

&lt;span class="gu"&gt;## Verification&lt;/span&gt;
GET /health returns 200 and the commit hash matches HEAD.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;em&gt;Edge cases &amp;amp; learnings&lt;/em&gt; section is where the return on investment lives. Every gotcha the agent meets is written down where the next session reads it &lt;em&gt;before&lt;/em&gt; acting, instead of being rediscovered at 2 a.m.&lt;/p&gt;

&lt;h2&gt;
  
  
  The part that makes it get better: self-annealing
&lt;/h2&gt;

&lt;p&gt;Structure alone stops the bleeding. What makes month three dramatically better than week one is a rule about failure: &lt;strong&gt;recovery is not a fix&lt;/strong&gt;. When something breaks, the agent runs a fixed loop, in this order:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Diagnose the root cause&lt;/strong&gt;: keep asking "why" until you reach something that, once fixed, prevents recurrence.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Fix it&lt;/strong&gt; in code, config or infrastructure.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Add the test&lt;/strong&gt; that would have caught it.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Add a standard&lt;/strong&gt; to the directive (and a lint, if the pattern is mechanically detectable).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Then recover&lt;/strong&gt;: reprocess the stuck items, restart the service.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Most agent sessions do step 5 first and stop. "Let's just reprocess the stuck items" and "I'll add a cron to retry failures" feel like progress and leave the cause in place. Making recovery the &lt;em&gt;last&lt;/em&gt; step means every failure leaves behind a test, a rule and sometimes a lint, so whole classes of mistakes stop being possible.&lt;/p&gt;

&lt;h3&gt;
  
  
  A real example from building our own store
&lt;/h3&gt;

&lt;p&gt;While building the checkout for our store, a secrets linter found a live Stripe key hard-coded in an old helper script in our own repo. Removing that one key would have been recovery. The fix was making &lt;code&gt;lint_secrets.py&lt;/code&gt; run before every commit and adding a line to &lt;code&gt;CLAUDE.md&lt;/code&gt; requiring it. That kind of mistake can no longer reach git in that repo, whoever (or whatever) is typing.&lt;/p&gt;

&lt;h2&gt;
  
  
  How to start today, for free
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Put a &lt;code&gt;CLAUDE.md&lt;/code&gt; (or &lt;code&gt;.cursorrules&lt;/code&gt; / &lt;code&gt;AGENTS.md&lt;/code&gt;) at your repo root that states the three layers and the self-annealing loop.&lt;/li&gt;
&lt;li&gt;Pick the one job your agent fails at most often. Write a directive for it with the six sections above, and point it at a script.&lt;/li&gt;
&lt;li&gt;Move the deterministic parts of that job into the script. Give the script a test.&lt;/li&gt;
&lt;li&gt;Tell the agent: &lt;em&gt;"Read CLAUDE.md, then run the deploy directive."&lt;/em&gt; Watch what it appends to &lt;em&gt;Edge cases &amp;amp; learnings&lt;/em&gt;.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;We publish a free starter, &lt;a href="https://github.com/skibuff22/agent-ops-kit-lite" rel="noopener noreferrer"&gt;Agent Ops Kit Lite on GitHub&lt;/a&gt; (MIT), with the &lt;code&gt;CLAUDE.md&lt;/code&gt;, the operating-principles directive, the directive template and the secrets linter. It is enough to try the approach on one job this afternoon.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Originally published at &lt;a href="https://calyx-ai.net/blog/why-ai-coding-agent-breaks-prod/" rel="noopener noreferrer"&gt;calyx-ai.net&lt;/a&gt;. Disclosure: I sell the full &lt;a href="https://calyx-ai.net/?utm_source=devto&amp;amp;utm_medium=crosspost&amp;amp;utm_campaign=why-agents-break-prod" rel="noopener noreferrer"&gt;Agent Ops Kit&lt;/a&gt; ($29) — the extra directives, tested execution scripts and multi-agent templates. The free lite kit above stands on its own. This article was drafted with AI assistance and reviewed against the framework we run in production.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>productivity</category>
      <category>devops</category>
      <category>programming</category>
    </item>
  </channel>
</rss>
