A shell command that runs automatically on Claude Code events like session start and stop.
Claude Code hooks are shell commands configured in ~/.claude/settings.json that fire automatically when specific events occur in a Claude Code session. They run outside the AI model — they are executed directly by the Claude Code process, not by Claude.
The three most useful hook events for time tracking are SessionStart (fires when a new session opens), UserPromptSubmit (fires each time you send a prompt — used for heartbeats), and SessionEnd (fires when the session closes). Note: avoid using Stop for stopping the timer — Stop fires after every assistant response, not at session end. Hooks run as shell commands, so any command-line tool available on your system — including curl — can be used.
Hooks are defined as an array under each event key. Each entry has a matcher (a regex that filters which sessions trigger the hook — leave blank to match all) and a hooks array of command objects. Multiple hooks can run per event.
Hooks are a key part of ClockMe's zero-click automation. By configuring a curl command in SessionStart, your timer starts the moment a session opens — before you type a single message. SessionEnd stops it when you close the session, UserPromptSubmit pings a heartbeat between turns, and a server-side watchdog auto-stops idle timers as a backstop if the session terminates uncleanly.
In ClockMe
ClockMe's setup wizard generates the exact hook configuration for your account. SessionStart calls clockme.co/api/timer/start, UserPromptSubmit calls clockme.co/api/timer/heartbeat, and SessionEnd calls clockme.co/api/timer/stop. Once configured, every Claude Code session is tracked automatically — no manual action needed.
Try ClockMe free →Hooks go in ~/.claude/settings.json under the 'hooks' key. Add a 'SessionStart' key for session-open events, 'UserPromptSubmit' for per-turn heartbeats, and 'SessionEnd' for session-close events. (Don't use 'Stop' for closing the timer — Stop fires after every assistant response.) Each value is an array of matcher/hooks objects.
The ClockMe hook uses curl with the -sf flags (silent, fail-fast) and redirects output to /dev/null. It runs asynchronously and has no measurable impact on session startup time.
Yes, if curl is installed. curl ships with Windows 10 1803+ and Windows 11 by default. If not available, install via 'winget install curl'. The command syntax is the same cross-platform.