Skip to main content

Track AI-generated vs human-made code changes in git repos

Project description

AI Tracker

Track what percentage of code changes in git repos are AI-generated (via Claude Code) vs human-made.

Installation

Option 1: uvx (recommended)

No installation needed - runs directly from PyPI:

uvx cc-ai-tracker stats

Option 2: Local install

Install globally with uv:

uv tool install cc-ai-tracker

Or install from source:

cd ai-tracker
uv tool install .

Then run directly:

ai-tracker stats

Setup

After installation, set up the hooks to start tracking:

ai-tracker install    # Install all hooks (Claude Code + git)

Or with uvx:

uvx cc-ai-tracker install

Usage

With uvx:

uvx cc-ai-tracker stats           # All-time stats
uvx cc-ai-tracker stats --graph   # Stats + chart for last 7 days
uvx cc-ai-tracker stats --chart --days 14  # Custom chart period

With local install:

ai-tracker stats           # All-time stats
ai-tracker stats --graph   # Stats + chart for last 7 days
ai-tracker stats --chart --days 14  # Custom chart period
ai-tracker stats --repo my-project  # Filter by repo

How It Works

  1. Claude Code Hooks (PostToolUse) - Logs every Edit/Write operation with line-level counts
  2. Git Post-commit Hook - Attributes committed changes to AI or human based on the edit log
  3. CLI Stats - Queries SQLite database and displays statistics with Rich formatting

Architecture

~/.config/ai-tracker/
├── tracker.db          # SQLite database (WAL mode)
├── cache/              # Temporary cache for Write tool pre-capture
└── git-hooks/
    └── post-commit     # Global git hook (delegates to local hooks)

Database

Data is stored in ~/.config/ai-tracker/tracker.db using SQLite with WAL mode for concurrent access.

Custom Database Path

For multi-agent deployments (e.g., agent-swarm workers), you can configure a custom database path:

export AI_TRACKER_DB_PATH="/path/to/custom/tracker.db"

This allows each agent to have its own isolated database file.

Query the Database

# View recent edits
sqlite3 ~/.config/ai-tracker/tracker.db "SELECT * FROM edits ORDER BY timestamp DESC LIMIT 10"

# View commits with attribution
sqlite3 ~/.config/ai-tracker/tracker.db "SELECT * FROM commits ORDER BY timestamp DESC LIMIT 10"

Uninstall

ai-tracker uninstall    # Remove all hooks (Claude Code + git)

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

cc_ai_tracker-0.2.0.tar.gz (16.7 kB view details)

Uploaded Source

Built Distribution

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

cc_ai_tracker-0.2.0-py3-none-any.whl (22.5 kB view details)

Uploaded Python 3

File details

Details for the file cc_ai_tracker-0.2.0.tar.gz.

File metadata

  • Download URL: cc_ai_tracker-0.2.0.tar.gz
  • Upload date:
  • Size: 16.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.20 {"installer":{"name":"uv","version":"0.9.20","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for cc_ai_tracker-0.2.0.tar.gz
Algorithm Hash digest
SHA256 62d7ea593f8a61f99e68e886e0c5d2fe5a07e5bb91568b9b202acfb8406331dd
MD5 afaa23df415e5f1a89ddcae9ac00ee6f
BLAKE2b-256 b57aa68849e2fc8724a3a897dcf4e4611616db2bd97c861b9240dde9a81af56c

See more details on using hashes here.

File details

Details for the file cc_ai_tracker-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: cc_ai_tracker-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 22.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.20 {"installer":{"name":"uv","version":"0.9.20","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for cc_ai_tracker-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e0a13ff4c703ca85bb73d449c7f363a08579b84b66a3d2027c039c995dba2432
MD5 793f7de2a8a4d320dec5d24f8cccad69
BLAKE2b-256 d48790728a0c8b3d2bbc3b1d95089a51c0db2185e5b91a4ec21c4894b11ad026

See more details on using hashes here.

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