Skip to main content
The Code page shows what each part of your codebase cost in the selected period, and how much of that spend was rework. Open it from Code in the Workspace section of the sidebar.

Before you begin

  • View Pull Requests and Repositories to open the Code page.
  • View Source Code to see the source of a file. Agent Golf reads the file from GitHub for each view and does not keep it.
  • View Team Activity to see the spend of all users. Without it, the page counts only the cost of your own sessions.
To see which roles include these permissions, see Default roles.

Spend and rework by path

The page starts with the repositories. Select a repository, then a folder, to go down the tree. A sentence at the top answers the question for the current place, for example “Your team spent $41.00 on src in this period.” Three tiles follow: Spend, Rework Cost, and Rework Share. How Spend splits:
  • Each pull request splits its attributed cost over its files by changed lines. A folder is the exact sum of its children.
  • Lockfiles, generated files, and snapshots take no share. When no file of a pull request has a share, for example a change of only binary files, each file takes an equal share.
  • Open and closed pull requests that did not merge do not count.
  • A pull request with no file list has no path. The Spend tile of a repository includes its cost and names it apart, for example “$17.00 from pull requests with no file list”.
  • Spend includes no CI cost.
How Rework counts:
  • It uses the same rule as Rework Rate: only corrective changes inside the rework window, on earlier pull requests with an authored session. For the same period, the Rework total of all repositories equals the rework cost of the team’s Rework Rate tile.
  • Rework Window above the table sets how long after a merge a later pull request still counts as rework: 3, 7, 14, or 30 days. The default is 7 days. Your browser keeps the choice, and the Rework Rate tiles and the pull request pages use the same window.

Source view

Select a file to open it. With View Source Code, the page shows the source of the file with a heatmap of the period, then the pull requests that changed the file. The file is the version after the newest change of the period on the default branch. Choose what the heat shows:
  • Cost: what the period spent on each line. A line takes the cost of the changes that wrote it and of the lines that it replaced, so a line that many changes rewrite gets hotter. Inside one changed block, the cost splits evenly over the lines, so a line value is an estimate. The lines, the removed code (On Removed Code), and the cost that has no line (Not on a Line) add up to the file’s spend.
  • Rework: the later pull requests that corrected each line, by the same rule as Rework Rate. Other rewrites add no heat. The file’s rework cost equals its value in the table.
The colors are relative to the file. Select a line to see the changes behind it. A file that many pull requests changed takes longer to open, because Agent Golf reads each version from GitHub. Without View Source Code, the page shows a note and lists each pull request that changed the file, with its changed line ranges. The page shows only this list in three more cases: the file is binary, the file is not on the default branch at the end of the period, or the Agent Golf GitHub App cannot read the repository.

Rework of one pull request

The Rework tab of a pull request shows the earlier pull requests that it reworks and the later pull requests that rework it, with a verdict for each link. See Pull Requests.

Common problems

No merged pull requests in this period. The page counts only pull requests that merged in the period. Choose a longer period, or connect GitHub. Older merges have no data. Agent Golf records the code changes of each merge. A pull request without recorded code changes shows no data on this page.