Skip to main content

Extract provenance from AI agent execution traces

Project description

ai-blame

Extract provenance/audit trails from AI agent execution traces.

Like git blame, but for AI-assisted edits.

Problem Statement

As AI agents increasingly assist with knowledge base curation, we need to track provenance — which agent/model made what changes, when, and why.

See: https://github.com/ai4curation/aidocs/issues/62

Supported Trace Sources

  • Claude Code traces (~/.claude/projects/<encoded-cwd>/)

Installation

uv pip install ai-blame

Or from source:

git clone https://github.com/ai4curation/ai-blame
cd ai-blame
uv sync

Usage

# Show stats about available traces
ai-blame stats

# Dry run - preview what curation_history would be added
ai-blame mine --initial-and-recent

# Actually apply changes to files
ai-blame mine --apply --initial-and-recent

# Filter to specific file
ai-blame mine Asthma.yaml --initial-and-recent

Output Format

Appends a curation_history section to YAML files:

# ... existing content ...

curation_history:
  - timestamp: "2025-12-01T08:03:42Z"
    model: claude-opus-4-5-20251101
    action: CREATED
  - timestamp: "2025-12-15T20:34:29Z"
    model: claude-opus-4-5-20251101
    action: EDITED

How It Works

  1. Scans Claude Code trace files (JSONL format)
  2. Identifies successful Edit and Write tool operations
  3. Extracts metadata: timestamp, model, file path
  4. Groups by file and filters (first+last, size thresholds)
  5. Appends curation_history to affected files

Trace Directory Detection

If --trace-dir is not specified, the tool looks for traces in:

~/.claude/projects/<encoded-cwd>/

Where <encoded-cwd> is your current working directory with / replaced by -.

For example, /Users/cjm/repos/dismech becomes:

~/.claude/projects/-Users-cjm-repos-dismech/

Developer Tools

There are several pre-defined command-recipes available. They are written for the command runner just. To list all pre-defined commands, run just or just --list.

Credits

This project uses the template monarch-project-copier

License

BSD-3-Clause

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

ai_blame-0.1.0.tar.gz (174.3 kB view details)

Uploaded Source

Built Distribution

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

ai_blame-0.1.0-py3-none-any.whl (11.0 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for ai_blame-0.1.0.tar.gz
Algorithm Hash digest
SHA256 7c9d495e627e96f42746b7b8ce371662308e9bbdd645be49371b41d523c1e5ac
MD5 564bb880a34628a892bfe26cf3b0e6d8
BLAKE2b-256 2971a23de6c9d687c75b35882ecbad9120c0e1a2d42838d0e7d2fba41ba543bc

See more details on using hashes here.

Provenance

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

Publisher: pypi-publish.yaml on ai4curation/ai-blame

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

File details

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

File metadata

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

File hashes

Hashes for ai_blame-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0f3f528fc837eb827965c60951a91351e46ad1507b18093e48a74d0efbda603d
MD5 89f2ea220bb8fd265048df2868390d29
BLAKE2b-256 ae4c9de8bf3ce9f128399fbbcbe9bcef294c690fc71f4edaba51048c55326569

See more details on using hashes here.

Provenance

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

Publisher: pypi-publish.yaml on ai4curation/ai-blame

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