Hooks are confusing

I still can’t understand how to get hooks to work.

Once the agent is finished, I always want it to run .NET build at the end. The agent should tell me whether or not the build succeeds or fails. Looking at the logs the hook runs, but the agent doesn’t do anything with the result

Looking at your screenshots, your hook setup looks correct and is running successfully. In your stop.sh script, followup_message is only sent when $BUILD_SUCCESS = false (line 47-48), so when the build succeeds, no message is sent back to the agent.

If you want the agent to always be notified of the build result (success or failure), move the followup_message output outside the conditional so it’s echoed for both cases - for example, include a success message like "followup_message": "Build completed successfully." in the success branch too.

Does that help clarify the behavior?

1 Like

Thank you so much!! Yes thats why.

The docs need a better POC I have no idea how anyone figures hooks out the documentation is far too abstract and needs concrete examples in a github repo or something

Thanks @sanjeed5

1 Like

Do these examples help? Hooks | Cursor Docs

If not, can you tell what would help more?

In my view, they are comprehensive in the way that Material UI might for instance describe the API of each of their components, but not straight-forward example or POC e.g. how to create a Card.

For instance there is a GIF on the page which is great but the minimal hooks code to replicate is not provided.

I note that there is an example for “block-git.sh” but I don’t find it a particularly useful example and the tab kind of obfuscates it.

I think for a lot of people (maybe speaking for others) is simply “does this compile or not” - if not fix it basically like my example. Or running prettier or similar.

My 2c anyway thanks again

1 Like