Iteratively improves a PR (GitHub), MR (GitLab), or shelved changelist (Perforce) until Greptile gives it a 5/5 confidence score with zero unresolved comments. Triggers Greptile review, fixes all actionable comments, pushes/re-shelves, re-triggers review, and repeats. Use when the user wants to fully optimize a PR/MR/CL against Greptile's code review standards.
Standardmäßig ist der Prompt ausgewählt, der zuerst die Quelle prüft. Sie können zu einem direkten Befehl wechseln oder eine lokale Kopie herunterladen.
Quelldateien prüfen
Lesen Sie SKILL.md und alle von SkillsMP angezeigten Begleitdateien, bevor Sie sich für eine Installation entscheiden.
Mit Codex oder Claude installieren Kopieren Sie diesen Prompt, fügen Sie ihn in Codex, Claude oder einen anderen Assistant ein und lassen Sie die Skill-Seite prüfen und installieren.
Ein direkter Befehl überspringt den Prüf-Prompt. Prüfen Sie die Quelle, bevor Sie ihn ausführen.
Iteratively improves a PR (GitHub), MR (GitLab), or shelved changelist (Perforce) until Greptile gives it a 5/5 confidence score with zero unresolved comments. Triggers Greptile review, fixes all actionable comments, pushes/re-shelves, re-triggers review, and repeats. Use when the user wants to fully optimize a PR/MR/CL against Greptile's code review standards.
license
MIT
compatibility
Requires git, gh (GitHub CLI) or glab (GitLab CLI) authenticated, and Greptile installed on the repo. For Perforce, requires p4 CLI authenticated.
metadata
{"author":"greptileai","version":"1.2"}
allowed-tools
Bash(gh:*) Bash(glab:*) Bash(git:*) Bash(p4:*)
Greploop
Iteratively fix a PR/MR/CL until Greptile gives a perfect review: 5/5 confidence, zero unresolved comments.
Inputs
PR/MR/CL number (optional): If not provided, detect the PR/MR for the current branch, or the default pending changelist for p4.
Instructions
0. Delegate execution when invoked by Codex
When Greploop is invoked from Codex and sub-agents are available, the main agent must delegate the actual Greploop execution to a sub-agent by default. Pass along the detected or provided PR/MR/CL identifier, repository/worktree path, current branch, VCS platform, user scope constraints, and any known changed-file intent. The parent agent monitors progress, relays concise status updates, and reports final results. Only run Greploop directly from the parent agent when sub-agents are unavailable or the environment cannot delegate.
1. Detect platform
First check for Perforce, then fall back to git remote detection:
# Check for Perforce environmentif p4 info >/dev/null 2>&1; then
VCS="perforce"else
REMOTE_URL=$(git remote get-url origin)
ifecho"$REMOTE_URL" | grep -qi "gitlab"; then
VCS="gitlab"else
VCS="github"fifi
For self-hosted GitLab instances whose hostname doesn't contain "gitlab", the user can override by passing --vcs gitlab as an input. For Perforce, pass --vcs perforce.
If PR_JSON is empty because no PR exists for the current branch/worktree, automatically publish a draft PR before starting the loop:
Inspect git status --short and determine the intended change scope. Do not silently stage unrelated changes; if the worktree is mixed and the intended files are unclear, stop and ask.
Ensure the work is on a review branch. If the current branch is missing, protected, default, or unsuitable, create/switch to a codex/<descriptive-name> branch.
Stage intended changes only, commit if needed, push the branch, and create a draft PR.
git switch -c codex/<descriptive-name> # only when a review branch is needed
git add <intended-files-only>
git commit -m "<concise change summary>"# only when there are staged changes
git push -u origin HEAD
gh pr create --draft --fill
Then continue Greploop against the created PR number.
GitLab — check if Greptile is already running before posting a trigger comment:
PIPELINES=$(glab api "projects/:fullpath/merge_requests/<MR_IID>/pipelines")
GREPTILE_RUNNING=$(echo"$PIPELINES" | jq '[.[] | select(.status == "running" or .status == "pending")] | length')
If no pipeline is running, post a trigger comment:
if [ "$GREPTILE_RUNNING" = "0" ]; then
glab mr note <MR_IID> --message "@greptile review"fi
Perforce — Perforce does not have native check runs. If Greptile is integrated via a webhook triggered on p4 shelve, wait for it to process. Check your Greptile installation's webhook endpoint or dashboard for the review status. Poll by re-fetching the Greptile review comment on the CL until a score appears.
glab api "projects/:fullpath/merge_requests/<MR_IID>/notes"
Filter for notes from the Greptile bot user (check the author.username field — the exact username may vary per installation; verify on first run).
Perforce:
1. CL description:
p4 describe -s <CL_NUMBER>
Check the description field for a Greptile-appended score block.
2. CL comments / review notes:
If your installation uses a review tool such as Helix Swarm, fetch comments via its API.
Example (Swarm API):
GET /api/v11/comments?topic=reviews/<REVIEW_ID>
Response fields of interest typically include:
user (author username)
body (comment text)
flags/state indicating whether the comment is resolved
Filter to comments authored by the Greptile bot:
Prefer exact username match if known
Otherwise, use a heuristic where the author name contains "greptile" (case-insensitive)
For all platforms, parse the text for:
Confidence score: a pattern like 3/5 or 5/5 (or Confidence: 3/5).
Comment count: Number of inline review comments noted in the summary.
Use whichever source has the most recent score.
Also fetch all unresolved inline comments:
GitHub:
gh api repos/{owner}/{repo}/pulls/<PR_NUMBER>/comments
GitLab:
glab api "projects/:fullpath/merge_requests/<MR_IID>/discussions"
Filter to DiffNote type discussions (notes[0].type == "DiffNote") from Greptile that are on the latest commit and not yet resolved ("resolved": false).
Perforce:
If using Swarm:
Fetch inline diff comments for the review associated with the CL
GET /api/v11/comments?topic=reviews/<REVIEW_ID>
Filter to comments from the Greptile bot user that have not been marked as resolved/addressed.
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
GitHub — fetch unresolved review threads and resolve all that have been addressed (see GraphQL reference):
GitLab — fetch unresolved discussions and resolve each one (see GitLab API reference):
glab api "projects/:fullpath/merge_requests/<MR_IID>/discussions?per_page=100"
Filter for "resolved": false discussions. Then resolve each by its id:
glab api --method PUT \
"projects/:fullpath/merge_requests/<MR_IID>/discussions/<DISCUSSION_ID>" \
--field resolved=true
Repeat for each unresolved discussion ID. (GitLab has no batch resolution — loop through each one.)
F. Commit and push / re-shelve
GitHub/GitLab:
Before staging, inspect the worktree and keep the write set scoped to Greptile fixes. Do not run git add -A when unrelated changes are present; stage only intended files, and stop/ask if scope is ambiguous.