Writing Cross-Platform Hooks for AI Coding Agents

How to write a single hook script that works across Claude Code and Cursor, giving you deterministic control over agent behaviour when it matters most.