Table of Contents

Gemini CLI

Gemini CLI is Google's open-source AI agent that brings the power of Gemini directly into the terminal. Built in TypeScript under the Apache 2.0 license, it leverages Google's Gemini models with a massive 1M-token context window to help developers write, debug, and understand code from the command line. With over 98,000 GitHub stars, it is one of the most popular CLI coding agents in the ecosystem.1)2)3)

GitHub: google-gemini/gemini-cli | Website: https://geminicli.com4)

Key Features

Architecture

Gemini CLI is structured as a monorepo with multiple packages:

Usage Example

# Install globally via npm
npm install -g @anthropic-ai/gemini-cli
 
# Start interactive session in a project
cd my-project
gemini
 
# Use with a direct prompt
gemini "explain the authentication flow in this codebase"
 
# Use Plan Mode for complex changes
gemini "refactor the database layer to use connection pooling" --plan

How It Works

graph TD A[User Prompt] --> B[Gemini CLI Agent Loop] B --> C{Plan Mode?} C -->|Yes| D[Analysis Phase - Read Only] D --> E[Generate Action Plan] E --> F[User Approval] F --> G[Execution Phase] C -->|No| G G --> H[Tool Selection] H --> I[File Edit Tool] H --> J[Shell Execution Tool] H --> K[Search Tool] H --> L[MCP Tool Bridge] I --> M[Apply Changes] J --> M K --> M L --> M M --> N[Stream Response to Terminal] N --> B

Comparison

Feature Gemini CLI Claude Code
Context Window 1M tokens 200K tokens
Language TypeScript TypeScript
License Apache 2.0 Proprietary
Model Lock-in Gemini only Claude only
MCP Support Yes Yes
Plan Mode Yes Yes
GitHub Stars ~99K N/A

See Also

References