Diamond helps reduce your team’s overall time-to-merge by providing your developers with immediate, actionable feedback on all of their pull requests.

Enabling Diamond

Before Diamond can start leaving comments, it must be enabled for a repository.

To enable Diamond, navigate to the Diamond settings page and click “Enable Diamond”.

After you click “Enable Diamond”, you’ll be prompted to select the repositories that you want to enable Diamond on. If you do not see the expected repositories, make sure that they are synced with Graphite.

Review comments

Once you have enabled Diamond, it will automatically start analyzing any new pull requests in the repository. Whenever it finds a bug, it will leave a comment directly on the pull request calling out the bug and suggesting potential fixes. Some examples of bugs you can expect Diamond to find are:

  • Logical mistakes (e.g. “Based on {callsite, usage, comments}, this function is trying to do X, but the implementation actually does Y”)

  • Edge cases (e.g. “This use of React’s useMemo will lead to issues on subsequent rerenders. For example, because the function is not re-evaluted when X changes, …”)

  • Accidentally committed—or copy and pasted—code (e.g. “This endpoint only checks for read permissions but then writes user settings to the database”)

In the right-hand panel of the PR page, you can see whether Diamond has previously run, is currently running, or won’t run (for example, Diamond won’t run on PRs that are over 100,000 characters).

The dashboard

After Diamond has run on a handful of PRs, you’ll start to see comments aggregate in your feed with additional stats such as: total number of PRs reviewed, issues Diamond found that led to fixes, and the percentage of Diamond comments that were downvoted by your team.

Accessible from the Diamond settings page, the feed shows you all the comments that Diamond has left in your selected repositories.

You can also filter the feed by category:

  • Logic bug: functional logic errors

  • Security issue: potential security vulnerabilities introduce in the code change

  • Accidentally committed code: things like temporary test code that shouldn’t be in production

  • Performance issue: areas where computational efficiency could be improved

  • Code quality/style: adherence to style guide convention and best practices

  • Documentation issue: problems with documentation clarity or accuracy

  • Potential edge case: unaccounted for scenarios in the codebase such as missing switch cases

Customization options

You can customize diamond in two main ways: Filters and Custom rules.

Filters allow you to specify certain cases that you want Diamond to ignore completely. For example you can tell Diamond to ignore test PRs, or to ignore some conventional best practices if they differ from your team’s internal style guide.

The second way you can customize Diamond is with Custom rules. Here you can detail explicit codebase guidelines that Diamond will follow when reviewing your code. There are some example templates available to choose from, such as style guides for some popular languages and general guidelines to help make code more accessible or secure. The fastest way to see immediate value from Custom rules is to directly paste in your organization’s coding guidelines or documentation!

Excluding files from Diamond review

You can exclude certain files or file types from Diamond reviews by marking them as generated files in your repository’s .gitattributes file. This is particularly useful for:

  • Data files that don’t need to be reviewed
  • Generated code that is automatically created by tools
  • Any files that would make a PR too big for Diamond to analyze

To exclude files, create or modify a .gitattributes file in the root of your repository and add entries marking the files as generated:

# Exclude specific files
docs/data.txt linguist-generated=true

# Exclude file types
*.csv linguist-generated=true

# Exclude entire directories
data/* linguist-generated=true

Files marked as linguist-generated will be treated as generated files by GitHub and Diamond, which means they’ll be automatically collapsed in pull request views and excluded from Diamond’s analysis when determining if a PR is too large to review.

For more information, see GitHub’s documentation on customizing how changed files appear on GitHub.

How Diamond works

Under the hood, Diamond watches for every new pull request. When it detects a new pull request, it gathers other relevant information from your repository (including similar past pull requests, additional files that might be relevant, and past comments) and passes that information to a sequence of large language models to determine if there are any bugs and how those could be fixed.

We use Anthropic and OpenAI as our LLM providers, and always design with the security of your data in mind. You can find more details in our AI security and privacy page.

Pricing

Diamond is priced per active committer, meaning anyone that’s committed code to one of your organizations repository in the last 3 months.

Diamond is $20/per committer per month and is billed organization-wide.

If your organization also has a Graphite Core subscription you receive a $5 discount per Graphite Core seat.

For example: if you have 20 active committers and are paying for 10 Graphite seats, 10 committers will be charged $15/month for Diamond, and the additional 10 committers will be charged $20/month for Diamond.

For custom enterprise pricing you can reach out to our sales team.