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.
Metadata
Release files for diffsniff-gatekeeper 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| diffsniff_gatekeeper-0.1.0.tar.gz | 10.7 kB | Without provenance | Details for diffsniff_gatekeeper-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| diffsniff_gatekeeper-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for diffsniff_gatekeeper-0.1.0-py3-none-any.whl |
Total release size: 21.7 kB
Release files / diffsniff_gatekeeper-0.1.0.tar.gz
| Download URL | diffsniff_gatekeeper-0.1.0.tar.gz |
|---|---|
| Size | 10.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e99838ee81e1c28f3e1ea21d7cc50d5468698cdd86ee96a19608642d7280dc8f
|
|
BLAKE2b-256 checksum How to use checksums |
f7c8e1aceda30ecea7cb53190e407d09f4888a911a71c40de9425a12902b96f2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.5
|
Release files / diffsniff_gatekeeper-0.1.0-py3-none-any.whl
| Download URL | diffsniff_gatekeeper-0.1.0-py3-none-any.whl |
|---|---|
| Size | 11.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ba7ec74e7b90c3bf7c44ea118f45b22e82abceebf77f397892dcca39bb8c44aa
|
|
BLAKE2b-256 checksum How to use checksums |
283e4e9757c08cd0ab446434523aa9c1f2e2c14da6c7ab8ef50855f20056d054
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.5
|
Security for diffsniff-gatekeeper 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.