Skip to content

Cursor (Windows): hooks-cursor.json should use run-hook.cmd for session-start #871

Closed

Description

@adamkane

Summary

On Windows 11, Cursor loads hooks/hooks-cursor.json which currently runs ./hooks/session-start. That file is extensionless (intentionally, per run-hook.cmd comments, so Claude Code does not prepend bash to .sh). Windows does not execute it as a program; the user gets the system Open with dialog instead of the SessionStart hook.

Expected

SessionStart runs silently via Git Bash, matching hooks.json behavior: run-hook.cmd session-start.

Proposed change

In hooks/hooks-cursor.json, change:

"command": "./hooks/session-start"

to:

"command": "./hooks/run-hook.cmd session-start"

Environment

  • OS: Windows 11
  • Cursor + superpowers@claude-plugins-official
  • Git for Windows installed (standard path)

References

  • hooks/run-hook.cmd already documents why the hook script is extensionless and routes to C:\Program Files\Git\bin\bash.exe.

Activity

  1. gilangjavier commented on Mar 22, 2026

    @gilangjavier

    Thanks — this makes sense. On Windows the extensionless ./hooks/session-start won’t execute directly, so Cursor ends up showing the “Open with” dialog.

    I’ll send a PR that updates hooks/hooks-cursor.json to run the SessionStart hook via run-hook.cmd (same approach as hooks.json), i.e.:

    • from: ./hooks/session-start
    • to: ./hooks/run-hook.cmd session-start

    That should make the Cursor hook behave consistently on Windows while keeping the extensionless hook script for Claude Code compatibility.

  2. added
    bug
    cursor
    hooks
    on Mar 23, 2026
  3. RatmmmhSquishyRat commented on Apr 7, 2026

    @RatmmmhSquishyRat

    still trigger it today, need fix~~

  4. Batarbin commented on Apr 7, 2026

    @Batarbin

    I encountered similar warning about the session-start when using Copilot in VS Code (I don't know about the CLI)

    Image

    The underline is slightly misaligned there... That's where it should be:

    At line:1 char:86
    + ... plugins\github.com\obra\superpowers/hooks/run-hook.cmd" session-start
    +                                                             ~~~~~~~~~~~~~
    Unexpected token 'session-start' in expression or statement.
        + CategoryInfo          : ParserError: (:) [], ParentContainsErrorRecordException
        + FullyQualifiedErrorId : UnexpectedToken
    
  5. AJpon commented on Apr 15, 2026

    @AJpon

    I encountered similar warning about the session-start when using Copilot in VS Code (I don't know about the CLI)

    @Batarbin

    {
    "hooks": {
    "SessionStart": [
    {
    "matcher": "startup|clear|compact",
    "hooks": [
    {
    "type": "command",
    "command": "\"${CLAUDE_PLUGIN_ROOT}/hooks/run-hook.cmd\" session-start",
    "async": false
    }
    ]
    }
    ]
    }
    }

    The above is the current hook file. Because the format of Copilot Hooks differs slightly from that of Claude Hooks, the value of the shell field (set to bash by default) is ignored in Windows environments.

    The string in the command field is processed by PowerShell. To execute a file in PowerShell, you need the "Call operator (&)".

    Example: & "${CLAUDE_PLUGIN_ROOT}/hooks/run-hook.cmd" session-start

    Given the existence of shells other than PowerShell, using this operator is not practical.

    In addition to the command field, the following additional fields are available in Copilot Hooks:

    Field Description
    command Default command (cross-platform)
    windows Windows-specific command
    linux Linux-specific command
    osx macOS-specific command
    cwd Script working directory (project root if omitted)
    env Additional environment variables (object)
    timeout Timeout in seconds (default: 30 seconds)

    When using this in VS Code, the Hook will work without issues if you rewrite it as follows:

    {
      "hooks": {
        "SessionStart": [
          {
            "matcher": "startup|clear|compact",
            "hooks": [
              {
                "type": "command",
                "command": "\"${CLAUDE_PLUGIN_ROOT}/hooks/run-hook.cmd\" session-start",
                "windows": "cmd /c \"${CLAUDE_PLUGIN_ROOT}/hooks/run-hook.cmd\" session-start",
                "async": false
              }
            ]
          }
        ]
      }
    }

    However, since I do not have a Claude subscription, I cannot verify whether this hook causes errors in Claude Code

    If you want to make hooks.json compliant with the Claude Hook specifications, you need to change run-hook.cmd to a PowerShell/bash polyglot and rename it to run-hook.ps1.

  6. qiyuey commented on Apr 20, 2026

    @qiyuey

    Just chiming in to confirm this is still reproducible on superpowers 5.0.7 + Cursor on Windows 11 — every new agent session pops up the Windows "Select an app to open 'session-start'" dialog, which is pretty disruptive.

    Applied the one-line fix locally (swapping ./hooks/session-start → ./hooks/run-hook.cmd session-start in hooks/hooks-cursor.json) and it works perfectly: dialog gone, SessionStart hook runs silently through Git Bash as expected.

    Since the fix is tiny, already proven by the parity with hooks.json, and this affects every Windows + Cursor user on install, would it be possible to prioritize merging it? Happy to open a PR if that helps move things along.

    Thanks a lot for maintaining the project!

  7. ThatGuyJacobee commented on Apr 28, 2026

    @ThatGuyJacobee

    Our team can reproduce this here:

    • Cursor - Windows 11
    • Superpowers 5.0.7

    Just wanted to bump when you have a chance - thank you for the project!

  8. arittr commented on Apr 28, 2026

    @arittr
    Collaborator

    Fixed by #1054, now merged into dev. Cursor on Windows now invokes SessionStart via ./hooks/run-hook.cmd session-start instead of executing the extensionless ./hooks/session-start directly.

  9. ggirard07 commented on Aug 12, 2026

    @ggirard07

    I am still hitting the same issue on vscode + github copilot. I am using the plugin integration from vscode.

    At line:1 char:87
    + ... plugins\github.com\obra\superpowers/hooks/run-hook.cmd" session-start
    +                                                             ~~~~~~~~~~~~~
    Unexpected token 'session-start' in expression or statement.
        + CategoryInfo          : ParserError: (:) [], ParentContainsErrorRecordException
        + FullyQualifiedErrorId : UnexpectedToken
    
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

    bugcursorhookswindows

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions