writingmaclulich.com

Make your AI coding agent hooks fire once, or they become noise

The argument in 58 seconds, with music. The counts are from my two Macs on 5 and 6 November 2026, and the merge hook is too new to call a result.

Three changes that keep an AI coding agent’s hooks from turning into noise

  1. Make a reminder fire once, and again only for something newMine fired 689 times in a day and 365 were repeats. The 24 after I changed it had none.
  2. Give each moment its own hook, such as the edit and the mergeMine are notes, never gates, and the merge one has fired three times, all on 6 November.
  3. Point a hook at the guide that owns the rule, by where it’s installedAn agent patched 88 lines anyway because the guide its reminder named wasn’t in its checkout.
The numbers are mine: Claude Code agents on my two Macs, 5 and 6 November 2026.

Make a reminder fire once

This is for you if your AI coding agents have a hook, a script their tool runs automatically, that reminds them of something, and you want them to keep listening. I run mine with Rigby, my own harness for several of them at once.

In part 1, a hook caught my agents editing a file with two fixes in 30 days and pushed them to redesign it instead of patching. Getting it quiet took longer than getting it to fire.

The first version reminded an agent on every edit to such a file, every time. Two days after it went in, Rigby’s disk cleanup, the code that frees up my disk, took another patch anyway.

The first version fired 689 times in a day. Now it fires once per file, and again only on a new fix

689
reminders in one day
365
repeated one that agent already had for the same file
24
by the next morning, after the change, none a repeat
Claude Code agents on my two Macs, 5 November 2026, by Sydney date. Repeats counted per agent transcript.

So it now fires once per file per session, and again only when another fix lands on that file. A reminder that repeats itself gets read as noise.

If you write a reminder hook, key it on the file and its fix count, and keep a small state file of what it has already said in the session.

Give each moment its own hook

Patching isn’t the only moment I wanted to catch. Agents also merge, so a second hook, built the same way, now reminds them to audit each merge.

Two hooks now catch my agents with nobody watching: one when they patch, one when they merge

  1. When an agent edits a hotspotA file with two fixes in 30 days: redesign it, starting from the structure audit, feature design and one-owner guides
  2. When an agent mergesThrough rig (Rigby’s merge command), git or gh: audit the structure, merge duplicate tests, delete dead Python
  3. Once eachPer file and fix count, or per merged commit, in each session
  4. Never a gateA note after the edit or merge, never a block in front of it
Claude Code and Codex, wired the same on both my Macs, 6 November 2026.

They’re two of the ten hooks in my set, each with one job, listed in one doc. Each owns one moment and points at the guide that owns the rule.

What the agent sees after a merge, simplified

A merge landed (<commit>): <n> files changed.
Run the post-merge audits now, before continuing.
Structure audit on this merge's whole diff.
Test audit on the tests that came in: delete or merge
duplicates into the test that already owns the behaviour.
Python census: delete any dead Python this merge left behind.

The hook doesn’t restate the rule, so a rule changes in one place. That only works if the agent can open the guide.

Point hooks at the guide by where it’s installed

In part 1, a Neuma agent (Neuma is a product I’m building) patched a hotspot anyway, adding 88 lines, because the guide its reminder pointed to wasn’t in that checkout.

A guide named by its place in the repo was missing from one checkout, and the agent patched anyway

  1. The reminder named a guideInside the checkout
  2. That checkout didn’t have itA Neuma agent’s checkout
  3. The agent patched anyway88 lines added to a hotspot
  4. Both hooks now name the installed skillsWhere they’re installed, not where they sit in a repo

If your reminder points at a guide, make sure every checkout your agents work in can find it.

How far to trust it

The merge hook is new, and no agent has redesigned anything after one yet

  1. Three firings, all on 6 NovemberOne after a one-file roadmap merge, where the agent went on to its next task, and two inside the agent building the hook
  2. Not yet seen in CodexIt’s wired there, but it hasn’t fired there yet
  3. Counted on Claude CodeThe 689 come from Claude Code on two Macs. Codex sessions aren’t in them
  4. A short count after the changeThe 24 are one Mac, from 22:35 that night to the next morning
  5. Reminders, not gatesAn agent can still read past either one
  6. Merge detection has changed sinceI first matched the command that was typed, and it missed some merges. The fix is in the duplicate-code article

What to copy

Give your own agent this brief to build a hook the same way.

A brief for a reminder hook that fires once

Write a hook for our coding agents that gives one reminder at one moment.
Moment: after an agent edits a file with two fixes in 30 days, or after it merges.
Key: the file and its fix count, or the merged commit.
Fire once per key in each session, and remember what it has said in a small state file.
Point at the guide that owns the rule, by where it is installed, and do not restate the rule.
Add a note after the action. Never block it.
Wire it the same way for each agent we run.

How it works

Pick the moment, fire once, point at the guide

  1. Pick a momentAn edit to a hotspot, a merge
  2. Key itFile and fix count, or the merged commit
  3. Fire once per keyRemembered per session in a small state file
  4. Point at the ownerThe guide where it’s installed, not the rule restated
  5. Never blockA note after the action, not a gate in front of it

Next I’ll count catches against misses for both hooks over a month, and see whether a merge reminder ever leads to a redesign.