Review code and pull requests
Gaunt Sloth reviews are stateless — nothing carries over between runs, so a verdict can’t be
argued down across a conversation — and a failing review exits non-zero. That combination is
what makes gth usable as an on-prem review gate: run it in CI, and a bad diff fails the job the
same way a failing test would.
The main use case: gate every pull request in CI
Section titled “The main use case: gate every pull request in CI”Goal: every PR gets reviewed automatically against its linked issue, and the result blocks the merge if the review fails.
In your CI job, after checking out the PR branch:
export ANTHROPIC_API_KEY="${{ secrets.ANTHROPIC_API_KEY }}"gth pr 42gth pr 42 fetches PR #42’s diff with the GitHub CLI (gh), finds the issue linked in the PR
description, and reviews the diff against that issue as the requirements. If the review fails, the
command exits non-zero and the CI step fails.
Two prerequisites for gth pr:
- the GitHub CLI (
gh) is installed and authenticated (in CI,ghpicks upGH_TOKEN); - the provider key is exported, exactly as in the Quickstart.
Run with no arguments — gth pr — and it discovers the current branch’s PR and its requirements
for you, which is handy in a job that already knows its own branch.
Review a local diff before you push
Section titled “Review a local diff before you push”You don’t need a PR to review. Pipe any diff in:
git --no-pager diff | gth reviewOr let the git content source run the diff for you:
gth review --content-source gitAdd requirements to check against, and focus the reviewer:
gth review --content-source git -r requirements.md -m "focus on security implications"Examples
Section titled “Examples”# Review PR #42 with GitHub issue #23 as the requirementsgth pr 42 23
# Review PR #42 against a Jira issue insteadgth pr 42 PROJ-123 -p jira
# Review a specific commit range (no pipe) via the git content sourcegth review origin/main...feature-branch --content-source git
# Review the working diff with a requirements filegit --no-pager diff | gth review -r requirements.mdRelated
Section titled “Related”- Pull requirements from a GitHub issue or Jira automatically: Content sources.
- Every
review/prflag: Commands. - Run the review under a cheaper model than your coding model: Choose & switch models.