Register the hooks
Add this to ~/.claude/settings.json (merge it with anything already there). Every event runs the same script with its own name. Restart Claude Code, then check with /hooks.
{
"hooks": {
"SessionStart": [{ "hooks": [{ "type": "command", "command": "sh ~/bin/claude-state.sh SessionStart", "timeout": 5 }] }],
"UserPromptSubmit": [{ "hooks": [{ "type": "command", "command": "sh ~/bin/claude-state.sh UserPromptSubmit", "timeout": 5 }] }],
"PreToolUse": [{ "hooks": [{ "type": "command", "command": "sh ~/bin/claude-state.sh PreToolUse", "timeout": 5 }] }],
"Notification": [{ "hooks": [{ "type": "command", "command": "sh ~/bin/claude-state.sh Notification", "timeout": 5 }] }],
"Stop": [{ "hooks": [{ "type": "command", "command": "sh ~/bin/claude-state.sh Stop", "timeout": 5 }] }],
"SessionEnd": [{ "hooks": [{ "type": "command", "command": "sh ~/bin/claude-state.sh SessionEnd", "timeout": 5 }] }]
}
}