{ "description": "ClaudeTools harness hooks for Grok driver. These delegate to the existing .claude/scripts and .claude/hooks bash implementations so that coord message injection, active lock warnings, memory sync, and the backslash-Windows-path safety block continue to work when using Grok instead of (or alongside) Claude Code. The scripts are the source of truth; only thin wrappers here for env + invocation. Uses explicit full paths to Git Bash and python fallback to avoid repeated PATH/WSL/jq resolution or parse errors in the hook runner.", "hooks": { "SessionStart": [ { "hooks": [ { "type": "command", "command": "C:\\Program Files\\Git\\bin\\bash.exe -c '\n export PATH=\"/c/Program Files/Git/bin:/c/Program Files/Git/usr/bin:$PATH\"\n WS=\"${GROK_WORKSPACE_ROOT:-$PWD}\"\n export GROK_WORKSPACE_ROOT=\"$WS\"\n export CLAUDE_PROJECT_DIR=\"$WS\"\n # Run the existing memory mirror (keeps ~/.claude/projects/.../memory in sync with repo .claude/memory/ for any compat or cross-driver use).\n /c/Program\\ Files/Git/bin/bash.exe \"$WS/.claude/scripts/sync-memory.sh\" || true\n'", "timeout": 45, "env": {} } ] } ], "UserPromptSubmit": [ { "hooks": [ { "type": "command", "command": "C:\\Program Files\\Git\\bin\\bash.exe -c '\n export PATH=\"/c/Program Files/Git/bin:/c/Program Files/Git/usr/bin:$PATH\"\n WS=\"${GROK_WORKSPACE_ROOT:-$PWD}\"\n export GROK_WORKSPACE_ROOT=\"$WS\"\n export CLAUDE_PROJECT_DIR=\"$WS\"\n # The existing check-messages.sh does the coord curls for unread messages (to personal + alias + broadcasts) and (in dev mode) active locks.\n # Under Grok its stdout will appear as a hook annotation in scrollback (visible to user). The model is also instructed via CLAUDE.md to perform the session-start protocol.\n /c/Program\\ Files/Git/bin/bash.exe \"$WS/.claude/scripts/check-messages.sh\" || true\n'", "timeout": 25, "env": {} } ] } ], "PreToolUse": [ { "matcher": "run_terminal_cmd|bash", "hooks": [ { "type": "command", "command": "C:\\Program Files\\Git\\bin\\bash.exe -c '\n export PATH=\"/c/Program Files/Git/bin:/c/Program Files/Git/usr/bin:$PATH\"\n WS=\"${GROK_WORKSPACE_ROOT:-$PWD}\"\n export GROK_WORKSPACE_ROOT=\"$WS\"\n export CLAUDE_PROJECT_DIR=\"$WS\"\n # Normalize Grok hook stdin (toolInput camelCase + hookEventName) into the shape the existing block script expects (.tool_input), then pipe.\n # Prefer jq; fallback to python (project uses py) to avoid jq-not-found or related parse errors.\n INPUT=$(cat)\n NORM=$(printf \"%s\" \"$INPUT\" | jq -c \".tool_input = (.toolInput // .tool_input // {})\" 2>/dev/null || py -c \"import sys,json; d=json.load(sys.stdin); ti = d.get('toolInput') or d.get('tool_input') or {}; d['tool_input'] = ti; print(json.dumps(d))\" 2>/dev/null || printf \"%s\" \"$INPUT\")\n printf \"%s\" \"$NORM\" | /c/Program\\ Files/Git/bin/bash.exe \"$WS/.claude/hooks/block-backslash-winpath.sh\"\n'", "timeout": 10, "env": {} } ] } ] } }