Hooks Refuse Before the Run
Asked to delete the database and reset the branch, the agent tried both and a hook refused each one before it ran. Autonomous pull requests need gates you trust, the same way a support bot is grounded and evaluated on every release.
Transcript
Okay, let's go into a little depth into our things. of course, the issue what has happened is like it runs in a headless mode, but we need to understand whether our hooks worked or whether our rules worked, what has actually happened. So I was playing around just spinning up a Claude instance and you know and ask I ask it to delete the database and reset the branch, it tries both the hook refused each one before the run and tell it to ask a human. What exactly happened? So, unless and until you create your own hooks, so when you can able to do an autonomous PR is when you are very confident that any autonomous PR, our verification gates and our testing will be deterministic enough to stop any malicious thing and it will forward things to human in the loop. This is not just for coding agents, this can be for any agents, right? So, if you are building an agentic AI application and you are creating a customer support bot, what is the first thing you will do? The first thing is stop hallucination. So, whenever there is a question which can be answered by the customer bot, you answer it. If that question you can't answer from the knowledge, don't hallucinate from any of your knowledge. Rather, always ground that information against my data. If that information is not available and you are not able to find that exact information, then always fall back to human so that human can take over and do it. That's how any customer support agent works, and that is how the evaluation actually, be done on each release. Like, like okay, what is the quality of my response? Is there a quality of my response that can be improved? What where are my traces and is my traces actually hallucinating, or is my traces have any issues, or is my traces actually taking multiple turns against it? Okay, let me put it in my data set and let me train again and deploy again. So that's the process which is used for agentic AI. That's the same process you need to use for any coding agent as well. When you have your bare bone coding agent, oftentimes these coding agents are more like frameworks that comes with built-in capabilities which avoids certain things like probably rm -rf of delete this folder or things like that. They they might already catch such instances, but then the nuances of what to execute, what not to execute, and all those things you are going to configure what permission that needs to be given, what hooks need to do. So, in this case, when your hook clearly points out okay, the user is asking to delete the database and reset the branch, which is not allowed in my hook, and it has been detected in the prehook. Now the database is still there and nothing was reset.
This lesson comes with Pro, $149 a year: Get Pro. This lesson is cut from the free Lightning session Build an Autonomous Claude Code Agent. The Live Labs build the same system with you, free, on Thursdays: see the Live Labs.
