Gemini CLI Engine

Google's open-source AI agent CLI, now available as a QuantumReef engine. Gemini CLI brings an industry-leading 1 million token context window, native multimodal input, and deep Google Cloud integration — all surfaced inside the unified QuantumReef session UI.

Overview

Gemini CLI is Google's open-source terminal agent powered by the Gemini model family. Released in mid-2024, it rapidly became one of the most downloaded AI coding tools on npm, thanks to its exceptional context window, competitive free tier, and tight integration with Google Cloud services. It supports reading and writing files, executing shell commands, web browsing via Google Search, and native image and PDF analysis — all from the command line.

QuantumReef integrates Gemini CLI via its --json_output flag, capturing structured tool calls and model responses into the unified QuantumReef session UI. The GeminiCliClient adapter manages the subprocess lifecycle, streams JSON events line-by-line into QuantumReef's message bus, and maps each event to a standard QuantumReef message type: text, tool_call, tool_result, or error.

The standout feature of the Gemini CLI engine is its 1 million token context window (Gemini 2.5 Pro). You can load entire codebases, lengthy documentation sets, verbose log files, or multi-thousand-page PDF specs directly into context — no chunking, no retrieval pipelines, no vector databases required.

Free tier available

Gemini CLI offers a generous free tier via Google AI Studio API keys — up to 1,000 requests per day on Gemini 2.5 Flash and 50 requests per day on Gemini 2.5 Pro. No billing account or credit card required to get started. For teams, the pay-as-you-go pricing on Flash is among the lowest in the industry.

How QuantumReef Wraps Gemini CLI

QuantumReef's GeminiCliClient adapter invokes Gemini CLI as a managed subprocess for each prompt session. Rather than running a persistent server, Gemini CLI is spawned on demand and communicates through structured JSON output streamed over stdout.

bash
# The invocation pattern QuantumReef uses internally
gemini \
  --json_output \
  --model gemini-2.5-pro \
  --yolo \
  "Your prompt here"

Subprocess Management

The adapter spawns Gemini CLI with --yolo (auto-approve mode) when QuantumReef's permission mode is set to allow, or with interactive approval routing when set to prompt. In prompt mode, QuantumReef intercepts permission requests from the subprocess and surfaces them as in-app approval dialogs — you never need to switch to a terminal window to unblock an agent.

Streaming

Gemini CLI emits newline-delimited JSON events as the model generates output. QuantumReef reads these events in real time and renders them in the session panel before the subprocess exits. Tool calls appear in the MCP Tools Panel as they are invoked, giving you live visibility into what the agent is doing at each step.

Session Continuity

Gemini CLI stores conversation context in ~/.gemini/tmp/. QuantumReef persists the session ID alongside the QuantumReef session record and passes it back to Gemini CLI on resume, maintaining full conversation history across multiple prompt turns within a single QuantumReef session.

Installation

Install Gemini CLI

bash
# Install globally via npm
npm install -g @google/gemini-cli

# Verify installation
gemini --version
# gemini-cli/0.1.x linux-x64 node-v22.x.x

Enable in QuantumReef

Navigate to Settings → Engines → Gemini CLI and toggle the engine on. QuantumReef auto-detects the gemini binary from your PATH. If you maintain multiple Gemini CLI versions, you can pin a specific binary path in the engine settings.

Authentication

Gemini CLI supports three authentication strategies. Choose the one that fits your situation:

Option A: Google Account OAuth (recommended for individuals)

The simplest path. Opens a browser window and authenticates with your personal Google account. Grants access to the free tier automatically, with no API key management required.

bash
# Launches browser for Google OAuth
gemini auth login

# Confirm authentication succeeded
gemini auth status
# ✓ Authenticated as user@gmail.com (oauth-personal)

Option B: API Key from Google AI Studio

Suitable for CI environments, headless servers, or when you need programmatic key rotation. Generate an API key at aistudio.google.com/apikey and export it into your environment.

bash
# Set for the current session
export GEMINI_API_KEY=AIzaSy...

# Add to your shell profile for persistence
echo 'export GEMINI_API_KEY=AIzaSy...' >> ~/.zshrc

# QuantumReef reads this variable automatically
# when the Gemini CLI engine is active

Option C: Google Cloud Vertex AI (enterprise)

For organisations with existing Google Cloud infrastructure and compliance requirements. Routes all traffic through your GCP project, enabling VPC Service Controls, audit logging, and enterprise SLAs. Requires a Google Cloud project with the Vertex AI API enabled and a service account key.

bash
# Required environment variables for Vertex AI auth
export GOOGLE_CLOUD_PROJECT=my-gcp-project-id
export GOOGLE_CLOUD_LOCATION=us-central1
export GOOGLE_APPLICATION_CREDENTIALS=/path/to/service-account-key.json

# Or use Application Default Credentials (ADC) via gcloud CLI
gcloud auth application-default login
gcloud config set project my-gcp-project-id

# Tell Gemini CLI to use Vertex AI instead of AI Studio
export GEMINI_AUTH_TYPE=vertex-ai

Vertex AI billing

Vertex AI uses your GCP billing account. Gemini 2.5 Pro on Vertex is priced per million input and output tokens. Enable budget alerts in the GCP Console to avoid unexpected charges during long agentic sessions with the 1M context window.

Configuration

SettingDefaultDescription
Modelgemini-2.5-proModel variant. gemini-2.5-flash is ~10× faster for simple tasks.
Context Window1,000,000Token budget available. Gemini 2.5 Pro supports the full 1M.
Max Output Tokens8192Maximum tokens in a single model response turn.
Working DirectoryWorkspace rootDirectory Gemini CLI operates within for file I/O.
Sandbox ModefalseRun the Bash tool inside a sandboxed container environment.
Core ToolsAll built-inComma-separated list of tool names to enable for the session.
TelemetryfalseSend anonymous usage data to Google. Disabled by default.
Auth Typeoauth-personalOne of: oauth-personal, api-key, vertex-ai.

Gemini CLI Settings File

The global settings file lives at ~/.gemini/settings.json. QuantumReef writes engine configuration changes to this file when you adjust settings via the UI.

~/.gemini/settings.json
{
  "theme": "dark",
  "selectedAuthType": "oauth-personal",
  "model": "gemini-2.5-pro",
  "sandbox": false,
  "telemetry": false,
  "coreTools": [
    "read_file",
    "write_file",
    "run_shell_command",
    "web_search",
    "web_fetch",
    "glob",
    "grep"
  ],
  "mcpServers": {
    "filesystem": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-filesystem", "/home/user"]
    }
  }
}

Per-workspace Override

Create a .gemini/settings.json in your project root to override global settings for that workspace only. QuantumReef detects and respects this file automatically when the Gemini CLI engine is active, applying it on top of the global config. This is useful for restricting tools on sensitive repositories or switching to a faster model for a frontend-only project.

.gemini/settings.json
{
  "model": "gemini-2.5-flash",
  "sandbox": true,
  "coreTools": [
    "read_file",
    "write_file",
    "run_shell_command"
  ]
}

Multimodal Input

Gemini CLI accepts images, PDFs, and video frames alongside text prompts. In QuantumReef, you can drag-and-drop files into the session input area when the Gemini CLI engine is active. The files are passed directly to the model as part of the prompt — no preprocessing or external pipeline required. Supported formats:

FormatExtensionsUse Case
Raster imagesPNG, JPG, JPEG, WebP, GIFUI mockups, screenshots, error dialogs, handwritten diagrams
Vector graphicsSVGArchitecture diagrams, flowcharts, entity relationship diagrams
DocumentsPDFTechnical specifications, API docs, research papers, design documents
Video (first 60s)MP4, WebM, MOVScreen recordings, bug reproduction videos, demo walkthroughs
AudioMP3, WAV, FLAC, AACMeeting recordings, voice memos, verbal requirements

UI-to-code workflow

Drag a Figma screenshot or design mockup into QuantumReef and prompt Gemini CLI to implement it as a component in your framework of choice. Because the 1M context window lets you include your entire codebase alongside the image, the generated component will automatically match your project's conventions, naming patterns, and existing utility classes — no copy-pasting of style guides required.

Google Ecosystem Tools

When authenticated via a Google account or Vertex AI, Gemini CLI gains access to Google-specific tools beyond the standard file and shell primitives. QuantumReef surfaces all of these in the MCP Tools Panel alongside Gemini's native tools, so you can review and approve each invocation in the session UI:

ToolRequiresDescription
google_searchGoogle account or API keyReal-time web search with cited sources. Results include URL, title, and snippet.
google_drive_readGoogle account + Drive scopeRead files directly from Google Drive by ID or search query. Supports Docs, Sheets, PDFs.
google_docs_writeGoogle account + Drive scopeCreate new Google Docs or update existing ones by document ID.
vertex_ai_predictVertex AI auth + IAM roleCall any Vertex AI endpoint — custom models, AutoML, or Foundation Model APIs.
bigquery_queryVertex AI auth + BigQuery roleExecute read-only SQL against any BigQuery dataset in your GCP project.

OAuth scope approval

The first time Gemini CLI requests Drive or Docs access, Google will prompt you to approve the additional OAuth scope in the browser. QuantumReef surfaces this prompt as an in-app notification rather than silently failing the tool call.

MCP Server Integration

Gemini CLI supports the Model Context Protocol (MCP) via its mcpServers configuration key. QuantumReef reads this configuration at session start and displays all active MCP servers and their exposed tools in the Tools Panel, alongside Gemini's native built-in tools. This means you get a single, unified view of every capability available to the agent — native tools and MCP tools — without needing to cross-reference separate config files.

bash
# Register an MCP server via Gemini CLI's built-in command
gemini mcp add filesystem \
  --command "npx -y @modelcontextprotocol/server-filesystem /workspace"

# Register a custom MCP server running over HTTP/SSE
gemini mcp add my-api-server \
  --url http://localhost:3100/mcp

# List all currently registered MCP servers
gemini mcp list
# filesystem   npx -y @modelcontextprotocol/server-filesystem /workspace  ● running
# my-api-server  http://localhost:3100/mcp                                  ● running

# Remove a server
gemini mcp remove my-api-server

MCP servers registered via gemini mcp add are written to the mcpServers block in ~/.gemini/settings.json and are automatically available in every QuantumReef session that uses the Gemini CLI engine. Per-workspace .gemini/settings.json files can define additional servers scoped to that project without polluting the global list.

When to Choose Gemini CLI

Use CaseWhy Gemini CLI Excels
Whole-codebase analysis1M token context — load entire monorepos without chunking, retrieval, or vector databases.
Multimodal tasksNative image, PDF, audio, and video input in a single prompt with no external pipeline.
Google Cloud projectsNative BigQuery, Vertex AI, Google Drive, and Docs integration via dedicated tools.
Cost-sensitive teamsGenerous free tier; Flash models are among the most affordable in the industry per token.
Real-time web researchBuilt-in Google Search tool returns cited, real-time results the model can reason over.
Document-heavy workflowsPDFs and long-form docs load directly into context; no chunking or summarisation loss.
Open-source preferenceGemini CLI is fully open-source under Apache 2.0 — inspect, fork, and extend freely.

Limitations

  • No persistent server process — each prompt spawns a new subprocess (~200–400ms startup overhead on cold start).
  • The 1M context window is only available on Gemini 2.5 Pro; Flash models are capped at 1M tokens but practical limits depend on tier.
  • Video input is trimmed to the first 60 seconds; longer recordings must be trimmed before passing to the engine.
  • Google Drive and Docs tools require OAuth re-approval if token refresh fails (automatic re-prompt in QuantumReef UI).
  • Fractal Agent Orchestration is not supported — use the RovoDev engine for multi-agent workflows.
  • The Consciousness Panel is exclusive to RovoDev sessions and is not available for Gemini CLI.
  • Sandbox mode uses a Docker container and requires the Docker daemon to be running on the Host machine.
  • BigQuery queries are read-only by default; write access requires explicit IAM role grants and tool config changes.