monitor-pr
Skill68 starsChanged 5 months agoMITView on GitHub
Watch an open pull request for new CI failures and review comments and drive it to a clean state. Uses the Monitor tool to stream PR status changes in real time so reactions are immediate instead of polled. Handles CodeRabbit nitpicks with judgment (do not blanket-skip) and treats "out of date" comments as still-relevant until proven otherwise. Replies to and resolves each thread as it's addressed. Triggers: "monitor the PR", "watch the PR for comments", "keep an eye on the PR", "address PR feedback as it lands", /monitor-pr.
- Commits and pushes
6 other projects use a version of this.
Adopted by
Most recently taken up by
- microsoft/vscode-team-kittheir own version, first seen Oct 27, 2026
- nexus-a1/claude-skillstheir own version, first seen Oct 17, 2026
- sageox/agent-toolkittheir own version, first seen Oct 8, 2026
- BabylonJS/Babylon.jstheir own version, first seen Oct 8, 2026
- caiopizzol/skillstheir own version, first seen Sep 28, 2026
- doc-detective/agent-toolstheir own version, first seen Apr 10, 2026
Other versions6 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 6
- BabylonJS/Babylon.js★ 26ksame name
- microsoft/vscode-team-kit★ 67same name
- doc-detective/agent-tools★ 13same name
- sageox/agent-toolkit★ 13same name
- caiopizzol/skills★ 3same name
- nexus-a1/claude-skills★ 1same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository5 other files it gives its agents.
- AGENTS.mdAGENTS.md
- firegoat-onboardingSkill
- review-incoming-prSkill
- sageoxSkill
- security-reviewSkill
The file
We split this skill into the rules it gives an agent
7 rules. 0 are common, 4 are distinctive, and 3 are very specific to this project.
0
Common
Most of the 6 edited versions we read keep these.
4
Distinctive
This author's own choices. Worth a look.
3
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 29
Start exactly one monitor at the top of the task with:
- Very specific: line 37
Stop the monitor with TaskStop only when the exit condition is met or the user cancels.
- Distinctive: line 86
60s poll floor: Don't drop below; you'll rate-limit yourself against the GitHub API and waste tokens on noise.
- Very specific: line 99
When the monitor emits change: fail=N pending=P unresolved=M, do the following.
- Very specific: line 239
When the monitor emits clean: ...:
- Distinctive: line 241
Run step 7 if you have not already — re-trigger Greptile and let the final-state review land.
- Distinctive: line 260
Pause and ask: if a comment implies a design decision the user should own, rather than guessing — but keep the monitor running during the …
“Common” is measured: kept by at least 6 in 10 of the 6 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
monitor-pr
Drives a pull request to green by streaming its state through the
Monitor tool and reacting the moment a check fails or a new review
comment lands. Designed for CodeRabbit-reviewed PRs but works for human
reviewers too.
Architecture: use the Monitor tool, not a sleep loop
This is load-bearing — do not substitute a Bash sleep loop. A loop
in a single Bash call blocks the agent until it exits, so the agent
can't react to events concurrently and misses interleaved work.
Monitor streams each stdout line as a notification into the
conversation, so the agent keeps full agency between events.
Start exactly one monitor at the top of the task with:
persistent: true— PR reviews can take hours; don't let a timeout kill the watch mid-review.description— specific, e.g."PR #493 state changes", because it appears in every notification.- The polling script below as
command.
Stop the monitor with TaskStop only when the exit condition is met or
the user cancels.
The polling script
Resolve PR metadata first (once, before starting the monitor):
gh pr view --json number,url,headRepository,headRepositoryOwner,baseRepositoryThen start the Monitor with this command (substitute PR, OWNER,
REPO). It emits one line only when state changes — a quiet PR
produces zero events, an eventful PR produces one event per transition.
PR=<number>; OWNER=<owner>; REPO=<repo>
last=""
while true; do
checks=$(gh pr checks "$PR" --json bucket 2>/dev/null || echo '[]')
failing=$(jq '[.[] | select(.bucket=="fail" or .bucket=="cancel")] | length' <<<"$checks")
pending=$(jq '[.[] | select(.bucket=="pending")] | length' <<<"$checks")
unresolved=$(gh api graphql --paginate -f query='
query($o:String!,$r:String!,$n:Int!,$endCursor:String){
repository(owner:$o,name:$r){
pullRequest(number:$n){
reviewThreads(first:100, after:$endCursor){
nodes{ isResolved }
pageInfo{ hasNextPage endCursor }
}
}
}
}' -f o="$OWNER" -f r="$REPO" -F n="$PR" 2>/dev/null \
| jq -s '[.[].data.repository.pullRequest.reviewThreads.nodes[]
| select(.isResolved==false)] | length')
state="fail=${failing:-?} pending=${pending:-?} unresolved=${unresolved:-?}"
if [ "$state" != "$last" ]; then
if [ "$failing" = "0" ] && [ "$pending" = "0" ] && [ "$unresolved" = "0" ]; then
echo "clean: all checks pass, none pending, zero unresolved threads"
else
echo "change: $state — triage needed"
fi
last="$state"
fi
sleep 60 || exit 0
doneMonitor discipline:
- 60s poll floor. Don't drop below; you'll rate-limit yourself against the GitHub API and waste tokens on noise.
- Only state transitions emit. Stable state is silent.
- Transient failures are tolerated (
2>/dev/nullon bothghcalls,|| echo '[]'ongh pr checks) so a single API blip yields a degraded poll instead of killing the watch. The${var:-?}fallbacks in the state string ensure partial results still produce an event rather than a blank state. - One line per event keeps notifications terse — Monitor turns every stdout line into a chat notification.
Reacting to a change: event
When the monitor emits change: fail=N pending=P unresolved=M, do the
following. Keep the monitor running the whole time.
1. Failing checks
gh pr checks <pr>
gh run view --log-failed <run-id>Fix the root cause in code. Never bypass with --no-verify, flaky-retry
loops, or skip directives.
2. Fetch every review thread with resolution + outdated state
REST doesn't expose isResolved/isOutdated. Use GraphQL, and
paginate via --paginate + an $endCursor variable so PRs with >100
threads don't silently truncate:
gh api graphql --paginate -f query='
query($owner:String!, $repo:String!, $number:Int!, $endCursor:String) {
repository(owner:$owner, name:$repo) {
pullRequest(number:$number) {
reviewThreads(first:100, after:$endCursor) {
nodes {
id
isResolved
isOutdated
path
line
originalLine
comments(first:50) {
nodes { databaseId author { login } body createdAt }
}
}
pageInfo { hasNextPage endCursor }
}
}
}
}' -f owner=<owner> -f repo=<repo> -F number=<pr>gh --paginate walks pageInfo.endCursor until hasNextPage: false and
emits one JSON document per page to stdout. When consuming, slurp with
jq -s and iterate across pages (e.g. jq -s '[.[].data.repository.pullRequest.reviewThreads.nodes[]] | ...').
3. Triage each unresolved thread
Judge each one individually. Do not blanket-skip any category.
- Human comment — address it.
- CodeRabbit actionable — address it.
- CodeRabbit nitpick — DO NOT auto-dismiss. CodeRabbit is often
overly polite and hides real issues under "nitpick". Read each one and
decide: is this a legit correctness/clarity/safety concern, or purely
stylistic noise that conflicts with repo conventions? Only skip if the
suggestion is actively wrong, contradicts
CLAUDE.md, or is irrelevant to the change's intent. When in doubt, apply the fix. - Thread marked
isOutdated: true— DO NOT skip. "Outdated" means the line numbers moved since the comment was written, not that the feedback is obsolete. Re-read the comment against the current code at that region and decide whether the concern still applies. Usually it does.
4. Fix in code
Actually edit source. Never reply-without-fix. If a comment implies a design decision the user should own, stop your own work and ask — but leave the monitor running. It's silent while state is stable, costs nothing, and will resume emitting as soon as the discussion ends in a push or a resolve.
5. Commit + push
Skip this step when the round changed no code, for example when you declined every thread.
Bundle the round into one commit following repo style (CLAUDE.md:
one-line type(scope): summary, ≤72 chars).
This repo's CLAUDE.md says: "Always confirm with human before doing
a git commit or a git push." Honor that unless the user has explicitly
told you to run autonomously.
Do not stop the monitor after pushing. A new push triggers new CI runs and may draw new CodeRabbit follow-ups; the monitor will fire again when they land, and the loop continues naturally.
Greptile will not follow up on its own. This repo's greptile.json
sets triggerOnUpdates: false, so Greptile reads the PR when it opens and
then not again until someone asks. CodeRabbit still re-reviews every push;
Greptile does not. That is what step 7 is for.
6. Reply + resolve each addressed thread
Reply after the push, so <sha> is the commit that holds the fix. A
Not changed: <reason>. reply names no commit: post it as soon as you
decide.
# Reply (the in_reply_to form of the review comments API). The && keeps the
# thread open if the reply fails.
gh api repos/<owner>/<repo>/pulls/<pr>/comments/<comment-databaseId>/replies \
-f body="Fixed in <sha>." &&
# Resolve
gh api graphql -f query='
mutation($threadId:ID!) {
resolveReviewThread(input:{threadId:$threadId}) {
thread { isResolved }
}
}' -f threadId=<thread-node-id>For threads you intentionally skipped (e.g., a nitpick that's wrong),
reply Not changed: <reason>. in one sentence, then still resolve the thread.
7. Re-trigger Greptile on the final state
Once every thread is addressed and CI is green — i.e. right before you would exit — ask Greptile to read the merged-ready state:
gh pr comment <n> --body "@greptileai"(The same thing is available as the "Re-trigger Greptile" button in Greptile's own comment footer.)
Then wait for the new review and triage whatever it returns exactly like any other round: fix, push, reply, resolve, re-trigger. A PR should be merged on a Greptile review of the code that is actually merging, not of the first draft of it.
Skip this only when Greptile never reviewed the PR at all (it is not
installed on the repo, or the PR carries the no-greptile label).
Exit
When the monitor emits clean: ...:
- Run step 7 if you have not already — re-trigger Greptile and let the final-state review land. If it opens new threads, you are not clean; go back to step 3.
TaskStopthe monitor.- Report a summary: what was fixed, what was intentionally skipped and why (one bullet per skipped thread), final check + thread counts, and whether the final Greptile re-trigger came back clean.
Guardrails
- Always use
Monitor. Notsleepin a Bash call, not manual repeated polling. Monitor streams events so the agent reacts immediately and runs concurrently with other work. - Never skip outdated comments blindly.
isOutdated= line moved. - Never blanket-dismiss CodeRabbit nitpicks. Judge each on merit.
- Never bypass failing checks with
--no-verifyor similar. - Never merge on a stale Greptile read. Greptile does not re-review on push here; re-trigger it at the final state (step 7).
- Confirm before
git pushunless running autonomously. - Pause and ask if a comment implies a design decision the user should own, rather than guessing — but keep the monitor running during the discussion. It's silent while state is stable.
- One-line commit messages, detail in the PR body.
Related
CLAUDE.md— repo commit/PR conventions, CodeRabbit reply protocol.greptile.json— repo review config;triggerOnUpdates: falseis why step 7 exists.CONTRIBUTING.mdexplains it for humans.Monitortool — session-length,persistent: true, one stdout line = one event, stop withTaskStop.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

