How hooks work
When a coding agent modifies a file:- The hook executes a scoped in-memory AST scan on the changed files via
runScopedScan. - Heavy processes (network audits, type-checking, and formatters) are skipped to keep turn latency low.
- If the edit introduces pattern violations (such as swallowed exceptions or unsafe type assertions), the hook returns structured feedback into the agent turn.
- The agent reads the machine-readable feedback and can self-correct within the same turn.
Installing hooks
Install hooks for all detected agents on your system:--project to scope hooks to the current repository only instead of your global user directory.
Status, baselines, and safety
Status and sentinel integrity
Check active hooks and verified SHA-256 sentinel hashes:Capturing baselines
Record pre-existing technical debt before running incremental checks:.raigal/baseline.json. Subsequent agent edits are evaluated using 3-stage baseline matching, ensuring pre-existing debt does not trigger false regressions.
Safe uninstallation
Remove hooks cleanly without disturbing hand-written editor settings:To connect Raigal tools directly to your agent tool-calling loop instead of relying on file system hooks, see the Raigal MCP server.