Relay coding-agent hook payloads to a local console listener. One binary, two roles:
hookmon listen— long-running TCP server; prints each envelopehookmon send— invoked by the agent as a command hook; forwards stdin JSON
Cursor is the first agent provider. Others plug in via agent.Provider.
go build -o hookmon .# terminal 1
./hookmon listen
# or: ./hookmon listen --log-file ./hooks.log
# terminal 2 / Cursor hooks.json
./hookmon send --agent cursor # reads hook JSON from stdinDefault address: 127.0.0.1:9473 (--addr, HOOKMON_ADDR, or .hookmon.yaml).
--log-file (or HOOKMON_LOG_FILE) redirects listen output to a file (absolute or relative path).
Copy examples/cursor/hooks.json to ~/.cursor/hooks.json or project .cursor/hooks.json. Point command at your binary:
"command": "/absolute/path/to/hookmon send --agent cursor"Wire format:
{ "agent": "cursor", "payload": { /* raw hook JSON */ } }send always acknowledges with {} and fails open if the listener is down.
- Implement
agent.Providerinagent/<name>/ agent.Registerininit()- Blank-import the package from
cmd - Add
examples/<name>/hook config