Replies: 7 comments 1 reply
-
|
I hit this exact problem and built a working PowerShell workaround. Sharing it here in case it helps others (or informs PR #150). The workaroundA PowerShell script as a PreToolUse hook that bypasses all three Unix dependencies (no bash, no jq, no POSIX permissions). PowerShell's Hook script:
|
Beta Was this translation helpful? Give feedback.
-
|
This is quite frustrating, rtk is meant to be saving us tokens but every call on Windows produces "[rtk] /!\ No hook installed — run |
Beta Was this translation helpful? Give feedback.
-
|
For what it's worth, the way the configuration ends up looking like on Linux does work on Windows. Claude Code uses Git Bash on Windows, so |
Beta Was this translation helpful? Give feedback.
-
|
** AI CODE** This worked for me - What fixed RTK for Windows Codex: The Codex instruction path was already basically correct @C:\Users"USER".codex\RTK.md RTK was installed and on PATH rtk --version rtk 0.35.0 Fix was to set RTK’s database path to a writable workspace location: [tracking] C:\Users"USER"\AppData\Roaming\rtk\config.toml rtk test -d was the wrong command rtk test -d ./src Fix was to update: C:\Users"USER".codex\RTK.md Use rtk proxy for shell builtins, PowerShell cmdlets, cmd builtins, and shell syntax. where bash -> C:\Windows\System32\bash.exe wsl -l -v Git Bash was installed at: C:\Program Files\Git\bin\bash.exe rtk proxy C:\Progra~1\Git\bin\bash.exe -lc "test -d ./src && echo exists" bash -lc ... rtk proxy powershell -NoProfile -Command "Test-Path -LiteralPath './src' -PathType Container" rtk proxy C:\Progra~1\Git\bin\bash.exe -lc "test -d ./src" rtk proxy cmd /c "if exist .\src (echo exists) else (echo missing)" rtk env Total commands: 68 AGENTS.md -> absolute RTK.md path |
Beta Was this translation helpful? Give feedback.
-
|
Thanks @skymat for the PowerShell workaround, it pointed me in the right direction. I tried following your PS1 approach first but still hit "Hook outdated" on every call, plus the hook was silently not firing. Ended up going down the Git Bash path instead and had to solve two more undocumented Windows bugs to get it fully clean. Sharing the end-to-end tutorial in case it helps others, and as additional input for PR #150. Environment
What I tried first (and what went wrong)Attempt 1 —
|
Beta Was this translation helpful? Give feedback.
-
|
For anyone landing here on Windows: I followed @cobrabr's manual pattern + @fajarmf10's exact hook script, everything looked correct per the docs, but Claude Code wouldn't actually run the hook. Every Bash call threw: All backslashes silently dropped. Took me a while to figure out: Claude Code on Windows dispatches hook commands through The fix is just changing the "command": "/c/Users/Jakov/.claude/hooks/rtk-rewrite.sh"Not Hopefully this saves someone else the detour. |
Beta Was this translation helpful? Give feedback.
-
|
Quick question for anyone watching #1635: What's the cleanest way to actually know when the official Windows fix lands in a published release? Subscribing to the PR + the release notes feed, or is there a better channel? And related: when it does ship and I run |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Context: What
rtk init --globaldoes on UnixWhen you run
rtk init --globalon macOS or Linux, RTK sets up a full system-levelintegration with Claude Code. Four things happen:
~/.claude/settings.jsonis updated with aPreToolUsehook entry:{ "hooks": { "PreToolUse": [{ "matcher": "Bash", "hooks": [{ "type": "command", "command": "~/.claude/hooks/rtk-rewrite.sh" }] }] } }This tells Claude Code: before executing any Bash command, run this hook first.
~/.claude/hooks/rtk-rewrite.shis created — the hook script that interceptsevery command Claude Code is about to run, rewrites it through RTK if applicable,
and returns the rewritten command transparently.
~/.claude/RTK.mdis created — a slim (10-line) awareness file describingRTK's meta commands (
rtk gain,rtk discover, etc.).~/.claude/CLAUDE.mdis updated with a reference@RTK.md, so Claude Codeautomatically loads the awareness file in every session.
The result: command rewriting is enforced at the system level. When Claude Code
issues
git status, the hook intercepts it and silently rewrites it tortk git statusbefore it ever executes. The LLM has no role in this — it happens unconditionally.
What happens on Windows
Running
rtk init --globalon Windows produces:Only CLAUDE.md is updated. It receives a full ~137-line block of instructions
telling Claude to always prefix commands with
rtk. Steps 1, 2, and 3 above areskipped entirely — no hook, no
settings.jsonupdate, noRTK.md.This means on Windows, RTK relies entirely on the LLM reading the CLAUDE.md instructions
and choosing to follow them. There is no system-level enforcement. Claude may prefix
commands correctly most of the time, but it is not guaranteed — the model can forget,
deprioritize the instruction under long context, or simply not apply it consistently.
Why the hook cannot be installed on Windows
The hook mechanism has three Unix-specific dependencies that have no native Windows equivalent:
Bash —
rtk-rewrite.shis a bash script. Windows has no native bash shell.Git Bash and WSL exist, but they are not guaranteed to be present or configured
in the environment where Claude Code runs hooks.
jq— the hook script usesjqto parse and build the JSON that Claude Code'sPreToolUseprotocol requires.jqis not available by default on Windows.Unix file permissions (
chmod 755) — the hook file must be executable.Setting executable permissions uses
std::os::unix::fs::PermissionsExt, a Rusttrait that is only available on Unix targets and does not compile on Windows at all.
Because of these three blockers, the hook installer in
src/init.rsis gated behind#[cfg(unix)]. The non-Unix code path warns and falls back to CLAUDE.md injection,which is the only mechanism that works cross-platform today.
Work in progress
There is an open pull request actively working on a solution to this limitation:
PR #150 — Windows-native hook support
The reliability gap
rtk init --globalPreToolUsehook — OS-level interceptionrtk init --globalWindows users get the awareness of RTK but not the enforcement. The token savings
RTK promises (60-90%) depend on consistent command rewriting — which is only
guaranteed in hook mode.
Beta Was this translation helpful? Give feedback.
All reactions