For the complete documentation index, see llms.txt. This page is also available as Markdown.

How to Set Up the Kerno Agent Hook

Learn how to wire the Kerno agent hook so your coding agent re-validates the endpoints your changes affect after every turn.

Introduction

The Kerno agent hook closes the loop on code changes. After you edit code, it surfaces the endpoints your change affected and has your coding agent re-validate them as part of its normal turn. It is optional, and you set it up once per repository.

In this guide, you will confirm the hook script Kerno creates, wire it into your editor, and verify it fires. For the review loop the hook automates, see How to Review your Code Changes.

Prerequisites

Before you begin, you will need:

Step 1. Confirm the hook script

Kerno's agent writes the hook script for you at .kerno/hooks/check-changes-detected.sh the first time it snapshots your workspace. Ask your agent to confirm it is there, or check yourself:

ls .kerno/hooks/check-changes-detected.sh

When it runs, the script looks for .kerno/CHANGES_DETECTED.md, a marker Kerno writes whenever a run discovers the endpoints your changes affect. If the marker is present, the script prints the impacted endpoints and asks your agent to validate them. If it is empty or missing, the script exits quietly.

Step 2. Wire the hook into your editor

The script needs something to run it at the end of each agent turn (a "stop" hook). Ask your agent to wire it for you:

Add a stop hook to my editor config that runs
bash .kerno/hooks/check-changes-detected.sh at the end of each turn.

You can also add it by hand. In Claude Code, add this block to a settings file:

In Cursor, add this to a hooks.json file:

Where you put the config decides who gets the hook. Both editors support the same choices:

  • Just you, everywhere. Your user file, ~/.claude/settings.json in Claude Code or ~/.cursor/hooks.json in Cursor.

  • Just you, this repository. In Claude Code use .claude/settings.local.json, which is gitignored. Cursor has no per-repository personal file, so use your user file for a personal hook.

  • Your whole team. Commit it to the project file, .claude/settings.json in Claude Code or .cursor/hooks.json in Cursor.

The hook works with any coding agent that supports stop hooks. For another agent, use its own stop-hook mechanism and file locations to run the same command.

Step 3. How the loop runs

Once the hook is wired, the loop runs on its own:

  1. You change code and ask your agent to review what changed, so Kerno discovers the affected endpoints with a changed scope and writes them to .kerno/CHANGES_DETECTED.md. See Scopes.

  2. The agent turn ends, and the hook runs the script.

  3. The script surfaces the impacted endpoints and asks your agent to bring the stack up and validate them with a changed scope.

  4. Your agent validates, then clears the marker.

The hook reacts to that marker, so it fires after a changed-scope run has found affected endpoints and stays quiet the rest of the time.

Step 4. Verify it is working

Check that all three pieces are in place:

  • The script .kerno/hooks/check-changes-detected.sh exists.

  • Your editor's hook config points at it, in whichever scope you chose.

  • A changed-scope run produces .kerno/CHANGES_DETECTED.md.

You can run the script yourself to see what it would surface:

It prints the impacted endpoints when the marker is present and exits quietly when it is not.

If the hook never seems to fire, the usual cause is a missing host config. The script does nothing until your editor is wired to run it on stop.

Conclusion

Now you have the hook configured, and your agent will re-validate the endpoints your changes affect automatically after each turn. From here, see How to Review your Code Changes for acting on the results.

Last updated