Le secrétaire de Fernand

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.

2 min read

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.

Böckeler's grid

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.

Inferentiala model judges, your attention follows
Computationala program decides, without your attention
Guidesbefore the agent acts
  1. 4 · literature in skills
  2. 5 · skills
toward computation
a codemod · a generator · a command (CLI) · code mode · a language server
Sensorsafter the agent acts
a review by a model or a person
toward computation
the optimum
  1. 1 · type checker
  2. 2 · linter
  3. 3 · dead code
  4. 6 · fitness functions
  5. 7 · plan in phases
  6. 8 · files per phase
  7. 9 · model per phase
  8. 10 · snapshot
  9. 11 · state machine
  10. 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

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.

Send me an emailremy@lesecretairedefernand.co