Show HN: Sphinx – A hook that quizzes you on your AI's code before shipping
Sphinx is a free, open-source Git hook (npm package sphinx-understand) that pauses pushes on protected branches and asks the developer a question about what the diff does when things go wrong. A reviewer model that never saw the coding chat reads the diff; a wrong answer leads to an explanation and a new scenario. It works with Codex, Claude Code, Cursor, OpenCode and Pi, or plain Git. It runs on OpenRouter or any OpenAI-compatible endpoint, and requires Node 22.19+.
What it claims
Sphinx is a free, open-source Git hook that blocks a push to a protected branch until the developer correctly answers a question about the diff. The questions target failure behaviour. The page's example concerns a Stripe webhook handler that saves the event ID before calling charge(). The follow-up asks what a retry does if charge() fails, and the correct answer is that the customer is never billed. The page says Sphinx is built to run on minimal tokens.
How it works
The reviewer model reads only the diff, not the coding chat. A wrong answer gets an explanation and then a new scenario, so the loop repeats until an answer is right. A sphinx yolo command bypasses the check, and every skip is logged. The page states two data boundaries: the developer's answers never reach the coding agent, and .env files and keys are never opened.
flowchart TD
A[git push to protected branch] --> B{sphinx yolo?}
B -- yes --> L[Skip logged, push continues]
B -- no --> C[Reviewer reads diff only]
C --> D[Asks failure-case question]
D --> E{Answer correct?}
E -- yes --> F[Push continues]
E -- no --> G[Explanation shown]
G --> DHow to use it
The tool requires Node 22.19+ and runs on macOS, Linux or WSL. Native Windows is not listed.
npm install -g sphinx-understand
sphinx install
# then push as usual
git pushsphinx install wires Git to the installed coding agents and prompts for the reviewer model. The reviewer can be the existing coding agent, OpenRouter, or any OpenAI-compatible endpoint. Pushes made by an agent are gated the same way as manual ones.
Limits
The page is a landing page. It gives no licence name and no token or cost figures beyond "minimal tokens". It also gives no evidence that the questions are accurate or useful. How protected branches are chosen, and where skip logs are stored, is left to separate docs that the page does not include.
Organisations named here
- Claude Code
- Cursor
- OpenCode
- OpenRouter
- Stripe
Technologies named here
- Sphinx
- Codex
- Claude Code
- Cursor
- OpenCode
- pi
- OpenRouter
- Git
- npm
- Node.js
- OpenAI API
Techniques named here
- Comprehension quiz before push
Related in coding-agents
