/review-loop:review-loopfrom review-loop
Drives every GitHub PR review thread to zero unresolved by iterating through comments, fixing actionable items, replying, and resolving bot threads via GraphQL. Use for 'review loop', 'address review comments', or 'get this PR to zero unresolved'.
Ships in review-loop. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
This skill has one job: take a GitHub PR with open review threads and drive every thread, from
every reviewer, to zero unresolved, iterating until the target is met, then report what it did
in a fixed format. It does not QA the running application; that is autoqa's job. It does not
decide whether the diff is safe beyond what reviewers raised; that is blast-radius's job. It
does not merge, and it does not mint credentials.
| Input | Required | Default |
|---|---|---|
Repository (owner/repo) | no | The origin remote of the current checkout |
| PR number | no | The PR for the current branch (gh pr view) |
Target (open-for-review, review-clean, or merge-ready) | no | review-clean |
| Trigger comment text | no | @greptile-apps review |
--max-iterations N | no | None (no cap). Set only when the caller wants a hard stop |
| Gate command | no | None. The caller or the repository supplies the command that runs tests and lint (for example the repo's make check); the skill only says where in the loop it runs |
| Base-branch sync | no | None. The caller or repository supplies the rebase or merge policy; the skill says where it runs |
Auth precondition: the caller has authenticated gh before invoking this skill. The skill
never mints, reads, or stores tokens. If gh auth status fails, stop and report it.
Repeat until the target in step 9 is met. There is no iteration cap by default; a caller may
pass --max-iterations to impose one. The loop still stops on timeout, a red gate it cannot
fix, an auth failure, or a stall (see "Stop on stall"). Each iteration:
Address review feedback (review-loop iteration 2).review-clean or merge-ready, require zero unresolved threads
across every reviewer and, when Greptile is installed, a 5/5 score from its latest summary.
For open-for-review, require a non-draft PR and focused proof. Automated review may
remain pending.If the caller set --max-iterations and the cap is reached with threads still open, stop and
report them; do not start another iteration.
Fetch all three comment sources on every iteration; a reviewer can use any of them.
# Inline review threads with resolution state (GraphQL; paginate on endCursor)
gh api graphql -f query='...' # see references/graphql-queries.md
# Reviews (approve, request changes, comment) with bodies
gh api --paginate "repos/{owner}/{repo}/pulls/<PR_NUMBER>/reviews?per_page=100"
# Issue comments on the PR conversation tab (Greptile summaries, Devin notes, humans)
gh api --paginate "repos/{owner}/{repo}/issues/<PR_NUMBER>/comments?per_page=100"
A thread is open when isResolved is false. A review body or issue comment is a thread when it
asks for a change or a reply; treat it as open until it is answered. Bot summaries that edit in
place (Greptile does this) must be read by updated_at, not created_at.
Resolve a bot thread after its item is fixed or answered. Use the GraphQL
resolveReviewThread mutation, batched with aliases, and assert the result:
gh api graphql -f query='
mutation {
t1: resolveReviewThread(input: {threadId: "ID1"}) { thread { isResolved } }
t2: resolveReviewThread(input: {threadId: "ID2"}) { thread { isResolved } }
}'
Every alias in the response must report isResolved: true. If one does not, re-fetch the
thread and treat it as still open; do not count it as resolved. Batch up to 20 aliases per
request. Full queries are in references/graphql-queries.md.
Resolving is only the GraphQL resolveReviewThread mutation. A REST reply (the
pulls/{pr}/comments/{id}/replies endpoint) answers a thread but never resolves it, and a
replied-but-unresolved thread still fails the zero-unresolved exit criterion. Always resolve
through GraphQL, never assume a reply resolved anything.
gh pr checks <PR_NUMBER> --json name,state and at
repos/{owner}/{repo}/commits/<HEAD_SHA>/check-runs for a check whose name matches
greptile (case-insensitive). If its state is PENDING or IN_PROGRESS, do not post; wait
for it.@greptile-apps review. Post it at
most once per push. Keep it to the mention: the reason for the re-review belongs in the
thread replies, which Greptile reads, not in the trigger. A trigger must be a new comment;
do not rely on an edited comment to start a review.updated_at is later than the trigger),
collapse the earlier trigger comments by the caller's agent identities with the GraphQL
minimizeComment mutation, classifier OUTDATED. A trigger is any such comment that
mentions @greptile-apps, including older prose triggers. Never collapse the latest
trigger or a human's comment, and never delete a trigger. See
references/graphql-queries.md.PENDING or IN_PROGRESS is not a result: wait for a terminal
conclusion AND for the summary comment's updated_at to move past the trigger time before
reading a score. A freshly-appeared check run beside an unchanged summary means Greptile has
started but not finished, and reading the old summary then records a stale score.updated_at is later than the trigger
comment and its body carries a score.updated_at), the PR
body, and the latest review from greptile-apps[bot] or greptile-apps-staging[bot]. The
score looks like 3/5, 5/5, or Confidence: 3/5.head_sha, or a summary whose updated_at post-dates the head
commit) and compare it to the PR's current head SHA. A score from an earlier commit is stale:
re-trigger, wait, and never record it as the exit criterion.review-clean or merge-ready, Greptile requires 5/5 and zero unresolved
Greptile threads.gh pr ready) and
say so in the report.If a poll for review results times out, stop the loop and report the timeout. Never continue with stale or missing review results, and never count a thread as resolved because the reviewer did not answer.
Stop and report when two consecutive iterations end with no code change and the only open items are ones already answered as informational or false positive. Re-triggering a reviewer that keeps repeating an answered point does not make progress. List those items under "Remaining" for a human.
End with this table. Print it even when the loop stops early.
| Field | Value |
|---|---|
| Repository / PR | owner/repo#N |
| Iterations | N (of max M, when a cap was set) |
| Threads found (per reviewer) | Greptile N, Devin N, humans N |
| Resolved this run | N |
| Replied, left open for a human | N |
| Remaining | N, then one line each: path:line and a short quote |
| Final Greptile score | X/5, or "not installed" |
| Stop reason | exit criterion met, stall, max iterations (when set), timeout, red gate, auth failure |
The report goes to the caller. Do not post it as a new PR comment. A caller that wants it on
the PR edits one comment marked <!-- agent-sticky:review-loop --> in place, using the upsert
recipe in references/graphql-queries.md.
Write the report and every reply through unslop before posting.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
github-pr, code-review, review-loop, greptile, devin, graphql
npx claudepluginhub parcha-ai/parcha-skills --plugin review-loopOther plugins' skills for the same job