AI Code Provenance: The Complete Guide (2026)

Guide

AI code provenance is the verifiable, auditable record of where AI-generated code comes from — which model wrote it, from which prompt, through which tool, reviewed by whom, and with what risk. This guide explains how it works, why git blame alone can't provide it, and how to get it for your codebase today.

What is AI code provenance?

AI code provenance is the traceable origin record for every line of AI-generated code in your repository: the model that produced it (e.g. Claude Opus 4.8, GPT-4o, Gemini), the prompt that requested it, the tool that delivered it (Copilot, Cursor, Claude Code, Codex CLI), the developer who accepted it, whether a human reviewed it before it shipped, and the license and security risk it carries.

Think of it as the missing half of git blame. Git blame attributes each line to the human who committed it. AI code provenance attributes each line to the AI that actually wrote it — and keeps that attribution tamper-evident, queryable, and exportable for audit.

As AI assistants write a growing share of production code, provenance is how teams answer the questions git was never designed for: Which parts of this codebase were machine-written? Which prompts produced them? Did a human review them? What legal and security exposure do they carry?

Why it matters now

Three forces make provenance urgent in 2026:

  • AI writes the code. Developer surveys consistently report the majority of engineers using AI assistants daily, with large fractions of accepted suggestions landing in production unreviewed.
  • Liability is shifting. Copied-or-similar code can carry GPL and other copyleft obligations into proprietary repos; generated code can embed leaked secrets, insecure patterns, or hallucinated APIs. Without provenance you discover these in an incident, not in a review.
  • Regulation is arriving. The EU AI Act obliges providers and deployers of AI systems to keep automated-generated output identifiable and logs available (Articles 11, 12 and 14 for human oversight). SOC 2 and ISO 42001 audits increasingly ask "how do you know which code was AI-generated?"

The key elements of AI code provenance

A complete provenance system records, for every AI insertion:

  • Identity & tool tracking — which assistant or CLI produced the change (Claude Code, Cursor, GitHub Copilot, Codex CLI, Gemini CLI…) and which account used it.
  • Model & prompt lineage — the exact model version and the prompt (or agent task) that led to the code.
  • Line-level attribution — per-line marks in the editor and in blame views, not just per-commit flags.
  • Review status — whether a human read and accepted the change, and who.
  • Risk & license scoring — IP/licence similarity (e.g. GPL match), secret leakage, and insecurity signals, weighted into a score.
  • Integrity — a tamper-evident hash chain over records, so the audit trail itself can be trusted.

Git blame vs AI code provenance

Git answers "who committed this line?" — a question about people and time. Provenance answers "which AI wrote this line, from what prompt, and was it reviewed?" — a question about machine origin and assurance.

QuestionGit blameAI provenance
Who committed the line?YesYes
Which model wrote it?NoYes
Which prompt produced it?NoYes
Was it human-reviewed before merge?NoYes
License / IP similarity risk?NoYes
Tamper-evident audit export?NoYes (AI-BOM, hash chain)

How provenance capture works

There are two capture points, and mature tools use both:

  • Editor-level capture — a plugin in VS Code, Cursor, JetBrains or a CLI wrapper observes insertions as they happen and records the active model, session and prompt context. Zero infrastructure; works offline and air-gapped.
  • Proxy-level capture — a transparent local proxy sits between the AI tool and the model API (e.g. localhost:8788), capturing the full prompt, model response, and tool metadata for every request. This works for agentic CLIs (Claude Code, Codex CLI, Gemini CLI, Goose) that have no editor to plugin into.

Records then flow into a local dashboard for risk scoring, semantic search (pgvector), team feeds, CI gates, and export.

Provenance and compliance (EU AI Act, SOC 2, AI-BOM)

Provenance records are the raw material for compliance artifacts:

  • EU AI Act — logging obligations (Art. 12) and human-oversight evidence (Art. 14) for AI-assisted output; an exportable provenance trail is the cheapest way to satisfy auditors.
  • AI-BOM — like an SBOM for dependencies, an AI Bill of Materials enumerates AI-generated content in a release, signed and verifiable.
  • SOC 2 / ISO audits — change-management evidence: who accepted what, when, with what risk flag.

Choosing an AI code provenance tool

Evaluate candidates against this checklist:

  • Capture breadth — does it cover your tools (editor assistants and agentic CLIs)?
  • Self-hosting — can prompts and code stay entirely on your infrastructure?
  • Line-level marks — attribution in the editor and in blame, not just a dashboard.
  • Risk signals — license similarity, secret detection, confidence scoring.
  • CI enforcement — can PRs be gated on unreviewed high-risk AI code?
  • Export & integrity — AI-BOM, CSV, hash chain, retention controls.

How LineageLens implements AI code provenance

LineageLens is an open-source, self-hosted provenance tool that covers the full checklist above:

  • 11 AI tools tracked — editor assistants (Copilot, Cursor, Windsurf, Codeium) and agentic CLIs (Claude Code, Codex CLI, Gemini CLI, Goose, Continue) via editor capture + transparent proxy.
  • Line-level blame — lineagelens blame annotates each line with model, prompt, developer, review status and risk, right where git blame sits.
  • Risk engine — five-signal confidence scoring incl. GPL-3.0-style license matching and secret-leak flags.
  • Governance — pgvector semantic search, team feed, GitHub Actions risk gate, MCP server, SHA-256 hash chain and signed AI-BOM on the Plus tier; Neo4j graph lineage and SSO on Max.

Start free: the Base VS Code extension records provenance locally in 30 seconds, and the Lite Docker tier adds the full dashboard on any $5 VPS.

Frequently asked questions

Is git blame enough for AI code tracking?
No. Git blame names the human who committed AI-written code, not the AI that wrote it. Provenance records the model, prompt, tool and review status per line.

Which AI coding tools can be tracked?
With LineageLens: Claude Code, Codex CLI, Gemini CLI, Goose and Continue via proxy capture; Copilot, Cursor, Windsurf and Codeium via editor capture; Aider and Cline/Roo are planned. See the full tool coverage list.

Does AI code provenance require sending code to a vendor cloud?
No. LineageLens is self-hosted at every tier — from a local VS Code extension to your own Postgres/Neo4j stack. Prompts and code never leave infrastructure you control.

What is an AI-BOM?
An AI Bill of Materials: a signed, machine-readable inventory of AI-generated content in a build, used for audit and compliance. LineageLens Plus generates one from the provenance hash chain.

How do I start?
Install the free Base extension (30 seconds), or deploy Lite with one Docker command. Compare all tiers on pricing.