PR Review Loop
name: pr-review-loop
by cemoso · published 2026-03-22
$ claw add gh:cemoso/cemoso-pr-review-loop---
name: pr-review-loop
description: Autonomous PR review loop with Greptile. Use when an agent creates a PR and needs to autonomously handle code review feedback — reading Greptile reviews, fixing issues, pushing fixes, re-triggering review, and auto-merging when score is 4/5+. Trigger on commands like "pr review {url}", "review my PR", or when a Greptile review webhook/poll delivers feedback.
---
# 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:
# Run the review loop
bash scripts/pr-review-loop.sh <owner/repo> <pr-number>Or invoke steps manually — see below.
Workflow
1. Fetch Review
# 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:
3. Auto-Merge (score ≥ 4)
gh pr merge <number> --merge --delete-branch --repo <owner/repo>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:
Address Greptile review feedback (round N)
- Fix X in path/to/file.ts
- Fix Y in path/to/other.ts
- Improve Z per reviewer suggestionPush and re-trigger:
git push
gh pr comment <number> --repo <owner/repo> --body "@greptileai review"5. Track State
Maintain `review-state.json` in workspace:
{
"owner/repo#123": {
"rounds": 2,
"maxRounds": 5,
"lastScore": 3,
"sameScoreCount": 1
}
}Update after each round. Check exit conditions:
6. Escalation
Command Interface
Agents should respond to:
References
See `references/greptile-patterns.md` for common Greptile feedback patterns and fix strategies.
More tools from the same signal band
Order food/drinks (点餐) on an Android device paired as an OpenClaw node. Uses in-app menu and cart; add goods, view cart, submit order (demo, no real payment).
Sign plugins, rotate agent credentials without losing identity, and publicly attest to plugin behavior with verifiable claims and authenticated transfers.
The philosophical layer for AI agents. Maps behavior to Spinoza's 48 affects, calculates persistence scores, and generates geometric self-reports. Give your...