Good thinking. That seems to have worked. I'll have to use it in anger to see how well it holds up but so far it's working!
First Edit: it works for the CLI but may not be working for the VS Code plugin.
Second Edit: I asked Claude to look at the VS Code extension and this is what it thinks:
>Bottom line: This is a bug in the VS Code extension. The extension defines its own programmatic PreToolUse/PostToolUse hooks for diagnostics tracking and file autosaving, but these override (rather than merge with) user-defined hooks from ~/.claude/settings.json. Your ExitPlanMode hook works in the CLI because the CLI reads settings.json directly, but in VS Code the extension's hooks take precedence and yours never fire.
There's a known bug in the VS Code native extension - hooks dont work. Somewhere in their sea of issues on GitHub, it's in there.