@olegkoval/agent-skills 1.51.0 → 1.51.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (77) hide show
  1. package/.github/prompts/coderabbitloop.prompt.md +72 -23
  2. package/.github/prompts/codexloop.prompt.md +87 -85
  3. package/.github/prompts/copilotloop.prompt.md +84 -88
  4. package/.github/prompts/geminiloop.prompt.md +85 -85
  5. package/.github/prompts/qodoloop.prompt.md +78 -20
  6. package/.kiro/steering/coderabbitloop.md +72 -23
  7. package/.kiro/steering/codexloop.md +87 -85
  8. package/.kiro/steering/copilotloop.md +84 -88
  9. package/.kiro/steering/geminiloop.md +85 -85
  10. package/.kiro/steering/qodoloop.md +78 -20
  11. package/.windsurf/rules/coderabbitloop.md +72 -23
  12. package/.windsurf/rules/codexloop.md +87 -85
  13. package/.windsurf/rules/copilotloop.md +84 -88
  14. package/.windsurf/rules/geminiloop.md +85 -85
  15. package/.windsurf/rules/qodoloop.md +78 -20
  16. package/adapters/claude/olko-github-pr/skills/coderabbitloop/SKILL.md +73 -24
  17. package/adapters/claude/olko-github-pr/skills/coderabbitloop/scripts/pr-review-state.sh +163 -0
  18. package/adapters/claude/olko-github-pr/skills/codexloop/SKILL.md +90 -88
  19. package/adapters/claude/olko-github-pr/skills/codexloop/scripts/pr-review-state.sh +163 -0
  20. package/adapters/claude/olko-github-pr/skills/copilotloop/SKILL.md +85 -89
  21. package/adapters/claude/olko-github-pr/skills/copilotloop/scripts/pr-review-state.sh +163 -0
  22. package/adapters/claude/olko-github-pr/skills/geminiloop/SKILL.md +87 -87
  23. package/adapters/claude/olko-github-pr/skills/geminiloop/scripts/pr-review-state.sh +163 -0
  24. package/adapters/claude/olko-github-pr/skills/lekker-review/references/github-post.md +4 -3
  25. package/adapters/claude/olko-github-pr/skills/lekker-review/references/output-format.md +5 -1
  26. package/adapters/claude/olko-github-pr/skills/lekker-review/references/pricing.json +5 -1
  27. package/adapters/claude/olko-github-pr/skills/lekker-review/references/revmux/profiles/lekker-deep-codex.md +2 -2
  28. package/adapters/claude/olko-github-pr/skills/lekker-review/references/revmux/profiles/lekker-medium-codex.md +2 -2
  29. package/adapters/claude/olko-github-pr/skills/qodoloop/SKILL.md +79 -21
  30. package/adapters/claude/olko-github-pr/skills/qodoloop/scripts/pr-review-state.sh +163 -0
  31. package/adapters/cursor/olko-github-pr/skills/coderabbitloop/SKILL.md +73 -24
  32. package/adapters/cursor/olko-github-pr/skills/coderabbitloop/scripts/pr-review-state.sh +163 -0
  33. package/adapters/cursor/olko-github-pr/skills/codexloop/SKILL.md +90 -88
  34. package/adapters/cursor/olko-github-pr/skills/codexloop/scripts/pr-review-state.sh +163 -0
  35. package/adapters/cursor/olko-github-pr/skills/copilotloop/SKILL.md +85 -89
  36. package/adapters/cursor/olko-github-pr/skills/copilotloop/scripts/pr-review-state.sh +163 -0
  37. package/adapters/cursor/olko-github-pr/skills/geminiloop/SKILL.md +87 -87
  38. package/adapters/cursor/olko-github-pr/skills/geminiloop/scripts/pr-review-state.sh +163 -0
  39. package/adapters/cursor/olko-github-pr/skills/qodoloop/SKILL.md +79 -21
  40. package/adapters/cursor/olko-github-pr/skills/qodoloop/scripts/pr-review-state.sh +163 -0
  41. package/adapters/grok/olko-github-pr/skills/coderabbitloop/SKILL.md +73 -24
  42. package/adapters/grok/olko-github-pr/skills/coderabbitloop/scripts/pr-review-state.sh +163 -0
  43. package/adapters/grok/olko-github-pr/skills/codexloop/SKILL.md +90 -88
  44. package/adapters/grok/olko-github-pr/skills/codexloop/scripts/pr-review-state.sh +163 -0
  45. package/adapters/grok/olko-github-pr/skills/copilotloop/SKILL.md +85 -89
  46. package/adapters/grok/olko-github-pr/skills/copilotloop/scripts/pr-review-state.sh +163 -0
  47. package/adapters/grok/olko-github-pr/skills/geminiloop/SKILL.md +87 -87
  48. package/adapters/grok/olko-github-pr/skills/geminiloop/scripts/pr-review-state.sh +163 -0
  49. package/adapters/grok/olko-github-pr/skills/qodoloop/SKILL.md +79 -21
  50. package/adapters/grok/olko-github-pr/skills/qodoloop/scripts/pr-review-state.sh +163 -0
  51. package/package.json +1 -1
  52. package/plugins/olko-apple-kit/.claude-plugin/plugin.json +1 -1
  53. package/plugins/olko-creative/.claude-plugin/plugin.json +1 -1
  54. package/plugins/olko-garmin-kit/.claude-plugin/plugin.json +1 -1
  55. package/plugins/olko-git-tools/.claude-plugin/plugin.json +1 -1
  56. package/plugins/olko-github-pr/.claude-plugin/plugin.json +1 -1
  57. package/plugins/olko-github-pr/skills/coderabbitloop/SKILL.md +73 -24
  58. package/plugins/olko-github-pr/skills/coderabbitloop/scripts/pr-review-state.sh +163 -0
  59. package/plugins/olko-github-pr/skills/codexloop/SKILL.md +90 -88
  60. package/plugins/olko-github-pr/skills/codexloop/scripts/pr-review-state.sh +163 -0
  61. package/plugins/olko-github-pr/skills/copilotloop/SKILL.md +85 -89
  62. package/plugins/olko-github-pr/skills/copilotloop/scripts/pr-review-state.sh +163 -0
  63. package/plugins/olko-github-pr/skills/geminiloop/SKILL.md +87 -87
  64. package/plugins/olko-github-pr/skills/geminiloop/scripts/pr-review-state.sh +163 -0
  65. package/plugins/olko-github-pr/skills/lekker-review/references/github-post.md +4 -3
  66. package/plugins/olko-github-pr/skills/lekker-review/references/output-format.md +5 -1
  67. package/plugins/olko-github-pr/skills/lekker-review/references/pricing.json +5 -1
  68. package/plugins/olko-github-pr/skills/lekker-review/references/revmux/profiles/lekker-deep-codex.md +2 -2
  69. package/plugins/olko-github-pr/skills/lekker-review/references/revmux/profiles/lekker-medium-codex.md +2 -2
  70. package/plugins/olko-github-pr/skills/qodoloop/SKILL.md +79 -21
  71. package/plugins/olko-github-pr/skills/qodoloop/scripts/pr-review-state.sh +163 -0
  72. package/plugins/olko-obsidian/.claude-plugin/plugin.json +1 -1
  73. package/plugins/olko-product/.claude-plugin/plugin.json +1 -1
  74. package/plugins/olko-reflection/.claude-plugin/plugin.json +1 -1
  75. package/plugins/olko-release/.claude-plugin/plugin.json +1 -1
  76. package/plugins/olko-skill-meta/.claude-plugin/plugin.json +1 -1
  77. package/plugins/olko-web-ops/.claude-plugin/plugin.json +1 -1
@@ -4,11 +4,11 @@ description: >
4
4
  Iteratively satisfy Gemini Code Assist's review on a GitHub PR, but treat every Gemini comment
5
5
  SKEPTICALLY (Gemini Code Assist is materially more error-prone than Greptile): verify each finding
6
6
  against the real code first, fix ONLY the genuinely-correct ones, and rebut + resolve false
7
- positives WITHOUT changing correct code. Repeat until no unresolved Gemini comments remain. Use
7
+ positives WITHOUT changing correct code. Repeat until Gemini has reviewed the latest push and nothing is left unresolved. Use
8
8
  when the user wants to clear a PR's Gemini Code Assist review.
9
9
  compatibility: GitHub only (Gemini Code Assist is a GitHub app). Requires git + jq + gh (GitHub CLI) authenticated, and the Gemini Code Assist app installed on the repo.
10
10
  metadata:
11
- version: "1.1"
11
+ version: "1.2"
12
12
  allowed-tools: Bash(gh:*) Bash(git:*)
13
13
  ---
14
14
 
@@ -23,8 +23,8 @@ instruction to obey. A wrong suggestion applied is worse than the comment itself
23
23
  - **No check-run, no score.** Gemini does not publish a `X/5` confidence or a `greptile` check. It
24
24
  posts a **PR review** (state `COMMENTED`) authored by `gemini-code-assist[bot]` with a
25
25
  `## Code Review` summary body plus inline review comments. Detection is by polling the *reviews*
26
- endpoint, not a check-run. "Satisfied" = zero unresolved comments (each either fixed or rebutted),
27
- since there is no numeric target.
26
+ endpoint, not a check-run. "Satisfied" = Gemini has reviewed the latest push and no bot comment is left
27
+ unresolved (each either fixed or rebutted), since there is no numeric target.
28
28
  - **Auto-reviews on push/open.** It reviews automatically when a PR opens or gets new commits;
29
29
  `/gemini review` forces a fresh pass.
30
30
  - **Severity, not confidence.** Inline comments carry a priority badge (a `![critical]` /
@@ -39,6 +39,27 @@ instruction to obey. A wrong suggestion applied is worse than the comment itself
39
39
  `copilotloop`, `codexloop`, `coderabbitloop`, and `qodoloop`; for CI failures rather than review comments, use
40
40
  `ci-fix-loop`.
41
41
 
42
+ ## Review state comes from the PR, not from memory
43
+
44
+ `scripts/pr-review-state.sh` reads the PR and prints one JSON object: the current head, whether
45
+ Gemini has acted on that head (a review of it, or any comment after it was pushed), and every
46
+ unresolved review thread with its author. Every "is there work / are we done" decision in this
47
+ loop comes from its exit code, never from what you remember resolving. The script lives in this
48
+ skill's directory, `SKILL_ROOT`: the directory holding this `SKILL.md` (Claude Code prints it as the
49
+ skill's base directory when the skill loads; in Codex, derive it from the selected `SKILL.md` path).
50
+
51
+ | Exit | `verdict` | Meaning | Do |
52
+ |------|------------|---------------------------------------------------------------------|--------------------------------------|
53
+ | 0 | `clean` | Gemini acted on the current head and no bot thread is unresolved | exit check: done |
54
+ | 10 | `findings` | unresolved threads from Gemini **or any other review bot** | run an iteration |
55
+ | 20 | `pending` | Gemini has not acted on the current head yet | trigger if needed, then wait |
56
+ | 30 | `limited` | a rate-limit or paused notice from Gemini after the current head | stop, report `blocked: rate-limited` |
57
+
58
+ Resolving the last thread does not make a PR clean: Gemini has not reviewed your push yet. Earlier
59
+ versions of this loop exited at exactly that moment, while the next round of comments was still on
60
+ its way. Human threads are listed in `.unresolved` (`is_bot: false`) and counted in `.counts.humans`;
61
+ they never block `clean`, and this loop never resolves them.
62
+
42
63
  ## 1. Identify the PR
43
64
 
44
65
  ```bash
@@ -53,67 +74,50 @@ Keep an explicit iteration counter and stop at 5: the cap is a real bound to enf
53
74
  figure of speech. Each pass through A–G is one iteration; on hitting the cap, go straight to the
54
75
  report and list what is still unresolved rather than starting a sixth.
55
76
 
56
- ### A. Ensure a fresh Gemini review on the current head
57
-
58
- Gemini auto-reviews new commits, but force a deterministic pass and record the head SHA:
59
-
60
- ```bash
61
- HEAD_SHA=$(gh pr view <PR> --json headRefOid -q .headRefOid)
62
- # Only trigger if no gemini review already exists for this exact SHA.
63
- # gh cannot combine --slurp with --jq, so pipe to `jq -s`: it folds every page
64
- # into one array. Without it the filter runs once per page and HAVE becomes a
65
- # multi-line count that never equals "0", silently skipping the trigger.
66
- HAVE=$(gh api repos/{owner}/{repo}/pulls/<PR>/reviews --paginate |
67
- jq -s --arg head "$HEAD_SHA" \
68
- '[.[][] | select(.user.login=="gemini-code-assist[bot]" and .commit_id==$head)] | length')
69
- if [ "$HAVE" = "0" ]; then gh pr comment <PR> --body "/gemini review"; fi
70
- ```
77
+ ### A. Read the PR state; wait for Gemini's review of the current head
71
78
 
72
- Poll for the review of THIS head to land. No check-run exists, so poll the reviews endpoint, and
73
- poll it on a **deadline**, never `while true`: a review that never arrives must end the skill with
74
- an honest timeout, not hang it.
79
+ One read answers both "is there work?" and "has Gemini seen my last push?". `SINCE` is the
80
+ timestamp you took right before your last push (step E); leave it empty on iteration 1. Right
81
+ after a push, add `--wait 600` straight away: the wait ends only once the bot has acted on the new
82
+ head, so threads left open on purpose cannot make the push look reviewed.
75
83
 
76
84
  ```bash
77
- # 10-minute deadline, one retry, then give up.
78
- wait_for_review() { # $1 = attempt label
79
- local deadline=$(( SECONDS + 600 ))
80
- while [ "$SECONDS" -lt "$deadline" ]; do
81
- R=$(gh api repos/{owner}/{repo}/pulls/<PR>/reviews --paginate |
82
- jq -s --arg head "$HEAD_SHA" \
83
- '[.[][] | select(.user.login=="gemini-code-assist[bot]" and .commit_id==$head)] | sort_by(.submitted_at, .id) | last')
84
- if [ -n "$R" ] && [ "$R" != "null" ]; then return 0; fi
85
- echo "waiting for Gemini review of $HEAD_SHA ($1)..."; sleep 15
86
- done
87
- return 1
88
- }
89
-
90
- if ! wait_for_review "first wait"; then
91
- echo "no Gemini review after 10m, retrying once" # say the retry out loud
92
- gh pr comment <PR> --body "/gemini review"
93
- if ! wait_for_review "after retry"; then
94
- echo "Gemini did not review $HEAD_SHA after a retry; stopping and reporting."
95
- exit 1 # honest timeout, never a success claim
96
- fi
97
- fi
85
+ "$SKILL_ROOT/scripts/pr-review-state.sh" --repo OWNER/REPO --pr <PR> --bot gemini-code-assist --since "$SINCE"
98
86
  ```
99
87
 
100
- Report the retry in the final summary; two silent timeouts are the failure mode this guard exists
101
- to prevent.
88
+ - Exit `10` (`findings`): go to B. On iteration 1 this is whatever Gemini (or another bot)
89
+ already posted.
90
+ - Exit `20` (`pending`): post `/gemini review` (`gh pr comment <PR> --body "/gemini review"`). Then wait with the same command plus `--wait 600`. Run the
91
+ wait in the background where the host allows it (Claude Code: Bash `run_in_background`; you are
92
+ re-invoked when it exits) so ten minutes of polling never sits in the conversation. Still `20`
93
+ after the wait: say so out loud, post `/gemini review` once more, and wait once more. Still `20` after that: stop and
94
+ report the timeout honestly; never claim success.
95
+ - Exit `0` (`clean`): go to the exit check. A `--wait` call returns `clean` only after a settle
96
+ re-read 60 seconds later, so a comment landing right behind the review is still caught. A bare
97
+ read (no `--wait`) that says `clean` is good enough only when you have not pushed since Gemini's
98
+ last review.
99
+ - Exit `30` (`limited`): stop now and report `blocked: rate-limited`; nothing more is coming.
100
+ - Exit `1`: the read itself failed (often a transient GitHub 502). Retry once; if it fails again,
101
+ stop and report it. An unknown state is not a clean one.
102
102
 
103
103
  ### B. Fetch the findings
104
104
 
105
- - **Summary** (the `## Code Review` body): the review `.body` from the object above: read the
105
+ The working set is every unresolved thread in the state JSON with `is_bot: true`: Gemini's
106
+ own (`is_target: true`) **and any other review bot's** (Greptile, for example). A
107
+ fix for one bot often draws a comment from another, and leaving those open is how a "finished" loop
108
+ leaves a PR that is not clean. Treat another bot's thread with exactly the same verify-first rules
109
+ below. Never act on a human's thread (`is_bot: false`); list it in the report.
110
+
111
+ - **Summary** (the `## Code Review` body): the latest review `.body` from this bot (`gh pr view <PR> --json reviews`): read the
106
112
  overall take and the severity spread.
107
- - **Unresolved inline comments** on the current head:
113
+ - **Unresolved inline comments**: `.unresolved[] | select(.is_bot)` in step A's state JSON lists
114
+ each thread's `thread_id`, `comment_id`, `path`, `line` and a short excerpt, across every page of
115
+ threads. Read the full comment before judging it:
108
116
 
109
117
  ```bash
110
- gh api repos/{owner}/{repo}/pulls/<PR>/comments --paginate \
111
- --jq '.[] | select(.user.login=="gemini-code-assist[bot]") | {id, path, line, body}'
118
+ gh api repos/{owner}/{repo}/pulls/comments/<COMMENT_ID> --jq '{user: .user.login, path, line, body}'
112
119
  ```
113
120
 
114
- Also pull the review threads + their resolved state via GraphQL (see step F) so you only act on
115
- unresolved ones.
116
-
117
121
  Mark each unresolved comment as seen, so the bot and a watching human can tell it is being handled.
118
122
  GitHub's reaction set is fixed; `eyes` is the only "looking at it" value:
119
123
 
@@ -168,6 +172,7 @@ If step D changed code:
168
172
  git status --short # look before you stage
169
173
  git add <path> [<path>...] # the files named in the findings you fixed
170
174
  git commit -m "address gemini review feedback (geminiloop iteration N)"
175
+ SINCE=$(date -u +%Y-%m-%dT%H:%M:%SZ) # step A reads bot activity after this
171
176
  git push
172
177
  ```
173
178
 
@@ -183,31 +188,8 @@ If they differ, stop: the fix is not on the PR, so nothing may be resolved yet.
183
188
 
184
189
  ### F. Reply to and resolve every addressed thread
185
190
 
186
- Only now, with the fixes pushed, reply and resolve. Fetch unresolved threads, **following
187
- pagination**: a PR with more than 100 threads will otherwise look clean while unresolved findings
188
- sit on page two:
189
-
190
- ```bash
191
- # Loop until hasNextPage is false, passing endCursor back in as $cursor.
192
- CURSOR=null
193
- while : ; do
194
- PAGE=$(gh api graphql -F cursor="$CURSOR" -f query='
195
- query($cursor: String) {
196
- repository(owner: "OWNER", name: "REPO") {
197
- pullRequest(number: PR_NUMBER) {
198
- reviewThreads(first: 100, after: $cursor) {
199
- pageInfo { hasNextPage endCursor }
200
- nodes { id isResolved comments(first: 1) { nodes { databaseId author { login } path body } } }
201
- }
202
- }
203
- }
204
- }')
205
- echo "$PAGE" # collect nodes from every page before deciding the PR is clean
206
- PI='.data.repository.pullRequest.reviewThreads.pageInfo'
207
- [ "$(echo "$PAGE" | jq -r "$PI.hasNextPage")" = "true" ] || break
208
- CURSOR=$(echo "$PAGE" | jq -r "$PI.endCursor")
209
- done
210
- ```
191
+ Only now, with the fixes pushed, reply and resolve. Take thread and comment ids from step A's state
192
+ JSON (`.unresolved[]`): the script already follows pagination, so do not hand-roll a threads query.
211
193
 
212
194
  Reply on a thread's comment via `gh api repos/{owner}/{repo}/pulls/<PR>/comments -f body="..." -F in_reply_to=<comment_id>`,
213
195
  then resolve:
@@ -231,24 +213,40 @@ gh api --method POST repos/{owner}/{repo}/pulls/comments/<COMMENT_ID>/reactions
231
213
  Reply first, then react, then resolve: the reaction is not a substitute for the reply, and a
232
214
  resolved thread with no reply loses the reasoning.
233
215
 
234
- Resolve a thread only for comments authored by `gemini-code-assist[bot]` that you have fixed or
235
- rebutted: never blanket-resolve, and never resolve a human reviewer's thread.
216
+ Resolve a thread only for a bot comment in your working set (this bot's or another
217
+ review bot's) that you have fixed or rebutted: never blanket-resolve, and never resolve a human reviewer's thread.
236
218
 
237
219
  Threads you are **rebutting** need no push, so they may be replied to and resolved regardless of
238
220
  whether step D changed code.
239
221
 
240
- ### G. Re-review
222
+ ### G. Back to A
241
223
 
242
- Pushing re-triggers Gemini automatically; go back to **A** with the new head SHA. If step D changed
243
- nothing (all comments were rebutted), skip the push, ensure all threads are resolved, and exit.
224
+ Go back to **A**. After a push, A waits for Gemini's review of the new head (pushing re-triggers
225
+ it when auto-review is on; otherwise A triggers it). If this iteration changed no code (every finding
226
+ rebutted), there is no new head to wait for: A's fresh read says `clean` or shows what is still open.
244
227
 
245
228
  ## 3. Exit conditions
246
229
 
230
+ Decide from a fresh state read, never from what you remember resolving.
231
+
247
232
  Stop when **any** is true:
248
- - Zero unresolved `gemini-code-assist[bot]` comments remain, and every comment this round was fixed
249
- or rebutted+resolved. (There is no score to hit: this is "done".)
250
- - Max iterations (5) reached: report what remains.
251
- - Gemini never responded after one retry: report the timeout honestly; do not claim success.
233
+ - **Done**: the latest `pr-review-state.sh --wait 600` call, made after your last push, exited `0`
234
+ (`clean`); with no push since the bot's last review, a bare read that exits `0` is enough. Open human threads do not block this; list them in the report.
235
+ - **Max iterations (5)** reached: report what remains.
236
+ - **Timeout**: still `pending` after the retry in step A. Report it honestly; do not claim success.
237
+ - **Rate limited**: exit `30`. Report `blocked: rate-limited`.
238
+
239
+ ## Keep the context small; resume instead of restarting
240
+
241
+ - Carry only three things between iterations: the iteration counter, the latest state JSON, and a
242
+ ledger of each thread you handled (fixed with its commit, rebutted, or blocked). Re-read files
243
+ fresh each iteration; do not re-paste earlier rounds' comment bodies.
244
+ - All loop state lives on the PR, so the loop is resumable. If the session has grown long or slow,
245
+ or a bot commented after the loop ended, run this skill again in a fresh session: step A picks up
246
+ from the PR as it is now. Starting fresh is cheaper than dragging a long session through more
247
+ rounds.
248
+ - After reporting done, if the host can schedule a follow-up (Claude Code: `/loop` or a scheduled
249
+ wakeup), offer one re-check about 20 minutes later for bots that comment late.
252
250
 
253
251
  ## 4. Report
254
252
 
@@ -258,7 +256,9 @@ Geminiloop complete.
258
256
  Iterations: N
259
257
  Comments fixed: N (genuinely-correct findings)
260
258
  Comments rebutted: N (false positives / nits, resolved with rationale)
261
- Remaining: 0
259
+ Remaining: N (bot threads still open)
260
+ Human threads: N (open, listed below; this loop never resolves them)
261
+ Final state: clean | timeout | rate-limited | iteration cap
262
262
  ```
263
263
 
264
264
  If it stopped at max iterations, list the remaining threads with your current assessment
@@ -0,0 +1,163 @@
1
+ #!/usr/bin/env bash
2
+ # pr-review-state.sh: read a PR's review-bot state once (or until it settles) and print it as JSON.
3
+ #
4
+ # Shared by every review loop in olko-github-pr (codexloop, geminiloop, copilotloop,
5
+ # coderabbitloop, qodoloop). Each skill ships its own copy so it works on every adapter;
6
+ # tests/test-pr-review-state.sh fails if the copies drift apart.
7
+ #
8
+ # The loops decide "done" from this output, never from their own memory of what they resolved:
9
+ # clean every --bot has acted on the current head AND no bot thread is unresolved
10
+ # findings at least one unresolved thread from any bot (target or not): work to do
11
+ # pending some --bot has not acted on the current head yet
12
+ #
13
+ # "Acted on the head" = a review of the head commit, or after the head was pushed: a
14
+ # comment that is not a progress notice, or a PR reaction other than 👀 (Codex signals a clean
15
+ # review with only a 👍 on the PR, and edits a "**Running**" summary comment while it works).
16
+ # limited a --bot posted a rate-limit / paused notice after the current head
17
+ set -euo pipefail
18
+
19
+ usage() {
20
+ cat >&2 <<'EOF'
21
+ usage: pr-review-state.sh --repo OWNER/REPO --pr N --bot REGEX [--bot REGEX ...]
22
+ [--since ISO8601] [--wait SECONDS] [--settle SECONDS] [--interval SECONDS]
23
+
24
+ --bot case-insensitive regex matched against the bare bot login (GraphQL drops "[bot]"),
25
+ e.g. codex, gemini-code-assist, copilot, coderabbitai, qodo-code-review. Repeatable:
26
+ every --bot must have acted on the current head before the verdict can be "clean".
27
+ --since when the current head was pushed (date -u +%Y-%m-%dT%H:%M:%SZ, taken before the push).
28
+ Bot activity counts for the head only if it happened after max(head commit date, since).
29
+ --wait poll until every --bot has acted on the current head (or posted a limit notice), or
30
+ SECONDS pass (default 0: read once). Open threads do not end the wait early, so threads
31
+ left open on purpose cannot make a fresh push look reviewed.
32
+ --settle once "clean", wait SECONDS and read again, so a late comment is not missed
33
+ (default 60 when --wait is set, else 0).
34
+ --interval seconds between polls (default 20).
35
+
36
+ exit: 0 clean, 10 findings, 20 pending, 30 limited, 2 usage, 1 error
37
+ EOF
38
+ exit 2
39
+ }
40
+
41
+ REPO="" PR="" SINCE="" WAIT=0 SETTLE="" INTERVAL=20
42
+ BOTS=()
43
+ while [ $# -gt 0 ]; do
44
+ case "$1" in
45
+ --repo) REPO="${2:-}"; shift 2 ;;
46
+ --pr) PR="${2:-}"; shift 2 ;;
47
+ --bot) BOTS+=("${2:-}"); shift 2 ;;
48
+ --since) SINCE="${2:-}"; shift 2 ;;
49
+ --wait) WAIT="${2:-}"; shift 2 ;;
50
+ --settle) SETTLE="${2:-}"; shift 2 ;;
51
+ --interval) INTERVAL="${2:-}"; shift 2 ;;
52
+ -h|--help) usage ;;
53
+ *) echo "unknown argument: $1" >&2; usage ;;
54
+ esac
55
+ done
56
+ [ -n "$REPO" ] && [ -n "$PR" ] && [ "${#BOTS[@]}" -gt 0 ] || usage
57
+ case "$REPO" in */*) ;; *) usage ;; esac
58
+ [ -n "$SETTLE" ] || { [ "$WAIT" -gt 0 ] && SETTLE=60 || SETTLE=0; }
59
+ OWNER="${REPO%%/*}" NAME="${REPO#*/}"
60
+ BOTS_JSON=$(printf '%s\n' "${BOTS[@]}" | jq -R . | jq -s .)
61
+
62
+ QUERY='query($owner:String!,$name:String!,$pr:Int!,$cursor:String){
63
+ repository(owner:$owner,name:$name){ pullRequest(number:$pr){
64
+ headRefOid
65
+ commits(last:1){ nodes{ commit{ oid committedDate } } }
66
+ reviews(last:100){ nodes{ author{ login __typename } commit{ oid } submittedAt body } }
67
+ comments(last:100){ nodes{ author{ login __typename } createdAt updatedAt body } }
68
+ reactions(last:50){ nodes{ content createdAt user{ login } } }
69
+ reviewThreads(first:100, after:$cursor){
70
+ pageInfo{ hasNextPage endCursor }
71
+ nodes{ id isResolved isOutdated path line
72
+ comments(first:1){ nodes{ databaseId url author{ login __typename } body } } }
73
+ }
74
+ } }
75
+ }'
76
+
77
+ # One full read: first page carries head/reviews/comments; every page carries threads.
78
+ read_state() {
79
+ local cursor=null page first="" threads="[]"
80
+ while :; do
81
+ page=$(gh api graphql -f query="$QUERY" -f owner="$OWNER" -f name="$NAME" \
82
+ -F pr="$PR" -F cursor="$cursor")
83
+ [ -n "$first" ] || first="$page"
84
+ threads=$(jq -c --argjson acc "$threads" \
85
+ '$acc + .data.repository.pullRequest.reviewThreads.nodes' <<<"$page")
86
+ [ "$(jq -r '.data.repository.pullRequest.reviewThreads.pageInfo.hasNextPage' <<<"$page")" = "true" ] || break
87
+ cursor=$(jq -r '.data.repository.pullRequest.reviewThreads.pageInfo.endCursor' <<<"$page")
88
+ done
89
+
90
+ jq -c --argjson bots "$BOTS_JSON" --argjson threads "$threads" --arg since "$SINCE" '
91
+ .data.repository.pullRequest as $p
92
+ | $p.headRefOid as $head
93
+ | ([$p.commits.nodes[0].commit.committedDate // "", $since] | max) as $after
94
+ | def matches($login): any($bots[]; . as $re | ($login // "") | test($re; "i"));
95
+ def isbot($a): ($a.__typename // "User") != "User";
96
+ def progress: test("busy working|in progress|currently processing|currently reviewing|\\*\\*(running|queued)\\*\\*"; "i");
97
+ def limited: test("review limit reached|reached your (pr )?review limit|reviews are paused|rate limit (exceeded|reached)|been rate[- ]limited"; "i");
98
+ [ $bots[] as $re
99
+ | ($p.reviews.nodes | map(select((.author.login // "") | test($re; "i")))) as $revs
100
+ | ($p.comments.nodes | map(select((.author.login // "") | test($re; "i")))) as $coms
101
+ | ($coms | map(select(.updatedAt >= $after))) as $fresh
102
+ | ($p.reactions.nodes | map(select(((.user.login // "") | test($re; "i"))
103
+ and .content != "EYES" and .createdAt >= $after))) as $reacts
104
+ | {
105
+ bot: $re,
106
+ reviewed_head: any($revs[]; .commit.oid == $head),
107
+ activity_after_head: (any($fresh[]; (.body | progress) | not)
108
+ or ($reacts | length) > 0),
109
+ limited: any($fresh[]; .body | limited)
110
+ }
111
+ | .acted_on_head = (.reviewed_head or .activity_after_head)
112
+ ] as $per_bot
113
+ | [ $threads[] | select(.isResolved | not)
114
+ | .comments.nodes[0] as $c
115
+ | {
116
+ thread_id: .id, comment_id: $c.databaseId, url: $c.url,
117
+ author: $c.author.login, is_bot: isbot($c.author), is_target: matches($c.author.login),
118
+ path, line, outdated: .isOutdated,
119
+ excerpt: (($c.body // "") | gsub("\\s+"; " ") | .[0:160])
120
+ } ] as $open
121
+ | ($open | map(select(.is_bot))) as $open_bot
122
+ | {
123
+ head: $head,
124
+ head_after: $after,
125
+ bots: $per_bot,
126
+ unresolved: $open,
127
+ counts: {
128
+ target: ($open_bot | map(select(.is_target)) | length),
129
+ other_bots: ($open_bot | map(select(.is_target | not)) | length),
130
+ humans: ($open | map(select(.is_bot | not)) | length)
131
+ },
132
+ verdict: (
133
+ if any($per_bot[]; .limited) then "limited"
134
+ elif ($open_bot | length) > 0 then "findings"
135
+ elif any($per_bot[]; .acted_on_head | not) then "pending"
136
+ else "clean" end)
137
+ }' <<<"$first"
138
+ }
139
+
140
+ exit_for() {
141
+ case "$1" in clean) echo 0 ;; findings) echo 10 ;; pending) echo 20 ;; limited) echo 30 ;; *) echo 1 ;; esac
142
+ }
143
+
144
+ deadline=$(( SECONDS + WAIT ))
145
+ state=$(read_state)
146
+ verdict=$(jq -r .verdict <<<"$state")
147
+ waiting() { jq -e '.verdict != "limited" and any(.bots[]; .acted_on_head | not)' >/dev/null <<<"$state"; }
148
+ while :; do
149
+ if waiting && [ "$SECONDS" -lt "$deadline" ]; then
150
+ sleep "$INTERVAL"
151
+ elif [ "$verdict" = "clean" ] && [ "$SETTLE" -gt 0 ]; then
152
+ # Clean once is not clean: bots post a review, then a second bot or a follow-up lands.
153
+ sleep "$SETTLE"
154
+ SETTLE=0
155
+ else
156
+ break
157
+ fi
158
+ state=$(read_state)
159
+ verdict=$(jq -r .verdict <<<"$state")
160
+ done
161
+
162
+ printf '%s\n' "$state"
163
+ exit "$(exit_for "$verdict")"
@@ -84,13 +84,14 @@ Rules:
84
84
  FYI comments ("behaviour change, intentional", "note that…", "just flagging").
85
85
  If there's nothing to do, there's no comment: put context like that in the
86
86
  review body or the saved review file, never as an inline PR comment.
87
- - The review-level `body` field must contain, in this order: the finding counts
88
- ("0 Critical / 5 Important / 6 Observations / 1 Idiomatic"), one or two
87
+ - The review-level `body` field must contain, in this order: one or two
89
88
  sentences of risk framing, then **a numbered list of the asks: one line each,
90
89
  imperative, matching the inline comments in order**. That list is what the
91
90
  author reads first and works from; it must be scannable in ten seconds. Then
92
91
  any Production Signals, then a short flat list of Observations marked "no
93
- action required", then the saved review file path.
92
+ action required". Do NOT open the body with a finding-count line and do NOT
93
+ end it with the saved review file path: a local `~/code-reviews/` path means
94
+ nothing to the author, and the counts duplicate the asks list.
94
95
 
95
96
  Keep the body itself under ~2,500 characters. If it is longer, the asks are
96
97
  buried: cut prose, never cut the numbered asks.
@@ -228,7 +228,11 @@ Input tokens: ~<N> ← estimated: diff tokens × agent passes + context fil
228
228
  Cost: ~$<X.XX> (output actual, input estimated; blended across model tiers below)
229
229
  ```
230
230
 
231
- Per-MTok pricing (input/output), verified 2026-07-07 from the claude-api reference; re-check there if models changed:
231
+ Per-MTok pricing (input/output), verified 2026-07-07 from the claude-api reference; re-check there if models changed. The Claude 5.5 rows and fable-5-1 are not yet on that sheet: they reuse the predecessor-tier rates and must be re-checked:
232
+ - claude-fable-5-1: $10 / $50 (unverified, as claude-fable-5)
233
+ - claude-opus-5-5: $15 / $75 (unverified; copied from the opus-5 rate in pricing.json, not checked)
234
+ - claude-sonnet-5-5: $3 / $15 (unverified)
235
+ - claude-haiku-5-5: $1 / $5 (unverified)
232
236
  - claude-fable-5: $10 / $50
233
237
  - claude-opus-4-8: $5 / $25
234
238
  - claude-sonnet-4-6 / claude-sonnet-5: $3 / $15
@@ -1,5 +1,9 @@
1
1
  {
2
- "note": "USD per million tokens, keyed by revmux's actual_model. revmux runs `claude --print` under subscription (Max plan) auth, so nothing here is a real API bill; this is an API-list-price ESTIMATE for the cost block only. Where a model exposes separate input/output prices, usd = tokens/1e6 * output price (output-only, not blended), because revmux reports a single combined `tokens` figure per agent with no input/output split to weight a blend. verified:false entries are not confirmed against a current price sheet (no local claude-api pricing doc found on this machine as of 2026-09-09) and must be checked before this cost block is trusted for a real decision.",
2
+ "note": "USD per million tokens, keyed by revmux's actual_model. revmux runs `claude --print` under subscription (Max plan) auth, so nothing here is a real API bill; this is an API-list-price ESTIMATE for the cost block only. Where a model exposes separate input/output prices, usd = tokens/1e6 * output price (output-only, not blended), because revmux reports a single combined `tokens` figure per agent with no input/output split to weight a blend. verified:false entries are not confirmed against a current price sheet (no local claude-api pricing doc found on this machine as of 2026-09-09) and must be checked before this cost block is trusted for a real decision. The claude-*-5-5 and claude-fable-5-1 rows carry the prices of their predecessor tier (fable: $10/$50 as listed in output-format.md; opus/sonnet/haiku: the 5-family rates above) until a price sheet confirms the new models.",
3
+ "claude-fable-5-1": { "input": 10, "output": 50, "blended": 30, "verified": false },
4
+ "claude-opus-5-5": { "input": 15, "output": 75, "blended": 45, "verified": false },
5
+ "claude-sonnet-5-5": { "input": 3, "output": 15, "blended": 9, "verified": false },
6
+ "claude-haiku-5-5": { "input": 1, "output": 5, "blended": 3, "verified": false },
3
7
  "claude-opus-5": { "input": 15, "output": 75, "blended": 45, "verified": false },
4
8
  "claude-sonnet-5": { "input": 3, "output": 15, "blended": 9, "verified": false },
5
9
  "claude-haiku-4-5-20251001": { "input": 1, "output": 5, "blended": 3, "verified": false },
@@ -1,13 +1,13 @@
1
1
  ---
2
2
  description: Deep lekker review using Codex agents and a second implementation pass
3
- model: codex/gpt-5.6-sol:high
3
+ model: codex/gpt-6-astra:high
4
4
  agents:
5
5
  - {name: quality+impl, lenses: [lekker-quality, lekker-implementation], color: cyan}
6
6
  - {name: simpl+conventions, lenses: [lekker-simplification, lekker-conventions], color: magenta}
7
7
  - {name: tests, lenses: [lekker-test-quality, tests], color: green}
8
8
  - {name: adversarial, lenses: [adversarial], color: yellow}
9
9
  - {name: bugs+impl, lenses: [bugs, impl], color: blue}
10
- stages: {synthesis: codex/gpt-5.6-sol:high, verify: codex/gpt-5.6-sol:high}
10
+ stages: {synthesis: codex/gpt-6-astra:high, verify: codex/gpt-6-astra:high}
11
11
  ---
12
12
  You are one read-only reviewer on a panel. Other reviewers apply different
13
13
  lenses to the same change. Report only findings supported by your own lenses.
@@ -1,12 +1,12 @@
1
1
  ---
2
2
  description: Medium-depth lekker review using Codex agents
3
- model: codex/gpt-5.6-sol:high
3
+ model: codex/gpt-6-astra:high
4
4
  agents:
5
5
  - {name: quality+impl, lenses: [lekker-quality, lekker-implementation], color: cyan}
6
6
  - {name: simpl+conventions, lenses: [lekker-simplification, lekker-conventions], color: magenta}
7
7
  - {name: tests, lenses: [lekker-test-quality, tests], color: green}
8
8
  - {name: adversarial, lenses: [adversarial], color: yellow}
9
- stages: {synthesis: codex/gpt-5.6-sol:high, verify: codex/gpt-5.6-sol:high}
9
+ stages: {synthesis: codex/gpt-6-astra:high, verify: codex/gpt-6-astra:high}
10
10
  ---
11
11
  You are one read-only reviewer on a panel. Other reviewers apply different
12
12
  lenses to the same change. Report only findings supported by your own lenses.