You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
codex install writes bash-only PreToolUse hook that fails on Windows PowerShell #522
graphify codex install writes a bash-style PreToolUse command into .codex/hooks.json. On Windows, Codex executes that hook under PowerShell, so the hook fails before every matching tool invocation with hook exited with code 1.
Affected environment
graphifyy: 0.4.25 (installed locally)
OS: Windows
Shell used by Codex CLI: PowerShell
Generated hook
{
"hooks": {
"PreToolUse": [
{
"matcher": "Bash",
"hooks": [
{
"type": "command",
"command": "[ -f graphify-out/graph.json ] && echo '{\"hookSpecificOutput\":{\"hookEventName\":\"PreToolUse\",\"additionalContext\":\"graphify: Knowledge graph exists. Read graphify-out/GRAPH_REPORT.md for god nodes and community structure before searching raw files.\"}}' || true"
}
]
}
]
}
}
Steps to reproduce
On Windows, run graphify codex install in a repo.
Ensure graphify-out/graph.json exists.
Let Codex invoke a matching shell/tool command in that repo.
Actual result
The hook fails with exit code 1 before command execution.
PowerShell parses the generated command as invalid syntax, for example:
Missing type name after '['
The token '&&' is not a valid statement separator in this version
The token '||' is not a valid statement separator in this version
Expected result
graphify codex install should generate a hook command that works in the shell Codex uses on Windows, or emit a shell-agnostic command.
Notes
A local workaround is to replace the generated command with a PowerShell-safe equivalent such as:
if (Test-Path'graphify-out/graph.json') {
Write-Output'{"hookSpecificOutput":{"hookEventName":"PreToolUse","additionalContext":"graphify: Knowledge graph exists. Read graphify-out/GRAPH_REPORT.md for god nodes and community structure before searching raw files."}}'
}
I am intentionally omitting local file paths, usernames, and screenshots for privacy.
Fixed on v8 (f7911fd), shipping in the next release.
Root cause was exactly as you described: the Claude/Codebuddy PreToolUse hook command was inline POSIX bash (case/esac, [ -f ], single-quoted echo '{json}', &&/||), which Windows cmd.exe/PowerShell can't parse — so the hook errored before every matching tool call and the graph nudge never reached the agent.
The fix moves the detection logic (search-command match, source-file extension match, skip-under-output-dir, graph-exists check) into a shell-agnostic graphify hook-guard <search|read> subcommand, invoked via the absolute graphify exe path. A single console-script invocation has no shell syntax, so it parses identically under sh, cmd.exe, and PowerShell — the same pattern already used for the codex hook. macOS/Linux behavior is unchanged (byte-identical nudge payload), and the graph path now also honors GRAPHIFY_OUT.
Note: I could not execute-test on real Windows in CI, so if you're able to run graphify install on Windows against a repo with graphify-out/graph.json and confirm the hook no longer exits 1 (and that grep/read calls get the nudge), that verification would be very welcome. Closing as resolved; reopen if anything still fails on your setup.
Activity
rexkoh425 commentedon May 3, 2026
Please update to v0.6.8 and try. Thanks.
#651
Fix: make Claude Code / Codebuddy PreToolUse graph-nudge hooks work o…
safishamsi commentedon Jul 6, 2026
Fixed on
v8(f7911fd), shipping in the next release.Root cause was exactly as you described: the Claude/Codebuddy
PreToolUsehook command was inline POSIX bash (case/esac,[ -f ], single-quotedecho '{json}',&&/||), which Windows cmd.exe/PowerShell can't parse — so the hook errored before every matching tool call and the graph nudge never reached the agent.The fix moves the detection logic (search-command match, source-file extension match, skip-under-output-dir, graph-exists check) into a shell-agnostic
graphify hook-guard <search|read>subcommand, invoked via the absolutegraphifyexe path. A single console-script invocation has no shell syntax, so it parses identically under sh, cmd.exe, and PowerShell — the same pattern already used for the codex hook. macOS/Linux behavior is unchanged (byte-identical nudge payload), and the graph path now also honorsGRAPHIFY_OUT.Note: I could not execute-test on real Windows in CI, so if you're able to run
graphify installon Windows against a repo withgraphify-out/graph.jsonand confirm the hook no longer exits 1 (and that grep/read calls get the nudge), that verification would be very welcome. Closing as resolved; reopen if anything still fails on your setup.Fix: port the Gemini CLI BeforeTool graph-nudge hook to be shell-agno…
test: rigorous edge cases for the hook-guard subcommand (#522)
Release 0.9.8
fix: document the Codex PreToolUse hook as an intentional no-op (#2165)
Squashed commit of the following:
Fix: make Claude Code / Codebuddy PreToolUse graph-nudge hooks work o…
Fix: port the Gemini CLI BeforeTool graph-nudge hook to be shell-agno…
test: rigorous edge cases for the hook-guard subcommand (Graphify-Lab…
Release 0.9.8
fix: document the Codex PreToolUse hook as an intentional no-op (Grap…
fix(install): remove only graphify's own hook entries, keep others (#…