Sphinx is a lightweight Git hook that forces a developer to demonstrate understanding of code produced or modified by an AI coding agent before allowing a push to proceed. Installed via npm and running locally (Node 22.19+, macOS/Linux/WSL), it intercepts pushes on protected branches, generates reviewer-style questions from the diff, and asks the committer to explain how the change behaves in edge cases. The tool is model-agnostic - supporting Codex, Claude Code, Cursor, OpenCode, Gemini/PI and any OpenAI-compatible endpoint or OpenRouter - and is designed to use minimal tokens. Answers are kept local and never sent back to the coding agent; .env files and keys aren’t exposed. There is a documented bypass (sphinx yolo) that logs skips for fast workflows. The project is free, MIT-licensed, and distributed via npm/GitHub.
Mechanically, Sphinx reads the diff, formulates targeted quiz questions that reveal faulty assumptions or race conditions, and blocks the push until the developer demonstrates correct reasoning. The provided example highlights a subtle Stripe webhook bug: saving an event ID before charging can lead to skipped charges on retry if charge() fails. By forcing developers to consider failure modes and retries, Sphinx catches semantics agents miss and keeps human understanding integral to shipping code.
Summary generated by AI from the linked article. hn.today is not affiliated with Hacker News or Y Combinator.