Claude Code hooks generator
Pick the Claude Code events to hook, a matcher and a command, and copy the exact hooks block for your settings file. One switch fills in the hooks Euthyne installs, byte for byte what euthyne init writes.
Fills in euthyne hook claude-code on the ten events, exactly as euthyne init writes them.
Runs in a shell with the event as JSON on stdin. Exit code 2 blocks the action on events that can block.
{
"hooks": {
"PostToolUse": [
{
"hooks": [
{
"command": "jq -r '.tool_input.file_path' | xargs npx prettier --write",
"type": "command"
}
],
"matcher": "Edit|Write"
}
]
}
}
If the file already has a hooks key, merge these event arrays into it rather than adding a second one. Claude Code normally picks up hook changes without a restart, and /hooks lists the hooks it loaded.
How it works
A hook is a command Claude Code runs at a fixed point in a session, with the event as JSON on stdin. In a settings file, hooks are grouped by event. Each group has an optional matcher and a list of handlers: for tool events the matcher is a tool name, for SessionStart it’s how the session began, for subagent events it’s the agent type (hooks reference).
Exit code 2 blocks the action on events that can block, such as PreToolUse. Where you paste the block sets its scope: every project, one repository for the whole team, or one repository just for you (hooks guide).
Why it matters
Hooks run every time, whatever the model decides. That makes them the place for what must always happen: formatting the files Claude edits, refusing a command, or keeping a record of what the agent did.
The record is what Euthyne uses hooks for. euthyne hook claude-code reads each event, checks it against the session’s permissions and signs a receipt. The ten events cover a session from start to end: each prompt, each tool call and its outcome, each subagent and each stop. Recording never blocks. The PreToolUse hook only decides a call when your org has a signed policy, and only denies it once the org switches that policy from dry run to enforce.
Record every tool call, signed
euthyne init installs these hooks for you, enrols the repository and signs a test receipt. From then on each event becomes a signed receipt in an append-only log anchored on-chain. Prompts and outputs stay on your machine, only salted hashes leave.
curl -fsSL https://euthyne.com/install | shbrew install euthyne-labs/tap/euthyneeuthyne init signs you in first, or lets you create an account. Request access or read the docs.
Frequently asked questions
Into the settings file for the scope you want: ~/.claude/settings.json for every project, .claude/settings.json for everyone who clones the repository, .claude/settings.local.json for you alone. If the file already has a hooks key, add the event arrays to it instead of adding a second one.
For tool events it's the tool name, like Bash or Edit|Write. A matcher made only of letters, digits, _, -, spaces, commas and | lists exact names; anything else is a JavaScript regular expression, so mcp__github__.* matches every GitHub MCP tool. An empty matcher or * matches everything.
PreToolUse can block a tool call and UserPromptSubmit can reject a prompt: exit with code 2 and Claude Code stops the action, using stderr as the reason. On PostToolUse the tool already ran, so exit code 2 only shows the message to Claude.
The ten hooks euthyne init installs: euthyne hook claude-code on SessionStart, UserPromptSubmit, PreToolUse, PostToolUse, PostToolUseFailure, PermissionDenied, SubagentStart, SubagentStop, Stop and SessionEnd, with a * matcher on the four tool events. A test checks that the block matches what init writes, byte for byte.
Recording never blocks. euthyne hook never touches the network itself and always exits 0, and errors go to a log that euthyne status shows. It blocks a tool call only if your org enforces a signed policy, on Team and Company. A new policy starts in dry run, where nothing is blocked.
No. The block is built in your browser from what you pick.