[Windows] Hook subprocess spawning creates visible console window flashes on every tool call
Environment
- Platform: Windows 11 Enterprise
- Claude Code: VS Code extension
- Node.js: v24.14.0
Problem
On Windows, every hook invocation (PreToolUse, PostToolUse, SessionStart, etc.) causes a console window (PowerShell or cmd) to briefly flash on screen. This happens because Claude Code's hook subprocess spawner does not set windowsHide: true (or equivalent CREATE_NO_WINDOW flag) when spawning hook processes on Windows.
Hook commands like node "path/to/hook.mjs" are spawned without suppressing the console window, causing a visible flash for every tool call. With plugins like context-mode that register hooks for Bash, Read, Grep, WebFetch, Agent, and multiple MCP tools, this results in dozens of console flashes per conversation turn — extremely distracting during normal use.
Expected Behavior
Hook processes run silently in the background with no visible console windows.
Steps to Reproduce
- Install Claude Code VS Code extension on Windows
- Install any plugin that registers a Node.js-based hook (e.g. context-mode)
- Trigger a tool call that matches the hook (e.g. a
BashorRead) - Observe console window flash
Proposed Fix
The subprocess spawner for hooks should use:
spawn(cmd, args, { windowsHide: true, ...rest })
This maps to CREATE_NO_WINDOW on Windows and eliminates the console flash without affecting hook stdin/stdout piping.
Workaround
Wrapping hook commands with powershell.exe -WindowStyle Hidden -NonInteractive -NoProfile -ExecutionPolicy Bypass -File <wrapper.ps1> partially mitigates the issue but adds ~200ms latency per hook call, gets overwritten on plugin upgrade, and is fragile. The correct fix is in Claude Code's hook process spawner.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗