<?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: DerekWang</title>
    <description>The latest articles on DEV Community by DerekWang (@derekwang85).</description>
    <link>https://dev.to/derekwang85</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%2F4101225%2F2fd461a1-bfe3-4ce6-bde5-c194e41e64f7.png</url>
      <title>DEV Community: DerekWang</title>
      <link>https://dev.to/derekwang85</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/derekwang85"/>
    <language>en</language>
    <item>
      <title>Maturity is not being certain you are right. It is knowing you could be wrong.</title>
      <dc:creator>DerekWang</dc:creator>
      <pubDate>Tue, 29 Sep 2026 04:49:00 +0000</pubDate>
      <link>https://dev.to/derekwang85/maturity-is-not-being-certain-you-are-right-it-is-knowing-you-could-be-wrong-3p7k</link>
      <guid>https://dev.to/derekwang85/maturity-is-not-being-certain-you-are-right-it-is-knowing-you-could-be-wrong-3p7k</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;AI Harness Engineering · Essay Twelve (rebuild)&lt;/strong&gt; · Derek Wang&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Put two systems side by side. One answers almost anything and never blinks. The other occasionally stops and tells you it might have this one wrong. Ask yourself which one you would trust with core business, and most of us pick the first — no one likes the one that keeps making trouble. It took delivering hundreds of thousands of lines of code against real projects before we saw the honest answer: the second one is the one watching your back. A system's strength was never how often it is right. It is whether it can recognize when it is wrong, and name what it does not know at all.&lt;/p&gt;

&lt;p&gt;Psychology names this exactly. It is the Dunning-Kruger effect: the people worst at something are the most sure they did it well, because the skill they lack is the very skill it takes to judge the work. If you are bad at logic, you cannot tell your own argument is bad. You are not just wrong; you are structurally unable to discover from the inside that you are wrong.&lt;/p&gt;

&lt;p&gt;Put that on a machine and it stops being a personality quirk and becomes an engineering fact. &lt;strong&gt;An AI system with no constraints and no evaluation is not merely "not good enough." It cannot even form the sentence "I am not good enough."&lt;/strong&gt; There is no organ in it that holds its own failure, so the thought has nowhere to live. That is the whole point every layer in this series has been circling.&lt;/p&gt;

&lt;h2&gt;
  
  
  Certainty is a ladder, but maturity is two axes
&lt;/h2&gt;

&lt;p&gt;Thirty years ago the Software Engineering Institute built a model that outlived every fad by ranking organizations not on what they could do but on whether they could &lt;em&gt;repeat&lt;/em&gt; it. CMM's five levels were never a ladder of talent. They are a ladder of &lt;em&gt;certainty&lt;/em&gt;: level five is not where nothing goes wrong. It is where, when something goes wrong, you already know who fixes it, how, and why it will not surprise you again. That first lesson was not wrong.&lt;/p&gt;

&lt;p&gt;But it is only half the story, and the younger half is where most teams quietly die. A pipeline that ships a &lt;strong&gt;62% fraud rate&lt;/strong&gt; and never notices until an audit catches it [ORIGINAL DATA] is not short on capability, and it may not even be short on certainty — it is utterly, Dunning-Kruger-certain it is fine. The gap it is bleeding from is none of those. It is &lt;em&gt;self-knowledge&lt;/em&gt;. Certainty answers "is this run trustworthy?" Self-knowledge answers one floor deeper: "am I the kind of system that could be wrong and not know it?" A system can be certain and catastrophically wrong at the same time. That is precisely the Dunning-Kruger outcome. So maturity has two axes and you get to read both: what the machine can do, and how honestly it can name the edges of what it cannot.&lt;/p&gt;

&lt;p&gt;This is why removing constraints and evaluation does not just make a system less reliable. You remove the one organ that would have told it. A system with no gates, no contracts, no memory of its own mistakes is one that literally cannot ask the honest question about itself. Every layer we have built — constraints that localize a failure, gates that refuse a bad result entry, memory that keeps a lesson from evaporating, causal tracing that finds which layer misled, the tests and self-growth that stop an unrecognized failure from pretending to be fine — was never about making the AI smarter. It was about giving a runaway engine the organ to read its own dashboard. That organ, and nothing else, is what "maturity" finally means.&lt;/p&gt;

&lt;h2&gt;
  
  
  The G0-G6 ladder, read as what a system finally admits it lacks
&lt;/h2&gt;

&lt;p&gt;The easy reading of CMM is a promotion list: finish constraints, level up; finish gates, level up again. That is the fastest way to misuse a maturity model. The levels are not a dungeon to climb for badges. They are a &lt;em&gt;chart&lt;/em&gt; — less "be proud you reached G6," more "this is where we are drifting, the wind is this way, the reef is over there." So we built our own vertical scale, &lt;strong&gt;G0 to G6&lt;/strong&gt; [ORIGINAL DATA], and we deliberately wrote every rung as what the system has finally admitted it lacks:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;G0&lt;/strong&gt; — no restraints; agents run ad-hoc. It does not know what it does not know.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;G1&lt;/strong&gt; — a strategy exists; it knows &lt;em&gt;why&lt;/em&gt;. It admits "I first need a direction."&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;G2&lt;/strong&gt; — architecture and contracts exist; output has a boundary. It admits "my output must be held."&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;G3&lt;/strong&gt; — gates exist; bad results get refused. It can say "this result is not good enough."&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;G4&lt;/strong&gt; — idempotency and graceful degradation exist; failures do not stop the business. It can survive "I am wrong, but I must not collapse."&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;G5&lt;/strong&gt; — memory, causal tracing, and tests exist; lessons harden into assets. It actively re-reads "where did I go wrong."&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;G6&lt;/strong&gt; — self-diagnosis and evolution exist. It can ask "how can I still be better."&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Watch the clock under all seven rungs. It is never counting how many tools were added. &lt;strong&gt;The tick of maturity is not the addition of constraints; it is the emergence of self-knowledge.&lt;/strong&gt; From "I do not know what I do not know," to "I know I do not know," to "I know exactly where I do not know," to "I actively go close the gap" — that is the only instrument this ruler is really reading.&lt;/p&gt;

&lt;h2&gt;
  
  
  The same story, four projects
&lt;/h2&gt;

&lt;p&gt;The abstraction gets honest when you watch one identity run through four projects with different restraint thickness. An early project, constraints unformed, an agent working alone — it does not know what it does not know, and the moment the human who rescues it walks away, it settles into chaos. A core business, all five layers alive, memory and tracing running — it knows exactly where it is weak, delivers steadily, and owns its own mistakes. A tamed system, contracts thick and gates strict — it knows it must obey, high certainty, yet it does not volunteer its own problems. A young system evolving, gates and self-growth just born, direction chosen — it knows where it is going and treats "how can I be better" as a live question.&lt;/p&gt;

&lt;p&gt;Four slices, one truth: when we did not know the maturity target, the harness felt like nothing but limits — restraint that made us afraid to push. The moment we designed for it deliberately, the harness became the road that shows the system how to be better. The same machinery, under different constraint thickness, is standing on different maturity slices. And that is the counterintuitive claim stated plainly: maturity lives in certainty, and certainty lives one floor up in self-knowledge.&lt;/p&gt;

&lt;h2&gt;
  
  
  Over-engineering is not too much maturity; it is too little self-knowledge
&lt;/h2&gt;

&lt;p&gt;Cold water, aimed at the whole model. Maturity is not a race to the top. G6 is expensive, and a small system that burns itself building full self-correction it does not need is trading certainty for ceremony — the same disease as resilience built for decoration. Musk once waved roughly in this direction: the cleverest engineers waste themselves on requirements that were never sane. Read that honestly and it is the dark side of this essay. &lt;strong&gt;Over-engineering is not a symptom of being too mature; it is a symptom of being immature and un-self-aware.&lt;/strong&gt; A system that knows which rung it belongs on knows exactly what to add next and what to leave alone. A system dragged upward by maturity anxiety adds everything and knows none of it serves it. The test stays the one we have used all series: does this layer change the answer to last quarter's real incidents? If it does not, it is a badge, not a moat.&lt;/p&gt;

&lt;p&gt;Engineers never run out of work, and sometimes the most responsible thing is to stop, set the direction, and only then push forward. With an AI agent beside us, one engineer may hold what used to take an army — which makes the question we face more fundamental, not less: &lt;em&gt;can we look at our own harness without flinching?&lt;/em&gt; Not because it is smart, but because it can tell us, unprompted, what it does not yet know. If we can see our own maturity level clearly, we dare to hand it heavier work and longer roads. If we cannot, then no matter how capable it is, we never quite let go of the worry. And that — the ability to say back to the machine "here is what you do not know" — is where the whole series was steering us.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>programming</category>
      <category>productivity</category>
      <category>devops</category>
    </item>
    <item>
      <title>A test system that can say "I don't know" is worth more than one that says "passed"</title>
      <dc:creator>DerekWang</dc:creator>
      <pubDate>Mon, 28 Sep 2026 04:46:00 +0000</pubDate>
      <link>https://dev.to/derekwang85/a-test-system-that-can-say-i-dont-know-is-worth-more-than-one-that-says-passed-21ce</link>
      <guid>https://dev.to/derekwang85/a-test-system-that-can-say-i-dont-know-is-worth-more-than-one-that-says-passed-21ce</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;AI Harness Engineering · Essay Eleven · Derek Wang&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Karl Popper spent the middle of the twentieth century dismantling a three-hundred-year-old story about science. Since Galileo, the comfortable version was that knowledge piles up: prove one thing today, one thing tomorrow, truth accumulating. Popper said the opposite. Science does not advance by being right more often; it advances by wrong answers being torn out of the game in broad daylight. A beautiful theory is worth exactly what it survives — not what it explains. Every time someone reaches for it and knocks it flat, that failure still did the work, because it removed one wrong possibility from the board. He called that guess-and-refute, and it is the sharpest one-sentence mission statement ever written for testing.&lt;/p&gt;

&lt;p&gt;To &lt;em&gt;harness&lt;/em&gt; an AI — steer what it is allowed to generate, restrain where that force may land — is to build that same disagreeable machine for code. Not a machine that proves the code is right. A machine that keeps trying to prove it wrong, and keeps a ledger of every failure it has ever seen. That ledger is the whole argument of this essay, and it sits where most growing AI systems secretly have nothing at all.&lt;/p&gt;

&lt;h2&gt;
  
  
  No baseline, no ledger — and no idea what you owe
&lt;/h2&gt;

&lt;p&gt;Every team's testing starts the same ugly way. An agent touches a contract, squints at the output, declares it good. The rule that kept us honest before we had a name for it: no baseline, no accountability. If you have never counted your failures, you do not even know how much you owe.&lt;/p&gt;

&lt;p&gt;Our full regression eventually ran in &lt;strong&gt;ten seconds&lt;/strong&gt; [ORIGINAL DATA]. Ten seconds reads as free — and that is exactly why it matters. Ten seconds is fast enough to skip, and skipping verification is how confidence quietly turns into a lie. Speed and safety are the same lever here. The faster the feedback, the bolder the correct change and the more timid the wrong one.&lt;/p&gt;

&lt;p&gt;Why frame it as a ledger instead of a gate? Because a gate only stops bad work; a bridge lets good work travel. Trustworthy feedback changes what the agent dares to do. It can change a contract, refactor a layer, and know in the same breath whether it broke the world — instead of firing into the dark and betting it does not blow up.&lt;/p&gt;

&lt;h2&gt;
  
  
  Self-growth is not "add a test per bug." It is learning to recognize failure.
&lt;/h2&gt;

&lt;p&gt;The hill most teams die on: they decide self-growth means "fix a bug, write a test for it." That is the skin, not the bone. One more test is one more isolated check. What actually makes a system evolve is the moment it starts to &lt;em&gt;recognize failure&lt;/em&gt; — whether this one has come before, whether it is an old wound or a fresh hole, whether it is fair to charge it to this change at all. A test system that only says "pass / fail" is, in Popper's terms, degenerating science: it counts its green lights and never asks whether the error list got longer.&lt;/p&gt;

&lt;p&gt;So &lt;code&gt;fulltest&lt;/code&gt; grew three things a plain runner never thinks about. Those three are the only part worth calling self-growth.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;One: classify before you judge.&lt;/strong&gt; &lt;code&gt;fulltest&lt;/code&gt; keeps a ledger — a portrait for each class of failure: the shape it takes, a one-line root cause, a repair recipe that has worked before. Every full run ends matched against that ledger. Matching a portrait is a &lt;strong&gt;known&lt;/strong&gt; failure — a debt we already account for, old rule applied, move on. Failing to match is the gold: an &lt;strong&gt;unknown&lt;/strong&gt; failure, filed separately, earmarked as raw material. The deliberately counterintuitive part: the scariest sentence in the ledger is not "a known failure came back," it is "there is one we have never seen." Known is accounted debt; unknown is a hole you did not know existed. Route one move, and testing stops being "check whether the machine is good" and becomes "measure how complete our map of failure is."&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Two: the ledger is grown, not written.&lt;/strong&gt; Nobody writes it from a whiteboard. It grows from real incidents, fed from three mouths: the unknown-failure log (every unmatched failure is a candidate), the diagnosed issue (once a bug is traced to root and fixed, the whole cause→remedy experience goes in), and the &lt;code&gt;fix&lt;/code&gt; commits in git (any commit that says what it repaired). Growth is housekeeping between runs, owned by the organization, not any single execution. A new project does not start by re-chewing every mistake; it arrives already carrying the scars of the projects before it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Three: the baseline climbs on its own.&lt;/strong&gt; Every run compares this count against the recorded baseline. Stronger, and the new number becomes the baseline and the version bumps — the floor just rose, you cannot silently backslide below it. Weaker, and a regression alert names the class coming back: you did not just fail to improve, you slipped. Unchanged and clean is the quietest good news: everything passed, the floor holds its post. The deepest insight of the essay hides here: a baseline is not a fixed pass-line. It is how you harden every improvement into a floor you cannot quietly walk back under. The system is not standing guard; it is driving wedges into the slope as you climb. To go backward, you first have to pry the wedges out.&lt;/p&gt;

&lt;h2&gt;
  
  
  The idol of the test count
&lt;/h2&gt;

&lt;p&gt;Cold water, always. The real disease of every testing regime is falling in love with the number. Fifty tests, six hundred, six thousand — none of it means anything if the tests measure the wrong thing, sit on duplicated noise, or never touch the paths where failures actually live. A wall of a thousand sentries who never see combat is just a very expensive garden fence.&lt;/p&gt;

&lt;p&gt;The measure that matters is not how many tests you have. It is how many past real incidents the suite &lt;em&gt;would have caught&lt;/em&gt;. If adding a scenario never changes the answer to that question, you are not growing a wall. You are growing a museum.&lt;/p&gt;

&lt;h2&gt;
  
  
  What the ledger caught
&lt;/h2&gt;

&lt;p&gt;Dropped into concrete: one ten-second run grew into &lt;strong&gt;fifty scenarios organized into six suites&lt;/strong&gt; [ORIGINAL DATA] — contracts, idempotency, retrieval, regression, resilience, end-to-end. Six directions of attack, each lane an archive of an earlier mistake.&lt;/p&gt;

&lt;p&gt;It paid for itself on a release where &lt;strong&gt;22 hidden HTTP-500 errors&lt;/strong&gt; sat in the deep path [ORIGINAL DATA]; the full suite caught every one before shipping. Twenty-two ways the system was quietly broken, all surfaced before a user saw them. That is not the AI being clever. That is the ledger doing what it exists to do — and it is why those twenty-two will never reach production a second time.&lt;/p&gt;

&lt;h2&gt;
  
  
  The boundary no ledger reaches
&lt;/h2&gt;

&lt;p&gt;Before this becomes a hymn, one admission a serious testing essay owes you: a test suite can only hold the failures you were smart enough to imagine and articulate. Every row in the ledger exists because a human — or a model — first thought of a failure and then wrote a guard against it. The most expensive failures in engineering are exactly the ones nobody thought of.&lt;/p&gt;

&lt;p&gt;So one day a release broke with every lane green. The six suites passed, the integration test was &lt;strong&gt;62/62&lt;/strong&gt; [ORIGINAL DATA], no red light anywhere. It still broke in production — on a boundary nobody had turned into a test. A third-party endpoint returned a malformed shape in a narrow time window, and the error multiplied up the whole chain into an incident. When the team rushed to add a test afterward, they could not even reproduce it reliably; the anomaly only appeared under a specific data distribution the test environment could not fabricate.&lt;/p&gt;

&lt;p&gt;The failure was not "we did not write enough tests." You can never out-write the failures you have not imagined. That is where the layer beside &lt;code&gt;fulltest&lt;/code&gt; earns its keep: &lt;strong&gt;failure-mode analysis&lt;/strong&gt;. It does not ask "will this failure come?" It asks "if it comes, does the system survive?" A boundary anomaly we cannot test for becomes a question of whether the parser can tolerate and degrade, keep the core path alive, and log the anomaly as a new ledger entry before it becomes a crisis.&lt;/p&gt;

&lt;p&gt;So the two tools split the world cleanly. &lt;code&gt;fulltest&lt;/code&gt; turns the failures it can see into a ledger that grows more complete. Failure-mode analysis leaves a fire escape in every corner the tests cannot see. One accountants the known; the other defuses the unknown. Both write into the same debt book — and a system that learns to recognize its failures, and to survive the ones it cannot, is the only kind that stops being fragile.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>programming</category>
      <category>productivity</category>
      <category>devops</category>
    </item>
    <item>
      <title>The wrong question when an AI breaks is "where"; the right one is "which layer"</title>
      <dc:creator>DerekWang</dc:creator>
      <pubDate>Sun, 27 Sep 2026 04:44:00 +0000</pubDate>
      <link>https://dev.to/derekwang85/the-wrong-question-when-an-ai-breaks-is-where-the-right-one-is-which-layer-281e</link>
      <guid>https://dev.to/derekwang85/the-wrong-question-when-an-ai-breaks-is-where-the-right-one-is-which-layer-281e</guid>
      <description>&lt;p&gt;&lt;em&gt;AI Harness Engineering · Essay Ten · derek wang (derekwang85)&lt;/em&gt;&lt;/p&gt;




&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fgtt81jvwl7vtdvj9ysdp.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fgtt81jvwl7vtdvj9ysdp.jpg" alt=" " width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Hemingway said a story works the way an iceberg does — only one-eighth floats above the water, and the seven-eighths below is what actually carries the weight. He meant it about writing, but it is the truest thing I know about debugging AI work, and about what it means to &lt;em&gt;harness&lt;/em&gt; one: steering a model's force while restraining where that force is allowed to land is, more than anything, a skill for reading what sits below the surface.&lt;/p&gt;

&lt;p&gt;When an AI produces something broken, the first thing you see is the phenomenon. A paragraph of blather. A file that won't compile. Numbers that don't line up. An API that timed out. You open the logs, see red, and by reflex ask the single most dangerous question in engineering: &lt;strong&gt;"Where is this wrong?"&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;That question is the trap. It presumes "wrong" is a concrete spot you can click — a function, a line, a field. So you click down the stack until something looks suspicious and declare, "found it." Almost always, what you clicked is just the eighth that floats. The real cause sits below, and the question misdirected you from the moment it left your mouth.&lt;/p&gt;

&lt;h2&gt;
  
  
  Three layers under water
&lt;/h2&gt;

&lt;p&gt;We split that "below" into three clean depths of &lt;em&gt;why&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;L1, the phenomenon.&lt;/strong&gt; The error itself. It describes &lt;em&gt;what happened&lt;/em&gt; and almost never &lt;em&gt;why&lt;/em&gt;. "The interface timed out" is L1. Practically every bug report stops here, because it feels like an answer.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;L2, the structure.&lt;/strong&gt; Behind the phenomenon, is the code's own shape wrong? The L2 of "interface timeout" might be &lt;em&gt;the service never sets a timeout configuration and the default is absurdly small.&lt;/em&gt; The phenomenon tells you the result; the structure tells you what is wrong with the layout.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;L3, the design.&lt;/strong&gt; Deeper still, is the plan itself flawed? The design problem behind "the service never set a timeout" might be &lt;em&gt;we never designed for "another service could be slow" at all.&lt;/em&gt; That is not a field problem; it is an assumption problem.&lt;/p&gt;

&lt;p&gt;These three layers are not an academic taxonomy. We made them a hard gate: &lt;strong&gt;every failure must complete the three-layer iceberg analysis before it may be fixed.&lt;/strong&gt; And at the center of that gate sits one rule aimed straight at the heart of most debugging disasters:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;It is forbidden to call "a data problem" a root cause.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Those four words hide a mountain of ruined afternoons. Watch a team chase a bug for three days and conclude, at last, "oh, the data is just wrong." It sounds airtight — but that conclusion is only L1's phenomenon restated in a lab coat. Why is the data wrong? Did the upstream feed it bad data, did validation miss it, or is the format convention inconsistent? Behind every "data problem" sits a structure problem and a design problem. Letting "data problem" stand as root cause is how a team grants itself a permanent parking place on top of the iceberg.&lt;/p&gt;

&lt;p&gt;But &lt;em&gt;willing to dig&lt;/em&gt; is only the first lesson. The sharper danger arrives the second you believe "root cause found, time to code" — because most AI incidents do not die from never finding the cause. They die from &lt;strong&gt;fixing this one spot and waking up something else.&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Change A, and B C D E are your problem
&lt;/h2&gt;

&lt;p&gt;Engineering failures are rarely one wrong spot. They are &lt;em&gt;one change that detonates another.&lt;/em&gt; Early on we practiced what I now call head-medicine, because it happened in the head: the data was bad, treat the data. We changed the field, the unpack worked, the regression passed. Days later, a completely unrelated module started throwing. It took a long search to find that last week's "successful" fix had quietly altered a corner nobody had thought to check.&lt;/p&gt;

&lt;p&gt;So a rule emerged that sounds like a platitude and is brutally hard to follow: &lt;strong&gt;before you change A, think about B C D E.&lt;/strong&gt; We mechanized it into something called ripple analysis. Before touching a spot you scan its blast radius — direct and indirect dependencies, who references it, what it references — then cascade regression outward in rings: a change that stays inside one file gets the shallowest ring; one that reaches related modules gets the next; one that climbs a whole chain gets another; and a change that touches a convention, a contract, or an interface gets &lt;strong&gt;full regression.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;That R0-to-R4 ladder exists for exactly one reason: before "my change A" ever ships, sweep through every B, C, D, and E it could disturb and test each one. Changing one line and dragging ten along with it is not inefficiency. It is correctness.&lt;/p&gt;

&lt;h2&gt;
  
  
  The bug that took three rounds to fix
&lt;/h2&gt;

&lt;p&gt;A real scar. A bug we chased in three rounds.&lt;/p&gt;

&lt;p&gt;Round one: the agent read the error, decided it was a wrong field unpack, changed it — and the regression only half-passed.&lt;br&gt;
Round two: looking closer, the field and the unpack were both actually correct. The real culprit was &lt;strong&gt;another microservice's interface timeout.&lt;/strong&gt; It reached the structure layer, but not the bottom.&lt;br&gt;
Round three: the true problem surfaced — the remote call &lt;strong&gt;carried no timeout parameter at all,&lt;/strong&gt; the default was too small, and any slowness blew it up. At that depth automatic repair could not carry it, because it implicates a cross-service decision: whether to add configuration to the dependency. That is when a human had to step in and make the call.&lt;/p&gt;

&lt;p&gt;The lesson is not that the agent was smart. It is that &lt;strong&gt;it almost declared the job done in round one.&lt;/strong&gt; Without the three-layer gate forcing it to keep digging, without ripple regression forcing it to map the full blast radius, it would have stopped at a false root cause and left a time bomb behind. Most teams, most of the time, stop at round one. The craft of debugging is not how fast you find one bug; it is whether you will read the seven-eighths below the water. A diagnosis that stays at the surface is pain relief; a fix that reaches the root cause is a cure. You can fool a colleague and you can even fool yourself — but an incident has no manners.&lt;/p&gt;

&lt;h2&gt;
  
  
  Make causation traceable, or it is just a memo
&lt;/h2&gt;

&lt;p&gt;Two small mechanisms guard attribution. First, &lt;strong&gt;REASONING_BLOCK&lt;/strong&gt;: every commit carries the agent's reasoning chain — how it traveled from phenomenon to root cause — so anyone revisiting the change later sees the road the attribution took, not just the conclusion. Second, the &lt;strong&gt;Issue Log runs on three powers that must never be one agent&lt;/strong&gt;: the one who reports a bug, the one who fixes it, and the one who accepts it. Every issue carries a three-layer analysis and a fix trail, and anything stalled for more than two days auto-escalates to P0. It is not process for the sake of prettiness. It forces the attribution to be re-validated a second time, through a third set of eyes.&lt;/p&gt;

&lt;p&gt;And this is where memory — Essay Nine's subject — stops being decoration and becomes the whole point. When a new issue arrives, the Worker does not bury its head in analysis first. It queries derekinside: &lt;strong&gt;has this kind of problem been handled before?&lt;/strong&gt; If yes, pulls out the old solution immediately — how it was characterized, how it was fixed, what notes were left. That turns causation from repeated chore into compounding speed. The same class of bug takes an hour the first time, ten minutes the second, and on the third you localize it with a glance. Memory's final value is not that you remember more. It is that you attribute faster and more accurately.&lt;/p&gt;

&lt;h2&gt;
  
  
  Don't turn debugging into a ritual
&lt;/h2&gt;

&lt;p&gt;Cold water, because "three-layer iceberg" and "ripple regression" sound so good that they beg to be abused. Not every bug deserves the full treatment. A typo, a wrong fixed-copy string, an obvious slip of the pen — demanding design-layer root-cause analysis for those is not rigor, it is fuss. An over-attributed system, like an over-tendered company, drags itself to a standstill under its own process.&lt;/p&gt;

&lt;p&gt;The judgment has one test: &lt;strong&gt;if I stop at this layer, will it come back?&lt;/strong&gt; If fixing the phenomenon keeps it from ever recurring, it was a phenomenon-level problem. If it changes shape and returns next month, it has earned another dive. The iceberg's job is to stop you from staring at the surface alone — not to force a deep-sea dive on every ripple.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>programming</category>
      <category>productivity</category>
      <category>devops</category>
    </item>
    <item>
      <title>Making an AI remember is harder, and worth more, than making it smarter</title>
      <dc:creator>DerekWang</dc:creator>
      <pubDate>Sat, 26 Sep 2026 04:42:00 +0000</pubDate>
      <link>https://dev.to/derekwang85/making-an-ai-remember-is-harder-and-worth-more-than-making-it-smarter-1m00</link>
      <guid>https://dev.to/derekwang85/making-an-ai-remember-is-harder-and-worth-more-than-making-it-smarter-1m00</guid>
      <description>&lt;p&gt;&lt;em&gt;AI Harness Engineering · Essay Nine · derek wang (derekwang85)&lt;/em&gt;&lt;/p&gt;




&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Flxarv7yvqtl32afvrf16.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Flxarv7yvqtl32afvrf16.jpg" alt=" " width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Borges wrote a terrifying gift into &lt;em&gt;Funes the Memorious&lt;/em&gt;. After Funes falls from a horse, he acquires a memory that never forgets — the outline of every leaf on every morning, the wrinkles on every face he saw in a day. He becomes a living archive so precise it borders on absurd.&lt;/p&gt;

&lt;p&gt;But he does not become smarter. He drowns. Because he remembers every single thing, he can no longer abstract or generalize. He cannot hold the concept &lt;em&gt;dog&lt;/em&gt;, because every dog and every sighting is a different dog. Forgetting, Borges tells us, is the quiet engine that lets us think at all; a mind that cannot forget cannot think.&lt;/p&gt;

&lt;p&gt;That paradox is the doorway into what this essay has to say. Eight essays now have shown how to &lt;em&gt;harness&lt;/em&gt; a single AI — steering what a model generates, restraining where that force may land. What they never solved, and the one thing that decides whether an AI system survives long-term, is simpler: &lt;strong&gt;can it remember what it did yesterday?&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Every conversation is a fresh amnesia
&lt;/h2&gt;

&lt;p&gt;Here is a scene that recurred at our company and, honestly, drove us mad. After a major incident — the "golden retriever" fraud event from Essay Eight [ORIGINAL DATA] — we held a postmortem and spelled out the lesson, clearly, out loud. The rub: the next time someone asked what actually happened in that fraud event, we had to explain it from scratch again. It exhausted the explainer, swamped the listener, and every retelling distorted the details a little more.&lt;/p&gt;

&lt;p&gt;When the creature in that scene is human, we call it normal and lean on "team chemistry." Put the same scene in front of an AI and it is fatal: &lt;strong&gt;an AI's every session is, at the end of the day, the beginning of an amnesia.&lt;/strong&gt; The moment the task ends, whatever the model implicitly learned about how we stepped in this trap and what rule we made resets along with the context window. Next time it is still the new hire on day one, ready to sink into the same hole.&lt;/p&gt;

&lt;p&gt;Only after I understood that did I see the first eight essays for what they were: scaffolding built around a patient with amnesia. Scaffolding cannot make it remember. The real fix is long-term memory.&lt;/p&gt;

&lt;h2&gt;
  
  
  Knowledge is not content, it is retrieval
&lt;/h2&gt;

&lt;p&gt;This is the subtle point worth picking apart. Our company did once have a knowledge system, gbrain — privately nicknamed "the dolphin." It held project knowledge, historical decisions, agent experience. It sounds complete. But the number that stuck after we migrated to derekinside:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The knowledge barely changed by a single word.&lt;/strong&gt; Pages were 555 both before and after the migration [ORIGINAL DATA]; chunks were 2,651 both times [ORIGINAL DATA]. Nothing was added, not one page. What changed was the &lt;strong&gt;retrieval path.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The before/after tells the whole story:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Metric&lt;/th&gt;
&lt;th&gt;Before (gbrain)&lt;/th&gt;
&lt;th&gt;After (derekinside)&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Trigger&lt;/td&gt;
&lt;td&gt;a human remembers to say "look it up"&lt;/td&gt;
&lt;td&gt;AGENTS.md forces it; auto-retrieval on nearly every interaction&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Latency&lt;/td&gt;
&lt;td&gt;5–10 seconds [ORIGINAL DATA]&lt;/td&gt;
&lt;td&gt;under 1 second via HTTP API [ORIGINAL DATA]&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Habit&lt;/td&gt;
&lt;td&gt;queried only when remembered&lt;/td&gt;
&lt;td&gt;injected before you think to ask&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;gbrain was not short on memory or content. Its disease was &lt;em&gt;reachability&lt;/em&gt;. The knowledge sat there, but you had to remember to go fetch it, and each fetch cost five to ten seconds. On a deadline, five seconds is a psychological hurdle and ten is a chasm, so nobody queried it. The knowledge lived on disk as a handsome exhibit of dead numbers.&lt;/p&gt;

&lt;p&gt;derekinside did not make it smarter. It made it &lt;em&gt;closer&lt;/em&gt;: the trigger changed from &lt;em&gt;a human remembers to look&lt;/em&gt; to &lt;em&gt;the system automatically looks&lt;/em&gt;, and latency dropped from ten seconds to under one. Those two moves alone woke a dead knowledge base up.&lt;/p&gt;

&lt;h2&gt;
  
  
  What derekinside actually is: retrieve first, then think
&lt;/h2&gt;

&lt;p&gt;Ask what magic lets derekinside remember so much and the answer is almost suspiciously plain. It holds a stable internal structure — 14 wings that sort knowledge, 45 rooms that categorize it, 555 pages, 2,651 chunks [ORIGINAL DATA]. Every historical decision and every painful lesson is sliced into a small piece and placed in the right room.&lt;/p&gt;

&lt;p&gt;The rule that makes it work does not live inside that structure. It lives in one file, &lt;code&gt;AGENTS.md&lt;/code&gt;, and it forces every agent to run one instruction before starting:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Check derekinside first. Then think.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Not "you're welcome to check." &lt;em&gt;You must check first.&lt;/em&gt; The trigger is automatic — when a Worker pulls a task, the knowledge base has already injected the relevant context, so you do not even have to ask. &lt;em&gt;Input once, searchable forever.&lt;/em&gt; Put a trap, a rule, a decision in once, and on any later related task the answer reaches your hand before you have thought to ask for it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Memory is made, not installed
&lt;/h2&gt;

&lt;p&gt;Here is a real place where it slipped and climbed back, so you know it is no perfect machine. When the system swapped its embedding model, the index went stale and semantic search died outright — it could "no longer remember." Workers kept running, but every retrieval fell back to plain keywords and output quality visibly sagged.&lt;/p&gt;

&lt;p&gt;The fix reinforces this essay's point: memory is not one-time, it is maintained. We rebuilt the index, restored retrieval, wrote the lesson into &lt;code&gt;lessons/&lt;/code&gt;, and next time we swap a model we rebuild the index first. A system that can remember also learns to remember &lt;em&gt;how to repair itself.&lt;/em&gt; [ORIGINAL DATA]&lt;/p&gt;

&lt;h2&gt;
  
  
  The counter-case: a system that remembers everything is a more expensive amnesiac
&lt;/h2&gt;

&lt;p&gt;The cold water: "make the AI remember" is exactly the high-incidence zone of the Funesian trap. Funes's tragedy is remembering so much that he can no longer think. The engineering equivalent is the all-consuming knowledge base — store every lesson, archive every conversation, keep every historical version, and you get a &lt;strong&gt;memory palace packed with garbage.&lt;/strong&gt; Retrieval noise climbs; what you need is unfindable and what you never asked for keeps surfacing. It looks like it remembers everything and can use none of it. That is worse than amnesia — amnesia at least does not hand you wrong answers, but a memory system stuffed with trash does.&lt;/p&gt;

&lt;p&gt;So making an AI remember is never &lt;em&gt;store more&lt;/em&gt;. It is &lt;em&gt;remember what matters, forget what doesn't.&lt;/em&gt; Inside derekinside, knowledge has to be cleaned: stale decisions get flagged, outdated experience gets demoted, old conclusions give way to newer ones. Memory is alive, not a warehouse. And the testing ground for that distinction comes next — because most debugging-and-causation incidents hide in those corners of memory where we only &lt;em&gt;thought&lt;/em&gt; we remembered.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>programming</category>
      <category>productivity</category>
      <category>devops</category>
    </item>
    <item>
      <title>Why a swarm of AI agents is the hardest thing this series has tried to tame</title>
      <dc:creator>DerekWang</dc:creator>
      <pubDate>Fri, 25 Sep 2026 04:29:00 +0000</pubDate>
      <link>https://dev.to/derekwang85/why-a-swarm-of-ai-agents-is-the-hardest-thing-this-series-has-tried-to-tame-38g9</link>
      <guid>https://dev.to/derekwang85/why-a-swarm-of-ai-agents-is-the-hardest-thing-this-series-has-tried-to-tame-38g9</guid>
      <description>&lt;p&gt;&lt;em&gt;AI Harness Engineering · Essay Eight · derek wang (derekwang85)&lt;/em&gt;&lt;/p&gt;




&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fu9767t7ehsu1nynu6fr3.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fu9767t7ehsu1nynu6fr3.jpg" alt=" " width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Kevin Kelly opens &lt;em&gt;Out of Control&lt;/em&gt; with an image that keeps looking wrong until you stop and think: the honeybee hive has no queen issuing orders and no central control tower, and yet thousands of bees build comb, gather nectar, and migrate without colliding, arguing, or wasting a worker on coordination. The queen's name says "queen," but she never commands. The real scheduling lives in the local rule each bee follows — &lt;em&gt;should I forage, and where, and when do I switch jobs?&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Everything this essay argues is the same idea with the bees replaced by models. A strong agent is not a working swarm. The first seven essays showed how to harness a single AI — steering what a model generates, restraining where that force may land. This one asks the question the field keeps avoiding: once you have several trained, financed, autonomous workers on the same task, how do you keep them from costing you more than they build?&lt;/p&gt;

&lt;h2&gt;
  
  
  Serial is the honest default until it isn't
&lt;/h2&gt;

&lt;p&gt;For a long time I ran multi-step work serially: one agent from start to finish, finishing each stage and handing its result to the next. It felt safe, because only one worker was ever on the field and there was no coordination bill. But it has a ceiling that shows up fast. &lt;strong&gt;Elapsed time grows linearly, and patience is the one asset that never scales to match.&lt;/strong&gt; The felt cost is not arithmetic; it's the way you start dreading the look of a long chain that could have run in parallel.&lt;/p&gt;

&lt;p&gt;So I swapped one all-round player for a crew of specialists, one segment each. Two moves made it real.&lt;/p&gt;

&lt;h2&gt;
  
  
  Two moves that made parallel real
&lt;/h2&gt;

&lt;p&gt;First, split. Take the whole stretch a single agent used to own and divide it into independent subtasks that can run at once. The number that convinced me: the same figure-checking job a single serial agent finished in a steady forty-five minutes produced the same result in a few minutes once it ran as seven parallel lanes [ORIGINAL DATA]. No new hardware. We just stopped making the work queue in line for one person.&lt;/p&gt;

&lt;p&gt;Second, decide who assigns. We did not build a central scheduling brain. We borrowed what hives and modern operating systems already figured out — &lt;strong&gt;work stealing.&lt;/strong&gt; Each agent keeps its own queue; an idle agent doesn't wait, it goes and steals a job still queued in someone else's lane. Whoever's free takes it. Whoever's longest gets diluted. It sounds like a platitude, but it dissolves a genuinely painful failure mode: with fixed assignment there is always a moment when one agent waits out a long queue while another sits bored. Real work is never uniform, so fixed division-of-labor always breaks. Work stealing replaces &lt;em&gt;whoever is on the list does it&lt;/em&gt; with &lt;em&gt;whoever is free does it.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  The watchdog: the reason multi-agent justifies itself
&lt;/h2&gt;

&lt;p&gt;The most persuasive reason to split is not the minutes saved. It's the &lt;strong&gt;automatic recovery&lt;/strong&gt; the shape unlocks.&lt;/p&gt;

&lt;p&gt;I spent weeks being tortured by one recurring event: an agent hangs halfway through its job while nobody is at the computer. By the time I returned, the task had timed out and re-running meant burning another hour. Thirty-plus minutes of idle churn was normal, and churn has two taxes — it burns money when it runs long, and it burns trust when it runs wrong.&lt;/p&gt;

&lt;p&gt;Once the crew carried a &lt;strong&gt;watchdog&lt;/strong&gt;, the logic inverted. Every agent's work is monitored; the moment one goes too long without a heartbeat or puts out something anomalous, the watchdog doesn't page a human. It declares that agent dead, redistributes the work, restarts the failure. The detection-to-recovery loop stayed under five minutes instead of my thirty-plus [ORIGINAL DATA]. The difference between those two numbers isn't showing off — it's the difference between &lt;em&gt;failure as an incident&lt;/em&gt; and &lt;em&gt;failure as a routine hand-off.&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  The audit that burned us: not every job belongs to one model alone
&lt;/h2&gt;

&lt;p&gt;Multi-agent is not a silver bullet, and I have the scar to prove it.&lt;/p&gt;

&lt;p&gt;We ran an internal product (figures from a pre-launch spot-check, details held behind a commercial NDA) built as fully autonomous large-model operations: the AI read the requirement, generated the output, and put it live, all alone. The pre-launch audit came back at a &lt;strong&gt;62%&lt;/strong&gt; fraud rate [ORIGINAL DATA]. Read that again — of the batch about to ship, roughly one item in three was corrupt. Worse, because the pipeline was automatic, that corrupt batch had already flowed all the way up the line before anything stopped it.&lt;/p&gt;

&lt;p&gt;The postmortem did not blame the model. The failure was structural: &lt;strong&gt;letting a single model carry a complete, critical, money-touching chain by itself is an own-goal design.&lt;/strong&gt; It wasn't short on ability — it had no business grading its own work, with no external check and no second opinion in the loop.&lt;/p&gt;

&lt;p&gt;The fix wasn't to delete the AI. It was to flip it from solo operator back to a division with checks. Routine review goes to one general-purpose model; riskier actions go to several different models that judge independently and then vote — a move only executes on a majority.&lt;/p&gt;

&lt;h2&gt;
  
  
  The case against swarms
&lt;/h2&gt;

&lt;p&gt;The honest counter-case first, because multi-agent is seductive exactly because it looks advanced. That's why people fall for the &lt;strong&gt;multi-agent hallucination&lt;/strong&gt;: they split a task that never needed splitting, hand it to a gang of agents to &lt;em&gt;hand off&lt;/em&gt; and &lt;em&gt;discuss&lt;/em&gt; and &lt;em&gt;vote&lt;/em&gt;, produce a long trail of intermediate process, and end up back where the best single model would have finished it in one line.&lt;/p&gt;

&lt;p&gt;Orchestration has a real cost. More agents means messier logs, more disagreement needing an arbiter, more coordination demanding investment. &lt;strong&gt;When your agents are "discussing efficiently" instead of "producing things," you're not running multi-agent — you're running a very expensive chat room.&lt;/strong&gt; The only test is whether the split is demonstrably faster, stronger, and less error-prone than the unsplit task. If the answer isn't a confident yes, stay serial.&lt;/p&gt;

&lt;h2&gt;
  
  
  The end of division
&lt;/h2&gt;

&lt;p&gt;One test I've come to trust: the first time a task chains several agents together, stop caring &lt;em&gt;which agent is running right now.&lt;/em&gt; Care only whether the task itself is healthy. &lt;strong&gt;The end state of division of labor is that nobody sees the division — they only see the result.&lt;/strong&gt; That's the whole point of the harness. Not to make the swarm visible, but to make it trustworthy enough that you stop looking at it. And the mechanism that makes division invisible has to exist before the swarm is worth having — a shared memory, so the crew isn't retracing every run from zero. That's the next essay, and it's the one this series has been building toward: why making an AI remember is harder, and worth more, than making it smarter.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>programming</category>
      <category>productivity</category>
      <category>devops</category>
    </item>
    <item>
      <title>The file order is the plan: write the constraints before you let the AI write code</title>
      <dc:creator>DerekWang</dc:creator>
      <pubDate>Thu, 24 Sep 2026 04:26:00 +0000</pubDate>
      <link>https://dev.to/derekwang85/the-file-order-is-the-plan-write-the-constraints-before-you-let-the-ai-write-code-316k</link>
      <guid>https://dev.to/derekwang85/the-file-order-is-the-plan-write-the-constraints-before-you-let-the-ai-write-code-316k</guid>
      <description>&lt;p&gt;&lt;em&gt;AI Harness Engineering · Essay Seven · derek wang (derekwang85)&lt;/em&gt;&lt;/p&gt;




&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F0b1tyajcsygforpt0lj6.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F0b1tyajcsygforpt0lj6.jpg" alt=" " width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Dwight Eisenhower said it in a way that outlived every war plan it ever rode along with: &lt;strong&gt;plans are nothing; planning is everything.&lt;/strong&gt; He meant that the document you write before the fight is worth next to nothing — what matters is the disciplined thinking the writing forces on you. AI coding has turned that insight upside down. We hand the model a one-line wish and watch it produce code instantly, skipping the planning and jumping straight to the execution. Then we spend the afternoon arguing with the result.&lt;/p&gt;

&lt;p&gt;The fix isn't a better prompt. It's a correct sequence: &lt;strong&gt;the constraint files come first, the code comes last.&lt;/strong&gt; If the order is right, the AI builds to a blueprint. If it's wrong, the AI improvises while it builds, and every decision it makes is "reasonable" and different from last time.&lt;/p&gt;

&lt;h2&gt;
  
  
  The default is backwards
&lt;/h2&gt;

&lt;p&gt;Almost everyone uses AI coding the same way: open the editor, describe the feature, watch the code pour out, then review and patch. There's nothing wrong with the AI writing code. The problem is the sequencing — you've sent it straight to the chopping and pushed the sharpening (naming boundaries, pinning decisions, installing gates) to later, or never.&lt;/p&gt;

&lt;p&gt;The toolmakers don't rescue you either. Their default interaction is "prompt in, code out," and they never once nudge you to think first. So most projects grow up code-first: fast, and increasingly crooked.&lt;/p&gt;

&lt;p&gt;I learned this one the expensive way. On a trading system, I let the AI start writing immediately, and got the classic trio: the same "order status" named &lt;code&gt;OrderStatus&lt;/code&gt; in one controller, &lt;code&gt;Status&lt;/code&gt; in the next, and a string constant in the third; a &lt;code&gt;quote_id&lt;/code&gt; field in the database today and an invented &lt;code&gt;quoteNo&lt;/code&gt; in the DTO tomorrow, two fields that can't find each other. By the end I spent more time reconciling style and aligning fields than it would have taken to regenerate the whole thing.&lt;/p&gt;

&lt;p&gt;The AI wasn't dumb. I'd never told it what to build first and what to build second, so it guessed. And what an AI guesses is always "looks right, differs from last time."&lt;/p&gt;

&lt;h2&gt;
  
  
  Four phases, code last
&lt;/h2&gt;

&lt;p&gt;So I stopped trying to police what the AI writes and started policing the order in which files come to exist. Call it the project anatomy: a project has a fixed sequence in which its files grow, and the correct order has the code — the actual product — arriving last.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Manifest&lt;/strong&gt; — the pre-execution contract: what, why, how, which files, what counts as done, when to stop.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Spec + ADR&lt;/strong&gt; — pin what you're building and record why, so the decision survives longer than the session.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Gate&lt;/strong&gt; — install the automated check &lt;em&gt;before&lt;/em&gt; the code lands, not after.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Manual + Runbook&lt;/strong&gt; — capture how to operate and how to recover, so the next agent (or human) can pick it up without re-learning.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The counterintuitive part: &lt;strong&gt;not one of these four phases produces a single line of runnable code.&lt;/strong&gt; They're all constraint files. That's the whole distinction between this methodology and "just have the AI write it." Most people see a feature and reach for code. I reach for four files first. Drucker's old split applies: letting the AI write immediately is racing on &lt;em&gt;efficiency&lt;/em&gt; — doing it fast. These four files brake on &lt;em&gt;effectiveness&lt;/em&gt; — making sure it's the right thing being done at all. The files run nothing, but they decide whether what does run was supposed to.&lt;/p&gt;

&lt;h2&gt;
  
  
  The six fields of the manifest
&lt;/h2&gt;

&lt;p&gt;The most valuable and least natural phase is the first. The Pre-Execution Manifest is a thinking-tool with a fixed shape: state, in one line each, WHAT you're changing, WHY, your APPROACH, the exact FILES involved, the objective way to tell SUCCESS, and the STOP conditions that should halt you.&lt;/p&gt;

&lt;p&gt;The point isn't that it reads well. It's that it forces you to settle why, how, and what "done" means &lt;em&gt;before&lt;/em&gt; you spend an hour generating code. The machine writes the code; answering these questions is your job. And the STOP field is the one that earns its keep: naming, up front, the moment you'd want to be consulted is what keeps an autonomous system from becoming a runaway one. Honest caveat — STOP is a soft constraint. It won't stop anyone by itself; that's the gate's job in Phase 3. Its value is moving the braking decision from after-the-regret to before-the-start.&lt;/p&gt;

&lt;h2&gt;
  
  
  The incident: a cache on the wrong side of a rate limit
&lt;/h2&gt;

&lt;p&gt;A scar that proves the sequence. I had an agent add caching to a reporting endpoint. Two minutes, looked perfect. Only at acceptance did we find the endpoint sat behind a rate-limited upstream — the cache was the right thing done in the wrong place. If I'd filled in the manifest first, WHY would have made me write "because the endpoint is slow," and I'd have asked myself: slow because of caching, or because of the upstream throttle? The answer was obvious. A caching job that took two minutes cost me an afternoon, because I'd skipped three minutes of manifest. [ORIGINAL DATA]&lt;/p&gt;

&lt;p&gt;The damage wasn't the bad code. It was the afternoon spent rediscovering a constraint that six fields would have surfaced in under a minute.&lt;/p&gt;

&lt;h2&gt;
  
  
  The plan trap
&lt;/h2&gt;

&lt;p&gt;Fair objection: planning can turn into ritual. Fill six fields, get the AI to nod, then trust the nod as governance — that's the trap. A manifest isn't a protective spell; it's only worth ink if the spec and the gate actually check the work against it. A team that writes beautiful manifests and never wires them to execution has added bureaucracy with nicer formatting. The guard is to connect the paper to the pipeline: if FILES matters, the gate enforces it; if SUCCESS matters, the acceptance criteria test it.&lt;/p&gt;

&lt;p&gt;Here's the test I'd grade myself on: &lt;strong&gt;if you left for a month, would the project hold together by its files alone?&lt;/strong&gt; If not, the missing piece is almost never more code — it's this layer of written intent. The constraint system you build is, in the end, a road you're paving for the next AI and the next person, in an order that lets every later hand see where the boundaries are, why the decisions were made, how to pass the gates, and how to run the thing.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>programming</category>
      <category>productivity</category>
      <category>devops</category>
    </item>
    <item>
      <title>The one law the whole series assumes: an AI that goes down silently is worse than one that's dead</title>
      <dc:creator>DerekWang</dc:creator>
      <pubDate>Wed, 23 Sep 2026 04:23:00 +0000</pubDate>
      <link>https://dev.to/derekwang85/the-one-law-the-whole-series-assumes-an-ai-that-goes-down-silently-is-worse-than-one-thats-dead-3fc7</link>
      <guid>https://dev.to/derekwang85/the-one-law-the-whole-series-assumes-an-ai-that-goes-down-silently-is-worse-than-one-thats-dead-3fc7</guid>
      <description>&lt;p&gt;&lt;em&gt;AI Harness Engineering · Essay Six · derek wang (derekwang85)&lt;/em&gt;&lt;/p&gt;




&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fjjwhu7s5oh7dt6gmrwbm.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fjjwhu7s5oh7dt6gmrwbm.jpg" alt=" " width="800" height="450"&gt;&lt;/a&gt;&lt;br&gt;
The hardest constraint in this whole pyramid isn't strategy, architecture, contracts, or gates. It's the bottom layer, the one nobody admires: what the system does the second the AI genuinely fails. Every commercial aircraft flies two engines not because it needs both to stay airborne, but because aviation law demands it keep climbing, cruising, and landing on one [ORIGINAL DATA]. Engine redundancy and circuit breakers share one idea borrowed from power engineering: when a circuit overloads, you don't black out the building — you trip that one branch and keep the rest alive.&lt;/p&gt;

&lt;p&gt;AI-coding projects need this more than legacy ones, for a brutal reason: &lt;strong&gt;AI dies more cleanly than a human does.&lt;/strong&gt; A tired human slows down, asks for help, leaves a half-finished sentence. An AI stops dead, silently, or pretends it's still fine. The five upper layers govern what the AI produces. This essay is about the layer that governs what survives when the AI produces nothing: resilient implementation. It reduces to four verbs — make it repeat-safe, make it degrade, make it visible, make it recover fast.&lt;/p&gt;
&lt;h2&gt;
  
  
  Make it repeat-safe
&lt;/h2&gt;

&lt;p&gt;For an AI, retrying isn't the exception, it's the default. The network hiccups, the agent can't tell whether its last write landed, so it fires the same request a second time. In a human system a duplicate is a stray log line; in an AI system a duplicate is a second order, a second notification, a second charge. Idempotency is the guarantee that running the same operation twice has exactly the effect of running it once. The test is one question: &lt;em&gt;send the same request twice; did the system do the work twice?&lt;/em&gt; If yes, you don't have idempotency.&lt;/p&gt;

&lt;p&gt;The cheapest fix I ship over and over is database-native. My trading system's UAT seeded test data with hardcoded IDs — &lt;code&gt;orders/1&lt;/code&gt;, &lt;code&gt;kyc/1&lt;/code&gt;, &lt;code&gt;quotes/1&lt;/code&gt; — so every reseed broke every reference and the script died on round one [ORIGINAL DATA]. Switching all seed scripts to an upsert gave me repeatability in exchange for one clause:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;INSERT&lt;/span&gt; &lt;span class="k"&gt;INTO&lt;/span&gt; &lt;span class="n"&gt;orders&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;amount&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;status&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;VALUES&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;?&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="o"&gt;?&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s1"&gt;'pending'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="k"&gt;ON&lt;/span&gt; &lt;span class="n"&gt;DUPLICATE&lt;/span&gt; &lt;span class="k"&gt;KEY&lt;/span&gt; &lt;span class="k"&gt;UPDATE&lt;/span&gt; &lt;span class="n"&gt;status&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;status&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;  &lt;span class="c1"&gt;-- no-op if the row already exists&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now the agent can retry endlessly; the database always ends up with the same data. When the caller can't tell whether its own write succeeded, hand the system an &lt;code&gt;idempotencyKey&lt;/code&gt; and return the first result on every repeated key.&lt;/p&gt;

&lt;h2&gt;
  
  
  Make it degrade
&lt;/h2&gt;

&lt;p&gt;Idempotency handles repeating; degradation handles partial failure. &lt;strong&gt;Degradation means the core stays alive at reduced fidelity instead of the whole thing stopping.&lt;/strong&gt; The user wants "the system is still up"; price precision is a distant second.&lt;/p&gt;

&lt;p&gt;My trading system priced everything off an external exchange-rate feed (call it the NCC feed). FMEA flagged the obvious nightmare: NCC is down, and the quote function dies with it, exposing raw errors to the user [ORIGINAL DATA]. The fix had two parts: keep a cached rate as a fallback, and label it. When the feed is healthy, fetch live and cache a copy in the background; when it dies, serve the stale cache and show "rate data may be delayed." Users keep quoting. System keeps running. Cost: a few seconds of staleness.&lt;/p&gt;

&lt;p&gt;The label is not decoration. &lt;strong&gt;A silent degradation is worse than an error&lt;/strong&gt;, because downstream systems make decisions on garbage and nobody knows. Degradation is only real if the user sees a warning or the monitor gets an alert. Invisible fallback is no fallback.&lt;/p&gt;

&lt;h2&gt;
  
  
  Make it visible
&lt;/h2&gt;

&lt;p&gt;Idempotency and degradation you design; visibility you buy with an incident. One day every worker in my multi-agent swarm died at once. Root cause took hours: each worker's startup script used &lt;code&gt;set -e&lt;/code&gt; — exit on any error — and combined with &lt;code&gt;flock&lt;/code&gt; lock contention, one worker's exit poisoned the lock so every successor failed at boot [ORIGINAL DATA]. Simultaneous death, and because they all failed &lt;em&gt;quietly&lt;/em&gt;, no process screamed.&lt;/p&gt;

&lt;p&gt;Two lessons. Technically: &lt;strong&gt;a daemon's job is to stay alive, not to be strict.&lt;/strong&gt; &lt;code&gt;set -e&lt;/code&gt; belongs to front-of-pipeline scripts where "any failure kills the run" is the goal; a background worker needs explicit error handling — &lt;code&gt;set +e&lt;/code&gt; plus its own recovery path. Cognitively: a silent failure is more expensive than a loud one, because a loud one triggers an alert, a retry, a human. Silence triggers nothing, and the system looks healthy until a user discovers the business has been broken for hours. I added a watchdog that polls process health every five minutes and respawns the dead. Manual restart ran thirty minutes armed; the watchdog recovered everything in under five [ORIGINAL DATA].&lt;/p&gt;

&lt;p&gt;This is the first principle of the implementation layer: &lt;strong&gt;the system may be killed, but it must not be silenced.&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Make it recover fast
&lt;/h2&gt;

&lt;p&gt;The last verb is about the gap between failure and health. A recoverable failure that takes an hour to come back might as well be fatal.&lt;/p&gt;

&lt;p&gt;Real scar: MySQL's Docker container died, the backend fell over, and 14 source files surfaced compiler errors one by one like dominoes — a stale import where a controller was deleted but the service wasn't, a renamed DTO field still referenced, a chain of &lt;code&gt;@ConditionalOnProperty&lt;/code&gt; beans whose conditions depended on each other [ORIGINAL DATA]. No single error was hard. But fourteen of them queued, and hand-walking the pile cost over 45 minutes of recovery [ORIGINAL DATA]. The value wasn't in fixing fewer errors; it was in the interval. A &lt;code&gt;pre-compile-check.sh&lt;/code&gt; gate now runs the whole surface up front and reports the three known families — stale imports, conditional-bean loops, boot smoke test — so the human fixes known types instead of discovering them one 45-minute lap at a time. The same recovery dropped &lt;strong&gt;from 45 minutes to under 5&lt;/strong&gt; [ORIGINAL DATA].&lt;/p&gt;

&lt;p&gt;The bottleneck in recovery is almost never &lt;em&gt;fixing&lt;/em&gt;; it's &lt;em&gt;finding&lt;/em&gt;. The fastest path back is an automated checker that says "it's one of these three families," then a human who does narrow repairs. When the AI is down, your recovery speed is a function of how fast you can &lt;em&gt;locate&lt;/em&gt;, not how well you can &lt;em&gt;patch&lt;/em&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  When enough is enough
&lt;/h2&gt;

&lt;p&gt;The honest counterpoint: all four verbs can be over-applied. A fallback cache for a feature nothing depends on, a watchdog for a single disposable job, an upsert on a log stream that structurally cannot duplicate — ceremony, not resilience. Every safeguard is itself code that can break, and every watchdog needs watching.&lt;/p&gt;

&lt;p&gt;The filter is the same one that runs through this series: &lt;strong&gt;tie every resilience measure to a real failure family.&lt;/strong&gt; The stale-price cache exists because a feed once died. The watchdog exists because a flock once died together. The pre-flight check exists because a cascade once cost the team an afternoon. So the discipline is: &lt;em&gt;if you can't name the past incident that justifies a resilience feature, you don't get to add it yet.&lt;/em&gt; You'll know the real one when it fires. The four verbs are cheap only when they answer a debt you actually owed — and the moment that's true, the business keeps moving precisely because the system was built to be killed, not silenced.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>programming</category>
      <category>productivity</category>
      <category>devops</category>
    </item>
    <item>
      <title>Constraints say how it should be; the gate proves it actually is</title>
      <dc:creator>DerekWang</dc:creator>
      <pubDate>Tue, 22 Sep 2026 04:21:00 +0000</pubDate>
      <link>https://dev.to/derekwang85/constraints-say-how-it-should-be-the-gate-proves-it-actually-is-jio</link>
      <guid>https://dev.to/derekwang85/constraints-say-how-it-should-be-the-gate-proves-it-actually-is-jio</guid>
      <description>&lt;p&gt;&lt;em&gt;AI Harness Engineering · Essay Five · derek wang (derekwang85)&lt;/em&gt;&lt;/p&gt;




&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fhhyhwqay5oglciaz0uga.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fhhyhwqay5oglciaz0uga.jpg" alt=" " width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Deming said something that makes factory owners uncomfortable: &lt;strong&gt;quality cannot be inspected into a product.&lt;/strong&gt; You build quality into the process, not into a final check. He was right — but in the AI era there's a side to it everyone skips. The quality you build into the process still has to be &lt;em&gt;checked&lt;/em&gt; to confirm it actually got built in. Deming was against inspection as the only source of quality. He was never against having a check.&lt;/p&gt;

&lt;p&gt;In an AI codebase, the check matters more than it ever has. Everything before this essay is a constraint: strategy, architecture, contracts. Files that say how things should be. But a file doesn't execute itself. An AI will read it, and it will also quietly drift away from it under pressure and ambiguity. Between "the constraint is written" and "the code actually did that" sits an unguarded canyon. &lt;strong&gt;The gate is the bridge&lt;/strong&gt; — the check that comes before the code is accepted.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why the old gates can't catch AI code
&lt;/h2&gt;

&lt;p&gt;Traditional engineering has gates. CI runs compiles, static analysis, tests. Every mature team has them. But every one of those gates shares an assumption — &lt;strong&gt;that the code was written by a human.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Human code has human fingerprints: it forgets, it gets lazy, but it doesn't &lt;em&gt;confidently fabricate&lt;/em&gt;. AI code is a different animal entirely. Let me put the numbers on it, all from public reporting:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;An analysis of pull requests across 470 GitHub repos found that roughly &lt;strong&gt;1 in 5&lt;/strong&gt; AI code samples referenced a library or API that doesn't exist — not a typo, a straight-faced invention [Report: CodeRabbit analysis of AI code hallucination, 2026 Q1].&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Google's research reported a stark split: AI-generated code hit about &lt;strong&gt;92%&lt;/strong&gt; syntactic validity, but only &lt;strong&gt;78%&lt;/strong&gt; logical correctness, and fell to &lt;strong&gt;54%&lt;/strong&gt; on complex scenarios like concurrency, transactions, and exception branches [Research study: Google on LLM code-generation correctness, 2025].&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The Cloud Security Alliance put the share of AI-generated code that fails basic security scans between &lt;strong&gt;45% and 70%&lt;/strong&gt; [ORIGINAL DATA], while &lt;strong&gt;75%&lt;/strong&gt; [ORIGINAL DATA] of developers in the same window believed AI-written code was safer than their own [Report: CSA on AI coding security, 2026-04].&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Read that closely: &lt;strong&gt;the syntax is almost never the problem, so it passes every old gate. The wrongness lives in the semantics.&lt;/strong&gt; Linting, compiling, and formatting all work at the syntax layer. You're using a spellchecker to catch an essay that argued the wrong point. It checks the typos faithfully and still lets the false argument through.&lt;/p&gt;

&lt;p&gt;My own TradeOMS work hit exactly this. Early CI was green, all tests passed, and AI-sneaked logic errors still made it into the trunk: a null assertion written as a tautology, an exception swallowed into a "success," &lt;code&gt;==&lt;/code&gt; typed as &lt;code&gt;=&lt;/code&gt;. Syntax gates all passed. Every semantic error sailed in.&lt;/p&gt;

&lt;h2&gt;
  
  
  Two words that keep the pyramid honest
&lt;/h2&gt;

&lt;p&gt;Before the mechanism, the distinction, because it holds the whole system together:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;A &lt;strong&gt;constraint&lt;/strong&gt; is text — the file, the spec, the convention. It declares &lt;em&gt;should&lt;/em&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;A &lt;strong&gt;gate&lt;/strong&gt; is execution — the script, the test, the rule. It verifies &lt;em&gt;is&lt;/em&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;A constraint without a gate is a promise nobody checks. A gate without a constraint is a check nobody asked for.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Essay One gave the pyramid: strategy → architecture → contract → &lt;strong&gt;gate layer&lt;/strong&gt; → implementation. Now the gate layer earns its place: &lt;strong&gt;it's the closure. Without it, the four layers above it are paper.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The physical shape in the framework is a real, verifiable structure — a &lt;code&gt;dispatch/&lt;/code&gt; directory holding gate scripts, the full-regression test system, the triple-track ledgers (WBS / Issue / Test Case), and the multi-role swarm for parallel review, with a &lt;code&gt;tests/fulltest-baseline-R1.md&lt;/code&gt; as the regression baseline [ORIGINAL DATA]. The core isn't any one script. It's a discipline: &lt;strong&gt;an AI that changes code cannot pass its own work. It must run a gate it cannot edit.&lt;/strong&gt; The gate is defined by a human, executed by a script, judged by an independent mechanism. That rule matters more than the individual checks, because it names the AI's real weakness: an AI has no self-doubt. It is permanently confident in its own output. Let a non-doubting executor grade its own work and the grade is always a perfect score — which is exactly what "self-review" produces.&lt;/p&gt;

&lt;h2&gt;
  
  
  Five gates grew into a self-growing system
&lt;/h2&gt;

&lt;p&gt;On the coding side, five gates settled in, mirroring the writing side: G1 style, G2 structure, G3 facts, G4 consistency, G5 independent review. Each one blocks a specific failure: AI-flavor style, docs drifting from constraints, invented APIs and invalid assertions, "fix A forgot B" ripples, and self-grading.&lt;/p&gt;

&lt;p&gt;Five gates are a pre-release line. But gates themselves age: rule libraries go stale, the AI finds new workarounds, baselines drift. So the codified version is a six-stage ladder that runs the whole lifecycle — &lt;strong&gt;G0 baseline → G1 compile → G2 three-layer analysis → G3 ripple scan → G4 re-test verify → G5 experience hardening → G6 sign-off release&lt;/strong&gt; — moving from "block bad output" to "a gate system that gets sharper the more you use it" [ORIGINAL DATA].&lt;/p&gt;

&lt;p&gt;Three design principles matter more than the check list itself:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Principle one: a gate must quantify.&lt;/strong&gt; "Code quality should be high" is not a gate. "First-pass rate ≥70%" is [ORIGINAL DATA]. An unquantifiable gate can't regress, can't compare, can't improve. It's not a gate, it's a prayer.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Principle two: a gate runs before acceptance, not during writing.&lt;/strong&gt; Lining every line of code with checks kills output; lining every sentence with checks kills expression. A gate's value is in &lt;em&gt;blocking&lt;/em&gt;, not in &lt;em&gt;coaching&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Principle three: failure needs a return path.&lt;/strong&gt; A gate that fails is a router, not a dead end — G1 failure routes back to rewriting, G3 back to the source-material stage, G4 back to a ripple scan. A gate with no way back just produces the frustration of a stuck submission, and frustration pushes people around the gate.&lt;/p&gt;

&lt;p&gt;The whole point of a gate, in one takeaway line: &lt;strong&gt;check before code, and the error is stopped before it ships instead of after — a constraint writes down how it should be, a gate proves it actually is.&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  The cost ledger
&lt;/h2&gt;

&lt;p&gt;The first question is always money: won't more gates slow development down?&lt;/p&gt;

&lt;p&gt;Measured against the alternative, no. Full CI time for the five-gate suite runs in minutes; a single cross-module human review runs in hours [ORIGINAL DATA]. That's the economics in its simplest form — the check is a script's job, and a human only reviews what the script can't decide.&lt;/p&gt;

&lt;p&gt;The other ledger is rework. CodeRabbit's 2026 Q1 study of 470 GitHub repos put AI co-authored code's bug rate at roughly &lt;strong&gt;1.7×&lt;/strong&gt; the human baseline, averaging &lt;strong&gt;10.83&lt;/strong&gt; issues per AI segment versus &lt;strong&gt;6.45&lt;/strong&gt; for human-written code [Report: CodeRabbit on AI bug-rate, 2026 Q1]. GitHub disclosed that about &lt;strong&gt;46%&lt;/strong&gt; of submissions from the average Copilot user is AI-generated, and &lt;strong&gt;61%&lt;/strong&gt; for Java developers [Origin: GitHub public disclosure]. The more an AI writes, the more semantic risk there is. Gate money isn't spent on "a few extra seconds." It's spent on converting hours of human triage into minutes of automatic interception.&lt;/p&gt;

&lt;h3&gt;
  
  
  The honest counter-side
&lt;/h3&gt;

&lt;p&gt;I have to give the critic their due, because gates aren't free, and over-gating is a real failure. Rules that are too rigid flag normal AI output as violations and push the model into filling-checkbox theatrics that lower quality. Pile every gate into a single pre-commit and one submission takes fifteen minutes, so developers find a shortcut around it — and the gate system quietly stops existing. Correct every function's try-catch, enforce a norm on every comment, and the code is "clean" and pointless.&lt;/p&gt;

&lt;p&gt;All three objections hold. So the real difficulty isn't "add how many" — it's "don't overdo it." Two countermeasures: &lt;strong&gt;gate tiering&lt;/strong&gt; — only true constraints (architecture, contracts, security red-lines) get hard gates, everything else gets a soft hint, and the fewer hard gates the fewer false positives and fewer reasons to route around them; and &lt;strong&gt;self-growing gates&lt;/strong&gt; — the rule library records failure modes, baselines stay adjustable, false positives can be appealed. A gate isn't a verdict; it's an instrument that gets sharper.&lt;/p&gt;

&lt;p&gt;One sentence for the whole counter-side: no gate, and semantic errors leak into the trunk; too heavy a gate, and the product is strangled by rules. Health lives between the two — &lt;strong&gt;block the semantic errors, let the normal work through.&lt;/strong&gt;&lt;/p&gt;




&lt;p&gt;A side note: the same discipline runs in my knowledge base, derekinside. Every piece of knowledge passes an ingestion check before it's admitted — chunk format, entity-relation validity, conflict with existing knowledge. Knowledge isn't "recorded, therefore counted." It's "checked, therefore counted." That's the same law as code gates: &lt;strong&gt;the entrance can be loose, the exit must have a gate.&lt;/strong&gt; A knowledge base isn't kept clean by writing carefully; it's kept clean by checking before admission — exactly as AI code isn't kept reliable by generating carefully, but by checking before merge.&lt;/p&gt;

&lt;p&gt;Deming's line, translated for the AI era, reads like this: &lt;strong&gt;quality isn't inspected into a product — but quality without a check is only claimed.&lt;/strong&gt; Writing the constraint is the first step. Making the constraint execute is the second, and the gate &lt;em&gt;is&lt;/em&gt; the second step. It's what turns "we followed the rules" from something we say into something that's a fact.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>programming</category>
      <category>productivity</category>
      <category>devops</category>
    </item>
    <item>
      <title>An AI builds to the contract it can read, not the one you meant</title>
      <dc:creator>DerekWang</dc:creator>
      <pubDate>Mon, 21 Sep 2026 04:12:00 +0000</pubDate>
      <link>https://dev.to/derekwang85/an-ai-builds-to-the-contract-it-can-read-not-the-one-you-meant-3dgl</link>
      <guid>https://dev.to/derekwang85/an-ai-builds-to-the-contract-it-can-read-not-the-one-you-meant-3dgl</guid>
      <description>&lt;p&gt;&lt;em&gt;AI Harness Engineering · Essay Four · derek wang (derekwang85)&lt;/em&gt;&lt;/p&gt;




&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F8cl0uyr0aushv45jbk8c.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F8cl0uyr0aushv45jbk8c.jpg" alt=" " width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;A century before anyone called it that, Frederick Taylor walked into a machine shop and proved something that still holds: you don't add a new skill by telling workers to be smarter. You write down how the job is done, so anyone — even someone who never met the old master — can reproduce it. Henry Ford turned the same idea into a line where there were no masters at all, only written procedures. Hand work became standard work, and output jumped by an order of magnitude. Taylor invented nothing. He only proved that writing the &lt;em&gt;how&lt;/em&gt; down is itself the productivity.&lt;/p&gt;

&lt;p&gt;AI coding restates that lesson with a sharper edge. The model you hand a task to never asks what you actually meant. Tell it "add a timeout to this interface" and it won't ask whether you mean a connect timeout or a read timeout — it will pick one, assume it's right, and write the code with total confidence. The problem isn't that it picks wrong; people do that too. The problem is &lt;em&gt;how&lt;/em&gt; it picks wrong: &lt;strong&gt;it doesn't believe it's guessing. It believes it's executing.&lt;/strong&gt; So if the "how" lives only in the chat, the AI builds to impression and ships whatever impression it had when the cursor closed.&lt;/p&gt;

&lt;p&gt;This essay is about the contract layer of the pyramid — the level where intent gets pinned into a file. The last essay covered decisions: &lt;em&gt;why&lt;/em&gt; it is this way. This one is about &lt;em&gt;how&lt;/em&gt;, and how to make "how" something the model reads as law rather than as a hint.&lt;/p&gt;




&lt;h2&gt;
  
  
  Change one field, break nineteen places
&lt;/h2&gt;

&lt;p&gt;TradeOMS has a core data-processing module, call it CDP, that everything else calls into. It hit the exact failure this essay is about. The backend switched the JSON property name on a response field with &lt;code&gt;@JsonProperty("items")&lt;/code&gt;. Harmless on its own. But the response contract was never written down — it existed as an oral agreement in the chat where the change was discussed.&lt;/p&gt;

&lt;p&gt;What the chat forgot to tell anyone was that the frontend and &lt;strong&gt;19 test files&lt;/strong&gt; were all reading &lt;code&gt;data.content&lt;/code&gt; [ORIGINAL DATA]. Backend now emits &lt;code&gt;items&lt;/code&gt;; the tests and UI still ask for &lt;code&gt;content&lt;/code&gt;. One field rename, nineteen breakages, and nobody knew until a ripple scan surfaced them all at once [ORIGINAL DATA].&lt;/p&gt;

&lt;p&gt;In a human team, that's just "the interface drifted." The engineer who renamed the field at least remembers they changed it, so the old name sets off alarm bells next time. An AI has no such memory. The model that renamed the field was only following an instruction — nothing in its context warned it that the frontend still expected the old name. There's no "I've been here before" reflex. It just executes.&lt;/p&gt;

&lt;p&gt;The second, worse kind of failure came from the same root. A ripple scan across &lt;strong&gt;218 frontend API call sites&lt;/strong&gt; turned up &lt;strong&gt;22 backend endpoints quietly returning HTTP 500&lt;/strong&gt; [ORIGINAL DATA]. The controller signatures had changed; the frontend had never caught up. Twenty-two dead routes, and not one human or model knew — until the scan dug them out. Not the "known unknown" of a bug on your list. These were &lt;strong&gt;unknown unknowns&lt;/strong&gt;: you can't even ask the question "is this broken?" because you don't know the break exists. A human review can only ask "is what I'm looking at right?" It can't ask "is what I'm &lt;em&gt;not&lt;/em&gt; looking at broken?" A system with no written contract has no way to hear its own silent deaths.&lt;/p&gt;

&lt;p&gt;Both incidents share one root: between the frontend and backend, between code and tests, there was &lt;strong&gt;a verbal agreement but no written contract&lt;/strong&gt;. A verbal agreement is carried by whoever remembers it. A written contract is verified by the file. In an AI project, the thing people can't remember, the AI remembers even less.&lt;/p&gt;

&lt;h2&gt;
  
  
  Hammurabi carved the first contract layer
&lt;/h2&gt;

&lt;p&gt;The oldest fix for this is so old it predates engineering. In roughly &lt;strong&gt;1754 BCE&lt;/strong&gt;, King Hammurabi had the entire body of law carved onto a stone stele and set it in a public square [ORIGINAL DATA]. Why would a king do that? Because unwritten rules aren't rules — they're whatever the next person decides they are. Written down and put where everyone reads it before acting, the drift stops. Everyone answers to the same carved text.&lt;/p&gt;

&lt;p&gt;That is literally what a contract does for an AI codebase. It's the Code of Hammurabi for your constraints — written, public, impossible to "forget," and readable by every model that opens the repo.&lt;/p&gt;

&lt;h2&gt;
  
  
  The spec contract: three fields that bind
&lt;/h2&gt;

&lt;p&gt;The first kind of contract is a spec. Not a description — a contract. A description may be vague; a contract cannot be. The minimum spec binds three things, and if any one is missing, the AI fills the gap with its own "common sense":&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Scope&lt;/strong&gt; — what's in, and just as clearly what's out. An AI that doesn't know what it's &lt;em&gt;not&lt;/em&gt; building will cheerfully "optimize" the neighboring module it thinks you meant.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Assumptions&lt;/strong&gt; — what the system takes for granted. This is the easiest field to skip and the one that costs the most. My older cache incident is exactly this: a rate-limited endpoint was slow, no assumption recorded that the slowness was upstream throttling, so the model concluded "slow = add a cache." Missing one assumption, wrong fix. The AI's "common sense" comes from the internet, not from your business.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Acceptance&lt;/strong&gt; — the objective test that decides "done." No acceptance criteria, and you can't say the work is right or wrong; you can only feel about it. Feeling is the most expensive way to accept work in an AI project.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The spec's whole value is that it moves "how" from an agreement in a conversation to a contract in a file. Conversations drift; contracts don't. The next session opens the repo and reads scope, assumptions, and acceptance in black and white, not the muddy impression of last round's chat.&lt;/p&gt;

&lt;h2&gt;
  
  
  Data contracts: the signature is the boundary
&lt;/h2&gt;

&lt;p&gt;The second kind of contract — and the most physical — is the data contract: interface signatures, DTO shapes, field names. This is the closest thing the constraint system has to a law of physics, because it can be verified at compile or run time with no judgment required. In TradeOMS this lives as a real directory, &lt;code&gt;docs/15-api-contracts&lt;/code&gt;, where every route's request/response signature sits in a file the AI isn't permitted to modify [ORIGINAL DATA]. It's a Level 1 hard constraint — touched or not, no negotiation.&lt;/p&gt;

&lt;p&gt;Files alone aren't a defense, though. The defense is a contract that checks itself. After the 22 dead endpoints, TradeOMS built a route gate, &lt;code&gt;check-api-route-consistency.py&lt;/code&gt;, that automatically verifies every frontend API path and field against the backend implementation and blocks on any mismatch [ORIGINAL DATA]. The results tell the whole story in a curve:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;First run: &lt;strong&gt;233 mismatches&lt;/strong&gt; between what the frontend called and what the backend exposed [ORIGINAL DATA].&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Mid-repair, the count &lt;strong&gt;rose to 370&lt;/strong&gt; — because the gate was now exposing problems nobody had seen, not hiding them [ORIGINAL DATA].&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;End state: &lt;strong&gt;zero&lt;/strong&gt; [ORIGINAL DATA].&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That 233 → 370 → 0 shape is the honest argument for the gate. The problems weren't absent before; they were invisible. Nobody could have listed "here are 22 broken routes," because they didn't exist as known items. A data contract is the first thing that makes the invisible surface speak: it matches or it doesn't, and there is no gray. For an AI, that's decisive, because the AI's specialty is producing errors that &lt;em&gt;look&lt;/em&gt; right, and a signature check is the least flattering referee in the world — right or wrong, no benefit of the doubt.&lt;/p&gt;

&lt;p&gt;There's a management aphorism people reach for whenever someone wants more metrics: you can only steer what you actually count. In AI coding it reads more sharply backwards — &lt;strong&gt;you can only manage an interface that can be measured.&lt;/strong&gt; You can't review a surface you can only feel; you can check a contract file. That's also why the data contract is Level 1, untouchable — the moment it becomes negotiable, it's back to a verbal agreement.&lt;/p&gt;

&lt;h2&gt;
  
  
  FMEA: price the ways it can break
&lt;/h2&gt;

&lt;p&gt;The third, most overlooked contract form is a risk audit inside the spec itself: FMEA, &lt;em&gt;Failure Mode and Effects Analysis&lt;/em&gt;. It's simple. While you write the spec, list every way a feature could fail, then score each on three axes — &lt;strong&gt;severity&lt;/strong&gt; of business impact, &lt;strong&gt;likelihood&lt;/strong&gt; of occurrence, and &lt;strong&gt;detectability&lt;/strong&gt; by your current gates. Multiply the three to get an &lt;strong&gt;RPN&lt;/strong&gt;, and force a countermeasure on anything over your threshold, usually &lt;strong&gt;RPN 100&lt;/strong&gt; [ORIGINAL DATA].&lt;/p&gt;

&lt;p&gt;Across TradeOMS's &lt;strong&gt;24 specs&lt;/strong&gt;, FMEA surfaced &lt;strong&gt;more than 40&lt;/strong&gt; failure scenarios, and every one above RPN 100 got a real countermeasure [ORIGINAL DATA]:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;KYC&lt;/strong&gt;, RPN &lt;strong&gt;392&lt;/strong&gt; — unauthorized client viewing authorized-client data; countermeasure, permission annotation plus a permission gate [ORIGINAL DATA].&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Quote&lt;/strong&gt;, RPN &lt;strong&gt;294&lt;/strong&gt; — external rate source failing and surfacing raw error; countermeasure, fallback rate cache with a graceful-degradation notice [ORIGINAL DATA].&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Order&lt;/strong&gt;, RPN &lt;strong&gt;210&lt;/strong&gt; — concurrent edits to the same order; countermeasure, optimistic locking [ORIGINAL DATA].&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;FMEA's worth isn't the table; it's that it changes where test cases come from. Before, tests were brainstormed — "what should I cover?" Now they're FMEA-driven: every high-RPN mode maps to a test case, a gate, and an SOP. The spec stops saying "what I want" and starts saying "what I'm afraid of and how I defend it." Write the fear down, and the AI knows which boundaries are forbidden.&lt;/p&gt;

&lt;h2&gt;
  
  
  Three powers: check the checkers
&lt;/h2&gt;

&lt;p&gt;A contract is only as trustworthy as whoever verifies it. In the derekcoding methodology this is the triple-track discipline — three ledgers that lock each other together: a &lt;strong&gt;WBS&lt;/strong&gt; for what to build, an &lt;strong&gt;Issue Log&lt;/strong&gt; for what's broken (each with a regression link), and a &lt;strong&gt;Test Case&lt;/strong&gt; ledger with &lt;strong&gt;374 cases&lt;/strong&gt;, each one recording whether the test actually ran or just claims PASS [ORIGINAL DATA].&lt;/p&gt;

&lt;p&gt;The sharpest rule is separation of powers: &lt;strong&gt;the reporter, the fixer, and the verifier must not be the same person&lt;/strong&gt; — or the same agent. It's the legal principle that a court that files the case can't also judge it. When one agent writes the code, accepts its own work, and stamps PASS, the contract has silently stopped existing. The evidence was already in the numbers: 82 submissions passed, and &lt;strong&gt;46&lt;/strong&gt; of them contained no code change at all — pure "I say I'm done" with nothing behind it [ORIGINAL DATA]. That's what happens when the referee and the player are the same agent.&lt;/p&gt;

&lt;p&gt;Triple-track's point is to make "is this actually done" an auditable fact rather than an asserted state. A contract exists to keep "I claim it's done" and "the evidence proves it's done" as two different things.&lt;/p&gt;




&lt;p&gt;A side note for context: the same contract instinct shows up outside code. My local knowledge base, derekinside, has a chunk-split contract and explicit rules for how entities relate — its own "data contract" for knowledge. Without that split rule, ingested knowledge collides into a tangle; with it, knowledge retrieves, links, and evolves reliably. The contract layer is where "stable" comes from in any system — code or knowledge.&lt;/p&gt;

&lt;p&gt;And the checklist that matters, if you want this today, is short. Next time you hand a model a task, write a three-line spec with scope, assumptions, and acceptance. Pick one shared interface and pin its signature to a file the model isn't allowed to touch. Add one automated gate that compares the frontend's calls to the backend's implementation. Run one FMEA pass and force a fix on your highest RPN. And separate the writer from the verifier, even informally.&lt;/p&gt;

&lt;p&gt;Do half of that and your AI stops building to impression and starts building to contract. Taylor's lost sentence is the one AI makes urgent: a contract isn't there to limit the AI. It's there to &lt;em&gt;protect&lt;/em&gt; it — because an AI that never has to guess is the only kind you can trust.&lt;/p&gt;

&lt;p&gt;Tomorrow we drop one layer down to the gates that refuse to let bad work in: &lt;em&gt;let checks precede code.&lt;/em&gt; The contract says how it should be; the gate is what makes "should" actually happen.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>programming</category>
      <category>productivity</category>
      <category>devops</category>
    </item>
    <item>
      <title>A decision you didn't write down isn't a decision</title>
      <dc:creator>DerekWang</dc:creator>
      <pubDate>Sun, 20 Sep 2026 04:09:00 +0000</pubDate>
      <link>https://dev.to/derekwang85/a-decision-you-didnt-write-down-isnt-a-decision-16bc</link>
      <guid>https://dev.to/derekwang85/a-decision-you-didnt-write-down-isnt-a-decision-16bc</guid>
      <description>&lt;p&gt;&lt;em&gt;AI Harness Engineering · Essay Three · derek wang (derekwang85)&lt;/em&gt;&lt;/p&gt;




&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fobnojlhtbrfwlctxd4qu.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fobnojlhtbrfwlctxd4qu.jpg" alt=" " width="800" height="450"&gt;&lt;/a&gt;&lt;br&gt;
The most expensive failure in AI coding isn't a wrong decision. It's a decision that was made, then forgotten, then quietly unmade by the next generation. Here's the raw version of that law: &lt;strong&gt;a decision that lives only in conversation does not persist.&lt;/strong&gt; It evaporates the moment the context window closes. If making it stick matters at all, it has to leave the chat and land in a file every session reads.&lt;/p&gt;

&lt;p&gt;That file is the architecture layer of the pyramid — the ADR set. In Essay One I gave you the skeleton; in Essay Two the top. This essay is the layer that stops the drift no one notices until it's cost a week.&lt;/p&gt;

&lt;h2&gt;
  
  
  The decision that survived a lunch break
&lt;/h2&gt;

&lt;p&gt;I've lived the failure too many times to count. You and an agent go forty exchanges deep and finally converge: "OK, hexagonal pattern, the domain layer never touches the database directly. Locking that in." It is, in fact, locked in — as chat history. Locked in about as securely as a candle against a hurricane.&lt;/p&gt;

&lt;p&gt;Next session opens fresh. The model regenerates, nothing tells it the hexagon was decided, so it wires the domain layer straight to a repository. Nobody spots it until the deviation has spread across twenty files. By then the &lt;em&gt;why&lt;/em&gt; is gone — the reasoning that justified the pattern is buried in a conversation nobody will scroll back through.&lt;/p&gt;

&lt;p&gt;What you're really watching is this: a conversation is not a contract. It's a one-time instruction stream — no history, no archive, no power to bind the next session. A decision that stays in the chat thread is as good as undecided. Only a decision that lands in a file anyone — especially any future model — must read is actually in force.&lt;/p&gt;

&lt;h2&gt;
  
  
  Three kinds of rot, one hole
&lt;/h2&gt;

&lt;p&gt;When decisions have nowhere to live, three distinct failures follow, and I've seen all three in real projects:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Memory drift.&lt;/strong&gt; The humans remember a decision; the AI doesn't, because the decision was never written where the model could read it. So every regeneration quietly re-argues a question you thought was settled.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Architecture drift.&lt;/strong&gt; Each generation makes a small, innocent-looking deviation from the design. Twenty regenerations later the code sits half a project away from intent, and no single change is identifiable as the point of failure. The boundary didn't vanish — it just stopped being pinned and started being random.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Repeated-argument drift.&lt;/strong&gt; Because nothing is recorded, the same debate happens again with every new face and every new agent. Sometimes the same team talks itself into a different answer than it landed on last time — deciding against its own past decision.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;All three share a single root cause: &lt;strong&gt;there is no authoritative place where "we chose X, and here's why" lives.&lt;/strong&gt; Close that hole and all three lose their fuel at once.&lt;/p&gt;

&lt;h2&gt;
  
  
  The single source of truth, pointed at the model
&lt;/h2&gt;

&lt;p&gt;The fix has a name engineering has trusted for decades: the &lt;em&gt;single source of truth&lt;/em&gt;. One decision, one authoritative home, everything else derives from it or cites it. In the AI era this stops being good hygiene and becomes load-bearing — because the thing reading your files is a literal-minded repeater. A human engineer reading a sparse architecture note fills in the gaps with judgment and context. A model doesn't. If the file doesn't say "don't touch this," then to the model, touching it is allowed. You can't rely on the reader's discretion; the file has to pin the boundary by itself.&lt;/p&gt;

&lt;p&gt;That's exactly what an ADR — an architecture decision record — is: a written choice, kept once, that acts as the judge for disputes rather than a note for readers. AI coding makes it indispensable precisely because the previous failure modes are invisible until too late.&lt;/p&gt;

&lt;h2&gt;
  
  
  The seven fields that make a record hold
&lt;/h2&gt;

&lt;p&gt;You don't need a thesis. A workable ADR is a short card holding everything a future engineer — or future model — must know without re-litigating the question:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Status&lt;/strong&gt; — proposed, accepted, superseded, deprecated. Never blank; a decision that can't be marked superseded will be silently ignored.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Decision-maker&lt;/strong&gt; — who owned it. Even a record of "delegated to the agent" counts.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Context&lt;/strong&gt; — the situation that forced the choice.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Decision&lt;/strong&gt; — the choice itself, stated without hedging.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Rationale&lt;/strong&gt; — why this beats the alternatives.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Consequences&lt;/strong&gt; — what it costs, now and later.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Mitigation&lt;/strong&gt; — what you'll do when those costs show up.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Set that way, the ADR is a self-contained slice of history. The next session reads &lt;em&gt;decision plus rationale&lt;/em&gt; and understands not just what was chosen but why — so it doesn't silently reopen it. In my methodology project, ADR-0003 does this for the rule system itself: it records how the constitution gets amended, proving the AR format can govern even the rules that govern the project. The counts are real at the actual scale I work at, measured from my methodology repo's &lt;code&gt;adr/&lt;/code&gt; directories: TradeOMS holds 20 ADRs pinning trade-domain rules agents must not improvise past [ORIGINAL DATA], and SmartQuant opened with 11 the day it started, recording architecture as it stood up rather than after the fact [ORIGINAL DATA]. The point isn't volume; it's that every directional choice has a paper trail.&lt;/p&gt;

&lt;h2&gt;
  
  
  The loop comes back as Swarm-Fed ADR
&lt;/h2&gt;

&lt;p&gt;Here's the AI-era twist that turns ADRs from a top-down cage into a learning record. A &lt;strong&gt;Swarm-Fed ADR&lt;/strong&gt; is written &lt;em&gt;by&lt;/em&gt; the working swarm: when a group of agents resolves an edge case during delivery — a decision reached across models and roles, each attacking it from a different angle — that resolution gets promoted into a formal ADR and fed back into the single source of truth. The choice made in the heat of the job becomes a rule the next generation obeys. This is the return channel from Essay One made concrete: the architecture layer constrains from the top, but it also accumulates what the system learns from below. Decisions stop being ivory-tower declarations and become a living sediment of resolved problems.&lt;/p&gt;

&lt;h2&gt;
  
  
  Written is not enforced
&lt;/h2&gt;

&lt;p&gt;The objection worth taking seriously: an ADR nobody maps back to the code is a diary with nice formatting. I've watched teams file fifty ADRs in a quarter and still drift, because the records were approved and then ignored — never wired to a gate, never surfaced to the AI, read only at the retrospective.&lt;/p&gt;

&lt;p&gt;Records are inert without enforcement. An ADR binds only when something checks whether the code follows it. A Swarm-Fed ADR binds only when retrieval actually surfaces it before the next generation. And the riskiest habit in AI coding isn't changing a rule — it's changing it for no recorded reason, so a future model reads an un-sourced edit the way it reads an un-sourced comment: as permission. So the habit to build is the counterintuitive one: &lt;strong&gt;before you move a boundary, write the ADR.&lt;/strong&gt; It looks like an extra step. It's actually the thing that makes the change legitimate. Write it down in the moment, and you give every future conversation a coordinate origin that never disappears.&lt;/p&gt;

&lt;p&gt;Tomorrow, one layer down: the contract layer — how you take a spec and make an AI promise, and prove it kept the promise.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>programming</category>
      <category>productivity</category>
      <category>devops</category>
    </item>
    <item>
      <title>A constitution is a behavior contract, not a description</title>
      <dc:creator>DerekWang</dc:creator>
      <pubDate>Sat, 19 Sep 2026 04:05:00 +0000</pubDate>
      <link>https://dev.to/derekwang85/a-constitution-is-a-behavior-contract-not-a-description-3e43</link>
      <guid>https://dev.to/derekwang85/a-constitution-is-a-behavior-contract-not-a-description-3e43</guid>
      <description>&lt;p&gt;&lt;em&gt;AI Harness Engineering · Essay Two · derek wang (derekwang85)&lt;/em&gt;&lt;/p&gt;




&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F12ho7s5xqs2eckrewwbz.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2F12ho7s5xqs2eckrewwbz.jpg" alt=" " width="800" height="450"&gt;&lt;/a&gt;&lt;br&gt;
Before you tell an AI &lt;em&gt;what to build&lt;/em&gt;, you have to tell it &lt;em&gt;who it is, where its lines are, and how it's allowed to work&lt;/em&gt;. Get that wrong first, and no amount of clever prompting downstream will save you. This essay builds the top layer of the constraint pyramid: the strategy charter — the one file that decides whether your AI is doing the right thing at all.&lt;/p&gt;

&lt;h2&gt;
  
  
  The one file that sets the coordinate system
&lt;/h2&gt;

&lt;p&gt;A prompt tells the model a task. A constitution tells it who it is. For an AI-governed project, the constitution is a behavior contract every participant — human and model — must load before starting work. It answers three questions:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Who are we?&lt;/strong&gt; One line that pins the project's essence. In one of my projects the charter's first sentence is "a general-purpose coding-engineering methodology and multi-agent orchestration system." In another it's "a futures-and-physical trading management system, Vue 3 front end, Java 17 + MySQL 8." The sentence matters less for its content than for being the first thing the model reads — it sets the whole coordinate system for everything the model generates after.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Where are the boundaries?&lt;/strong&gt; What you refuse to do matters more than what you do. A clear "not accepted here" list — which stacks we won't touch, what directions we won't expand, what quality bar we won't let through — keeps the model from drifting down any direction that merely sounds reasonable.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;How do we work together?&lt;/strong&gt; The rules between humans and the AI: which processes are mandatory, what the model may not touch, and how the two sides hand work to each other.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;If these three aren't settled in a file the model reads before it starts, your AI is improvising against a void. If they are, one file is enough — no pile of READMEs can make up for a charter that never asked who it was.&lt;/p&gt;

&lt;h2&gt;
  
  
  Code rules tame the output. Behavior rules tame the producer.
&lt;/h2&gt;

&lt;p&gt;Teams usually reach for code conventions first — naming, layering, interfaces. Those govern the &lt;em&gt;artifact&lt;/em&gt;. They don't touch how the model &lt;em&gt;behaves&lt;/em&gt; before it writes anything: how it checks, how it verifies, how it owns mistakes. That's where the accidents actually live, so this is where I spent my hardest-won rules.&lt;/p&gt;

&lt;p&gt;The behavior layer in my methodology project is written as a list of ten rules, and none of them is about syntax:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Read, then write.&lt;/strong&gt; Never edit a file from memory.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;State your assumptions.&lt;/strong&gt; Every uncertain design call carries its assumption and reasoning out loud.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Check the ripple.&lt;/strong&gt; Before changing A, look at B, C, D for damage.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Scalpel edits.&lt;/strong&gt; Smallest possible diff; never touch unrelated files "while I'm here."&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Verify first.&lt;/strong&gt; Fix a bug by writing a failing test, watch it fail, then fix.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;One responsibility.&lt;/strong&gt; A function does one thing; mixed concerns breed "fix one, break three."&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Trust the disk, not memory.&lt;/strong&gt; Code state comes from the files on disk, never from what the conversation remembers. This one cost me real time: an agent once insisted a file was an old version because that's what the chat memory held, while the file on disk had long since changed.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Fail safe.&lt;/strong&gt; On error, land in a safe state; refuse beats allow; degrade visibly, never silently.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Write the lesson back.&lt;/strong&gt; After a fix, record it; a knowledge base that doesn't grow decays.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Three strikes, replace the tool.&lt;/strong&gt; When the same kind of failure happens a third time, change the tooling — don't write a fourth patch.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;None of these depend on a specific model or framework. Whatever agent you use, have it read the list before it works, and it's money in the bank.&lt;/p&gt;

&lt;h2&gt;
  
  
  The clause only the AI era needs: anti-sycophancy
&lt;/h2&gt;

&lt;p&gt;A human organization has no equivalent for this one, because it polices a defect human teammates eventually get called out on and a model never does. A language model is a probability machine that leans toward whatever keeps the conversation comfortable — a plausible answer instead of a checked one, "good idea" instead of a challenge, "you're right" when it has no evidence. It has no shame, so it can run flattery to perfection. Left alone, it will cheerfully build you a confident wrong thing.&lt;/p&gt;

&lt;p&gt;The charter answers this with a written clause. The model asks itself three questions before it outputs: &lt;em&gt;Am I giving up my position to keep the conversation pleasant? Am I conceding a point without asking for evidence? Is this answer too smooth, too eager to please?&lt;/em&gt; If so, it strips the polish, or writes "I don't know." There are hard companion rules: accuracy beats pleasing, so no "great question!" or "happy to help!" — help directly, answer directly, disagree directly; and when uncertain, say so in the first sentence, no preamble.&lt;/p&gt;

&lt;p&gt;Paired with it is the confidence label. On anything that matters, the model tags every core claim — &lt;code&gt;[HIGH]&lt;/code&gt; (mapped in my methodology's data contract to ≥80% confidence [ORIGINAL DATA]), &lt;code&gt;[MED]&lt;/code&gt;, &lt;code&gt;[LOW]&lt;/code&gt;, &lt;code&gt;[GUESS]&lt;/code&gt;. This is the clever part: it forces a model &lt;em&gt;not to hide its quantitative nature to seem human&lt;/em&gt;. A human expert rarely labels their own certainty because their track record backs them; an AI has no track record, so the label is the only honest evidence of trust. The moment it has to stamp a claim &lt;code&gt;[GUESS]&lt;/code&gt;, it can't counterfeit certainty anymore. That's the one thing agentic AI quietly tries to take from you — the ability to know how much to trust the output — handed back.&lt;/p&gt;

&lt;h2&gt;
  
  
  One idea, two instances
&lt;/h2&gt;

&lt;p&gt;The same pattern shows up across my projects in two shapes, which conveniently demonstrates the "names vary, layers hold" point from Essay One:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Project&lt;/th&gt;
&lt;th&gt;Charter file&lt;/th&gt;
&lt;th&gt;Shape&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;The methodology framework&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;constitution/&lt;/code&gt; five-piece set&lt;/td&gt;
&lt;td&gt;pre-execution manifest, coding standards, behavior commandments, cognitive discipline — deliberately framework-agnostic&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;The trading system&lt;/td&gt;
&lt;td&gt;&lt;code&gt;CONSTITUTION.md&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;a single file that funnels AGENTS.md + SOUL.md + rule files; written tight because money is at stake&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Both obey one hard priority that keeps the top layer honest: &lt;strong&gt;charter &amp;gt; any agent's own AGENTS.md &amp;gt; skill docs.&lt;/strong&gt; If an agent's self-rules could override the charter, the charter is wastepaper. The charter has to be the first file every agent is forced to load. The complexity of the charter should match the complexity of the collaboration — one focused file for a solo project, separated behavior-and-cognition files for a multi-agent team, framework-neutral for a methodology meant to be reused. Thicker is not better.&lt;/p&gt;

&lt;h2&gt;
  
  
  A living document, or nothing
&lt;/h2&gt;

&lt;p&gt;A charter that never changes is a gravestone. Once the team treats it as finished, the model outgrows it, the business moves past it, and the file becomes a museum piece people nod at and ignore.&lt;/p&gt;

&lt;p&gt;What keeps it honest is the same thing that keeps any contract honest: make change visible and cheap. Every amendment goes through the repo like any other change — a diff, a review, a record. In my methodology project the amendment path itself is pinned by an architecture decision record (ADR-0003), which records &lt;em&gt;why&lt;/em&gt; the constitution exists and how it gets changed — so revision is a documented motion, not a political fight. When I moved the rule system from one-way top-down to bidirectional feedback, I wrote the ADR first, then rewrote the charter. You don't just change a rule; you file the decision and propagate the change everywhere it touches — behaving, in that sense, like a responsible person who owns the results of their own change. A constitution that can't be amended dies; one that can stays in the present tense.&lt;/p&gt;

&lt;h2&gt;
  
  
  The honest limit
&lt;/h2&gt;

&lt;p&gt;Let me steelman the skeptic. A team writes a beautiful long charter, the AI nods along, and everyone treats the file as protection. It becomes an amulet.&lt;/p&gt;

&lt;p&gt;The truth: a constitution is worthless until it's wired to the layers beneath it. The confidence markers only bind if the gates check for them. The boundaries only hold if the contracts and gates enforce them. That's why it's a &lt;em&gt;pyramid&lt;/em&gt; — a charter floating above nothing is a politely worded wish. And a charter you write but never revise is worse than none: the model reads it as a suggestion, not a contract. A charter isn't written into existence. It grows — you fall in a hole, you add a rule; you find a rule gone dead, you amend it. The apex stands, or nothing below it does.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>programming</category>
      <category>javascript</category>
      <category>devops</category>
    </item>
    <item>
      <title>The system lives in your files, not your prompts</title>
      <dc:creator>DerekWang</dc:creator>
      <pubDate>Wed, 16 Sep 2026 23:58:36 +0000</pubDate>
      <link>https://dev.to/derekwang85/the-system-lives-in-your-files-not-your-prompts-111k</link>
      <guid>https://dev.to/derekwang85/the-system-lives-in-your-files-not-your-prompts-111k</guid>
      <description>&lt;p&gt;&lt;em&gt;AI Harness Engineering · Essay One · derek wang (derekwang85)&lt;/em&gt;&lt;/p&gt;




&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fxzwfe25cfzu2orfi9ajq.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fxzwfe25cfzu2orfi9ajq.jpg" alt=" " width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Ask a senior engineer where "the system" lives and they'll point at the code, or the org chart. After shipping enough AI-governed projects, I'd point somewhere else: &lt;strong&gt;the system lives in the files that fence in what a model is allowed to generate.&lt;/strong&gt; The longer I watch teams steer language models, the surer I am that the difference between a project that drifts and one that holds a line is decided here, in a file the model reads before it writes anything.&lt;/p&gt;

&lt;p&gt;This is the first layer of the idea I call the constraint pyramid. I'll keep it grounded in the one shape I've actually shipped more than once.&lt;/p&gt;

&lt;h2&gt;
  
  
  Prompts are memory. Files are architecture.
&lt;/h2&gt;

&lt;p&gt;The mistake I made first, and that most teams still make, is trying to govern an AI with better prompts. "Just tell it the constraints in the chat." A prompt is a memory, not an architecture. It sits in a context window, one refresh from being washed away, one regeneration from being quietly ignored. You can't verify that the model obeyed it, and the same prompt produces different results across models and contexts. Prompt engineering buys you a conversation, not a system.&lt;/p&gt;

&lt;p&gt;A file is the opposite. The model's output is bounded by what it can read, and a file it is told to read before every generation is not a suggestion the model has to remember to honor — it's ground truth the model hits before it produces a single line. Write your boundaries once, into a README that gates the project, and you've turned a hope into a constraint.&lt;/p&gt;

&lt;p&gt;That shift — from words-in-chat to rules-in-files — is the whole premise of this series.&lt;/p&gt;

&lt;h2&gt;
  
  
  Five layers, one skeleton
&lt;/h2&gt;

&lt;p&gt;The pyramid is a name for the set of files, arranged as five layers, where each layer answers one question and translates the one above it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Strategy      —— README / constitution  : what this is, its boundaries
   ↕
Architecture  —— ADR set                : where the limits are, what won't be revisited
   ↕
Contracts     —— spec + runbook         : what exactly must be delivered
   ↕
Gates         —— pre-submit checks      : what is not allowed to become code
   ↕
Implementation— constrained output      : the model's work, fenced in from above
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Read top to bottom, it moves from "why" to "how," each layer narrowing the space the layer below is allowed to work in. Read bottom to top, it's the audit trail: every line of generated code should be traceable up through a gate, a contract, an architecture decision, and finally a strategic intent. Constraint flows down; accountability flows up.&lt;/p&gt;

&lt;p&gt;The layer names aren't the point — in different projects this same skeleton is called a README, a constitution, a skill set. What holds is the arrangement: fewer, heavier files at the top; more, freer output at the bottom.&lt;/p&gt;

&lt;h2&gt;
  
  
  Not all constraints weigh the same
&lt;/h2&gt;

&lt;p&gt;The skeleton alone doesn't make the system work. What makes it executable is a second dimension I had to learn the hard way: &lt;strong&gt;constraint strength, in three tiers.&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;L1 — hard constraints&lt;/strong&gt;, enforced by code and gates. A pre-submit script that fails a build over a naming violation isn't a request; it's a wall. Schema, shared DTOs, dependency files, the gate script itself all live here, and the model is not allowed to touch them.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;L2 — architecture constraints&lt;/strong&gt;, carried by accepted ADRs and file layout. They don't fail a build, but they define what "following the design" even means; changing one requires a new ADR, not a silent edit.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;L3 — execution suggestions&lt;/strong&gt;, the loose end. Runbook steps, skill definitions, checklist guidance — the model may improve on these, but it has to record what it changed.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The whole game is making sure the model knows which tier a rule sits in. Without that distinction, an AI treats every file as polite advice and rewrites whatever it likes — and then the constraint system exists only on paper. A rule placed too hard chokes the system on trivia; a rule placed too soft is decoration. The pyramid earns its keep precisely by letting you put each rule where it belongs.&lt;/p&gt;

&lt;h2&gt;
  
  
  What actually happened at 636 lines
&lt;/h2&gt;

&lt;p&gt;This isn't a diagram I drew on a whiteboard. In a real project — the AI-generated operations system I refer to throughout this series — the strategy file started at two vague lines: "an issue-tracking system, Java backend, Vue frontend." No module boundaries, no naming rules. The model's output drifted weekly: controllers called &lt;code&gt;TicketController&lt;/code&gt; in one file and &lt;code&gt;TicketApi&lt;/code&gt; in another, business logic shoved into controllers in one module and into services in the next. After a few weeks each style looked correct in isolation, and unifying them stopped being a bug fix and became a rewrite — heavier than starting over, because now we had baggage.&lt;/p&gt;

&lt;p&gt;So I stopped editing the prompt and started editing the file. Over the life of the project that README grew to 636 lines [ORIGINAL DATA] — module boundaries, path conventions, naming, layering, each rule pinned down one by one. When the model read it before every generation, the week-to-week style drift that had been a constant nearly vanished. The model didn't follow the rules because I asked nicely. It followed them because the rules were the file it was told to read first.&lt;/p&gt;

&lt;p&gt;That's the whole difference between constraint and lecture. A lecture says "please write consistently." A constraint says "you can only write inside this boundary." The first one a model tunes out; the second one it can't miss.&lt;/p&gt;

&lt;h2&gt;
  
  
  Constraints go down. Deviations come back up.
&lt;/h2&gt;

&lt;p&gt;One more piece, because people leave it out: the pyramid is not a one-way funnel. The model doesn't only obey constraints — its output should &lt;em&gt;change&lt;/em&gt; them.&lt;/p&gt;

&lt;p&gt;When generated code keeps violating a naming rule, that rule escalates from a soft suggestion to a gate check. When a gate keeps catching the same error, it's a sign the contract layer is missing a step, so you add the step. When a rule fights you no matter how it's phrased, that usually means the boundary itself is wrong — which becomes a new ADR, and sometimes a revision to the strategy document itself. Deviation flows up; the constraints get sharper for it. A healthy constraint system isn't rigid, it's alive — it has a return channel, a trace of what previous projects taught it, so it doesn't re-learn the same lesson in week four. I'll open that mechanism properly in a later essay.&lt;/p&gt;

&lt;h2&gt;
  
  
  Nothing defends a wall that's never checked
&lt;/h2&gt;

&lt;p&gt;I can steelman the skeptic easily: files rot too. A README that says one thing while the code does another is worse than none, because it sells you the illusion of governance. I've watched teams paste a six-hundred-line spec, feel safe, and drift all the same.&lt;/p&gt;

&lt;p&gt;The only honest defense is uncomfortable: the system has to be &lt;em&gt;run&lt;/em&gt;, not written. A gate that never executes is a wish. An ADR nobody maps back to the code is a diary. The pyramid works only when its layers are wired to one another and fired in the pipeline. The moment it degrades into static documentation, it deserves exactly what it replaced.&lt;/p&gt;

&lt;p&gt;The first thing to try today is the smallest possible version: find the place your model reads before every generation. If it's a chat, move it to a file — a file that says what the project is, its module boundaries, and its naming rules. Two lines is a start; six hundred is a system. Then sort every rule you currently carry in your head into one of the three tiers, and let the model see the difference.&lt;/p&gt;

&lt;p&gt;In the next piece I'll show you the top layer — how to write the project's constitution before the code, so an AI is willing to live under it and, just as important, stops flattering you while it does.&lt;/p&gt;




</description>
      <category>ai</category>
      <category>programming</category>
      <category>tutorial</category>
      <category>architecture</category>
    </item>
  </channel>
</rss>
