A script that blocks a step

Think of it when a rule must hold every time, and the agent sometimes forgets it.

In everyday life

It is like the ticket gate at a train station: it checks every ticket before the traveller gets through, whether or not they remember the rules. A camera that films people after they pass stops nobody.

One case

A school’s grade system has a rules file that says “run the type checkerA program that reads the code, without running it, and reports any value used as the wrong kind. before every commit”. In one week the agent makes 20 commits and runs the check before 17. The 3 unchecked commits each break the build, and each one costs a developer 30 minutes. The team adds a hook that runs the check before every commit and blocks the commit when the check fails, and the next week no broken commit gets in.

The written rule held 17 times out of 20
The case, cell by cell1 cell = 1 day
Commits made
44444
Commits checked first
43433
Broken commits
3
The week after the hook
0
The week before the hook. Each unchecked commit broke the build.

Every case

Text in a rules file is a request. The agent usually obeys it, and usually is not enough for a rule that must always hold. A blocking hook runs whether or not the agent remembers, stops the step when its check fails, and shows the agent the message, so write that message to name the fix. Git’s own commit hooks can be skipped with a flag, so also deny that flag in the agent’s permissions.

The word

Engineers call this

hookA small script that the agent’s tool, or git, runs automatically at a fixed point, such as before a command or before a commit. A blocking hook that runs before a step can stop it and tell the agent why; a hook that runs after the step, or only sends a notice, cannot undo it.

When a rule must hold every time, enforce it with a blocking script that runs before the step where it matters. Keep written rules for the judgment calls a script cannot check.

Where this idea leads

Skills that encode it

  • principle-encode-lessons-in-structure pstackA recurring correction becomes a runtime check or script instead of more text: the instruction is the symptom.
  • correct pstackPrefers a check whose error names the fix, proved to fail on a real past mistake, over a written agent rule.