Skip to main content

Extract provenance from AI agent execution traces

Project description

ai-blame logo

ai-blame

Extract provenance from AI agent execution traces.

Like git blame, but for AI-assisted edits.

PyPI Documentation License

Why?

AI coding assistants modify your files, but git blame only shows who committed the changes—not which AI model actually wrote them. ai-blame fills this gap by extracting provenance from execution traces and embedding it in your files.

Features

  • Automatic trace discovery — Finds Claude Code traces based on your project directory
  • Multiple output modes — Append to files, create sidecars, or embed as comments
  • Configurable per file type — Different policies for YAML, JSON, Python, etc.
  • Dry-run by default — Preview changes before applying
  • Flexible filtering — By file pattern, change size, or time range

Installation

pip install ai-blame

# Or with uv
uv pip install ai-blame

Quick Start

# Check what traces are available
ai-blame stats

# Preview what would be added (dry run)
ai-blame mine --initial-and-recent

# Apply changes
ai-blame mine --apply --initial-and-recent

# Filter to specific files
ai-blame mine --pattern ".py" --apply

Output Examples

YAML/JSON files — Append directly

# config.yaml
name: my-project
version: 1.0

edit_history:
  - timestamp: "2025-12-01T08:03:42+00:00"
    model: claude-opus-4-5-20251101
    agent_tool: claude-code
    action: CREATED

Code files — Sidecar or comments

# main.py (with comment policy)

def hello():
    print("Hello, world!")

# --- edit_history ---
# - timestamp: '2025-12-01T08:03:42+00:00'
#   model: claude-opus-4-5-20251101
#   action: CREATED
# --- end edit_history ---

Or use sidecar files: main.pymain.history.yaml

Configuration

Create .ai-blame.yaml in your project root:

defaults:
  policy: sidecar
  sidecar_pattern: "{stem}.history.yaml"

rules:
  - pattern: "*.yaml"
    policy: append
  - pattern: "*.json"
    policy: append
    format: json
  - pattern: "*.py"
    policy: comment
    comment_syntax: hash
  - pattern: "tests/**"
    policy: skip

Supported Agents

Agent Status
Claude Code ✅ Supported
OpenAI Codex 🔜 Planned
Others PRs welcome!

Documentation

Full documentation: ai4curation.github.io/ai-blame

Contributing

We welcome contributions! See CONTRIBUTING.md.

PRs especially welcome for additional agent support (Cursor, Aider, Copilot, etc.).

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.2.0.tar.gz (1.0 MB 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.2.0-py3-none-any.whl (16.1 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for ai_blame-0.2.0.tar.gz
Algorithm Hash digest
SHA256 19773e689c549d4bfa1dbd559ba5a0ce0370107e1411b37572e7a3cc9d54102d
MD5 8c92527451e7f4c27a59cc18811357b7
BLAKE2b-256 9df3a967e618d3d531080bb6163ca836a98923cddf3eb468708f53bbd236c106

See more details on using hashes here.

Provenance

The following attestation bundles were made for ai_blame-0.2.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.2.0-py3-none-any.whl.

File metadata

  • Download URL: ai_blame-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 16.1 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.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6c6ee69aa796aa4b92d6d6bf822eba45a3eb8be97d98fa3df2bf5b631c783dc5
MD5 b9f4deb8b19f24517f25cf142cccdfbb
BLAKE2b-256 686a287c9533e4f554c4e761c043309f9e8635c69188f60916c8ab2dee0c13f3

See more details on using hashes here.

Provenance

The following attestation bundles were made for ai_blame-0.2.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