Gemini-cli is awesome. Having modified it to use the Claude models, we can do a bit more of a direct comparison of the agent scaffolds to see how it stacks up to Claude Code on the same task.
Fun freebie: Gemini-cli made this about itself using Opus!
Gemini CLI Architecture: Core vs CLI Abstraction
This document provides a detailed breakdown of how three different AI agent scaffolding systems, all using the same underlying model, approached and solved a nuanced bug in a command-line interface (CLI) tool.
The task was to investigate and fix a suspected bug in a gemini-cli, Node.js CLI tool. The problem was two-fold:
/model claude-opus-4-0 command), the underlying logic did not seem to update correctly.The core of the issue was a state management and initialization problem: the application was not correctly re-initializing its API client when the model configuration changed, especially when this change required switching between entirely different backend providers.
All three agents correctly identified a core set of files as central to the problem. Understanding their roles is key to understanding the agents' actions.
packages/core/src/config/config.ts: The Brain. This class is the central configuration hub. It holds the current model name, the selected authentication method, and, crucially, the singleton instance of the GeminiClient. The setModel() and getModel() methods reside here.packages/core/src/core/client.ts: The Engine. This class orchestrates the API calls. It holds an instance of a ContentGenerator and is responsible for sending prompts to the backend. It is initialized once and held by the Config object.packages/core/src/core/contentGenerator.ts: The Factory. This file contains the logic (createContentGenerator) that decides which provider-specific SDK to use. It inspects the model name and auth type to return either a GoogleGenAI instance or a custom AnthropicAdapter.packages/cli/src/ui/hooks/slashCommandProcessor.ts: The User Interface. This file implements the CLI's slash commands. The /model command logic, which calls config.setModel(), is defined here.packages/cli/src/gemini.tsx: The Entry Point. This is the main application entry point, responsible for parsing arguments, loading the initial configuration, and handling the non-interactive execution flow.