Skip to main content

aidiff

Track which lines in your codebase were written by AI.

PyPI version PyPI downloads License: MIT

aidiff demo


aidiff is git blame for AI-generated code. It tracks, scores, and visualizes how much of your codebase was written by AI assistants like Copilot, Claude, ChatGPT, and Cursor.

Why?

AI-generated code is becoming a significant portion of modern codebases. Studies show that AI-assisted developers accept ~30% of suggestions, and that number is growing fast.

But nobody tracks it. This creates invisible technical debt:

  • Which files are mostly AI-generated?
  • Are AI-written functions getting proper review?
  • What's your team's actual AI code ratio over time?

aidiff answers these questions.

Quick Start

pip install aidiff

cd your-repo
aidiff scan          # Scan and show AI ratio
aidiff status        # Full statistics
aidiff report        # Generate HTML report

That's it. Three commands to understand your AI code footprint.

How It Works

aidiff uses a hybrid detection approach:

  1. Explicit tags - # ai-generated, Co-authored-by: Claude, [AI] in commits
  2. Commit analysis - Patterns in commit messages indicating AI involvement
  3. Heuristic analysis - Detects AI coding patterns:
    • Overly verbose variable names (user_authentication_token_validation)
    • Redundant comments (# Initialize the result dictionary)
    • Placeholder TODOs (# TODO: Add error handling)
    • Docstrings longer than the function body
    • Universal type hints on every function

Commands

Command Description
aidiff scan Scan repo and calculate AI ratio
aidiff status Show full statistics with tables
aidiff track <file> Show AI-scored lines in a file
aidiff report Generate HTML report with charts
aidiff install Install pre-commit git hook
aidiff check --ci CI-friendly output for pipelines
aidiff init-action Generate GitHub Action workflow

HTML Report

aidiff report generates a beautiful, self-contained HTML report with:

  • AI code ratio trends over time (Chart.js)
  • File-by-file AI score heatmap
  • Contributor AI usage breakdown
  • Recent commit AI classification

GitHub Action

aidiff init-action  # Generates .github/workflows/aigate.yml

This creates a GitHub Action that automatically comments on PRs with the AI code ratio, warning when it exceeds 70%.

Git Hook

aidiff install  # Installs pre-commit hook

Automatically runs aidiff scan before each commit, keeping .aidiff/data.json up to date.

Configuration

aidiff stores data in .aidiff/data.json in your repo root. This file is meant to be committed and shared with your team.

Insiders

Early supporters get priority features and direct input on the roadmap.

Become a Sponsor to unlock:

  • Custom detection rules
  • Team dashboard
  • Slack/Discord notifications
  • Priority support

License

MIT

Metadata

Release files for aidiff 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 aidiff 0.1.1
File Size Uploaded
aidiff-0.1.1.tar.gz 16.8 kB Details

Built distribution (wheel)

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

Total release size: 33.7 kB

Release files / aidiff-0.1.1.tar.gz

Download URL aidiff-0.1.1.tar.gz
Size 16.8 kB
Tags Source
SHA-256 checksum
How to use checksums
fbcca50507b27f1f006f9e55e34fd9fe5834ddc6874acf2c5b013b31e3c6e652
BLAKE2b-256 checksum
How to use checksums
82eb4bab55c347c50193bed5cbd3907e028875eb6a042ce98c2825f849e379ca
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 4, 2026.

Transparency log

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

Download URL aidiff-0.1.1-py3-none-any.whl
Size 16.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
33a3b9033ea79c269ac0a8353e1621a56c5fd7ce60670aec464086a9cbd62a48
BLAKE2b-256 checksum
How to use checksums
f9bf441b9c42f2a5049fbb5beafe697b7326205b58fd1868fbd7c119e0e8cee0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Apr 4, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.0

2 release files

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