Add your work to the map
Three hooks in your Claude Code settings anonymously record session starts, every message you send and the tokens used per turn — so the map sees real load inside long sessions, not just session starts. It’s opt-in, and removing a few lines turns it off.
1. Install the hooks
Option A: let Claude Code do iteasiest
Copy the prompt and send it to Claude Code. The agent downloads the script and shows it to you, backs up your settings, replaces an older Hourglyph hook if there is one, merges the new entries in and shows you the diff. Claude Code asks for permission before writing files.
Set up the Hourglyph hooks for Claude Code on this machine (https://hourglyph.github.io/setup/).
Goal: anonymously send session starts, the times I send messages, and token counts per turn to the peak-hours map. Message text, answers, code and paths are never sent.
Steps:
1. Download the script and show me its full contents before continuing:
mkdir -p ~/.claude/hooks && curl -fsSL https://hourglyph.github.io/hook/hourglyph.sh -o ~/.claude/hooks/hourglyph.sh
(source on GitHub: https://github.com/hourglyph/hourglyph.github.io/blob/main/public/hook/hourglyph.sh). Check that it does nothing but send an event name and four token counts.
2. Read ~/.claude/settings.json (treat a missing file as {}). If it exists, back it up to ~/.claude/settings.json.bak first.
3. Remove any old Hourglyph entries from hooks — commands containing "hourglyph.sh" / "rpc/checkin" — so nothing is duplicated.
4. Merge, don't overwrite: keep every other setting and hook, and append exactly these elements to hooks.SessionStart, hooks.UserPromptSubmit and hooks.Stop (create them if missing):
{
"SessionStart": [
{
"matcher": "startup",
"hooks": [
{
"type": "command",
"command": "sh \"$HOME/.claude/hooks/hourglyph.sh\" session",
"async": true
}
]
}
],
"UserPromptSubmit": [
{
"hooks": [
{
"type": "command",
"command": "sh \"$HOME/.claude/hooks/hourglyph.sh\" message",
"async": true
}
]
}
],
"Stop": [
{
"hooks": [
{
"type": "command",
"command": "sh \"$HOME/.claude/hooks/hourglyph.sh\" stop",
"async": true
}
]
}
]
}
5. Write the file back as valid JSON and re-read it to confirm it parses.
6. Check that curl and awk are available (command -v curl awk).
7. Show me the diff and tell me how to remove everything: delete those three entries from settings.json and the file ~/.claude/hooks/hourglyph.sh — or in one command: curl -fsSL https://hourglyph.github.io/hook/uninstall.sh | sh
Don't change anything else. Data starts flowing with the next new session.Option B: by hand
Download the script (read the source on GitHub, 65 lines of sh + awk):
mkdir -p ~/.claude/hooks && curl -fsSL https://hourglyph.github.io/hook/hourglyph.sh -o ~/.claude/hooks/hourglyph.shThen add the hooks block to ~/.claude/settings.json (or merge it into an existing one). If you had the older hook with rpc/checkin, remove it.
{
"hooks": {
"SessionStart": [
{
"matcher": "startup",
"hooks": [
{
"type": "command",
"command": "sh \"$HOME/.claude/hooks/hourglyph.sh\" session",
"async": true
}
]
}
],
"UserPromptSubmit": [
{
"hooks": [
{
"type": "command",
"command": "sh \"$HOME/.claude/hooks/hourglyph.sh\" message",
"async": true
}
]
}
],
"Stop": [
{
"hooks": [
{
"type": "command",
"command": "sh \"$HOME/.claude/hooks/hourglyph.sh\" stop",
"async": true
}
]
}
]
}
}2. What gets sent
| Hook | When | What is sent |
|---|---|---|
SessionStart | a new session starts | {"p_event":"session"} |
UserPromptSubmit | you send a message | {"p_event":"message"} — no text |
Stop | Claude finishes a turn | 4 integers: input, output, cache-write and cache-read tokens |
- The script counts tokens locally from the transcript file whose path Claude Code passes to the hook. Only the totals leave your machine — no text, code, paths or session id.
- All hooks run in the background (
async: true) with a 5-second timeout, so they never slow Claude Code down. Output is discarded; nothing enters the model’s context. - The server adds the hour, weekday and country (from a header the network attaches to the connection); the IP isn’t stored.
- The key in the script is Supabase’s public (publishable) key: it can only send events, not read raw data. Events per network are rate-limited (see the notes below).
3. Verify
Start claude in a new terminal, send a message, wait a minute and open the map — the message and token counters go up. The /hooks command lists active hooks.
How to turn it off
One command removes only the Hourglyph entries from ~/.claude/settings.json (keeping a backup at settings.json.hourglyph-bak) and deletes the script. Your other hooks and settings stay as they are. Read the source on GitHub.
curl -fsSL https://hourglyph.github.io/hook/uninstall.sh | shNeeds python3 or node; without them it changes nothing and tells you what to remove by hand.
Or ask Claude Code
Remove the Hourglyph hooks for Claude Code on this machine (https://hourglyph.github.io/setup/).
1. Back up ~/.claude/settings.json to ~/.claude/settings.json.hourglyph-bak.
2. Remove only the Hourglyph entries from hooks — commands containing "hourglyph.sh" / "rpc/checkin". Keep every other hook and setting as is; drop groups and events left empty.
3. Write the file back as valid JSON and re-read it to confirm it parses.
4. Delete ~/.claude/hooks/hourglyph.sh.
5. Show me the diff.By hand
Delete the three entries mentioning hourglyph.sh from ~/.claude/settings.json and the file ~/.claude/hooks/hourglyph.sh. Data already sent is anonymous and not linked to you.
Notes
- Requires
sh,awkandcurl, which ship with macOS, Linux and WSL. On Windows without WSL, Claude Code runs hooks through Git Bash, which includes all three. - To count only work on a specific project, put the same block in that repository’s
.claude/settings.json. - Up to 8 session starts and 30 messages or turns a minute are accepted per network — enough for several projects at once.
- Don’t want to configure anything? Press “I’m using Claude Code right now” on the home page.
- Hooks documentation: code.claude.com/docs/en/hooks.