> ## Documentation Index
> Fetch the complete documentation index at: https://docs.agent.golf/llms.txt
> Use this file to discover all available pages before exploring further.

# Attribution

> See which agent sessions authored or reviewed each pull request, and link a session by hand when no automatic link exists.

Attribution links each agent session to the pull requests that it authored or reviewed. You see which agent work went into each pull request, what it cost, and who did it.

Agent sessions stay in a Self-Hosted Uplink instance. Uplink sends attribution evidence, not session content, to Agent Golf. Agent Golf combines it with GitHub pull requests and shows linked sessions.

A Self-Hosted Uplink instance matches each session to the pull requests that it authored or reviewed, on your
infrastructure. It sends attribution evidence to Agent Golf, not session content. With Cloud Uplink, the matching
runs on Agent Golf infrastructure. Agent Golf shows the linked sessions of each pull request.

## Requirements

* The Agent Golf GitHub App, installed on the pull request's repositories. See [GitHub Integration](https://docs.agent.golf/github/overview.md).
* A running uplink instance that stores the sessions.
* Session content in your harness telemetry. When a harness sends less content, Uplink finds fewer automatic links. You can still [link a session by hand](#link-a-session-by-hand).

## Where linked sessions show

* **Pull Requests**: the agent icon with the number of linked sessions in each row. See [Pull Requests](https://docs.agent.golf/dashboard/pull-requests.md).
* **Session Attribution** on each pull request page: the linked sessions and the share of each session's cost.
* **Dashboard**: **Your Pull Requests** shows the agent icon for each pull request. **Needs Attention** shows a notice when merged pull requests have no linked session.
* **Sessions**: the **Pull Requests** card of each session lists its linked pull requests, with the share of the session cost that goes to each.

## What a linked session means

A session links to a pull request through attribution evidence from Uplink, through a manual link, or through both. The evidence gives the session a role: **authored** or **reviewed**. A manual link gives no role.

A session can link to several pull requests, and a pull request can include sessions from several developers. Without the **View Team Activity** permission, the counts and costs include only your own sessions. See [Default roles](https://docs.agent.golf/account/users.md#default-roles).

An epoch is one period of the pull request, from one change of its content to the next. Automatic links have two limits:

* **Time.** In the first epoch of a pull request, only evidence from 2 hours before its first commit or its opening, whichever is earlier, counts. A session authors a pull request only with work near its commits. A session can review a pull request until the pull request is merged or closed.
* **Authors.** A session cannot author a pull request when the person who ran it did not author the pull request or one of its commits. It can still review the pull request. Agent Golf applies this limit only when it knows each author as a workspace user with a linked GitHub account.

Two sessions that one person runs at the same time on the same files can both link to a pull request.

## Link a session by hand

When attribution finds no link, the session owner can add one. The pull request must already show on the **Pull Requests** page.

Before you begin:

* You own the session. A user who can open other users' sessions cannot link them.
* You have the **Attribute Own Sessions** permission.

To link the session:

1. Open **Sessions**, then open the session.
2. In the **Pull Requests** card, select **Link a Pull Request**.
3. In **Pull Request URL**, enter the GitHub pull request URL, for example `https://github.com/acme/widgets/pull/42`.
4. Select **Link Pull Request**.

The pull request shows in the **Pull Requests** card with the **Manual** label. If you link the same pull request again, Agent Golf keeps the existing link.

To do the same from a terminal, use [`agentgolf attribute`](https://docs.agent.golf/cli/commands#agentgolf-attribute).

A manual link adds the session to the pull request's counts, but not to its cost. See [Cost of a pull request](#cost-of-a-pull-request).

If the dashboard shows **The session or pull request was not found for your account.**, check that the pull request shows on the **Pull Requests** page and that you own the session.

## Cost of a pull request

The cost of a pull request counts only the work of its sessions in their attributed epochs. An attributed epoch of a session is an epoch in which the evidence links the session as **authored** or **reviewed**.

* Each model request counts for the pull requests whose attributed epochs contain the time of the request. A request outside every attributed epoch adds no cost.
* When the attributed epochs of more than one pull request contain a request, its cost splits evenly between them. The shares add up to the cost of the request.
* The first epoch of a pull request has no start time. When a session works on pull request A, A merges, and the same session then opens pull request B, the work for A counts only for A.
* A session that only a manual link connects adds no cost. The cost shows "N manual links not counted".
* Without **View Team Activity**, the cost includes only your own sessions. The split of a request does not change.

Agent Golf keeps each model request's time, cost, and token counts after your workspace's [**Session Detail** window](https://docs.agent.golf/account/data-retention.md#history-retention) deletes the session detail, so a pull request's cost stays the same. A session whose requests were deleted before Agent Golf recorded their cost adds no cost, and the cost detail says so.

For the CI part of the cost, see [CI Costs](https://docs.agent.golf/dashboard/ci-costs.md).

## Pull request comments

A comment that a session posts on a pull request with the GitHub CLI can count as evidence, for example with `gh pr comment` or `gh pr review`. This covers a comment, a review body, and an inline review comment. Uplink matches the comment's lines with the comments on the pull request, and sends attribution evidence, not the text.

* Evidence from a comment only raises the confidence of a link. It does not link a session by itself, and it gives a session no role.
* A comment does not start a new epoch. Agent Golf reads new comments at the pull request's next code change and at the merge, so a comment after the last push still counts.

> [accordion] More comment rules
>
> * Evidence from a comment stays when someone deletes the comment.
> * The Agent Golf GitHub App's own comments do not count.
> * A comment in the code is part of the diff, so it counts as a normal code change.

## Data boundary

With a Self-Hosted Uplink instance, matching runs on your infrastructure. With [Cloud Uplink](https://docs.agent.golf/uplink/cloud.md), it runs in the Cloud Uplink instance. See [What Leaves Your Network](https://docs.agent.golf/getting-started/data-boundary.md).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.