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
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.
# 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
# Install globally via npm
npm install -g @google/gemini-cli
# Verify installation
gemini --version
# gemini-cli/0.1.x linux-x64 node-v22.x.xEnable 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.
# 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.
# 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 activeOption 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.
# 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-aiVertex AI billing
Configuration
| Setting | Default | Description |
|---|---|---|
| Model | gemini-2.5-pro | Model variant. gemini-2.5-flash is ~10× faster for simple tasks. |
| Context Window | 1,000,000 | Token budget available. Gemini 2.5 Pro supports the full 1M. |
| Max Output Tokens | 8192 | Maximum tokens in a single model response turn. |
| Working Directory | Workspace root | Directory Gemini CLI operates within for file I/O. |
| Sandbox Mode | false | Run the Bash tool inside a sandboxed container environment. |
| Core Tools | All built-in | Comma-separated list of tool names to enable for the session. |
| Telemetry | false | Send anonymous usage data to Google. Disabled by default. |
| Auth Type | oauth-personal | One 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.
{
"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.
{
"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:
| Format | Extensions | Use Case |
|---|---|---|
| Raster images | PNG, JPG, JPEG, WebP, GIF | UI mockups, screenshots, error dialogs, handwritten diagrams |
| Vector graphics | SVG | Architecture diagrams, flowcharts, entity relationship diagrams |
| Documents | Technical specifications, API docs, research papers, design documents | |
| Video (first 60s) | MP4, WebM, MOV | Screen recordings, bug reproduction videos, demo walkthroughs |
| Audio | MP3, WAV, FLAC, AAC | Meeting recordings, voice memos, verbal requirements |
UI-to-code workflow
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:
| Tool | Requires | Description |
|---|---|---|
| google_search | Google account or API key | Real-time web search with cited sources. Results include URL, title, and snippet. |
| google_drive_read | Google account + Drive scope | Read files directly from Google Drive by ID or search query. Supports Docs, Sheets, PDFs. |
| google_docs_write | Google account + Drive scope | Create new Google Docs or update existing ones by document ID. |
| vertex_ai_predict | Vertex AI auth + IAM role | Call any Vertex AI endpoint — custom models, AutoML, or Foundation Model APIs. |
| bigquery_query | Vertex AI auth + BigQuery role | Execute read-only SQL against any BigQuery dataset in your GCP project. |
OAuth scope approval
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.
# 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-serverMCP 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 Case | Why Gemini CLI Excels |
|---|---|
| Whole-codebase analysis | 1M token context — load entire monorepos without chunking, retrieval, or vector databases. |
| Multimodal tasks | Native image, PDF, audio, and video input in a single prompt with no external pipeline. |
| Google Cloud projects | Native BigQuery, Vertex AI, Google Drive, and Docs integration via dedicated tools. |
| Cost-sensitive teams | Generous free tier; Flash models are among the most affordable in the industry per token. |
| Real-time web research | Built-in Google Search tool returns cited, real-time results the model can reason over. |
| Document-heavy workflows | PDFs and long-form docs load directly into context; no chunking or summarisation loss. |
| Open-source preference | Gemini 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.