Developer Builds Stop Hook to Skip Audit Nags During Unattended Claude Code Sessions
A developer using Claude Code's autonomous setup discovered that audit notification hooks designed for interactive sessions were also firing during unattended automated runs, generating 19 stacked error logs overnight on July 12, 2026. The Stop hook — a shell script that checks whether Claude performed a self-audit after modifying files — was blocking CLI runs launched via launchd with an exit 2 error, degrading pipeline execution. The root cause was that Claude Code uses a single Stop hook primitive for both human-facing and machine-facing sessions, with no built-in distinction between the two contexts. The developer identified that the session transcript file contains an 'entrypoint' field — 'cli' for interactive use and 'sdk-cli' for Agent SDK runs — which the hook itself can read to determine whether a human is present. By parsing this field from the transcript at runtime, the hook can silently skip audit nags during unattended automation while still enforcing them in interactive sessions.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.
Discussion (0)
Log in to join the discussion and vote.
Log in