Skip to content

Claude Code plugin hooks never run on Windows β€” .sh scripts open in the file-associated editor instead of executingΒ #593

Description

@ArmandoPerdomo

πŸ“‹ Pre-flight Checks

  • I have searched existing issues and this is not a duplicate
  • I understand this issue needs status:approved before a PR can be opened

πŸ“ Bug Description

On Windows, none of the Claude Code plugin hooks actually execute. Every hook in plugin/claude-code/hooks/hooks.json invokes its .sh script directly:

"command": "\"${CLAUDE_PLUGIN_ROOT}/scripts/session-start.sh\""

Windows cannot execute .sh files, so ShellExecute opens them with the file-associated editor instead of running them. This affects all five hooks (SessionStart, post-compaction, UserPromptSubmit, SubagentStop, Stop), so the memory features that depend on hooks (session tracking, auto-import, compaction recovery, passive capture) silently never run.

Environment: Windows 11 Pro Β· Claude Code 2.1.206 Β· engram v1.19.0 Β· plugin 0.1.1 Β· installed via the official engram setup claude-code Β· Git Bash on PATH (C:\Program Files\Git\usr\bin\bash.exe).

Fix that works locally: prefixing every hook command with bash makes all five hooks work (verified: session-start.sh returns the memory protocol + context payload with exit 0):

"command": "bash \"${CLAUDE_PLUGIN_ROOT}/scripts/session-start.sh\""

Git Bash wins PATH resolution over the WSL stub on a standard Git-for-Windows install, and Claude Code already requires Git Bash on Windows, so bash should be a safe cross-platform prefix (no-op on macOS/Linux).

Side note: scripts/user-prompt-submit.ps1 ships in the plugin but is never referenced by hooks.json β€” looks like a Windows path was started but not wired up. Happy to test a fix on Windows.

πŸ”„ Steps to Reproduce

  1. On Windows 11, install the plugin with engram setup claude-code.
  2. Start any Claude Code session (or submit a prompt, or let a session stop).
  3. Watch the editor associated with .sh files open instead of the hook executing.

βœ… Expected Behavior

Hook scripts execute silently: SessionStart injects the memory protocol and prior context, UserPromptSubmit/SubagentStop/Stop capture session data into engram. No windows open.

❌ Actual Behavior

The .sh file-associated editor (VS Code in my case) opens showing ~/.claude/plugins/cache/engram/engram/0.1.1/scripts and closes shortly after β€” on every SessionStart, UserPromptSubmit, SubagentStop and Stop. The hooks never actually run, so no session tracking, context injection or compaction recovery happens on Windows.

Operating System

Windows

Engram Version

1.19.0

Agent / Client

Claude Code

πŸ“‹ Relevant Logs

πŸ’‘ Additional Context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions