fix #651: hook-check exits silently instead of emitting unsupported additionalContext

Codex Desktop rejects hookSpecificOutput.additionalContext on PreToolUse.
hook-check is now a no-op — graph guidance reaches the agent via AGENTS.md/skill.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Safi
2026-05-02 17:29:40 +01:00
co-authored by Claude Sonnet 4.6
parent ba41258635
commit cf7ce3a450
2 changed files with 22 additions and 17 deletions
+3 -17
View File
@@ -1510,23 +1510,9 @@ def main() -> None:
sys.exit(1)
elif cmd == "hook-check":
# Shell-agnostic PreToolUse hook entry point for Codex (and any platform
# where embedding Python/bash inline in a JSON hook command is fragile).
# Prints the hookSpecificOutput JSON if graph.json exists, exits 0 silently
# if not. Works on Windows PowerShell, cmd.exe, macOS, and Linux.
graph = Path("graphify-out") / "graph.json"
if graph.exists():
import json as _json
print(_json.dumps({
"hookSpecificOutput": {
"hookEventName": "PreToolUse",
"additionalContext": (
"graphify: Knowledge graph exists. "
"Read graphify-out/GRAPH_REPORT.md for god nodes and "
"community structure before searching raw files."
),
}
}))
# Codex Desktop rejects hookSpecificOutput.additionalContext on PreToolUse.
# Keep this as a cross-platform no-op so installed hooks never break Bash
# tool calls. Graph guidance reaches the agent via AGENTS.md / skill instead.
sys.exit(0)
elif cmd == "check-update":
if len(sys.argv) < 3: