Antigravity hooks are declared in a plugin's hooks.json, and the event that runs before a tool executes is PreToolUse; that handler receives the tool call as JSON and can rewrite its arguments (the overwrite merge into toolCall.args), which is how secrets are redacted in transit. Option A is the only choice that both binds to the pre-tool event and ties the outcome to the handler's result: it reads the payload, rewrites the parameters, and only then returns success, so a failed sanitization never yields the success result that lets the call proceed. C runs after execution (PostToolUse only observes and cannot change or block the call), so keys would already have been written. B only evaluates policy and edits strings in place, and D only mutates and returns the payload with no mechanism for halting on failure. Note that the Inspect/Decide/Transform names are exam abstractions, since the documented hook type is a command hook.
Community Discussion