# AI impact on PR metrics

## Automatic AI assistant detection for PRs

To help you understand how AI use affects developer productivity metrics, Swarmia automatically detects pull requests assisted by GitHub Copilot, Cursor, or Claude Code. You can see which AI tools assisted in an individual pull request by opening it anywhere in the app.

<figure><img src="https://2772466312-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FMa8uBmGhQgR7MTPq9yh7%2Fuploads%2F3tesVcLEufSVFXJI1Bb8%2F004078%402x.png?alt=media&#x26;token=d56c1715-bea9-485f-83ce-aa30a4d71ad9" alt=""><figcaption></figcaption></figure>

A pull request is considered AI-assisted if at least one of these conditions is met:

* It was authored by an AI tool (in which case it's also considered an [AI coding agent](https://help.swarmia.com/use-cases/measure-the-productivity-impact-of-ai-tools/ai-agent-metrics) PR)
* Any of its commits were authored or co-authored by an AI tool
* Any of its commits were made by an author who used an AI tool within the previous 24 hours
* Any of its commits has the `Made-with: Cursor` Git trailer
* It has the `claude-code-assisted` label

You can see the reason for tagging an individual pull request in a tooltip by hovering over the AI tool badge.

{% hint style="info" %}
In Swarmia, pull requests authored by AI tools are attributed to the people who initiated them. For example, if GitHub Copilot creates a PR on your behalf, Swarmia shows you as its author.
{% endhint %}

## Compare pull request metrics by the AI coding assistant

The [AI tools → AI impact](https://app.swarmia.com/ai/impact/code) page helps you understand how pull requests assisted by different AI coding tools — or no AI tools — perform across metrics like throughput, cycle time, batch size, and review time.

This makes it easier to [answer questions like](https://www.swarmia.com/blog/staged-approach-AI-adoption-for-engineering/): Is AI-assisted work moving through your system faster or slower? Which teams benefit most from AI tools? How are quality indicators responding to increased AI usage?

Use the **grouping selector** to select the data sets you want to compare: maybe AI versus no AI, or different AI coding tools side-by-side.

<figure><img src="https://2772466312-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FMa8uBmGhQgR7MTPq9yh7%2Fuploads%2F6R8nJVb0kIKFThCIjpA2%2F004076%402x.png?alt=media&#x26;token=c46a993a-1b9d-4e5c-9a4f-d4525ab4593a" alt=""><figcaption></figcaption></figure>

Use the **aggregate selector** to view averages, or choose from various percentiles to reduce the effect of outlier pull requests. You can also **apply filters** like repository to understand where AI-assisted work differs from other work.

<figure><img src="https://2772466312-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FMa8uBmGhQgR7MTPq9yh7%2Fuploads%2FNXwql5RzEVqmvzSYm9p2%2F004079%402x.png?alt=media&#x26;token=9bf81d9f-aa3f-4e32-8d67-010df5514110" alt=""><figcaption></figcaption></figure>

## AI assistant filter

You can use the **AI assistant** filter to view pull requests on all the pages under [Code metrics](https://app.swarmia.com/metrics/code) based on the AI tools involved. (See also the [AI agent filter](https://help.swarmia.com/use-cases/ai-agent-metrics#ai-agent-filter) for viewing pull requests created by AI agents.)

<figure><img src="https://2772466312-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FMa8uBmGhQgR7MTPq9yh7%2Fuploads%2FNdvfgns7TXnCj7kNce5Z%2F004080%402x.png?alt=media&#x26;token=3e1f716a-c73f-4c94-8032-b7b6eed3a6ea" alt=""><figcaption></figcaption></figure>

## Frequently asked questions

### Why is my PR marked AI-assisted even though I didn't use AI for it?

Some AI coding tool providers don't share PR-level activity data in their analytics APIs. To address this, we use certain heuristics, such as checking if the commit authors have used an AI tool within the previous 24 hours. (See the full list of rules under [Automatic AI assistant detection for PRs](#automatic-ai-assistant-detection-for-prs) above.)

This can result in false positives. For example, if you simultaneously work on tasks A and B, but only use AI for task A, Swarmia inaccurately associates the tool usage also with task B.

You can hover over the AI tool label to see the exact attribution reason for any pull request:

<figure><img src="https://2772466312-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FMa8uBmGhQgR7MTPq9yh7%2Fuploads%2FQZGQnZ2plLXBsjA9uqzU%2F003468%402x.png?alt=media&#x26;token=97251651-c6e4-4e43-8947-8fed1c918414" alt=""><figcaption></figcaption></figure>

### Why is the attribution window 24 hours?

It accounts for cases where you create code with AI today but commit it tomorrow. Also, some AI coding tool providers report user activity only on the daily level, so we can't get more granular than that.
