Yesterday a small build landed on r/PromptEngineering, and the twist is that it contains almost no prompting. The author had a line in their CLAUDE.md that said “search this fix library before you debug.” It worked maybe half the time. The agent would hit an error, get tunnel vision, and forget the instruction existed. Anyone who has run a long coding session will recognize this. The instruction sits at the top of the context, the error log fills the bottom, and somewhere in the middle the agent just stops thinking about the thing you told it to do.
What’s new
The fix library is called yarrow. It’s a searchable collection of known fixes, the kind of “oh, that error means you forgot to export the env var” knowledge that usually lives in your head or in scattered notes. It plugs into Claude Code through a hook instead of an instruction. You don’t ask the agent to remember to look things up. The harness does the looking for it. Think of the difference between telling a new hire to check the wiki and wiring the wiki into the error dialog itself.
The twist
The agent never has to decide to use the tool. A hook is a script Claude Code runs automatically after a command fails, so the lookup happens whether the model remembers or not. There’s no judgment call in the loop, which is exactly why it works. The model’s attention is the unreliable part, and the hook takes attention out of the equation.
The script takes the error output and searches the library. Then there are two outcomes:
- Close match: the fix is placed right in front of the agent, at the moment it’s stuck. That timing is the whole point. The advice arrives when the agent actually needs it, not 40 turns earlier in a file it skimmed once.
- No match: it says nothing. No noise, no extra context burned.
That silent path matters. A hook that spoke up on every failure would just become another thing to ignore. Every token the hook injects competes with the real work, so a hook that stays quiet most of the time earns trust the moment it does speak.
The mini-workflow
- 🔧 Run the installer: npx yarrow-fixes install sets up the hook for you. Do this in a project you already work in, so you can judge it on real errors.
- 💥 Work as usual. When a command fails, the hook fires on its own. You don’t change how you prompt at all.
- 🔍 The error gets searched against the fix library. This is a lookup, not another model call, so it’s fast and costs you nothing in reasoning.
- ✅ Close match? The fix shows up in the agent’s context. No match? Silence. Either way the agent keeps moving.
The author’s verdict: way more reliable than any wording they tried. They rewrote that CLAUDE.md line several different ways, with capital letters, with “IMPORTANT,” with examples, and none of it beat simply taking the decision away from the model.
Pro tips
- Audit your instructions file for “always do X” lines. The author’s takeaway was that a lot of these should be hooks. If something has to happen every single time, it doesn’t belong in a suggestion the model weighs against everything else in context. A quick test: if you have ever typed “you forgot to…” to your agent twice for the same thing, that line is a hook candidate.
- Keep the silent path silent. Commenters pointed out that instructions decay the deeper an agent gets into a task. A hook doesn’t decay, but it only helps if its output is worth reading. Surface a fix only on a close match, and keep the injected text short so the agent can act on it right away.
- The pattern isn’t just for errors. One commenter said their sessions kept forgetting to check for a daily work file, so they swapped the instruction for a hook that runs on every message and flags when the file is missing. Same idea, different trigger. Other natural fits are a hook that runs your linter after edits or one that reminds the agent of a branch rule before a commit.
- Mind match quality. Another commenter flagged that a library like this lives or dies on how cleanly it matches errors. Test it on your own failures before you trust it. Deliberately break a build in a few familiar ways and watch whether the right fix surfaces, and whether anything irrelevant sneaks in.
- Start small. Convert one instruction to a hook, run a few sessions, and see what changes before you rebuild your whole setup around the idea.
The community summed it up better than I could. One said prompting is hoping the model listens, while hooks actually change the workflow. Another said forcing the agent to do something works better than politely asking it 50 times.
Call to Action
Pick the one line in your CLAUDE.md that the agent ignores most often and ask whether a hook could enforce it instead. Write down what you’d want to happen, what event should trigger it, and what the agent should see when it fires. If you work with Claude Code and want to try the fix library, npx yarrow-fixes install is the whole setup. 🏴☠ Report back with what your agent stopped forgetting!
Frequently Asked Questions
Q: How does Yarrow decide a match is close enough to show?
The hook sends the failed command’s error text to Yarrow, and the matching happens on Yarrow’s side. The hook only passes along the top fixes when it counts as a close match, and it stays quiet otherwise. The package docs don’t publish the exact cutoff, so if you want to see what comes back for your own error, run npx yarrow-fixes search with the error text by hand.
Q: What happens when a match is close but wrong?
Yarrow never blocks or runs anything. The fix is just context the agent sees next to the error, so the agent still decides whether to use it. Fixes are written by other agents and nobody reviews them by hand, so a wrong match is possible. Read a fix before you run it, and use the –verified flag to limit results to fixes that were reproduced in a clean sandbox and re-checked every 30 days.
Q: Should every ‘always do X’ rule become a hook?
Most commenters agree that steps which must happen every time belong in code, like a hook or a required tool call. One commenter adds that a hook guarantees the information shows up, but the model still decides what to do with it. Keep the instructions file for the judgment calls, since rules the model only half follows waste tokens.
stopped trying to prompt my agent into using a tool and used a hook instead
by u/Significant_Camp4148 in PromptEngineering