greploop
Loop a PR through Greptile review until 5/5 confidence with zero unresolved comments.
- License 许可
- MIT
- 最近更新
- 2026-11-04
- Stars
- ★ 0
- Forks
- 0
01 前言 Front Matter
- name
- greploop
- license
- MIT
- metadata
- { "author": "greptileai", "version": "1.3" }
- description
- Loop a PR through Greptile review until 5/5 confidence with zero unresolved comments.
- allowed-tools
- Bash(gh:*) Bash(git:*)
- compatibility
- Requires git and gh (GitHub CLI) authenticated, and Greptile installed on the repo.
- disable-model-invocation
- true
02 资源文件 4
- 参考文档agents/openai.yaml189 B
- 参考文档CREDITS.md320 B
- 许可证LICENSE1.0 KB
- 参考文档references/graphql-queries.md2.1 KB
03 SKILL.md 正文
Greploop
Iteratively fix a PR until Greptile gives a perfect review: 5/5 confidence, zero unresolved comments.
Inputs
- PR number (optional): If not provided, detect the PR for the current branch.
Instructions
1. Identify the PR
gh pr view --json number,headRefName,headRefOid
Switch to the PR branch if not already on it.
Key fields: number, headRefName, headRefOid.
2. Loop
Repeat the following cycle. Max 5 iterations to avoid runaway loops.
A. Trigger Greptile review
Push the latest changes (if any):
git push
Check if Greptile is already running before posting a new trigger comment:
GREPTILE_STATE=$(gh pr checks <PR_NUMBER> --json name,state --jq '.[] | select(.name | test("greptile"; "i")) | .state')
If Greptile is not already running (PENDING or IN_PROGRESS), request a fresh review:
if [ "$GREPTILE_STATE" != "PENDING" ] && [ "$GREPTILE_STATE" != "IN_PROGRESS" ]; then
gh pr comment <PR_NUMBER> --body "@greptile review"
fi
Then poll for the Greptile check run to complete. The loop runs up to 10 minutes, so run this block with a 600000 ms timeout (or in the background):
HEAD_SHA=$(gh pr view <PR_NUMBER> --json headRefOid -q .headRefOid)
ATTEMPTS=0
MAX_ATTEMPTS=60
POLL_INTERVAL_SECONDS=10
while true; do
ATTEMPTS=$((ATTEMPTS + 1))
if [ "$ATTEMPTS" -gt "$MAX_ATTEMPTS" ]; then
echo "Timed out waiting for the Greptile check run after approximately 10 minutes." >&2
exit 1
fi
GREPTILE_CHECK=$(gh api "repos/{owner}/{repo}/commits/$HEAD_SHA/check-runs" \
--jq '.check_runs[] | select(.name | test("greptile"; "i")) | "\(.status // "completed") \(.conclusion // "pending")"' 2>/dev/null)
if [ -z "$GREPTILE_CHECK" ]; then
echo "Waiting for Greptile check to appear..."
sleep "$POLL_INTERVAL_SECONDS"
continue
fi
read -r STATUS CONCLUSION <<< "$GREPTILE_CHECK"
if [ "$STATUS" = "completed" ]; then
if [ "$CONCLUSION" = "success" ]; then
echo "Greptile check passed!"
else
echo "Greptile check completed with: $CONCLUSION"
fi
break
fi
echo "Waiting for Greptile... (status: $STATUS)"
sleep "$POLL_INTERVAL_SECONDS"
done
If polling times out, stop the greploop workflow and report the timeout. Do not continue with stale or missing review results.
B. Fetch Greptile review results
Greptile may surface its score in several places — check all of them:
1. PR description (body):
gh pr view <PR_NUMBER> --json body -q '.body'
2. General PR comments (issue comments):
gh api --paginate "repos/{owner}/{repo}/issues/<PR_NUMBER>/comments?per_page=100"
Filter for Greptile-authored comments and use the body from the most recently updated comment (updated_at), not the most recently created comment. Greptile may edit the same general PR comment on each review cycle; parse the current body, including the "Prompt to fix all with AI" section, before deciding there are no remaining issues.
3. PR reviews:
gh api repos/{owner}/{repo}/pulls/<PR_NUMBER>/reviews
Look for the most recent entry from greptile-apps[bot] or greptile-apps-staging[bot].
Parse the text for:
- Confidence score: a pattern like
3/5or5/5(orConfidence: 3/5). - Comment count: Number of inline review comments noted in the summary.
4. Unresolved review threads (gh fills {owner} and {repo}; see GraphQL reference):
gh api graphql --paginate -F owner='{owner}' -F repo='{repo}' -F pr=<PR_NUMBER> -f query='
query($owner: String!, $repo: String!, $pr: Int!, $endCursor: String) {
repository(owner: $owner, name: $repo) {
pullRequest(number: $pr) {
reviewThreads(first: 100, after: $endCursor) {
pageInfo { hasNextPage endCursor }
nodes {
id
isResolved
comments(first: 1) {
nodes { body path author { login } }
}
}
}
}
}
}' --jq '.data.repository.pullRequest.reviewThreads.nodes[] | select(.isResolved == false)'
The unresolved comment count is the number of threads this returns.
Use whichever source has the most recently updated score. Prefer updated_at from issue comments when comparing an edited Greptile summary against older review entries.
Also carry forward actionable items from the latest Greptile general PR comment, especially the "Prompt to fix all with AI" section, even if the thread query in B.4 returns zero unresolved threads.
C. Check exit conditions
Stop the loop if any of these are true:
- Confidence score is 5/5 AND there are zero unresolved comments
- Max iterations reached (report current state)
D. Fix actionable comments
For each unresolved Greptile comment:
- Read the file and understand the comment in context.
- Determine if it's actionable (code change needed) or informational.
- If actionable, make the fix.
- If informational or a false positive, note it but still resolve the thread.
E. Resolve threads
Resolve every thread handled in D (fixed, informational, or false positive), using the thread IDs from B.4:
gh api graphql -f query='
mutation {
t1: resolveReviewThread(input: {threadId: "ID1"}) { thread { isResolved } }
t2: resolveReviewThread(input: {threadId: "ID2"}) { thread { isResolved } }
}'
F. Commit and push
If git status --porcelain is empty after D, exit the loop and report the remaining comments as informational. Otherwise stage only the files you edited:
git add <files you edited>
git commit -m "address greptile review feedback (greploop iteration N)"
git push
Then go back to step A.
3. Report
After exiting the loop, summarize:
| Field | Value |
|---|---|
| Iterations | N |
| Final confidence | X/5 |
| Comments resolved | N |
| Remaining comments | N (if any) |
If the loop exited due to max iterations, list any remaining unresolved comments and suggest next steps.
Output format
Greploop complete.
Iterations: 2
Confidence: 5/5
Resolved: 7 comments
Remaining: 0
If not fully resolved:
Greploop stopped after 5 iterations.
Confidence: 4/5
Resolved: 12 comments
Remaining: 2
Remaining issues:
- src/auth.ts:45 — "Consider rate limiting this endpoint"
- src/db.ts:112 — "Missing index on user_id column"
04 同仓库更多 Skills
explainroo
Make an explainer video (MP4) with a voice-over using explainroo. The voice is made on this computer and no API key is needed. Use when the user asks for an explainer, how-to, walkthrough, launch or tutorial video, an animated diagram with a voice-over, or a short for YouTube, Reels or TikTok.
unslop
Cut AI tells from prose a human will read. Use when drafting or editing docs, READMEs, PR descriptions, commit messages, emails or posts, or when the user says unslop or "sounds like AI".
technical-writing
Layered technical-writing standard (Diátaxis, Google style, STE, Global English) for docs, RFCs, READMEs, PR descriptions and commit messages.
no-comments
Spawn Comment Sicko, fix accepted findings, and offer encodings for claimed constraints.
ponytail
Lazy senior dev mode: the smallest change that fully solves the task, and a reply a busy human understands in one read. Use on any coding task (writing, fixing, refactoring, reviewing, choosing dependencies) and when the user says "ponytail", "be lazy", "simplest solution", "yagni", or complains about over-engineering or bloat. Levels: lite, full (default), ultra.
ponytail-review
Quality review of a change: is the logic right, is it safe, does it hold under real load, is risky code tested, is it fast enough, and is every line needed. Reads the connected code, not only the diff. Each finding is explained in plain English. Use for "review this", "code review", "review the last commit", "review my PR", "is this over-engineered", /ponytail-review.