You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Share One Registration-Check Skeleton Between the Installer's PreToolUse and SessionEnd Hooks #3519
registration_problems in host-setup/agent-safety/claude/install.py checks each hook's registration in settings.json with the same skeleton, written twice:
The skeleton walks the event's groups and picks out the entries that name the hook with names_hook. It reports an entry that does not run the deployed file with runs_hook and type command. It counts named entries apart from sound ones, and it closes with the "not registered" and "registered N times" lines.
The fixes in this function keep landing on the skeleton, and each one has had to be made in every copy:
The parts that differ by event have needed no matching change elsewhere:
PreToolUse requires the group's matcher to see each tool, and a blind matcher excludes the entry from the count.
SessionEnd requires a timeout of at least SWEEP_TIMEOUT_SECONDS, which excludes the entry. Its matcher note does not exclude, since a narrowed matcher still fires on some exit reasons and so still counts toward the duplicate line.
Proposal
Pull the skeleton into one helper that takes the event's groups, the hook name, the wording for its messages, and a per-entry judgment from the caller. The judgment decides whether a sound entry counts as registered and reports its own event-specific notes. check_pre_tool_hook becomes a caller passing the matcher-sees-tools judgment. The SessionEnd loop becomes a caller passing the timeout and matcher-shape judgment.
Activity
Share One Registration-Check Loop Between the Installer's Hooks (#3520)