Step 12: Gaming the gate
Step 12: Gaming the gate
The twelfth step of the harness I put around my coding agents: five ways to keep a check honest when the agent it judges could edit it.
Part of the series: Codebase Harness, Step by Step · View all parts
Previously in this series: Step 11: A state machine whose every case is decided before it compiles
Your agent turned the lint gate green. Did it fix the error, or turn the rule off? A check the agent can edit is no longer a check. Protect what your gates read, not only the code they judge.
Two dimensions. A guide acts before the agent, a sensor after. Each is inferential, judged by a model, or computational, decided by a program. Inferential guides are what the agent reads, AGENTS.md, a skill, a plan, sharper written in the literature's words; computational guides are deterministic tools, a codemod, a generator, a command that acts in the agent's place, code mode, where the agent writes a program instead of a string of actions, a language server. Inferential sensors are a review by a model or a person; computational sensors are the type checker, the linter, tests and fitness functions. Each practice moves a judgement toward computation, and the computational sensor is the optimum.
- 4 · literature in skills
- 5 · skills
- 1 · type checker
- 2 · linter
- 3 · dead code
- 6 · fitness functions
- 7 · plan in phases
- 8 · files per phase
- 9 · model per phase
- 10 · snapshot
- 11 · state machine
- 12 · anti-gamingtoday
In Birgitta Böckeler's grid of guides and sensors, a gate is a computational sensor. One the agent can rewrite measures what the agent wants: a measure that becomes a target stops being a good measure. The series' map: Guides and Sensors: Mapping Your Attention to Free It
Five ways to keep a check honest
First, protect the files a gate reads: the linter's config, the tsconfig, the test runner's config, a baseline of accepted violations. Refuse the agent's write, and check the commit anyway.
The files a gate reads include its code. I protected my baselines, not the scripts that write and check them: the agent could have taught the check to accept more, and the gate would have passed. Protect the checker with what it checks.
Second, a disable comment names its rule and says why, after --. No blanket disable. A person reads the reason: that is where judgement belongs. A cast, x as T, is the type checker's disable comment: it claims a type nothing checked. Same rule.
Third, a ratchet: the exceptions are counted, and the count can only go down.
Fourth, the judge is not the maker. The harness runs the gates; the agent's word that they passed counts for nothing.
Fifth, each check must be able to fail. Break the code on purpose, one mutant at a time: a test that still passes checks nothing.
Separation of duties goes back to Saltzer and Schroeder (1975), the measure turned target to Goodhart, in Marilyn Strathern's words (1997). Both, with their sources: foundations.steme.dev/practices/separation-of-duties
If you want an example, here is the list of files my repo keeps from its agent: lbdremy/phax/phax.json
Next in this series: Step 13: A warning is a green light
A thought after reading?
If you would like to discuss about this article, you can write to me here. I share because I care and I want to learn. Please teach me with care.