✓ Verified 💻 Development ✓ Enhanced Data

Pr Review Loop

Autonomous PR review loop with Greptile.

Rating
4.1 (182 reviews)
Downloads
2,844 downloads
Version
1.0.0

Overview

Autonomous PR review loop with Greptile.

Complete Documentation

View Source →

PR Review Loop

Autonomous cycle: Greptile reviews PR → agent fixes feedback → pushes → re-triggers → repeats until score ≥ 4/5 or max rounds.

Quick Start

When triggered with a PR URL or review payload:

bash
# Run the review loop
bash scripts/pr-review-loop.sh <owner/repo> <pr-number>

Or invoke steps manually — see below.

Workflow

1. Fetch Review

bash
# Get latest Greptile review
gh api "/repos/{owner}/{repo}/pulls/{pr}/reviews" \
  --jq '[.[] | select(.user.login == "greptile-apps[bot]")] | last'

# Get inline comments
gh api "/repos/{owner}/{repo}/pulls/{pr}/comments" \
  --jq '[.[] | select(.user.login == "greptile-apps[bot]")]'

2. Parse Score

Look for confidence/quality score in review body. Greptile typically includes a score like Score: X/5 or Confidence: X/5. Extract it:

  • Score ≥ 4/5 → auto-merge
  • Score < 4/5 → fix issues
  • No score found → treat as needing fixes if there are comments, otherwise merge

3. Auto-Merge (score ≥ 4)

bash
gh pr merge <number> --merge --delete-branch --repo <owner/repo>

4. Fix Issues (score < 4)

For each Greptile comment:

  • Read the file and line referenced
  • Understand the feedback
  • Apply the fix
  • Stage changes
Commit with a descriptive message listing each fix:
text
Address Greptile review feedback (round N)

- Fix X in path/to/file.ts
- Fix Y in path/to/other.ts
- Improve Z per reviewer suggestion

Push and re-trigger:

bash
git push
gh pr comment <number> --repo <owner/repo> --body "@greptileai review"

5. Track State

Maintain review-state.json in workspace:

json
{
  "owner/repo#123": {
    "rounds": 2,
    "maxRounds": 5,
    "lastScore": 3,
    "sameScoreCount": 1
  }
}

Update after each round. Check exit conditions:

  • rounds ≥ 5 → merge anyway, notify Master
  • sameScoreCount ≥ 2 (same score 2 rounds in a row) → merge anyway, notify Master

6. Escalation

  • Architectural decisions (review mentions architecture, design patterns, breaking changes) → ping Master on Telegram, don't auto-fix
  • Max rounds reached → merge + notify Master with summary
  • Unclear feedback → ask Master

Command Interface

Agents should respond to:

  • pr review — start review loop on a PR
  • pr review — same, by reference
  • pr status — show active review loops and their state

References

See references/greptile-patterns.md for common Greptile feedback patterns and fix strategies.

Installation

Terminal bash

openclaw install pr-review-loop
    
Copied!

💻Code Examples

bash scripts/pr-review-loop.sh <owner/repo> <pr-number>

bash-scriptspr-review-loopsh-ownerrepo-pr-number.txt
Or invoke steps manually — see below.

## Workflow

### 1. Fetch Review

--jq '[.[] | select(.user.login == "greptile-apps[bot]")]'

---jq---selectuserlogin--greptile-appsbot.txt
### 2. Parse Score

Look for confidence/quality score in review body. Greptile typically includes a score like `Score: X/5` or `Confidence: X/5`. Extract it:

- **Score ≥ 4/5** → auto-merge
- **Score < 4/5** → fix issues
- **No score found** → treat as needing fixes if there are comments, otherwise merge

### 3. Auto-Merge (score ≥ 4)

gh pr merge <number> --merge --delete-branch --repo <owner/repo>

gh-pr-merge-number---merge---delete-branch---repo-ownerrepo.txt
### 4. Fix Issues (score < 4)

For each Greptile comment:
1. Read the file and line referenced
2. Understand the feedback
3. Apply the fix
4. Stage changes

Commit with a descriptive message listing each fix:

gh pr comment <number> --repo <owner/repo> --body "@greptileai review"

gh-pr-comment-number---repo-ownerrepo---body-greptileai-review.txt
### 5. Track State

Maintain `review-state.json` in workspace:
example.sh
# Get latest Greptile review
gh api "/repos/{owner}/{repo}/pulls/{pr}/reviews" \
  --jq '[.[] | select(.user.login == "greptile-apps[bot]")] | last'

# Get inline comments
gh api "/repos/{owner}/{repo}/pulls/{pr}/comments" \
  --jq '[.[] | select(.user.login == "greptile-apps[bot]")]'
example.txt
Address Greptile review feedback (round N)

- Fix X in path/to/file.ts
- Fix Y in path/to/other.ts
- Improve Z per reviewer suggestion
example.json
{
  "owner/repo#123": {
    "rounds": 2,
    "maxRounds": 5,
    "lastScore": 3,
    "sameScoreCount": 1
  }
}

Tags

#web_and-frontend-development

Quick Info

Category Development
Model Claude 3.5
Complexity One-Click
Author cemoso
Last Updated 3/10/2026
🚀
Optimized for
Claude 3.5
🧠

Ready to Install?

Get started with this skill in seconds

openclaw install pr-review-loop