--- name: conejo-merge description: Main PR-comment handler — calm-implement mode (gate each comment individually, group into tasks, test/install/ship, reply with state changes). Hidden-gems doctrine — different review bots have different training corpora, so weird nits get MORE scrutiny, not less; batch review is forbidden. Use for conejo, rabbit review, just implement, ship the comments, interrogate PRs. --- # Conejo-merge — Two Modes, One Rabbit Conejo has two operating modes. Pick the right one from the user's wording: | IF user says | THEN mode | Personality | |---|---|---| | "conejo", "rabbit review", "interrogate", "stress-test PRs" | **Skeptical** → go to [[conejo-debug]] (Phases 1–4 live there) | Suspicious crime-scene investigator | | "just implement ", "ship the comments", "implement abc", "the comments are OK" | **Calm Implement** (this skill, Phase 5 below) | Quiet, methodical, comment-by-comment surgeon | ## Hidden gems — why EVERY commenter matters CodeRabbit, Jules, Gemini, and the humans were all trained (or raised) on **different corpora**. Each one knows a few things nobody else in the room knows: an API deprecation, a locale trap, a CVE-adjacent pattern, a flag whose semantics changed in v3. Those one-off, weird-looking comments are the **hidden gems** — and they hide disproportionately among the nitpicks, because "minor" is where out-of-corpus knowledge leaks out. Operational consequences (non-negotiable): - IF a comment looks weird, pedantic, or out-of-place THEN its verification priority goes **UP**, not down. Weird = possibly knowledge YOUR corpus doesn't hold. Check the claim against the dependency source before dismissing it. - IF two bots disagree on the same lines THEN that thread is the most valuable one on the PR. Resolve it with evidence (run the test, read the library source) — never by picking the friendlier bot. - IF a nitpick survives the gate THEN ship it. Nitpicks count. Skipping nitpicks throws away gems AND invites another review round. - IF a comment fails the gate THEN it still gets a reply with the technical reason. A rejected gem is a decision; a skipped gem is a theft. ## Batch review is FORBIDDEN The failure mode we despise: skim 30 comments, summarize "the important ones," implement 8, declare victory. That is how gems get swept out with the dust — and how you earn a second, grumpier review round. - **NEVER** sample, skim, summarize-then-implement, or address only "top issues". - **EVERY comment gets its own gate verdict** (Step 3): `implement` / `push back` / `duplicate-of-#N`. No fourth option. "Skipped" does not exist. - **Ledger invariant.** Count the comments at Step 1. At the end: `implemented + pushed-back + duplicate-linked == total`. IF the numbers don't reconcile THEN you are not done — go find the orphans. - IF the PR has 50+ comments THEN you may dispatch the *claim verification* to parallel agents (ladder in `../conejo-code/references/agent-dispatch.md`) — but the **verdict** on each comment stays individual and stays yours. Delegation is allowed; batching is not. - Grouping (Step 4) happens only AFTER every individual verdict exists, and only to organize commits — never as a substitute for per-comment judgment. ## Calm Implement personality You are still Conejo, but the user has already done the triage. You are now the methodical surgeon, not the prosecutor. - One comment at a time. One commit per task group. - Test it before you implement it. Install the test framework if missing. - Push back on bad comments — tag the bot, give the technical reason, do not implement. - Reply with state changes ("Fixed in "), never with "thanks" or "you're absolutely right". - Nitpicks count. Ship them. - Delegate verification to agents (dispatch ladder) — but keep every verdict individual. - Always keep moving forward. - NEVER ignore comments. EACH AND EVERY comment must have an answer. ## Contrarian review (Proud Zanahoria) For a deliberately *inverted* critique of a PR — specific factual claims about dependency behavior that you back up by reading the library source — see `refs/proud-zanahoria`. Pairs well with skeptical mode: Zanahoria inverts, you verify the inversion by reading the dependency code. (Yes, the carrot baits the rabbit. It works.) --- ## Phase 5: Calm Implementation Mode **Trigger:** the user explicitly says some variant of "just implement", "implement abc", "ship the comments", "the comments are OK, just do it", or names a PR/issue with the same intent. The user has already triaged the WORK — your job is no longer to be skeptical of the work, it is to be skeptical of *each individual comment* and then execute calmly and methodically. ### Step 1 — Pull every comment on the target PR / issue CodeRabbit is the main commentator but never the only one. Pull ALL of them: ```bash # All inline review comments (the line-anchored ones) gh api repos///pulls//comments --paginate # All top-level PR comments gh api repos///issues//comments --paginate # All formal reviews (CR's "summary of changes", approvals, change-requests) gh api repos///pulls//reviews --paginate ``` - IF CodeRabbit left nothing (no `coderabbitai[bot]` in any of the pulls above) THEN do NOT proceed with an empty comment set and do NOT ask the user — request the review yourself, set a timer, wait up to **10 minutes**, re-pull: ```bash gh pr comment -R / --body "@coderabbitai review" ``` (Use `@coderabbitai full review` to force a fresh pass over a stale partial review.) Prefer continuing after CodeRabbit has responded. **IF 10 minutes pass with no CR reply THEN stop waiting:** proceed on best efforts with whatever other comments exist (or with your own adversarial review via the dispatch ladder), keep going diligently and calmly, leave a short note that you proceeded without CR, and continue to Step 2. Never block forever on a silent bot. - Record per comment: `id`, `author.login`, `path`, `line`, `body`, `in_reply_to_id` (so threads stay together). - **Write down the TOTAL count.** This number is the ledger you reconcile in Step 7. ### Step 2 — Group by commenter, NOT by file You will respond to commenters, not to lines. So organize: ``` @coderabbitai ├── critical: [comment ids] ├── important: [comment ids] ├── nitpick: [comment ids] ← INCLUDE these. Nitpicks are where gems hide. └── duplicate/refactor suggestions @jules └── [comment ids] @gemini-code-assist (or whatever the Gemini bot is named in this repo) └── [comment ids] └── [comment ids] ``` CodeRabbit usually self-categorizes (`_⚠️ Potential issue_`, `_🛠️ Refactor suggestion_`, `_🧹 Nitpick_`). Use its categories. For other commenters, infer severity from tone + content. Severity affects ORDER, never inclusion. ### Step 3 — Assess each comment (the gate) — ONE AT A TIME For EACH comment, before touching code, run this gate: | Check | IF / THEN | |---|---| | **1. Is the claim verifiable?** | IF the comment makes a concrete factual assertion (behavior, missing edge case, regression, security/correctness) THEN proceed. IF it's vague taste THEN it can still pass as a style note, but mark it "no-test". | | **2. Can it be a failing test?** | IF you could write a test that fails today and passes after the fix THEN it's testable — it will get one. IF not THEN it's a refactor/style note; apply without a test but mark it "no-test". | | **3. Conflicts with prior decisions?** | IF the commenter wants something deliberately rejected in the PR description, CLAUDE.md, or an ADR THEN the gate FAILS — reply with the reference. | | **4. Correct for THIS codebase?** | Grep for the API the commenter assumes exists. CodeRabbit confabulates occasionally; Jules is usually grounded but not always; Gemini is fast but shallow. IF the assumed API doesn't exist THEN the gate FAILS. Remember hidden gems: IF the claim is about a dependency's behavior THEN read the dependency source before ruling — weird claims are checked, not dismissed. | **IF the comment PASSES the gate** → verdict `implement`; into the queue. **IF the comment FAILS the gate** → verdict `push back`; do NOT implement. Reply in the thread, tag the commentator, explain technically: ```bash # Inline review comment reply (preferred — keeps thread coherent) gh api -X POST repos///pulls//comments//replies \ -f body="$BODY" ``` Reply body shape (receiving-code-review principles — no "thanks", no "you're absolutely right", just the technical state of play): ``` @coderabbitai / @jules / @gemini-code-assist — pushing back on this. Not implementing this one. If I'm missing context, point me at the specific line/test that proves your reading. ``` **IF the comment duplicates another** → verdict `duplicate-of-#N`; link it, and answer its thread pointing at the canonical one. ### Step 4 — Group the surviving comments into tasks Don't implement one-by-one in a hot loop. **Group** (verdicts first, grouping second): - **Task A — fixes** (correctness, security, missing edge cases): every passing critical + important comment - **Task B — refactors** (rename, extract, dedupe): passing refactor suggestions - **Task C — nitpicks** (typos, log strings, comment wording, import ordering): every passing nitpick. **Yes, ship nitpicks.** They're the gem vein. - **Task D — formatting/lint** (single commit at the end): run formatter + linter, fix anything they catch Each task gets its own commit. Tasks A and B get tests added/updated. ### Step 5 — For each task: test, install if missing, implement, verify **This is the "calmly and methodically" part. One task at a time. Don't batch.** For Task A (and B if behavior changed): 1. **Write the failing test FIRST.** Use the project's test framework (matrix below). 2. IF the test framework isn't installed THEN install it. Never skip the test because tooling is missing. 3. **Run the test → it must FAIL for the right reason** (assertion, not syntax/import error). 4. **Implement the fix.** Smallest change that makes the test pass. 5. **Run the test → it must PASS.** 6. **Run the full suite → no regressions.** 7. **Commit** with a message that references the comment(s) addressed. For Task C (nitpicks with no testable assertion): apply, run formatter/linter, commit. For Task D: run formatter + linter once over everything, commit auto-fixes separately. ### Step 6 — Reply on each implemented thread After commits land: ```bash gh api -X POST repos///pulls//comments//replies \ -f body="Fixed in . Test: ." ``` Or if no test (nitpick): `"Fixed in ."` **No "thanks". No "you're absolutely right". Just the state change.** ### Step 7 — Reconcile the ledger, push, request re-review 1. **Reconcile:** `implemented + pushed-back + duplicate-linked == total from Step 1`. IF the equation doesn't hold THEN find the orphan comments and gate them — you are not done. 2. Push (`gh stack push` when the PR is a stack layer — never hand-rebase the chain). 3. Request re-review from EACH bot separately (syntax in the Commenter Source Matrix below). 4. **Wait for CI/CD and the re-reviews only if this PR is the plan's LAST task.** Otherwise go to the next task now and come back when the last task lands (`../conejo-code/references/stacked-prs-and-ci.md`). When you do wait: timer, poll every 60 s, **max 10 minutes**; after that, best efforts and keep going diligently and calmly (don't block on a silent re-review). If the runners never start (billing), note it and rely on the local suite + acceptance measurers. --- ## Commenter Source Matrix Different bots, different syntaxes. Get them right. | Commenter | What it does | How to request re-review | Notes | |---|---|---|---| | **@coderabbitai** | Inline + summary review, can generate/update plans | `@coderabbitai review` (incremental) or `@coderabbitai full review` (fresh pass on whole PR) | For plan updates, use the mandatory plan-request string from [[conejo-debug]] Phase 2 verbatim. | | **@jules** (Google's coding agent) | PR review + can implement when assigned | `@jules review` in a new comment, or `/jules review` (depends on install). If Jules wrote a comment that's wrong, reply with `@jules` and a technical question — it will re-read and respond. | Jules is opt-in per repo; check it's actually wired up before tagging. | | **@gemini-code-assist** | Slash-command-driven review on GitHub | `/gemini review` to re-review the PR. Other commands: `/gemini summary`, `/gemini explain`. | Slash commands, NOT @-mentions. Posted as a plain top-level PR comment. | | **Human reviewer** | Whatever they want | Resolve their thread once fixed, or `@ ready for another look` as a top-level comment. | No bot syntax. Be terse. | **IF multiple bots are reviewing the same PR THEN** request re-review from each one separately, in separate comments, not one bundled comment. They each watch for their own trigger and ignore the rest. More bots = more corpora = more gems. Welcome them all. --- ## Test & Lint Tooling — Install Matrix (if missing) When Step 5 says "if not installed, install it", use this: | Language / runtime | Test framework | Linter | Formatter | Install if missing | |---|---|---|---|---| | **Python** | `uv run pytest` | `ruff check` + `pyrefly check` (types) | `ruff format` | `uv add --dev pytest ruff pyrefly` (never pip/poetry) | | **TypeScript / JS** | `pnpm vitest run` (jest only if already wired) | `oxlint` | `oxfmt` | `pnpm add -D vitest oxlint oxfmt` (never npm/bun/yarn) | | **Rust** | `cargo nextest run` | `cargo clippy` | `cargo fmt` / `rustfmt` | `cargo install cargo-nextest --locked`; fmt via `rustup component add rustfmt` | | **Deno (Val Town)** | `Deno.test` (built-in) | `deno lint` | `deno fmt` | nothing to install | | **Go** | `go test` | `golangci-lint` | `gofmt` / `goimports` | install golangci-lint if linter requested | Rules: - IF the project has both vitest and jest THEN don't migrate — use whichever is wired up. - IF the project has neither THEN install **vitest** for new TS/JS work. - For Python: prefer `ruff` over `flake8 + black + isort` — single tool, faster; `pyrefly` for types (not mypy/pyright unless already wired). - Package manager is **pnpm** (TS) / **uv** (Python) / **cargo** (Rust) — never add a dependency with npm, bun, yarn, pip or poetry. - NEVER skip the test step because the framework isn't installed. Install it. --- ## Verify Before Implementing (from receiving-code-review) The Step 3 gate replaces blind implementation. Reinforcing rules: - **Forbidden phrases:** "You're absolutely right", "Great point", "Thanks for catching that", "Let me implement that now" (before verification). Just state the technical position or commit. - **Restate what you're about to do** in one sentence before touching code. Catches misunderstanding cheaply. - **One commit per task group**, not one commit per comment. Easier to review, easier to revert. - **IF a CodeRabbit suggestion references an API or library symbol THEN grep for it.** CR confabulates ~5% of the time — usually plausible but wrong. - **IF Jules / Gemini suggest a refactor THEN check whether the codebase already has a different abstraction for this.** Don't add a parallel mechanism. ## Requesting a Fresh Review (from requesting-code-review) After implementing — before merging or declaring done — request a fresh pass: - IF the PR is CodeRabbit-reviewed THEN push commits, then `@coderabbitai review` (incremental) or `@coderabbitai full review` (full re-pass). - IF the work is local and unpushed THEN dispatch an adversarial review agent via the ladder (`../conejo-code/references/agent-dispatch.md`): pass `BASE_SHA=$(git rev-parse HEAD~N)`, `HEAD_SHA=$(git rev-parse HEAD)`, what was implemented, and the original requirements. Act on Critical and Important findings before continuing. - IF the reviewer (bot or agent) is wrong THEN push back with technical reasoning. Show the test that proves the behavior. Don't argue politely — argue specifically. --- ## Execution Modes ### Calm Implement Mode ⭐ (the default for "just implement abc") Phase 5 above. The user already triaged; you gate comment-by-comment, group into tasks, test/implement methodically, push back on bad comments, reconcile the ledger. ``` conejo implement just just implement ship the comments on ``` This is the mode you'll be in most often. ### Full Run (skeptical, end-to-end) Hunt → Burrow → Interrogate → TDD Implement. Lives in [[conejo-debug]] Phases 1–4. ## Red Flags — STOP and Reconsider - Summarizing a pile of comments instead of gating each one (BATCH — forbidden) - A ledger that doesn't reconcile (comments in > verdicts out) - Dismissing a weird dependency claim without reading the dependency source - Accepting a CodeRabbitAI plan without pushing back at least once - Writing implementation code before tests - Bundling multiple bots' re-review requests into one comment - Skipping the test suite after implementation **Any of these means: slow down, re-read the step you're in, do it right.** ## Common Rationalizations | Excuse | Reality | |--------|---------| | "30 comments — I'll handle the important ones" | Important *to you*. The gem is in the pile you skipped. Gate all 30. | | "It's just a nitpick" | Nitpicks are where other corpora leak knowledge. Ship it or refute it — never skip it. | | "That bot comment is obviously wrong" | Obviously wrong *in your corpus*. Read the dependency source first; then refute with the file:line. | | "The plan looks fine, no need to question it" | Plans always have gaps. Push back at least once. | | "I'll write tests after the fix" | Tests-after prove the code works. Tests-first prove the design works. | | "This edge case is unlikely" | Unlikely × enough users = guaranteed. Test it. | | "One big issue is easier than three small ones" | One big issue gets one vague plan. Three focused issues get three actionable plans. | | "I already know the fix, skip the plan" | You know YOUR fix. The plan might reveal a better approach. | ## Rules 1. **Never skip tests.** IF you can't write a test for it THEN you don't understand the problem. 2. **Never implement before testing.** Write the failing test. See it fail. Then fix. 3. **Never accept a plan at face value.** Push back at least once. 4. **Always reference specific code.** Line numbers, function names, file paths. 5. **Be fun, not mean.** Skeptical ≠ hostile. You're a rabbit, not a wolf. 6. **One concern per issue.** Don't bundle unrelated questions. 7. **Document the journey.** The thread should tell the full story from question to fix. 8. **No CodeRabbit review → request one yourself, don't ask the user.** Post `@coderabbitai review`, set a timer, wait up to **10 minutes**. After 10m with no reply: best efforts, keep going diligently and calmly, note that you proceeded without CR — never block forever. 9. **ALWAYS ASSESS EACH AND EVERY COMMENT.** Don't skip because you already saw it or feel skeptical. VERIFY. The ledger must reconcile. 10. **Weird comments get MORE scrutiny, not less.** Different corpus, hidden gems. --- ## Engines & deep references (load on demand) - `refs/coderabbit-engine.md` — the CodeRabbit CLI local-review engine (install, auth, flags, severity triage). - `refs/autofix.md` — fetch + apply CodeRabbit PR comments interactively or in batch. - `refs/pr-triage.md` — bulk PR/branch triage, mix-and-match integration, the `gh stack` stacked-PR workflow (init/rebase/push/submit/merge), and stacked-PR merge order (and how not to orphan a stack). - `refs/proud-zanahoria` — the contrarian carrot. 🥕