.gemini/settings.json. AfterAgent notifies after a response; Notification forwards Gemini CLI system alerts.
--background lets the notification send continue if Gemini CLI or its hook is interrupted. Remove the flag if you want the hook to wait for the send to finish. See send-text for details.
Gemini CLI hooks run synchronously, but with --background they wait only until Midway starts the detached send. A Notification hook fires for system alerts, not necessarily every time the agent asks a free-form question.