How /goal actually works under the hood, and how to get the same effect yourself with a one-line file edit — no plugin, no restart, no patched binary.
Claude Code has a private, in-memory sessionHooks registry that only the built-in /goal command and Skills can write to. You can't access it from user-land.
But the runtime re-reads your .claude/settings.local.json file on every single hook event, so dropping a hooks block into that file is effectively the same thing: the hook becomes active on the next tool call, and deleting it from the file removes it on the call after that. No restart needed. Both directions were verified empirically.