Summary
rtk init --global on Windows falls back to --claude-md mode with the message:
⚠️ Hook-based mode requires Unix (macOS/Linux).
Windows: use --claude-md mode for full injection.
Falling back to --claude-md mode.
However, Claude Code fully supports PreToolUse hooks on Windows (via Git Bash), and rtk rewrite works perfectly on Windows. There is no technical reason to skip hook installation on this platform.
Evidence
rtk rewrite works on Windows
$ rtk rewrite "git status"
rtk git status
$ rtk rewrite "cargo test"
rtk cargo test
$ rtk rewrite "ls -la"
rtk ls -la
Manual hook setup works
I manually created a PreToolUse hook and registered it in ~/.claude/settings.json:
Hook script (~/.claude/hooks/rtk-rewrite.sh):
#!/bin/bash
INPUT=$(cat)
COMMAND=$(echo "$INPUT" | grep -o '"command"[[:space:]]*:[[:space:]]*"[^"]*"' | head -1 | sed 's/.*:[[:space:]]*"//;s/"$//')
if [ -z "$COMMAND" ] || [[ "$COMMAND" == rtk\ * ]]; then
exit 0
fi
REWRITTEN=$(rtk rewrite "$COMMAND" 2>/dev/null)
if [ $? -ne 0 ] || [ "$REWRITTEN" = "$COMMAND" ]; then
exit 0
fi
REWRITTEN_ESCAPED=$(echo "$REWRITTEN" | sed 's/\\/\\\\/g; s/"/\\"/g')
cat <<ENDJSON
{"hookSpecificOutput":{"hookEventName":"PreToolUse","permissionDecision":"allow","permissionDecisionReason":"rtk: token-optimized","updatedInput":{"command":"$REWRITTEN_ESCAPED"}}}
ENDJSON
exit 0
settings.json:
{
"hooks": {
"PreToolUse": [
{
"matcher": "Bash",
"hooks": [
{
"type": "command",
"command": "\"$HOME/.claude/hooks/rtk-rewrite.sh\""
}
]
}
]
}
}
This works correctly — Claude Code on Windows uses Git Bash for hook execution.
Request
Please update rtk init --global to support hook-based installation on Windows, since:
- Claude Code uses Git Bash on Windows — shell scripts work fine
rtk rewrite already works on Windows
- The CLAUDE.md fallback is less effective because Claude Code prefers built-in tools (Read, Grep, Glob) over Bash, and the CLAUDE.md instructions are not guaranteed to be followed by subagents
Environment
- OS: Windows 11 Pro (10.0.26200)
- RTK: v0.27.2
- Claude Code: VSCode extension
- Shell: Git Bash (MINGW64)
Summary
rtk init --globalon Windows falls back to--claude-mdmode with the message:However, Claude Code fully supports PreToolUse hooks on Windows (via Git Bash), and
rtk rewriteworks perfectly on Windows. There is no technical reason to skip hook installation on this platform.Evidence
rtk rewrite works on Windows
Manual hook setup works
I manually created a PreToolUse hook and registered it in
~/.claude/settings.json:Hook script (
~/.claude/hooks/rtk-rewrite.sh):settings.json:
{ "hooks": { "PreToolUse": [ { "matcher": "Bash", "hooks": [ { "type": "command", "command": "\"$HOME/.claude/hooks/rtk-rewrite.sh\"" } ] } ] } }This works correctly — Claude Code on Windows uses Git Bash for hook execution.
Request
Please update
rtk init --globalto support hook-based installation on Windows, since:rtk rewritealready works on WindowsEnvironment