Summary
On Windows with Claude Code 2.1.177, the superpowers@claude-plugins-official 5.1.0 SessionStart hook can fail before run-hook.cmd executes when the command is run through PowerShell. The current hook command begins with a quoted string followed by session-start; in PowerShell that leading quoted string is parsed as an expression, not as a command invocation, so the following bareword becomes an unexpected token.
Environment
- OS: Windows
- Claude Code CLI:
2.1.177 (Claude Code)
- Plugin:
superpowers@claude-plugins-official 5.1.0
- Local plugin package metadata:
{ "name": "superpowers", "version": "5.1.0" }
Observed behavior
A persisted Claude Code SessionStart non-blocking hook error for this host contains:
hookName: SessionStart:startup
At line:1 char:101
Unexpected token 'session-start' in expression or statement.
ParserError: UnexpectedToken
The underline in the persisted error points at session-start.
Current manifest command
Local hooks/hooks.json for Superpowers 5.1.0 contains:
"command": "\"${CLAUDE_PLUGIN_ROOT}/hooks/run-hook.cmd\" session-start"
hooks/run-hook.cmd exists locally.
Why this fails under PowerShell
In PowerShell, a statement starting with a quoted string is treated as a string expression. The subsequent bareword session-start is not passed as an argument to that string, so PowerShell reports UnexpectedToken before the .cmd wrapper runs.
Suggested fix
If the hook command may be executed by PowerShell, use PowerShell's call operator:
& "${CLAUDE_PLUGIN_ROOT}/hooks/run-hook.cmd" session-start
Alternatively, have Claude Code invoke .cmd hooks through CMD explicitly, e.g. cmd /c, when running Windows plugin hooks.
Superpowers' own Windows polyglot hook documentation says Windows hooks run through CMD and gives a cmd /c simulation. This host's persisted error indicates the command is instead being interpreted by PowerShell, so either the plugin manifest needs to be PowerShell-safe or the host invocation shell should match the documented CMD path.
I did not find an existing matching issue in obra/superpowers for run-hook.cmd session-start PowerShell UnexpectedToken char 101; the only search hit was unrelated issue #101.
Summary
On Windows with Claude Code 2.1.177, the
superpowers@claude-plugins-official5.1.0 SessionStart hook can fail beforerun-hook.cmdexecutes when the command is run through PowerShell. The current hook command begins with a quoted string followed bysession-start; in PowerShell that leading quoted string is parsed as an expression, not as a command invocation, so the following bareword becomes an unexpected token.Environment
2.1.177 (Claude Code)superpowers@claude-plugins-official5.1.0{ "name": "superpowers", "version": "5.1.0" }Observed behavior
A persisted Claude Code SessionStart non-blocking hook error for this host contains:
The underline in the persisted error points at
session-start.Current manifest command
Local
hooks/hooks.jsonfor Superpowers 5.1.0 contains:hooks/run-hook.cmdexists locally.Why this fails under PowerShell
In PowerShell, a statement starting with a quoted string is treated as a string expression. The subsequent bareword
session-startis not passed as an argument to that string, so PowerShell reportsUnexpectedTokenbefore the.cmdwrapper runs.Suggested fix
If the hook command may be executed by PowerShell, use PowerShell's call operator:
Alternatively, have Claude Code invoke
.cmdhooks through CMD explicitly, e.g.cmd /c, when running Windows plugin hooks.Superpowers' own Windows polyglot hook documentation says Windows hooks run through CMD and gives a
cmd /csimulation. This host's persisted error indicates the command is instead being interpreted by PowerShell, so either the plugin manifest needs to be PowerShell-safe or the host invocation shell should match the documented CMD path.I did not find an existing matching issue in
obra/superpowersforrun-hook.cmd session-start PowerShell UnexpectedToken char 101; the only search hit was unrelated issue #101.