Blog / Tools

Sphinx: a git hook that quizzes you on what your agent's code does

Today's Show HN: Sphinx blocks git push until you answer a question about what the agent-written code actually does. We break down the mechanics, the reviewer model, and the limits of the approach.

•4 min read
Tools Agents

TL;DR: Sphinx took off on Hacker News — a git hook for agent-assisted development. Before a push to a protected branch, it pauses the operation and asks you: what does this code do when things go wrong? Answer wrong — it explains and gives you a new scenario. Answer right — the push continues. It works with Codex, Claude Code, Cursor, OpenCode, and Pi, with a separate reviewer model that never saw your chat with the agent.

The problem it solves

The agent wrote the code, you skimmed the diff, hit push — and moved on. Sound familiar? Sphinx calls this “outsource your thinking, not your understanding”: thinking can be delegated, understanding cannot. The hook turns push into a checkpoint: until you predict the code’s behavior on an edge case, the change doesn’t ship.

An example from the docs: the agent added a Stripe webhook handler that saves the event ID before calling charge(). Sphinx asks: “Stripe times out and sends the same event again. What happens on the retry?” You answer “the customer gets charged twice” — and get the breakdown: no, the retry finds the saved ID and returns 200 without charging; but if charge() fails, the next retry skips the charge entirely. Then a new scenario to lock it in.

Sphinx catches the edge case: Stripe webhook retry

How it works

The mechanics are simple and therefore reliable:

  1. You (or the agent) run git push to a protected branch (main/master by default).
  2. Git pauses. Sphinx prints a local questionnaire URL and waits up to 25 minutes.
  3. A separate reviewer model reads the diff through read-only git tools — it never saw your chat with the agent, so it isn’t contaminated by the agent’s own explanations.
  4. You answer questions about behavior, failure modes, and invariants — not file names. Get it wrong and you get an explanation plus a new scenario on the same concept.
  5. Pass, and the push continues. A pass lasts 24 hours for the same code and policy.

Questions are prepared in the background after commits, so they’re often ready by push time. A typical check takes 5–8 model calls plus one per answer; limits and cost are configurable.

How Sphinx works: from git push to passing the check

What to know before installing

  • Requirements: Node.js 22.19+, Git, macOS/Linux/WSL. Native Windows is not supported yet.
  • Machine-wide: sphinx install sets a global core.hooksPath — pushes in every repository get checked. Your existing hooks run first.
  • You need a reviewer account: a signed-in Codex or Claude Code CLI (using that plan’s allowance), OpenRouter (billed separately), or any OpenAI-compatible endpoint.
  • Code leaves your machine: the reviewer receives the changed code and related files. .env files, private keys, and common credential files are excluded by default; add your own sensitive paths to .sphinxignore.
  • This is practice, not a security gate: anyone with local access — including the agent — can bypass hooks. Passing doesn’t prove you understood the code unaided. The examiner is an LLM and can be wrong.

What Sphinx sees and what it excludes: .env, keys, credentials

Limits of the approach

  • Version 0.1 checks local commits and pushes only: web merges, CI-required checks, and deployments are not covered.
  • Binary files can’t be read.
  • sphinx yolo disables checks for a repository or globally — and every skip is logged with its reason. That’s honest: the tool admits it will be bypassed and makes the bypass visible.
  • Question quality depends on the reviewer model. The repo ships evaluation results on synthetic changes — but that’s not a certification for arbitrary repositories.

Sphinx limits: what’s covered and what’s not

Why this is close to home

Sphinx solves the problem of understanding agent code in the moment. But there’s a second, quieter problem: the agent wrote the code a week ago, and today you no longer remember why it chose that particular retry handling. A checkpoint at push verifies understanding now; memory between sessions preserves it forever. MaxGraph stores decisions, their rationale, and their relations — so a week later the agent (and you) can ask not “what does this code do” but “why did we decide this”, and get an answer with context.

Sphinx verifies understanding now, MaxGraph preserves it forever

FAQ

Is this a replacement for code review? No. It’s a comprehension check, not a code audit. The reviewer LLM asks about behavior but doesn’t systematically hunt for vulnerabilities.

Can the agent pass the check for me? Theoretically — yes, if it has access to the browser with the questionnaire. The authors say it plainly: this is practice, not a security gate. The value is that you are forced to think.

What does it cost? Sphinx itself is free (MIT). You pay for the reviewer model: via your existing Codex/Claude Code plan or OpenRouter. A typical check is 5–8 calls.

What’s next


MaxGraph — memory for AI agents: local, private, with a living knowledge graph. 7 days free.

MaxGraph

Give your agent memory

7-day trial, no card. Installation is one prompt — your agent does the rest.

Pricing ✓ Copied