Skip to main content

Correlate AI coding sessions with git history — attribution, churn, and blame overlay.

Project description

aigit

Correlate AI coding sessions with git history.

aigit tracks which lines of your codebase were written by an AI assistant — and which weren't. It works by matching code blocks from AI session logs to git commits via fuzzy hashing, then surfacing that attribution as a git blame-style overlay and CI report.

   4 a1b2c3d  [claude_c 100%] def greet(name: str) -> str:
   5 a1b2c3d  [claude_c 100%]     return f"Hello, {name}!"
   6 a1b2c3d
   7 f9e8d7c                   def farewell(name: str) -> str:
   8 f9e8d7c                       return f"Goodbye, {name}!"

Why

As AI-assisted coding becomes the norm, teams lose visibility into:

  • What percentage of the codebase is AI-authored
  • Whether AI-generated code has higher churn or bug rates than hand-written code
  • Which specific commits introduced AI-generated code and from what prompt

Install

pip install aigit

Requires Python 3.10+ and git.

Quick start

# 1. Index your AI sessions and git history
aigit index

# 2. View blame with AI attribution overlay
aigit blame src/myfile.py

# 3. See repo-wide AI% stats
aigit stats

# 4. Generate a CI report
aigit ci --format=markdown

Supported AI tools

Tool Status
Claude Code Supported (auto-discovers ~/.claude/projects/)
OpenAI Codex Coming soon
Cursor Planned
Devin / OpenCode Planned

The provider system is pluggable — see CONTRIBUTING.md to add your tool.

Commands

aigit index

Reads AI sessions and walks git history to build a local attribution database at .aigit/attribution.db.

aigit index                          # auto-discover Claude Code sessions
aigit index --sessions ./my-exports  # point to a custom session directory
aigit index --provider codex         # use a different provider

aigit blame <file>

Annotates git blame output with AI attribution. Lines written by an AI are highlighted with the tool name and confidence score.

aigit blame src/app.py
aigit blame src/app.py --show-prompt   # also show the prompt that generated each line

aigit stats

Shows AI attribution statistics across the repository.

aigit stats                    # repo-wide summary
aigit stats --file src/app.py  # single file
aigit stats --top 50           # show top 50 files (default: 20)

Example output:

aigit stats  —  3 sessions, 142 code blocks indexed

File                              AI lines  Total   AI%    Tools
────────────────────────────────  ────────  ──────  ─────  ─────────────
src/api/routes.py                      87     120  72.5%  claude_code:87
src/core/engine.py                     54      98  55.1%  claude_code:54
tests/test_routes.py                   41      60  68.3%  claude_code:41

Repo-wide: 182 / 450 lines (40.4% AI-attributed)

aigit ci

Emits a machine-readable report for CI pipelines.

aigit ci                        # markdown (default)
aigit ci --format=json          # JSON
aigit ci --output=report.md     # write to file

CI integration (GitHub Actions)

Add this workflow to post an AI attribution report on every pull request:

# .github/workflows/aigit-report.yml
name: aigit AI Attribution Report
on:
  pull_request:
    types: [opened, synchronize]
jobs:
  aigit-report:
    runs-on: ubuntu-latest
    permissions:
      pull-requests: write
    steps:
      - uses: actions/checkout@v4
        with:
          fetch-depth: 0
      - run: pip install aigit
      - run: aigit index
      - run: aigit ci --format=markdown --output=aigit-report.md
      - uses: marocchino/sticky-pull-request-comment@v2
        with:
          path: aigit-report.md
          header: aigit-attribution

How it works

  1. Session ingestion — reads AI tool session logs and extracts code blocks (both markdown fences and file write operations)
  2. Tiered fuzzy matching — compares code blocks against git diff hunks using:
    • Exact SHA-256 match → 100% confidence
    • TLSH fuzzy hash distance < 30 → 90% confidence
    • TLSH fuzzy hash distance < 100 → 70% confidence
  3. Attribution storage — stores matches in a local SQLite database (.aigit/attribution.db)
  4. Blame overlay — runs git blame and annotates lines where the originating commit matched an AI code block

Contributing

See CONTRIBUTING.md.

License

Apache 2.0 — see LICENSE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

getaigit-0.1.0.tar.gz (23.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

getaigit-0.1.0-py3-none-any.whl (23.9 kB view details)

Uploaded Python 3

File details

Details for the file getaigit-0.1.0.tar.gz.

File metadata

  • Download URL: getaigit-0.1.0.tar.gz
  • Upload date:
  • Size: 23.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for getaigit-0.1.0.tar.gz
Algorithm Hash digest
SHA256 92b8bf100300161967098a9982577e61b9f8a5eb6690e53b0e430e0eaccb144c
MD5 dc4a0750b4682faec8c8da78b35093c4
BLAKE2b-256 553c2bd4b4a823f2cd7193f4c4977a50a29f98da7ac6e07d4527f60cdfe8c7d8

See more details on using hashes here.

Provenance

The following attestation bundles were made for getaigit-0.1.0.tar.gz:

Publisher: ci.yml on getaigit/getaigit

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file getaigit-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: getaigit-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 23.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for getaigit-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0fbfefdfed8e4ad965ce4201416e60861ae6b66c8a1c4c9e4762cac8e9bb900b
MD5 9631e27093964f1e9f23bc09ff1561df
BLAKE2b-256 10406cf1ba3207ea2b2bbac22817aa38f5611ba22f8267b037f45c3d059f8341

See more details on using hashes here.

Provenance

The following attestation bundles were made for getaigit-0.1.0-py3-none-any.whl:

Publisher: ci.yml on getaigit/getaigit

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page