P
PostToolUse (Write|Edit|Bash)
HookFires on
PostToolUsematchingWrite|Edit|BashImmediately after a tool returns, with its result available.
Where this sits in a session
- Session start→
- Prompt submitted→
- Prompt expansion→
- Before tool use→
- After tool use→
- Notification→
- Before compaction→
- Subagent finished→
- Turn finished→
- Session end
Can block — This hook is able to deny the action or send Claude back to work.
What it runs
Executed automatically when the event fires — no prompt, no confirmation.
command
bash "${CLAUDE_PLUGIN_ROOT}/scripts/hook.sh" claude PostToolUseInstall it yourself
Paste into .claude/settings.json to run this hook without installing the whole plugin. Adjust the paths to point at your own copy of the scripts.
settings.json
{
"hooks": {
"PostToolUse": [
{
"hooks": [
{
"type": "command",
"command": "bash \"${CLAUDE_PLUGIN_ROOT}/scripts/hook.sh\" claude PostToolUse"
}
],
"matcher": "Write|Edit|Bash"
}
]
}
}Source
Read this before installing — it runs on your machine with your permissions.
#!/bin/bash
DIR="$(cd "$(dirname "$0")" && pwd)"
if [[ -n "$WSL_DISTRO_NAME" ]]; then
exec "$DIR/hook-windows-amd64.exe" "$@"
fi
case "$OSTYPE" in
darwin*)
case "$HOSTTYPE" in
arm64) exec "$DIR/hook-darwin-arm64" "$@" ;;
aarch64) exec "$DIR/hook-darwin-arm64" "$@" ;;
*) exec "$DIR/hook-darwin-amd64" "$@" ;;
esac ;;
linux*)
case "$HOSTTYPE" in
aarch64) exec "$DIR/hook-linux-arm64" "$@" ;;
*) exec "$DIR/hook-linux-amd64" "$@" ;;
esac ;;
msys*|cygwin*)
exec "$DIR/hook-windows-amd64.exe" "$@" ;;
*)
echo "unsupported platform: OSTYPE=$OSTYPE" >&2
exit 2 ;;
esac
Shipped by 1 plugin
Installing any of these installs this hook.
Reviews
Log in to leave a review.
No reviews yet — be the first.
Explore related
Other things in this space — across every part of the ecosystem, not just hooks.