Log Every Elicitation Dialog Shown to a Human
Distinct from the Elicitation-event hooks elsewhere in this catalog, which act on the request itself: this one is purely about visibility completeness, confirming a human-facing dialog actually appeared, for audit purposes separate from whatever decision was made on it.
1. Save this as the hook script
#!/usr/bin/env python3
"""Notification hook — logs elicitation dialogs shown to the user.
Wire with matcher "elicitation_dialog|elicitation_url_dialog"."""
import json, sys, datetime
from pathlib import Path
data = json.load(sys.stdin)
log_path = Path(data.get("cwd", ".")) / ".claude" / "elicitation_dialog_log.jsonl"
log_path.parent.mkdir(parents=True, exist_ok=True)
entry = {"ts": datetime.datetime.utcnow().isoformat() + "Z",
"notification_type": data.get("notification_type")}
with open(log_path, "a") as f:
f.write(json.dumps(entry) + "\n")
sys.exit(0)
Save to a path inside your project, e.g. .claude/hooks/log-elicitation-dialog-shown.sh, then chmod +x it.
2. Wire it into .claude/settings.json
{
"hooks": {
"Notification": [
{
"matcher": "elicitation_dialog|elicitation_url_dialog",
"hooks": [
{"type": "command", "command": "python3 .claude/hooks/log-elicitation-dialog-shown.py"}
]
}
]
}
}
Before you use this
A hook runs with your local shell's permissions — review the script above before adding it, the same way you'd review any script you didn't write yourself. See our guide on hook security risks for the specific CVEs this category of feature has already produced.
Related hooks