Skip to content

Hooks

Updated Nov 12, 2026
On this page

A hook is a command that minion runs on your machine around the work of an agent. A hook can block a tool call, add context for the model, or run a formatter after an edit. Hooks run on the machine where the call runs, never on the Raven server.

Files

minion reads hooks from these files:

File Format Trust
hooks.toml in the minion config directory Raven Not needed
~/.agents/hooks.toml Raven Not needed
~/.claude/settings.json Claude Code Not needed
<workdir>/.agents/hooks.toml Raven Needed
<workdir>/.claude/settings.json Claude Code Needed
<workdir>/.claude/settings.local.json Claude Code Needed

CLAUDE_CONFIG_DIR moves the ~/.claude directory. A file larger than 256 KiB is not read.

Events

Event When it runs Can block
PreToolUse Before a tool call Yes
PostToolUse After a tool call No
UserPromptSubmit After you send a message No

The hooks.toml format

toml
[[hooks]]
name = "no-secrets"
event = "PreToolUse"
tools = ["Read", "Edit", "Write"]
paths = ["**/.env", "**/*.pem"]
command = "echo 'secret files are off limits' >&2; exit 2"

[[hooks]]
name = "fmt"
event = "PostToolUse"
tools = ["Edit", "Write"]
paths = ["**/*.rs"]
command = "rustfmt \"$RAVEN_HOOK_PATH\""

[[hooks]]
name = "deploy-context"
event = "UserPromptSubmit"
keywords = ["deploy", "release"]
command = "git status --short --branch"
  • tools names the Raven tools, such as Shell, Read, Edit and Write.
  • paths globs match the target path of the call, relative to the workdir. A call without a path never matches a hook with paths.
  • keywords matches parts of your message, without regard to case.
  • A missing gate matches every call or message.
  • timeout_ms defaults to 30000 for tool events, at most 120000. It defaults to 5000 for UserPromptSubmit, at most 15000.
  • A file with an unknown key, event, field or tool name runs nothing.

The command runs in the shell of the Shell tool: bash, or PowerShell on Windows. It gets JSON on stdin and the variables RAVEN_HOOK_EVENT, RAVEN_HOOK_TOOL, RAVEN_HOOK_PATH, RAVEN_PROJECT_DIR, RAVEN_CONVERSATION_ID and RAVEN_TASK_ID.

Result Effect
Exit 0 The call runs. Stdout is context for the model.
Exit 2 in PreToolUse The call does not run. Stderr is the result that the model sees.
Another exit, a timeout The call runs, and the model sees the failure. With on_error = "deny", a PreToolUse hook blocks the call.

Claude Code hooks

minion runs the PreToolUse, PostToolUse and UserPromptSubmit hooks of Claude Code with the input and output of Claude Code. A script for Claude Code thus works in Raven without changes.

Claude Code In Raven
matcher Empty and * match all tools. Letters, digits and _- ,| name tools exactly. Other text is a regular expression.
Tool names The Shell tool is Bash on every OS. Read, Write, Edit, Glob and Grep keep their names. Other tools have their Raven names.
Edit Before an edit call with several changes, the hook runs once for each change, and a block of one change stops the whole call. After the call, it runs once, with the last change.
if Only the tool name of the rule is compared. The pattern in parentheses is not.
command with args The program starts with the arguments as written, without a shell.
command without args bash runs it. On Windows, Git Bash runs it, or PowerShell when there is no Git Bash or the hook sets "shell": "powershell".
${CLAUDE_PROJECT_DIR} The workdir. The hook also gets it as a variable.
timeout Seconds, at most 120 for tool events and 15 for UserPromptSubmit.
onFailure: "block" A failure or a timeout of a PreToolUse hook blocks the call.
permissionDecision deny, ask and defer block the call. Raven has no approval prompt for hooks.
updatedInput Blocks the call. Raven cannot change the input of a call.
updatedToolOutput The model sees a notice in place of the output.
additionalContext, systemMessage, reason Context for the model.
disableAllHooks Turns off the Claude Code hooks. The hooks.toml files still run.

minion does not run the other events, the http, prompt, agent and mcp_tool types, or async hooks. It does not load Claude Code plugins, so their hooks and skills do not apply. A handler that two files define runs once.

Trust

A repository can change the files in its workdir. Their hooks run only after you trust their content on this machine:

sh
minion hooks list [DIR]     # what runs, and which files are trusted
minion hooks trust [DIR]    # trust the hooks files of DIR as they read now
minion hooks untrust [DIR]
minion hooks off            # turn off every hook on this machine
minion hooks on
  • A change to the hooks of a file withdraws its trust. In a Claude Code settings file, only hooks and disableAllHooks count, so a new permission rule keeps the trust.
  • Trust covers the file, not the scripts that it calls.
  • A machine that you share with another account runs your hooks for that account too.

Notices

When a hook file does not load, the conversation shows one short notice, such as Claude Code plugins not loaded: impeccable. The model reads it too. Each notice shows once until the conversation is compacted.