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.1.6.tar.gz (15.4 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.1.6-py3-none-any.whl (20.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: cc_ai_tracker-0.1.6.tar.gz
  • Upload date:
  • Size: 15.4 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.1.6.tar.gz
Algorithm Hash digest
SHA256 69cf5264d06c015fef0c920170cc85cd482ff0564774c1f48f71f69b58367128
MD5 5643cde5e946dbc9114c477ed23967b0
BLAKE2b-256 cc2efccac0c64c0d35c0ba7e36bca6138789132bb29afe54182fb8a36b65fd5e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: cc_ai_tracker-0.1.6-py3-none-any.whl
  • Upload date:
  • Size: 20.7 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.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 837ab1023134a88f3ebca1626cdbfe4675abc2c1e18b2be4a007c0e7e992c832
MD5 e23311fb1e74ab3e6adf8dde3271212f
BLAKE2b-256 1da70501f1204a40a31ab93a962df497f35677f42a5514f66ac965c33c855656

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