Skip to main content
Glama

gemini-bridge

CI Python 3.10+ License: MIT Status: Alpha

Let Claude ask Google's Gemini for a second opinion — safely.

You're building something with Claude Code. Claude writes a plan or some code. But who checks Claude? gemini-bridge lets Claude (or you) hand that plan, file, or set of changes to Gemini, a completely different AI from a different company, and get back an independent review. Different AIs make different mistakes, so a second pair of eyes catches things the first one missed.

Gemini only gets to read what you send it. It can't edit your files, run commands, or poke around your computer.

Not affiliated with Google or Anthropic.


What it does, in plain words

  • Second opinions. "Hey Gemini, here's Claude's plan for the database. Anything wrong with it?"

  • Code reviews. "Gemini, review everything I changed since my last commit. Any bugs? Any security holes?"

  • Design feedback. "Which of these two approaches is better, and why?"

  • (Optional) Hand off real work. Let Gemini build a UI piece or click through your app in a browser and take screenshots, in a separate copy of your project, so nothing touches your real files until you say so. This is called Agent mode and it's off by default.

You don't need to learn any commands to use it. After setup you just talk to Claude Code normally:

  • "Get a second opinion from Gemini on this migration plan"

  • "Have Gemini do a security review of my uncommitted changes"

  • "Ask Gemini if this login code has any bugs"

Claude sends the question, waits for Gemini, and shows you what Gemini said.


Related MCP server: antigravity-claude-mcp

Why you'd want this

  • Claude can be confidently wrong. So can any AI. Asking a different AI is the cheapest way to catch that before it ships.

  • It's safe by default. Running Gemini's command-line tool on its own can edit files and run commands. gemini-bridge switches all of that off. If Gemini somehow tries to use a tool anyway, the bridge throws the answer away and reports it (CONTAINMENT_VIOLATION).

  • The answers have a fixed format. Reviews come back as a clear verdict (approve / request changes / comment) plus a list of issues with file, line, and how serious each one is, not a wall of text. If Gemini replies in the wrong format, the bridge asks once more; if it's still wrong, it tells you instead of handing you garbage.

  • Everything is logged. Every call goes into a log on your machine that can't be quietly edited afterwards, so you can always see what was sent to Gemini and what came back.


How it works (the 30-second version)

You / Claude Code ──► gemini-bridge ──► Antigravity CLI (agy) ──► Gemini
                         │
                         ├─ picks only the files/diff you asked for (skips secrets like .env and keys)
                         ├─ runs Gemini in a fresh, empty, throwaway setup with every tool turned off
                         ├─ checks the answer is in the right format
                         └─ saves the conversation so you can ask follow-up questions

It talks to Gemini through Google's Antigravity CLI (agy), so it uses your existing Antigravity account and plan. You don't need a separate API key.


What you need

  • Python 3.10 or newer and git

  • Antigravity CLI (agy) installed and signed in once (run agy in a terminal and finish the login)

  • Claude Code (or any other app that supports MCP servers), if you want Claude to use it

  • Calls use up your Antigravity plan's quota

Alpha status: It's tested for real on Windows 11 (agy 1.5.18–1.5.20). The automated tests run on Windows, macOS, and Linux, but real Gemini calls haven't been tried on macOS/Linux yet. After setup, gemini-bridge doctor --live tells you whether it works on your machine.


Setup

Easiest way: let Claude Code set it up

  1. Sign in to agy yourself first. Open a terminal, run agy, and finish the login. Claude can't do this part for you because it's an interactive login.

  2. Paste this into Claude Code:

Set up gemini-bridge (https://github.com/IAbhishekJhaI/gemini-bridge) for me:
1. Check that Python 3.10+, git and the Antigravity CLI (agy) are on my PATH.
   If agy is missing or not signed in, stop and tell me — I'll sign in myself.
2. Clone the repo and install it with `pipx install .`. If pipx isn't installed,
   don't install it into my global or user Python (it can upgrade packages other
   tools depend on): put pipx in its own venv, or install gemini-bridge into a
   dedicated venv and put its script on my PATH.
3. Run `gemini-bridge doctor --live` and show me the result. Stop if any check fails.
4. Register it: `claude mcp add --scope user gemini-bridge -- gemini-bridge mcp`
5. Set MCP_TOOL_TIMEOUT=600000 persistently for my OS and shell.
Leave agent mode off. When done, tell me to restart Claude Code.
  1. Restart Claude Code completely (quit and reopen) so it picks up the new tools and the timeout.

  2. Ask it something like "Get a second opinion from Gemini on this file".

Manual way

Step 1: Install it

git clone https://github.com/IAbhishekJhaI/gemini-bridge.git
cd gemini-bridge
pipx install .

pipx puts the tool in its own little sandbox so it can't clash with your other Python stuff. Don't have pipx? Install it the way pipx's docs suggest for your system (e.g. scoop install pipx on Windows, brew install pipx on macOS, sudo apt install pipx on Ubuntu). Avoid pip install --user pipx into the Python your other projects use: it can upgrade packages those projects depend on and break them. (pip install . also works, but it installs into whatever Python is active.)

Step 2: Check it works

gemini-bridge doctor --live

This makes two short real calls to Gemini (they count against your quota):

  1. A simple "are you there?" call, which also checks that Gemini has no tools available.

  2. A test where Gemini is asked to write a file and run a command. Both must fail. You want to see write_file=ERROR, run_command=ERROR.

Every line should say [PASS].

Step 3: Connect it to Claude Code

claude mcp add --scope user gemini-bridge -- gemini-bridge mcp

Step 4: Give Gemini enough time to answer

Gemini can take anywhere from 15 seconds to a few minutes on a big question, which is longer than Claude Code waits by default. Raise the limit to 10 minutes:

  • Windows (PowerShell): setx MCP_TOOL_TIMEOUT 600000

  • macOS / Linux: add export MCP_TOOL_TIMEOUT=600000 to your ~/.zshrc or ~/.bashrc

Step 5: Restart Claude Code and check it's connected:

claude mcp get gemini-bridge

It should say Connected. Claude Code runs the bridge inside whatever project folder you open, so Gemini can only be shown files from that project.

{
  "mcpServers": {
    "gemini-bridge": {
      "command": "gemini-bridge",
      "args": ["mcp"],
      "env": {
        "GEMINI_BRIDGE_WORKSPACE": "/path/to/project"
      }
    }
  }
}

Using it

From Claude Code (normal way)

Just ask in plain English. Claude picks the right tool:

You say something like…

Claude uses

"Ask Gemini what it thinks of this plan / file / idea"

ask_gemini

"Have Gemini review my changes" / "…since main"

review_changes

"Continue that Gemini conversation"

ask_gemini with the same thread_id

"What review styles does Gemini have?"

list_profiles

"Show me the whole Gemini conversation"

get_thread

None of these change your project. The bridge only writes to its own folder (logs and saved conversations).

Gemini's answer is advice, not approval. Treat it like one extra reviewer's opinion.

From your terminal

# Ask a question, with a file attached
gemini-bridge ask "Is a single Postgres table with row locks enough to prevent double-spend?" -f docs/adr-007.md

# Ask a follow-up in the same conversation
gemini-bridge ask "What would you change first?" --thread t-20261128T101500Z-a1b2c3

# Review your uncommitted changes
gemini-bridge review

# Security-focused review of a branch compared to main
gemini-bridge review --base main --head feature/x -p security-review --focus "token handling"

# Look around
gemini-bridge profiles     # list review styles
gemini-bridge threads      # list saved conversations
gemini-bridge log          # see the call log
gemini-bridge config       # see your current settings
gemini-bridge doctor --live

Add --json for machine-readable output. Exit codes: 0 OK, 1 something went wrong on Gemini's side, 2 the bridge refused the request.


Profiles (review styles)

A profile tells Gemini how to answer, and what format the answer must be in.

Profile

Good for

What you get back

ask (default)

General questions

answer, key points, risks, open questions

chat

Free-form chat

plain Markdown

design-review

"Which approach is better?"

recommendation, reasoning, alternatives with pros/cons, risks

code-review (default for reviews)

Reviewing changes

verdict (approve / request_changes / comment), summary, findings (file, line, severity, issue, fix)

security-review

Security checks

same as code-review, focused on security

Create <config-dir>/profiles/<name>/ with:

  • profile.json: {"kind": "ask" | "review", "description": "...", "schema": "schema.json" | null}

  • prompt.md: the prompt template. Wrap untrusted parts in tags that use {nonce}. Must include {question} (for ask) or {diff} (for review).

  • schema.json (optional): a JSON Schema with top-level "type": "object". Stick to type, properties, required, enum, items, and additionalProperties.

Placeholders you can use:

  • ask: {question} {files} {omitted} {thread} {round} {max_rounds} {nonce}

  • review: {diff} {files} {omitted} {focus} {base} {head} {nonce}

Easiest start: copy a built-in one from src/gemini_bridge/profiles/.

Who wins: your own profiles can replace built-in ones. A repo can ship extra profiles in <repo>/.gemini-bridge/profiles/, but those can only add new names. They can never replace built-in or your own profiles.


Agent mode (optional)

Normally Gemini can only read and answer. Agent mode lets Gemini actually do things, like build a UI component, run your tests, or open your app in a browser, click around, and take screenshots.

To keep that safe:

  • Gemini works in a separate copy of your project (a git worktree on a branch called gemini/<id>). Your real files aren't touched.

  • Every single action Gemini tries (read a file, run a command, open a page) is checked against a strict allow-list first. Anything not allowed is blocked.

  • The browser it uses is a fresh, headless Chrome that can only visit your own machine (localhost).

  • Nothing lands in your project until you (or Claude) look at the changes and run agent_apply.

Turn it on by adding this to your user config file (see Settings for where it lives). A project can't turn it on for you:

{
  "agent": {
    "enabled": true
  }
}

Then restart Claude Code. Try:

  • "Have Gemini add a dark-mode toggle to the header, then review its diff"

  • "Start the dev server and have Gemini test the signup flow and share screenshots"

How a session goes:

agent_start ──► agent_wait (repeat until done) ──► look at report, agent_diff, agent_artifacts
                                                        │
                      needs changes? ──► agent_send ────┘
                      looks good?    ──► agent_apply ──► agent_close

⚠️ Read SECURITY.md before turning this on. Gemini is allowed to run your build/test commands, and it can edit the files those commands run (like package.json scripts). Only use agent mode on projects you trust, and always look at the diff before applying it.

Tool

What it does

agent_start(task, profile?, base?, files?, url?, serve?, model?)

Makes the separate copy (worktree) on gemini/<id> and starts Gemini in the background. Returns right away.

agent_wait(session_id, since?, timeout_s?)

Waits (up to wait_cap_s, default 120s) and returns what happened: messages, steps, blocked actions, plan, final report. Call again with next_since until it's idle.

agent_status(session_id)

Current state, report, number of changed files, number of blocked actions.

agent_send(session_id, message)

Send feedback or a follow-up instruction (wakes the worker back up if it went idle).

agent_diff(session_id, full?)

Show what Gemini changed.

agent_artifacts(session_id)

List screenshots and output files so Claude can look at them.

agent_apply(session_id, three_way?)

Copy Gemini's changes into your real project (doesn't commit).

agent_cancel(session_id)

Stop the current work but keep the copy around to inspect.

agent_close(session_id, keep_branch?)

End the session and delete the copy (optionally save the changes onto gemini/<id> first).

agent_list(all_workspaces?)

List sessions and their states.

gemini-bridge agent start -p ui-build "Add a dark-mode toggle to the header" \
  --serve "npm run dev" --url http://localhost:5173/
gemini-bridge agent wait <session_id> --follow
gemini-bridge agent diff <session_id>
gemini-bridge agent send <session_id> "Use the existing Button component instead of a raw <button>"
gemini-bridge agent apply <session_id>
gemini-bridge agent close <session_id>

Profile

What it's for

Final report has

ui-build (default)

Build UI in the copy, run the project's checks, optionally look at it in the browser

summary, files_changed, commands_run, how_to_verify, screenshots, open_issues

ui-test

Click through the app in a browser and take screenshots. Can only write to .gemini-bridge-artifacts/

verdict, summary, findings, coverage, screenshots, blockers

agent

General coding tasks

same as ui-build

Every step Gemini takes goes through the bridge's PreToolUse hook (if the hook fails, the step is blocked), inside a throwaway HOME:

  • File reads/writes only inside the copy (never .git or anything in deny_paths).

  • Commands only from allow_commands: no shell operators, no git push, no package installs.

  • Browser: a bridge-launched headless Chrome with a fresh profile, local network only.

  • strict: true (default): if any step ever ran without going through the hook, the session is cancelled and marked failed.

Key

Default

What it does

enabled

false

Turns agent tools on (user config only).

model, effort

gemini-4-neon-high, high

Which Gemini model and how hard it thinks.

max_sessions

2

How many sessions can run at once.

turn_timeout_s, session_timeout_s, idle_timeout_s

900, 3600, 900

Time limits in seconds. Idle workers stop and wake up again on agent_send.

wait_cap_s

120

Longest a single agent_wait waits (keep it below MCP_TOOL_TIMEOUT).

allow_commands, deny_commands

build/test/git-read; push/installs

Command patterns (* at the end = wildcard). deny_commands always wins.

allow_hosts

["localhost", "127.0.0.1", "[::1]"]

Hosts the browser and fetches may visit.

link_dirs

["node_modules"]

Folders linked into the copy so builds work without reinstalling.

browser, browser_headless, browser_executable

true, true, null (auto)

Browser on/off, hidden window, custom Chrome path.

allow_web_search, allow_subagents

false

Loosen the rules on purpose.

strict

true

Fail the session if any step skipped the safety hook.

mcp_servers

[]

Extra MCP servers to pass into each session.

Sessions and their copies live in <state_dir>/agent/sessions/<id>/ and <state_dir>/agent/worktrees/<id>/.


Settings

You don't need to change anything; the defaults work. If you want to, your settings file is here:

  • Windows: %APPDATA%\gemini-bridge\config.json

  • macOS / Linux: ~/.config/gemini-bridge/config.json

  • Or anywhere you like: point $GEMINI_BRIDGE_CONFIG at it

Example (every key is optional):

{
  "default_advisor": "gemini",
  "advisors": {
    "gemini": { "model": "gemini-4-neon-high", "effort": "high", "timeout_s": 600 },
    "fast":   { "model": "gemini-4-neon-low",  "effort": "low",  "timeout_s": 180 }
  },
  "default_profile": "ask",
  "max_rounds": 10,
  "max_context_bytes": 400000,
  "deny_paths": [".git", ".env*", "*.pem", "*.key", "id_rsa*"],
  "extra_deny": [],
  "log_outputs": true
}

Key

What it does

advisors.<name>

command (default ["agy"]), model (see agy models), effort, timeout_s, fresh_profile (true), minimal_env (true), env_passthrough, copy_from_home, sandbox_flag (true).

deny_paths

File patterns that are never sent to Gemini, not even inside a diff. Built-in list covers .git, .env*, keys, keystores, and credential files. Setting this key replaces the list.

extra_deny

Extra Antigravity permission deny rules. The built-in lockdown rules can't be removed.

max_rounds

Max back-and-forth rounds in one conversation (default 10).

max_context_bytes, max_prompt_bytes

Size limits for attached context and the whole prompt (400000 / 500000).

retries

How many times to re-ask if Gemini replies in the wrong format (default 1).

log_outputs

Also save Gemini's replies in the log (default true).

state_dir

Where logs, conversations, and agent sessions are stored. Default %LOCALAPPDATA%\gemini-bridge (Windows) or ~/.local/state/gemini-bridge (or $GEMINI_BRIDGE_STATE_DIR).

Project settings (<project>/.gemini-bridge.json) can only make things stricter: default_profile, default_review_profile, default_advisor, a lower max_rounds, turning review_include_files off, and adding to deny_paths / extra_deny. Everything else (including agent and advisors) is ignored with a warning, so a repo you downloaded can't weaken the safety settings or swap in a different command.


When something goes wrong

Every answer comes with a status. Here's what they mean:

Status

What happened

What to do

OK

Got a valid answer.

Nothing.

ADVISOR_ERROR

agy failed: not installed, not signed in, out of quota, etc.

Run agy in a terminal and check you're signed in; run gemini-bridge doctor --live.

TIMEOUT

Gemini took too long and was stopped.

Ask a smaller question, or raise timeout_s in settings.

SCHEMA_INVALID

Gemini answered in the wrong format, even after one retry.

Try again, or use the chat profile for free-form answers.

CONTAINMENT_VIOLATION

A tool ran (or tools got loaded) even though everything should be blocked. The answer was thrown away and not retried.

Don't ignore it: check SECURITY.md and open an issue with gemini-bridge log output.

SAFETY_FILTER

Google's safety filter blocked the prompt.

Rephrase the question.

BUSY

Another Gemini call was already running too long.

Wait and retry. The bridge runs one call at a time.

ROUND_LIMIT_EXCEEDED

The conversation hit max_rounds.

Start a new conversation.

NO_CHANGES

Nothing to review.

Make sure you have changes, or pick a different base/head.

REJECTED

The bridge refused: bad path, a secret file, unknown profile, or too big.

Check the message; it says why.

Claude doesn't see the Gemini tools? Fully restart Claude Code, then run claude mcp get gemini-bridge. It should say Connected.

Claude says the tool call timed out, but Gemini was still thinking? MCP_TOOL_TIMEOUT isn't set (or Claude Code wasn't restarted after setting it). See setup Step 4.


More docs


For contributors

python -m venv .venv
.venv/bin/pip install -e .                 # Windows: .venv\Scripts\pip install -e .
python -m unittest discover -s tests -v    # offline tests (use a fake agy, no Gemini calls)
python tests/live_check.py                 # real check against Gemini
python scripts/probe_acp.py --hook --chrome # re-test agy ACP, hooks, and browser

Want to add another AI besides Gemini? Subclass gemini_bridge.adapters.base.Adapter and register it in src/gemini_bridge/adapters/__init__.py.

License

MIT

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      B
      quality
      Not graded
      maintenance
      Enables MCP-compatible AI clients like Claude Code, Cursor, and Codex to invoke Google Antigravity's Gemini coding agent for repository-aware file operations, command execution, code review, test generation, and quota checks, while also providing a standalone dual-mode CLI.
      7
      MIT
    • A
      license
      B
      quality
      C
      maintenance
      Enables MCP clients such as Claude Code and Cursor to delegate long multi-step coding tasks to Google Antigravity CLI, generate read-only plans and code reviews, digest large codebases, and manage background sessions in isolated git worktrees.
      15
      152 npm
      2
      MIT