Rename the hook.
Call it turn_ended in your own wrapper so downstream automations cannot confuse it with completion.
Use this when Claude Code hooks fire while a background task or subagent is still running. The guard separates notification from completion: check live children, require a proof receipt, and only page a human when the run is actually done or actually stuck.
Call it turn_ended in your own wrapper so downstream automations cannot confuse it with completion.
A JSON row with child ids, process ids, last status, and max runtime beats a clever notification string.
Use TURN_ENDED, WORK_PENDING, DONE_VERIFIED, and STUCK. Ambiguous “finished” messages rot trust.
The final alert needs the acceptance check that ran after the last change. A hook event without proof is only transport.
If the hook cannot inspect background state, it cannot claim done. Unknown background work means pending, not finished.
Noise burns trust. Page only for verified completion or a real boundary: credentials, money, legal terms, private data, or scope.