Skip to main content

GitZero

A CLI tool that scans any GitHub repository for signals consistent with AI-generated or AI-assisted code. Analyzes 25+ behavioral and static signals across git history and source files, outputs an explainable risk report, and includes a full ML training pipeline.

→ Full project writeup and demo


GitZero scan output


How It Works

GitZero uses a hybrid detection pipeline: deterministic heuristics produce the primary explainable score, while an optional calibrated Random Forest provides a separate learned probability.

GitZero architecture and machine-learning pipeline

  1. Load and filter the repository. GitZero accepts a local folder or public GitHub URL, builds a source-file index, and excludes dependencies, generated code, vendored libraries, caches, training artifacts, and framework scaffolding.
  2. Analyze two evidence families. Git history analysis measures repository behavior over time, while static analysis examines patterns in the current source code.
  3. Normalize and score the evidence. Findings use a common signal format containing a score, supporting details, affected files, and confidence context. The heuristic combines independent signal families and applies false-positive dampeners.
  4. Produce an explainable report. The CLI shows the risk score, Low/Medium/High band, confidence, dampening, top signals, highest-signal files, and optional ML probability.

Why Use an ML Model?

The Random Forest is an optional second opinion, not a replacement for the explainable heuristic. Its purpose is to learn nonlinear interactions between weak signals that fixed weights may miss.

  • It trains on raw signal and scan-metadata features, not GitZero's final risk_score.
  • Hard-evidence columns are excluded so the model must learn subtler repository patterns.
  • Its probability is reported separately and never overwrites the heuristic result.
  • A disagreement between the two methods indicates uncertainty and gives the reviewer a reason to inspect the evidence.

The current calibrated Random Forest was evaluated with owner-grouped 5-fold cross-validation on 193 labeled repositories and reached 0.968 ROC-AUC on that corpus. This is a project benchmark, not a claim of universal authorship-detection accuracy.


What It Detects

Git signals — large commit bursts, file creation waves, single-drop histories, no-merge linear histories, formulaic commit messages, author uniformity, tight commit time clustering.

Static signals — naming entropy, docstring density, type annotation coverage, complexity uniformity, structural repetition, debug artifact absence, generic TODOs, shallow test quality, README-to-code misalignment.

Hard evidence — explicit AI config files: AGENTS.md, CLAUDE.md, .cursorrules, .aider, Copilot instructions, and README phrases like vibe coded or built with ChatGPT.

False-positive guards — vendor libraries (jQuery, Bootstrap), framework scaffolding, multi-author history, merge commits, and long-lived organic repos all reduce the score automatically.


Highlights

  • 25+ detection signals with per-signal weights and confidence scoring
  • Jupyter notebook support — extracts and analyzes .ipynb code cells
  • ML pipeline: Random Forest with grouped cross-validation on 193 labeled repos — 0.968 ROC-AUC without hard-evidence features (evaluation summary)
  • Batch export to JSONL/CSV with ML-ready feature columns for every signal
  • --ml-model flag for experimental probability alongside the heuristic score
  • 50+ tests, ruff clean

Install

pip install gitzero

Usage

gitzero scan https://github.com/user/repo     # scan any public GitHub repo
gitzero scan ./my-local-repo --verbose        # show per-file signal breakdown
gitzero scan ./my-local-repo --json           # machine-readable output
gitzero batch ./corpus --recursive --label-from-parent --format jsonl -o out.jsonl

Stack: Python · Typer · Rich · PyDriller · radon

Metadata

Release files for gitzero 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for gitzero 0.1.1
File Size Uploaded Provenance Actions
gitzero-0.1.1.tar.gz 57.3 kB Without provenance Details for gitzero-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for gitzero 0.1.1
File Interpreter ABI Platform Actions
gitzero-0.1.1-py3-none-any.whl Python 3 none any Details for gitzero-0.1.1-py3-none-any.whl

Total release size: 108.4 kB

Release files / gitzero-0.1.1.tar.gz

Download URL gitzero-0.1.1.tar.gz
Size 57.3 kB
Tags Source
SHA-256 checksum
How to use checksums
7728c84da6b408113a5d372803f424bd296ee6d4ab718979b66a20ca350f37ac
BLAKE2b-256 checksum
How to use checksums
427a9e77712e9a46521526985f0a93f78ce9f33e3fae4ea0cad7957bfd330c86
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.13

Release files / gitzero-0.1.1-py3-none-any.whl

Download URL gitzero-0.1.1-py3-none-any.whl
Size 51.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c623a0155a39154fb4a91a51b1dd67aad7468bccb22387cff2eec45fa688f95a
BLAKE2b-256 checksum
How to use checksums
ae60b32d9571c66f81cd66d7a34569bc6637b2e28d22fd3030c6835cdbdb7baf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.13

Security for gitzero 0.1.1

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.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page