Session-End Compliance Checklist Reminder
A cheap habit-forming nudge for any project that keeps a running compliance TODO file: on an explicit logout (not an abrupt disconnect), print a reminder listing what's still open, so it doesn't silently roll over to whoever opens the next session.
1. Save this as the hook script
#!/usr/bin/env python3
"""SessionEnd hook — reminds about open compliance TODOs on logout.
Wire with matcher "logout"."""
import json, sys
from pathlib import Path
data = json.load(sys.stdin)
todo_path = Path(data.get("cwd", ".")) / "COMPLIANCE_TODO.md"
if todo_path.exists() and todo_path.read_text().strip():
print(f"REMINDER: {todo_path} has open items — review before the next "
f"session picks this project back up.", file=sys.stderr)
sys.exit(0)
Save to a path inside your project, e.g. .claude/hooks/session-end-compliance-checklist-reminder.sh, then chmod +x it.
2. Wire it into .claude/settings.json
{
"hooks": {
"SessionEnd": [
{
"matcher": "logout",
"hooks": [
{"type": "command", "command": "python3 .claude/hooks/session-end-compliance-checklist-reminder.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