Skip to content
Back to skills

Watch Pr

ASecurity

Wait, at zero token cost, until a GitHub PR gets a new push, is merged/closed, is marked ready for review or back to draft, changes review decision, or (with --comments) gets a new comment from someone else, conflicts with its base, or fails CI, or with --ci finishes CI passing or failing, then wake and act on it. Use on every PR you open (with --comments), and when waiting on someone to update a PR you've reviewed or are watching.

  • 12 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added September 30, 2026
ai-agentsgoshellbashgit

Works with

  • claude code
  • cursor

Security analysis

A100/100

Scanned November 20, 2026

npx -y skills add petergaultney/lemonaid --skill watch-pr --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Watch Pr?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Watch Pr
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/petergaultney-watch-pr/badge)](https://www.skillsdirectory.com/skills/petergaultney-watch-pr)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: watch-pr
description: Wait, at zero token cost, until a GitHub PR gets a new push, is merged/closed, is marked ready for review or back to draft, changes review decision, or (with --comments) gets a new comment from someone else, conflicts with its base, or fails CI, or with --ci finishes CI passing or failing, then wake and act on it. Use on every PR you open (with --comments), and when waiting on someone to update a PR you've reviewed or are watching.
---

# Watch a PR for pushes, state changes, review comments, and CI

## With an attached brief

Prefer `lemonaid watch --self` for all subscriptions together; the `brief` skill's "Declare subscriptions and watch them" table lists what it watches and how to subscribe. Read current state first.

The standalone commands below remain available.

## Arguments

A PR number or URL. If omitted, infer it from the current branch (`gh pr view --json number`).

- `--comments --me "<your signature>"`: also wake on new comments from anyone but you, and, as the PR's author, when it starts conflicting with its base or its CI fails. Use it on every PR you open (`--role author` implies it). `<your signature>` is the one you sign Relay Comments with, e.g. `MotorHoe (Author)`.
- `--ci`: also wake when CI finishes on the current head, passing or failing. Combines with `--comments`; it does not require `--comments`. An author doesn't need it: mark your PR ready once your reviewer clears it, without waiting for CI, and a failure wakes you through `--comments`.
- `--role author|reviewer|parent|mention`: wake only for the events that role needs. Under `lemonaid watch --self` the role is worked out from your brief; `watch --self --status` prints it.
- `--legacy <name>`: another signature whose comments count as yours, e.g. one you signed with before (repeatable).
- Without `--comments` or `--ci`: pushes, merge/close, draft/ready, and review decision only, e.g. when you reviewed someone else's PR. Conflicts and CI are the author's to fix, so a reviewer isn't woken for them.

A comment counts when it is in any review thread, including outdated and resolved threads, a submitted review's body, or the PR conversation. Lemons usually post with their human's GitHub account, so sign everything you post right after the marker: `🍋 MotorHoe (Author): ...`. A comment is skipped as yours only when it starts with 🍋, then your `--me` or a `--legacy` signature, then a colon. Every other comment wakes you, including other lemons' 🍋 comments, signed or not. Bots and pending (unsubmitted) review comments never count. Comments already reported to `--me` are remembered, so a rearm doesn't wake you on one you handled.

For quieter waits, use `--skip-outdated` and/or `--skip-resolved`, or set `skip_outdated = true` and/or `skip_resolved = true` under `[watch.pr]` in the lemonaid config. Both default to false. `--no-skip-outdated` and `--no-skip-resolved` override configured filters for one wait. These filters apply only to review threads.

## Watching in your brief

With an attached brief, the watch command automatically records its restartable command under the final `## Watching` after startup checks pass. The command keeps the supplied arguments without injecting defaults or temporary state paths. Rearming updates the same entry, including the head and flags; you do not need a separate `brief waiter add` or `set`. Confirm it is running with `--status`: a saved command can remain while a one-shot waiter has exited.

Keep the entry across one-shot events while you handle them and rearm. When the watch ends permanently, remove it with `lemonaid brief waiter rm --self "<unique command substring>"`. Without an attached brief, the command watches normally without recording. Recording uses the attached brief of the lemon the waiter wakes.

## Choosing where to test

Use local tests during active development when their feedback helps you make the next change. After a small tweak whose behavior you understand, you may choose to push and let CI validate it instead of running the suite locally and then waiting for the same checks again. Use your judgment about the change and the CI coverage.

With `--comments`, a CI failure wakes the author: clear a `merge` status, fix it, and push. When CI the waiter saw running or failed then passes on a PR out of draft, it wakes the author once more to restore `merge`. Other passes wake nobody by default. The PR stays ready for review on GitHub, which shows the failure. Add `--ci` only when you must have a particular result, after checking `gh pr checks <number>` first, since a CI result that has already finished is never reported; keep it on each rearm until CI finishes on that head, then rearm without it.

CI completion waits for every check on the current head to finish. Every check counts, including checks that are not required for merging. No checks is not a completion. A completion is remembered once per head and watcher identity, so rearming with `--head` does not repeat it, even when switching between `--comments` and `--ci`.

## Waiting

A waiter reports only what changes after you start it, never what is already true. Before your first waiter on a PR, read its current state yourself (`gh pr view <number> --comments`, `gh pr checks <number>`). Later waiters remember what the last one reported, so a change made between waiters still wakes you.

Check for an existing waiter first: `lemonaid watch pr --status <number> [--me "<your signature>"]`, with the same `--me` as the waiter. If one is running, don't start another; a second one for the same PR and name refuses to start.

<!-- harness: claude -->
In Claude Code, start the waiter with `--once` as a background Bash task, then end your turn:

```
Bash(
  command: lemonaid watch pr --wait <number> --head <current head sha> --once [--comments --me "<your signature>"],
  description: "Wait for pushes / state / comments on PR #<number>",
  run_in_background: true,
  timeout: 2147483647,
)
```

It prints the first event and exits, and the task's completion wakes you. Handle the event, then rearm the same way with `--head` set to the head you just handled. (`--head` is optional: the waiter remembers the head it last reported, and with lemonaid's hooks installed your own pushes don't wake you.)
<!-- /harness -->

Never push with `-q` or `--quiet`, or with stderr sent to `/dev/null`. The hooks recognize your push from the `old..new branch -> branch` line `git push` prints, and a push that prints none would wake you. In Claude Code the hooks remove `-q`/`--quiet` before the push runs; otherwise they refuse it.

<!-- harness: claude -->
- Don't use `Monitor`: it expires after 30 minutes and wakes you for nothing.
- Don't run the waiter without `--once` in background Bash: its output goes to a file and never wakes you.
- Pass `timeout: 2147483647`. Claude Code stops a background task after 30 minutes by default, and after its `BASH_MAX_TIMEOUT_MS` ceiling otherwise. If the harness stops the waiter anyway, rearm it, whatever the notice says.
<!-- /harness -->

<!-- harness: codex -->
In Codex, check that `CODEX_THREAD_ID` is set and `codex queue --help` succeeds, then start `lemonaid watch pr --wait <number or PR URL> [--repo <owner/name> with a number] --head <current head sha> [--comments --me "<your signature>"] --codex-thread` (bare: it reads `CODEX_THREAD_ID` itself; never write `"$CODEX_THREAD_ID"`, which keeps the command from matching Codex's allow rule) as an `exec_command` session with escalated (unsandboxed) permissions, since `codex queue` must write `~/.codex`, and end the turn. The first event is queued into your thread and the waiter exits. When woken, handle it, then rearm with `--head` set to the head you just handled. Don't pipe the waiter into `codex queue` yourself.
<!-- /harness -->

The waiter makes one GraphQL call a minute, for the repo of the current directory (pass the PR's URL instead of its number, or `--repo owner/name`, if you are elsewhere). The last reported head, state, comments, draft flag, review decision, and blocked heads are remembered as your cursors, so a change made between one waiter's exit and the rearm, a push or merge included, is reported by the next one. Your very first waiter on a PR takes it as it is now as already seen. Never poll in a background shell, and never chain scheduled wakeups.

## When woken

- **Head moved:** record the old SHA from the event, then `git fetch origin && git log <old>..<new> --stat` and `gh pr diff <number>`. Report what changed. If you were watching for something specific, re-evaluate it against the new state. If you are on the PR's branch, `git pull --ff-only`; never switch branches to get there.
- **Ready for review:** someone wants it reviewed now. Keep `--comments` if it's yours, and rearm. Under `watch --self` this wakes nobody.
- **Conflicts with its base:** reported once per head, when GitHub says `CONFLICTING`. Rebase onto `origin/<base>` (if the base PR just merged, see the stacked-PR step below), run the tests, push with `--force-with-lease`, check that `gh pr view <n> --json mergeable` says `MERGEABLE`, tell your reviewer, and rearm.
- **CI passed, with a note to recheck:** CI the waiter last saw running or failed, on this head or an earlier one, has passed. Check `gh pr view <n> --json mergeable,reviewDecision,isDraft`; if your reviewer has cleared it and it is `MERGEABLE`, set your brief's Status back to `merge`. Rearm.
- **CI passed (`--ci`):** the current head has finished CI successfully. Continue the review or merge-readiness work, then rearm without `--ci`.
- **CI failed:** reported once per head, after every check on it has finished. Every check counts, including checks that are not required for merging. The notice lists each failed check with its job page and the errors it annotated, or, with none, the `gh run view --job <id> --log-failed` command that prints its failed log. Clear a `merge` status (the PR stays ready for review on GitHub), fix it and push, or rerun a flaky job (`gh run rerun <run-id> --failed`), tell your reviewer, and rearm.
- **Stacked PR, base merged:** GitHub retargets your PR to the base's own base. If that merge was a squash, your branch still carries the base's original commits and usually conflicts. Rebase only your own commits (`git rebase --onto origin/main <base's last commit> <your branch>`), run the tests, push with `--force-with-lease`, check it's `MERGEABLE`, and rearm.
- **Back in draft:** more work is wanted before review. Look for what in the PR's comments; if nothing says, ask in your final message. Rearm.
- **Review decision `APPROVED`:** report it and rearm. Don't merge unless you were told to.
- **Review decision `CHANGES_REQUESTED`:** the reviewer's comments arrive as their own event, or in the same line; handle those. If none are visible, read `gh pr view <n> --json reviews`.
- **Review decision `REVIEW_REQUIRED` or `none`:** an approval was dismissed (often by a push) or the requirement changed. Note it and rearm.
- **New comments:** the event names each comment's author and location. Make any fix that is clearly asked for. Reply in the comment's own thread, starting with `🍋 <your signature>:`, if you are allowed to post; otherwise draft the reply in your final message for your human to post. Then rearm.
- **Merged or closed:** nothing is left to watch, whether you wrote the PR or reviewed it. Stop the waiter with `lemonaid watch stop --self pr <number>`, never `pkill -f` the command, which stops every lemon's matching waiter, and end your turn with one line saying so.

## Watching a whole repo

A lead that should notice PRs it did not open, or that opens no PR itself, waits on the repo instead of one PR: `lemonaid watch repo --wait owner/name [--label NAME] [--exclude-author LOGIN] --once`. It reports a PR opened or marked ready for review, a watched label added, and a seen PR closed or merged. Put the command under `## Watching` and `lemonaid watch --self` delivers its events with the rest. See `docs/watch.md`.

## Notes

- One `gh` call per minute per watched PR. To watch many PRs, run one waiter per PR, or ask before starting dozens.
- `lemonaid watch pr --help` lists every flag. State and locks are your cursors, under `~/.local/state/lemonaid/cursors/<your Lemon-ID>/`; deleting them loses what changed since the last report and breaks duplicate detection for running waiters.

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.