pr-watch
Use this skill when you need local, agent-friendly visibility into GitHub pull request conversation, review, and CI activity.
Core rules
- Do not ask the user which GitHub webhook events to subscribe to.
pr-watchmanages the required event set internally. - Treat watched orgs and repos as configuration. Add or remove explicit targets instead of assuming defaults.
- Prefer machine-friendly commands:
wait,events,status,list, andlist-targets. - Keep the last seen
seqcursor and reuse it with--since-cursorso you only fetch deltas. - Use
pr-watchif it is installed onPATH. Inside the source repo, usecargo run --as the fallback.
Preflight
Start with:
pr-watch doctor
Use doctor when setup is uncertain. It reports:
- whether
ghis installed - whether the
cli/gh-webhookextension is available - whether GitHub auth is present
- whether org forwarding may require
admin:org_hook
Do not install extensions or change auth automatically unless the user explicitly asks.
Standard workflow
- Start the daemon in a persistent shell session:
pr-watch daemon
- Add the required targets:
pr-watch add-target org ORG
pr-watch add-target repo OWNER/REPO
- Confirm daemon and forwarder state:
pr-watch status
pr-watch list
pr-watch list-targets
- Wait for PR activity:
pr-watch wait OWNER/REPO PR_NUMBER --since-cursor LAST_SEQ --timeout 300
- Fetch the full delta after wake-up:
pr-watch events OWNER/REPO PR_NUMBER --since-cursor LAST_SEQ
- Persist the highest returned
seqand reuse it on the nextwaitoreventscall.
Single-shot pattern
When the task is "wait for PR activity, then inspect the delta", use this procedure directly from the skill:
- Check daemon health with
pr-watch status. - If the daemon is unavailable, run
pr-watch doctorand report the blocker clearly. - Inspect
pr-watch list-targets. - If neither a matching repo target nor a covering org target exists, add
pr-watch add-target repo OWNER/REPO. - Run:
pr-watch wait OWNER/REPO PR_NUMBER --timeout 300 [--since-cursor CURSOR]
- If
waitsucceeds and returns an event withseq = N: UseCURSORif one was provided. Otherwise fetch the delta withpr-watch events OWNER/REPO PR_NUMBER --since-cursor N-1. - Return a concise machine-friendly result that includes:
statusrepopr_numbersince_cursornext_cursorwait_eventevents
Fallback in the source repo:
cargo run -- doctor
cargo run -- status
cargo run -- list-targets
cargo run -- add-target repo OWNER/REPO
cargo run -- wait OWNER/REPO PR_NUMBER --timeout 300 [--since-cursor CURSOR]
cargo run -- events OWNER/REPO PR_NUMBER [--since-cursor CURSOR]
Operating notes
- Run
daemonin its own long-lived terminal session. Use separate short-lived commands forwait,events, and target management. - If
statusorlistshows the daemon is unavailable, start it instead of retrying control commands blindly. - If
add-targetfails with GitHub404, assume missing webhook or admin access on that org or repo until proven otherwise. waitexits0when it receives a new matching event.waitexits2on timeout. Treat that as "no new event yet," not a hard failure.eventsreturns normalized event history for the PR and ignores unrelated non-PR events.
Limitations
- Forwarding is only org-scoped or repo-scoped because
gh webhook forwardworks that way. - Org forwarding may require
admin:org_hook. check_runandworkflow_runassociation is only as good as the PR linkage GitHub includes in the webhook payload.- For detailed live CI observation on a single PR,
gh run watchorgh pr checks --watchcan still be useful alongsidepr-watch.
Cleanup
pr-watch stop-forwarder ID
pr-watch remove-target org ORG
pr-watch remove-target repo OWNER/REPO
pr-watch stop