Code Generation Attribution
Also known as Generated code attribution
Definition
Code generation attribution is the process of associating a code change with the AI tool, model, session, and human activity that contributed to it. The association may be directly recorded or inferred, and its evidence strength should remain visible.
Different records support different claims
A tool event can show that a developer accepted a suggestion or that an agent edited a file. A commit records a repository change and its credited authors. A merged pull request records a later review and integration decision. These events form a chain only when there is enough information to connect them.
Direct telemetry is strongest when it identifies the relevant edit and retains that identity through subsequent changes. Commit trailers provide declared attribution: GitHub supports a Co-authored-by trailer, but the trailer alone does not say which lines a contributor wrote. GitHub's co-authorship documentation.
Time-window matching is weaker. A developer may have an AI session open while writing unrelated code, so overlapping timestamps establish proximity rather than authorship. Likewise, an AI-like writing style is not reliable evidence that a particular tool produced a change.
A mixed-authorship example
Suppose an agent proposes an 80-line patch. The developer replaces part of its error handling, adds a test, and merges a 110-line change after review. Telemetry identifies the original patch and the relevant session, but the final diff includes human contributions.
A defensible report can label the pull request AI-assisted and retain the link to the session. It cannot automatically declare all 110 lines AI-generated. If the system tracks edit lineage, it may estimate the retained portion with an explicit matching method. If it only has a commit marker, that finer claim is unavailable.
Now suppose the session involved two models. Assigning the entire pull request to the last model would hide earlier contributions. Track the relationship at the resolution the data supports, and allow multiple contributors rather than forcing false precision.
Measure coverage as well as adoption
Report the share of changes with usable attribution and the share with unknown provenance. Missing telemetry should not silently become "human-only." GitHub documents that Copilot usage metrics draw on several telemetry sources and that coverage can differ with client settings and supported surfaces. GitHub Copilot usage metrics.
Consistent identity mapping also matters when one person uses multiple accounts or devices. Resolve identities with an auditable mapping, preserve original identifiers for investigation, and avoid counting a shared service account as one individual developer.
When allocating costs, identify whether a session produced one change or contributed to several. Splitting its full cost equally across pull requests is a stated allocation rule, not an observation of which request consumed each token. Retain that distinction in reports.
Attribution is not causal impact
Knowing that AI contributed to a pull request does not establish that AI made it faster, cheaper, or better. Those claims require a baseline or a suitable comparison design. Add review effort, retained output, defects, and rework to the analysis, and distinguish contribution evidence from the separate question of business value.
How this relates to Weave
Weave's Token Intelligence describes three attribution methods: native tool signals, commit metadata, and time-series estimates. Engineering Intelligence provides context for relating that activity to output. Keep the method and confidence visible rather than treating every AI-associated change as directly verified authorship.
Explore Engineering intelligence