DEV Community

Cover image for The 3-check rule I use before I accept any AI coding task (free repo inside)
Heinrich Neb
Heinrich Neb

Posted on Edited on AI-assisted

The 3-check rule I use before I accept any AI coding task (free repo inside)

An AI wrote 13 tests for me. All 13 were green. I was pleased for about a minute. Then I saw that the line they were meant to test was commented out. The tests had never touched my code.

After that I wrote down what I check before I accept any task from an agent. It is three things. I can remember them without a note, and so can you.

The rule

  1. Checks. Something with an exit code ran: tests, build, lint. Not "I looked at it".
  2. Controls. At least one check was pointed at something broken, and it failed. It had to.
  3. Locked acceptance. The agent could not edit the test that decides if it is done.

If one of the three is missing, the task is not done. It is a claim.

Why these three

Checks are obvious, and they are still the most skipped. "Build: pass" showed up in an agent's report three times in six weeks. Each time the server did not start. The build passed. Nobody had run the thing.

Controls answer the 13-tests problem. A check that has never failed might be a check that cannot fail. The cure is cheap. Run the same test with the feature switched off, or against an old fixture, or against a file you know is broken. It must go red. If it stays green, your check is decoration.

Locked acceptance answers the cheapest cheat there is. An agent has two ways to turn a red test green. It can fix the code, or it can fix the test. Both look like progress in a diff. So you pin the acceptance file with a hash before the agent starts. If the hash changes, the verdict is red, whatever the test now says.

Enforce it with one file

The rule works as a habit, but habits slip at 6 pm. proof-gate is a single Node file (18+) that enforces all three. MIT, no dependencies, 8 tests of its own.

git clone https://github.com/cachly-dev/proof-gate
cp proof-gate/proof-gate.mjs ./proof-gate.mjs
Enter fullscreen mode Exit fullscreen mode

Describe the task in proof-gate.json:

{
  "tasks": {
    "export-csv": {
      "locked": ["test/export-csv.test.mjs"],
      "checks": [
        { "name": "acceptance", "run": "node --test test/export-csv.test.mjs" },
        { "name": "build", "run": "npm run build" }
      ],
      "controls": [
        {
          "name": "fails on the old exporter",
          "run": "node --test test/export-csv.test.mjs",
          "env": { "USE_OLD_EXPORTER": "1" }
        }
      ]
    }
  }
}
Enter fullscreen mode Exit fullscreen mode

Here is how each line of the rule maps to the file:

  • checks is rule 1.
  • controls is rule 2. Each control must exit non-zero.
  • locked is rule 3.

You pin the acceptance files once, then commit the pin:

node proof-gate.mjs lock export-csv
git add .proof-gate/locks.json proof-gate.json && git commit -m "pin export-csv acceptance"
Enter fullscreen mode Exit fullscreen mode

Anyone, human or agent, then runs:

node proof-gate.mjs export-csv
Enter fullscreen mode Exit fullscreen mode
TASK: export-csv
GATE: 0 (3/3)
RECEIPT: .proof-gate/receipts/export-csv.json
NOTE: -
Enter fullscreen mode Exit fullscreen mode

What each failure looks like

The agent edits the locked test:

TASK: export-csv
GATE: 1 (0/3)
RECEIPT: .proof-gate/receipts/export-csv.json
NOTE: locked file changed: test/export-csv.test.mjs
Enter fullscreen mode Exit fullscreen mode

The control passes when it should fail:

TASK: export-csv
GATE: 1 (2/3)
RECEIPT: .proof-gate/receipts/export-csv.json
NOTE: control passed, so the check cannot say no: fails on the old exporter
Enter fullscreen mode Exit fullscreen mode

You forgot to write any control:

TASK: export-csv
GATE: 2 (refused)
RECEIPT: -
NOTE: no controls: a check nobody has seen fail is not a check yet (add one that must fail)
Enter fullscreen mode Exit fullscreen mode

Exit code 2 means refused. It is never green. The gate would rather say nothing was judged than give you a green it did not earn.

The block for CLAUDE.md or AGENTS.md

Copy this as is:

## Done means
- A task is done when `node proof-gate.mjs <task>` exits 0. Paste its four lines.
- Never edit files listed under "locked". If the test is wrong, stop and say so.
- If a control passes, fix the check, not the control.
- "It should work" is a plan, not a result. Run it.
Enter fullscreen mode Exit fullscreen mode

The second line matters most. It gives the agent a legal move when it thinks the test is wrong: stop and tell you. Without that line, editing the test looks like the only way forward.

Using the rule without the tool

If you do not want a tool, use the rule as a review question. When an agent says a task is done, ask three things in this order:

  1. "Which command did you run, and what was its exit code?"
  2. "Which run failed on purpose, and what did it show?"
  3. "Which files did you change? Is the acceptance test among them?"

If the answers come back as a command, a failure and a file list, you can accept. If they come back as "it should work", you cannot. The tool only saves you from asking and from trusting the answer.

What it does not do

It does not judge whether your tests are good. It only refuses to call a task done when the three basics are missing. A weak test with a good control is still a weak test. But it is a weak test you have seen fail once, which is more than most of mine had.

Try it tonight

Take the next small task you hand to an agent. Before it starts, write down one check, one control and the one file you will lock. Then see whether the agent comes back with a receipt or with a sentence.

The full version of this method, with task packs, a model ladder and a ledger, is a free ZIP. Leave your address at cachly.dev/forge and the download link arrives after you confirm. Nothing more than that.

Which of the three would catch the most in your last week of agent work?


I build cachly. It keeps what you explain to your AI: your rules, your decisions and the bugs you already solved. Claude Code, Cursor, Copilot and the others read it in every session, for you alone or for your whole team, and every lesson carries the name of whoever learned it.

Try it, in increasing order of commitment:

  • 30 seconds, no account: npx @cachly-dev/mcp-server@latest demo in any git repo. It reads your log locally and prints what an assistant would already know about the project. After npx fetches the package, the command makes no network calls.
  • Claude Code plugin: /plugin marketplace add cachly-dev/cachly-mcp, then /plugin install cachly-brain@cachly.
  • 5 minutes, free tier: npx @cachly-dev/mcp-server@latest autopilot writes the MCP configuration for whichever assistant you use.
  • Or from the web: cachly.dev · free tier, servers in Germany.

On Product Hunt from 1 December: cachly on Product Hunt. Follow it there if you want a note on launch day.

Written with AI assistance.

Top comments (0)