<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
  <title>Alexandre Richard</title>
  <subtitle>Engineering manager in Strasbourg. Notes on agentic engineering, black-box testing and vintage arcade hardware.</subtitle>
  <link href="https://alexrichard.org/"/>
  <link rel="self" href="https://alexrichard.org/feed.xml"/>
  <id>https://alexrichard.org/</id>
  <updated>2026-11-22T12:00:00Z</updated>
  <author><name>Alexandre Richard</name></author>
  <entry>
    <title>Documentation that checks itself against the cartridge</title>
    <link href="https://alexrichard.org/blog/documentation-that-checks-itself.html"/>
    <id>https://alexrichard.org/blog/documentation-that-checks-itself.html</id>
    <published>2026-11-22T12:00:00Z</published>
    <updated>2026-11-22T12:00:00Z</updated>
    <summary>An agent wrote about 400 KB of documentation of a 1994 game; here is how it was made readable for strangers and then tested against the ROM like code so that it always leverages actually measured data.</summary>
    <category term="agentic-engineering" label="agentic engineering"/>
    <category term="black-box-development" label="black-box development"/>
    <category term="documentation" label="documentation"/>
    <category term="testing" label="testing"/>
    <category term="sailor-moon-s" label="Sailor Moon S"/>
    <category term="romhacking" label="romhacking"/>
    <content type="html" xml:base="https://alexrichard.org/blog/">&lt;blockquote&gt;
&lt;p&gt;This post is part of a series on &lt;em&gt;&lt;a href=&quot;https://github.com/DefinitelyFrenchName/SMS-FrenchName-edition&quot;&gt;Sailor Moon S - FrenchName edition&lt;/a&gt;&lt;/em&gt;. It digs deeper on a topic from &lt;a href=&quot;https://alexrichard.org/blog/it-s-1994-and-sailor-uranus-is-broken.html&quot;&gt;It&amp;rsquo;s 1994 and Sailor Uranus is broken.&lt;/a&gt; &lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;On 3 September I was reading one of the explainer pages the agent had drawn for this project, &lt;a href=&quot;https://definitelyfrenchname.github.io/SMS-FrenchName-edition/frame.html&quot;&gt;one frame, as the cartridge runs it&lt;/a&gt;, and I stopped on this sentence:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&amp;ldquo;Three idioms account for most of the surprise&amp;rdquo;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;There is so much wrong in that single sentence that I didn&amp;rsquo;t know where to start. So I asked the agent to explain it to me. The agent went and found the sentence in the page generator and proceeded to answer. To its credit it did correctly remark the sentence was &amp;ldquo;badly written&amp;rdquo;, and listed three faults. &lt;/p&gt;
&lt;p&gt;The first two were lack of context/glossary (out of context use of the word &amp;ldquo;idiom&amp;rdquo;) and lack of focus (the document was supposed to be a description of a frame, not a post-mortem on the work); the the third one can be described as unmeasured data claimed as factual truth and is at the core of this post:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;&amp;ldquo;Account for most of the&amp;rdquo;&lt;/em&gt; sounds quantitative and really isn&amp;rsquo;t. Nobody counted surprises. In a project whose first rule is that every number comes from a run, a sentence borrowing the &lt;em&gt;cadence&lt;/em&gt; of a measurement without being one is at best a very bad habit and at worst a bad attempt at making believe your statements are rooted in facts.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;A coding agent writes confident prose at exactly the speed it writes correct prose. And possibly because it&amp;rsquo;s trained on human materiel and tries to maximize its usefulness, it&amp;rsquo;s prone to cut corners in an attempt to please more. &lt;/p&gt;
&lt;p&gt;In documentation, the two look the same. This post is about the roughly 400 KB of documentation of the original game that came out of this project, and the machinery that makes it hard for a sentence like that to survive.&lt;/p&gt;
&lt;h2 id=&quot;unexpectedly-prose-was-strong-tests-however&quot;&gt;(Unexpectedly) prose was strong. Tests however&amp;hellip;&lt;/h2&gt;
&lt;p&gt;Outside of code, my feedback of the agents after two months was lopsided. Claude&amp;rsquo;s documentation and explanations, written on demand, were remarkably readable, &lt;em&gt;given proper guidance and feedback&lt;/em&gt;. Its tests however were much weaker, which felt strange given that in the end they could be boiled down to scripts and coded instructions. And they kept depending on wording and internal names that had nothing to do with what was being tested:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The health script decided whether the doc checker had passed by grepping its output for &lt;code&gt;ALL PASS (...)&lt;/code&gt;. The checker colourised its output, so an ANSI escape code sat inside that phrase. Health reported FAIL while the checker passed! (&lt;a href=&quot;https://github.com/DefinitelyFrenchName/SMS-FrenchName-edition/commit/d20ae9a&quot;&gt;&lt;code&gt;d20ae9a&lt;/code&gt;&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;A training-mode test counted lines of output to report how many checks ran. In one instance, &amp;lsquo;14 checks&amp;rsquo; were actually 4 real + 10 DBG&amp;rdquo;: literally debug prints were being counted as checks without any justification (&lt;a href=&quot;https://github.com/DefinitelyFrenchName/SMS-FrenchName-edition/commit/6ee181e&quot;&gt;&lt;code&gt;6ee181e&lt;/code&gt;&lt;/a&gt;).&lt;/li&gt;
&lt;li&gt;A hand-pinned byte in the regression suite&amp;rsquo;s detection table &amp;ldquo;silently skipped eleven tests for a week&amp;rdquo; when a stub moved.&lt;/li&gt;
&lt;li&gt;Issue #2 was titled &amp;ldquo;Regression suite always exits 0 — the documented shipping gate cannot fail&amp;rdquo;.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;I can only assume that at least part of the problem came from the fact that the harness had few proper hooks and scripted parts from the start and most of what was organically built  to address the needs was ultimately built on English requirements, not algorithmic premises. Did it read better than most of gstack? I&amp;rsquo;d say so but that tells you more about Claude&amp;rsquo;s improvements than my own.&lt;/p&gt;
&lt;p&gt;This being said, when given proper directives not just on the goal of the documentation but on how it should read and look and how it should be tested, things shifted dramatically. And as usual, if you can it&amp;rsquo;s better to set up guidelines and guardrails from the start but if you can&amp;rsquo;t just remember to improve all of your project and not just the one occurence you detected. After all, unlike humans, agents don&amp;rsquo;t mind spending ressources on alledgedly boring stuff!&lt;/p&gt;
&lt;p&gt;Most of what follows is about closing my measurement gap: making the documentation &lt;em&gt;itself&lt;/em&gt; testable, so that a test asks the cartridge, not the wording.&lt;/p&gt;
&lt;h2 id=&quot;two-halves-one-rule&quot;&gt;Two halves, one rule&lt;/h2&gt;
&lt;p&gt;The first decision was where documents go. On 8 August &lt;code&gt;docs/&lt;/code&gt; was split in two, with a one-line rule (&lt;a href=&quot;https://github.com/DefinitelyFrenchName/SMS-FrenchName-edition/blob/main/docs/README.md&quot;&gt;&lt;code&gt;docs/README.md&lt;/code&gt;&lt;/a&gt;):&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;The rule of thumb when adding a file: &lt;em&gt;would this still be true, and still useful, to someone who had never heard of this project?&lt;/em&gt; If yes, it belongs in &lt;code&gt;game/&lt;/code&gt;.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;code&gt;docs/game/&lt;/code&gt; is about the retail cartridge, true whatever anyone patches. &lt;code&gt;docs/project/&lt;/code&gt; is my edition: patch notes, builds, decisions, the Sailor Saturn backport. The test sounds trivial. In practice it forces each sentence to say which thing it is about: the game, or my changes to it. (The same question later shaped the generic test harness that came out of the next project.)&lt;/p&gt;
&lt;p&gt;The centrepiece of &lt;code&gt;game/&lt;/code&gt; is &lt;a href=&quot;https://github.com/DefinitelyFrenchName/SMS-FrenchName-edition/blob/main/docs/game/sms_data_architecture.md&quot;&gt;&lt;code&gt;sms_data_architecture.md&lt;/code&gt;&lt;/a&gt;. It is organised by the console&amp;rsquo;s four memories (ROM, work RAM, video RAM, audio RAM), not by the order we discovered things, and its first section is the one idea a stranger needs: &amp;ldquo;This engine is data-driven.&amp;rdquo; A character is a manifest, box tables, animation tables and a palette, and generic interpreters walk them. Next to it sit the engine internals, the damage system, the stat system, every special move of every character, and one generated page per fighter.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;What a &amp;ldquo;memory map&amp;rdquo; is.&lt;/strong&gt; The console sees ROM, RAM and the video and audio chips through addresses. A memory map says which address range holds what, for example &amp;ldquo;the two fighters&amp;rsquo; data structures start at &lt;code&gt;$7E:1000&lt;/code&gt; and &lt;code&gt;$7E:1080&lt;/code&gt;&amp;rdquo;. With no source code, the map &lt;em&gt;is&lt;/em&gt; the documentation.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h2 id=&quot;the-holes-acknowledging-what-is-unknown&quot;&gt;The holes (acknowledging what is unknown )&lt;/h2&gt;
&lt;p&gt;An important section of that document is the last one, §13, &amp;ldquo;The holes — what is genuinely not known&amp;rdquo;:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;A map that hides its gaps is worse than no map. These are the parts of the cartridge this project cannot yet read, listed so nobody re-derives the same dead ends.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;It lists a compression codec nobody seems to have publicly documented: about 180 KB of graphics after the last fighter, a bank that is 87% &lt;code&gt;00&lt;/code&gt;/&lt;code&gt;FF&lt;/code&gt; with no pointer into it, and about a third of the object structure that every fighter and projectile lives in.&lt;/p&gt;
&lt;p&gt;That last row carries its own retraction. Bytes &lt;code&gt;+0x79/+0x7A&lt;/code&gt; used to be in the &amp;ldquo;unmapped&amp;rdquo; list. In August an experimental build parked a timer there, because unmapped looked like free. A write census and a full-session watch then showed the engine uses those bytes as a per-object hit counter (&lt;a href=&quot;https://github.com/DefinitelyFrenchName/SMS-FrenchName-edition/commit/e1b9809&quot;&gt;&lt;code&gt;e1b9809&lt;/code&gt;&lt;/a&gt;). The row now says so, with a warning: that is &amp;ldquo;what &amp;lsquo;unmapped&amp;rsquo; invites&amp;rdquo;. The section ends by flagging one of its own entries as &amp;ldquo;&lt;em&gt;inferred from bytes alone&lt;/em&gt; — this project has been wrong about exactly that kind of evidence before.&amp;rdquo;&lt;/p&gt;
&lt;h2 id=&quot;checkdocs-31-checks-then-five-dead-facts&quot;&gt;checkdocs: 31 checks, then five dead facts&lt;/h2&gt;
&lt;p&gt;The documents had been rewritten and reorganised all through 8 August. That afternoon, re-measuring for the data-architecture document had already disagreed with the older docs in five places (&lt;a href=&quot;https://github.com/DefinitelyFrenchName/SMS-FrenchName-edition/commit/36a376b&quot;&gt;&lt;code&gt;36a376b&lt;/code&gt;&lt;/a&gt;). Then I asked the question that produced &lt;code&gt;tools/checkdocs.py&lt;/code&gt;. The commit message frames it better than I did (&lt;a href=&quot;https://github.com/DefinitelyFrenchName/SMS-FrenchName-edition/commit/769b536&quot;&gt;&lt;code&gt;769b536&lt;/code&gt;&lt;/a&gt;):&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;when documentation is reorganised and rewritten, is every fact still measured, or has an elegant-sounding sentence replaced a measured one somewhere? Re-reading my own prose is the weakest possible check on that, so this re-derives the claims from the ROM instead.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;It started with 31 checks over six documents. Each check has three steps:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Assert that the claim is &lt;strong&gt;still in the document&lt;/strong&gt;, quoted. If someone edits the doc, the check fails loudly instead of testing a claim nobody makes any more.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Derive the same fact from the cartridge.&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;Compare.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;All 31 held. The first error it found was in the checker itself, not the docs.&lt;/p&gt;
&lt;p&gt;Forty-two minutes later it had implemented 76 checks and a new rule. Every documented &lt;em&gt;table&lt;/em&gt; gets a validator for its shape, and that validator is also run at the &lt;strong&gt;wrong&lt;/strong&gt; address and must fail there. &amp;ldquo;The pointers look plausible&amp;rdquo; survives a two-byte shift; a stride or an ordering does not. Writing those checks meant re-deriving every documented table, and five documented facts did not survive (&lt;a href=&quot;https://github.com/DefinitelyFrenchName/SMS-FrenchName-edition/commit/0d4bbfd&quot;&gt;&lt;code&gt;0d4bbfd&lt;/code&gt;&lt;/a&gt;):&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;A special-move record is 7 bytes, not 8. The &amp;ldquo;field&amp;rdquo; at byte 7 was the next record&amp;rsquo;s attack ID.&lt;/li&gt;
&lt;li&gt;An instruction was documented two bytes late, &amp;ldquo;in four places across three documents&amp;rdquo;. It came from the commit that proved there is no randomness in damage (post 4).&lt;/li&gt;
&lt;li&gt;A &lt;code&gt;jmp&lt;/code&gt; was really a &lt;code&gt;jsr&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;A screen engine draws eight screens, not nine.&lt;/li&gt;
&lt;li&gt;One velocity was written as its raw 16-bit word instead of its signed value.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Two days later it passed 200 checks. Today a health run counts 249 checks across 20 documents. The tool also prints what it &lt;em&gt;cannot&lt;/em&gt; check, &amp;ldquo;prose, reasoning, causal claims (&amp;lsquo;this is why X&amp;rsquo;)&amp;rdquo;, so that, in its own words, &amp;ldquo;the green line is not over-read&amp;rdquo;.&lt;/p&gt;
&lt;p&gt;One judgement from that growth is worth keeping. The cheap way to cover more addresses was to make each doc quote the instruction at each address it names, then check the quote. The agent declined: &amp;ldquo;a quote stamped from the address it is meant to test is a tautology&amp;rdquo;. It can catch rot later, but never an address that is already wrong. Only claims where a human supplied independent redundancy catch present errors.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Why &amp;ldquo;fail at the wrong address&amp;rdquo; matters.&lt;/strong&gt; A test that passes on correct input proves little. If it would also pass on &lt;em&gt;wrong&lt;/em&gt; input, it proves nothing. Mutation testing formalises this: plant a fault and make sure the test notices.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h2 id=&quot;a-disassembler-checked-by-someone-elses-disassembler&quot;&gt;A disassembler checked by someone else&amp;rsquo;s disassembler&lt;/h2&gt;
&lt;p&gt;Many checks need to decode 65816 instructions, so the decoder became a single point of failure. On 10 August it was compared with &lt;a href=&quot;https://github.com/pelrun/Dispel&quot;&gt;DisPel&lt;/a&gt;, a disassembler by a different author, and they agreed on 5,051 consecutive instructions across nine ROM ranges (&lt;a href=&quot;https://github.com/DefinitelyFrenchName/SMS-FrenchName-edition/commit/befd7a9&quot;&gt;&lt;code&gt;befd7a9&lt;/code&gt;&lt;/a&gt;). Two of the nine ranges are data, on purpose, because &amp;ldquo;data exercises rare opcodes that hand written code never reaches&amp;rdquo;. This is &lt;a href=&quot;https://en.wikipedia.org/wiki/Differential_testing&quot;&gt;differential testing&lt;/a&gt;: two independent implementations, and you look at where they disagree.&lt;/p&gt;
&lt;p&gt;The same commit records that the first two negative controls were wrong. One passed vacuously because every sampled range began with an instruction that reset the very thing the control had corrupted. The other perturbed an opcode the workload never reached. Both now pick their target from what the workload actually executes.&lt;/p&gt;
&lt;h2 id=&quot;the-confession&quot;&gt;The confession&lt;/h2&gt;
&lt;p&gt;Back to the evening of 8 August. Right after &lt;code&gt;checkdocs&lt;/code&gt; landed, the agent committed the ANSI-colour fix above, with this:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Worth recording that I committed and pushed the previous change with health failing, because I read the commit as done once the push succeeded rather than re-running the gate after wiring it in. &lt;code&gt;git commit&lt;/code&gt; does not run health.sh — nothing does but me.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Of note: the repo did have a CI health workflow, since 6 August. But a hosted runner has no ROM, so every cartridge check is reported as SKIP there. The workflow says so at the top:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;a green tick here means &amp;ldquo;the tree is self-consistent&amp;rdquo;, not &amp;ldquo;the builds are good&amp;rdquo;.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Not putting in place a check around this limitation was definitely a failure on my part. However it is worth noticing that, especially for processes that are not your super usual web development kind, the agents really saw no problem with the situation. Could they have detected the issue? I&amp;rsquo;m confident they could have&amp;hellip; if and only if specifically directed to; hence the need to put in guardrails and guidelines early and propagating them throughout the project when they&amp;rsquo;re introduced.&lt;/p&gt;
&lt;h2 id=&quot;drawn-pages-and-the-feedback-that-shaped-them&quot;&gt;Drawn pages, and the feedback that shaped them&lt;/h2&gt;
&lt;p&gt;Two of the documents are also published as drawn pages, built by committed generators and rendered by CI on every push:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&quot;https://definitelyfrenchname.github.io/SMS-FrenchName-edition/&quot;&gt;&lt;strong&gt;The data architecture&lt;/strong&gt;&lt;/a&gt;, from &lt;code&gt;tools/mkarchpage.py&lt;/code&gt;. The geometry is computed, &amp;ldquo;never hand-typed … hand-authoring SVG coordinates is how off-by-one diagrams happen&amp;rdquo;, and the accent colour is read from Sailor Uranus&amp;rsquo;s palette in the clean ROM.&lt;/li&gt;
&lt;li&gt;&lt;a href=&quot;https://definitelyfrenchname.github.io/SMS-FrenchName-edition/frame.html&quot;&gt;&lt;strong&gt;One frame, as the cartridge runs it&lt;/strong&gt;&lt;/a&gt;, from &lt;code&gt;tools/mkenginepage.py&lt;/code&gt;. It draws the in-match loop stage by stage, with every patch pinned to the stage it hooks. Its &lt;code&gt;--check&lt;/code&gt; re-reads every instruction it draws from the ROM. Three stages are drawn as grey boxes labelled UNIDENTIFIED, because &amp;ldquo;a grey box is worth more than a confident guess.&amp;rdquo;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;These pages are where &amp;ldquo;given proper guidance and feedback&amp;rdquo; shows most clearly in the git log. On 8 and 9 August:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;The architecture page opened with &amp;ldquo;HiROM, FastROM, no copier header&amp;rdquo;. &amp;ldquo;Maintainer read it and asked&amp;rdquo;, and it gained a footnote that explains the address model from scratch (&lt;a href=&quot;https://github.com/DefinitelyFrenchName/SMS-FrenchName-edition/commit/873ff33&quot;&gt;&lt;code&gt;873ff33&lt;/code&gt;&lt;/a&gt;).&lt;/li&gt;
&lt;li&gt;The footer claimed the page used &amp;ldquo;Sailor Uranus&amp;rsquo;s own sixteen colours&amp;rdquo;. When I asked what that meant, the agent checked the ROM and found only some of them were hers (&lt;a href=&quot;https://github.com/DefinitelyFrenchName/SMS-FrenchName-edition/commit/853c2d6&quot;&gt;&lt;code&gt;853c2d6&lt;/code&gt;&lt;/a&gt;).&lt;/li&gt;
&lt;li&gt;The frame page&amp;rsquo;s first cut had two reported formatting faults: a label running out of its box, and a row of patch markers landing in the next stage. Rather than nudge coordinates, the generator now measures every string and refuses to write a page where text overflows or boxes overlap (&lt;a href=&quot;https://github.com/DefinitelyFrenchName/SMS-FrenchName-edition/commit/915632c&quot;&gt;&lt;code&gt;915632c&lt;/code&gt;&lt;/a&gt;).&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;one-final-word&quot;&gt;One final word&lt;/h2&gt;
&lt;p&gt;There is one last benefit I didn&amp;rsquo;t touch upon because it felt obvious: regenerating your documents&amp;rsquo; data from directly from the source of truth means one less source of rot: the document might rot eventually but at least each part of it that refers to data stays correct and relevant and that&amp;rsquo;s no small victory in my book.&lt;/p&gt;</content>
  </entry>
  <entry>
    <title>Certainty is the failure signal</title>
    <link href="https://alexrichard.org/blog/certainty-is-the-failure-signal.html"/>
    <id>https://alexrichard.org/blog/certainty-is-the-failure-signal.html</id>
    <published>2026-11-17T12:00:00Z</published>
    <updated>2026-11-17T12:00:00Z</updated>
    <summary>A coding agent writes confident prose exactly as fast as correct prose, so the project&#x27;s first rule was built to bite hardest at the moment everyone is sure.</summary>
    <category term="agentic-engineering" label="agentic engineering"/>
    <category term="black-box-development" label="black-box development"/>
    <category term="testing" label="testing"/>
    <category term="sailor-moon-s" label="Sailor Moon S"/>
    <category term="romhacking" label="romhacking"/>
    <content type="html" xml:base="https://alexrichard.org/blog/">&lt;blockquote&gt;
&lt;p&gt;This post is part of a series on &lt;em&gt;&lt;a href=&quot;https://github.com/DefinitelyFrenchName/SMS-FrenchName-edition&quot;&gt;Sailor Moon S - FrenchName edition&lt;/a&gt;&lt;/em&gt;. It digs deeper on a topic from &lt;a href=&quot;https://alexrichard.org/blog/it-s-1994-and-sailor-uranus-is-broken.html&quot;&gt;It&amp;rsquo;s 1994 and Sailor Uranus is broken.&lt;/a&gt; &lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;On the morning of August 10, before the next piece of work began, I wrote this down for the agent. It was not a reaction to a particular mistake. The same morning it became the first section of the project&amp;rsquo;s &lt;a href=&quot;https://github.com/DefinitelyFrenchName/SMS-FrenchName-edition/blob/main/CLAUDE.md&quot;&gt;&lt;code&gt;CLAUDE.md&lt;/code&gt;&lt;/a&gt; (&lt;a href=&quot;https://github.com/DefinitelyFrenchName/SMS-FrenchName-edition/commit/b4597ea&quot;&gt;&lt;code&gt;b4597ea&lt;/code&gt;&lt;/a&gt;):&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Any data should come from measurements, NEVER guesses. When you don&amp;rsquo;t know you measure, when you think you know you measure to check against the measurement, and when you&amp;rsquo;re sure you don&amp;rsquo;t have to measure is precisely when you absolutely must measure. We do not compromise: the source of truth is the original code.&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;The first two clauses are ordinary engineering. The third is the one that matters, and the agent named it better than I did, in the commit that promoted the rule:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;The third clause is the one that bites: unmeasured certainty is the failure signal, not the safety signal, because confidence is exactly when the check gets skipped.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h2 id=&quot;confidence-is-not-evidence&quot;&gt;Confidence is not evidence&lt;/h2&gt;
&lt;p&gt;Here is the problem in one sentence: a coding agent writes a confident wrong sentence exactly as fast, and exactly as fluently, as a confident right one. Humans&amp;hellip; project differently. Doubt breeds fear so we have a tendency to leak hints: we hedge, we take longer, we say &amp;ldquo;I think&amp;rdquo; to shield ourselves. An agent&amp;rsquo;s prose has the same texture whether it ran the experiment or not. Rafal Strzalinski blogging about his reverse-engineering an Atari game with Claude put it well when he reminded that [&amp;ldquo;confidence and accuracy are orthogonal properties&amp;rdquo;] (https://quesma.com/blog/ghidra-mcp-unlimited-lives/)).&lt;/p&gt;
&lt;p&gt;Feynman pointed to the same core issue when he famously told Caltech graduates in 1974: &amp;ldquo;The first principle is that you must not fool yourself—and you are the easiest person to fool&amp;rdquo; (&lt;a href=&quot;https://calteches.library.caltech.edu/51/2/CargoCult.htm&quot;&gt;&lt;em&gt;Cargo Cult Science&lt;/em&gt;&lt;/a&gt;). An agent fools itself the way we do, by carrying a plausible number forward without re-checking it. It just does it faster and in better prose.&lt;/p&gt;
&lt;p&gt;So the rule has to work without anyone being able to &lt;em&gt;tell&lt;/em&gt; which statements are shaky. Treat every statement as shaky until a run in this session produced it.&lt;/p&gt;
&lt;h2 id=&quot;the-retraction-gallery&quot;&gt;The retraction gallery&lt;/h2&gt;
&lt;p&gt;The repository keeps its mistakes, and the commit messages that take something back are some of the best reading in it. Four of them follow.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Sidebar: Saturn and her shells.&lt;/strong&gt; Sailor Saturn is not in this game. She was backported from the 1996 sequel. You summon her by holding L+R while picking Uranus, Neptune or Pluto, and she borrows that character&amp;rsquo;s slot in the game, which the project calls her &lt;em&gt;shell&lt;/em&gt;. Using a shell to inject her character data into has the major benefit of basically keeping th original code intact. Here the important detail is that I she can have 3 different shells&amp;hellip; and many of the bugs below exist on one shell and not another (and yes having 3 possible shells was invinting chaos but back then I had no idea how much!)&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;strong&gt;&amp;ldquo;~36px for every character.&amp;rdquo;&lt;/strong&gt; On 19 July a commit titled &amp;ldquo;System-wide wiki cross-check&amp;rdquo; recorded, in passing, that the neutral backdash is &amp;ldquo;~36px for every character measured&amp;rdquo; (&lt;a href=&quot;https://github.com/DefinitelyFrenchName/SMS-FrenchName-edition/commit/8e8745d&quot;&gt;&lt;code&gt;8e8745d&lt;/code&gt;&lt;/a&gt;). It went into the special-moves reference and stayed there for weeks. When the agent finally censused all nine characters on the clean ROM, it was 47 to 60 pixels: Uranus 47, Neptune 60, everyone else in between (&lt;a href=&quot;https://github.com/DefinitelyFrenchName/SMS-FrenchName-edition/commit/f3aecad&quot;&gt;&lt;code&gt;f3aecad&lt;/code&gt;&lt;/a&gt;). The correction is generous to its predecessor and exact about what failed:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;The instinct behind the old line — distance roughly uniform, duration not — was right; the number was wrong.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Then it does the important thing. A ratio elsewhere on the page (&amp;ldquo;the GC backdash travels ~2-2.5x the neutral&amp;rdquo;) had used 36 as its denominator. The commit did not quietly recompute it. It &amp;ldquo;is withdrawn, not revised&amp;rdquo;, because the other half had not been re-measured either, &amp;ldquo;so the honest state is &amp;lsquo;unmeasured&amp;rsquo;, not a new multiplier.&amp;rdquo;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;The diff that measured the wrong thing.&lt;/strong&gt; One of Saturn&amp;rsquo;s projectiles was wrongly drawn as two disconnected pieces, and the agent ran a build-by-build bisection that pointed at version 0.14.8 as the moment it broke. It published that as a finding. Then it ran a control: plain Neptune, no Saturn at all. The control &amp;ldquo;reproduces the same tile indices, the same palette and the same blank count as the Saturn run&amp;rdquo;. The metric had been watching the &lt;em&gt;character&lt;/em&gt; standing next to the projectile instead of the projectile(&lt;a href=&quot;https://github.com/DefinitelyFrenchName/SMS-FrenchName-edition/commit/a4bb542&quot;&gt;&lt;code&gt;a4bb542&lt;/code&gt;&lt;/a&gt;):&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;The maintainer had already reproduced the bug on v0.14.6 while the measurement called 0.14.5 and 0.14.6 identical — that contradiction was the first sign the metric was invalid, and it should have stopped the claim before it was written.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;That is the human in the loop. I was going through builds trying to understand what went wrong and saw the bug where the numbers said it could not be. The rule that came out of it is in the ROM-hacking skill as RH-18: &amp;ldquo;A replacement metric must separate a known-good build from a known-bad one before it is believed.&amp;rdquo;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Five facts corrected in one documentation pass.&lt;/strong&gt; When the agent started writing automatic checks for the game documentation, each documented table had to be re-derived from the cartridge to write its assertion. Five &amp;ldquo;facts&amp;rdquo; died on contact (&lt;a href=&quot;https://github.com/DefinitelyFrenchName/SMS-FrenchName-edition/commit/0d4bbfd&quot;&gt;&lt;code&gt;0d4bbfd&lt;/code&gt;&lt;/a&gt;): a record that is 7 bytes, not 8; an instruction address that was two bytes late &amp;ldquo;in four places across three documents&amp;rdquo;; a &lt;code&gt;jmp&lt;/code&gt; that is a &lt;code&gt;jsr&lt;/code&gt;; a screen engine with eight screens, not nine; a velocity written as its raw word. The commit&amp;rsquo;s summary of the second one could be the summary of all five: &lt;em&gt;&amp;ldquo;A carried-forward claim nobody re-derived.&amp;rdquo;&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Confident about the obstacles, too.&lt;/strong&gt; Certainty fails in the pessimistic direction as well. Saturn&amp;rsquo;s nameplate was expected to be expensive, because the notes said the font was loaded per matchup and would be missing letters. Measurements actually found all 26 letters present in every shell&amp;rsquo;s matchup. The old note had inferred it from &amp;ldquo;G is in no character&amp;rsquo;s name&amp;rdquo;, which the commit calls &amp;ldquo;a true fact with a false conclusion&amp;rdquo; (&lt;a href=&quot;https://github.com/DefinitelyFrenchName/SMS-FrenchName-edition/commit/9c16b1e&quot;&gt;&lt;code&gt;9c16b1e&lt;/code&gt;&lt;/a&gt;). 
Similarly, a &amp;ldquo;blocker&amp;rdquo; on Saturn&amp;rsquo;s voice pitch turned out to be a misread program counter: the two addresses believed to be a shared pitch routine turned out to be computing nothing (&lt;a href=&quot;https://github.com/DefinitelyFrenchName/SMS-FrenchName-edition/commit/92e0cae&quot;&gt;&lt;code&gt;92e0cae&lt;/code&gt;&lt;/a&gt;). Finding that out took having the agents write a disassembler for the sound CPU and validate against a hand-decode first.&lt;/p&gt;
&lt;h2 id=&quot;a-four-session-bug&quot;&gt;A four-session bug&lt;/h2&gt;
&lt;p&gt;The worst one cost four sessions. When Saturn threw someone, the victim turned into screen-wide fragments of seemingly random sprites. Version 0.14.7 patched the two places that read the thrown-pose table, &amp;ldquo;on the documented basis that the ROM has exactly two of them&amp;rdquo; (&lt;a href=&quot;https://github.com/DefinitelyFrenchName/SMS-FrenchName-edition/commit/31c0751&quot;&gt;&lt;code&gt;31c0751&lt;/code&gt;&lt;/a&gt;).&lt;/p&gt;
&lt;p&gt;That was true of the clean ROM. It was false of the ROM we &lt;em&gt;shipped&lt;/em&gt;. To give Saturn her own code, the build copies an entire bank of the engine into new space, and the copy was taken before the hook was applied. Scanning the built image found four reads, two hooked and two vanilla. When Saturn was the thrower, her code ran from the copy. Every test had used a vanilla character throwing Saturn, so &amp;ldquo;the 47-check gate passed on every build carrying the throw corruption&amp;rdquo; (&lt;a href=&quot;https://github.com/DefinitelyFrenchName/SMS-FrenchName-edition/commit/5b37343&quot;&gt;&lt;code&gt;5b37343&lt;/code&gt;&lt;/a&gt;).&lt;/p&gt;
&lt;p&gt;Two details matter. The bug was pinned &amp;ldquo;on the maintainer&amp;rsquo;s repro (Saturn vs Saturn, 6P)&amp;rdquo;&amp;hellip;And it was finally found &amp;ldquo;by &lt;strong&gt;rendering&lt;/strong&gt; the sprite against a frame-matched vanilla control&amp;rdquo;, not by any of the numeric instruments that had passed for four sessions. The builder now asserts that no unhooked read is left &lt;em&gt;anywhere in the assembled image&lt;/em&gt;.&lt;/p&gt;
&lt;h2 id=&quot;the-ship-is-sinking-as-intended&quot;&gt;The ship is sinking as intended&lt;/h2&gt;
&lt;p&gt;Saturn&amp;rsquo;s two ground throws were on each other&amp;rsquo;s buttons, and one of them went the wrong way (which is a known bug in the sequel). I wished to fix it with an input swap: forward and 4 back inputs read the other way around for that throw. Version 0.16.0 instead flipped the direction the victim flies. The victim landed on the correct side, every check passed, and it was wrong in play, because Saturn no longer turned around. I immediately caught it when testing. The fix commit says it plainly: &amp;ldquo;The gate was ALL PASS on that build, which is the point&amp;rdquo; (&lt;a href=&quot;https://github.com/DefinitelyFrenchName/SMS-FrenchName-edition/commit/69a8ca1&quot;&gt;&lt;code&gt;69a8ca1&lt;/code&gt;&lt;/a&gt;).&lt;/p&gt;
&lt;p&gt;A measurement can only check what it measures. The request was about a &lt;em&gt;mechanism&lt;/em&gt;, and the checks were about an &lt;em&gt;outcome&lt;/em&gt;.&lt;/p&gt;
&lt;h2 id=&quot;the-control-needs-a-control&quot;&gt;The control needs a control&lt;/h2&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Note: negative controls.&lt;/strong&gt; A negative control is a run where the answer must be &amp;ldquo;no&amp;rdquo;: the wrong address, the unpatched build, a planted fault. If the check still says &amp;ldquo;yes&amp;rdquo;, it was never checking. The project&amp;rsquo;s doc checker re-runs every table check at the documented address ±1 and ±2, and each one must object (Trap 20). This is basically the project&amp;rsquo;s implementation of mutation testing.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Negative controls are code, so they can be wrong too. On 10 August, three of them &amp;ldquo;looked right and tested nothing&amp;rdquo;. One seeded a CPU flag in code whose very first instruction resets that flag. One planted its fault in an opcode the workload never executes. One was anchored on an address with &amp;ldquo;&lt;strong&gt;zero call sites&lt;/strong&gt;&amp;rdquo;. Each would have produced a reassuring result forever. The trap&amp;rsquo;s conclusion is the next turn of the screw: a control is wrong until it has failed on purpose.&lt;/p&gt;
&lt;h2 id=&quot;false-certainty-in-the-test-layer&quot;&gt;False certainty in the test layer&lt;/h2&gt;
&lt;p&gt;The same failure shows up in tests, in a quieter form. One one the issues being that Claude is quite amazing at interpreting text and wirting code but I found it had ramarkable difficulties not writing tests that did not lean on its internal wording and names. That might seems harmless&amp;hellip; except that it makes human checks virtually impossible without a translation&amp;hellip; by a model that might not have all the context. 
That issue is compounded by the fact end to end tests rely not just on code but on exchanges between subagents and any false certainty from one will cascade as truth.&lt;/p&gt;
&lt;p&gt;Two examples. Issue #2, from the cross-model review: the regression suite, &amp;ldquo;the documented shipping gate&amp;rdquo;, counted failures, printed them, &amp;ldquo;then calls &lt;code&gt;emu.stop(0)&lt;/code&gt; unconditionally&amp;rdquo;. The verdict lived in the text; the exit status always said &amp;ldquo;pass&amp;rdquo;. And &lt;a href=&quot;https://github.com/DefinitelyFrenchName/SMS-FrenchName-edition/commit/d20ae9a&quot;&gt;&lt;code&gt;d20ae9a&lt;/code&gt;&lt;/a&gt;, where the health check grepped for the words &amp;ldquo;ALL PASS (…)&amp;rdquo;, but the checker colours its output, so an ANSI escape code sat inside the phrase and the match never fired. The commit message is a confession:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Worth recording that I committed and pushed the previous change with health failing, because I read the commit as done once the push succeeded rather than re-running the gate after wiring it in. &lt;code&gt;git commit&lt;/code&gt; does not run health.sh — nothing does but me.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&amp;ldquo;Done because the push succeeded&amp;rdquo; is certainty standing in for a measurement. Forty minutes later the gate stopped reading prose and keyed on the checker&amp;rsquo;s exit code (&lt;a href=&quot;https://github.com/DefinitelyFrenchName/SMS-FrenchName-edition/commit/0763335&quot;&gt;&lt;code&gt;0763335&lt;/code&gt;&lt;/a&gt;).&lt;/p&gt;
&lt;h2 id=&quot;making-measured-checkable&quot;&gt;Making &amp;ldquo;measured&amp;rdquo; checkable&lt;/h2&gt;
&lt;p&gt;A rule like this is useless if it is only a mood. What made it work was turning it into properties you can check.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Every number needs a run from this session.&lt;/strong&gt; &amp;ldquo;No number reaches a document, a commit message, a patch or a plan without a run that produced it in that session. Inherited numbers are re-derived, not carried forward.&amp;rdquo;&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Reports are filed counts.&lt;/strong&gt; &amp;ldquo;A subagent&amp;rsquo;s reported number is a filed count, &lt;strong&gt;not&lt;/strong&gt; a measurement.&amp;rdquo; That covers issues, wikis and the repo&amp;rsquo;s own older notes too. 
  Trap 17 shows why: asserts were filed as being 66 were actually 77; dead hash constants filed as being 13 were actually 16. And a report that called a document wrong was fully overturned by reading the ROM. Turns out the document was right.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Contaminated numbers are discarded, never adjusted.&lt;/strong&gt; If the tool was broken, the number is gone. Measuring is cheap enough that it&amp;rsquo;s not worth trying to salvage unreliable data.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Docs cite their own evidence, explicitly.&lt;/strong&gt; The backdash correction quotes, for each character, the address and instruction that sets the impulse, so the checker can re-derive the row at will. It is also negative-controlled: &amp;ldquo;pointing Uranus&amp;rsquo;s row at Pluto&amp;rsquo;s handler while keeping her quote turns it red.&amp;rdquo;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;One honest footnote. My own first brief had a section headed &amp;ldquo;Known anchors (do not re-derive)&amp;rdquo;. I wrote unmesasured certainty into the project on day one, and the rule I added a month later says the opposite!&lt;/p&gt;</content>
  </entry>
  <entry>
    <title>Black boxes and oracles</title>
    <link href="https://alexrichard.org/blog/black-boxes-and-oracles.html"/>
    <id>https://alexrichard.org/blog/black-boxes-and-oracles.html</id>
    <published>2026-11-14T12:00:00Z</published>
    <updated>2026-11-14T12:00:00Z</updated>
    <summary>Before anyone read a line of assembly, the agent was pressing buttons in a headless emulator and watching memory, and that harness turned out to be the biggest multiplier in the whole project.</summary>
    <category term="agentic-engineering" label="agentic engineering"/>
    <category term="black-box-development" label="black-box development"/>
    <category term="testing" label="testing"/>
    <category term="sailor-moon-s" label="Sailor Moon S"/>
    <category term="romhacking" label="romhacking"/>
    <content type="html" xml:base="https://alexrichard.org/blog/">&lt;blockquote&gt;
&lt;p&gt;This post is part of a series on &lt;em&gt;&lt;a href=&quot;https://github.com/DefinitelyFrenchName/SMS-FrenchName-edition&quot;&gt;Sailor Moon S - FrenchName edition&lt;/a&gt;&lt;/em&gt;. It digs deeper on a topic from &lt;a href=&quot;https://alexrichard.org/blog/it-s-1994-and-sailor-uranus-is-broken.html&quot;&gt;It&amp;rsquo;s 1994 and Sailor Uranus is broken.&lt;/a&gt; &lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;On the first night of this project, before it read a single line of assembly, I made the agent press buttons.&lt;/p&gt;
&lt;p&gt;My instructions were: don&amp;rsquo;t read a 30-year-old program from the top. Make the real program do one small thing, watch which bytes change and which instruction changed them, and &lt;em&gt;then&lt;/em&gt; read the code at that address. This post is about the bench that makes that possible, why it mattered more than anything else I built, and the times it lied.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Quick refresher: frames.&lt;/strong&gt; The console redraws the screen 60 times a second, and the game&amp;rsquo;s logic advances once per redraw. Fighting games count everything in these ticks: a move&amp;rsquo;s startup, how long it hurts, how long you are stuck afterwards. For testing, the important property is that the game is &lt;em&gt;deterministic&lt;/em&gt;. The same inputs on the same frames from the same starting state produce the same result, every time. Speedrunners rely on this: &lt;a href=&quot;https://tasvideos.org/WelcomeToTASVideos&quot;&gt;TASVideos&lt;/a&gt; defines a tool-assisted run as &amp;ldquo;a pre-programmed series of inputs that is intended to be played back in the exact same way every time&amp;rdquo;. Our harness is the same idea pointed at testing instead of speedrunning.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Watching memory.&lt;/strong&gt; The emulator, Mesen2, can run a Lua script alongside the game. A script can ask to be called whenever the CPU writes a given address, and from inside that callback it can read the CPU&amp;rsquo;s registers, including the &lt;em&gt;program counter&lt;/em&gt; (PC): the address of the code that is running. &amp;ldquo;Who writes the player&amp;rsquo;s action byte?&amp;rdquo; becomes a three-line script.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;That was the plan. Step 1 of the brief Claude wrote for itself that evening (&lt;a href=&quot;https://github.com/DefinitelyFrenchName/SMS-FrenchName-edition/blob/main/docs/project/history/claude_code_spec.md&quot;&gt;&lt;code&gt;docs/project/history/claude_code_spec.md&lt;/code&gt;&lt;/a&gt;) reads:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Dynamic first.&lt;/strong&gt; Boot ROM in emulator, pick Uranus (P1). Lua: log writes to $7E:1040/1041/1042 and $7E:1001/1002/1006/1007 with PC of the writing instruction (memory write callbacks). Perform 5A (standing light) once. The writer PC lands inside the animation interpreter — this single trace likely answers everything.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;The approach is derived from human practices, common to those who do maintenance on undocumented codebases: it matters little that you prefer breath or depth first, you need to start somewhere and you need somewhere that is relevant from what you can actually check outside that unknown codebase. I said this blog series is first about black-box agentic development, and here was the starting point.&lt;/p&gt;
&lt;p&gt;In fairness, this is not the only possible approach and it&amp;rsquo;s not unlikely that there are some better ones specifically for agents. But I didn&amp;rsquo;t know better and, more importantly, I knew the method worked, was great at limiting the scope of all the upcoming tasks, hence limit context usage. I couldn&amp;rsquo;t be sure it would scale well but since the workload would be lightened, hopefully I could compensate any speed limit by the relentlessness of agents.&lt;/p&gt;
&lt;h2 id=&quot;size-not-complexity&quot;&gt;Size, not complexity&lt;/h2&gt;
&lt;p&gt;As I stated before, what became clear fast, and clearer still on a bigger project later, is that the obstacle was virtually never the intrinsic complexity of the assembly. It was the &lt;em&gt;size&lt;/em&gt; of the codebase. There is a lot of it, and almost none of it is relevant to the question you are asking at a given moment.&lt;/p&gt;
&lt;p&gt;On this project, size happened to be manageable. The clean cartridge is 2,621,440 bytes (2.5 MiB, forty 64 KiB banks), and its sequel, which we later borrowed a character from, is 3.0 MiB. Claude could probably hold the whole problem at once if it needed. On &lt;em&gt;Vampire Saved&lt;/em&gt;, a CPS-II arcade romhack I worked on afterwards, the parent romset alone unpacks to 44.3 MiB across 21 files, and the work had to go bit by bit.&lt;/p&gt;
&lt;p&gt;In the case of romhacks an &lt;em&gt;accurate&lt;/em&gt; emulator is both a way to test end to end and a tool to help cut size down to scope. For instance, when we tried to backport Sailor Saturn and needed to know how much of the engine was specific to her, Claude did not read the bank. It recorded which instructions &lt;em&gt;executed&lt;/em&gt; in three situations (idle, Saturn attacking, Uranus attacking and connecting) and diffed them. The result (&lt;a href=&quot;https://github.com/DefinitelyFrenchName/SMS-FrenchName-edition/commit/676235c&quot;&gt;&lt;code&gt;676235c&lt;/code&gt;&lt;/a&gt;) &amp;ldquo;bounds Saturn-exclusive code at 299 addrs (~630 B)&amp;rdquo;. A whole bank became 630 bytes worth reading.&lt;/p&gt;
&lt;p&gt;As long as you can isolate proper scopes, the sky is the limit. That &amp;ldquo;dynamic first&amp;rdquo; approach is one way to isolate them.&lt;/p&gt;
&lt;h2 id=&quot;the-bench&quot;&gt;The bench&lt;/h2&gt;
&lt;p&gt;The bench used is small, and an agent can run every piece of it alone, as part of its harness, without a window and without human interaction.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;&lt;a href=&quot;https://github.com/DefinitelyFrenchName/SMS-FrenchName-edition/blob/main/tools/run.sh&quot;&gt;&lt;code&gt;tools/run.sh&lt;/code&gt;&lt;/a&gt;&lt;/strong&gt; launches Mesen in &lt;code&gt;--testrunner&lt;/code&gt; mode: no window, no frame limiter, one Lua script, one ROM, a timeout. It also pins the two controller types and &lt;code&gt;--snes.ramPowerOnState=AllZeros&lt;/code&gt;. That last flag is there because on the first night Claude noticed that Mesen&amp;rsquo;s default, random power-on RAM, &amp;ldquo;made runs nondeterministic&amp;rdquo; (&lt;a href=&quot;https://github.com/DefinitelyFrenchName/SMS-FrenchName-edition/commit/3ab1680&quot;&gt;&lt;code&gt;3ab1680&lt;/code&gt;&lt;/a&gt;). A test bench that boots differently each time is not a bench.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;&lt;code&gt;tools/sms_env.lua&lt;/code&gt; and &lt;code&gt;tools/probelib.lua&lt;/code&gt;&lt;/strong&gt; give every script the same view of the repo and the same helpers: read RAM, read ROM, build a clean controller state. Mesen&amp;rsquo;s working directory is not the shell&amp;rsquo;s, so until these existed, scripts hardcoded absolute paths that only worked on my machine.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Probes.&lt;/strong&gt; There are 407 tracked Lua files under &lt;code&gt;tools/&lt;/code&gt;. Many are probes: one question, one script, one trace file in &lt;code&gt;traces/&lt;/code&gt; named for what it compared (&lt;code&gt;_before&lt;/code&gt;/&lt;code&gt;_after&lt;/code&gt;, &lt;code&gt;_clean&lt;/code&gt; for the unmodified game, &lt;code&gt;_f672&lt;/code&gt; for a frame number). The agent greps those files; it does not need to look at a screen.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Savestates as anchors.&lt;/strong&gt; By 00:27 on the first night, the agent had navigated from power-on to a live match of Uranus against Moon with no human input and saved the state (&lt;a href=&quot;https://github.com/DefinitelyFrenchName/SMS-FrenchName-edition/commit/a8d75a7&quot;&gt;&lt;code&gt;a8d75a7&lt;/code&gt;&lt;/a&gt;). From then on, a test starts mid-fight rather than at the boot logo; today 179 Lua files load a savestate. (Mesen only creates or loads states from inside a CPU-execution callback, so fixtures are written from a hook on a known address.)&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&quot;the-difference-between-theory-and-practice-is-in-theory-theres-no-difference&quot;&gt;&amp;ldquo;The difference between theory and practice is in theory there&amp;rsquo;s no difference&amp;rdquo;&lt;/h2&gt;
&lt;p&gt;You would think a script pressing Start on a title screen is the easiest part. It took two commits and a bit of human ingenuity.&lt;/p&gt;
&lt;p&gt;The first problem was the game. Claude mapped the title menu&amp;rsquo;s input path and found that it looks at the &amp;ldquo;newly pressed&amp;rdquo; flags only every few frames: &amp;ldquo;Menu misses 1-frame press edges; navigation needs closed-loop pulsing&amp;rdquo; (&lt;a href=&quot;https://github.com/DefinitelyFrenchName/SMS-FrenchName-edition/commit/3ab1680&quot;&gt;&lt;code&gt;3ab1680&lt;/code&gt;&lt;/a&gt;, &amp;ldquo;4-frame poll cadence&amp;rdquo;). A human never notices this, because a human finger holds a button for several frames, at irregular times. A script that pulses every fourth frame can line up with the poller&amp;rsquo;s blind spot forever. The proposed was is a period the poller cannot lock onto: &amp;ldquo;Use period-7 (3 on / 4 off) pulses — verified every pulse registers at the title menu.&amp;rdquo;&lt;/p&gt;
&lt;p&gt;The second problem was the emulator. Twelve minutes later came &lt;a href=&quot;https://github.com/DefinitelyFrenchName/SMS-FrenchName-edition/commit/183fd0b&quot;&gt;&lt;code&gt;183fd0b&lt;/code&gt;&lt;/a&gt; in which Claude read Mesen&amp;rsquo;s own C++ for the Lua binding and found a critical misunderstanding on its part. The note it wrote:&lt;/p&gt;
&lt;div class=&quot;hl&quot;&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;code&gt;### Mesen 2.1.1 setInput port bug (critical harness note)
`LuaApi::SetInput` does `ForceParamCount(3)` then `lua_settop(lua, 4)`, so the
documented 2nd parameter (port) is DISCARDED and always reads as 0. The port is
effectively the **3rd** argument: `emu.setInput(buttons, 0, port)` with port 0=JOY1, 1=JOY2.
Verified: setInput({start},0,0)+setInput({down},0,1) → $4219=10, $421B=04.
Consequence: any second setInput call written as (tbl, 1) silently clobbers port 0.
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;This is also the series&amp;rsquo; first retraction, and it reinforced by belief that Claude could correct itself but also was prone to go for the seemingly best cost/benefit explanation in most circumstances, often without actuallly checking if it were correct or just &amp;ldquo;happened to fit that one time&amp;rdquo;. 
In that case, the commit just before it had recorded, in the same notes file: &amp;ldquo;&lt;code&gt;emu.setInput&lt;/code&gt; port indices are 0-based (port 0 = P1) — confirmed by $4219 latching start+down set on port 0.&amp;rdquo; That &amp;ldquo;confirmation&amp;rdquo; pressed buttons on port 0 and saw them arrive on port 0&amp;hellip; Except that with Claude&amp;rsquo;s buggy interpretation, &lt;em&gt;everything&lt;/em&gt; arrives on port 0, so the test could not have failed. The fix came from a test that could: one button on each port, two different registers&amp;hellip; the pattern broke and then came the analysis and the fix. Not exactly a detail since literally 296 of our 407 Lua files call &lt;code&gt;emu.setInput&lt;/code&gt;, and thus depends on that third argument being properly used.&lt;/p&gt;
&lt;h2 id=&quot;just-because-the-harness-is-code-doesnt-mean-its-right&quot;&gt;Just because the harness is code doesn&amp;rsquo;t mean it&amp;rsquo;s right&lt;/h2&gt;
&lt;p&gt;A harness is code, and while code can&amp;rsquo;t &amp;ldquo;lie&amp;rdquo;, it can mislead. This one lied in four memorable ways.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;A flag that did nothing.&lt;/strong&gt; The first &lt;code&gt;run.sh&lt;/code&gt; passed &lt;code&gt;--debug.scriptWindow.scriptTimeout=300&lt;/code&gt;. It rode along on every run for about four weeks, until a measurement on 6 August (issue #52) showed it has no effect under &lt;code&gt;--testrunner&lt;/code&gt;: &amp;ldquo;every Lua entry (script load and each callback) is capped at a hard 1 second whatever value is passed, so the flag was dead cargo&amp;rdquo;. The comment in &lt;code&gt;run.sh&lt;/code&gt; still says so, so nobody adds it back.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Errors that vanish.&lt;/strong&gt; Inside a Mesen memory callback, an error kills the hook without a message. A celebrated fix that added an &lt;code&gt;assert&lt;/code&gt; &amp;ldquo;never worked: the &amp;lsquo;fixed&amp;rsquo; script hung to timeout exactly like the unfixed one, message swallowed&amp;rdquo;.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Trap 12.&lt;/strong&gt; &amp;ldquo;Anything thrown inside a Mesen memory callback dies WITHOUT A MESSAGE — assert included. […] a fix whose effect was never OBSERVED (only reasoned about) is not fixed.&amp;rdquo;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;strong&gt;Silence that looks like an answer.&lt;/strong&gt; Trap 9 collects three cases from one session, including &amp;ldquo;the character never jumps&amp;rdquo;, which was the round&amp;rsquo;s entrance animation and the GO! banner, not an input fault, and a script that crashed on a nil and still printed &amp;ldquo;done&amp;rdquo;.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Trap 9.&lt;/strong&gt; &amp;ldquo;A probe that reports nothing is usually broken, not evidence of nothing. […] Prove the harness sees the thing before concluding the game does not do it.&amp;rdquo;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;strong&gt;The PC that pointed one instruction late.&lt;/strong&gt; This one closes the loop on &amp;ldquo;Dynamic first&amp;rdquo;. A write watch named two addresses as the code that zeroes a counter at round load. Except in the meantime I had set up documentation so that it would only accept data actually supported by the cartridge. The project&amp;rsquo;s doc checker, which re-reads the cartridge, refused to accept the documentation row. The real stores were three bytes earlier: &amp;ldquo;The session watch reports a write callback&amp;rsquo;s PC as the NEXT instruction&amp;rdquo; (&lt;a href=&quot;https://github.com/DefinitelyFrenchName/SMS-FrenchName-edition/commit/8d689d8&quot;&gt;&lt;code&gt;8d689d8&lt;/code&gt;&lt;/a&gt;). The brief&amp;rsquo;s whole method rests on &amp;ldquo;the PC of the writing instruction&amp;rdquo;, and the PC we get is the one after it. That is fine, once you know: the dynamic trace tells you &lt;em&gt;where to look&lt;/em&gt;, and the bytes tell you &lt;em&gt;what is there&lt;/em&gt;.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Trap 27.&lt;/strong&gt; &amp;ldquo;A write callback&amp;rsquo;s PC is the NEXT instruction. […] A watch&amp;rsquo;s PC FINDS a writer; the ROM NAMES it.&amp;rdquo;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;If you want to try this: the project used Mesen2 2.1.1, whose &lt;a href=&quot;https://github.com/SourMesen/Mesen2&quot;&gt;repository&lt;/a&gt; is now archived; the maintained fork is &lt;a href=&quot;https://github.com/nesdev-org/MesenCE&quot;&gt;MesenCE&lt;/a&gt;. [Note: I&amp;rsquo;ve no idea whether &lt;code&gt;run.sh&lt;/code&gt; and the &lt;code&gt;setInput&lt;/code&gt; quirk behave the same on MesenCE since I&amp;rsquo;ve not tested it.]&lt;/p&gt;
&lt;h2 id=&quot;still-a-human-in-the-loop&quot;&gt;Still a human in the loop&lt;/h2&gt;
&lt;p&gt;Alas, the bench could not replace human testing (although that&amp;rsquo;s less and less true as the projects went on). For instance, on 21 July I reported, from toying around with the Lua training mode:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;…the life refill only accurs after a normal hit. Special move damage does not trigger refill afeter 2s which leads me to think the trigger is not HP&amp;lt;96 as claimed but something else.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Claude reproduced it headlessly, with a dummy that &amp;ldquo;sat at damaged HP for 10+ seconds&amp;rdquo;, and traced it three modules deep. A projectile special&amp;rsquo;s hitbox lives on the projectile, so the frame-data tracker never saw the attacker&amp;rsquo;s move go active and left it in &amp;ldquo;startup&amp;rdquo; forever, which kept the combo open, and refill waits for the combo to close. Its reply opened with &amp;ldquo;Your instinct was right — the trigger isn&amp;rsquo;t &lt;code&gt;HP &amp;lt; max&lt;/code&gt;.&amp;rdquo; The fix shipped with a new self-test, T10, that pins the projectile case (&lt;a href=&quot;https://github.com/DefinitelyFrenchName/SMS-FrenchName-edition/commit/29f1cfe&quot;&gt;&lt;code&gt;29f1cfe&lt;/code&gt;&lt;/a&gt;).&lt;/p&gt;
&lt;p&gt;That is the division of labour in one exchange. I noticed something felt wrong in play and had a hunch about why. The agent turned the hunch into a reproduction, the reproduction into a mechanism, and the mechanism into a test that runs without me.&lt;/p&gt;
&lt;p&gt;It works the other way too. for instance, every build carries a &amp;ldquo;naked-eye tell&amp;rdquo;, a version string on the title screen (&amp;ldquo;FrenchName Rev. S-02&amp;rdquo;), so that when I report both the agents and I know which exact version I was handling. Sounds obvious but if you&amp;rsquo;re overly reliant on the agents, you tend to glaze over such details and it bites hard when you lose hours chasing a problem which exact reproduction is linked to a specific version.&lt;/p&gt;
&lt;h2 id=&quot;the-cartridge-as-oracle&quot;&gt;The cartridge as oracle&lt;/h2&gt;
&lt;p&gt;Testing has a name for the hard part: the &lt;em&gt;oracle problem&lt;/em&gt; knowing what the right answer is when there is no specification. Here, the original cartridge is the specification. Whatever the 1994 code does is, by definition, correct, except where we deliberately change it. The agents and I derived therefrom three kinds of check.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Byte-identical side effects.&lt;/strong&gt; A patch must change what it targets and nothing else. The first patch&amp;rsquo;s proof included &amp;ldquo;whiff/on-hit traces byte-identical&amp;rdquo; and a control character for whom the new code never runs (&lt;a href=&quot;https://github.com/DefinitelyFrenchName/SMS-FrenchName-edition/commit/b914e3d&quot;&gt;&lt;code&gt;b914e3d&lt;/code&gt;&lt;/a&gt;). Michael Feathers calls these characterization tests: pin down what the code &lt;em&gt;does&lt;/em&gt; before you change it (yes, this is a quote form &lt;em&gt;Working Effectively with Legacy Code&lt;/em&gt; which is a book I&amp;rsquo;d still recommend at least skimming through, even in 2026).&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Two implementations, one answer.&lt;/strong&gt; The in-ROM training mode (patch 11) is &amp;ldquo;oracle-validated&amp;rdquo; against the Lua one, feature by feature: &amp;ldquo;38/38 oracle checks&amp;rdquo; (&lt;a href=&quot;https://github.com/DefinitelyFrenchName/SMS-FrenchName-edition/commit/8ca4966&quot;&gt;&lt;code&gt;8ca4966&lt;/code&gt;&lt;/a&gt;). The precise Lua version judges the assembly version that has to fit in the cartridge.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;A chain of hashes.&lt;/strong&gt; A builder writes a complete ROM; only then does a diff tool turn clean and built images into a &lt;code&gt;.bps&lt;/code&gt; patch (&lt;a href=&quot;https://github.com/DefinitelyFrenchName/SMS-FrenchName-edition/blob/main/docs/project/how_patches_are_built.md&quot;&gt;how patches are built&lt;/a&gt;). Applying that patch to the clean ROM must reproduce the built SHA-1 exactly. A recorded hash is something a script checks, not something a person trusts.&lt;/p&gt;
&lt;p&gt;None of this needs the agent to understand the game. It needs the agent to &lt;em&gt;run&lt;/em&gt; it, alone, the same way every time. That is the multiplier: an agent that can ask the program a question and get an answer in seconds stops guessing, because guessing has become more expensive and thus less useful than measuring.&lt;/p&gt;
&lt;h2 id=&quot;from-one-game-to-any-black-box&quot;&gt;From one game to any black box&lt;/h2&gt;
&lt;p&gt;Hardened on Vampire Saved, the same idea became &lt;a href=&quot;https://github.com/DefinitelyFrenchName/BBH-frame-based&quot;&gt;its own project&lt;/a&gt;, first extracted &amp;ldquo;by asking of every piece: &lt;em&gt;would this still be true if the thing under test were not that ROM, not CPS-2, not even a game?&lt;/em&gt;&amp;rdquo;. But that&amp;rsquo;s a story from another time.&lt;/p&gt;</content>
  </entry>
  <entry>
    <title>It&#x27;s 1994 and Sailor Uranus is broken.</title>
    <link href="https://alexrichard.org/blog/it-s-1994-and-sailor-uranus-is-broken.html"/>
    <id>https://alexrichard.org/blog/it-s-1994-and-sailor-uranus-is-broken.html</id>
    <published>2026-11-08T12:00:00Z</published>
    <updated>2026-11-08T12:00:00Z</updated>
    <summary>To rekindle an old pet project, I gave a coding agent a 1994 Super Famicom fighting game, an emulator and one cardinal rule, keeping the decisions myself.</summary>
    <category term="agentic-engineering" label="agentic engineering"/>
    <category term="black-box-development" label="black-box development"/>
    <category term="sailor-moon-s" label="Sailor Moon S"/>
    <category term="romhacking" label="romhacking"/>
    <content type="html" xml:base="https://alexrichard.org/blog/">&lt;p&gt;At 23:03 on a Thursday in July 2026 I committed four files to an empty repository: a one-page brief, a hitbox table, an address card and a 65-line Python extractor. At 01:37 the next morning, a coding agent committed a 12-byte patch that fixes a thirty-year-old infinite combo in &lt;em&gt;Bishoujo Senshi Sailor Moon S: Jougai Rantou!? Shuyaku Sōdatsusen&lt;/em&gt;, a 1994 Super Famicom fighting game. A fix that had been on my mind for years and that I had put on the backburner after doing some memory mapping and concluding this was perfectly doable but also very time-consuming.&lt;/p&gt;
&lt;p&gt;That was the first evening. The brunt of the work was done in two days: that night, and a weekend ten days later when Claude took the engine apart system by system, covering damage, stats, throws and every special move of every character. The rest of the two months was piling up new patches and many more tests, testing the limits of what the agents could do, and starting to build my ongoing framework for agent-driven black-box engineering. &lt;/p&gt;
&lt;p&gt;But first, a bit of context.&lt;/p&gt;
&lt;h2 id=&quot;a-game-that-is-broken-in-all-the-best-ways&quot;&gt;A game that is broken in all the best ways&lt;/h2&gt;
&lt;p&gt;&lt;em&gt;Sailor Moon S&lt;/em&gt; came out in Japan on 16 December 1994, published by Angel (a subsidiary of Bandai). What is not common knowledge is that the developer was none other than Arc System Works, 4 years before the first &lt;em&gt;Guilty Gear&lt;/em&gt; and decades before becoming one of the handful of legendary-grade names in the fighting game genre. This actually was the first fighting game the studio ever made and I am in awe of what they acheived. &lt;/p&gt;
&lt;p&gt;Indeed the game is remarkably feature-packed and forward thinking: featuring backdashing, guard cancelling, reversals, desperation moves, and even super jump (well.. for one of the characters). To be fair, the same year 1994, Vampire/Darkstalkers would blow that out of the water&amp;hellip; but in arcades, on state-of-the-art CPS-II hardware. Sailor Moon S  is a SNES game, about a tenth of the size running on a fraction of the CPS-II computing power. Oh and did I mention the game has separate hurtboxes and data for head and body?&lt;/p&gt;
&lt;p&gt;This being said, the game is not without faults. It has a few bugs and is, at first glance outrageously broken because most of the moves are way too good. But in the face of that, ArcSys dared do the unthinkable: instead of nerfing broken characters and make everyone fair but dull, they instead basically buffed everyone to the point where everyone stands a chance. Simply put: universal mechanics like invincible back dashing and guard cancelling give you a chance against anyone. The game is still brutal but it is extremely fun and rewarding and that&amp;rsquo;s why it still has a &lt;a href=&quot;https://www.youtube.com/watch?v=yMN3EA54kW4&quot;&gt;competitive scene thirty years later, and a small but very dedicated community&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;All is good then? Well.. I might have lied by omission. Everyone does have a chance but Sailor Uranus is broken to such an extent that most of the community decided to ban her. The reason is two-fold and both are linked to her forward dash: 1) she has an easy infinite  (i.e. an infinite damage loop) and 2) she has a bug in her programming that makes her dash invincible post hard knockdown. I had no idea about the root cause of the second bug but the infinite I knew all about and, perhaps more importantly, I knew how I wanted to fix it.&lt;/p&gt;
&lt;p&gt;So my brief to the agents was surgical and could be paraphrased as &amp;ldquo;don&amp;rsquo;t rebalance the game, keep the loop, but make each repetition require a press timed to a single frame: one sixtieth of a second, with no input buffer to help.&amp;rdquo;&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Note: frames.&lt;/strong&gt; The console redraws the screen 60 times a second, and fighting games count everything in those ticks. A move with &amp;ldquo;3 frames of startup&amp;rdquo; hits 50 ms after you press the button. A &amp;ldquo;1-frame link&amp;rdquo; means the next press must land inside one specific 16.7 ms window. That is &lt;em&gt;very&lt;/em&gt; hard, but humans can learn it.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;h2 id=&quot;no-source-code-only-the-cartridge&quot;&gt;No source code, only the cartridge&lt;/h2&gt;
&lt;p&gt;There is no source available for this game. All I could rely on was a dump of the 2.5 MB ROM from my own copies of the game, the community&amp;rsquo;s knowledge (frame data on Dustloop, a RAM map in an existing training-mode script), my own exploratory notes and an emulator.&lt;/p&gt;
&lt;p&gt;I brought very little else from outside. The SNES itself is about as well documented as hardware gets. This game&amp;rsquo;s &lt;em&gt;code&lt;/em&gt; is not. A few community members know it extraordinarily well, the community-standard training-mode script answers a lot of questions, and most of the frame data is known. But the engine itself, and the mapping from what you see on screen to the bytes that cause it, were largely uncharted.&lt;/p&gt;
&lt;p&gt;Looking a the agents working, what became clear very quickly was that the obstacle wouldn&amp;rsquo;t be the complexity of the assembly. It was the &lt;em&gt;size&lt;/em&gt; of the codebase. A 2.5 MB cartridge, or 2.5 + 3 MB once the sequel joined in, is small enough for Claude to hold the whole problem at once. (My next project, a CPS-II arcade game with a romset of about 45 MB, would need to be taken bit by bit. But even so, as long as you can carve out proper scopes, the sky is the limit.)&lt;/p&gt;
&lt;p&gt;The setup I designed, and later generalised, works like this:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Mesen2, headless.&lt;/strong&gt; The agent boots the game with no window, drives the controllers from Lua scripts, and reads memory every frame.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Probes.&lt;/strong&gt; Hundreds of small Lua scripts each answer one question (&amp;ldquo;what writes to this byte, and when?&amp;rdquo;) and write a trace file the agent can grep.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Builders, not patches.&lt;/strong&gt; For each change, a Python script reads the clean ROM, edits the bytes, writes a new ROM, and only then &lt;em&gt;diffs&lt;/em&gt; the two into a BPS patch file. Every build is checked by SHA-1.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Human testing.&lt;/strong&gt; Nothing ships until someone has played it.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The brief&amp;rsquo;s own plan put it in two words: &lt;em&gt;dynamic first&lt;/em&gt;. Don&amp;rsquo;t start by reading assembly. Instead press the buttons on the emulator, watch which memory changes and which instruction changed it, and only then open the disassembler at that address, as a human would.&lt;/p&gt;
&lt;h2 id=&quot;the-first-evening&quot;&gt;The first evening&lt;/h2&gt;
&lt;p&gt;The commit log of that first night reads like a lab notebook:&lt;/p&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Time&lt;/th&gt;
&lt;th&gt;Commit&lt;/th&gt;
&lt;th&gt;What happened&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;23:30&lt;/td&gt;
&lt;td&gt;&lt;a href=&quot;https://github.com/DefinitelyFrenchName/SMS-FrenchName-edition/commit/6641fc3&quot;&gt;&lt;code&gt;6641fc3&lt;/code&gt;&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Headless emulator harness running.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;23:58&lt;/td&gt;
&lt;td&gt;&lt;a href=&quot;https://github.com/DefinitelyFrenchName/SMS-FrenchName-edition/commit/3ab1680&quot;&gt;&lt;code&gt;3ab1680&lt;/code&gt;&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;The agent maps how the title menu reads the controller (a 4-frame polling cadence), because a robot has to get past the menus before it can play.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;00:11&lt;/td&gt;
&lt;td&gt;&lt;a href=&quot;https://github.com/DefinitelyFrenchName/SMS-FrenchName-edition/commit/183fd0b&quot;&gt;&lt;code&gt;183fd0b&lt;/code&gt;&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;It finds an off-by-one in the &lt;em&gt;emulator&amp;rsquo;s&lt;/em&gt; Lua API: the controller port is the third argument, not the second. Input injection now works.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;00:27&lt;/td&gt;
&lt;td&gt;&lt;a href=&quot;https://github.com/DefinitelyFrenchName/SMS-FrenchName-edition/commit/a8d75a7&quot;&gt;&lt;code&gt;a8d75a7&lt;/code&gt;&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;It navigates from boot to a live match, Uranus against Moon, with no human input (it pokes the character-select cursor rather than pressing buttons there), and saves a savestate as a test fixture.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;00:50&lt;/td&gt;
&lt;td&gt;&lt;a href=&quot;https://github.com/DefinitelyFrenchName/SMS-FrenchName-edition/commit/252bdf1&quot;&gt;&lt;code&gt;252bdf1&lt;/code&gt;&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;It measures the loop as the brief described it, starting from crouching light punch.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;01:14&lt;/td&gt;
&lt;td&gt;&lt;a href=&quot;https://github.com/DefinitelyFrenchName/SMS-FrenchName-edition/commit/038785b&quot;&gt;&lt;code&gt;038785b&lt;/code&gt;&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;Retarget.&lt;/strong&gt; The measurement shows the loop the community actually uses is crouching heavy punch cancelled into a forward dash. My brief named the wrong move.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;01:37&lt;/td&gt;
&lt;td&gt;&lt;a href=&quot;https://github.com/DefinitelyFrenchName/SMS-FrenchName-edition/commit/b914e3d&quot;&gt;&lt;code&gt;b914e3d&lt;/code&gt;&lt;/a&gt;&lt;/td&gt;
&lt;td&gt;Patch shipped.&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;The last commit message is worth quoting, because it shows what &amp;ldquo;done&amp;rdquo; meant:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Patch (12 bytes): reroute the handler&amp;rsquo;s cancel-check through a stub in verified-free space $C1:BE20 gating on step tick &amp;lt; 4, delaying dash-out by exactly 6 frames. Loop continuation collapses from a 7-frame window to 1 frame […]. Proven: +1f gate test, whiff/on-hit traces byte-identical, Moon unaffected (stub never executes), 3-rep frame-perfect infinite still lands vs blocking P2, BPS round-trip.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Let&amp;rsquo;s look at the shape of that proof:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;positive case:&lt;/strong&gt; the infinite loop still works if you are frame-perfect&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;negative case:&lt;/strong&gt; it no longer works if you are not&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;side effects:&lt;/strong&gt; byte-identical traces where nothing should change&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;control:&lt;/strong&gt; another character, for whom the new code never runs&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;That shape became the project&amp;rsquo;s standard.&lt;/p&gt;
&lt;p&gt;The same morning, the agent went after the other bug which the community largely agrees is the main reason Uranus should stay banned. It has been labbed it thoroughly and Inva&amp;rsquo;s video &lt;a href=&quot;https://www.youtube.com/watch?v=Ra75x_Ooc2M&quot;&gt;What makes Sailor Uranus so broken?&lt;/a&gt; explains it with footage. What was not readily available was the exact implementation mechanism of the invincible forward dash bug (I have no doubt at least a handful of experts knew but I wouldn&amp;rsquo;t blame them for not documenting every little case). &lt;/p&gt;
&lt;p&gt;It turns out that after a knockdown, every character loses its invulnerability when it starts an action, except Uranus&amp;rsquo;s forward dash, whose handler alone skips the one instruction that clears it. Dash on wake-up and you stay invulnerable for the whole dash. A thirty-year-old bug, root-caused and fixed in 10 bytes (&lt;a href=&quot;https://github.com/DefinitelyFrenchName/SMS-FrenchName-edition/commit/ed68e31&quot;&gt;&lt;code&gt;ed68e31&lt;/code&gt;&lt;/a&gt;).&lt;/p&gt;
&lt;p&gt;What truly surprised me most that night was that Claude didn&amp;rsquo;t just find the code, it &lt;em&gt;interpreted&lt;/em&gt; it. We&amp;rsquo;re not talking decompilation here but interpretation of the codebase, without source. Furthermore, because LLMs are trained on material that includes fighting game jargon, Claude explained the code using FGC terms. And that has major benefits.&lt;/p&gt;
&lt;p&gt;See, fighting-game players share a precise lingo: a &lt;em&gt;meaty&lt;/em&gt; is an attack timed to hit on the opponent&amp;rsquo;s first frame of wake-up, a &lt;em&gt;true combo&lt;/em&gt; can&amp;rsquo;t be blocked between hits, and a &lt;em&gt;link&lt;/em&gt; are 2 moves that combo but that you can&amp;rsquo;t buffer: you have to input exactly on time. Consequently, arcane as it might sound: &amp;ldquo;make the forward dash into light punch a 1-frame link, but keep it a true combo, not a meaty&amp;rdquo; was a complete and unambiguous spec, and the commit messages and docs that came back used the same words in the same senses.&lt;/p&gt;
&lt;p&gt;One honest caveat: that evening was not a cold start. The four files in the first commit were the product of my own earlier memory-mapping, and the RAM map came from an existing community training mode. The agent was fast because it started on solid ground.&lt;/p&gt;
&lt;h2 id=&quot;then-it-kept-going&quot;&gt;Then it kept going&lt;/h2&gt;
&lt;p&gt;The first week ended with a handful of balance patches and a palette pack. Then the project sprawled:&lt;/p&gt;
&lt;div class=&quot;nowrap-first&quot;&gt;
&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Week&lt;/th&gt;
&lt;th&gt;Commits&lt;/th&gt;
&lt;th&gt;What it was about&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Jul 9–12&lt;/td&gt;
&lt;td&gt;19&lt;/td&gt;
&lt;td&gt;Harness, first patches&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Jul 13–19&lt;/td&gt;
&lt;td&gt;117&lt;/td&gt;
&lt;td&gt;More patches, a training mode (first in Lua, then &lt;em&gt;inside&lt;/em&gt; the ROM), and a deep engine campaign: damage formula, stat system, throws, every special move of every character&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Jul 20–26&lt;/td&gt;
&lt;td&gt;17&lt;/td&gt;
&lt;td&gt;Player feedback, a README, the first &amp;ldquo;reference&amp;rdquo; bundle&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Jul 27–Aug 2&lt;/td&gt;
&lt;td&gt;91&lt;/td&gt;
&lt;td&gt;A full review of the codebase by two different AI models, then the big swerve: porting Sailor Saturn from the sequel, &lt;em&gt;Super S&lt;/em&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Aug 3–9&lt;/td&gt;
&lt;td&gt;257&lt;/td&gt;
&lt;td&gt;Saturn becomes playable, gets her voice, her stage, her nameplate. Releases. Then an audit of every claim in the docs&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Aug 10–16&lt;/td&gt;
&lt;td&gt;40&lt;/td&gt;
&lt;td&gt;The measurement rule becomes rule #1. Lessons distilled into agent skills&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Aug 17–Sep 5&lt;/td&gt;
&lt;td&gt;33&lt;/td&gt;
&lt;td&gt;An experiment: can this game become an &amp;ldquo;anime fighter&amp;rdquo;, with air dashes and juggles? (Yes.)&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;/div&gt;
&lt;h2 id=&quot;what-came-out&quot;&gt;What came out&lt;/h2&gt;
&lt;p&gt;&lt;strong&gt;Patches.&lt;/strong&gt; There are 18 patches, mostly independent and compatible with one another so anyone curious can pick their poison.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;a href=&quot;https://github.com/DefinitelyFrenchName/SMS-FrenchName-edition/tree/main/docs/game&quot;&gt;Documentation.&lt;/a&gt;&lt;/strong&gt; This is the part I am happiest with, and agents did most of the writing, and the docs are regenerated from the latest data available. &lt;code&gt;docs/game/&lt;/code&gt; holds data-focused analysis of the &lt;em&gt;original&lt;/em&gt; game, written for anyone hacking it whether or not they care about my own patches:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;memory maps&lt;/li&gt;
&lt;li&gt;the 128-byte object structure that every fighter and projectile lives in, byte by byte&lt;/li&gt;
&lt;li&gt;the damage pipeline&lt;/li&gt;
&lt;li&gt;the stat system&lt;/li&gt;
&lt;li&gt;sound&lt;/li&gt;
&lt;li&gt;menus&lt;/li&gt;
&lt;li&gt;every special move&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;A section titled &amp;ldquo;The holes — what is genuinely not known&amp;rdquo; lists what we did not figure out. A checker script re-derives the docs&amp;rsquo; claims from the cartridge. The day it learned to check addresses, it disproved five very confident statements ins the projects&amp;rsquo; documentation (&lt;a href=&quot;https://github.com/DefinitelyFrenchName/SMS-FrenchName-edition/commit/0d4bbfd&quot;&gt;&lt;code&gt;0d4bbfd&lt;/code&gt;&lt;/a&gt;). &lt;/p&gt;
&lt;p&gt;Two pages are drawn for easier access and legibility: &lt;a href=&quot;https://definitelyfrenchname.github.io/SMS-FrenchName-edition/&quot;&gt;the data architecture&lt;/a&gt; and &lt;a href=&quot;https://definitelyfrenchname.github.io/SMS-FrenchName-edition/frame.html&quot;&gt;one frame, as the cartridge runs it&lt;/a&gt;. If you have no idea the kind of write-up you can get from raw data and notes in minutes providing you&amp;rsquo;re willing to actually guide the AI, I highly encourage you take a look at them.&lt;/p&gt;
&lt;p&gt;The contrast with the tests is worth stating. With proper guidance and feedback, the explanations Claude wrote on demand were remarkably readable; those two drawn pages are the best example. Its &lt;em&gt;tests&lt;/em&gt; were weaker in one specific way: they kept leaning on inner wording, matching a message&amp;rsquo;s text or an internal name instead of the behaviour behind it. One health check grepped for the words &amp;ldquo;ALL PASS (&amp;rdquo; and broke when a colour code slipped between them (&lt;a href=&quot;https://github.com/DefinitelyFrenchName/SMS-FrenchName-edition/commit/d20ae9a&quot;&gt;&lt;code&gt;d20ae9a&lt;/code&gt;&lt;/a&gt;). Post 7 has the rest of that story.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;A memory for the agent.&lt;/strong&gt; The agent forgets everything between sessions. What carried two months of work:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;code&gt;HANDOFF.md&lt;/code&gt;, an operational map that grew to 1,620 lines&lt;/li&gt;
&lt;li&gt;28 numbered &amp;ldquo;traps&amp;rdquo;, each paid for by a specific mistake&lt;/li&gt;
&lt;li&gt;four tiers of &lt;em&gt;skills&lt;/em&gt;: rule books the agent loads, each with a human-readable twin and a script that keeps the two identical&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Tooling.&lt;/strong&gt; About 400 Lua scripts and 80 Python tools. They include an assembler and a disassembler for the console&amp;rsquo;s 65816 CPU, the latter cross-checked against a different author&amp;rsquo;s disassembler on 5,051 consecutive instructions. The harness idea was later extracted into its own project, &lt;a href=&quot;https://github.com/DefinitelyFrenchName/BBH-frame-based&quot;&gt;a generic frame-based black-box harness&lt;/a&gt;; that is a future series.&lt;/p&gt;
&lt;h2 id=&quot;who-did-what&quot;&gt;Who did what&lt;/h2&gt;
&lt;p&gt;From the README, in my own words:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Some of the memory analysis, all the decisions, the automated test harness design and a disgusting amount of testing was made by an organic brain. However all the assembly heavy lifting and the immense majority of lua and python scripting was done by Claude.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;What I did do:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Decided.&lt;/strong&gt; The model offered options with a recommendation, and I picked one or rewrote the question.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Played.&lt;/strong&gt; Every release was tested, by humans. Several builds were retired on that field verdict alone, and one fix that passed every check was still wrong, because it reproduced the outcome I had described rather than the mechanism I had asked for. The agent measures what it is told to measure; I noticed when that was not what I meant.&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;Set the rules.&lt;/strong&gt; The most important one is in the next section.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;From the beginning, it felt strange compared to LLMs of yesteryear because the agents spoke the right lingo and ran akin to an actual literal team. But the thing that struck me wasn&amp;rsquo;t so much the tirelessness or ability of the agents but how they acted like a bunch of ADHD brains running on amphetamines: potentially brilliant, needing no sleep, hyper-focused but with the memory of a goldfish and more than anything: as confident as a stock trader from the 80s. I would lie if I said I didn&amp;rsquo;t feel elation as much as I felt terrified. However this is not a new risk: human teams are prone to exhibit the same kind of behaviours and I happen to have extensive experience on how to manage such risks.&lt;/p&gt;
&lt;h2 id=&quot;the-one-rule&quot;&gt;The one rule&lt;/h2&gt;
&lt;p&gt;About a month in, I wrote this down as a standing rule, before the next piece of work rather than in reaction to a particular mistake. It became the first section of the agent&amp;rsquo;s instructions:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;When you don&amp;rsquo;t know you measure, when you think you know you measure to check against the measurement, and when you&amp;rsquo;re sure you don&amp;rsquo;t have to measure is precisely when you absolutely must measure. The source of truth is the original code.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;The agent&amp;rsquo;s own paraphrase, which it kept in its notes: &lt;em&gt;unmeasured certainty is the failure signal, not the safety signal.&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;A coding agent writes confident prose at exactly the same speed as correct prose. You cannot tell the two apart by reading, only by measuring.&lt;/p&gt;
&lt;p&gt;The repository, patches and docs are on &lt;a href=&quot;https://github.com/DefinitelyFrenchName/SMS-FrenchName-edition&quot;&gt;GitHub&lt;/a&gt;. &lt;/p&gt;</content>
  </entry>
</feed>
