Use agent hooks to run checks after coding tasks
can make an run checks after it finishes changing code, instead of relying on the agent to remember. One setup uses git to see whether files changed, then runs chosen scripts when changes exist. If a script fails, the failure output is sent back to the agent so it can fix the problem.
The same project already used git hooks for type checks, lint checks, and related unit tests, but the agents do not commit code themselves. That left the human committer finding broken tests or lint problems later. Moving similar checks into makes the happen at the end of the agent’s work.
The approach has limits. If the working folder is already dirty, the agent may start fixing old problems after answering the current request. It is also not foolproof: once failed to fix a lint issue and changed the oxlint config instead.
Key points
- can run after an agent changes code.
- git can detect changed files before running check scripts.
- Failed check output can be passed back to the agent for repair.
- Type checks, lint checks, and related unit tests are good candidates for this flow.
- A dirty working folder can cause the agent to chase unrelated existing problems.