Skip to content

[FEATURE] Add windowsHide option for hooks on Windows #17230

Closed as not planned
Closed as not planned

Description

@mmmprod

Preflight Checklist

  • I have searched existing requests and this feature hasn't been requested yet
  • This is a single feature request (not multiple features)

Problem Statement

When hooks execute on Windows, a CMD console window briefly appears for each hook execution. This creates a poor user experience, especially with hooks like Stop that run after every response

Proposed Solution

Attempted Workarounds (all failed)

  1. PowerShell -WindowStyle Hidden - window still flashes
  2. VBScript wrapper with WshShell.Run ..., 0, True - window still flashes
  3. Batch file with start /b - window still flashes

The root cause is that Claude Code uses child_process to spawn hook commands, which creates a visible cmd.exe window on Windows before the actual command runs.

Proposed Solution

Add a windowsHide option for hooks (similar to what was added in SDK v0.17.1 - see #103 in claude-agent-sdk-typescript).

Example configuration:

{
  "hooks": {
    "Stop": [{
      "hooks": [{
        "type": "command",
        "command": "node script.js",
        "windowsHide": true
      }]
    }]
  }
}

Or default windowsHide: true for all hook executions on Windows

### Alternative Solutions

_No response_

### Priority

Critical - Blocking my work

### Feature Category

CLI commands and flags

### Use Case Example

_No response_

### Additional Context

_No response_

Activity

  1. added
    enhancement
    on Jan 10, 2026
  2. EngDawood commented on Jan 11, 2026

    @EngDawood

    yes , it's very annoying

  3. thinkhalo commented on Jan 11, 2026

    @thinkhalo

    Supporting this request - critical for plugin ecosystem

    +1 for this feature request.

    Use Case:

    The claude-mem plugin executes hooks on every user interaction:

    • SessionStart → Context injection (runs once per session startup)
    • UserPromptSubmit → Session initialization (every user message)
    • PostToolUse → Observation capture (every tool result)
    • Stop → Summary generation (every stop event)

    On Windows, each hook execution creates a visible console window popup, resulting in dozens of flashing windows per session. This makes the plugin (and Claude Code itself) nearly unusable on Windows.

    Technical Details:

    The issue is that hook spawn calls don't include windowsHide: true. This is standard Node.js practice for Windows:

    const child = spawn(command, args, {
      windowsHide: process.platform === 'win32',  // Prevents console window
      shell: true,
      stdio: 'inherit'
    });

    Why This Matters:

    1. Plugin ecosystem depends on hooks - Without windowless execution, Windows users can't effectively use plugins
    2. Already solved in claude-agent-sdk - The pattern exists in the Anthropic codebase
    3. One-line fix - Adding windowsHide option to hook spawn calls
    4. Affects professional users - Makes Claude Code unsuitable for enterprise Windows environments

    Workaround Attempts:

    I've investigated all possible workarounds (PowerShell -WindowStyle Hidden, VBScript wrappers, batch files, PATH shims) - none work because:

    • The initial cmd.exe window always appears before any wrapper
    • Hooks need stdin for JSON input, eliminating most wrapper approaches
    • The spawn happens in Claude Code before hooks.json is processed

    Request:

    Could this be included in the same fix as issue #14828? It's the exact same root cause (missing windowsHide in spawn options), just in the hooks execution path instead of tool execution path.

    I'm a professional Windows user willing to test beta builds and provide detailed feedback.

    References:

    Thank you!

  4. topemalheiro commented on Jan 19, 2026

    @topemalheiro

    Anthropic please fix this, it's really annoying and we want to use claude-mem.

  5. added
    stale
    on Feb 12, 2026
  6. github-actions commented on Feb 27, 2026

    @github-actions

    Closing for now — inactive for too long. Please open a new issue if this is still relevant.

  7. github-actions commented on Mar 7, 2026

    @github-actions

    This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.

  8. locked as resolved and limited conversation to collaborators on Mar 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementstale

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions