guilyx/grip

A git hook that won't let you push code you can't explain. Quizzes you on your own diff. Works with Claude Code, Codex, Cursor.

What it is

A tool that blocks a git push until you can answer questions about the code you're about to send. It reads the changes (the "diff") and asks five questions: why you built it this way, where it might fail, what a malicious caller could do, and how you know it works. A model grades your answers from 0 to 100; if you score below your team's passing mark, the push is held back.

Core idea

It checks the developer, not the code. AI can write the code; grip just makes sure you can defend it. The README quotes Mitchell Hashimoto on the "whiteboard defense" — being able to answer confidently why you did X instead of Y, and what happens if an actor behaves maliciously.

How to try it (30 seconds, offline)

pipx install grip-hook
mkdir try-grip && cd try-grip && git init -q
echo 'def add(a, b): return a + b' > math.py && git add math.py
grip quiz --provider fake      # five questions in your terminal
grip whiteboard --provider fake # same questions, drawn in your browser

The fake provider doesn't actually grade your answers — it only checks length (20 characters or the word "because" gets full marks). It's just to show the flow. For real grading, you use a model you already have: --provider claude-code, codex, gemini, or anthropic.

Nothing is enforced until you run grip init to install the hook.

Key features

  • Five questions from your diff, graded against a hidden rubric into a "Grip Score" out of 100. No line numbers or trivia.
  • grip whiteboard: your change drawn as parts and arrows in the browser, with the questions pinned to it — including what a malicious actor could do. You can set hook_mode = "whiteboard" so every push is defended there.
  • Works with what you have: reuses Claude Code, Codex, or Gemini CLI as the model (no API key needed), or uses Anthropic, any OpenAI-compatible API, or Ollama locally.
  • Inside coding agents: /grip works in Claude Code, Codex, Gemini CLI, Cursor, and others, plus a gate that keeps the agent from pushing until you pass.
  • Out of the way when it should be: a passed diff is remembered, a retry reuses its questions (so only grading costs a call), grip skip lets one push through, and CI / non-interactive runs are skipped.

Installation

Python 3.11 or newer, on Linux, macOS, or Windows:

pipx install grip-hook        # or: uv tool install grip-hook

This installs the grip command and a git grip alias.

Quick start

cd your-repo
grip init        # writes .grip.toml, installs the pre-push hook
git push         # grip asks five questions first

grip init defaults to provider = "auto", which uses Claude Code, Codex, or Gemini CLI when one is installed. Otherwise you set ANTHROPIC_API_KEY or pick another provider.

Other commands

grip quiz                  # quiz your staged changes now, no hook needed
grip quiz --branch         # quiz the whole branch since main (your pull request)
grip whiteboard            # defend the change in the browser
grip quiz --provider fake  # try the flow offline (grades by length only)
grip skip                  # let the next push through
grip status                # hooks, last score, configuration

Configuration

A .grip.toml file at the root of the repository, committed so the team shares one bar:

passing_score = 70        # 0-100
difficulty = "normal"     # easy | normal | hard
provider = "claude-code"  # auto | anthropic | claude-code | codex | gemini | openai | ollama

Documentation

Full docs at guilyx.github.io/grip: getting started, a walkthrough, coding agents, the whiteboard, how grip works internally, and honest numbers on what the score does and doesn't measure.

License

BSD-3-Clause. Copyright (c) 2026, Erwin L.

Related

  • Project
  • Project
  • Project
  • Project