@olegkoval/agent-skills 1.25.0 → 1.26.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 (66) hide show
  1. package/.claude-plugin/plugin.json +8 -2
  2. package/.cursor-plugin/index.json +30 -0
  3. package/.grok-plugin/index.json +30 -0
  4. package/.kiro/steering/codexloop.md +254 -0
  5. package/.kiro/steering/geminiloop.md +230 -0
  6. package/.kiro/steering/pr-finalize-complete.md +187 -0
  7. package/.windsurf/rules/codexloop.md +253 -0
  8. package/.windsurf/rules/geminiloop.md +229 -0
  9. package/.windsurf/rules/pr-finalize-complete.md +186 -0
  10. package/README.md +9 -3
  11. package/catalog/skills.json +146 -0
  12. package/package.json +1 -1
  13. package/packages/software-development/codexloop/SKILL.md +261 -0
  14. package/packages/software-development/codexloop/adapters/claude/plugin.json +5 -0
  15. package/packages/software-development/codexloop/adapters/claude/skills/codexloop/SKILL.md +262 -0
  16. package/packages/software-development/codexloop/adapters/codex/README.md +26 -0
  17. package/packages/software-development/codexloop/adapters/cursor/plugin.json +6 -0
  18. package/packages/software-development/codexloop/adapters/cursor/skills/codexloop/SKILL.md +263 -0
  19. package/packages/software-development/codexloop/adapters/grok/plugin.json +6 -0
  20. package/packages/software-development/codexloop/adapters/grok/skills/codexloop/SKILL.md +262 -0
  21. package/packages/software-development/codexloop/adapters/kiro/steering/codexloop.md +254 -0
  22. package/packages/software-development/codexloop/adapters/windsurf/rules/codexloop.md +253 -0
  23. package/packages/software-development/dependabot-triage/SKILL.md +150 -0
  24. package/packages/software-development/dependabot-triage/adapters/claude/plugin.json +5 -0
  25. package/packages/software-development/dependabot-triage/adapters/claude/skills/dependabot-triage/SKILL.md +151 -0
  26. package/packages/software-development/dependabot-triage/adapters/codex/README.md +19 -0
  27. package/packages/software-development/dependabot-triage/adapters/cursor/plugin.json +6 -0
  28. package/packages/software-development/dependabot-triage/adapters/cursor/skills/dependabot-triage/SKILL.md +151 -0
  29. package/packages/software-development/dependabot-triage/adapters/grok/plugin.json +6 -0
  30. package/packages/software-development/dependabot-triage/adapters/grok/skills/dependabot-triage/SKILL.md +151 -0
  31. package/packages/software-development/geminiloop/SKILL.md +237 -0
  32. package/packages/software-development/geminiloop/adapters/claude/plugin.json +5 -0
  33. package/packages/software-development/geminiloop/adapters/claude/skills/geminiloop/SKILL.md +238 -0
  34. package/packages/software-development/geminiloop/adapters/codex/README.md +25 -0
  35. package/packages/software-development/geminiloop/adapters/cursor/plugin.json +6 -0
  36. package/packages/software-development/geminiloop/adapters/cursor/skills/geminiloop/SKILL.md +239 -0
  37. package/packages/software-development/geminiloop/adapters/grok/plugin.json +6 -0
  38. package/packages/software-development/geminiloop/adapters/grok/skills/geminiloop/SKILL.md +238 -0
  39. package/packages/software-development/geminiloop/adapters/kiro/steering/geminiloop.md +230 -0
  40. package/packages/software-development/geminiloop/adapters/windsurf/rules/geminiloop.md +229 -0
  41. package/packages/software-development/pr-finalize-complete/SKILL.md +195 -0
  42. package/packages/software-development/pr-finalize-complete/adapters/claude/plugin.json +5 -0
  43. package/packages/software-development/pr-finalize-complete/adapters/claude/skills/pr-finalize-complete/SKILL.md +196 -0
  44. package/packages/software-development/pr-finalize-complete/adapters/codex/README.md +24 -0
  45. package/packages/software-development/pr-finalize-complete/adapters/cursor/plugin.json +6 -0
  46. package/packages/software-development/pr-finalize-complete/adapters/cursor/skills/pr-finalize-complete/SKILL.md +197 -0
  47. package/packages/software-development/pr-finalize-complete/adapters/grok/plugin.json +6 -0
  48. package/packages/software-development/pr-finalize-complete/adapters/grok/skills/pr-finalize-complete/SKILL.md +196 -0
  49. package/packages/software-development/pr-finalize-complete/adapters/kiro/steering/pr-finalize-complete.md +187 -0
  50. package/packages/software-development/pr-finalize-complete/adapters/windsurf/rules/pr-finalize-complete.md +186 -0
  51. package/packages/software-development/pr-to-green/SKILL.md +165 -0
  52. package/packages/software-development/pr-to-green/adapters/claude/plugin.json +5 -0
  53. package/packages/software-development/pr-to-green/adapters/claude/skills/pr-to-green/SKILL.md +166 -0
  54. package/packages/software-development/pr-to-green/adapters/codex/README.md +19 -0
  55. package/packages/software-development/pr-to-green/adapters/cursor/plugin.json +6 -0
  56. package/packages/software-development/pr-to-green/adapters/cursor/skills/pr-to-green/SKILL.md +166 -0
  57. package/packages/software-development/pr-to-green/adapters/grok/plugin.json +6 -0
  58. package/packages/software-development/pr-to-green/adapters/grok/skills/pr-to-green/SKILL.md +166 -0
  59. package/packages/software-development/store-listing-copy/SKILL.md +215 -0
  60. package/packages/software-development/store-listing-copy/adapters/claude/plugin.json +5 -0
  61. package/packages/software-development/store-listing-copy/adapters/claude/skills/store-listing-copy/SKILL.md +216 -0
  62. package/packages/software-development/store-listing-copy/adapters/codex/README.md +20 -0
  63. package/packages/software-development/store-listing-copy/adapters/cursor/plugin.json +6 -0
  64. package/packages/software-development/store-listing-copy/adapters/cursor/skills/store-listing-copy/SKILL.md +216 -0
  65. package/packages/software-development/store-listing-copy/adapters/grok/plugin.json +6 -0
  66. package/packages/software-development/store-listing-copy/adapters/grok/skills/store-listing-copy/SKILL.md +216 -0
@@ -0,0 +1,262 @@
1
+ ---
2
+ name: codexloop
3
+ description: >
4
+ Iteratively satisfy OpenAI Codex's code review on a GitHub PR, but treat every Codex comment
5
+ SKEPTICALLY: verify each finding against the real code first, fix ONLY the genuinely-correct
6
+ ones, and rebut + resolve false positives WITHOUT changing correct code. Repeat until no
7
+ unresolved Codex comments remain. Use when the user says "satisfy codex", "clear the codex
8
+ review", "fix codex comments", "codex loop", or wants to iterate on Codex PR review feedback.
9
+ compatibility: GitHub only (Codex code review is a GitHub app). Requires git + gh (GitHub CLI) authenticated, and the Codex / ChatGPT connector app installed on the repo with code review enabled.
10
+ metadata:
11
+ version: "1.0"
12
+ allowed-tools: Bash(gh:*) Bash(git:*)
13
+ ---
14
+ <!-- Generated by scripts/build-adapters.sh. Do not edit directly. -->
15
+
16
+ # Codexloop
17
+
18
+ Drive a GitHub PR until Codex has no unresolved review comments — **but do not cargo-cult its
19
+ suggestions.** Every comment is a *claim to verify*, not an instruction to obey. A wrong
20
+ suggestion applied is worse than the comment itself.
21
+
22
+ ## How Codex differs from Greptile / Gemini
23
+
24
+ - **No check-run, no score.** Codex does not publish an `X/5` confidence or a named check. It posts
25
+ a **PR review** (state `COMMENTED`) plus inline review comments. Detection is by polling the
26
+ *reviews* endpoint. "Satisfied" = zero unresolved comments (each either fixed or rebutted).
27
+ - **Trigger phrase is `@codex review`.** Codex reviews automatically when a PR opens or gets new
28
+ commits if auto-review is enabled on the repo; the mention forces a fresh pass. Other useful
29
+ mentions: `@codex review focus on <area>` for a scoped re-review.
30
+ - **Priority, not confidence.** Codex findings usually lead with a severity/priority word (`P1`,
31
+ `P2`, `P3` or `critical`/`major`/`minor`) or a short titled heading. Weight the top tier
32
+ seriously; treat the bottom tier as usually-skippable nits unless clearly correct.
33
+ - **Codex is terse and often reasons from the diff alone.** Its characteristic failure is
34
+ confidently asserting a bug based only on the changed hunk, without the surrounding file or the
35
+ call sites. That makes "read the whole file before believing it" the single highest-value check.
36
+
37
+ ## Not for
38
+
39
+ - GitLab / Perforce (Codex code review is a GitHub app). For other review bots this catalog ships
40
+ `geminiloop`, `coderabbitloop`, and `qodoloop`; for CI failures rather than review comments, use
41
+ `ci-fix-loop`.
42
+
43
+ ## 0. Resolve the Codex bot login (do this first, do not hardcode)
44
+
45
+ The connector's bot login varies by installation, so discover it from the PR rather than
46
+ assuming it:
47
+
48
+ ```bash
49
+ gh api repos/{owner}/{repo}/pulls/<PR>/reviews --paginate --jq '.[].user.login' | sort -u
50
+ gh api repos/{owner}/{repo}/pulls/<PR>/comments --paginate --jq '.[].user.login' | sort -u
51
+ ```
52
+
53
+ Pick the login matching `*codex*` (commonly `chatgpt-codex-connector[bot]`, sometimes
54
+ `codex[bot]`) and export it as `BOT`.
55
+
56
+ **Finding nothing here is NOT a stop condition.** On a PR Codex has never reviewed there is no bot
57
+ login to find yet — that is the normal starting state, not a missing app. When the probe comes back
58
+ empty, fall through to step 2A, post `@codex review`, and re-run this probe once a review lands;
59
+ until then match any login containing `codex` when polling. Only conclude the app is absent after
60
+ step 2A's bounded wait has expired with no review and no codex-like login anywhere on the PR — and
61
+ then say so and stop, rather than looping against nothing.
62
+
63
+ ## 1. Identify the PR
64
+
65
+ ```bash
66
+ gh pr view --json number,headRefName,headRefOid -q '{number,branch:.headRefName,head:.headRefOid}'
67
+ ```
68
+
69
+ Switch to the PR branch if not already on it. Capture `OWNER`/`REPO` (`gh repo view --json owner,name`).
70
+
71
+ ## 2. The loop (max 5 iterations)
72
+
73
+ Keep an explicit iteration counter and stop at 5 — the cap is a real bound to enforce, not a
74
+ figure of speech. Each pass through A–G is one iteration; on hitting the cap, go straight to the
75
+ report and list what is still unresolved rather than starting a sixth.
76
+
77
+ ### A. Ensure a fresh Codex review on the current head
78
+
79
+ ```bash
80
+ HEAD_SHA=$(gh pr view <PR> --json headRefOid -q .headRefOid)
81
+ # Only trigger if no Codex review already exists for this exact SHA:
82
+ HAVE=$(gh api repos/{owner}/{repo}/pulls/<PR>/reviews --paginate \
83
+ --jq "[.[] | select(.user.login==\"$BOT\" and .commit_id==\"$HEAD_SHA\")] | length")
84
+ if [ "$HAVE" = "0" ]; then gh pr comment <PR> --body "@codex review"; fi
85
+ ```
86
+
87
+ Poll for the review of THIS head to land. No check-run exists, so poll the reviews endpoint — and
88
+ poll it on a **deadline**, never `while true`: a review that never arrives must end the skill with
89
+ an honest timeout, not hang it.
90
+
91
+ ```bash
92
+ # 10-minute deadline, one retry, then give up. DEADLINE/RETRIES are the
93
+ # enforcement of the bounds this skill claims — do not drop them.
94
+ wait_for_review() { # $1 = attempt label
95
+ local deadline=$(( SECONDS + 600 ))
96
+ while [ "$SECONDS" -lt "$deadline" ]; do
97
+ R=$(gh api repos/{owner}/{repo}/pulls/<PR>/reviews --paginate \
98
+ --jq "[.[] | select(.user.login==\"$BOT\" and .commit_id==\"$HEAD_SHA\")] | last")
99
+ if [ -n "$R" ] && [ "$R" != "null" ]; then return 0; fi
100
+ echo "waiting for Codex review of $HEAD_SHA ($1)..."; sleep 15
101
+ done
102
+ return 1
103
+ }
104
+
105
+ if ! wait_for_review "first wait"; then
106
+ echo "no Codex review after 10m — retrying once" # say the retry out loud
107
+ gh pr comment <PR> --body "@codex review"
108
+ if ! wait_for_review "after retry"; then
109
+ echo "Codex did not review $HEAD_SHA after a retry; stopping and reporting."
110
+ exit 1 # honest timeout, never a success claim
111
+ fi
112
+ fi
113
+ ```
114
+
115
+ Codex can take several minutes on a large diff, which is why the deadline is generous. Report the
116
+ retry in the final summary; two silent timeouts are the failure mode this guard exists to prevent.
117
+
118
+ ### B. Fetch the findings
119
+
120
+ - **Summary**: the review `.body` from the object above — read the overall take and the priority
121
+ spread.
122
+ - **Unresolved inline comments** on the current head:
123
+
124
+ ```bash
125
+ gh api repos/{owner}/{repo}/pulls/<PR>/comments --paginate \
126
+ --jq ".[] | select(.user.login==\"$BOT\") | {id, path, line, body}"
127
+ ```
128
+
129
+ Also pull the review threads + their resolved state via GraphQL (see step F) so you only act on
130
+ unresolved ones.
131
+
132
+ ### C. Critically evaluate EACH comment (the core of this skill)
133
+
134
+ For every comment, **verify the claim against the actual code and repo conventions before touching
135
+ anything.** Read the whole file — not just the diff hunk Codex saw — plus the types and the call
136
+ sites. Then classify:
137
+
138
+ 1. **CORRECT + actionable** — the finding is real and the fix improves the code. → fix it (step D).
139
+ 2. **FALSE POSITIVE / technically wrong** — the claim doesn't hold. → do **NOT** change code; write a
140
+ specific, evidence-based reply (cite the exact code/line/behavior that disproves it), then resolve.
141
+ 3. **Valid but out-of-scope / stylistic nit** that conflicts with repo convention or the PR's intent
142
+ → briefly decline with a reason, then resolve. Do not expand the PR's scope to satisfy a nit.
143
+
144
+ **Hard rules:**
145
+ - **Never modify correct code just to silence Codex.** Prefer a reasoned rebuttal.
146
+ - When uncertain whether a claim holds, **investigate** (read more code, run the type-checker / tests)
147
+ rather than assume Codex is right. Default to skepticism.
148
+ - If a suggested change would break other call sites, alter public behavior, or contradict a verified
149
+ repo convention, it is a category-2 rebuttal, not a fix.
150
+ - Never fabricate identifiers to satisfy a comment (e.g. a Linear/ticket prefix). If Codex asks for a
151
+ ticket reference and none exists, say so; do not invent one.
152
+
153
+ **Codex's common failure modes to watch for (default these to category 2):**
154
+ - Diff-local reasoning: asserts a bug that the unchanged surrounding code already handles.
155
+ - "This can be null/undefined here" where the type or an earlier guard already rules it out.
156
+ - Invented race conditions or error paths with no actual trigger.
157
+ - Suggestions that compile-break or break other callers.
158
+ - Security/perf warnings with no exploit path or measurable cost.
159
+ - Restating library/framework semantics incorrectly.
160
+ - Style demands that contradict the repo's existing, consistent pattern.
161
+
162
+ ### D. Apply fixes — category 1 only
163
+
164
+ Make the minimal correct change. Re-run the local gate if the repo has one (typecheck/tests) before
165
+ moving on.
166
+
167
+ ### E. Commit and push FIRST, before resolving anything
168
+
169
+ Order matters. A resolved thread is a claim that the fix is on the branch, so the push has to
170
+ succeed before the claim is made — otherwise a failed commit or push leaves the PR unfixed with the
171
+ finding marked resolved, and nobody looks at it again.
172
+
173
+ If step D changed code:
174
+
175
+ ```bash
176
+ # Stage ONLY the files your fixes touched — never `git add -A`, which sweeps up
177
+ # unrelated work and untracked secrets sitting in the worktree.
178
+ git status --short # look before you stage
179
+ git add <path> [<path>...] # the files named in the findings you fixed
180
+ git commit -m "address codex review feedback (codexloop iteration N)"
181
+ git push
182
+ ```
183
+
184
+ Author the commit per the repo's norms (e.g. the user's identity; no AI attribution if that is the
185
+ convention). Confirm the push actually landed before continuing:
186
+
187
+ ```bash
188
+ git rev-parse HEAD
189
+ gh pr view <PR> --json headRefOid -q .headRefOid # must match
190
+ ```
191
+
192
+ If they differ, stop: the fix is not on the PR, so nothing may be resolved yet.
193
+
194
+ ### F. Reply to and resolve every addressed thread
195
+
196
+ Only now, with the fixes pushed, reply and resolve. Fetch unresolved threads, **following
197
+ pagination** — a PR with more than 100 threads will otherwise look clean while unresolved findings
198
+ sit on page two:
199
+
200
+ ```bash
201
+ # Loop until hasNextPage is false, passing endCursor back in as $cursor.
202
+ CURSOR=null
203
+ while : ; do
204
+ PAGE=$(gh api graphql -F cursor="$CURSOR" -f query='
205
+ query($cursor: String) {
206
+ repository(owner: "OWNER", name: "REPO") {
207
+ pullRequest(number: PR_NUMBER) {
208
+ reviewThreads(first: 100, after: $cursor) {
209
+ pageInfo { hasNextPage endCursor }
210
+ nodes { id isResolved comments(first: 1) { nodes { databaseId author { login } path body } } }
211
+ }
212
+ }
213
+ }
214
+ }')
215
+ echo "$PAGE" # collect nodes from every page before deciding the PR is clean
216
+ PI='.data.repository.pullRequest.reviewThreads.pageInfo'
217
+ [ "$(echo "$PAGE" | jq -r "$PI.hasNextPage")" = "true" ] || break
218
+ CURSOR=$(echo "$PAGE" | jq -r "$PI.endCursor")
219
+ done
220
+ ```
221
+
222
+ Reply on a thread's comment via `gh api repos/{owner}/{repo}/pulls/<PR>/comments -f body="..." -F in_reply_to=<comment_id>`,
223
+ then resolve:
224
+
225
+ ```bash
226
+ gh api graphql -f query='mutation { resolveReviewThread(input: {threadId: "THREAD_ID"}) { thread { isResolved } } }'
227
+ ```
228
+
229
+ Resolve a thread only for comments authored by `$BOT` that you have fixed or rebutted — never
230
+ blanket-resolve, and never resolve a human reviewer's thread.
231
+
232
+ Threads you are **rebutting** need no push, so they may be replied to and resolved regardless of
233
+ whether step D changed code.
234
+
235
+ ### G. Re-review
236
+
237
+ Pushing re-triggers Codex when auto-review is on; otherwise post `@codex review`. Go back to **A**
238
+ with the new head SHA. If step D changed nothing (all comments were rebutted), skip the push,
239
+ ensure all threads are resolved, and exit.
240
+
241
+ ## 3. Exit conditions
242
+
243
+ Stop when **any** is true:
244
+ - Zero unresolved `$BOT` comments remain, and every comment this round was fixed or
245
+ rebutted+resolved. (There is no score to hit — this is "done".)
246
+ - Max iterations (5) reached — report what remains.
247
+ - Codex never responded after one retry — report the timeout honestly; do not claim success.
248
+
249
+ ## 4. Report
250
+
251
+ ```text
252
+ Codexloop complete.
253
+ PR: #<n>
254
+ Bot login: <resolved $BOT>
255
+ Iterations: N
256
+ Comments fixed: N (genuinely-correct findings)
257
+ Comments rebutted: N (false positives / nits, resolved with rationale)
258
+ Remaining: 0
259
+ ```
260
+
261
+ If it stopped at max iterations, list the remaining threads with your current assessment
262
+ (fix-pending vs disputed) so a human can arbitrate.
@@ -0,0 +1,26 @@
1
+ # Codex Adapter for codexloop
2
+
3
+ This is a Codex-specific adapter for the `olko:codexloop` skill.
4
+ The canonical skill definition is in `../../SKILL.md`.
5
+
6
+ ## Usage
7
+
8
+ Invoke in a Codex session:
9
+
10
+ ```
11
+ Use the olko:codexloop skill to clear the Codex review on this PR.
12
+ ```
13
+
14
+ ## Workflow
15
+
16
+ See `../../SKILL.md` for the full workflow: resolve the Codex bot login from the PR itself
17
+ (it varies by installation, so it is never hardcoded), post `@codex review` when no review exists
18
+ for the current head, poll the reviews endpoint until it lands, then evaluate every inline comment
19
+ against the real code before touching anything — fix only the findings that hold, rebut the rest
20
+ with evidence, reply to and resolve each thread, push, and repeat until clean or the iteration cap
21
+ is reached. The procedure is plain `git`/`gh` and is agent-agnostic.
22
+
23
+ Note the skill is deliberately skeptical: Codex reasons largely from the diff hunk, so its
24
+ characteristic failure is asserting a bug that the unchanged surrounding code already handles.
25
+ Reading the whole file and the call sites before accepting a finding is the point of the loop, and
26
+ a wrong suggestion applied is worse than the comment itself.
@@ -0,0 +1,6 @@
1
+ {
2
+ "name": "olko:codexloop",
3
+ "version": "0.1.0",
4
+ "description": "Iteratively drives a GitHub PR to zero unresolved OpenAI Codex review comments — but verifies every finding against the real code first, fixes only the correct ones, and rebuts false positives without changing correct code.",
5
+ "skills": "skills/"
6
+ }
@@ -0,0 +1,263 @@
1
+ ---
2
+ name: codexloop
3
+ description: >
4
+ Iteratively satisfy OpenAI Codex's code review on a GitHub PR, but treat every Codex comment
5
+ SKEPTICALLY: verify each finding against the real code first, fix ONLY the genuinely-correct
6
+ ones, and rebut + resolve false positives WITHOUT changing correct code. Repeat until no
7
+ unresolved Codex comments remain. Use when the user says "satisfy codex", "clear the codex
8
+ review", "fix codex comments", "codex loop", or wants to iterate on Codex PR review feedback.
9
+ compatibility: GitHub only (Codex code review is a GitHub app). Requires git + gh (GitHub CLI) authenticated, and the Codex / ChatGPT connector app installed on the repo with code review enabled.
10
+ metadata:
11
+ targets: ["cursor"]
12
+ version: "1.0"
13
+ allowed-tools: Bash(gh:*) Bash(git:*)
14
+ ---
15
+ <!-- Generated by scripts/build-adapters.sh. Do not edit directly. -->
16
+
17
+ # Codexloop
18
+
19
+ Drive a GitHub PR until Codex has no unresolved review comments — **but do not cargo-cult its
20
+ suggestions.** Every comment is a *claim to verify*, not an instruction to obey. A wrong
21
+ suggestion applied is worse than the comment itself.
22
+
23
+ ## How Codex differs from Greptile / Gemini
24
+
25
+ - **No check-run, no score.** Codex does not publish an `X/5` confidence or a named check. It posts
26
+ a **PR review** (state `COMMENTED`) plus inline review comments. Detection is by polling the
27
+ *reviews* endpoint. "Satisfied" = zero unresolved comments (each either fixed or rebutted).
28
+ - **Trigger phrase is `@codex review`.** Codex reviews automatically when a PR opens or gets new
29
+ commits if auto-review is enabled on the repo; the mention forces a fresh pass. Other useful
30
+ mentions: `@codex review focus on <area>` for a scoped re-review.
31
+ - **Priority, not confidence.** Codex findings usually lead with a severity/priority word (`P1`,
32
+ `P2`, `P3` or `critical`/`major`/`minor`) or a short titled heading. Weight the top tier
33
+ seriously; treat the bottom tier as usually-skippable nits unless clearly correct.
34
+ - **Codex is terse and often reasons from the diff alone.** Its characteristic failure is
35
+ confidently asserting a bug based only on the changed hunk, without the surrounding file or the
36
+ call sites. That makes "read the whole file before believing it" the single highest-value check.
37
+
38
+ ## Not for
39
+
40
+ - GitLab / Perforce (Codex code review is a GitHub app). For other review bots this catalog ships
41
+ `geminiloop`, `coderabbitloop`, and `qodoloop`; for CI failures rather than review comments, use
42
+ `ci-fix-loop`.
43
+
44
+ ## 0. Resolve the Codex bot login (do this first, do not hardcode)
45
+
46
+ The connector's bot login varies by installation, so discover it from the PR rather than
47
+ assuming it:
48
+
49
+ ```bash
50
+ gh api repos/{owner}/{repo}/pulls/<PR>/reviews --paginate --jq '.[].user.login' | sort -u
51
+ gh api repos/{owner}/{repo}/pulls/<PR>/comments --paginate --jq '.[].user.login' | sort -u
52
+ ```
53
+
54
+ Pick the login matching `*codex*` (commonly `chatgpt-codex-connector[bot]`, sometimes
55
+ `codex[bot]`) and export it as `BOT`.
56
+
57
+ **Finding nothing here is NOT a stop condition.** On a PR Codex has never reviewed there is no bot
58
+ login to find yet — that is the normal starting state, not a missing app. When the probe comes back
59
+ empty, fall through to step 2A, post `@codex review`, and re-run this probe once a review lands;
60
+ until then match any login containing `codex` when polling. Only conclude the app is absent after
61
+ step 2A's bounded wait has expired with no review and no codex-like login anywhere on the PR — and
62
+ then say so and stop, rather than looping against nothing.
63
+
64
+ ## 1. Identify the PR
65
+
66
+ ```bash
67
+ gh pr view --json number,headRefName,headRefOid -q '{number,branch:.headRefName,head:.headRefOid}'
68
+ ```
69
+
70
+ Switch to the PR branch if not already on it. Capture `OWNER`/`REPO` (`gh repo view --json owner,name`).
71
+
72
+ ## 2. The loop (max 5 iterations)
73
+
74
+ Keep an explicit iteration counter and stop at 5 — the cap is a real bound to enforce, not a
75
+ figure of speech. Each pass through A–G is one iteration; on hitting the cap, go straight to the
76
+ report and list what is still unresolved rather than starting a sixth.
77
+
78
+ ### A. Ensure a fresh Codex review on the current head
79
+
80
+ ```bash
81
+ HEAD_SHA=$(gh pr view <PR> --json headRefOid -q .headRefOid)
82
+ # Only trigger if no Codex review already exists for this exact SHA:
83
+ HAVE=$(gh api repos/{owner}/{repo}/pulls/<PR>/reviews --paginate \
84
+ --jq "[.[] | select(.user.login==\"$BOT\" and .commit_id==\"$HEAD_SHA\")] | length")
85
+ if [ "$HAVE" = "0" ]; then gh pr comment <PR> --body "@codex review"; fi
86
+ ```
87
+
88
+ Poll for the review of THIS head to land. No check-run exists, so poll the reviews endpoint — and
89
+ poll it on a **deadline**, never `while true`: a review that never arrives must end the skill with
90
+ an honest timeout, not hang it.
91
+
92
+ ```bash
93
+ # 10-minute deadline, one retry, then give up. DEADLINE/RETRIES are the
94
+ # enforcement of the bounds this skill claims — do not drop them.
95
+ wait_for_review() { # $1 = attempt label
96
+ local deadline=$(( SECONDS + 600 ))
97
+ while [ "$SECONDS" -lt "$deadline" ]; do
98
+ R=$(gh api repos/{owner}/{repo}/pulls/<PR>/reviews --paginate \
99
+ --jq "[.[] | select(.user.login==\"$BOT\" and .commit_id==\"$HEAD_SHA\")] | last")
100
+ if [ -n "$R" ] && [ "$R" != "null" ]; then return 0; fi
101
+ echo "waiting for Codex review of $HEAD_SHA ($1)..."; sleep 15
102
+ done
103
+ return 1
104
+ }
105
+
106
+ if ! wait_for_review "first wait"; then
107
+ echo "no Codex review after 10m — retrying once" # say the retry out loud
108
+ gh pr comment <PR> --body "@codex review"
109
+ if ! wait_for_review "after retry"; then
110
+ echo "Codex did not review $HEAD_SHA after a retry; stopping and reporting."
111
+ exit 1 # honest timeout, never a success claim
112
+ fi
113
+ fi
114
+ ```
115
+
116
+ Codex can take several minutes on a large diff, which is why the deadline is generous. Report the
117
+ retry in the final summary; two silent timeouts are the failure mode this guard exists to prevent.
118
+
119
+ ### B. Fetch the findings
120
+
121
+ - **Summary**: the review `.body` from the object above — read the overall take and the priority
122
+ spread.
123
+ - **Unresolved inline comments** on the current head:
124
+
125
+ ```bash
126
+ gh api repos/{owner}/{repo}/pulls/<PR>/comments --paginate \
127
+ --jq ".[] | select(.user.login==\"$BOT\") | {id, path, line, body}"
128
+ ```
129
+
130
+ Also pull the review threads + their resolved state via GraphQL (see step F) so you only act on
131
+ unresolved ones.
132
+
133
+ ### C. Critically evaluate EACH comment (the core of this skill)
134
+
135
+ For every comment, **verify the claim against the actual code and repo conventions before touching
136
+ anything.** Read the whole file — not just the diff hunk Codex saw — plus the types and the call
137
+ sites. Then classify:
138
+
139
+ 1. **CORRECT + actionable** — the finding is real and the fix improves the code. → fix it (step D).
140
+ 2. **FALSE POSITIVE / technically wrong** — the claim doesn't hold. → do **NOT** change code; write a
141
+ specific, evidence-based reply (cite the exact code/line/behavior that disproves it), then resolve.
142
+ 3. **Valid but out-of-scope / stylistic nit** that conflicts with repo convention or the PR's intent
143
+ → briefly decline with a reason, then resolve. Do not expand the PR's scope to satisfy a nit.
144
+
145
+ **Hard rules:**
146
+ - **Never modify correct code just to silence Codex.** Prefer a reasoned rebuttal.
147
+ - When uncertain whether a claim holds, **investigate** (read more code, run the type-checker / tests)
148
+ rather than assume Codex is right. Default to skepticism.
149
+ - If a suggested change would break other call sites, alter public behavior, or contradict a verified
150
+ repo convention, it is a category-2 rebuttal, not a fix.
151
+ - Never fabricate identifiers to satisfy a comment (e.g. a Linear/ticket prefix). If Codex asks for a
152
+ ticket reference and none exists, say so; do not invent one.
153
+
154
+ **Codex's common failure modes to watch for (default these to category 2):**
155
+ - Diff-local reasoning: asserts a bug that the unchanged surrounding code already handles.
156
+ - "This can be null/undefined here" where the type or an earlier guard already rules it out.
157
+ - Invented race conditions or error paths with no actual trigger.
158
+ - Suggestions that compile-break or break other callers.
159
+ - Security/perf warnings with no exploit path or measurable cost.
160
+ - Restating library/framework semantics incorrectly.
161
+ - Style demands that contradict the repo's existing, consistent pattern.
162
+
163
+ ### D. Apply fixes — category 1 only
164
+
165
+ Make the minimal correct change. Re-run the local gate if the repo has one (typecheck/tests) before
166
+ moving on.
167
+
168
+ ### E. Commit and push FIRST, before resolving anything
169
+
170
+ Order matters. A resolved thread is a claim that the fix is on the branch, so the push has to
171
+ succeed before the claim is made — otherwise a failed commit or push leaves the PR unfixed with the
172
+ finding marked resolved, and nobody looks at it again.
173
+
174
+ If step D changed code:
175
+
176
+ ```bash
177
+ # Stage ONLY the files your fixes touched — never `git add -A`, which sweeps up
178
+ # unrelated work and untracked secrets sitting in the worktree.
179
+ git status --short # look before you stage
180
+ git add <path> [<path>...] # the files named in the findings you fixed
181
+ git commit -m "address codex review feedback (codexloop iteration N)"
182
+ git push
183
+ ```
184
+
185
+ Author the commit per the repo's norms (e.g. the user's identity; no AI attribution if that is the
186
+ convention). Confirm the push actually landed before continuing:
187
+
188
+ ```bash
189
+ git rev-parse HEAD
190
+ gh pr view <PR> --json headRefOid -q .headRefOid # must match
191
+ ```
192
+
193
+ If they differ, stop: the fix is not on the PR, so nothing may be resolved yet.
194
+
195
+ ### F. Reply to and resolve every addressed thread
196
+
197
+ Only now, with the fixes pushed, reply and resolve. Fetch unresolved threads, **following
198
+ pagination** — a PR with more than 100 threads will otherwise look clean while unresolved findings
199
+ sit on page two:
200
+
201
+ ```bash
202
+ # Loop until hasNextPage is false, passing endCursor back in as $cursor.
203
+ CURSOR=null
204
+ while : ; do
205
+ PAGE=$(gh api graphql -F cursor="$CURSOR" -f query='
206
+ query($cursor: String) {
207
+ repository(owner: "OWNER", name: "REPO") {
208
+ pullRequest(number: PR_NUMBER) {
209
+ reviewThreads(first: 100, after: $cursor) {
210
+ pageInfo { hasNextPage endCursor }
211
+ nodes { id isResolved comments(first: 1) { nodes { databaseId author { login } path body } } }
212
+ }
213
+ }
214
+ }
215
+ }')
216
+ echo "$PAGE" # collect nodes from every page before deciding the PR is clean
217
+ PI='.data.repository.pullRequest.reviewThreads.pageInfo'
218
+ [ "$(echo "$PAGE" | jq -r "$PI.hasNextPage")" = "true" ] || break
219
+ CURSOR=$(echo "$PAGE" | jq -r "$PI.endCursor")
220
+ done
221
+ ```
222
+
223
+ Reply on a thread's comment via `gh api repos/{owner}/{repo}/pulls/<PR>/comments -f body="..." -F in_reply_to=<comment_id>`,
224
+ then resolve:
225
+
226
+ ```bash
227
+ gh api graphql -f query='mutation { resolveReviewThread(input: {threadId: "THREAD_ID"}) { thread { isResolved } } }'
228
+ ```
229
+
230
+ Resolve a thread only for comments authored by `$BOT` that you have fixed or rebutted — never
231
+ blanket-resolve, and never resolve a human reviewer's thread.
232
+
233
+ Threads you are **rebutting** need no push, so they may be replied to and resolved regardless of
234
+ whether step D changed code.
235
+
236
+ ### G. Re-review
237
+
238
+ Pushing re-triggers Codex when auto-review is on; otherwise post `@codex review`. Go back to **A**
239
+ with the new head SHA. If step D changed nothing (all comments were rebutted), skip the push,
240
+ ensure all threads are resolved, and exit.
241
+
242
+ ## 3. Exit conditions
243
+
244
+ Stop when **any** is true:
245
+ - Zero unresolved `$BOT` comments remain, and every comment this round was fixed or
246
+ rebutted+resolved. (There is no score to hit — this is "done".)
247
+ - Max iterations (5) reached — report what remains.
248
+ - Codex never responded after one retry — report the timeout honestly; do not claim success.
249
+
250
+ ## 4. Report
251
+
252
+ ```text
253
+ Codexloop complete.
254
+ PR: #<n>
255
+ Bot login: <resolved $BOT>
256
+ Iterations: N
257
+ Comments fixed: N (genuinely-correct findings)
258
+ Comments rebutted: N (false positives / nits, resolved with rationale)
259
+ Remaining: 0
260
+ ```
261
+
262
+ If it stopped at max iterations, list the remaining threads with your current assessment
263
+ (fix-pending vs disputed) so a human can arbitrate.
@@ -0,0 +1,6 @@
1
+ {
2
+ "name": "olko:codexloop",
3
+ "version": "0.1.0",
4
+ "description": "Iteratively drives a GitHub PR to zero unresolved OpenAI Codex review comments — but verifies every finding against the real code first, fixes only the correct ones, and rebuts false positives without changing correct code.",
5
+ "skills": "skills/"
6
+ }