What Can Hooks Do?
Enforce policies
Block dangerous commands, require confirmation for specific actions, or restrict file access.
Add context
Inject additional instructions or information when specific tools are called.
Run side effects
Execute scripts, send notifications, or log events when things happen.
Modify permissions
Dynamically grant or restrict permissions based on the situation.
Quick Example
Create.devin/hooks.v1.json in your project:
./scripts/check-command.sh before every shell command execution. The script receives event data on stdin and can block the action by returning a non-zero exit code.
Hook Events
Hooks can respond to these lifecycle events:
See Lifecycle Hooks for details on each event and its available data.
Hook Format
Each hook has a type (command or prompt), an optional matcher (regex on the hook event’s tool_name), and configuration:
Command Hooks
Command hooks run a shell command. Event data is passed as JSON on stdin, and the command can return JSON on stdout to control the outcome. Input (stdin):
The
DEVIN_PROJECT_DIR environment variable is automatically set to the project root directory.
See Using the Matcher for the built-in tool names and MCP tool name format you can match.
Exit Codes
Where Hooks Live
Devin CLI reads hooks from the following locations. All use the same JSON format.Project-Level
User-Level (Global)
In
.devin/hooks.v1.json, the hooks object is the entire file (no wrapper key needed). In all other locations, hooks are nested under the "hooks" key in a settings file.Hooks from
.claude/ paths are loaded when read_config_from.claude is enabled (the default). You can disable this in your user config if needed.Verifying Hooks
Use the/hooks slash command to see all currently loaded hooks and their source files:
Next Steps
Lifecycle Hooks
Deep dive into each event type and what data is available.
Claude Code Hooks Docs
Full reference for the hook format.

