/agenv:patch Optional host to check (claude or codex; omit for both)from agenv
Diagnoses and fixes Claude Code/Codex plugin hook failures on Windows. Handles BOM, CRLF, path mangling, missing interpreters, and version-directory conflicts.
Ships in agenv. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Nearly every Windows hook failure has one of two causes: a .sh script cmd.exe
cannot run, or a bare Unix command or interpreter that is not resolvable when
the hook launches. One command fixes both. The tables below only name what is
being seen; find the CASE-NN root-cause write-ups in the
case catalogue.
| Symptom | Cause | CASE |
|---|---|---|
JSON Parse error: Unrecognized token '' · :: command not found · #!/bin/bash: No such file or directory · <<(을)를 지정된 경로를 찾지 못했습니다 (mojibake <<��(��) ...) | UTF-8 BOM in a hooks.json, a hook script, or the polyglot .cmd | CASE-01 |
Hook load failed: JSON Parse error | BOM, CRLF, or otherwise invalid hooks.json | CASE-01/02/05 |
SyntaxError from python3/node on a .py/.js hook file | a bash script named .py/.js calling the interpreter on itself | CASE-22 |
No such file or directory for a hook command | a .sh script or bare command cmd.exe cannot run | CASE-07/08 |
MODULE_NOT_FOUND in a Node hook | a backslash C:\... path mangled in settings.json | CASE-20 |
'node' is not recognized... / 'node'은(는) 내부 또는 외부 명령... (mojibake 'node'��...) | a bare interpreter in settings.json not on cmd.exe's PATH | CASE-23 |
bash: .../<interpreter>: No such file or directory | a hook entry whose target is the interpreter name instead of the script | CASE-24 |
Python was not found; run without arguments to install from the Microsoft Store | bare python3 resolving to the Store alias stub | CASE-09 |
hook exited with code 1 on every hook of one plugin in an open Codex session, from the moment another Codex process started | that process upgraded the plugin and deleted the version directory the session loaded | CASE-35 |
win-hooks' own SessionStart and UserPromptSubmit hooks fail in every session opened before an upgrade, while patch from the new version prints healthy | the upgrade removed the loaded version directory whole, leaving no name to relink (fixed: patch now lists it as missing root and restores it) | CASE-36 |
hook exited with code 1 on every prompt from a hook in ~/.codex/hooks.json (or a [[hooks.*.hooks]] table in config.toml) whose command starts with a quoted path such as "C:/Program Files/nodejs/node.exe" "...mjs" | Codex runs it through the PowerShell session shell, which cannot start a program from a quoted path (ParserError); patch lists it as quoted_command, rewrites hooks.json's Windows command, and the person trusts the file again in /hooks | CASE-31 |
an open session reports SKILL.md: failed to read file (os error 2) for a skill under ~/.agents/skills or ~/.claude/skills after a skill install | the installer deleted and rewrote the skill folder, or removed it from one skills root while it stays installed in another (fixed: patch lists it as missing skill and links it to the other install) | CASE-37 |
patch restores the same newer version of another plugin (missing root visualize/1.0.109) on every run, and Codex logs failed to load plugin: missing or invalid plugin.json for it | the plugin's catalogue moved it back to an older version, Codex loads the highest version directory, and a restore of links held no manifest (fixed: a recorded root above the install is restored as a real copy of the installed version, manifest included; a links-only one no record names is shadowing root and removed) | CASE-36 |
win-hooks' own hooks fail with plugin root is not a directory or hook exited with code 1 in sessions opened before the installed version number went down (1.18.0 to 0.96.6), or before the plugin moved from show-me-the-env@show-me-the-env into agenv@show-me-the-env | the root those sessions run from ranks above the install, or belongs to the earlier plugin name; a junction made in its place, or inside it, is refused by Codex (fixed: patch restores it as a real copy either way) | CASE-36, CASE-38, CASE-39 |
unsupported plugin entry type: ...\<version>\bin or plugin root is not a directory for a version folder a session runs from | the folder, or an entry in it, is a junction, and Codex refuses any reparse point in a plugin root (fixed: patch lists it as emptied root and replaces it with a real copy) | CASE-39 |
The two CP949-garbled errors look alike but are not: <<(을)를 지정된 경로... is a
BOM-corrupted polyglot .cmd (CASE-01), 'node'...내부 또는 외부 명령 is a bare
interpreter in settings.json (CASE-23).
Confirm the platform is win32 first; on macOS and Linux there is nothing to
repair and this skill does not apply.
node "$(cat ~/.claude/win-hooks/root)/bin/win-hooks.mjs" patch $ARGUMENTS
$ARGUMENTS is optionally claude or codex; with neither, both are done. If
the root file is missing, win-hooks has never run - use
npx show-me-the-env win-hooks patch instead, the npm package
../../references/install.md (relative to this file) names as the one install route.
The command reports what it found, repairs whatever is not healthy, and re-reports to prove the result. Running it again on a healthy host changes nothing.
Each host section lists how many hook files were scanned, then one line per
problem. A section headed after repair is the proof pass; healthy means
there is nothing left to do. The line prefixes are a closed vocabulary:
| Line prefix | Meaning |
|---|---|
incompatible | A hook that needs patching but has not been patched yet |
bom | A UTF-8 BOM in a hook file (breaks JSON, shebangs, and cmd.exe) |
json_crlf | CRLF line endings in hooks.json |
json_invalid | hooks.json is not parseable |
wrapper_missing | A patched hook has no entry in the hook map |
wrapper_broken | A hook entry names a target that cannot run |
wrapper_orphan | A file in the hook directory that nothing dispatches |
cmd_missing | The dispatcher is missing from the hook directory, or older than the shipped one |
recursive_wrapper | A hook script calls an interpreter on itself and loops |
python3_stub | A python hook with no working interpreter installed |
backslash_path | A settings.json hook command with Windows backslash paths |
bare_command | A settings.json hook command cmd.exe cannot resolve |
quoted_command | A Codex user hook (~/.codex/hooks.json, or inline in config.toml, which is reported for a hand edit) that opens with a quoted path PowerShell cannot run |
More lines name a plugin version directory, not a hook, and are not issue
types: missing root (removed whole while a recorded session may still run from
it, or a junction Codex refuses as a root) and emptied root (left empty) block
healthy until the repair restores them (CASE-35, CASE-36, CASE-38);
outdated root (a restored copy of a version no longer installed) blocks it until
the repair copies the installed one again; shadowing root (empty or links only,
ranked above the installed version, named by no record, so Codex loads it
instead) and lapsed root (a restored copy no session has run from for a week)
block it until the repair removes them (CASE-36); restored root is one already
a real copy of the installed version, listed beside healthy for the
sessions still running from it. missing skill, emptied skill and dangling skill name a skill folder an open session listed and can no longer read, while the same skill is installed in another skills root; each blocks healthy until the repair links it there (CASE-37).
The last runs block is the heartbeat: one line per run with its duration and
how many plugins were scanned and patched. It does not prove the hook ran, since
a hand-run repair writes the same line. win-hooks heals at every SessionStart,
announcing the result in one line so a clean run is distinguishable from a hook
that never fired (CASE-32). It heals again silently on the next prompt after a
plugin's hooks change (CASE-26). No lines at all means it never dispatched -
usually the plugin is disabled or Node is not on PATH. On Codex there is one
more cause: an upgrade changes the hook manifest, which invalidates the trust
hash Codex recorded for it, and an untrusted hook is skipped with no message at
all (CASE-33). Running patch by hand still repairs everything; re-trusting
the hook is the user's call, never win-hooks'.
Summarize as a table: Plugin | Issue | Detail. A repair lands on disk, but the
running session has already cached its hook config - tell the user to run
/reload-plugins, or it applies in the next session (CASE-13).
When the report names a Codex user hooks file to trust again, tell the user to
open /hooks and trust it; until then Codex skips that file's hooks without a
word, and granting trust is the user's call, never win-hooks' (CASE-33).
hook exited with code N: Codex hides the hook's stderr, and the code depends on the session shell (a missing script is exit 1 under pwsh -Command, -196608 under cmd /C). Replay the hook's commandWindows from its hooks/*.json under pwsh -Command, with ${PLUGIN_ROOT} replaced by the version directory the session loaded, and read the stderr there. A path into an emptied or missing version directory is CASE-35._hooks/hooks.map.json and
run claude --debug hooks. If the entry runs a shell script, confirm Git Bash
at C:\Program Files\Git\bin\bash.exe, or set WH_BASH_EXE for a
non-standard install./reload-plugins applies it (CASE-13/26).What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
6 skills in this plugin
/attachAttach another computer (a second laptop, a spare desktop) so it can take this machine's heavy work, or decide it should be restored from the profile as a working machine instead. Chooses the role, then drives agenv machine bootstrap, serve, specs, register, lanes and detach and hands the person the one line to paste. Not for restoring a profile (load), saving one (save), or reaching a machine the person does not own./contributeUse when someone wants something agenv could not install, configure or detect reported to the agenv maintainers, wants an adapter change they made proposed upstream as a pull request, or wants to review, send or withdraw an existing agenv contribution draft. Triages with agenv doctor first (local setup is never filed), drafts only through agenv contribute, and sends only after the person approves the exact preview./initStart an agenv profile or see what this machine lacks: run agenv init, suggest tools per role and platform, and point to the one install route when the engine is missing./loadBring this machine to the person's own saved agenv profile (new machine, reinstall, catching up after the profile changed elsewhere), including a preview-only look at what loading would change and getting a missing agenv engine in place first. Also use when someone asks to undo or roll back an earlier agenv load. Not for saving this machine into a profile (save), starting one (init), catalog profiles (catalog, adopt, follow) or a health check with no intent to change anything (doctor)./saveSave (capture, back up, snapshot, update) this machine's agent and coding environment into the person's agenv profile, or only preview what a save would change. Runs the agenv save preview, shows every add, update, removal, refusal and the secrets status, and writes only the exact digest the person approves. Not for restoring (load), starting a profile (init), health checks (doctor), catalog profiles, or plain git work.npx claudepluginhub lilmgenius/show-me-the-env --plugin agenvOther plugins' skills for the same job