Every correction I give my coding agent becomes a file, then a hook
When my programming agent makes an error and I point out the wrong part, the corrections don't just stay in the chat but are stored as files, so the next session doesn't trip over the same thing again. I spent quite a while figuring that out actually.
In this way, I have 100 incident notes which the agent has written, and it also keeps memory notes in the project, with one fact for each file. A one-line index of those notes is loaded each time a session starts. Should the same mistake occur another time, it won't merely be a memory but a hook. That hook runs on every tool call and every reply, whether the agent remembers it or not. At the moment I have 63 hooks.
A few of them came about from pretty common things. It began to reply in English after long sessions in a different language. The note for that one says the more English documents it had just read, the more likely it was to drift into English. Now if a reply is in English, a hook makes the agent rewrite it.
Another time it told me something was fixed without testing it. From this I made a rule: it has to write down how it checked. And dash use was restricted.
Has your agent ever brought back something that had already been corrected? How do you make sure that it doesn't?
Replies
Mid-task the agent lost earlier context and rebuilt a helper that already existed two files away under a different name. That left two versions of the same logic drifting apart. Now every prompt forces it to search existing utilities first instead of letting it spin up a new file.