{% extends "base.html" %} {% block title %}{{ title }}{% endblock %} {% block content %}
Configure Claude Code hooks for automatic activity tracking
Claude Code hooks are callback mechanisms that allow external applications (like this tracker) to receive notifications about various events in your Claude Code sessions. They enable real-time tracking of your development activity without manual intervention.
Triggered when a new Claude Code session begins
Triggered when a Claude Code session ends
Triggered when conversation messages are added
Triggered when files are created or modified
Triggered when Claude Code tools are used
The easiest way to set up hooks is using our automated installation script that configures everything for you.
For most users, this one-liner will set up everything you need:
# Set your domain and run the installer
export DOMAIN=claude.l.supported.systems
./setup-hooks
# Install basic hook set
./install-hooks.sh basic
Includes essential session and conversation tracking
# Install all available hooks
./install-hooks.sh comprehensive
Includes all 39+ hooks for complete tracking
./install-hooks.sh --list
- List available profiles./install-hooks.sh --verify
- Verify installation./install-hooks.sh --uninstall
- Remove all hooks./install-hooks.sh --help
- Show detailed helpThe tracker server must be running to receive hook notifications.
python main.py
Find your Claude Code configuration file to add hooks.
~/.config/claude/settings.json
~/.config/claude/settings.json
%APPDATA%\claude\settings.json
Add the hook configuration to your Claude Code settings file.
{
"hooks": {
"session_start": "curl -X POST http://localhost:8000/api/sessions/start -H 'Content-Type: application/json' -d '{\"project_path\": \"$PWD\", \"start_time\": \"$TIMESTAMP\"}'",
"session_end": "curl -X POST http://localhost:8000/api/sessions/end -H 'Content-Type: application/json' -d '{\"session_id\": \"$SESSION_ID\", \"end_time\": \"$TIMESTAMP\"}'",
"conversation_update": "curl -X POST http://localhost:8000/api/conversations -H 'Content-Type: application/json' -d '{\"session_id\": \"$SESSION_ID\", \"content\": \"$CONTENT\"}'",
"tool_call": "curl -X POST http://localhost:8000/api/tool-calls -H 'Content-Type: application/json' -d '{\"tool_name\": \"$TOOL_NAME\", \"parameters\": $TOOL_PARAMS, \"result_status\": \"$RESULT_STATUS\", \"execution_time_ms\": $EXECUTION_TIME}'"
}
}
{
"hooks": {
"session_start": "curl -X POST http://localhost:8000/api/sessions/start -H 'Content-Type: application/json' -d '{\"project_path\": \"$PWD\", \"start_time\": \"$TIMESTAMP\", \"user\": \"$USER\"}'",
"session_end": "curl -X POST http://localhost:8000/api/sessions/end -H 'Content-Type: application/json' -d '{\"session_id\": \"$SESSION_ID\", \"end_time\": \"$TIMESTAMP\"}'",
"conversation_update": "curl -X POST http://localhost:8000/api/conversations -H 'Content-Type: application/json' -d '{\"session_id\": \"$SESSION_ID\", \"content\": \"$CONTENT\", \"timestamp\": \"$TIMESTAMP\"}'",
"file_modified": "curl -X POST http://localhost:8000/api/activities -H 'Content-Type: application/json' -d '{\"session_id\": \"$SESSION_ID\", \"file_path\": \"$FILE_PATH\", \"action\": \"$ACTION\", \"timestamp\": \"$TIMESTAMP\"}'",
"tool_call": "curl -X POST http://localhost:8000/api/tool-calls -H 'Content-Type: application/json' -d '{\"tool_name\": \"$TOOL_NAME\", \"parameters\": $TOOL_PARAMS, \"result_status\": \"$RESULT_STATUS\", \"execution_time_ms\": $EXECUTION_TIME, \"timestamp\": \"$TIMESTAMP\"}'"
},
"hook_settings": {
"timeout": 5,
"retry_count": 3,
"async": true
}
}
{
"hooks": {
"session_start": "curl -X POST http://localhost:YOUR_PORT/api/sessions/start -H 'Content-Type: application/json' -d '{\"project_path\": \"$PWD\", \"start_time\": \"$TIMESTAMP\"}'",
"session_end": "curl -X POST http://localhost:YOUR_PORT/api/sessions/end -H 'Content-Type: application/json' -d '{\"session_id\": \"$SESSION_ID\", \"end_time\": \"$TIMESTAMP\"}'",
"conversation_update": "curl -X POST http://localhost:YOUR_PORT/api/conversations -H 'Content-Type: application/json' -d '{\"session_id\": \"$SESSION_ID\", \"content\": \"$CONTENT\"}'",
"tool_call": "curl -X POST http://localhost:YOUR_PORT/api/tool-calls -H 'Content-Type: application/json' -d '{\"tool_name\": \"$TOOL_NAME\", \"parameters\": $TOOL_PARAMS, \"result_status\": \"$RESULT_STATUS\"}'"
}
}
Replace YOUR_PORT with your actual port number
Claude Code provides these variables that you can use in your hook commands:
$SESSION_ID
$TIMESTAMP
$PWD
$USER
$CONTENT
$FILE_PATH
$TOOL_NAME
$TOOL_PARAMS
$RESULT_STATUS
You can test individual hooks manually to ensure they work:
curl -X POST http://localhost:8000/api/sessions/start -H 'Content-Type: application/json' -d '{"project_path": "/path/to/project", "start_time": "2024-01-01T12:00:00"}'
tail -f logs/tracker.log
http://localhost:8000
~/.config/claude/settings.json
%APPDATA%\claude\settings.json
Still having trouble with hooks?