A local git gatekeeper that blocks AI-generated slop in PR descriptions.
Project description
DiffSniff
Stop AI-generated filler from sneaking into your Git history.
DiffSniff is a local, terminal-based gatekeeper that cross-references your staged Git changes against your Pull Request description. If it detects that the description is generic AI-generated filler that doesn't accurately reflect the code you've written, it blocks the commit.
Why DiffSniff?
Traditional AI detectors focus on writing style, which makes them easy to bypass. You can simply ask a model to "write like a human."
DiffSniff takes a different approach.
Instead of analyzing how text is written, it verifies whether the claims in your PR description actually match the code changes in your diff.
How It Works
Local Heuristics
DiffSniff performs lightweight local analysis to identify low-effort copy-paste descriptions by measuring:
- Vocabulary overlap
- Structural variance
- Content specificity
This catches obvious mismatches instantly without requiring an API call.
Adversarial Q&A
DiffSniff then:
- Feeds your Git diff to an LLM.
- Generates highly specific technical questions about the code changes.
- Checks whether your PR description answers those questions.
If your PR claims one thing while the code does another, DiffSniff flags it.
Installation
Install directly from PyPI:
pip install diffsniff-gatekeeper
Configuration
Bring Your Own Model
DiffSniff uses LiteLLM under the hood, allowing you to use virtually any supported provider, including:
- Gemini
- OpenAI
- Anthropic
- Local models
Example: Gemini
Export your API key:
export GEMINI_API_KEY="your-google-ai-key"
Optional Configuration
Create a config.json file in your working directory to customize behavior:
{
"model": "gemini/gemma-4-31b-it",
"slop_threshold": 55,
"num_questions": 3
}
Configuration Options
| Option | Description |
|---|---|
model |
LLM used for adversarial questioning |
slop_threshold |
Minimum score required to pass validation |
num_questions |
Number of generated code-specific questions |
Using OpenAI
To switch providers:
{
"model": "gpt-4o"
}
Then export your API key:
export OPENAI_API_KEY="your-openai-key"
Usage
- Stage your code changes:
git add .
-
Write a draft PR description in a Markdown file.
-
Run DiffSniff:
diffsniff pr_draft.md
Results
✅ Pass
Your PR description accurately reflects the code changes and you're ready to push.
❌ Fail
Your description doesn't sufficiently explain what the code actually does.
Rewrite the documentation and try again.
Philosophy
DiffSniff doesn't care whether a human or an AI wrote your PR description.
It cares whether the description is true.
If your documentation accurately explains the code, it passes.
If it's generic filler disconnected from reality, it fails.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file diffsniff_gatekeeper-0.1.0.tar.gz.
File metadata
- Download URL: diffsniff_gatekeeper-0.1.0.tar.gz
- Upload date:
- Size: 10.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e99838ee81e1c28f3e1ea21d7cc50d5468698cdd86ee96a19608642d7280dc8f
|
|
| MD5 |
3948797df7f12885d023c892c3edc631
|
|
| BLAKE2b-256 |
f7c8e1aceda30ecea7cb53190e407d09f4888a911a71c40de9425a12902b96f2
|
File details
Details for the file diffsniff_gatekeeper-0.1.0-py3-none-any.whl.
File metadata
- Download URL: diffsniff_gatekeeper-0.1.0-py3-none-any.whl
- Upload date:
- Size: 11.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ba7ec74e7b90c3bf7c44ea118f45b22e82abceebf77f397892dcca39bb8c44aa
|
|
| MD5 |
ad82a900d03215f0823e14ff9dcfac7b
|
|
| BLAKE2b-256 |
283e4e9757c08cd0ab446434523aa9c1f2e2c14da6c7ab8ef50855f20056d054
|