Skip to content

xpd hook

Read one PostToolUse event from standard input. For file edits and writes from Claude Code, Grok and Antigravity and for Codex patches, check the edited Python files in the current project. Return warning and error diagnostics to the agent, as additional context or, for Antigravity, appended to the tool result.

Terminal window
xpd hook

A clean edit produces no output.

Terminal window
$ mkdir -p hook-example && touch hook-example/pyproject.toml && echo 'total = 1' > hook-example/clean.py
$ printf '{"hook_event_name":"PostToolUse","cwd":"%s/hook-example","tool_name":"Write","tool_input":{"file_path":"clean.py"}}' "$PWD" | xpd hook

The hook exits successfully for findings, clean files, ignored paths and malformed input. It applies safe xpd fixes to the edited files and reports how many it fixed before the remaining warnings and errors.