SessionStart hook fails on Windows/Cygwin: backslash path not translated for /bin/bash
Bug Description
Plugin hooks with SessionStart event fail on Windows when Cygwin bash is the configured shell. The ${CLAUDE_PLUGIN_ROOT} variable is expanded to a Windows-style path (with backslashes), but the hook command is executed via Cygwin's /bin/bash, which strips the backslashes and produces an invalid path.
Steps to Reproduce
- Install Claude Code on Windows with Cygwin as the shell
- Install any plugin with a SessionStart hook (e.g.,
superpowers,explanatory-output-style) - Start a new session
Expected Behavior
Hooks execute successfully. The plugin root path should be translated to a Cygwin-compatible format (e.g., /c/Users/sho/.claude/plugins/cache/...) before being passed to /bin/bash.
Actual Behavior
Hooks fail with "No such file or directory". From the debug log:
Hook SessionStart:startup (SessionStart) error:
/bin/bash: C:Userssho.claudepluginscacheclaude-plugins-officialsuperpowers4.3.0/hooks/session-start.sh: No such file or directory
The Windows path C:\Users\sho\.claude\plugins\cache\claude-plugins-official\superpowers\4.3.0 has its backslashes stripped by Cygwin bash, resulting in the mangled path C:Userssho.claudeplugins....
Root Cause
When Claude Code constructs the hook command, it substitutes ${CLAUDE_PLUGIN_ROOT} with the Windows-native path (backslashes). It then invokes the command via Cygwin's /bin/bash. Cygwin bash interprets backslashes as escape characters rather than path separators, producing an invalid path.
Running the same scripts manually from a Cygwin terminal works fine because the paths are already in Unix format.
Environment
- OS: Windows 11 Pro 10.0.26200
- Shell: Cygwin bash (
/bin/bash) - Affected plugins:
superpowers@claude-plugins-official(v4.3.0),explanatory-output-style@claude-plugins-official
Suggested Fix
When the detected shell is Cygwin bash (i.e., /bin/bash on Windows), convert CLAUDE_PLUGIN_ROOT and the command path to POSIX format before execution. Cygwin provides cygpath for this:
cygpath -u "C:\Users\sho\.claude\plugins\cache\..."
# → /c/Users/sho/.claude/plugins/cache/...
Alternatively, normalize all plugin paths to use forward slashes before substitution, which works in both Cygwin and Git Bash on Windows.
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗