@olegkoval/agent-skills 1.49.2 → 1.51.0

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 (75) hide show
  1. package/.github/copilot-instructions.md +1 -0
  2. package/.github/prompts/coderabbitloop.prompt.md +90 -15
  3. package/.github/prompts/codexloop.prompt.md +33 -6
  4. package/.github/prompts/copilotloop.prompt.md +302 -0
  5. package/.github/prompts/geminiloop.prompt.md +34 -6
  6. package/.github/prompts/qodoloop.prompt.md +18 -0
  7. package/.kiro/steering/coderabbitloop.md +90 -15
  8. package/.kiro/steering/codexloop.md +33 -6
  9. package/.kiro/steering/copilotloop.md +301 -0
  10. package/.kiro/steering/geminiloop.md +34 -6
  11. package/.kiro/steering/qodoloop.md +18 -0
  12. package/.windsurf/rules/coderabbitloop.md +90 -15
  13. package/.windsurf/rules/codexloop.md +33 -6
  14. package/.windsurf/rules/copilotloop.md +300 -0
  15. package/.windsurf/rules/geminiloop.md +34 -6
  16. package/.windsurf/rules/qodoloop.md +18 -0
  17. package/README.md +1 -0
  18. package/adapters/claude/olko-github-pr/skills/coderabbitloop/SKILL.md +91 -16
  19. package/adapters/claude/olko-github-pr/skills/coderabbitloop/references/graphql-queries.md +41 -9
  20. package/adapters/claude/olko-github-pr/skills/codexloop/SKILL.md +35 -8
  21. package/adapters/claude/olko-github-pr/skills/copilotloop/SKILL.md +309 -0
  22. package/adapters/claude/olko-github-pr/skills/geminiloop/SKILL.md +36 -8
  23. package/adapters/claude/olko-github-pr/skills/lekker-review/SKILL.md +26 -1
  24. package/adapters/claude/olko-github-pr/skills/lekker-review/references/agents/completeness-critic.md +12 -0
  25. package/adapters/claude/olko-github-pr/skills/lekker-review/references/agents/implementation.md +26 -1
  26. package/adapters/claude/olko-github-pr/skills/lekker-review/references/agents/prover.md +8 -1
  27. package/adapters/claude/olko-github-pr/skills/lekker-review/references/agents/test-quality.md +20 -2
  28. package/adapters/claude/olko-github-pr/skills/lekker-review/references/agents/verifier.md +25 -0
  29. package/adapters/claude/olko-github-pr/skills/lekker-review/references/fix-mode.md +23 -0
  30. package/adapters/claude/olko-github-pr/skills/qodoloop/SKILL.md +19 -1
  31. package/adapters/claude/olko-github-pr/skills/qodoloop/references/graphql-queries.md +19 -2
  32. package/adapters/codex/olko-github-pr/README.md +1 -0
  33. package/adapters/cursor/olko-github-pr/skills/coderabbitloop/SKILL.md +91 -16
  34. package/adapters/cursor/olko-github-pr/skills/coderabbitloop/references/graphql-queries.md +41 -9
  35. package/adapters/cursor/olko-github-pr/skills/codexloop/SKILL.md +35 -8
  36. package/adapters/cursor/olko-github-pr/skills/copilotloop/SKILL.md +309 -0
  37. package/adapters/cursor/olko-github-pr/skills/geminiloop/SKILL.md +36 -8
  38. package/adapters/cursor/olko-github-pr/skills/qodoloop/SKILL.md +19 -1
  39. package/adapters/cursor/olko-github-pr/skills/qodoloop/references/graphql-queries.md +19 -2
  40. package/adapters/grok/olko-github-pr/skills/coderabbitloop/SKILL.md +91 -16
  41. package/adapters/grok/olko-github-pr/skills/coderabbitloop/references/graphql-queries.md +41 -9
  42. package/adapters/grok/olko-github-pr/skills/codexloop/SKILL.md +35 -8
  43. package/adapters/grok/olko-github-pr/skills/copilotloop/SKILL.md +309 -0
  44. package/adapters/grok/olko-github-pr/skills/geminiloop/SKILL.md +36 -8
  45. package/adapters/grok/olko-github-pr/skills/qodoloop/SKILL.md +19 -1
  46. package/adapters/grok/olko-github-pr/skills/qodoloop/references/graphql-queries.md +19 -2
  47. package/catalog/skills.json +23 -0
  48. package/package.json +1 -1
  49. package/plugins/olko-apple-kit/.claude-plugin/plugin.json +1 -1
  50. package/plugins/olko-creative/.claude-plugin/plugin.json +1 -1
  51. package/plugins/olko-garmin-kit/.claude-plugin/plugin.json +1 -1
  52. package/plugins/olko-git-tools/.claude-plugin/plugin.json +1 -1
  53. package/plugins/olko-github-pr/.claude-plugin/plugin.json +1 -1
  54. package/plugins/olko-github-pr/skills/coderabbitloop/SKILL.md +91 -16
  55. package/plugins/olko-github-pr/skills/coderabbitloop/references/graphql-queries.md +41 -9
  56. package/plugins/olko-github-pr/skills/codexloop/SKILL.md +35 -8
  57. package/plugins/olko-github-pr/skills/copilotloop/SKILL.md +308 -0
  58. package/plugins/olko-github-pr/skills/geminiloop/SKILL.md +36 -8
  59. package/plugins/olko-github-pr/skills/lekker-review/SKILL.md +26 -1
  60. package/plugins/olko-github-pr/skills/lekker-review/references/agents/completeness-critic.md +12 -0
  61. package/plugins/olko-github-pr/skills/lekker-review/references/agents/implementation.md +26 -1
  62. package/plugins/olko-github-pr/skills/lekker-review/references/agents/prover.md +8 -1
  63. package/plugins/olko-github-pr/skills/lekker-review/references/agents/test-quality.md +20 -2
  64. package/plugins/olko-github-pr/skills/lekker-review/references/agents/verifier.md +25 -0
  65. package/plugins/olko-github-pr/skills/lekker-review/references/fix-mode.md +23 -0
  66. package/plugins/olko-github-pr/skills/lekker-review/workflow.js +87 -5
  67. package/plugins/olko-github-pr/skills/qodoloop/SKILL.md +19 -1
  68. package/plugins/olko-github-pr/skills/qodoloop/references/graphql-queries.md +19 -2
  69. package/plugins/olko-obsidian/.claude-plugin/plugin.json +1 -1
  70. package/plugins/olko-product/.claude-plugin/plugin.json +1 -1
  71. package/plugins/olko-reflection/.claude-plugin/plugin.json +1 -1
  72. package/plugins/olko-release/.claude-plugin/plugin.json +1 -1
  73. package/plugins/olko-skill-meta/.claude-plugin/plugin.json +1 -1
  74. package/plugins/olko-web-ops/.claude-plugin/plugin.json +1 -1
  75. package/scripts/lib/catalog.mjs +1 -1
@@ -36,13 +36,30 @@ CodeRabbit has slash commands (official, `docs.coderabbit.ai/reference/review-co
36
36
  gh pr view --json number,headRefName,headRefOid -q '{number, branch: .headRefName, sha: .headRefOid}'
37
37
  ```
38
38
 
39
- Check out the branch if not already on it.
39
+ Check out the branch if not already on it, **then require a clean working tree**
40
+ (`git status --porcelain` empty) before touching anything:
41
+
42
+ ```bash
43
+ [ -z "$(git status --porcelain)" ] || { echo "working tree not clean, refusing to start: would risk committing unrelated changes"; exit 1; }
44
+ ```
45
+
46
+ This is the precondition step E's scoped `git add <file>` depends on: staging only the files a fix
47
+ touched is safe *because* the tree started clean. Skip it and a file with pre-existing local edits
48
+ gets those edits swept into the fix commit right along with it.
40
49
 
41
50
  ### 2. Loop (max 5 iterations)
42
51
 
43
- #### A. Push and wait
52
+ Keep an explicit iteration counter and stop at 5: the cap is a real bound to enforce, not a figure
53
+ of speech. Each pass through A–F is one iteration; on hitting the cap, go straight to the report.
54
+
55
+ #### A. Wait for a review of the current head
56
+
57
+ On **iteration 1**, if there is nothing to push yet (you haven't fixed anything in this loop), don't
58
+ wait for a brand-new review: use whatever CodeRabbit has already posted as your starting point and
59
+ go straight to step B. Otherwise:
44
60
 
45
61
  ```bash
62
+ SINCE=$(date -u +%Y-%m-%dT%H:%M:%SZ)
46
63
  git push
47
64
  ```
48
65
 
@@ -52,11 +69,27 @@ If this repo doesn't auto-review on push, nudge it:
52
69
  gh pr comment <PR_NUMBER> --body "@coderabbitai review"
53
70
  ```
54
71
 
55
- Poll (every ~10s, timeout ~5min) for CodeRabbit's next formal review to land: a new entry in `gh api repos/{owner}/{repo}/pulls/<PR_NUMBER>/reviews` from `coderabbitai[bot]` created after this push. If you instead see a rate-limit comment ("review limit"), **stop the loop now** and go to Report with `blocked: rate-limited`.
72
+ Poll (every ~10s, timeout ~5min) for CodeRabbit's next formal review to land: a new entry in
73
+ `gh api --paginate repos/{owner}/{repo}/pulls/<PR_NUMBER>/reviews` from `coderabbitai[bot]`
74
+ (REST spelling carries the `[bot]` suffix) created after `$SINCE`. Follow pagination so a review
75
+ that lands on page two is not missed. If you instead see a rate-limit comment ("review limit"),
76
+ **stop the loop now** and go to Report with `blocked: rate-limited`. If no review arrives within
77
+ the timeout after one retry, stop and report the timeout honestly; do not claim success.
56
78
 
57
79
  #### B. Fetch unresolved findings
58
80
 
59
- Run the `unresolvedQodoThreads`-shaped query in `references/graphql-queries.md` (filter `author.login == "coderabbitai[bot]"` instead of Qodo's login). For each unresolved thread, parse the finding text and the **Prompt for AI Agents** block (heading text is `🤖 Prompt for AI Agents`, not `Agent Prompt`: match case/emoji-insensitively).
81
+ Run the `unresolvedQodoThreads`-shaped query in `references/graphql-queries.md` (filter `author.login`
82
+ on GraphQL's bare `coderabbitai`, **not** REST's `coderabbitai[bot]`: see the reference's login-spelling
83
+ note, and follow `pageInfo.hasNextPage`/`endCursor` until exhausted). For each unresolved thread,
84
+ parse the finding text, its `databaseId`, and the **Prompt for AI Agents** block (heading text is
85
+ `🤖 Prompt for AI Agents`, not `Agent Prompt`: match case/emoji-insensitively).
86
+
87
+ Mark each thread as seen with an 👀 reaction on its first comment (`databaseId` from the query), so
88
+ the bot and a watching human can tell it is being worked:
89
+
90
+ ```bash
91
+ gh api --method POST repos/{owner}/{repo}/pulls/comments/<DATABASE_ID>/reactions -f content=eyes
92
+ ```
60
93
 
61
94
  #### C. Check exit conditions
62
95
 
@@ -64,26 +97,68 @@ Stop if there are zero unresolved CodeRabbit threads, or max iterations reached.
64
97
 
65
98
  #### D. Fix each finding
66
99
 
67
- For each thread, in order: read the Prompt for AI Agents block in full: it names the issue and the fix. Apply it, staying inside its stated scope. If the suggestion is wrong, unsafe, or needs a product decision, don't force it: note that in step E instead.
100
+ For each thread, in order: read the Prompt for AI Agents block in full: it names the issue and the fix. Apply it, staying inside its stated scope. If the suggestion is wrong, unsafe, or needs a product decision, don't force it: note that in step F instead. Track two lists as you go: **fixed** (thread id + the exact files you touched) and **skipped** (thread id + why). Do not resolve anything yet.
101
+
102
+ #### E. Commit and push FIRST, before resolving anything
68
103
 
69
- #### E. Answer and resolve
104
+ Order matters. A resolved thread is a claim that the fix is on the branch, so the push has to succeed
105
+ before the claim is made: otherwise a failed commit or push leaves the PR unfixed with the finding
106
+ marked resolved, and nobody looks at it again.
70
107
 
71
- **Reply to the thread first, then resolve it**, the "answer to the comments" half of the job:
108
+ If step D changed code:
72
109
 
73
110
  ```bash
74
- gh api graphql -f query='mutation { addPullRequestReviewThreadReply(input: {pullRequestReviewThreadId: "<THREAD_ID>", body: "<REPLY>"}) { comment { id } } }'
111
+ # Stage ONLY the files your fixes touched: never `git add -A`, which sweeps up
112
+ # unrelated work and untracked secrets sitting in the worktree.
113
+ git status --short # look before you stage
114
+ git add <path> [<path>...] # the files named in the findings you fixed
115
+ git commit -m "address CodeRabbit review feedback (coderabbitloop iteration N)"
116
+ git push
75
117
  ```
76
118
 
77
- Reply body: one or two sentences, what you changed and why, or exactly why you didn't fix it. Then resolve (`resolveReviewThread`). A finding you deliberately skip still gets a reply and gets resolved.
119
+ Confirm the push actually landed before continuing:
78
120
 
79
- #### F. Commit and push
121
+ ```bash
122
+ git rev-parse HEAD
123
+ gh pr view <PR_NUMBER> --json headRefOid -q .headRefOid # must match
124
+ ```
125
+
126
+ If they differ, stop: the fix is not on the PR, so nothing may be resolved yet.
127
+
128
+ #### F. Reply to each finding, react, then resolve
129
+
130
+ Only now, with the fixes pushed, reply and resolve. **Reply to the thread first, then react, then
131
+ resolve it**, the "answer to the comments" half of the job:
80
132
 
81
133
  ```bash
82
- git add -A
83
- git commit -m "address CodeRabbit review feedback (coderabbitloop iteration N)"
84
- git push
134
+ gh api graphql -f query='
135
+ mutation($threadId: ID!, $body: String!) {
136
+ addPullRequestReviewThreadReply(input: {pullRequestReviewThreadId: $threadId, body: $body}) {
137
+ comment { id }
138
+ }
139
+ }' -f threadId="$THREAD_ID" -f body="$REPLY_TEXT"
85
140
  ```
86
141
 
142
+ Pass the thread id and reply text as GraphQL **variables** (`-f threadId=... -f body=...`), never
143
+ interpolated into the query string: a reply containing a quote, backtick, or newline breaks (or
144
+ injects into) a hand-built query.
145
+
146
+ Reply body: one or two sentences, what you changed and why, or exactly why you didn't fix it. A
147
+ finding you deliberately skip still gets a reply and gets resolved.
148
+
149
+ Then record the disposition as a reaction on the thread's first comment: the learning signal, and a
150
+ visible marker for a human scanning the PR. 👍 (`+1`) for fixed, 👎 (`-1`) for skipped/rebutted.
151
+ CodeRabbit reads a 👎 as feedback that the finding was wrong.
152
+
153
+ ```bash
154
+ gh api --method POST repos/{owner}/{repo}/pulls/comments/<DATABASE_ID>/reactions -f content=+1
155
+ # skipped/rebutted finding:
156
+ gh api --method POST repos/{owner}/{repo}/pulls/comments/<DATABASE_ID>/reactions -f content=-1
157
+ ```
158
+
159
+ Then resolve (`resolveReviewThread`). Reply first, react, then resolve: a reaction never replaces
160
+ the reply, and a resolved thread with no reply loses the reasoning.
161
+
87
162
  Go back to step A.
88
163
 
89
164
  ### 3. Report
@@ -94,7 +169,7 @@ Go back to step A.
94
169
  | Findings resolved | N |
95
170
  | Findings skipped | N (with reasons) |
96
171
  | Remaining | N (if any) |
97
- | Blocked | rate-limited / max-iterations / none |
172
+ | Blocked | rate-limited / timeout / max-iterations / none |
98
173
 
99
174
  ```
100
175
  Coderabbitloop complete.
@@ -105,4 +180,4 @@ Coderabbitloop complete.
105
180
 
106
181
  ## References
107
182
 
108
- - `references/graphql-queries.md`: shared with `qodoloop`: the exact `reviewThreads` query and the `resolveReviewThread` / `addPullRequestReviewThreadReply` mutations. Swap the author-login filter to `coderabbitai[bot]` and the prompt-heading match to `Prompt for AI Agents`.
183
+ - `references/graphql-queries.md`: shared with `qodoloop`: the exact `reviewThreads` query (including the `databaseId` the reaction step needs) and the `resolveReviewThread` / `addPullRequestReviewThreadReply` mutations. Filter `author.login` on GraphQL's bare `coderabbitai` (never `coderabbitai[bot]`) and match the prompt heading `Prompt for AI Agents`.
@@ -28,7 +28,7 @@ suggestion applied is worse than the comment itself.
28
28
  ## Not for
29
29
 
30
30
  - GitLab / Perforce (Codex code review is a GitHub app). For other review bots this catalog ships
31
- `geminiloop`, `coderabbitloop`, and `qodoloop`; for CI failures rather than review comments, use
31
+ `copilotloop`, `geminiloop`, `coderabbitloop`, and `qodoloop`; for CI failures rather than review comments, use
32
32
  `ci-fix-loop`.
33
33
 
34
34
  ## 0. Resolve the Codex bot login (do this first, do not hardcode)
@@ -75,9 +75,13 @@ report and list what is still unresolved rather than starting a sixth.
75
75
 
76
76
  ```bash
77
77
  HEAD_SHA=$(gh pr view <PR> --json headRefOid -q .headRefOid)
78
- # Only trigger if no Codex review already exists for this exact SHA:
79
- HAVE=$(gh api repos/{owner}/{repo}/pulls/<PR>/reviews --paginate \
80
- --jq "[.[] | select(.user.login==\"$BOT\" and .commit_id==\"$HEAD_SHA\")] | length")
78
+ # Only trigger if no Codex review already exists for this exact SHA.
79
+ # gh cannot combine --slurp with --jq, so pipe to `jq -s`: it folds every page
80
+ # into one array. Without it the filter runs once per page and HAVE becomes a
81
+ # multi-line count that never equals "0", silently skipping the trigger.
82
+ HAVE=$(gh api repos/{owner}/{repo}/pulls/<PR>/reviews --paginate |
83
+ jq -s --arg bot "$BOT" --arg head "$HEAD_SHA" \
84
+ '[.[][] | select(.user.login==$bot and .commit_id==$head)] | length')
81
85
  if [ "$HAVE" = "0" ]; then gh pr comment <PR> --body "@codex review"; fi
82
86
  ```
83
87
 
@@ -91,8 +95,9 @@ an honest timeout, not hang it.
91
95
  wait_for_review() { # $1 = attempt label
92
96
  local deadline=$(( SECONDS + 600 ))
93
97
  while [ "$SECONDS" -lt "$deadline" ]; do
94
- R=$(gh api repos/{owner}/{repo}/pulls/<PR>/reviews --paginate \
95
- --jq "[.[] | select(.user.login==\"$BOT\" and .commit_id==\"$HEAD_SHA\")] | last")
98
+ R=$(gh api repos/{owner}/{repo}/pulls/<PR>/reviews --paginate |
99
+ jq -s --arg bot "$BOT" --arg head "$HEAD_SHA" \
100
+ '[.[][] | select(.user.login==$bot and .commit_id==$head)] | sort_by(.submitted_at, .id) | last')
96
101
  if [ -n "$R" ] && [ "$R" != "null" ]; then return 0; fi
97
102
  echo "waiting for Codex review of $HEAD_SHA ($1)..."; sleep 15
98
103
  done
@@ -126,6 +131,13 @@ gh api repos/{owner}/{repo}/pulls/<PR>/comments --paginate \
126
131
  Also pull the review threads + their resolved state via GraphQL (see step F) so you only act on
127
132
  unresolved ones.
128
133
 
134
+ Mark each unresolved comment as seen, so the bot and a watching human can tell it is being handled.
135
+ GitHub's reaction set is fixed; `eyes` is the only "looking at it" value:
136
+
137
+ ```bash
138
+ gh api --method POST repos/{owner}/{repo}/pulls/comments/<COMMENT_ID>/reactions -f content=eyes
139
+ ```
140
+
129
141
  ### C. Critically evaluate EACH comment (the core of this skill)
130
142
 
131
143
  For every comment, **verify the claim against the actual code and repo conventions before touching
@@ -227,6 +239,21 @@ then resolve:
227
239
  gh api graphql -f query='mutation { resolveReviewThread(input: {threadId: "THREAD_ID"}) { thread { isResolved } } }'
228
240
  ```
229
241
 
242
+ Then record the disposition as a reaction on the bot's own comment: the learning signal, and a
243
+ visible marker for a human scanning the PR:
244
+
245
+ - 👍 (`+1`): the finding was accepted and fixed.
246
+ - 👎 (`-1`): the finding was rebutted as a false positive. **This is the correction signal.**
247
+
248
+ ```bash
249
+ gh api --method POST repos/{owner}/{repo}/pulls/comments/<COMMENT_ID>/reactions -f content=+1
250
+ # rebutted finding:
251
+ gh api --method POST repos/{owner}/{repo}/pulls/comments/<COMMENT_ID>/reactions -f content=-1
252
+ ```
253
+
254
+ Reply first, then react, then resolve: the reaction is not a substitute for the reply, and a
255
+ resolved thread with no reply loses the reasoning.
256
+
230
257
  Resolve a thread only for comments authored by `$BOT` that you have fixed or rebutted: never
231
258
  blanket-resolve, and never resolve a human reviewer's thread. For each fixed comment, verify the
232
259
  push first, reply with the change made, then resolve the thread and verify `isResolved: true`.
@@ -0,0 +1,300 @@
1
+ <!-- Generated by scripts/build-adapters.sh. Do not edit directly. -->
2
+
3
+ ---
4
+ description: "Iteratively drives a GitHub PR to zero unresolved GitHub Copilot review comments, verifying every finding against the real code first, fixes only the correct ones, and rebuts false positives without changing correct code."
5
+ ---
6
+
7
+ # Copilotloop
8
+
9
+ Drive a GitHub PR until Copilot has no unresolved review comments, **but do not cargo-cult its
10
+ suggestions.** Every comment is a *claim to verify*, not an instruction to obey. A wrong
11
+ suggestion applied is worse than the comment itself.
12
+
13
+ ## How Copilot differs from other review bots
14
+
15
+ - **No check-run, no score.** Copilot posts an overview comment and a PR review with inline review
16
+ comments. Detection is by polling the reviews endpoint and paginated review threads. "Satisfied"
17
+ means zero unresolved Copilot threads and zero unaddressed body findings after each finding is
18
+ fixed or rebutted with a recorded reply.
19
+ - **Request through the reviewers API.** Copilot does not use a reliable slash-command trigger.
20
+ Request `copilot-pull-request-reviewer[bot]` through the pull request reviewers endpoint. A
21
+ repository may also be configured to review new pushes automatically.
22
+ - **Copilot may repeat comments.** A re-review can repeat comments that were resolved or downvoted,
23
+ so match findings to the current head and prior replies before reopening work, including body
24
+ findings that have no inline thread.
25
+ - **Copilot is concise and can reason from the diff alone.** Its characteristic failure is
26
+ confidently asserting a bug based only on the changed hunk, without the surrounding file or the
27
+ call sites. That makes "read the whole file before believing it" the single highest-value check.
28
+
29
+ ## Not for
30
+
31
+ - GitLab / Perforce. For other review bots this catalog ships `codexloop`, `geminiloop`,
32
+ `coderabbitloop`, and `qodoloop`; for CI failures rather than review comments, use
33
+ `ci-fix-loop`.
34
+
35
+ ## 0. Resolve the Copilot bot login (do this first)
36
+
37
+ The bot login is normally stable, but confirm it from the PR rather than assuming it:
38
+
39
+ ```bash
40
+ gh api repos/{owner}/{repo}/pulls/<PR>/reviews --paginate --jq '.[].user.login' | sort -u
41
+ gh api repos/{owner}/{repo}/pulls/<PR>/comments --paginate --jq '.[].user.login' | sort -u
42
+ ```
43
+
44
+ Use `copilot-pull-request-reviewer[bot]` as `BOT`. Confirm it appears after the first requested
45
+ review; if GitHub uses a different login for the installation, use the exact Copilot-looking login
46
+ returned by the probe rather than guessing.
47
+
48
+ **Finding nothing here is NOT a stop condition.** On a PR Copilot has never reviewed there is no bot
49
+ login to find yet. Fall through to step 2A, request the reviewer, and re-run this probe once a
50
+ review lands. Only conclude Copilot is unavailable after the bounded wait expires with no review.
51
+
52
+ ## 1. Identify the PR
53
+
54
+ ```bash
55
+ gh pr view --json number,headRefName,headRefOid -q '{number,branch:.headRefName,head:.headRefOid}'
56
+ ```
57
+
58
+ Switch to the PR branch if not already on it. Capture `OWNER`/`REPO` (`gh repo view --json owner,name`).
59
+
60
+ ## 2. The loop (max 5 iterations)
61
+
62
+ Keep an explicit iteration counter and stop at 5: the cap is a real bound to enforce, not a
63
+ figure of speech. Each pass through A–G is one iteration; on hitting the cap, go straight to the
64
+ report and list what is still unresolved rather than starting a sixth.
65
+
66
+ ### A. Ensure a fresh Copilot review on the current head
67
+
68
+ ```bash
69
+ HEAD_SHA=$(gh pr view <PR> --json headRefOid -q .headRefOid)
70
+ # Only trigger if no Copilot review exists for this exact SHA:
71
+ HAVE=$(gh api repos/{owner}/{repo}/pulls/<PR>/reviews --paginate |
72
+ jq -s --arg bot "$BOT" --arg head "$HEAD_SHA" \
73
+ '[.[][] | select(.user.login==$bot and .commit_id==$head)] | length')
74
+ if [ "$HAVE" = "0" ]; then
75
+ gh api --method POST repos/{owner}/{repo}/pulls/<PR>/requested_reviewers \
76
+ -f 'reviewers[]=copilot-pull-request-reviewer[bot]'
77
+ fi
78
+ ```
79
+
80
+ Poll for the review of THIS head to land. No check-run exists, so poll the reviews endpoint, and
81
+ poll it on a **deadline**, never `while true`: a review that never arrives must end the skill with
82
+ an honest timeout, not hang it.
83
+
84
+ ```bash
85
+ # 10-minute deadline, one retry, then give up. DEADLINE/RETRIES are the
86
+ # enforcement of the bounds this skill claims: do not drop them.
87
+ wait_for_review() { # $1 = attempt label
88
+ local deadline=$(( SECONDS + 600 ))
89
+ while [ "$SECONDS" -lt "$deadline" ]; do
90
+ R=$(gh api repos/{owner}/{repo}/pulls/<PR>/reviews --paginate |
91
+ jq -s --arg bot "$BOT" --arg head "$HEAD_SHA" \
92
+ '[.[][] | select(.user.login==$bot and .commit_id==$head)] | sort_by(.submitted_at, .id) | last')
93
+ if [ -n "$R" ] && [ "$R" != "null" ]; then return 0; fi
94
+ echo "waiting for Copilot review of $HEAD_SHA ($1)..."; sleep 15
95
+ done
96
+ return 1
97
+ }
98
+
99
+ if ! wait_for_review "first wait"; then
100
+ echo "no Copilot review after 10m, retrying once" # say the retry out loud
101
+ gh api --method POST repos/{owner}/{repo}/pulls/<PR>/requested_reviewers \
102
+ -f 'reviewers[]=copilot-pull-request-reviewer[bot]'
103
+ if ! wait_for_review "after retry"; then
104
+ echo "Copilot did not review $HEAD_SHA after a retry; stopping and reporting."
105
+ exit 1 # honest timeout, never a success claim
106
+ fi
107
+ fi
108
+ ```
109
+
110
+ Copilot usually reviews quickly, but large diffs can take longer; the deadline is bounded. Report the
111
+ retry in the final summary; two silent timeouts are the failure mode this guard exists to prevent.
112
+
113
+ ### B. Fetch the findings
114
+
115
+ - **Summary**: read the Copilot overview comment and review `.body`, including all matching reviews
116
+ for the current head. Extract and classify actionable claims even when they have no inline thread;
117
+ an approval assessment or lack of inline comments does not make those findings complete.
118
+ Track each body finding across iterations by source review/comment ID and item, with its
119
+ classification, fix commit or evidence-based rebuttal, PR-level reply URL, and completion status.
120
+ Link duplicates to the same finding so they are counted once; retain pending findings after a push.
121
+ - **Unresolved inline comments** on the current head:
122
+
123
+ ```bash
124
+ gh api repos/{owner}/{repo}/pulls/<PR>/comments --paginate \
125
+ --jq ".[] | select(.user.login==\"$BOT\") | {id, path, line, body}"
126
+ ```
127
+
128
+ Also pull the review threads + their resolved state via GraphQL (see step F) so you only act on
129
+ unresolved ones.
130
+
131
+ Mark each unresolved inline comment as seen, so the bot and a watching human can tell it is being
132
+ handled. GitHub's reaction set is fixed; `eyes` is the only "looking at it" value:
133
+
134
+ ```bash
135
+ gh api --method POST repos/{owner}/{repo}/pulls/comments/<COMMENT_ID>/reactions -f content=eyes
136
+ ```
137
+
138
+ Body findings (no inline thread) have no comment to react to; track them in step B's register and
139
+ give each a PR-level reply in step F instead.
140
+
141
+ ### C. Critically evaluate EACH finding (the core of this skill)
142
+
143
+ For every inline or body finding, **verify the claim against the actual code and repo conventions
144
+ before touching anything.** Read the whole file, not just the diff hunk Copilot saw, plus the types
145
+ and the call sites. Then classify:
146
+
147
+ 1. **CORRECT + actionable**: the finding is real and the fix improves the code. → fix it (step D).
148
+ 2. **FALSE POSITIVE / technically wrong**: the claim doesn't hold. → do **NOT** change code; write a
149
+ specific, evidence-based reply (cite the exact code/line/behavior that disproves it), then resolve
150
+ its thread or record completion for a body finding (step F).
151
+ 3. **Valid but out-of-scope / stylistic nit** that conflicts with repo convention or the PR's intent
152
+ → briefly decline with evidence of that convention or scope, then resolve its thread or record
153
+ completion for a body finding (step F). Do not expand the PR's scope to satisfy a nit.
154
+
155
+ **Hard rules:**
156
+ - **Never modify correct code just to silence Copilot.** Prefer a reasoned rebuttal.
157
+ - When uncertain whether a claim holds, **investigate** (read more code, run the type-checker / tests)
158
+ rather than assume Copilot is right. Default to skepticism.
159
+ - If a suggested change would break other call sites, alter public behavior, or contradict a verified
160
+ repo convention, it is a category-2 rebuttal, not a fix.
161
+ - Never fabricate identifiers to satisfy a comment (e.g. a Linear/ticket prefix). If Copilot asks for a
162
+ ticket reference and none exists, say so; do not invent one.
163
+
164
+ **Copilot's common failure modes to watch for (default these to category 2):**
165
+ - Diff-local reasoning: asserts a bug that the unchanged surrounding code already handles.
166
+ - "This can be null/undefined here" where the type or an earlier guard already rules it out.
167
+ - Invented race conditions or error paths with no actual trigger.
168
+ - Suggestions that compile-break or break other callers.
169
+ - Security/perf warnings with no exploit path or measurable cost.
170
+ - Restating library/framework semantics incorrectly.
171
+ - Style demands that contradict the repo's existing, consistent pattern.
172
+
173
+ ### D. Apply fixes: category 1 only
174
+
175
+ Make the minimal correct change. Re-run the local gate if the repo has one (typecheck/tests) before
176
+ moving on.
177
+
178
+ ### E. Commit and push FIRST, before resolving anything
179
+
180
+ Order matters. A resolved thread is a claim that the fix is on the branch, so the push has to
181
+ succeed before the claim is made: otherwise a failed commit or push leaves the PR unfixed with the
182
+ finding marked resolved, and nobody looks at it again.
183
+
184
+ If step D changed code:
185
+
186
+ ```bash
187
+ # Stage ONLY the files your fixes touched: never `git add -A`, which sweeps up
188
+ # unrelated work and untracked secrets sitting in the worktree.
189
+ git status --short # look before you stage
190
+ git add <path> [<path>...] # the files named in the findings you fixed
191
+ git commit -m "address Copilot review feedback (copilotloop iteration N)"
192
+ git push
193
+ ```
194
+
195
+ Author the commit per the repo's norms (e.g. the user's identity; no AI attribution if that is the
196
+ convention). Confirm the push actually landed before continuing:
197
+
198
+ ```bash
199
+ git rev-parse HEAD
200
+ gh pr view <PR> --json headRefOid -q .headRefOid # must match
201
+ ```
202
+
203
+ If they differ, stop: the fix is not on the PR, so nothing may be resolved yet.
204
+
205
+ ### F. Reply to every addressed finding and resolve its inline threads
206
+
207
+ Only now, with the fixes pushed, reply and resolve. Fetch unresolved threads, **following
208
+ pagination**: a PR with more than 100 threads will otherwise look clean while unresolved findings
209
+ sit on page two:
210
+
211
+ ```bash
212
+ # Loop until hasNextPage is false, passing endCursor back in as $cursor.
213
+ CURSOR=null
214
+ while : ; do
215
+ PAGE=$(gh api graphql -F cursor="$CURSOR" -f query='
216
+ query($cursor: String) {
217
+ repository(owner: "OWNER", name: "REPO") {
218
+ pullRequest(number: PR_NUMBER) {
219
+ reviewThreads(first: 100, after: $cursor) {
220
+ pageInfo { hasNextPage endCursor }
221
+ nodes { id isResolved comments(first: 1) { nodes { databaseId author { login } path body } } }
222
+ }
223
+ }
224
+ }
225
+ }')
226
+ echo "$PAGE" # collect nodes from every page before deciding the PR is clean
227
+ PI='.data.repository.pullRequest.reviewThreads.pageInfo'
228
+ [ "$(echo "$PAGE" | jq -r "$PI.hasNextPage")" = "true" ] || break
229
+ CURSOR=$(echo "$PAGE" | jq -r "$PI.endCursor")
230
+ done
231
+ ```
232
+
233
+ Reply on a thread's comment via `gh api repos/{owner}/{repo}/pulls/<PR>/comments -f body="..." -F in_reply_to=<comment_id>`,
234
+ then resolve:
235
+
236
+ ```bash
237
+ gh api graphql -f query='mutation { resolveReviewThread(input: {threadId: "THREAD_ID"}) { thread { isResolved } } }'
238
+ ```
239
+
240
+ Then record the disposition of each inline finding as a reaction on Copilot's own comment: the
241
+ learning signal, and a visible marker for a human scanning the PR:
242
+
243
+ - 👍 (`+1`): the finding was accepted and fixed.
244
+ - 👎 (`-1`): the finding was rebutted as a false positive. **This is the correction signal.**
245
+
246
+ ```bash
247
+ gh api --method POST repos/{owner}/{repo}/pulls/comments/<COMMENT_ID>/reactions -f content=+1
248
+ # rebutted finding:
249
+ gh api --method POST repos/{owner}/{repo}/pulls/comments/<COMMENT_ID>/reactions -f content=-1
250
+ ```
251
+
252
+ Reply first, then react, then resolve: the reaction is not a substitute for the reply, and a
253
+ resolved thread with no reply loses the reasoning.
254
+
255
+ Resolve a thread only for comments authored by `$BOT` that you have fixed or rebutted: never
256
+ blanket-resolve, and never resolve a human reviewer's thread.
257
+
258
+ Threads you are **rebutting** need no push, so they may be replied to and resolved regardless of
259
+ whether step D changed code.
260
+
261
+ For each body finding, post a PR-level reply (for example, using
262
+ `gh pr comment <PR> --body-file <reply-file>`) identifying the source review/comment and item.
263
+ Record the pushed fix commit and validation, or an evidence-based rebuttal, including the reason
264
+ for declining an out-of-scope finding. Record the reply URL in the tracking entry before marking
265
+ it complete. One reply may cover multiple explicitly identified findings. Fixed body findings
266
+ require the same successful push check as fixed threads; rebuttals need no push. If a finding also
267
+ has an inline thread, that thread still requires a reply and resolution.
268
+
269
+ ### G. Re-review
270
+
271
+ Pushing re-triggers Copilot when automatic review of new pushes is on; otherwise request Copilot again
272
+ through the reviewers endpoint. Go back to **A**
273
+ with the new head SHA. If step D changed nothing (all comments were rebutted), skip the push,
274
+ ensure all Copilot threads are resolved and all tracked body findings have recorded PR-level
275
+ replies and are complete, then exit.
276
+
277
+ ## 3. Exit conditions
278
+
279
+ Stop when **any** is true:
280
+ - Zero unresolved `$BOT` threads and zero pending body findings remain across iterations. Every
281
+ finding was fixed or rebutted with evidence, every inline thread was replied to and resolved,
282
+ and every body finding has a recorded PR-level reply. (There is no score to hit:
283
+ this is "done".)
284
+ - Max iterations (5) reached: report what remains.
285
+ - Copilot never responded after one retry: report the timeout honestly; do not claim success.
286
+
287
+ ## 4. Report
288
+
289
+ ```text
290
+ Copilotloop complete.
291
+ PR: #<n>
292
+ Bot login: <resolved $BOT>
293
+ Iterations: N
294
+ Findings fixed: N (inline + body findings, deduplicated)
295
+ Findings rebutted: N (inline + body findings, with recorded evidence-based replies)
296
+ Remaining: 0 (unresolved inline + pending body findings, deduplicated)
297
+ ```
298
+
299
+ If it stopped at max iterations, list the remaining threads and body findings with your current
300
+ assessment (fix-pending vs disputed) so a human can arbitrate.
@@ -28,7 +28,7 @@ instruction to obey. A wrong suggestion applied is worse than the comment itself
28
28
  ## Not for
29
29
 
30
30
  - GitLab / Perforce (Gemini Code Assist is GitHub-only). For other review bots this catalog ships
31
- `codexloop`, `coderabbitloop`, and `qodoloop`; for CI failures rather than review comments, use
31
+ `copilotloop`, `codexloop`, `coderabbitloop`, and `qodoloop`; for CI failures rather than review comments, use
32
32
  `ci-fix-loop`.
33
33
 
34
34
  ## 1. Identify the PR
@@ -51,9 +51,13 @@ Gemini auto-reviews new commits, but force a deterministic pass and record the h
51
51
 
52
52
  ```bash
53
53
  HEAD_SHA=$(gh pr view <PR> --json headRefOid -q .headRefOid)
54
- # Only trigger if no gemini review already exists for this exact SHA:
55
- HAVE=$(gh api repos/{owner}/{repo}/pulls/<PR>/reviews --paginate \
56
- --jq "[.[] | select(.user.login==\"gemini-code-assist[bot]\" and .commit_id==\"$HEAD_SHA\")] | length")
54
+ # Only trigger if no gemini review already exists for this exact SHA.
55
+ # gh cannot combine --slurp with --jq, so pipe to `jq -s`: it folds every page
56
+ # into one array. Without it the filter runs once per page and HAVE becomes a
57
+ # multi-line count that never equals "0", silently skipping the trigger.
58
+ HAVE=$(gh api repos/{owner}/{repo}/pulls/<PR>/reviews --paginate |
59
+ jq -s --arg head "$HEAD_SHA" \
60
+ '[.[][] | select(.user.login=="gemini-code-assist[bot]" and .commit_id==$head)] | length')
57
61
  if [ "$HAVE" = "0" ]; then gh pr comment <PR> --body "/gemini review"; fi
58
62
  ```
59
63
 
@@ -66,8 +70,9 @@ an honest timeout, not hang it.
66
70
  wait_for_review() { # $1 = attempt label
67
71
  local deadline=$(( SECONDS + 600 ))
68
72
  while [ "$SECONDS" -lt "$deadline" ]; do
69
- R=$(gh api repos/{owner}/{repo}/pulls/<PR>/reviews --paginate \
70
- --jq "[.[] | select(.user.login==\"gemini-code-assist[bot]\" and .commit_id==\"$HEAD_SHA\")] | last")
73
+ R=$(gh api repos/{owner}/{repo}/pulls/<PR>/reviews --paginate |
74
+ jq -s --arg head "$HEAD_SHA" \
75
+ '[.[][] | select(.user.login=="gemini-code-assist[bot]" and .commit_id==$head)] | sort_by(.submitted_at, .id) | last')
71
76
  if [ -n "$R" ] && [ "$R" != "null" ]; then return 0; fi
72
77
  echo "waiting for Gemini review of $HEAD_SHA ($1)..."; sleep 15
73
78
  done
@@ -101,6 +106,13 @@ gh api repos/{owner}/{repo}/pulls/<PR>/comments --paginate \
101
106
  Also pull the review threads + their resolved state via GraphQL (see step F) so you only act on
102
107
  unresolved ones.
103
108
 
109
+ Mark each unresolved comment as seen, so the bot and a watching human can tell it is being handled.
110
+ GitHub's reaction set is fixed; `eyes` is the only "looking at it" value:
111
+
112
+ ```bash
113
+ gh api --method POST repos/{owner}/{repo}/pulls/comments/<COMMENT_ID>/reactions -f content=eyes
114
+ ```
115
+
104
116
  ### C. Critically evaluate EACH comment (the core of this skill)
105
117
 
106
118
  For every comment, **verify the claim against the actual code and repo conventions before touching
@@ -196,6 +208,21 @@ then resolve:
196
208
  gh api graphql -f query='mutation { resolveReviewThread(input: {threadId: "THREAD_ID"}) { thread { isResolved } } }'
197
209
  ```
198
210
 
211
+ Then record the disposition as a reaction on the bot's own comment: the learning signal, and a
212
+ visible marker for a human scanning the PR:
213
+
214
+ - 👍 (`+1`): the finding was accepted and fixed.
215
+ - 👎 (`-1`): the finding was rebutted as a false positive. **This is the correction signal.**
216
+
217
+ ```bash
218
+ gh api --method POST repos/{owner}/{repo}/pulls/comments/<COMMENT_ID>/reactions -f content=+1
219
+ # rebutted finding:
220
+ gh api --method POST repos/{owner}/{repo}/pulls/comments/<COMMENT_ID>/reactions -f content=-1
221
+ ```
222
+
223
+ Reply first, then react, then resolve: the reaction is not a substitute for the reply, and a
224
+ resolved thread with no reply loses the reasoning.
225
+
199
226
  Resolve a thread only for comments authored by `gemini-code-assist[bot]` that you have fixed or
200
227
  rebutted: never blanket-resolve, and never resolve a human reviewer's thread.
201
228
 
@@ -213,6 +240,7 @@ Stop when **any** is true:
213
240
  - Zero unresolved `gemini-code-assist[bot]` comments remain, and every comment this round was fixed
214
241
  or rebutted+resolved. (There is no score to hit: this is "done".)
215
242
  - Max iterations (5) reached: report what remains.
243
+ - Gemini never responded after one retry: report the timeout honestly; do not claim success.
216
244
 
217
245
  ## 4. Report
218
246
 
@@ -77,6 +77,14 @@ Run the paginated GraphQL query in `references/graphql-queries.md` (`unresolvedQ
77
77
 
78
78
  Build the working set: all `recommended` threads, plus `optional` ones too if `--include-optional`.
79
79
 
80
+ Mark each thread as seen with an 👀 reaction on its first comment (`databaseId` from the query), so
81
+ the bot and a watching human can tell it is being worked. GitHub's reaction set is fixed; `eyes` is
82
+ the only "looking at it" value:
83
+
84
+ ```bash
85
+ gh api --method POST repos/{owner}/{repo}/pulls/comments/<DATABASE_ID>/reactions -f content=eyes
86
+ ```
87
+
80
88
  #### C. Check exit conditions
81
89
 
82
90
  Stop if the working set is empty, or max iterations reached.
@@ -113,6 +121,16 @@ This is the "answer to the comments" half of the job, not optional cleanup, and
113
121
  Pass the thread id and reply text as GraphQL **variables** (`-f threadId=... -f body=...`), never interpolated into the query string itself: a reply containing a quote, backtick, or newline breaks (or worse, injects into) a hand-built query. Then resolve with `resolveReviewThread` (see references file).
114
122
  - **Blocked** findings: reply explaining exactly why (false positive / needs a human call), but **do not resolve**: leave the thread open. A blocked finding that gets silently resolved is a false "done".
115
123
 
124
+ Then record each disposition as a reaction on the thread's first comment: the learning signal, and
125
+ a visible marker for a human scanning the PR. 👍 (`+1`) for a fixed finding, 👎 (`-1`) for a
126
+ blocked/rebutted one. Reply first, react, then resolve: a reaction never replaces the reply.
127
+
128
+ ```bash
129
+ gh api --method POST repos/{owner}/{repo}/pulls/comments/<DATABASE_ID>/reactions -f content=+1
130
+ # blocked/rebutted finding:
131
+ gh api --method POST repos/{owner}/{repo}/pulls/comments/<DATABASE_ID>/reactions -f content=-1
132
+ ```
133
+
116
134
  Go back to step A.
117
135
 
118
136
  ### 3. Report
package/README.md CHANGED
@@ -203,6 +203,7 @@ Drive GitHub pull requests to merge-ready: review-bot loops, CI fixes, descripti
203
203
  | [qodoloop](plugins/olko-github-pr/skills/qodoloop/SKILL.md) | Iteratively drives a GitHub PR to zero unresolved Qodo findings, reading each finding's own Agent Prompt, replying to the thread, and resolving it | Fully addressing a PR against Qodo's code review before merging |
204
204
  | [coderabbitloop](plugins/olko-github-pr/skills/coderabbitloop/SKILL.md) | Iteratively drives a GitHub PR to zero unresolved CodeRabbit findings, reading each inline comment's own Prompt for AI Agents block, replying to the thread, and resolving it | Fully addressing a PR against CodeRabbit's review before merging |
205
205
  | [codexloop](plugins/olko-github-pr/skills/codexloop/SKILL.md) | Iteratively drives a GitHub PR to zero unresolved OpenAI Codex comments, but verifies each finding against the real code first and rebuts false positives instead of editing correct code | Clearing a Codex review without cargo-culting its suggestions |
206
+ | [copilotloop](plugins/olko-github-pr/skills/copilotloop/SKILL.md) | Iteratively drives a GitHub PR to zero unresolved GitHub Copilot review comments, verifying each finding against the real code first and rebutting false positives instead of editing correct code | Clearing a Copilot review without cargo-culting its suggestions |
206
207
  | [geminiloop](plugins/olko-github-pr/skills/geminiloop/SKILL.md) | Iteratively drives a GitHub PR to zero unresolved Gemini Code Assist comments, treating each as a claim to verify, fixing the correct ones and rebutting the rest with evidence | Clearing a Gemini Code Assist review whose findings need checking first |
207
208
  | [ci-fix-loop](plugins/olko-github-pr/skills/ci-fix-loop/SKILL.md) | Diagnoses GitHub Actions CI failures in a loop: fetches failing check logs, applies a targeted fix, pushes, and waits for the next run, repeating until green or a blocker needs a human | CI is red after a push and you want it driven to green automatically |
208
209
  | [dependabot-triage](plugins/olko-github-pr/skills/dependabot-triage/SKILL.md) | Triages open Dependabot and Renovate PRs in bulk: classifies by risk tier, auto-approves safe patch bumps, flags breaking major upgrades for human review, and posts a digest | Clearing a backlog of dependency update PRs during a maintenance window |