Fix SessionStart hook variable expansion on Linux#584
Conversation
📝 WalkthroughWalkthroughThe change modifies the Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes Possibly related issues
Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@hooks/hooks.json`:
- Line 9: The command value in hooks.json currently interpolates
${CLAUDE_PLUGIN_ROOT}/hooks/run-hook.cmd without quotes, which breaks on Windows
paths with spaces; update the "command" entry so the executable path portion is
wrapped in double quotes while leaving the session-start argument unquoted
(i.e., quote ${CLAUDE_PLUGIN_ROOT}/hooks/run-hook.cmd but keep session-start as
a separate argument) so the "command" key correctly handles paths with spaces.
| { | ||
| "type": "command", | ||
| "command": "'${CLAUDE_PLUGIN_ROOT}/hooks/run-hook.cmd' session-start", | ||
| "command": "${CLAUDE_PLUGIN_ROOT}/hooks/run-hook.cmd session-start", |
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
fd hooks.json -x cat -n {}Repository: obra/superpowers
Length of output: 479
🏁 Script executed:
# Look for other hook commands to see if there's a consistent pattern
rg "command.*CLAUDE_PLUGIN_ROOT" -A 2 -B 2Repository: obra/superpowers
Length of output: 1225
🏁 Script executed:
# Search for any documentation or comments about variable expansion in hooks
rg -i "variable.*expansion|quote|CLAUDE_PLUGIN_ROOT" --type json --type md --type txtRepository: obra/superpowers
Length of output: 1318
🏁 Script executed:
# Check if there are any other similar configuration patterns in the repo
fd -e json -x grep -l "CLAUDE_PLUGIN_ROOT" {}Repository: obra/superpowers
Length of output: 78
Missing quotes around path variable will break Windows installations with spaces in the plugin directory.
The documentation in docs/windows/polyglot-hooks.md explicitly requires quoting: "The path must be quoted because ${CLAUDE_PLUGIN_ROOT} may contain spaces on Windows (e.g., C:\Program Files\...)." All examples in that file use double quotes around the variable expansion.
Change to:
Diff
- "command": "${CLAUDE_PLUGIN_ROOT}/hooks/run-hook.cmd session-start",
+ "command": "\"${CLAUDE_PLUGIN_ROOT}/hooks/run-hook.cmd\" session-start",📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| "command": "${CLAUDE_PLUGIN_ROOT}/hooks/run-hook.cmd session-start", | |
| "command": "\"${CLAUDE_PLUGIN_ROOT}/hooks/run-hook.cmd\" session-start", |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@hooks/hooks.json` at line 9, The command value in hooks.json currently
interpolates ${CLAUDE_PLUGIN_ROOT}/hooks/run-hook.cmd without quotes, which
breaks on Windows paths with spaces; update the "command" entry so the
executable path portion is wrapped in double quotes while leaving the
session-start argument unquoted (i.e., quote
${CLAUDE_PLUGIN_ROOT}/hooks/run-hook.cmd but keep session-start as a separate
argument) so the "command" key correctly handles paths with spaces.
|
I've been having similar issues loading superpowers as @04cb . I've tried both the fix submitted and the CodeRabbit. Test environment
I've also tried to get Claude to interactively try and resolve the issue with no luck. The issue seems to be triggered by running multiple Claude Code sessions in different terminal windows, in my situation. Claude Code change log suggests there is some bug fixes in a newer version. v2.1.61 — Fixed concurrent writes corrupting config on Windows. This is almost certainly contributing to your inconsistent plugin loading, since plugin state is tracked in config files that can corrupt under concurrent access. Initial testing with Claude Code v2.1.61 looks promising. Root cause summary for the PR comment: the fix that actually worked on Windows with v2.1.63 was:
|
…e management
Comprehensive audit of all 16 skills with fixes and enhancements:
Skills improvements:
- verification-before-completion: canonical evidence format (command/citation/diff)
- using-git-worktrees: rework to layer on native EnterWorktree
- test-driven-development: add pipelined TDD mode and evidence gates
- agent-team-driven-development: add pipelined TDD and evidence gates
- dispatching-parallel-agents: add worktree isolation and autonomy
- composing-teams: add agent hierarchy and test-writer role
- receiving-code-review: add evidence demand and pedantry filter
- systematic-debugging: improve CSO, add fork and worktree support
- writing-skills: align with Anthropic guide, add versioning
- finishing-a-development-branch: fix worktree CWD and add state.yml
- requesting-code-review: require citation evidence from reviewers
- writing-plans: add directory-based plans and test expectations
- brainstorming: add verification gates, research step, assumption challenging
- executing-plans: add evidence gates and cold session resume
- subagent-driven-development: add evidence gates and progress persistence
- using-superpowers: trim red flags, fix subagent context gap
Cross-cutting fixes:
- Generalize "your human partner" to "the user" across all skills
- Restore Cursor/Codex/multi-platform support across skills
- Correct spec-reviewer agent type and remove bias language (CX-4, CX-18, CX-19)
- Align code-reviewer placeholder to {PLAN_OR_REQUIREMENTS} (CX-7)
- Add worktree env file guidance and fix hook bash compatibility (obra superpowers obraGH-521, obraGH-572, obraGH-584)
- Add integration section and sequential fallback to dispatching (CX-17, markelz0r)
- Add announce and cross-task dependency check to agent-team (CX-15, obra superpowers obraGH-578)
- Update stale skill references and verification links (CX-9)
- Address CodeRabbit review findings
Documentation:
- Skills audit brainstorm, design document, and implementation plan
- Skills audit v2 design, research, and implementation plan
- Upstream research: open issues/PRs, closed issues, forks survey, unmerged PRs
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…e management
Comprehensive audit of all 16 skills with fixes and enhancements:
Skills improvements:
- verification-before-completion: canonical evidence format (command/citation/diff)
- using-git-worktrees: rework to layer on native EnterWorktree
- test-driven-development: add pipelined TDD mode and evidence gates
- agent-team-driven-development: add pipelined TDD and evidence gates
- dispatching-parallel-agents: add worktree isolation and autonomy
- composing-teams: add agent hierarchy and test-writer role
- receiving-code-review: add evidence demand and pedantry filter
- systematic-debugging: improve CSO, add fork and worktree support
- writing-skills: align with Anthropic guide, add versioning
- finishing-a-development-branch: fix worktree CWD and add state.yml
- requesting-code-review: require citation evidence from reviewers
- writing-plans: add directory-based plans and test expectations
- brainstorming: add verification gates, research step, assumption challenging
- executing-plans: add evidence gates and cold session resume
- subagent-driven-development: add evidence gates and progress persistence
- using-superpowers: trim red flags, fix subagent context gap
Cross-cutting fixes:
- Generalize "your human partner" to "the user" across all skills
- Restore Cursor/Codex/multi-platform support across skills
- Correct spec-reviewer agent type and remove bias language (CX-4, CX-18, CX-19)
- Align code-reviewer placeholder to {PLAN_OR_REQUIREMENTS} (CX-7)
- Add worktree env file guidance and fix hook bash compatibility (obra superpowers obraGH-521, obraGH-572, obraGH-584)
- Add integration section and sequential fallback to dispatching (CX-17, markelz0r)
- Add announce and cross-task dependency check to agent-team (CX-15, obra superpowers obraGH-578)
- Update stale skill references and verification links (CX-9)
- Address CodeRabbit review findings
Documentation:
- Skills audit brainstorm, design document, and implementation plan
- Skills audit v2 design, research, and implementation plan
- Upstream research: open issues/PRs, closed issues, forks survey, unmerged PRs
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Fixes issue #577. The hook command used single quotes around CLAUDE_PLUGIN_ROOT which prevented shell variable expansion on Linux. This caused the hook to fail with No such file or directory error.
Changed from single quotes to no quotes since the JSON string already provides proper quoting. The shell will now correctly expand the CLAUDE_PLUGIN_ROOT environment variable.