# Our Hook Told the Agent It Was Wrong. It Said No, Three Times.

> Source: <https://dev.to/nabil_since_dev/our-hook-told-the-agent-it-was-wrong-it-said-no-three-times-54f>
> Published: 2026-11-22 23:30:00+00:00

**Recommendation:** Budget hook timeouts for your slowest real check, not the average, and write correction notes that name the exact file and string the agent wrote plus a verifiable source for the fix.
More in the playbook "Working with AI coding agents": <https://wpnews.pro/playbooks/coding-agents>

**Our first hook had a 3 second budget. The check it ran took 3.2 seconds. So for one version of our CLI, the feature worked perfectly and said nothing about the exact thing it was built to catch.**

That was the easy bug. The hard one came a few hours later, when the hook finally spoke up, and the coding agent listened carefully, thought about it, and declined.

Three times.

The idea is simple. When a coding agent writes a file, a hook runs right after. Since checks the file, and if the agent just wrote something already dead, like a model ID that was retired last month, the agent hears about it on the spot, with what to write instead.

Not after the build fails. Not in code review. On the line it just wrote.

The rules we gave ourselves:

That last rule is where the first bug lived.

The agent's hook contract gives you a timeout. We picked 3 seconds for our own wait, because a hook that makes your agent feel sluggish gets uninstalled.

Before shipping, we'd already spent an evening on speed. A one-file check took 1.75 seconds in production, and when we counted, the read made 15 database queries one after another, each waiting on the last for no good reason. We ran the independent ones together and stopped reading the same row twice, and a one-file check went from about 20 sequential round trips to 11.

Then we measured the real thing, end to end, through the real CLI:

| What the agent just wrote | End to end | 
|---|---|
| A file naming only a package | 0.8 s | 
| A file with a model ID, seen before in another session | 2.0 s | 
| A file with a model ID, first time | 3.2 s | 

The fast cases were fine. The case the whole feature exists for, a model ID the agent just wrote, came in at 3.2 seconds. Our hook gave up at 3.

So version 0.5.0 did exactly what we designed: when Since is slow, say nothing rather than stall the agent. It said nothing about the one thing we built it to catch. We published 0.5.1, with a 6 second wait, eight minutes after 0.5.0.

Lesson one, cheap and obvious in hindsight: measure the case you care about, not the average case. The average was great.

Next, we wanted proof the note actually changes what an agent writes. We have a benchmark that asks coding models everyday questions and checks whether their answers use things that are already retired. We added a hook arm: the model answers, the hook checks the files it wrote, and if something is proven wrong, the model gets the note and one turn to revise.

We ran it on a small, fast model first. The note arrived. The model read it. And three times, it left the retired model ID exactly where it was.

Here's the part I didn't expect: it explained itself each time. No hallucinated compliance, no ignoring us. It gave reasons. Good ones.

Here's what the note looked like back then (this one is the example from our CLI's own tests):

```
Since.dev checked what was just written and found:
- src/llm.ts:3: gpt-3.5-turbo on OpenAI API: retirement 2026-10-23. Use gpt-5.6-terra. Write: export const ask = (q) => client.chat.completions.create({ model: "gpt-5.6-terra", messages: [{ role: "user", content: q }] });
```

Read it as a careful engineer would. It's a list of facts. The instruction, "Use gpt-5.6-terra," is buried in the middle, after a date. There's no source. And there's no ask.

**Reason one: "That file doesn't exist."** The note named a file the benchmark had made up, `src/file1.py`, because the model's answer hadn't named its files and our harness invented a placeholder. The model looked at its own answer, saw no such file, and reasonably concluded the note was about something else.

**Reason two: "I didn't write that."** The note named the dated model ID, while the code used the short alias. To us those are the same model. To a careful reader, the note was complaining about a string that didn't appear anywhere in the code.

**Reason three: "I can't verify that."** The note said to use a replacement, with no source. The model had no way to check that the replacement was real, so it kept what it knew. Which, honestly, is the behavior you'd want from an agent when a stranger's message tells it to change a model ID.

Each of those is a bug in the note, not in the model. The model was doing exactly what we'd want it to do with a vague, unsourced, slightly wrong message.

We changed four things:

And in the benchmark, files are named the way the answer named them, and the model has Since's lookup tools available (with no rule telling it to use them), so if it doubts a replacement, it can check.

The same example, rewritten:

```
Since.dev checked what was just written and found:
- src/llm.ts:3: replace gpt-3.5-turbo here with gpt-5.6-terra. gpt-3.5-turbo on OpenAI API: retirement 2026-10-23. Write: export const ask = (q) => client.chat.completions.create({ model: "gpt-5.6-terra", messages: [{ role: "user", content: q }] }); Source: https://developers.openai.com/api/docs/deprecations
Fix each one before you go on.
```

Same facts. Different order, one link, one sentence at the end.

On the same 8 cases, the revisions went from 1 clean to 7 clean.

I had been writing the note for a human skimming a terminal: facts first, the eye finds the fix. An agent doesn't skim. It reads every word, takes them literally, and weighs them against what it can see. A note that names a file it can't find, or a string it didn't write, isn't a weak signal to an agent. It's evidence the note is wrong.

Which means a message to an agent is closer to an API than to a log line. It needs to be exact, it needs to say what to do, and it needs to show its work.

What's the most reasonable excuse a coding agent has given you for not doing what you asked?

*I'm Nabil. I build [Since](https://since.dev?utm_source=devto), which tracks what your code depends on and tells you before it breaks.*
