L3 v0.4.0 source

gemini-review

Modelin attığı her commit'i Gemini'ye inceleten bir Claude Code Mod'u. Bir Bash git commit çalışmadan önce Gemini, commit'in kaydedeceği değişikliği ve konuşmayı okur. Engelleyici bir bulgu commit'i durdurur ve model sebebini okur; minor bir bulgu commit'in çalışmasına izin verir ve model onu sonuçtan sonra okur.

Ne yapar

  1. Mod Bash tool'unu hook'lar. İçinde git commit geçen bir komut (commit skill'i dahil) çalışmadan önce incelenir; diğer her komut dokunulmadan çalışır.
  2. Komutu shell'siz okur: cd <dir> ve git -C <dir> dizini belirler, aynı komutta commit'ten önceki git add neyin stage'leneceğini söyler, commit -a, add -u ve add -A ise her tracked ya da untracked değişikliğin gireceğini söyler. Heredoc ya da tırnak içindeki bir commit mesajı komut olarak okunmaz. git commit --help ve --dry-run hiçbir şey kaydetmez ve incelenmez. Commit'ten önce başka bir şey çalıştıran bir komut (echo x >> f && git commit -am ...) çalışmadan önce durdurulur ve model, commit'i kendi Bash çağrısında atması gerektiğini okur. İnceleme değişikliği komut çalışmadan önce okur, yani o adımların değiştireceği şey incelemede olmazdı: böyle bir commit boş bir diff ile ve incelemesiz geçti (2.1.278 üzerinde ölçüldü). Commit'ten sonraki komutlara (&& git push) izin verilir.
  3. Değişikliği git ile toplar, Bash tool'unun dizininde argv ile çalıştırarak ($.session.cwd() bir Bash cd komutunu izler, 2.1.278 üzerinde ölçüldü): index'i, komutun working tree'den stage'lediği bir path'i (index, git add çalışana kadar eski içeriği tutar) ve her yeni dosyayı bütün olarak.
  4. Diff'i ve konuşmayı tek bir generateContent isteğinde bir schema ile gönderir: bulguların listesi, her biri blocker ya da minor, bir dosya, bir satır ve bir mesajla. İsteği gemini-core kurar: gemini-review için tuttuğu key, model ve thinking seviyesi ile; cevabı da o okur.
  5. blocker, değişikliğin getirdiği bir bug, veri kaybı, bir güvenlik açığı, diff içinde bir secret ya da credential, veya kullanıcının istediğine aykırı bir değişiklik demektir. Diğer her şey minor'dır.
  6. Karar:
    • bir blocker: komut çalışmaz; model her blocker'ı ve minor notları okur; talimat, düzeltip tekrar commit etmesi ya da bulgu yanlışsa kullanıcıya sebebini söyleyip aynı komutu başına GEMINI_REVIEW_SKIP=1 koyarak çalıştırmasıdır;
    • yalnız minor bulgular: commit çalışır ve model notları sonuçtan sonra okur;
    • hiç bulgu yok: commit çalışır ve model, incelemenin bir şey bulmadığını söyleyen tek satırı okur.
  7. İnceleme cevap veremediğinde (key yok, bir HTTP hatası, bozuk bir cevap, bir git hatası, 1.500.000 karakteri aşan bir diff) commit çalışır, bir transcript satırı sebebini söyler ve model sebebi okur.
  8. Gemini arada bir HTTP 503 ("high demand") döner, çoğu zaman 10 saniye ya da daha fazlasından sonra. gemini-core bunu okuduğu şekliyle mod 1 sn, 2 sn ve 3 sn sonra tekrar sorar, en fazla dört kere, ve 60 saniye geçtikten sonra yeni deneme başlatmaz. Bir hook'un 10 saniyelik bütçesi $.clock beklemelerini sayar ama isteklerini saymaz, yani beklemeler kısa kalır.

2.1.278 üzerinde gemini-3.8-flash ile yapılan canlı testte sk_live_... içeren bir dosyanın commit'i sub/pay.ts:1: Hardcoded live Stripe secret key committed in source code ile durduruldu, düzeltmeden sonraki git add pay.ts sub.ts && git commit çalıştı, GEMINI_REVIEW_SKIP=1 ile atılan bir commit incelemesiz çalıştı ve geçersiz bir key commit'in Gemini HTTP 400: API key not valid ile çalışmasına izin verdi. O session'daki sekiz incelemenin dördü cevap aldı (biri iki 503'ten sonra, toplam 42,5 saniye) ve dördü yalnız 503 aldı ve commit'in çalışmasına izin verdi.

Ne gösterir

Her incelemeden sonra bir toast ve /gemini-review içinde sonuncusu:

gemini-review: reviewed 1 file(s) · 1 blocker, 0 minor · 2k in, 515 out · sent to Gemini free tier

Her incelemeden sonra bir transcript satırı, böylece modele ne söylendiğini okursunuz. Bu satır talimat cümlesi olmadan yalnız bulguları taşır:

gemini-review: commit reviewed: 2 file(s), nothing to report
gemini-review: commit reviewed with 1 minor note(s): pay.ts:12: Name the constant.
gemini-review: commit stopped: reviewed 1 file(s) · 1 blocker, 0 minor · 2k in, 515 out
gemini-review: commit ran without a review: the model used GEMINI_REVIEW_SKIP=1

Context ve satır ayrı iki kanaldır: model satırı hiç okumaz, siz context'i hiç okumazsınız.

Komut

/gemini-review              on ya da off, gemini-core'un tuttuğu model, thinking seviyesi ve tier, key var mı, son inceleme
/gemini-review on | off     off: commit'ler incelenmeden çalışır; gemini-core'da key yokken on reddedilir
/gemini-review reset        tekrar off, varsayılan

İnceleme kurulumdan sonra kapalıdır, yani siz bir key ayarlayıp açana kadar Gemini'ye hiçbir şey gönderilmez.

Key, tier, model (varsayılan gemini-3.8-flash) ve thinking seviyesi gemini-core'a aittir:

/gemini-core model review gemini-3.7-flash
/gemini-core thinking review low
/gemini-core paid

Free tier ya da paid tier

Her inceleme diff'i ve konuşmayı gönderir: prompt'larınızı, modelin çalıştırdığı komutları ve okuduğu dosyaların içeriğini. Free tier'da Google bunları kullanabilir ve insan denetçiler okuyabilir; gemini-core README'si Gemini API Additional Terms'ten alıntılar. Google'a göstermeyeceğiniz bir projede billing açık bir key kullanın ve /gemini-core paid ayarlayın.

Kurulum

claude plugin marketplace add KilimcininKorOglu/claude-code-mods
claude plugin install gemini-review@kilimcininkoroglu-mods

gemini-core'a bağlıdır; claude plugin install onu da ekler. Function hook'lar early access. Flag olmadan hiçbir şey yüklenmez. Flag'i kalıcı yapmak için ~/.claude/settings.json dosyasına ekleyin:

{ "env": { "CLAUDE_CODE_ENABLE_FUNCTION_HOOKS": "1" } }

Kurulumdan sonra

  1. Gemini key'ini ve tier'ı gemini-core'da ayarlayın, onun After installing bölümünde yazdığı gibi, sonra Claude Code'u yeniden başlatın.
  2. /gemini-review on çalıştırın. Key olmadan still off: gemini-core has no Gemini key cevabını verir ve kapalı kalır.
  3. /gemini-review çalıştırın. İlk satır on · <model> · thinking ... · <tier> tier · key set demelidir.
  4. Bir commit commit ran without a review: Gemini HTTP 429 ile çalışıyorsa key'inizde o model için kota yok demektir. /gemini-core model review ile başka bir model seçin.

0.1.x'ten güncellemeden sonra: claude plugin update gemini-core'u eklemez (2.1.278 üzerinde ölçüldü), bu yüzden bir kere claude plugin install gemini-core@kilimcininkoroglu-mods çalıştırın. 0.2.0 sürümü key, tier ve model'i gemini-core'a taşıdı; daha önce saklanan apiKey, tier ve model option'ları ile /gemini-review free|paid|model ayarları artık okunmuyor, onları gemini-core'da yeniden ayarlayın. 0.3.0 sürümü incelemeyi varsayılan olarak kapattı: daha eski bir sürümden güncellediyseniz, daha önce /gemini-review on çalıştırmadıysanız kapalıdır; bir kere /gemini-review on çalıştırın.

Option'lar

Option Varsayılan Ne ayarlar
maxInputChars 2000000 En fazla kaç karakter konuşma gönderilir

Nereye uzanır

Claude Code 2.1.278 üzerinde claude plugin validate ile doğrulandı:

❯ ./register.ts hooks: session.start, command.run{command=gemini-review}, tool.call{tool=Bash}
❯ ./register.ts calls: $.clock.now (via askGemini), $.clock.sleep (via askGemini), $.command.register, $.gemini.enroll, $.gemini.read (via askGemini), $.gemini.request (via askGemini), $.gemini.settings (via review, runCommand, storeEnabled), $.http.fetch (via askGemini), $.process.run (via collectDiff, git), $.session.cwd (via review), $.session.messages (via review), $.store.delete (via runCommand), $.store.get (via isEnabled), $.store.set (via storeEnabled), $.ui.log, $.ui.toast (via verdictOf)

Reach L3, network'e çıkar.

1. Okur:     her Bash komutunu; bir commit anında repository'nin diff'ini ve yeni dosyalarını git üzerinden, ve konuşmayı (mesajlar, tool input'ları ve output'ları); kendi $.store dosyasını; gemini-core'dan key'i taşıyan isteği
2. Çalıştırır: salt okuma git komutlarını argv ile, shell yok: rev-parse, diff, ls-files; en fazla 200 yeni dosya okunur
3. Gönderir: diff'i ve konuşmayı, commit başına bir istek (503 sonrası en fazla dört, 429 ya da key hatası sonrası ek key başına bir tane daha), gemini-core'un kurduğu URL'ye (generativelanguage.googleapis.com), key x-goog-api-key header'ında, hiçbir zaman URL'de değil
4. Saklar:   $.store içinde on/off ayarını; son inceleme satırı bellekte yaşar
5. Düşman girdi: bir diff ya da bir konuşma Gemini'nin bulgularını yönlendirebilir, yani düşman bir değişiklik geçebilir ya da sağlam bir değişiklik durdurulabilir; model bulguları bir ret ya da bir not olarak okur ve yanlış olanı atlayabilir; komuttan gelen path'ler git'e `--` sonrası argv olarak ulaşır, hiçbir zaman shell üzerinden geçmez

Sınırlar

  • Bir inceleme bir modelin görüşüdür. Bir sorunu kaçırabilir; yanlış bir blocker, modelin kendi kararıyla kullandığı skip ön eki ile geçilir.
  • Yalnız modelin Bash commit'leri incelenir. Sizin terminalinizden, modelin çalıştırdığı bir script'ten, bir alias'tan ya da başka bir tool üzerinden atılan commit incelenmez.
  • Komut okuma alışılmış biçimleri kapsar. Bir subshell içindeki cd, path'lerdeki değişkenler ve git'in genişlettiği glob'lar çözülmez.
  • Bir subagent'ın commit'i yalnız diff'i gönderir, çünkü subagent içinde $.session.messages() hangi transcript'i cevaplar, doğrulanmadı.
  • Her inceleme tüm konuşmayı gönderir, yani uzun bir session her incelemeyi daha büyük ve daha yavaş yapar. $.session.messages() en yeni 4096 mesajı cevaplar.
  • Bash hook'u canlı testte sınır olmadan 42,5 saniye çalıştı. Daha uzun bir sınır ölçülmedi.

Geliştirme

make install     # eslint, typescript-eslint, typescript
make lint        # complexity limiti 10, üstünde build'i düşürür
make typecheck   # /plugin-types ile üretilen .claude/types/ gerekir
make validate
make test        # claude plugin test

gemini-review

A Claude Code Mod that has Gemini review every commit the model makes. Before a Bash git commit runs, Gemini reads the change the commit records and the conversation. A blocking finding stops the commit and the model reads why; a minor finding lets the commit run and the model reads it after the result.

What it does

  1. The mod hooks the Bash tool. A command with a git commit in it (the commit skill included) is reviewed before it runs; any other command runs untouched.
  2. It reads the command without a shell: cd <dir> and git -C <dir> set the directory, git add before the commit in the same command says what gets staged, and commit -a, add -u and add -A say that every tracked or untracked change goes in. A commit message in a heredoc or in quotes is not read as a command. git commit --help and --dry-run record nothing and are not reviewed. A command that runs anything else before the commit (echo x >> f && git commit -am ...) is stopped before it runs, and the model reads that it must commit in a Bash call of its own. The review reads the change before the command runs, so what those steps change would not be in it: such a commit went through with an empty diff and no review (measured on 2.1.278). Commands after the commit (&& git push) are allowed.
  3. It collects the change with git, run by argv in the Bash tool's directory ($.session.cwd() follows a Bash cd, measured on 2.1.278): the index, a path the command stages from the working tree (the index still holds its older content until git add runs), and each new file whole.
  4. It sends the diff and the conversation in one generateContent request with a schema: a list of findings, each blocker or minor, with a file, a line and a message. gemini-core builds the request with the key, the model and the thinking level it holds for gemini-review, and reads the answer.
  5. blocker means a bug the change introduces, data loss, a security hole, a secret or credential in the diff, or a change that contradicts what the user asked for. Everything else is minor.
  6. The verdict:
    • a blocker: the command does not run; the model reads each blocker and the minor notes, with the instruction to fix and commit again, or, when a finding is wrong, to tell the user why and run the same command with GEMINI_REVIEW_SKIP=1 in front;
    • only minor findings: the commit runs and the model reads the notes after the result;
    • no finding: the commit runs and the model reads one line saying the review found nothing.
  7. When the review cannot answer (no key, an HTTP error, a malformed answer, a git error, a diff over 1,500,000 characters), the commit runs, a transcript line says why, and the model reads the reason.
  8. Gemini answers HTTP 503 ("high demand") now and then, often after 10 seconds or more. As gemini-core reads it, the mod asks again after 1 s, 2 s and 3 s, at most four times, and starts no attempt once 60 s have passed. A hook's 10-second budget counts its $.clock waits but not its requests, so the waits stay short.

In a live check on 2.1.278 with gemini-3.8-flash, a commit of a file with sk_live_... was stopped with sub/pay.ts:1: Hardcoded live Stripe secret key committed in source code, a git add pay.ts sub.ts && git commit after the fix ran, a GEMINI_REVIEW_SKIP=1 commit ran unreviewed, and an invalid key let the commit run with Gemini HTTP 400: API key not valid. Of eight reviews in that session, four got an answer (one after two 503s, 42.5 seconds in all) and four got only 503 answers and let the commit run.

What it shows

A toast after each review, and the last one in /gemini-review:

gemini-review: reviewed 1 file(s) · 1 blocker, 0 minor · 2k in, 515 out · sent to Gemini free tier

A transcript line after every review, so you read what the model was told. The line holds the findings alone, without the instruction:

gemini-review: commit reviewed: 2 file(s), nothing to report
gemini-review: commit reviewed with 1 minor note(s): pay.ts:12: Name the constant.
gemini-review: commit stopped: reviewed 1 file(s) · 1 blocker, 0 minor · 2k in, 515 out
gemini-review: commit ran without a review: the model used GEMINI_REVIEW_SKIP=1

The context and the line are separate channels: the model never reads the line, and you never read the context.

Command

/gemini-review              on or off, the model, thinking level and tier gemini-core holds, whether a key is set, the last review
/gemini-review on | off     off: commits run without a review; on is refused while gemini-core has no key
/gemini-review reset        off again, the default

The review is off after an install, so nothing is sent to Gemini before you set a key and turn it on.

The key, the tier, the model (default gemini-3.8-flash) and the thinking level are gemini-core's:

/gemini-core model review gemini-3.7-flash
/gemini-core thinking review low
/gemini-core paid

Free tier or paid tier

Every review sends the diff and the conversation: your prompts, the commands the model ran and the contents of the files it read. On the free tier Google may use them and human reviewers may read them; the gemini-core README quotes the Gemini API Additional Terms. On a project you would not show to Google, use a key with billing enabled and set /gemini-core paid.

Install

claude plugin marketplace add KilimcininKorOglu/claude-code-mods
claude plugin install gemini-review@kilimcininkoroglu-mods

It depends on gemini-core, which claude plugin install adds. Function hooks are early access. Nothing loads without the flag. To keep it on, add this to ~/.claude/settings.json:

{ "env": { "CLAUDE_CODE_ENABLE_FUNCTION_HOOKS": "1" } }

After installing

  1. Set the Gemini key and the tier in gemini-core, as its After installing section says, then restart Claude Code.
  2. Run /gemini-review on. Without a key it answers still off: gemini-core has no Gemini key and stays off.
  3. Run /gemini-review. The first line reads on · <model> · thinking ... · <tier> tier · key set.
  4. When a commit runs with commit ran without a review: Gemini HTTP 429, the model has no quota on your key. Pick another with /gemini-core model review.

After an update from 0.1.x: claude plugin update does not add gemini-core (measured on 2.1.278), so run claude plugin install gemini-core@kilimcininkoroglu-mods once. Version 0.2.0 moved the key, tier and model to gemini-core; the apiKey, tier and model options and the settings /gemini-review free|paid|model stored before are no longer read, so set them again in gemini-core. Version 0.3.0 made the review off by default: after an update from an earlier version it is off unless you ran /gemini-review on before, so run /gemini-review on once.

Options

Option Default What it sets
maxInputChars 2000000 Characters of conversation sent at most

What it can reach

Validated with claude plugin validate on Claude Code 2.1.278:

❯ ./register.ts hooks: session.start, command.run{command=gemini-review}, tool.call{tool=Bash}
❯ ./register.ts calls: $.clock.now (via askGemini), $.clock.sleep (via askGemini), $.command.register, $.gemini.enroll, $.gemini.read (via askGemini), $.gemini.request (via askGemini), $.gemini.settings (via review, runCommand, storeEnabled), $.http.fetch (via askGemini), $.process.run (via collectDiff, git), $.session.cwd (via review), $.session.messages (via review), $.store.delete (via runCommand), $.store.get (via isEnabled), $.store.set (via storeEnabled), $.ui.log, $.ui.toast (via verdictOf)

Reach L3, reaches the network.

1. Reads:    each Bash command; at a commit, the repository's diff and new files through git, and the conversation (messages, tool inputs and outputs); its own $.store; from gemini-core, the request with the key
2. Runs:     read-only git by argv, no shell: rev-parse, diff, ls-files; at most 200 new files are read
3. Sends:    the diff and the conversation, one request per commit (up to four after a 503, and once more per extra key after a 429 or a key error), to the URL gemini-core builds (generativelanguage.googleapis.com) with the key in the x-goog-api-key header, never in the URL
4. Persists: in $.store, the on/off setting; the last review line lives in memory
5. Hostile input: a diff or a conversation can steer Gemini's findings, so a hostile change can pass or a sound one be stopped; the model reads the findings as a denial or a note and can skip a wrong one; paths from the command reach git as argv after --, never through a shell

Limits

  • A review is a model's opinion. It can miss a problem, and a wrong blocker is passed with the skip prefix, which the model uses by its own decision.
  • Only the model's Bash commits are reviewed. A commit from your terminal, from a script the model runs, from an alias or through another tool is not.
  • The command reading covers the usual forms. A cd inside a subshell, variables in paths and globs that git expands are not resolved.
  • A subagent's commit sends only the diff, because which transcript $.session.messages() answers inside a subagent was not verified.
  • Every review sends the whole conversation, so a long session makes each review larger and slower. $.session.messages() answers the newest 4096 messages.
  • The Bash hook ran 42.5 seconds without a limit in the live check. A longer limit was not measured.

Development

make install     # eslint, typescript-eslint, typescript
make lint        # complexity limit 10, fails the build above it
make typecheck   # needs .claude/types/ from /plugin-types
make validate
make test        # claude plugin test